Elin Decompiled Documentation EA 23.185 Nightly Patch 1
Loading...
Searching...
No Matches
Recipe.cs
Go to the documentation of this file.
1using System.Collections.Generic;
2using Newtonsoft.Json;
3using UnityEngine;
4using UnityEngine.UI;
5
6public class Recipe : EClass
7{
8 public enum State
9 {
10 Valid,
12 }
13
14 public enum IngType
15 {
16 Default,
18 }
19
20 public class Ingredient : EClass
21 {
22 [JsonProperty]
23 public int uid;
24
25 [JsonProperty]
26 public int req;
27
28 [JsonProperty]
29 public int mat = -1;
30
31 [JsonProperty]
32 public int refVal = -1;
33
34 [JsonProperty]
35 public string id;
36
37 [JsonProperty]
38 public string tag;
39
40 [JsonProperty]
41 public List<string> idOther = new List<string>();
42
43 [JsonProperty]
45
46 public Thing thing;
47
48 public bool optional;
49
50 public bool dye;
51
52 public bool useCat;
53
54 public bool IsThingSpecified => uid != 0;
55
56 public string IdThing
57 {
58 get
59 {
60 if (!useCat)
61 {
62 return id;
63 }
64 return EClass.sources.categories.map[id].GetIdThing();
65 }
66 }
67
69 {
70 if (thing == null)
71 {
73 if (thing == null)
74 {
76 if (thing == null)
77 {
79 if (thing == null)
80 {
82 }
83 }
84 }
85 }
86 return thing;
87 }
88
89 public bool CanSetThing(Thing t)
90 {
91 if (t.id != id || t.Num < req)
92 {
93 return false;
94 }
95 return true;
96 }
97
98 public void SetThing(Thing t = null)
99 {
100 uid = t?.uid ?? 0;
101 thing = t;
102 mat = t?.material.id ?? (-1);
103 }
104
105 public string GetName()
106 {
107 if (useCat)
108 {
109 string text = CatName(id);
110 if (idOther.Count > 0)
111 {
112 foreach (string item in idOther)
113 {
114 text = text + ", " + CatName(item);
115 }
116 }
117 return "ingCat".lang(text);
118 }
119 string text2 = EClass.sources.cards.map[id].GetName().IsEmpty(("card_" + id).lang());
120 string text3 = (tag.IsEmpty() ? "" : ("(" + ("tag_" + tag).lang() + ")"));
121 if (idOther.Count > 0)
122 {
123 foreach (string item2 in idOther)
124 {
125 text3 = text3 + ", " + EClass.sources.cards.map[item2].GetName();
126 }
127 }
128 return text2 + text3;
129 static string CatName(string id)
130 {
131 return EClass.sources.categories.map[id].GetName();
132 }
133 }
134
136 {
137 if (ingType == IngType.CreativeFood && t.HasElement(10) && !t.category.IsChildOf("seasoning") && !t.category.IsChildOf("meal") && !(t.trait is TraitFoodFishSlice))
138 {
139 return true;
140 }
141 if (useCat)
142 {
143 if (t.category.IsChildOf(id))
144 {
145 return true;
146 }
147 foreach (string item in idOther)
148 {
149 if (t.category.IsChildOf(item))
150 {
151 return true;
152 }
153 }
154 return false;
155 }
156 if (t.id == id || t.source._origin == id)
157 {
158 return true;
159 }
160 foreach (string item2 in idOther)
161 {
162 if (t.id == id || t.source._origin == item2)
163 {
164 return true;
165 }
166 }
167 return false;
168 }
169 }
170
171 public static Dictionary<string, Recipe> recipeCache = new Dictionary<string, Recipe>();
172
173 [JsonProperty]
174 public string id;
175
176 [JsonProperty]
177 public List<Ingredient> ingredients = new List<Ingredient>();
178
179 [JsonProperty]
180 public bool UseStock;
181
182 [JsonProperty]
183 public bool IngAsProduct;
184
185 [JsonProperty]
186 public bool VirtualBlock;
187
188 public int _dir;
189
190 public int sync;
191
192 public int idMat = -1;
193
194 public int idSkin;
195
196 public State state;
197
199
201
203
204 public virtual TileRow tileRow => source.row as TileRow;
205
206 public virtual RenderRow renderRow => source.row;
207
208 public string Name => GetName();
209
210 public virtual TileType tileType
211 {
212 get
213 {
214 if (!(source.type == "Bridge") || source.row.tileType is TileTypeBridge)
215 {
216 return renderRow.tileType;
217 }
218 return TileType.Bridge;
219 }
220 }
221
223
224 public int MaxAltitude
225 {
226 get
227 {
229 {
230 return tileType.MaxAltitude;
231 }
232 return 0;
233 }
234 }
235
236 public int RecipeLv => EClass.player.recipes.knownRecipes.TryGetValue(id, 0);
237
238 public bool IsFloor => tileType.IsFloor;
239
240 public bool IsObj => tileRow is SourceObj.Row;
241
242 public virtual bool IsBlock => !IsFloorOrBridge;
243
245
246 public bool IsBridge => source.type == "Bridge";
247
248 public virtual bool IsThing => false;
249
250 public virtual Card Mold => null;
251
252 public virtual int W
253 {
254 get
255 {
256 if (_dir % 2 != 0)
257 {
258 return renderRow.H;
259 }
260 return renderRow.W;
261 }
262 }
263
264 public virtual int H
265 {
266 get
267 {
268 if (_dir % 2 != 0)
269 {
270 return renderRow.W;
271 }
272 return renderRow.H;
273 }
274 }
275
276 public virtual bool RequireIngredients => true;
277
278 public bool MultiSize
279 {
280 get
281 {
282 if (W == 1)
283 {
284 return H != 1;
285 }
286 return true;
287 }
288 }
289
291
292 public virtual int CostMoney => 0;
293
294 public virtual bool CanRotate
295 {
296 get
297 {
298 if (tileType.CanRotate(buildMode: true))
299 {
300 return tileRow._tiles.Length > 1;
301 }
302 return false;
303 }
304 }
305
306 public static Recipe GetOrCreate(string id)
307 {
308 Recipe recipe = recipeCache.TryGetValue(id);
309 if (recipe == null)
310 {
311 RecipeSource recipeSource = RecipeManager.dict.TryGetValue(id);
312 if (recipeSource != null)
313 {
314 recipe = Create(recipeSource);
315 recipeCache.Add(id, recipe);
316 }
317 }
318 return recipe;
319 }
320
321 public static Recipe Create(RecipeSource _source, int idMat = -1, Thing ing = null)
322 {
323 string type = _source.type;
324 Recipe recipe = (_source.isBridgePillar ? new RecipeBridgePillar() : (type.IsEmpty() ? new RecipeCard() : ((type == "Custom") ? new RecipeCustom() : new Recipe())));
325 recipe.id = _source.id;
326 recipe._source = _source;
327 recipe.idMat = idMat;
328 if (ing != null)
329 {
330 recipe.BuildIngredientList(ing);
331 if (ing.trait is TraitTile)
332 {
333 recipe.VirtualBlock = true;
334 }
335 }
336 return recipe;
337 }
338
339 public static Recipe Create(Thing t)
340 {
341 RecipeSource recipeSource = RecipeManager.dict.TryGetValue(t.id);
342 if (recipeSource == null)
343 {
344 return null;
345 }
346 RecipeCard recipeCard = new RecipeCard
347 {
348 id = recipeSource.id,
349 _source = recipeSource,
350 IngAsProduct = true,
351 idSkin = t.idSkin
352 };
353 recipeCard.BuildIngredientList(t);
354 if (t.uid == 0 || recipeCard.ingredients[0].uid == 0 || recipeCard.ingredients[0].thing == null)
355 {
356 Debug.LogError("expection: invalid ingredient " + t);
357 }
358 return recipeCard;
359 }
360
361 public static void DropIngredients(string id, string idMatMain, int num = 1)
362 {
364 Recipe orCreate = GetOrCreate(EClass.sources.cards.map[id].RecipeID);
365 orCreate.BuildIngredientList();
366 Msg.Say("dropReward");
367 foreach (Ingredient ingredient in orCreate.ingredients)
368 {
369 Thing thing = ThingGen.Create(ingredient.id).SetNum(ingredient.req);
370 if (ingredient == orCreate.ingredients[0])
371 {
372 thing.ChangeMaterial(idMatMain);
373 thing.SetNum(num);
374 }
375 EClass.player.DropReward(thing, silent: true);
376 }
377 }
378
379 public bool IsStaticLV()
380 {
381 switch (source.idFactory)
382 {
383 case "factory_floor":
384 case "factory_block":
385 case "factory_wall":
386 case "factory_platform":
387 return true;
388 default:
389 return renderRow.Category.IsChildOf("block");
390 }
391 }
392
393 public int GetQualityBonus()
394 {
395 if (IsStaticLV())
396 {
397 return 0;
398 }
399 Element reqSkill = source.GetReqSkill();
400 int num = reqSkill.Value - EClass.pc.Evalue(reqSkill.id);
401 int num2 = 0;
402 if (num > 0)
403 {
404 if (num < 5)
405 {
406 return 0;
407 }
408 return -(num - 4) * 10;
409 }
410 num2 += EClass.curve(-num, 10, 20, 80) / 10 * 10 + 10;
411 if (RecipeLv > 0)
412 {
413 num2 += (int)Mathf.Sqrt(RecipeLv - 1) * 10;
414 }
415 return num2;
416 }
417
418 public virtual int GetRefVal()
419 {
420 if (source.row is SourceBlock.Row)
421 {
422 return (source.row as SourceBlock.Row).id;
423 }
424 if (source.row is SourceFloor.Row)
425 {
426 return (source.row as SourceFloor.Row).id;
427 }
428 if (source.row is SourceObj.Row)
429 {
430 return (source.row as SourceObj.Row).id;
431 }
432 return -1;
433 }
434
435 public virtual string GetIdThing()
436 {
437 if (source.row is SourceBlock.Row)
438 {
439 return (source.row as SourceBlock.Row).idThing;
440 }
441 if (source.row is SourceFloor.Row)
442 {
443 if (!IsBridge)
444 {
445 return "floor";
446 }
447 return "platform";
448 }
449 if (source.row is SourceObj.Row)
450 {
451 return "obj";
452 }
453 return null;
454 }
455
456 public virtual bool ShouldShowHighlight(HitResult r)
457 {
458 return r != HitResult.Valid;
459 }
460
462 {
464 {
465 return BaseTileSelector.BoxType.Box;
466 }
467 return BaseTileSelector.BoxType.Fence;
468 }
469
470 public int GetDefaultColor()
471 {
472 if (UseStock)
473 {
474 Thing thing = ingredients[0].thing;
475 return renderRow.GetColorInt(thing.isDyed ? thing.DyeMat : thing.material);
476 }
478 }
479
481 {
482 int num = -1;
483 if (ingredients.Count > 0)
484 {
485 num = ((ingredients[0].thing == null) ? ingredients[0].mat : ingredients[0].thing.material.id);
486 }
487 if (num == -1)
488 {
489 num = 3;
490 }
491 return EClass.sources.materials.rows[num];
492 }
493
495 {
496 if (idMat != -1)
497 {
498 return EClass.sources.materials.rows[idMat];
499 }
500 if (UseStock)
501 {
502 ingredients[0].RefreshThing();
503 Thing thing = ingredients[0].thing;
504 if (thing != null)
505 {
506 if (!thing.isDyed)
507 {
508 return thing.material;
509 }
510 return thing.DyeMat;
511 }
512 return EClass.sources.materials.rows[3];
513 }
514 int num = ((ingredients.Count > 0) ? ingredients[source.colorIng].mat : 3);
515 if (num == -1)
516 {
517 num = 3;
518 }
519 return EClass.sources.materials.rows[num];
520 }
521
522 public virtual void BuildIngredientList()
523 {
525 {
527 }
528 }
529
531 {
532 UseStock = true;
534 {
535 id = t.id,
536 tag = null,
537 req = 1,
538 uid = t.uid,
539 thing = t,
540 mat = t.material.id
541 };
542 ingredients.Add(item);
543 }
544
545 public virtual void OnChangeIngredient()
546 {
547 }
548
549 public virtual Thing Craft(BlessedState blessed, bool sound = false, List<Thing> ings = null, TraitCrafter crafter = null, bool model = false)
550 {
551 Thing thing = null;
552 string type = source.type;
553 thing = ((type == "Block") ? ThingGen.CreateBlock(tileRow.id, GetMainMaterial().id) : ((!(type == "Obj")) ? ThingGen.CreateFloor(tileRow.id, GetMainMaterial().id, source.isBridge) : ThingGen.CreateObj(tileRow.id, GetMainMaterial().id)));
554 if (thing == null)
555 {
556 return null;
557 }
558 thing.trait.OnCrafted(this, ings);
559 thing.SetBlessedState(blessed);
560 if (model)
561 {
562 return thing;
563 }
564 Msg.Say("crafted", thing);
565 thing = EClass.pc.AddCard(thing) as Thing;
566 if (thing.GetRootCard() == EClass.pc)
567 {
568 EClass.pc.HoldCard(thing);
569 }
570 return thing;
571 }
572
573 public bool HasSameTile(Point point, int dir, int altitude, int bridgeHeight)
574 {
575 if (IsObj)
576 {
577 if (point.growth != null && point.sourceObj == tileRow && point.cell.matObj == GetColorMaterial())
578 {
579 return true;
580 }
581 if (dir == point.cell.objDir && point.cell.matObj == GetColorMaterial() && point.sourceObj == tileRow)
582 {
583 return true;
584 }
585 }
586 else if (IsBridge)
587 {
588 if (dir == point.cell.floorDir && point.matBridge == GetColorMaterial() && point.sourceBridge == tileRow && Mathf.Clamp(bridgeHeight + altitude, 0, 255) == point.cell.bridgeHeight)
589 {
590 return true;
591 }
592 }
593 else if (IsFloorOrBridge)
594 {
595 if (dir == point.cell.floorDir && point.matFloor == GetColorMaterial() && point.sourceFloor == tileRow)
596 {
597 return true;
598 }
599 }
600 else if (IsWallOrFence)
601 {
602 if (point.matBlock == GetColorMaterial() && point.sourceBlock == tileRow && dir == point.cell.blockDir)
603 {
604 return true;
605 }
606 }
607 else if (IsBlock && point.matBlock == GetColorMaterial() && point.sourceBlock == tileRow)
608 {
609 if (point.sourceBlock.tileType.AltitudeAsDir && dir != point.cell.objDir)
610 {
611 return false;
612 }
613 return true;
614 }
615 return false;
616 }
617
618 public virtual void Build(TaskBuild task)
619 {
620 Build(task.owner, null, task.pos, (ingredients.Count > 0) ? ingredients[0].mat : task.recipe.idMat, task.dir, task.altitude, task.bridgeHeight);
621 }
622
623 public virtual void Build(Chara chara, Card t, Point pos, int mat, int dir, int altitude, int bridgeHeight)
624 {
625 if (mat == -1)
626 {
627 mat = 2;
628 }
629 EClass.pc.PlaySound(EClass.sources.materials.rows[mat].GetSoundImpact());
630 pos.cell.isModified = true;
631 switch (source.type)
632 {
633 case "Block":
634 {
635 int ramp = tileRow.id;
636 if (ramp == 3)
637 {
638 ramp = EClass.sources.materials.rows[mat].ramp;
639 }
641 {
642 EClass._map.SetRoofBlock(pos.x, pos.z, mat, ramp, dir, altitude);
643 break;
644 }
645 if (pos.HasObj && !pos.sourceObj.tileType.CanBuiltOnBlock)
646 {
648 EClass._map.SetObj(pos.x, pos.z);
649 }
650 EClass._map.SetBlock(pos.x, pos.z, mat, ramp, dir);
651 if (tileType.IsBlockPass && pos.HasChara)
652 {
653 foreach (Chara item in pos.ListCharas())
654 {
655 chara.Kick(item, ignoreSelf: false, karmaLoss: false);
656 }
657 }
659 {
660 pos.cell.objDir = dir;
661 }
662 {
663 foreach (Card item2 in pos.ListCards())
664 {
665 if (item2.isThing && item2.placeState == PlaceState.roaming)
666 {
667 item2._Move(item2.pos.GetNearestPoint());
668 }
669 }
670 break;
671 }
672 }
673 case "Floor":
674 if (pos.HasObj && pos.sourceObj.tileType.RemoveOnFloorChange && (!BuildMenu.Instance || !EClass.debug.ignoreBuildRule))
675 {
676 EClass._map.SetObj(pos.x, pos.z);
677 }
678 EClass._map.SetFloor(pos.x, pos.z, mat, tileRow.id, dir);
679 break;
680 case "Bridge":
681 if (pos.sourceObj.tileType.RemoveOnFloorChange)
682 {
683 EClass._map.SetObj(pos.x, pos.z);
684 }
685 EClass._map.SetBridge(pos.x, pos.z, Mathf.Clamp(bridgeHeight + altitude, 0, 255), mat, tileRow.id, dir);
686 break;
687 case "Obj":
688 EClass._map.SetObj(pos.x, pos.z, mat, tileRow.id, 1, dir, ignoreRandomMat: true);
690 {
691 EClass._map.SetBlockDir(pos.x, pos.z, dir);
692 }
693 if (pos.growth != null)
694 {
696 }
697 break;
698 }
699 }
700
701 public virtual void OnRenderMarker(Point point, bool active, HitResult result, bool main, int dir, int bridgeHeight)
702 {
703 if (dir != -1)
704 {
705 _dir = dir;
706 }
707 RenderParam renderParam = tileRow.GetRenderParam(DefaultMaterial, _dir, point, bridgeHeight);
708 renderParam.matColor = (active ? EClass.Colors.blockColors.Active : EClass.Colors.blockColors.Inactive);
709 point.ApplyAnime(renderParam);
710 if (tileType.IsWater)
711 {
713 {
714 EClass.screen.guide.passGuideFloor.Add(point, (float)result, 0.3f);
715 }
716 return;
717 }
719 {
720 Vector3 v = point.Position();
722 {
724 }
725 }
727 {
728 if (bridgeHeight > 0 && !point.cell.skipRender && EClass.screen.guide.isActive)
729 {
730 EClass.screen.guide.passGuideFloor.Add(point, (float)result, 0.3f);
731 }
732 if (!tileType.IsWallOrFence && (point.HasChara || (point.HasObj && point.cell.blocked)))
733 {
734 Vector3 v2 = point.Position();
736 {
738 }
739 return;
740 }
742 {
743 EClass.screen.tileMap.SetRoofHeight(renderParam, point.cell, point.x, point.z, 0, bridgeHeight, tileType.IsWallOrFence ? _dir : (-1), ignoreAltitudeY: true);
744 }
745 renderParam.y = renderParam.y - EClass.screen.tileMap.rendererBlockMarker.offset.y + renderRow.renderData.offset.y;
746 renderParam.z += EClass.setting.render.tileMarkerZ;
747 int num = ((tileType.blockRenderMode != BlockRenderMode.Pillar) ? 1 : (_dir + 1 + ((_dir >= 7) ? _dir : 0)));
748 if (num == 1)
749 {
751 }
752 else
753 {
755 }
756 }
758 {
759 if (point.HasObj)
760 {
761 _ = ref point.Position();
762 }
763 renderParam.z += ((point.cell.liquidLv > 0) ? (-0.01f) : EClass.setting.render.tileMarkerZFloor);
765 }
766 else
767 {
768 renderParam.z += EClass.setting.render.tileMarkerZ;
769 renderRow.renderData.Draw(renderParam);
770 }
771 }
772
773 public string GetName()
774 {
775 if (UseStock && ingredients[0].thing == null)
776 {
777 return "";
778 }
779 string text = (UseStock ? ingredients[0].thing.Name : source.Name);
780 if (text == "")
781 {
782 text = ("card_" + source.id).lang();
783 }
784 if (text == "*r")
785 {
786 text = source.row.GetText("aka");
787 }
788 if (text == "*r")
789 {
790 text = "(" + source.row.GetField<string>("id") + ")";
791 }
792 return text.ToTitleCase();
793 }
794
795 public virtual string GetDetail()
796 {
797 return renderRow.GetText("detail").IsEmpty(source.GetDetail());
798 }
799
800 public virtual void WriteNote(UINote n)
801 {
802 n.Clear();
803 n.Build();
804 }
805
806 public void WriteReqFactory(UINote n, bool hasFactory = true)
807 {
809 {
810 n.AddHeaderTopic("reqFactory".lang(source.NameFactory.TagColor(hasFactory ? FontColor.Default : FontColor.Bad)));
811 n.Space(8);
812 }
813 }
814
815 public void WriteReqSkill(UINote n)
816 {
817 n.AddHeaderTopic("reqSkill");
818 Element reqSkill = source.GetReqSkill();
819 int value = EClass.pc.elements.GetOrCreateElement(reqSkill).Value;
820 Color textColor = EClass.Colors.Skin.GetTextColor((value >= reqSkill.Value) ? FontColor.Good : FontColor.Warning);
821 n.AddText(null, reqSkill.Name + " " + reqSkill.Value + " (" + value + ")", textColor).text1.SetSize(-1);
822 n.Space(8);
823 }
824
825 public virtual IRenderer GetRenderer()
826 {
827 return tileRow.renderData;
828 }
829
830 public virtual void OnSelected()
831 {
832 }
833
834 public virtual void OnChangeAltitude(int a)
835 {
836 }
837
838 public virtual void Rotate()
839 {
840 if (EInput.isShiftDown || Input.GetMouseButton(1))
841 {
842 _dir--;
843 }
844 else
845 {
846 _dir++;
847 }
849 {
851 {
852 _dir = 0;
853 }
854 if (_dir < 0)
855 {
856 _dir = tileType.MaxAltitude - 1;
857 }
858 }
859 else
860 {
861 int num = tileRow._tiles.Length;
863 {
864 num = 2;
865 }
866 if (_dir < 0)
867 {
868 _dir = num - 1;
869 }
870 if (_dir >= num)
871 {
872 _dir = 0;
873 }
874 }
875 if ((bool)BuildMenu.Instance)
876 {
878 }
879 }
880
881 public virtual void SetDir(int d)
882 {
883 _dir = d;
884 if ((bool)BuildMenu.Instance)
885 {
887 }
888 }
889
890 public virtual Recipe Duplicate()
891 {
892 return IO.DeepCopy(this);
893 }
894
895 public virtual void SetImage(Image icon)
896 {
897 renderRow.SetImage(icon, null, renderRow.GetColorInt((ingredients != null && ingredients.Count > 0 && ingredients[0].thing != null) ? ingredients[0].thing.material : DefaultMaterial), setNativeSize: true, 0, idSkin);
898 }
899
900 public bool IsCraftable()
901 {
902 foreach (Ingredient ingredient in ingredients)
903 {
904 if (ingredient.optional)
905 {
906 continue;
907 }
908 ThingStack thingStack = EClass._map.Stocked.ListThingStack(ingredient, StockSearchMode.AroundPC);
909 bool flag = false;
910 foreach (Thing item in thingStack.list)
911 {
912 if (item.Num >= ingredient.req)
913 {
914 flag = true;
915 break;
916 }
917 }
918 if (!flag)
919 {
920 return false;
921 }
922 }
923 return true;
924 }
925
926 public int GetMaxCount()
927 {
928 int num = 999;
929 for (int i = 0; i < ingredients.Count; i++)
930 {
931 Ingredient ingredient = ingredients[i];
932 Thing thing = ingredient.thing;
933 int num2 = 0;
934 if (!ingredient.optional || thing != null)
935 {
936 if (thing != null && !thing.isDestroyed)
937 {
938 num2 = thing.Num / ingredient.req;
939 }
940 if (num2 < num)
941 {
942 num = num2;
943 }
944 }
945 }
946 return num;
947 }
948
949 public void SetTextDifficulty(UIText text)
950 {
951 Element reqSkill = source.GetReqSkill();
953 string text2 = reqSkill.Name + " " + reqSkill.Value;
954 text.SetText(text2);
955 }
956
957 public int GetSortVal()
958 {
959 Element reqSkill = source.GetReqSkill();
960 return reqSkill.source.id * 10000 - reqSkill.Value;
961 }
962
963 public bool HasFirstTimeBonus()
964 {
965 if (IsStaticLV())
966 {
967 return false;
968 }
969 if (EClass.player.recipes.craftedRecipes.Contains(id))
970 {
971 return false;
972 }
973 return true;
974 }
975
977 {
978 if (HasFirstTimeBonus())
979 {
981 Element reqSkill = source.GetReqSkill();
982 int num = 1 + ((!IsStaticLV()) ? (reqSkill.Value / 20) : 0);
983 Msg.Say("firstTimeCraft", Name);
984 EClass.pc.Pick(ThingGen.Create("ticket_fortune").SetNum(num));
985 }
986 }
987
989 {
990 List<int> list = new List<int>();
991 foreach (Ingredient ingredient in ingredients)
992 {
993 int item = ((ingredient.thing != null) ? ingredient.thing.uid : 0);
994 list.Add(item);
995 }
997 }
998
1000 {
1001 QuestTrackCraft result = null;
1002 foreach (Quest item in EClass.game.quests.list)
1003 {
1004 if (item is QuestTrackCraft)
1005 {
1006 result = item as QuestTrackCraft;
1007 break;
1008 }
1009 }
1010 return result;
1011 }
1012
1013 public void ToggleTrack(QuestTrackCraft quest)
1014 {
1015 if (quest != null && quest.idRecipe == id)
1016 {
1017 EClass.game.quests.Remove(quest);
1018 }
1019 else
1020 {
1021 if (quest != null)
1022 {
1023 EClass.game.quests.Remove(quest);
1024 }
1025 QuestTrackCraft questTrackCraft = Quest.Create("track_craft") as QuestTrackCraft;
1026 questTrackCraft.SetRecipe(this);
1027 EClass.game.quests.Start(questTrackCraft);
1028 }
1030 {
1031 EClass.player.questTracker = true;
1032 EClass.ui.widgets.ActivateWidget("QuestTracker");
1034 }
1036 }
1037}
BlessedState
Definition: BlessedState.cs:2
BlockRenderMode
FontColor
Definition: FontColor.cs:2
HitResult
Definition: HitResult.cs:2
PlaceState
Definition: PlaceState.cs:2
StockSearchMode
new Chara owner
Definition: AIAct.cs:14
virtual bool IsRoofEditMode(Card c=null)
Definition: ActionMode.cs:311
ScreenGuide guide
BaseTileSelector tileSelector
BaseTileMap tileMap
MeshPass passFloor
Definition: BaseTileMap.cs:145
MeshPass passFloorEx
Definition: BaseTileMap.cs:163
MeshPass passFloorWater
Definition: BaseTileMap.cs:165
RenderData rendererFloorMarker
Definition: BaseTileMap.cs:201
RenderData rendererBlockMarker
Definition: BaseTileMap.cs:199
MeshPass passLiquid
Definition: BaseTileMap.cs:135
void SetRoofHeight(MeshPassParam _param, Cell _cell, int _cx, int _cz, int h=0, int altitude=0, int dirWall=-1, bool ignoreAltitudeY=false)
MeshPass passBlockEx
Definition: BaseTileMap.cs:161
MeshPass passBlock
Definition: BaseTileMap.cs:147
static BuildMenu Instance
Definition: BuildMenu.cs:77
UIRecipeInfo info1
Definition: BuildMenu.cs:27
Definition: Card.cs:11
bool isDestroyed
Definition: Card.cs:73
virtual MoveResult _Move(Point p, MoveType type=MoveType.Walk)
Definition: Card.cs:5541
virtual bool isThing
Definition: Card.cs:2043
ElementContainerCard elements
Definition: Card.cs:39
string id
Definition: Card.cs:33
bool HasElement(int ele, int req=1)
Definition: Card.cs:5638
SourceMaterial.Row DyeMat
Definition: Card.cs:1902
SourceMaterial.Row material
Definition: Card.cs:2013
SoundSource PlaySound(string id, float v=1f, bool spatial=true)
Definition: Card.cs:5852
Card ChangeMaterial(int idNew, bool ignoreFixedMaterial=false)
Definition: Card.cs:2994
Card AddCard(Card c)
Definition: Card.cs:3043
Thing SetNum(int a)
Definition: Card.cs:3393
PlaceState placeState
Definition: Card.cs:81
virtual void SetBlessedState(BlessedState s)
Definition: Card.cs:3787
Point pos
Definition: Card.cs:57
int uid
Definition: Card.cs:120
Trait trait
Definition: Card.cs:51
bool isDyed
Definition: Card.cs:444
ThingContainer things
Definition: Card.cs:36
Card GetRootCard()
Definition: Card.cs:3324
int Evalue(int ele)
Definition: Card.cs:2533
int Num
Definition: Card.cs:156
SourceCategory.Row category
Definition: Card.cs:2011
SourceMaterial.Row matObj
Definition: Cell.cs:1036
bool skipRender
Definition: Cell.cs:270
int floorDir
Definition: Cell.cs:922
int objDir
Definition: Cell.cs:910
byte bridgeHeight
Definition: Cell.cs:74
int blockDir
Definition: Cell.cs:898
Definition: Chara.cs:10
void HoldCard(Card t, int num=-1)
Definition: Chara.cs:4343
void Kick(Point p, bool ignoreSelf=false)
Definition: Chara.cs:5479
Thing Pick(Thing t, bool msg=true, bool tryStack=true)
Definition: Chara.cs:4179
BlockColors blockColors
SkinColorProfile Skin
bool ignoreBuildRule
Definition: CoreDebug.cs:184
Definition: EClass.cs:5
static Game game
Definition: EClass.cs:8
static Scene scene
Definition: EClass.cs:30
static ColorProfile Colors
Definition: EClass.cs:38
static int curve(int a, int start, int step, int rate=75)
Definition: EClass.cs:68
static Map _map
Definition: EClass.cs:18
static SourceManager sources
Definition: EClass.cs:42
static BaseGameScreen screen
Definition: EClass.cs:32
static Player player
Definition: EClass.cs:12
static Chara pc
Definition: EClass.cs:14
static CoreDebug debug
Definition: EClass.cs:48
static UI ui
Definition: EClass.cs:16
static GameSetting setting
Definition: EClass.cs:34
Definition: EInput.cs:8
static bool isShiftDown
Definition: EInput.cs:261
Element GetOrCreateElement(Element ele)
int id
Definition: ELEMENT.cs:248
int Value
Definition: ELEMENT.cs:290
virtual string Name
Definition: ELEMENT.cs:302
RenderSetting render
Definition: GameSetting.cs:301
QuestManager quests
Definition: Game.cs:179
void SetDefaultStage()
Definition: GrowSystem.cs:259
void SetBridge(int x, int z, int height=0, int idMat=0, int idBridge=0, int dir=0)
Definition: Map.cs:968
void SetBlockDir(int x, int z, int dir)
Definition: Map.cs:1161
void MineObjSound(Point point)
Definition: Map.cs:1924
void SetFloor(int x, int z, int idMat=0, int idFloor=0)
Definition: Map.cs:953
void SetBlock(int x, int z, int idMat=0, int idBlock=0)
Definition: Map.cs:992
void SetRoofBlock(int x, int z, int idMat, int idBlock, int dir, int height)
Definition: Map.cs:983
PropsStocked Stocked
Definition: Map.cs:121
void SetObj(int x, int z, int id=0, int value=1, int dir=0)
Definition: Map.cs:1531
void Add(Point point, float tile=0f, float color=0f)
Definition: MeshPass.cs:122
Definition: Msg.cs:5
static string Say(string idLang, string ref1, string ref2=null, string ref3=null, string ref4=null)
Definition: Msg.cs:58
RecipeManager recipes
Definition: Player.cs:1017
Thing DropReward(Thing t, bool silent=false)
Definition: Player.cs:2439
Definition: Point.cs:9
SourceMaterial.Row matBlock
Definition: Point.cs:55
SourceMaterial.Row matFloor
Definition: Point.cs:57
SourceBlock.Row sourceBlock
Definition: Point.cs:63
ref Vector3 Position(int height)
Definition: Point.cs:536
List< Card > ListCards(bool includeMasked=false)
Definition: Point.cs:1035
RenderParam ApplyAnime(RenderParam p)
Definition: Point.cs:1309
int x
Definition: Point.cs:36
Point GetNearestPoint(bool allowBlock=false, bool allowChara=true, bool allowInstalled=true, bool ignoreCenter=false, int minRadius=0)
Definition: Point.cs:607
int z
Definition: Point.cs:39
SourceMaterial.Row matBridge
Definition: Point.cs:59
SourceObj.Row sourceObj
Definition: Point.cs:69
List< Chara > ListCharas()
Definition: Point.cs:1155
SourceFloor.Row sourceFloor
Definition: Point.cs:65
bool HasObj
Definition: Point.cs:137
Cell cell
Definition: Point.cs:51
SourceFloor.Row sourceBridge
Definition: Point.cs:67
GrowSystem growth
Definition: Point.cs:77
bool HasChara
Definition: Point.cs:226
bool HasNonWallBlock
Definition: Point.cs:182
Thing Find(int uid)
Definition: Props.cs:389
ThingStack ListThingStack(Recipe.Ingredient ing, StockSearchMode searchMode)
Definition: Props.cs:204
List< Quest > list
Definition: QuestManager.cs:11
void Remove(Quest q)
Definition: QuestManager.cs:67
Quest Start(string id, string idGlobalChara)
Definition: QuestManager.cs:41
void SetRecipe(Recipe r)
Definition: Quest.cs:7
static Quest Create(string _id, string _idPerson=null, Chara c=null)
Definition: Quest.cs:241
override void BuildIngredientList()
Definition: RecipeCard.cs:65
Dictionary< string, List< int > > lastIngredients
static void BuildList()
HashSet< string > craftedRecipes
static RecipeSource Get(string id)
static Dictionary< string, RecipeSource > dict
Dictionary< string, int > knownRecipes
Element GetReqSkill()
RenderRow row
Definition: RecipeSource.cs:5
List< Recipe.Ingredient > GetIngredients()
string idFactory
Definition: RecipeSource.cs:85
string NameFactory
Definition: RecipeSource.cs:73
string GetDetail()
string type
Definition: RecipeSource.cs:7
bool NeedFactory
Definition: RecipeSource.cs:61
Thing RefreshThing()
Definition: Recipe.cs:68
bool IsThingSpecified
Definition: Recipe.cs:54
string GetName()
Definition: Recipe.cs:105
List< string > idOther
Definition: Recipe.cs:41
bool CanSetThing(Thing t)
Definition: Recipe.cs:89
string tag
Definition: Recipe.cs:38
void SetThing(Thing t=null)
Definition: Recipe.cs:98
IngType ingType
Definition: Recipe.cs:44
string IdThing
Definition: Recipe.cs:57
bool IsValidIngredient(Thing t)
Definition: Recipe.cs:135
Definition: Recipe.cs:7
string id
Definition: Recipe.cs:174
virtual int GetRefVal()
Definition: Recipe.cs:418
SourceMaterial.Row DefaultMaterial
Definition: Recipe.cs:202
int RecipeLv
Definition: Recipe.cs:236
State
Definition: Recipe.cs:9
void SetTextDifficulty(UIText text)
Definition: Recipe.cs:949
virtual void WriteNote(UINote n)
Definition: Recipe.cs:800
void WriteReqSkill(UINote n)
Definition: Recipe.cs:815
void WriteReqFactory(UINote n, bool hasFactory=true)
Definition: Recipe.cs:806
static Recipe Create(Thing t)
Definition: Recipe.cs:339
State state
Definition: Recipe.cs:196
virtual void OnRenderMarker(Point point, bool active, HitResult result, bool main, int dir, int bridgeHeight)
Definition: Recipe.cs:701
virtual bool RequireIngredients
Definition: Recipe.cs:276
int GetMaxCount()
Definition: Recipe.cs:926
virtual string GetIdThing()
Definition: Recipe.cs:435
bool HasSameTile(Point point, int dir, int altitude, int bridgeHeight)
Definition: Recipe.cs:573
virtual IRenderer GetRenderer()
Definition: Recipe.cs:825
virtual Card Mold
Definition: Recipe.cs:250
virtual bool CanRotate
Definition: Recipe.cs:295
virtual TileRow tileRow
Definition: Recipe.cs:204
virtual void Rotate()
Definition: Recipe.cs:838
virtual void SetDir(int d)
Definition: Recipe.cs:881
virtual TileType tileType
Definition: Recipe.cs:211
RecipeSource _source
Definition: Recipe.cs:198
static void DropIngredients(string id, string idMatMain, int num=1)
Definition: Recipe.cs:361
int sync
Definition: Recipe.cs:190
virtual void OnSelected()
Definition: Recipe.cs:830
bool IsObj
Definition: Recipe.cs:240
virtual RenderRow renderRow
Definition: Recipe.cs:206
int idMat
Definition: Recipe.cs:192
RecipeSource source
Definition: Recipe.cs:200
void SaveLastIngredients()
Definition: Recipe.cs:988
int GetSortVal()
Definition: Recipe.cs:957
List< Ingredient > ingredients
Definition: Recipe.cs:177
virtual void Build(TaskBuild task)
Definition: Recipe.cs:618
virtual bool IsFloorOrBridge
Definition: Recipe.cs:222
virtual bool IsBlock
Definition: Recipe.cs:242
bool VirtualBlock
Definition: Recipe.cs:186
bool IsCraftable()
Definition: Recipe.cs:900
void BuildIngredientList(Thing t)
Definition: Recipe.cs:530
IngType
Definition: Recipe.cs:15
QuestTrackCraft GetQuestTrack()
Definition: Recipe.cs:999
virtual SourceMaterial.Row GetMainMaterial()
Definition: Recipe.cs:480
virtual int H
Definition: Recipe.cs:265
virtual int CostMoney
Definition: Recipe.cs:292
static Dictionary< string, Recipe > recipeCache
Definition: Recipe.cs:171
static Recipe Create(RecipeSource _source, int idMat=-1, Thing ing=null)
Definition: Recipe.cs:321
int MaxAltitude
Definition: Recipe.cs:225
virtual bool IsThing
Definition: Recipe.cs:248
bool IsFloor
Definition: Recipe.cs:238
void ToggleTrack(QuestTrackCraft quest)
Definition: Recipe.cs:1013
void TryGetFirstTimeBonus()
Definition: Recipe.cs:976
string Name
Definition: Recipe.cs:208
virtual void Build(Chara chara, Card t, Point pos, int mat, int dir, int altitude, int bridgeHeight)
Definition: Recipe.cs:623
bool IsWallOrFence
Definition: Recipe.cs:244
int GetQualityBonus()
Definition: Recipe.cs:393
bool MultiSize
Definition: Recipe.cs:279
virtual void OnChangeIngredient()
Definition: Recipe.cs:545
virtual string GetDetail()
Definition: Recipe.cs:795
virtual Thing Craft(BlessedState blessed, bool sound=false, List< Thing > ings=null, TraitCrafter crafter=null, bool model=false)
Definition: Recipe.cs:549
bool UseStock
Definition: Recipe.cs:180
bool HasFirstTimeBonus()
Definition: Recipe.cs:963
int _dir
Definition: Recipe.cs:188
int GetDefaultColor()
Definition: Recipe.cs:470
bool IsStaticLV()
Definition: Recipe.cs:379
bool IsBridge
Definition: Recipe.cs:246
static Recipe GetOrCreate(string id)
Definition: Recipe.cs:306
int idSkin
Definition: Recipe.cs:194
string GetName()
Definition: Recipe.cs:773
virtual void SetImage(Image icon)
Definition: Recipe.cs:895
virtual SourceMaterial.Row GetColorMaterial()
Definition: Recipe.cs:494
virtual void BuildIngredientList()
Definition: Recipe.cs:522
BaseTileSelector tileSelector
Definition: Recipe.cs:290
BaseTileSelector.BoxType GetBoxType()
Definition: Recipe.cs:461
virtual void OnChangeAltitude(int a)
Definition: Recipe.cs:834
virtual bool ShouldShowHighlight(HitResult r)
Definition: Recipe.cs:456
virtual int W
Definition: Recipe.cs:253
bool IngAsProduct
Definition: Recipe.cs:183
virtual Recipe Duplicate()
Definition: Recipe.cs:890
void Draw(RenderParam p, int tile)
Definition: RenderData.cs:128
void DrawRepeat(RenderParam p, int count, float size, bool skipFirst=false)
Definition: RenderData.cs:214
Vector3 offset
Definition: RenderData.cs:18
MeshPass pass
Definition: RenderData.cs:16
int GetColorInt(SourceMaterial.Row mat)
Definition: RenderRow.cs:424
RenderData renderData
Definition: RenderRow.cs:71
SourceCategory.Row Category
Definition: RenderRow.cs:119
TileType tileType
Definition: RenderRow.cs:77
int[] _tiles
Definition: RenderRow.cs:12
void SetImage(Image image, Sprite sprite=null, int matCol=0, bool setNativeSize=true, int dir=0, int idSkin=0, Card card=null)
Definition: RenderRow.cs:351
virtual RenderParam GetRenderParam(SourceMaterial.Row mat, int dir, Point point=null, int bridgeHeight=-1)
Definition: RenderRow.cs:388
SourceMaterial.Row DefaultMaterial
Definition: RenderRow.cs:86
ActionMode actionMode
Definition: Scene.cs:79
bool isActive
Definition: ScreenGuide.cs:15
MeshPass passGuideBlock
Definition: ScreenGuide.cs:5
MeshPass passGuideFloor
Definition: ScreenGuide.cs:7
Color GetTextColor(FontColor fontColor)
Dictionary< string, CardRow > map
Definition: SourceCard.cs:8
string GetText(string id="name", bool returnNull=false)
Definition: SourceData.cs:553
SourceMaterial materials
SourceCard cards
SourceCategory categories
int altitude
Definition: TaskBuild.cs:17
Recipe recipe
Definition: TaskBuild.cs:8
int bridgeHeight
Definition: TaskBuild.cs:14
int dir
Definition: TaskBuild.cs:11
Point pos
Definition: TaskPoint.cs:11
Thing Find(int uid)
static Thing CreateBlock(int id, int idMat)
Definition: ThingGen.cs:101
static Thing CreateObj(int id, int idMat)
Definition: ThingGen.cs:116
static Thing CreateFloor(int id, int idMat, bool platform=false)
Definition: ThingGen.cs:108
static Thing Create(string id, int idMat=-1, int lv=-1)
Definition: ThingGen.cs:53
Definition: Thing.cs:8
SourceThing.Row source
Definition: Thing.cs:11
int id
Definition: TileRow.cs:8
virtual BaseTileSelector.BoxType BoxType
Definition: TileType.cs:263
static TileTypeBridge Bridge
Definition: TileType.cs:65
virtual bool IsFloor
Definition: TileType.cs:139
virtual int MaxAltitude
Definition: TileType.cs:207
virtual float RepeatSize
Definition: TileType.cs:231
virtual bool IsWallOrFence
Definition: TileType.cs:143
virtual bool AltitudeAsDir
Definition: TileType.cs:209
virtual bool IsFloorOrBridge
Definition: TileType.cs:135
virtual bool CanRotate(bool buildMode)
Definition: TileType.cs:284
virtual BlockRenderMode blockRenderMode
Definition: TileType.cs:267
virtual bool ChangeBlockDir
Definition: TileType.cs:127
static TileTypeDoor Door
Definition: TileType.cs:95
virtual bool IsBlockPass
Definition: TileType.cs:153
virtual bool IsWater
Definition: TileType.cs:163
virtual void OnCrafted(Recipe recipe, List< Thing > ings)
Definition: Trait.cs:655
UIText text1
Definition: UIItem.cs:6
Definition: UINote.cs:6
UIItem AddHeaderTopic(string text, Sprite sprite=null)
Definition: UINote.cs:89
void Clear()
Definition: UINote.cs:35
UIItem AddText(string text, FontColor color=FontColor.DontChange)
Definition: UINote.cs:113
void Space(int sizeY=0, int sizeX=1)
Definition: UINote.cs:62
void Build()
Definition: UINote.cs:49
void OnRotate()
Definition: UIText.cs:6
void SetText(string s)
Definition: UIText.cs:159
UIText SetSize(int a)
Definition: UIText.cs:227
static void RefreshButtons()
static WidgetQuestTracker Instance