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