Elin Modding Docs Doc
Loading...
Searching...
No Matches
Recipe.cs
1using System;
2using System.Collections.Generic;
3using System.Runtime.CompilerServices;
4using Newtonsoft.Json;
5using UnityEngine;
6using UnityEngine.UI;
7
8// Token: 0x02000058 RID: 88
9public class Recipe : EClass
10{
11 // Token: 0x060001F8 RID: 504 RVA: 0x000100E8 File Offset: 0x0000E2E8
12 public static Recipe GetOrCreate(string id)
13 {
14 Recipe recipe = Recipe.recipeCache.TryGetValue(id, null);
15 if (recipe == null)
16 {
17 RecipeSource recipeSource = RecipeManager.dict.TryGetValue(id, null);
18 if (recipeSource != null)
19 {
20 recipe = Recipe.Create(recipeSource, -1, null);
21 Recipe.recipeCache.Add(id, recipe);
22 }
23 }
24 return recipe;
25 }
26
27 // Token: 0x060001F9 RID: 505 RVA: 0x0001012C File Offset: 0x0000E32C
28 public static Recipe Create(RecipeSource _source, int idMat = -1, Thing ing = null)
29 {
30 string type = _source.type;
31 Recipe recipe = _source.isBridgePillar ? new RecipeBridgePillar() : (type.IsEmpty() ? new RecipeCard() : ((type == "Custom") ? new RecipeCustom() : new Recipe()));
32 recipe.id = _source.id;
33 recipe._source = _source;
34 recipe.idMat = idMat;
35 if (ing != null)
36 {
37 recipe.BuildIngredientList(ing);
38 if (ing.trait is TraitTile)
39 {
40 recipe.VirtualBlock = true;
41 }
42 }
43 return recipe;
44 }
45
46 // Token: 0x060001FA RID: 506 RVA: 0x000101B4 File Offset: 0x0000E3B4
47 public static Recipe Create(Thing t)
48 {
49 RecipeSource recipeSource = RecipeManager.dict.TryGetValue(t.id, null);
50 if (recipeSource == null)
51 {
52 return null;
53 }
54 RecipeCard recipeCard = new RecipeCard
55 {
56 id = recipeSource.id,
57 _source = recipeSource,
58 IngAsProduct = true,
59 idSkin = t.idSkin
60 };
61 recipeCard.BuildIngredientList(t);
62 if (t.uid == 0 || recipeCard.ingredients[0].uid == 0 || recipeCard.ingredients[0].thing == null)
63 {
64 Debug.LogError("expection: invalid ingredient " + ((t != null) ? t.ToString() : null));
65 }
66 return recipeCard;
67 }
68
69 // Token: 0x060001FB RID: 507 RVA: 0x00010258 File Offset: 0x0000E458
70 public static void DropIngredients(string id, string idMatMain, int num = 1)
71 {
72 RecipeManager.BuildList();
73 Recipe orCreate = Recipe.GetOrCreate(EClass.sources.cards.map[id].RecipeID);
74 orCreate.BuildIngredientList();
75 Msg.Say("dropReward");
76 foreach (Recipe.Ingredient ingredient in orCreate.ingredients)
77 {
78 Thing thing = ThingGen.Create(ingredient.id, -1, -1).SetNum(ingredient.req);
79 if (ingredient == orCreate.ingredients[0])
80 {
81 thing.ChangeMaterial(idMatMain);
82 thing.SetNum(num);
83 }
84 EClass.player.DropReward(thing, true);
85 }
86 }
87
88 // Token: 0x17000054 RID: 84
89 // (get) Token: 0x060001FC RID: 508 RVA: 0x00010320 File Offset: 0x0000E520
90 public RecipeSource source
91 {
92 get
93 {
94 RecipeSource result;
95 if ((result = this._source) == null)
96 {
97 result = (this._source = RecipeManager.Get(this.id));
98 }
99 return result;
100 }
101 }
102
103 // Token: 0x17000055 RID: 85
104 // (get) Token: 0x060001FD RID: 509 RVA: 0x0001034B File Offset: 0x0000E54B
105 public SourceMaterial.Row DefaultMaterial
106 {
107 get
108 {
109 return this.renderRow.DefaultMaterial;
110 }
111 }
112
113 // Token: 0x17000056 RID: 86
114 // (get) Token: 0x060001FE RID: 510 RVA: 0x00010358 File Offset: 0x0000E558
115 public virtual TileRow tileRow
116 {
117 get
118 {
119 return this.source.row as TileRow;
120 }
121 }
122
123 // Token: 0x17000057 RID: 87
124 // (get) Token: 0x060001FF RID: 511 RVA: 0x0001036A File Offset: 0x0000E56A
125 public virtual RenderRow renderRow
126 {
127 get
128 {
129 return this.source.row;
130 }
131 }
132
133 // Token: 0x17000058 RID: 88
134 // (get) Token: 0x06000200 RID: 512 RVA: 0x00010377 File Offset: 0x0000E577
135 public string Name
136 {
137 get
138 {
139 return this.GetName();
140 }
141 }
142
143 // Token: 0x17000059 RID: 89
144 // (get) Token: 0x06000201 RID: 513 RVA: 0x00010380 File Offset: 0x0000E580
145 public virtual TileType tileType
146 {
147 get
148 {
149 if (!(this.source.type == "Bridge") || this.source.row.tileType is TileTypeBridge)
150 {
151 return this.renderRow.tileType;
152 }
153 return TileType.Bridge;
154 }
155 }
156
157 // Token: 0x1700005A RID: 90
158 // (get) Token: 0x06000202 RID: 514 RVA: 0x000103CC File Offset: 0x0000E5CC
159 public virtual bool IsFloorOrBridge
160 {
161 get
162 {
163 return this.tileType.IsFloorOrBridge;
164 }
165 }
166
167 // Token: 0x1700005B RID: 91
168 // (get) Token: 0x06000203 RID: 515 RVA: 0x000103D9 File Offset: 0x0000E5D9
169 public int MaxAltitude
170 {
171 get
172 {
173 if (this.IsThing || this.IsBridge || this.tileType.blockRenderMode == BlockRenderMode.Pillar)
174 {
175 return this.tileType.MaxAltitude;
176 }
177 return 0;
178 }
179 }
180
181 // Token: 0x1700005C RID: 92
182 // (get) Token: 0x06000204 RID: 516 RVA: 0x00010406 File Offset: 0x0000E606
183 public int RecipeLv
184 {
185 get
186 {
187 return EClass.player.recipes.knownRecipes.TryGetValue(this.id, 0);
188 }
189 }
190
191 // Token: 0x1700005D RID: 93
192 // (get) Token: 0x06000205 RID: 517 RVA: 0x00010423 File Offset: 0x0000E623
193 public bool IsFloor
194 {
195 get
196 {
197 return this.tileType.IsFloor;
198 }
199 }
200
201 // Token: 0x1700005E RID: 94
202 // (get) Token: 0x06000206 RID: 518 RVA: 0x00010430 File Offset: 0x0000E630
203 public bool IsObj
204 {
205 get
206 {
207 return this.tileRow is SourceObj.Row;
208 }
209 }
210
211 // Token: 0x1700005F RID: 95
212 // (get) Token: 0x06000207 RID: 519 RVA: 0x00010440 File Offset: 0x0000E640
213 public virtual bool IsBlock
214 {
215 get
216 {
217 return !this.IsFloorOrBridge;
218 }
219 }
220
221 // Token: 0x17000060 RID: 96
222 // (get) Token: 0x06000208 RID: 520 RVA: 0x0001044B File Offset: 0x0000E64B
223 public bool IsWallOrFence
224 {
225 get
226 {
227 return this.tileType.IsWallOrFence;
228 }
229 }
230
231 // Token: 0x17000061 RID: 97
232 // (get) Token: 0x06000209 RID: 521 RVA: 0x00010458 File Offset: 0x0000E658
233 public bool IsBridge
234 {
235 get
236 {
237 return this.source.type == "Bridge";
238 }
239 }
240
241 // Token: 0x17000062 RID: 98
242 // (get) Token: 0x0600020A RID: 522 RVA: 0x0001046F File Offset: 0x0000E66F
243 public virtual bool IsThing
244 {
245 get
246 {
247 return false;
248 }
249 }
250
251 // Token: 0x17000063 RID: 99
252 // (get) Token: 0x0600020B RID: 523 RVA: 0x00010472 File Offset: 0x0000E672
253 public virtual Card Mold
254 {
255 get
256 {
257 return null;
258 }
259 }
260
261 // Token: 0x0600020C RID: 524 RVA: 0x00010478 File Offset: 0x0000E678
262 public bool IsStaticLV()
263 {
264 string idFactory = this.source.idFactory;
265 return idFactory == "factory_floor" || idFactory == "factory_block" || idFactory == "factory_wall" || idFactory == "factory_platform" || this.renderRow.Category.IsChildOf("block");
266 }
267
268 // Token: 0x0600020D RID: 525 RVA: 0x000104DC File Offset: 0x0000E6DC
269 public int GetQualityBonus()
270 {
271 if (this.IsStaticLV())
272 {
273 return 0;
274 }
275 Element reqSkill = this.source.GetReqSkill();
276 int num = reqSkill.Value - EClass.pc.Evalue(reqSkill.id);
277 int num2 = 0;
278 if (num <= 0)
279 {
280 num2 += EClass.curve(-num, 10, 20, 80) / 10 * 10 + 10;
281 if (this.RecipeLv > 0)
282 {
283 num2 += (int)Mathf.Sqrt((float)(this.RecipeLv - 1)) * 10;
284 }
285 return num2;
286 }
287 if (num < 5)
288 {
289 return 0;
290 }
291 return -(num - 4) * 10;
292 }
293
294 // Token: 0x17000064 RID: 100
295 // (get) Token: 0x0600020E RID: 526 RVA: 0x00010563 File Offset: 0x0000E763
296 public virtual int W
297 {
298 get
299 {
300 if (this._dir % 2 != 0)
301 {
302 return this.renderRow.H;
303 }
304 return this.renderRow.W;
305 }
306 }
307
308 // Token: 0x17000065 RID: 101
309 // (get) Token: 0x0600020F RID: 527 RVA: 0x00010586 File Offset: 0x0000E786
310 public virtual int H
311 {
312 get
313 {
314 if (this._dir % 2 != 0)
315 {
316 return this.renderRow.W;
317 }
318 return this.renderRow.H;
319 }
320 }
321
322 // Token: 0x17000066 RID: 102
323 // (get) Token: 0x06000210 RID: 528 RVA: 0x000105A9 File Offset: 0x0000E7A9
324 public virtual bool RequireIngredients
325 {
326 get
327 {
328 return true;
329 }
330 }
331
332 // Token: 0x06000211 RID: 529 RVA: 0x000105AC File Offset: 0x0000E7AC
333 public virtual int GetRefVal()
334 {
335 if (this.source.row is SourceBlock.Row)
336 {
337 return (this.source.row as SourceBlock.Row).id;
338 }
339 if (this.source.row is SourceFloor.Row)
340 {
341 return (this.source.row as SourceFloor.Row).id;
342 }
343 if (this.source.row is SourceObj.Row)
344 {
345 return (this.source.row as SourceObj.Row).id;
346 }
347 return -1;
348 }
349
350 // Token: 0x06000212 RID: 530 RVA: 0x00010634 File Offset: 0x0000E834
351 public virtual string GetIdThing()
352 {
353 if (this.source.row is SourceBlock.Row)
354 {
355 return (this.source.row as SourceBlock.Row).idThing;
356 }
357 if (this.source.row is SourceFloor.Row)
358 {
359 if (!this.IsBridge)
360 {
361 return "floor";
362 }
363 return "platform";
364 }
365 else
366 {
367 if (this.source.row is SourceObj.Row)
368 {
369 return "obj";
370 }
371 return null;
372 }
373 }
374
375 // Token: 0x17000067 RID: 103
376 // (get) Token: 0x06000213 RID: 531 RVA: 0x000106A8 File Offset: 0x0000E8A8
377 public bool MultiSize
378 {
379 get
380 {
381 return this.W != 1 || this.H != 1;
382 }
383 }
384
385 // Token: 0x06000214 RID: 532 RVA: 0x000106C1 File Offset: 0x0000E8C1
386 public virtual bool ShouldShowHighlight(HitResult r)
387 {
388 return r != HitResult.Valid;
389 }
390
391 // Token: 0x06000215 RID: 533 RVA: 0x000106CA File Offset: 0x0000E8CA
392 public BaseTileSelector.BoxType GetBoxType()
393 {
394 if (this.tileType.BoxType != BaseTileSelector.BoxType.Fence)
395 {
396 return BaseTileSelector.BoxType.Box;
397 }
398 return BaseTileSelector.BoxType.Fence;
399 }
400
401 // Token: 0x17000068 RID: 104
402 // (get) Token: 0x06000216 RID: 534 RVA: 0x000106DD File Offset: 0x0000E8DD
403 public BaseTileSelector tileSelector
404 {
405 get
406 {
407 return EClass.screen.tileSelector;
408 }
409 }
410
411 // Token: 0x06000217 RID: 535 RVA: 0x000106EC File Offset: 0x0000E8EC
412 public int GetDefaultColor()
413 {
414 if (this.UseStock)
415 {
416 Thing thing = this.ingredients[0].thing;
417 return this.renderRow.GetColorInt(thing.isDyed ? thing.DyeMat : thing.material);
418 }
419 return this.renderRow.GetColorInt(this.DefaultMaterial);
420 }
421
422 // Token: 0x06000218 RID: 536 RVA: 0x00010748 File Offset: 0x0000E948
423 public virtual SourceMaterial.Row GetMainMaterial()
424 {
425 int num = -1;
426 if (this.ingredients.Count > 0)
427 {
428 if (this.ingredients[0].thing != null)
429 {
430 num = this.ingredients[0].thing.material.id;
431 }
432 else
433 {
434 num = this.ingredients[0].mat;
435 }
436 }
437 if (num == -1)
438 {
439 num = 3;
440 }
441 return EClass.sources.materials.rows[num];
442 }
443
444 // Token: 0x06000219 RID: 537 RVA: 0x000107C4 File Offset: 0x0000E9C4
445 public virtual SourceMaterial.Row GetColorMaterial()
446 {
447 if (this.idMat != -1)
448 {
449 return EClass.sources.materials.rows[this.idMat];
450 }
451 if (!this.UseStock)
452 {
453 int num = (this.ingredients.Count > 0) ? this.ingredients[this.source.colorIng].mat : 3;
454 if (num == -1)
455 {
456 num = 3;
457 }
458 return EClass.sources.materials.rows[num];
459 }
460 this.ingredients[0].RefreshThing();
461 Thing thing = this.ingredients[0].thing;
462 if (thing == null)
463 {
464 return EClass.sources.materials.rows[3];
465 }
466 if (!thing.isDyed)
467 {
468 return thing.material;
469 }
470 return thing.DyeMat;
471 }
472
473 // Token: 0x17000069 RID: 105
474 // (get) Token: 0x0600021A RID: 538 RVA: 0x00010898 File Offset: 0x0000EA98
475 public virtual int CostMoney
476 {
477 get
478 {
479 return 0;
480 }
481 }
482
483 // Token: 0x0600021B RID: 539 RVA: 0x0001089B File Offset: 0x0000EA9B
484 public virtual void BuildIngredientList()
485 {
486 if (this.UseStock || !this.RequireIngredients)
487 {
488 return;
489 }
490 this.ingredients = this.source.GetIngredients();
491 }
492
493 // Token: 0x0600021C RID: 540 RVA: 0x000108C0 File Offset: 0x0000EAC0
494 public void BuildIngredientList(Thing t)
495 {
496 this.UseStock = true;
498 {
499 id = t.id,
500 tag = null,
501 req = 1,
502 uid = t.uid,
503 thing = t,
504 mat = t.material.id
505 };
506 this.ingredients.Add(item);
507 }
508
509 // Token: 0x0600021D RID: 541 RVA: 0x00010924 File Offset: 0x0000EB24
510 public virtual void OnChangeIngredient()
511 {
512 }
513
514 // Token: 0x1700006A RID: 106
515 // (get) Token: 0x0600021E RID: 542 RVA: 0x00010926 File Offset: 0x0000EB26
516 public virtual bool CanRotate
517 {
518 get
519 {
520 return this.tileType.CanRotate(true) && this.tileRow._tiles.Length > 1;
521 }
522 }
523
524 // Token: 0x0600021F RID: 543 RVA: 0x00010948 File Offset: 0x0000EB48
525 public virtual Thing Craft(BlessedState blessed, bool sound = false, List<Thing> ings = null, bool model = false)
526 {
527 string type = this.source.type;
528 Thing thing;
529 if (!(type == "Block"))
530 {
531 if (!(type == "Obj"))
532 {
533 thing = ThingGen.CreateFloor(this.tileRow.id, this.GetMainMaterial().id, this.source.isBridge);
534 }
535 else
536 {
537 thing = ThingGen.CreateObj(this.tileRow.id, this.GetMainMaterial().id);
538 }
539 }
540 else
541 {
542 thing = ThingGen.CreateBlock(this.tileRow.id, this.GetMainMaterial().id);
543 }
544 if (thing == null)
545 {
546 return null;
547 }
548 thing.trait.OnCrafted(this);
549 thing.SetBlessedState(blessed);
550 if (model)
551 {
552 return thing;
553 }
554 Msg.Say("crafted", thing, null, null, null);
555 thing = (EClass.pc.AddCard(thing) as Thing);
556 if (thing.GetRootCard() == EClass.pc)
557 {
558 EClass.pc.HoldCard(thing, -1);
559 }
560 return thing;
561 }
562
563 // Token: 0x06000220 RID: 544 RVA: 0x00010A3C File Offset: 0x0000EC3C
564 public bool HasSameTile(Point point, int dir, int altitude, int bridgeHeight)
565 {
566 if (this.IsObj)
567 {
568 if (point.growth != null && point.sourceObj == this.tileRow && point.cell.matObj == this.GetColorMaterial())
569 {
570 return true;
571 }
572 if (dir == point.cell.objDir && point.cell.matObj == this.GetColorMaterial() && point.sourceObj == this.tileRow)
573 {
574 return true;
575 }
576 }
577 else if (this.IsBridge)
578 {
579 if (dir == point.cell.floorDir && point.matBridge == this.GetColorMaterial() && point.sourceBridge == this.tileRow && Mathf.Clamp(bridgeHeight + altitude, 0, 255) == (int)point.cell.bridgeHeight)
580 {
581 return true;
582 }
583 }
584 else if (this.IsFloorOrBridge)
585 {
586 if (dir == point.cell.floorDir && point.matFloor == this.GetColorMaterial() && point.sourceFloor == this.tileRow)
587 {
588 return true;
589 }
590 }
591 else if (this.IsWallOrFence)
592 {
593 if (point.matBlock == this.GetColorMaterial() && point.sourceBlock == this.tileRow && dir == point.cell.blockDir)
594 {
595 return true;
596 }
597 }
598 else if (this.IsBlock && point.matBlock == this.GetColorMaterial() && point.sourceBlock == this.tileRow)
599 {
600 return !point.sourceBlock.tileType.AltitudeAsDir || dir == point.cell.objDir;
601 }
602 return false;
603 }
604
605 // Token: 0x06000221 RID: 545 RVA: 0x00010BCC File Offset: 0x0000EDCC
606 public virtual void Build(TaskBuild task)
607 {
608 this.Build(task.owner, null, task.pos, (this.ingredients.Count > 0) ? this.ingredients[0].mat : task.recipe.idMat, task.dir, task.altitude, task.bridgeHeight);
609 }
610
611 // Token: 0x06000222 RID: 546 RVA: 0x00010C2C File Offset: 0x0000EE2C
612 public virtual void Build(Chara chara, Card t, Point pos, int mat, int dir, int altitude, int bridgeHeight)
613 {
614 if (mat == -1)
615 {
616 mat = 2;
617 }
618 EClass.pc.PlaySound(EClass.sources.materials.rows[mat].GetSoundImpact(null), 1f, true);
619 pos.cell.isModified = true;
620 string type = this.source.type;
621 if (!(type == "Block"))
622 {
623 if (type == "Floor")
624 {
625 if (pos.sourceObj.tileType.RemoveOnFloorChange && (!BuildMenu.Instance || !EClass.debug.ignoreBuildRule))
626 {
627 EClass._map.SetObj(pos.x, pos.z, 0, 1, 0);
628 }
629 EClass._map.SetFloor(pos.x, pos.z, mat, this.tileRow.id, dir);
630 return;
631 }
632 if (type == "Bridge")
633 {
634 if (pos.sourceObj.tileType.RemoveOnFloorChange)
635 {
636 EClass._map.SetObj(pos.x, pos.z, 0, 1, 0);
637 }
638 EClass._map.SetBridge(pos.x, pos.z, Mathf.Clamp(bridgeHeight + altitude, 0, 255), mat, this.tileRow.id, dir);
639 return;
640 }
641 if (!(type == "Obj"))
642 {
643 return;
644 }
645 EClass._map.SetObj(pos.x, pos.z, mat, this.tileRow.id, 1, dir);
646 if (this.tileType.ChangeBlockDir)
647 {
648 EClass._map.SetBlockDir(pos.x, pos.z, dir);
649 }
650 if (pos.growth != null)
651 {
652 pos.growth.SetDefaultStage();
653 }
654 return;
655 }
656 else
657 {
658 int ramp = this.tileRow.id;
659 if (ramp == 3)
660 {
661 ramp = EClass.sources.materials.rows[mat].ramp;
662 }
663 if (EClass.scene.actionMode.IsRoofEditMode(null))
664 {
665 EClass._map.SetRoofBlock(pos.x, pos.z, mat, ramp, dir, altitude);
666 return;
667 }
668 if (pos.HasObj && !pos.sourceObj.tileType.CanBuiltOnBlock)
669 {
670 EClass._map.MineObjSound(pos);
671 EClass._map.SetObj(pos.x, pos.z, 0, 1, 0);
672 }
673 EClass._map.SetBlock(pos.x, pos.z, mat, ramp, dir);
674 if (this.tileType.IsBlockPass && pos.HasChara)
675 {
676 foreach (Chara t2 in pos.ListCharas())
677 {
678 chara.Kick(t2, false, true);
679 }
680 }
681 if (this.tileType.AltitudeAsDir)
682 {
683 pos.cell.objDir = dir;
684 }
685 foreach (Card card in pos.ListCards(false))
686 {
687 if (card.isThing && card.placeState == PlaceState.roaming)
688 {
689 card._Move(card.pos.GetNearestPoint(false, true, true, false), Card.MoveType.Walk);
690 }
691 }
692 return;
693 }
694 }
695
696 // Token: 0x06000223 RID: 547 RVA: 0x00010F84 File Offset: 0x0000F184
697 public unsafe virtual void OnRenderMarker(Point point, bool active, HitResult result, bool main, int dir, int bridgeHeight)
698 {
699 if (dir != -1)
700 {
701 this._dir = dir;
702 }
703 RenderParam renderParam = this.tileRow.GetRenderParam(this.DefaultMaterial, this._dir, point, bridgeHeight);
704 renderParam.matColor = (float)(active ? EClass.Colors.blockColors.Active : EClass.Colors.blockColors.Inactive);
705 point.ApplyAnime(renderParam);
706 if (this.tileType.IsWater)
707 {
708 if (EClass.screen.guide.isActive)
709 {
710 EClass.screen.guide.passGuideFloor.Add(point, (float)result, 0.3f);
711 }
712 return;
713 }
714 if (this.tileType.IsWallOrFence && point.HasNonWallBlock)
715 {
716 Vector3 vector = *point.Position();
717 if (EClass.screen.guide.isActive)
718 {
719 EClass.screen.guide.passGuideBlock.Add(ref vector, 5f, 0f);
720 }
721 }
722 if (this.renderRow.renderData.pass == EClass.screen.tileMap.passBlock || this.renderRow.renderData.pass == EClass.screen.tileMap.passBlockEx || this.renderRow.renderData.pass == EClass.screen.tileMap.passLiquid)
723 {
724 if (bridgeHeight > 0 && !point.cell.skipRender && EClass.screen.guide.isActive)
725 {
726 EClass.screen.guide.passGuideFloor.Add(point, (float)result, 0.3f);
727 }
728 if (!this.tileType.IsWallOrFence && (point.HasChara || (point.HasObj && point.cell.blocked)))
729 {
730 Vector3 vector2 = *point.Position();
731 if (EClass.screen.guide.isActive)
732 {
733 EClass.screen.guide.passGuideBlock.Add(ref vector2, 5f, 0f);
734 }
735 return;
736 }
737 if (EClass.scene.actionMode.IsRoofEditMode(null))
738 {
739 EClass.screen.tileMap.SetRoofHeight(renderParam, point.cell, point.x, point.z, 0, bridgeHeight, this.tileType.IsWallOrFence ? this._dir : -1, true);
740 }
741 renderParam.y = renderParam.y - EClass.screen.tileMap.rendererBlockMarker.offset.y + this.renderRow.renderData.offset.y;
742 renderParam.z += EClass.setting.render.tileMarkerZ;
743 int num = (this.tileType.blockRenderMode == BlockRenderMode.Pillar) ? (this._dir + 1 + ((this._dir >= 7) ? this._dir : 0)) : 1;
744 if (num == 1)
745 {
746 EClass.screen.tileMap.rendererBlockMarker.Draw(renderParam);
747 return;
748 }
749 EClass.screen.tileMap.rendererBlockMarker.DrawRepeat(renderParam, num, this.tileType.RepeatSize, false);
750 return;
751 }
752 else
753 {
754 if (this.renderRow.renderData.pass == EClass.screen.tileMap.passFloor || this.renderRow.renderData.pass == EClass.screen.tileMap.passFloorEx || this.renderRow.renderData.pass == EClass.screen.tileMap.passFloorWater)
755 {
756 if (point.HasObj)
757 {
758 point.Position();
759 }
760 renderParam.z += ((point.cell.liquidLv > 0) ? -0.01f : EClass.setting.render.tileMarkerZFloor);
761 EClass.screen.tileMap.rendererFloorMarker.Draw(renderParam);
762 return;
763 }
764 renderParam.z += EClass.setting.render.tileMarkerZ;
765 this.renderRow.renderData.Draw(renderParam);
766 return;
767 }
768 }
769
770 // Token: 0x06000224 RID: 548 RVA: 0x0001139C File Offset: 0x0000F59C
771 public string GetName()
772 {
773 if (this.UseStock && this.ingredients[0].thing == null)
774 {
775 return "";
776 }
777 string text = this.UseStock ? this.ingredients[0].thing.Name : this.source.Name;
778 if (text == "")
779 {
780 text = ("card_" + this.source.id).lang();
781 }
782 if (text == "*r")
783 {
784 text = this.source.row.GetText("aka", false);
785 }
786 if (text == "*r")
787 {
788 text = "(" + this.source.row.GetField("id") + ")";
789 }
790 return text.ToTitleCase(false);
791 }
792
793 // Token: 0x06000225 RID: 549 RVA: 0x0001147B File Offset: 0x0000F67B
794 public virtual string GetDetail()
795 {
796 return this.renderRow.GetText("detail", false).IsEmpty(this.source.GetDetail());
797 }
798
799 // Token: 0x06000226 RID: 550 RVA: 0x0001149E File Offset: 0x0000F69E
800 public virtual void WriteNote(UINote n)
801 {
802 n.Clear();
803 n.Build();
804 }
805
806 // Token: 0x06000227 RID: 551 RVA: 0x000114AC File Offset: 0x0000F6AC
807 public void WriteReqFactory(UINote n, bool hasFactory = true)
808 {
809 if (this.source.NeedFactory)
810 {
811 n.AddHeaderTopic("reqFactory".lang(this.source.NameFactory.TagColor(hasFactory ? FontColor.Default : FontColor.Bad, null), null, null, null, null), null);
812 n.Space(8, 1);
813 }
814 }
815
816 // Token: 0x06000228 RID: 552 RVA: 0x000114FC File Offset: 0x0000F6FC
817 public void WriteReqSkill(UINote n)
818 {
819 n.AddHeaderTopic("reqSkill", null);
820 Element reqSkill = this.source.GetReqSkill();
821 int value = EClass.pc.elements.GetOrCreateElement(reqSkill).Value;
822 Color textColor = EClass.Colors.Skin.GetTextColor((value >= reqSkill.Value) ? FontColor.Good : FontColor.Warning);
823 n.AddText(null, string.Concat(new string[]
824 {
825 reqSkill.Name,
826 " ",
827 reqSkill.Value.ToString(),
828 " (",
829 value.ToString(),
830 ")"
831 }), textColor).text1.SetSize(-1);
832 n.Space(8, 1);
833 }
834
835 // Token: 0x06000229 RID: 553 RVA: 0x000115B9 File Offset: 0x0000F7B9
836 public virtual IRenderer GetRenderer()
837 {
838 return this.tileRow.renderData;
839 }
840
841 // Token: 0x0600022A RID: 554 RVA: 0x000115C6 File Offset: 0x0000F7C6
842 public virtual void OnSelected()
843 {
844 }
845
846 // Token: 0x0600022B RID: 555 RVA: 0x000115C8 File Offset: 0x0000F7C8
847 public virtual void OnChangeAltitude(int a)
848 {
849 }
850
851 // Token: 0x0600022C RID: 556 RVA: 0x000115CC File Offset: 0x0000F7CC
852 public virtual void Rotate()
853 {
854 if (EInput.isShiftDown || Input.GetMouseButton(1))
855 {
856 this._dir--;
857 }
858 else
859 {
860 this._dir++;
861 }
862 if (this.tileType.AltitudeAsDir)
863 {
864 if (this._dir >= this.tileType.MaxAltitude)
865 {
866 this._dir = 0;
867 }
868 if (this._dir < 0)
869 {
870 this._dir = this.tileType.MaxAltitude - 1;
871 }
872 }
873 else
874 {
875 int num = this.tileRow._tiles.Length;
876 if (this.tileRow.tileType == TileType.Door)
877 {
878 num = 2;
879 }
880 if (this._dir < 0)
881 {
882 this._dir = num - 1;
883 }
884 if (this._dir >= num)
885 {
886 this._dir = 0;
887 }
888 }
889 if (BuildMenu.Instance)
890 {
891 BuildMenu.Instance.info1.OnRotate();
892 }
893 }
894
895 // Token: 0x0600022D RID: 557 RVA: 0x000116AA File Offset: 0x0000F8AA
896 public virtual void SetDir(int d)
897 {
898 this._dir = d;
899 if (BuildMenu.Instance)
900 {
901 BuildMenu.Instance.info1.OnRotate();
902 }
903 }
904
905 // Token: 0x0600022E RID: 558 RVA: 0x000116CE File Offset: 0x0000F8CE
906 public virtual Recipe Duplicate()
907 {
908 return IO.DeepCopy<Recipe>(this);
909 }
910
911 // Token: 0x0600022F RID: 559 RVA: 0x000116D8 File Offset: 0x0000F8D8
912 public virtual void SetImage(Image icon)
913 {
914 this.renderRow.SetImage(icon, null, this.renderRow.GetColorInt((this.ingredients != null && this.ingredients.Count > 0 && this.ingredients[0].thing != null) ? this.ingredients[0].thing.material : this.DefaultMaterial), true, 0, this.idSkin);
915 }
916
917 // Token: 0x06000230 RID: 560 RVA: 0x0001174C File Offset: 0x0000F94C
918 public bool IsCraftable()
919 {
920 foreach (Recipe.Ingredient ingredient in this.ingredients)
921 {
922 if (!ingredient.optional && EClass._map.Stocked.ListThingStack(ingredient, StockSearchMode.AroundPC).max < ingredient.req)
923 {
924 return false;
925 }
926 }
927 return true;
928 }
929
930 // Token: 0x06000231 RID: 561 RVA: 0x000117C8 File Offset: 0x0000F9C8
931 public int GetMaxCount()
932 {
933 int num = 999;
934 for (int i = 0; i < this.ingredients.Count; i++)
935 {
936 Recipe.Ingredient ingredient = this.ingredients[i];
937 Thing thing = ingredient.thing;
938 int num2 = 0;
939 if (!ingredient.optional || thing != null)
940 {
941 if (thing != null && !thing.isDestroyed)
942 {
943 num2 = thing.Num / ingredient.req;
944 }
945 if (num2 < num)
946 {
947 num = num2;
948 }
949 }
950 }
951 return num;
952 }
953
954 // Token: 0x06000232 RID: 562 RVA: 0x00011838 File Offset: 0x0000FA38
955 public void SetTextDifficulty(UIText text)
956 {
957 Element reqSkill = this.source.GetReqSkill();
958 int value = EClass.pc.elements.GetOrCreateElement(reqSkill).Value;
959 string text2 = reqSkill.Name + " " + reqSkill.Value.ToString();
960 text.SetText(text2);
961 }
962
963 // Token: 0x06000233 RID: 563 RVA: 0x00011890 File Offset: 0x0000FA90
964 public int GetSortVal()
965 {
966 Element reqSkill = this.source.GetReqSkill();
967 return reqSkill.source.id * 10000 - reqSkill.Value;
968 }
969
970 // Token: 0x040004E9 RID: 1257
971 public static Dictionary<string, Recipe> recipeCache = new Dictionary<string, Recipe>();
972
973 // Token: 0x040004EA RID: 1258
974 [JsonProperty]
975 public string id;
976
977 // Token: 0x040004EB RID: 1259
978 [JsonProperty]
979 public List<Recipe.Ingredient> ingredients = new List<Recipe.Ingredient>();
980
981 // Token: 0x040004EC RID: 1260
982 [JsonProperty]
983 public bool UseStock;
984
985 // Token: 0x040004ED RID: 1261
986 [JsonProperty]
987 public bool IngAsProduct;
988
989 // Token: 0x040004EE RID: 1262
990 [JsonProperty]
991 public bool VirtualBlock;
992
993 // Token: 0x040004EF RID: 1263
994 public int _dir;
995
996 // Token: 0x040004F0 RID: 1264
997 public int sync;
998
999 // Token: 0x040004F1 RID: 1265
1000 public int idMat = -1;
1001
1002 // Token: 0x040004F2 RID: 1266
1003 public int idSkin;
1004
1005 // Token: 0x040004F3 RID: 1267
1006 public Recipe.State state;
1007
1008 // Token: 0x040004F4 RID: 1268
1009 public RecipeSource _source;
1010
1011 // Token: 0x020007CD RID: 1997
1012 public enum State
1013 {
1014 // Token: 0x040021DB RID: 8667
1015 Valid,
1016 // Token: 0x040021DC RID: 8668
1017 Invalid
1018 }
1019
1020 // Token: 0x020007CE RID: 1998
1021 public class Ingredient : EClass
1022 {
1023 // Token: 0x17001119 RID: 4377
1024 // (get) Token: 0x060037CF RID: 14287 RVA: 0x0012B73D File Offset: 0x0012993D
1025 public bool IsThingSpecified
1026 {
1027 get
1028 {
1029 return this.uid != 0;
1030 }
1031 }
1032
1033 // Token: 0x1700111A RID: 4378
1034 // (get) Token: 0x060037D0 RID: 14288 RVA: 0x0012B748 File Offset: 0x00129948
1035 public string IdThing
1036 {
1037 get
1038 {
1039 if (!this.useCat)
1040 {
1041 return this.id;
1042 }
1043 return EClass.sources.categories.map[this.id].GetIdThing();
1044 }
1045 }
1046
1047 // Token: 0x060037D1 RID: 14289 RVA: 0x0012B778 File Offset: 0x00129978
1048 public Thing RefreshThing()
1049 {
1050 if (this.thing == null)
1051 {
1052 this.thing = EClass.pc.things.Find(this.uid);
1053 if (this.thing == null)
1054 {
1055 this.thing = EClass._map.Stocked.Find(this.uid);
1056 if (this.thing == null)
1057 {
1058 this.thing = EClass.pc.things.Find(this.id, this.mat, this.refVal);
1059 if (this.thing == null)
1060 {
1061 this.thing = EClass._map.Stocked.Find(this.id, this.mat, this.refVal, false);
1062 }
1063 }
1064 }
1065 }
1066 return this.thing;
1067 }
1068
1069 // Token: 0x060037D2 RID: 14290 RVA: 0x0012B833 File Offset: 0x00129A33
1070 public bool CanSetThing(Thing t)
1071 {
1072 return !(t.id != this.id) && t.Num >= this.req;
1073 }
1074
1075 // Token: 0x060037D3 RID: 14291 RVA: 0x0012B859 File Offset: 0x00129A59
1076 public void SetThing(Thing t = null)
1077 {
1078 this.uid = ((t != null) ? t.uid : 0);
1079 this.thing = t;
1080 this.mat = ((t != null) ? t.material.id : -1);
1081 }
1082
1083 // Token: 0x060037D4 RID: 14292 RVA: 0x0012B88C File Offset: 0x00129A8C
1084 public string GetName()
1085 {
1086 if (this.useCat)
1087 {
1088 string text = Recipe.Ingredient.<GetName>g__CatName|18_0(this.id);
1089 if (this.idOther.Count > 0)
1090 {
1091 foreach (string text2 in this.idOther)
1092 {
1093 text = text + ", " + Recipe.Ingredient.<GetName>g__CatName|18_0(text2);
1094 }
1095 }
1096 return "ingCat".lang(text, null, null, null, null);
1097 }
1098 string str = EClass.sources.cards.map[this.id].GetName().IsEmpty(("card_" + this.id).lang());
1099 string text3 = this.tag.IsEmpty() ? "" : ("(" + ("tag_" + this.tag).lang() + ")");
1100 if (this.idOther.Count > 0)
1101 {
1102 foreach (string key in this.idOther)
1103 {
1104 text3 = text3 + ", " + EClass.sources.cards.map[key].GetName();
1105 }
1106 }
1107 return str + text3;
1108 }
1109
1110 // Token: 0x060037D6 RID: 14294 RVA: 0x0012BA2D File Offset: 0x00129C2D
1111 [CompilerGenerated]
1112 internal static string <GetName>g__CatName|18_0(string id)
1113 {
1114 return EClass.sources.categories.map[id].GetName();
1115 }
1116
1117 // Token: 0x040021DD RID: 8669
1118 [JsonProperty]
1119 public int uid;
1120
1121 // Token: 0x040021DE RID: 8670
1122 [JsonProperty]
1123 public int req;
1124
1125 // Token: 0x040021DF RID: 8671
1126 [JsonProperty]
1127 public int mat = -1;
1128
1129 // Token: 0x040021E0 RID: 8672
1130 [JsonProperty]
1131 public int refVal = -1;
1132
1133 // Token: 0x040021E1 RID: 8673
1134 [JsonProperty]
1135 public string id;
1136
1137 // Token: 0x040021E2 RID: 8674
1138 [JsonProperty]
1139 public string tag;
1140
1141 // Token: 0x040021E3 RID: 8675
1142 [JsonProperty]
1143 public List<string> idOther = new List<string>();
1144
1145 // Token: 0x040021E4 RID: 8676
1146 public Thing thing;
1147
1148 // Token: 0x040021E5 RID: 8677
1149 public bool optional;
1150
1151 // Token: 0x040021E6 RID: 8678
1152 public bool dye;
1153
1154 // Token: 0x040021E7 RID: 8679
1155 public bool useCat;
1156 }
1157}
Definition Card.cs:13
Definition Chara.cs:12
Definition Msg.cs:7
Definition Point.cs:11
Definition Thing.cs:10