Elin Decompiled Documentation EA 23.339.0 Nightly
Loading...
Searching...
No Matches
Trait.cs
Go to the documentation of this file.
1using System;
2using System.Collections.Generic;
3using System.Linq;
4using UnityEngine;
5
6public class Trait : EClass
7{
8 public enum TileMode
9 {
10 Default,
11 Door,
17 }
18
19 public enum CopyShopType
20 {
21 None,
22 Item,
24 }
25
27
28 public Card owner;
29
30 protected static List<Point> listRadiusPoints = new List<Point>();
31
32 public string[] Params
33 {
34 get
35 {
36 if (!owner.c_editorTraitVal.IsEmpty())
37 {
38 return ("," + owner.c_editorTraitVal).Split(',');
39 }
40 return owner.sourceCard.trait;
41 }
42 }
43
44 public virtual byte WeightMod => 0;
45
46 public virtual int IdSkin => owner.idSkin;
47
48 public virtual string Name => owner.NameSimple;
49
50 public virtual TileType tileType => owner.TileType;
51
52 public virtual RefCardName RefCardName => RefCardName.Default;
53
54 public virtual bool IsBlockPath => tileType.IsBlockPass;
55
56 public virtual bool IsBlockSight => tileType.IsBlockSight;
57
58 public virtual bool IsDoor => false;
59
60 public virtual bool IsOpenSight => false;
61
62 public virtual bool IsOpenPath => false;
63
64 public virtual bool IsFloating => false;
65
66 public virtual bool IsNoShop => false;
67
68 public virtual bool IsGround => false;
69
70 public virtual bool IsOnlyUsableByPc => false;
71
72 public virtual bool InvertHeldSprite => false;
73
74 public virtual bool IsChangeFloorHeight => owner.Pref.Surface;
75
76 public virtual bool ShouldRefreshTile
77 {
78 get
79 {
80 if (!IsBlockPath && !IsOpenSight)
81 {
82 return IsBlockSight;
83 }
84 return true;
85 }
86 }
87
88 public virtual bool ShouldTryRefreshRoom => IsDoor;
89
90 public virtual int InstallBottomPriority => -1;
91
92 public virtual bool CanHarvest => true;
93
94 public virtual int radius => 0;
95
96 public virtual TraitRadiusType radiusType => TraitRadiusType.Default;
97
98 public virtual bool CanUseRoomRadius => true;
99
100 public virtual int GuidePriotiy => 0;
101
102 public virtual int OriginalElectricity
103 {
104 get
105 {
106 if (!owner.isThing)
107 {
108 return 0;
109 }
110 int electricity = owner.Thing.source.electricity;
111 if (electricity > 0 || EClass._zone == null || EClass._zone.branch == null)
112 {
113 return electricity;
114 }
115 return electricity * 100 / (100 + EClass._zone.branch.Evalue(2700) / 2);
116 }
117 }
118
119 public virtual int Electricity => OriginalElectricity;
120
121 public virtual bool IgnoreLastStackHeight => false;
122
123 public virtual int Decay => owner.material.decay;
124
125 public virtual int DecaySpeed => 100;
126
127 public virtual int DecaySpeedChild => 100;
128
129 public virtual bool IsFridge => false;
130
131 public virtual int DefaultStock => 1;
132
133 public virtual bool HoldAsDefaultInteraction => false;
134
135 public virtual int CraftNum => 1;
136
137 public virtual bool ShowOrbit => false;
138
139 public virtual bool HaveUpdate => false;
140
141 public virtual bool IsSpot => radius > 0;
142
143 public virtual bool IsFactory => false;
144
145 public virtual bool CanAutofire => false;
146
147 public virtual bool CanName => false;
148
149 public virtual bool CanPutAway
150 {
151 get
152 {
153 if (!CanOnlyCarry)
154 {
155 return !owner.HasTag(CTAG.godArtifact);
156 }
157 return false;
158 }
159 }
160
161 public virtual bool CanChangeHeight => true;
162
163 public virtual bool CanStack => owner.category.maxStack > 1;
164
165 public virtual bool CanCopyInBlueprint
166 {
167 get
168 {
169 if (owner.rarity <= Rarity.Superior && owner.sourceCard.value > 0)
170 {
171 return CanBeDestroyed;
172 }
173 return false;
174 }
175 }
176
177 public virtual bool CanBeAttacked => false;
178
179 public virtual bool CanBeTeleported => !owner.IsMultisize;
180
181 public virtual bool CanExtendBuild => false;
182
183 public virtual string langNote => "";
184
185 public virtual string IDInvStyle => "default";
186
187 public virtual string IDActorEx => owner.Thing.source.idActorEx;
188
189 public virtual bool MaskOnBuild => false;
190
191 public virtual bool ShowContextOnPick => false;
192
193 public virtual bool IsThrowMainAction
194 {
195 get
196 {
197 if (!owner.HasTag(CTAG.throwWeapon))
198 {
199 return owner.IsMeleeWeapon;
200 }
201 return true;
202 }
203 }
204
205 public virtual bool LevelAsQuality => false;
206
207 public virtual bool UseDummyTile => true;
208
209 public virtual bool RequireFullStackCheck => false;
210
211 public virtual bool DisableAutoCombat => false;
212
214 {
215 get
216 {
217 if (!owner.IsPC)
218 {
219 return InvGridSize.Default;
220 }
221 return InvGridSize.Backpack;
222 }
223 }
224
225 public virtual bool IsContainer => false;
226
227 public virtual bool CanUseContent => CanSearchContent;
228
229 public virtual bool CanSearchContent
230 {
231 get
232 {
233 if (!owner.isChara)
234 {
235 if (IsContainer)
236 {
237 return owner.c_lockLv == 0;
238 }
239 return false;
240 }
241 return true;
242 }
243 }
244
245 public virtual bool CanOpenContainer
246 {
247 get
248 {
249 if (IsContainer)
250 {
251 return !owner.isNPCProperty;
252 }
253 return false;
254 }
255 }
256
257 public virtual bool IsSpecialContainer => false;
258
259 public virtual ContainerType ContainerType => ContainerType.Default;
260
261 public virtual ThrowType ThrowType => ThrowType.Default;
262
263 public virtual EffectDead EffectDead => EffectDead.Default;
264
265 public virtual bool IsHomeItem => false;
266
267 public virtual bool IsAltar => false;
268
269 public virtual bool IsRestSpot => false;
270
271 public virtual bool CanBeMasked => false;
272
273 public virtual bool IsLocalAct => true;
274
275 public virtual bool IsBlendBase => false;
276
277 public virtual bool CanBeOnlyBuiltInHome => false;
278
279 public virtual bool CanBuildInTown
280 {
281 get
282 {
284 {
286 }
287 return false;
288 }
289 }
290
291 public virtual bool CanBeHeld => ReqHarvest == null;
292
293 public virtual bool CanBeStolen
294 {
295 get
296 {
297 if (!CanOnlyCarry)
298 {
299 return CanBeHeld;
300 }
301 return false;
302 }
303 }
304
305 public virtual bool CanOnlyCarry => false;
306
307 public virtual bool CanBeDestroyed => true;
308
309 public virtual bool CanBeSmashedToDeath => false;
310
311 public virtual bool CanBeHallucinated => true;
312
313 public virtual bool CanBeDropped => true;
314
315 public virtual string ReqHarvest => null;
316
317 public virtual bool CanBeDisassembled
318 {
319 get
320 {
321 if (CanBeDestroyed && !(this is TraitTrap) && owner.things.Count == 0)
322 {
323 return owner.rarity < Rarity.Artifact;
324 }
325 return false;
326 }
327 }
328
329 public virtual bool CanBeShipped
330 {
331 get
332 {
333 if (!owner.IsImportant)
334 {
335 return !owner.IsUnique;
336 }
337 return false;
338 }
339 }
340
341 public virtual bool HasCharges => false;
342
343 public virtual bool ShowCharges => HasCharges;
344
345 public virtual bool ShowChildrenNumber => IsContainer;
346
347 public virtual bool ShowAsTool => false;
348
349 public virtual bool CanBeHeldAsFurniture
350 {
351 get
352 {
353 if (!(this is TraitTool))
354 {
355 return IsThrowMainAction;
356 }
357 return true;
358 }
359 }
360
361 public virtual bool HideInAdv => false;
362
363 public virtual bool NoHeldDir => false;
364
365 public virtual bool AlwaysHideOnLowWall => false;
366
368
369 public virtual bool RenderExtra => false;
370
371 public virtual float DropChance => 0f;
372
373 public virtual string IdNoRestock => owner.id;
374
375 public virtual int IdleUseChance => 3;
376
377 public virtual string RecipeCat => owner.sourceCard.RecipeCat;
378
379 public virtual bool IsTool => false;
380
381 public virtual string LangUse => "actUse";
382
383 public virtual bool IgnoreOnSteppedWhenMoving => false;
384
385 public virtual bool IsOn => owner.isOn;
386
387 public virtual bool IsAnimeOn
388 {
389 get
390 {
391 if (!IsOn)
392 {
393 return !IsToggle;
394 }
395 return true;
396 }
397 }
398
399 public bool IsToggle => ToggleType != ToggleType.None;
400
401 public virtual bool AutoToggle
402 {
403 get
404 {
405 if (IsLighting || ToggleType == ToggleType.Curtain || ToggleType == ToggleType.Electronics)
406 {
407 return !owner.disableAutoToggle;
408 }
409 return false;
410 }
411 }
412
413 public bool IsLighting
414 {
415 get
416 {
417 if (ToggleType != ToggleType.Fire)
418 {
419 return ToggleType == ToggleType.Light;
420 }
421 return true;
422 }
423 }
424
425 public virtual bool IsLightOn
426 {
427 get
428 {
429 if (!owner.isChara)
430 {
431 return owner.isOn;
432 }
433 return true;
434 }
435 }
436
437 public virtual bool IsNightOnlyLight
438 {
439 get
440 {
441 if (ToggleType != ToggleType.Electronics && IsToggle)
442 {
443 return !owner.isRoofItem;
444 }
445 return false;
446 }
447 }
448
449 public virtual TileMode tileMode => TileMode.Default;
450
451 public virtual bool UseAltTiles => owner.isOn;
452
453 public virtual bool UseLowblock => false;
454
455 public virtual bool UseExtra => true;
456
457 public virtual bool UseLightColor => true;
458
459 public virtual Color? ColorExtra => null;
460
461 public virtual int MaxFuel
462 {
463 get
464 {
465 if (ToggleType != ToggleType.Fire)
466 {
467 return 0;
468 }
469 return 100;
470 }
471 }
472
473 public virtual int FuelCost => 1;
474
475 public virtual bool ShowFuelWindow => true;
476
477 public bool IsRequireFuel => MaxFuel > 0;
478
479 public string IdToggleExtra => owner.Thing?.source.idToggleExtra;
480
481 public virtual ToggleType ToggleType
482 {
483 get
484 {
485 if (Electricity >= 0)
486 {
487 return ToggleType.None;
488 }
489 return ToggleType.Electronics;
490 }
491 }
492
493 public virtual string IdSoundToggleOn
494 {
495 get
496 {
497 if (Electricity >= 0)
498 {
499 if (ToggleType != ToggleType.Fire)
500 {
501 return "switch_on";
502 }
503 return "torch_lit";
504 }
505 return "switch_on_electricity";
506 }
507 }
508
509 public virtual string IdSoundToggleOff
510 {
511 get
512 {
513 if (Electricity >= 0)
514 {
515 if (ToggleType != ToggleType.Fire)
516 {
517 return "switch_off";
518 }
519 return "torch_unlit";
520 }
521 return "switch_off_electricity";
522 }
523 }
524
525 public virtual int ShopLv => Mathf.Max(1, EClass._zone.development / 10 + owner.c_invest * (100 + Guild.Merchant.InvestBonus()) / 100 + 1);
526
527 public virtual CopyShopType CopyShop => CopyShopType.None;
528
529 public virtual int NumCopyItem => 2 + Mathf.Min(owner.c_invest / 10, 3);
530
531 public virtual ShopType ShopType
532 {
533 get
534 {
535 if (!owner.GetStr("merchant_override").IsEmpty())
536 {
537 return ShopType.CustomContent;
538 }
539 return ShopType.None;
540 }
541 }
542
543 public virtual CurrencyType CurrencyType => CurrencyType.Money;
544
545 public virtual PriceType PriceType => PriceType.Default;
546
547 public virtual bool AllowSell
548 {
549 get
550 {
551 if (CurrencyType != CurrencyType.Money)
552 {
553 return CurrencyType == CurrencyType.None;
554 }
555 return true;
556 }
557 }
558
559 public virtual int CostRerollShop
560 {
561 get
562 {
563 if (CurrencyType == CurrencyType.Money || CurrencyType == CurrencyType.Influence)
564 {
565 return 1;
566 }
567 return 0;
568 }
569 }
570
571 public virtual bool AllowCriminal => owner.isThing;
572
573 public virtual int RestockDay => 5;
574
575 public virtual SlaverType SlaverType => SlaverType.None;
576
577 public virtual string LangBarter => "daBuy";
578
579 public virtual bool RemoveGlobalOnBanish => false;
580
581 public virtual bool CanChangeAffinity => true;
582
583 public string TextNextRestock => GetTextRestock(LangBarter, pet: false);
584
585 public string TextNextRestockPet => GetTextRestock((SlaverType == SlaverType.Slave) ? "daBuySlave" : "daBuyPet", pet: true);
586
587 public string GetParam(int i, string def = null)
588 {
589 if (i < Params.Length)
590 {
591 return Params[i];
592 }
593 return def;
594 }
595
596 public int GetParamInt(int i, int def)
597 {
598 if (i < Params.Length)
599 {
600 return Params[i].ToInt();
601 }
602 return def;
603 }
604
605 public virtual SourcePref GetPref()
606 {
607 return null;
608 }
609
610 public virtual RenderData GetRenderData()
611 {
612 return null;
613 }
614
615 public virtual bool Contains(RecipeSource r)
616 {
617 return r.idFactory == ((owner.sourceCard.origin != null) ? owner.sourceCard.origin.id : owner.id);
618 }
619
620 public virtual int GetValue()
621 {
622 return owner.sourceCard.value;
623 }
624
625 public virtual bool CanStackTo(Thing to)
626 {
627 return CanStack;
628 }
629
630 public virtual string GetHoverText()
631 {
632 return null;
633 }
634
635 public virtual Action GetHealAction(Chara c)
636 {
637 return null;
638 }
639
640 public virtual bool CanBlend(Thing t)
641 {
642 return false;
643 }
644
645 public virtual void OnBlend(Thing t, Chara c)
646 {
647 }
648
649 public virtual int GetActDuration(Chara c)
650 {
651 return 0;
652 }
653
655 {
656 return null;
657 }
658
659 public virtual Sprite GetRefSprite()
660 {
661 return null;
662 }
663
664 public virtual void OnRenderExtra(RenderParam p)
665 {
666 }
667
668 public virtual Emo2 GetHeldEmo(Chara c)
669 {
670 return Emo2.none;
671 }
672
673 public virtual void SetOwner(Card _owner)
674 {
675 owner = _owner;
676 OnSetOwner();
677 }
678
679 public virtual bool IdleUse(Chara c, int dist)
680 {
681 return false;
682 }
683
684 public virtual void OnSetOwner()
685 {
686 }
687
688 public virtual void OnImportMap()
689 {
690 }
691
692 public virtual void SetParams(params string[] s)
693 {
694 }
695
696 public virtual void OnCrafted(Recipe recipe, List<Thing> ings)
697 {
698 }
699
700 public virtual void OnCreate(int lv)
701 {
702 }
703
704 public virtual void OnEquip(Chara c, bool onSetOwner)
705 {
706 }
707
708 public virtual void OnUnequip(Chara c)
709 {
710 }
711
712 public virtual void OnChangePlaceState(PlaceState state)
713 {
714 }
715
716 public virtual void OnAddedToZone()
717 {
718 }
719
720 public virtual void OnRemovedFromZone()
721 {
722 }
723
724 public virtual void OnSimulateHour(VirtualDate date)
725 {
726 }
727
728 public virtual string GetName()
729 {
730 return owner.sourceCard.GetText();
731 }
732
733 public virtual void SetName(ref string s)
734 {
735 }
736
737 public virtual void OnRenderTile(Point point, HitResult result, int dir)
738 {
739 if (radius == 0)
740 {
741 return;
742 }
743 Vector3 vector = point.Position();
744 vector.z += EClass.setting.render.thingZ;
745 foreach (Point item in ListPoints(point))
746 {
747 Vector3 vector2 = item.Position();
748 EClass.screen.guide.passGuideFloor.Add(vector2.x, vector2.y, vector2.z, 10f, 0.3f);
749 }
750 }
751
752 public virtual void OnListInteraction(InvOwner.ListInteraction list, ButtonGrid b, bool context)
753 {
754 Card card = owner;
755 Thing t = card as Thing;
756 if (t == null)
757 {
758 return;
759 }
760 if (!LayerChara.Instance)
761 {
762 if (CanRead(EClass.pc))
763 {
764 list.Add("invRead", 110, delegate
765 {
766 t.DoAct(new AI_Read
767 {
768 target = t
769 });
770 }, "remove");
771 }
772 if (CanUse(EClass.pc))
773 {
774 list.Add(LangUse, 120, delegate
775 {
776 if (OnUse(EClass.pc))
777 {
778 EClass.player.EndTurn();
779 }
780 }, "use");
781 }
782 if (CanDrink(EClass.pc))
783 {
784 list.Add("invDrink", 130, delegate
785 {
786 t.DoAct(new AI_Drink
787 {
788 target = t
789 });
790 }, "remove");
791 }
792 else if (CanEat(EClass.pc))
793 {
794 list.Add("invFood", 140, delegate
795 {
796 t.DoAct(new AI_Eat
797 {
798 cook = false,
799 target = t
800 });
801 }, "remove");
802 }
803 if (IsBlendBase)
804 {
805 list.Add("invBlend", 150, delegate
806 {
808 }, "blend");
809 }
810 }
811 if (!context || !CanName)
812 {
813 return;
814 }
815 list.Add("changeName", 200, delegate
816 {
817 Dialog.InputName("dialogChangeName", t.c_refText.IsEmpty(""), delegate(bool cancel, string text)
818 {
819 if (!cancel)
820 {
821 t.c_refText = text;
822 }
823 });
824 });
825 }
826
827 public virtual int CompareTo(Card b)
828 {
829 return 0;
830 }
831
832 public virtual bool CanBuiltAt(Point p)
833 {
834 return true;
835 }
836
837 public virtual void Update()
838 {
839 }
840
842 {
843 return owner.pos;
844 }
845
846 public Point GetRandomPoint(Func<Point, bool> func = null, Chara accessChara = null)
847 {
848 if (radius == 0)
849 {
850 return owner.pos;
851 }
852 List<Point> list = ListPoints();
853 for (int i = 0; i < 50; i++)
854 {
855 Point point = list.RandomItem();
856 if (point.IsValid && (func == null || func(point)) && (accessChara == null || accessChara.HasAccess(point)))
857 {
858 return point;
859 }
860 }
861 return list[0];
862 }
863
864 public virtual List<Point> ListPoints(Point center = null, bool onlyPassable = true, bool allowChara = true)
865 {
866 listRadiusPoints.Clear();
867 if (center == null)
868 {
869 center = owner.pos;
870 }
871 if (radius == 0)
872 {
873 listRadiusPoints.Add(center.Copy());
874 return listRadiusPoints;
875 }
876 Room room = center.cell.room;
877 if (room != null && CanUseRoomRadius)
878 {
879 foreach (Point point in room.points)
880 {
881 if (allowChara || !point.HasChara)
882 {
883 if (radiusType == TraitRadiusType.Farm)
884 {
885 listRadiusPoints.Add(point.Copy());
886 }
887 else if ((!onlyPassable || !point.cell.blocked) && !point.cell.HasBlock && point.cell.HasFloor)
888 {
889 listRadiusPoints.Add(point.Copy());
890 }
891 }
892 }
893 }
894 else
895 {
896 EClass._map.ForeachSphere(center.x, center.z, radius + 1, delegate(Point p)
897 {
898 if (allowChara || !p.HasChara)
899 {
900 if (radiusType == TraitRadiusType.Farm)
901 {
902 if (!p.cell.HasBlock || p.cell.HasFence)
903 {
904 listRadiusPoints.Add(p.Copy());
905 }
906 }
907 else if ((!onlyPassable || !p.cell.blocked) && !p.cell.HasBlock && p.cell.HasFloor && (!onlyPassable || Los.IsVisible(center, p)))
908 {
909 listRadiusPoints.Add(p.Copy());
910 }
911 }
912 });
913 }
914 if (listRadiusPoints.Count == 0)
915 {
916 listRadiusPoints.Add(center.Copy());
917 }
918 return listRadiusPoints;
919 }
920
921 public virtual Recipe GetRecipe()
922 {
923 return Recipe.Create(owner.Thing);
924 }
925
926 public virtual Recipe GetBuildModeRecipe()
927 {
928 return Recipe.Create(owner.Thing);
929 }
930
931 public virtual bool CanCook(Card c)
932 {
933 if (c == null || !ExistsOnMap || !(c.trait is TraitFood))
934 {
935 return false;
936 }
937 return true;
938 }
939
940 public void CookProgress()
941 {
942 if (!ExistsOnMap)
943 {
944 return;
945 }
946 foreach (Card item in owner.pos.ListCards())
947 {
948 owner.PlaySound("cook");
949 item.renderer.PlayAnime(AnimeID.Jump);
950 }
951 }
952
953 public virtual bool CanOffer(Chara cc, Card tg)
954 {
955 if (tg == null || tg.isChara || tg.trait.CanOnlyCarry)
956 {
957 return false;
958 }
959 if (tg.rarity == Rarity.Artifact)
960 {
961 return false;
962 }
963 return true;
964 }
965
966 public void OfferProcess(Chara cc)
967 {
968 if (!ExistsOnMap)
969 {
970 return;
971 }
972 SourceReligion.Row row = EClass.sources.religions.map.TryGetValue(owner.c_idDeity, EClass.sources.religions.map["eyth"]);
973 string @ref = row.GetTextArray("name2")[1];
974 string ref2 = row.GetTextArray("name2")[0];
975 if (EClass.rnd(3) == 0)
976 {
977 cc.Talk("offer", @ref, ref2);
978 }
979 foreach (Card item in owner.pos.ListCards())
980 {
981 if (CanOffer(cc, item))
982 {
983 item.renderer.PlayAnime(AnimeID.Shiver);
984 }
985 }
986 }
987
988 public void Offer(Chara cc)
989 {
990 if (!ExistsOnMap)
991 {
992 return;
993 }
994 foreach (Card item in owner.pos.ListCards())
995 {
996 if (CanOffer(cc, item))
997 {
998 item.Destroy();
999 cc.depression.Mod(100);
1000 owner.PlaySound("offering");
1001 }
1002 }
1003 }
1004
1005 public virtual bool TryProgress(AIProgress p)
1006 {
1007 return true;
1008 }
1009
1010 public virtual LockOpenState TryOpenLock(Chara cc, bool msgFail = true)
1011 {
1012 Thing thing = cc.things.FindBest<TraitLockpick>((Thing t) => -t.c_charges);
1013 int num = ((thing == null) ? (cc.Evalue(280) / 2 + 2) : (cc.Evalue(280) + 10));
1014 int num2 = owner.c_lockLv;
1015 bool flag = this is TraitChestPractice;
1016 if (flag)
1017 {
1018 num2 = num / 4 * 3 - 1;
1019 }
1020 if (num <= num2 && cc.IsPC)
1021 {
1022 cc.PlaySound("lock");
1023 cc.Say("openLockFail2");
1024 owner.PlayAnime(AnimeID.Shiver);
1025 return LockOpenState.NotEnoughSkill;
1026 }
1027 if (thing != null && !flag)
1028 {
1029 thing.ModCharge(-1, destroy: true);
1030 }
1031 if (EClass.rnd(num + 6) > num2 + 5 || (!cc.IsPC && EClass.rnd(20) == 0) || EClass.rnd(200) == 0)
1032 {
1033 cc.PlaySound("lock_open");
1034 cc.Say("lockpick_success", cc, owner);
1035 int num3 = 100 + num2 * 10;
1036 if (owner.c_lockedHard)
1037 {
1038 num3 *= 10;
1039 }
1040 cc.ModExp(280, num3);
1041 OnLockOpen(cc);
1042 return LockOpenState.Success;
1043 }
1044 cc.PlaySound("lock");
1045 if (cc.IsPC)
1046 {
1047 cc.Say("openLockFail");
1048 }
1049 cc.ModExp(280, (thing != null) ? 50 : 30);
1050 if ((thing == null) | (EClass.rnd(2) == 0))
1051 {
1052 cc.stamina.Mod(-1);
1053 }
1054 return LockOpenState.Fail;
1055 }
1056
1057 public virtual LockOpenState TryPryOpenLock(Chara cc, bool msgFail = true)
1058 {
1059 Thing tool = cc.Tool;
1060 cc.stamina.Mod(-1);
1061 Point pos = owner.GetRootCard().pos;
1063 material.PlayHitEffect(pos);
1064 material.AddBlood(pos);
1065 if (!cc.IsAliveInCurrentZone || tool == null)
1066 {
1067 return LockOpenState.Fail;
1068 }
1069 cc.ModExp(280, 20);
1070 cc.ModExp(70, 30);
1071 int a = Mathf.Clamp(20 * tool.material.hardness / material.hardness, 10, 150);
1072 owner.hp -= EClass.rnd(a);
1073 int num = (int)Mathf.Clamp(20L * (long)(owner.c_lockLv + 20) / cc.STR, 5f, 50f);
1074 if (owner.c_lockedHard)
1075 {
1076 num = num * 3 / 2;
1077 }
1078 if (EClass.rnd(100) < num)
1079 {
1080 DamageRandomProperty(cc);
1081 }
1082 if (owner.hp < 0)
1083 {
1084 cc.Say("pry_success", cc, owner);
1085 if (owner.trait is TraitChestPractice)
1086 {
1087 cc.PlaySound("lock_open");
1088 }
1089 OnLockOpen(cc);
1090 foreach (Thing item in owner.things.List((Thing thing) => thing.Num > 10))
1091 {
1092 item.SetNum(item.Num / 10 * 8);
1093 }
1094 if (!(owner.trait is TraitChestPractice))
1095 {
1096 if (owner.isNPCProperty && cc.IsPC)
1097 {
1099 }
1100 owner.Die();
1101 }
1102 return LockOpenState.Success;
1103 }
1104 return LockOpenState.Fail;
1105 }
1106
1108 {
1109 Thing thing = owner.things.List((Thing a) => a.category.id == "currency" || !a.IsUnique).RandomItem();
1110 if (thing != null)
1111 {
1112 if (thing.Num > 10)
1113 {
1114 thing.SetNum(thing.Num / 10 * 9);
1115 }
1116 else if (thing.Num > 1)
1117 {
1118 thing.SetNum(thing.Num - 1);
1119 }
1120 else
1121 {
1122 thing.Destroy();
1123 }
1124 cc.Say("pry_damage", cc, thing);
1125 }
1126 }
1127
1128 public virtual void OnLockOpen(Chara cc)
1129 {
1130 owner.c_lockLv = 0;
1131 if (owner.c_lockedHard)
1132 {
1133 owner.c_lockedHard = false;
1134 owner.c_priceAdd = 0;
1135 }
1136 if (cc.IsPC && owner.isLostProperty)
1137 {
1139 }
1140 owner.isLostProperty = false;
1141 if (owner.GetBool(127))
1142 {
1143 Steam.GetAchievement(ID_Achievement.FIAMA_CHEST);
1144 }
1145 }
1146
1147 public virtual void WriteNote(UINote n, bool identified)
1148 {
1149 }
1150
1152 {
1153 _ = 7;
1154 return owner.sourceCard._index;
1155 }
1156
1157 public virtual HotItem GetHotItem()
1158 {
1159 return new HotItemHeld(owner as Thing);
1160 }
1161
1162 public virtual bool CanRead(Chara c)
1163 {
1164 return false;
1165 }
1166
1167 public virtual void OnRead(Chara c)
1168 {
1169 }
1170
1171 public virtual bool CanEat(Chara c)
1172 {
1173 return owner.HasElement(10);
1174 }
1175
1176 public virtual void OnEat(Chara c)
1177 {
1178 }
1179
1180 public virtual bool CanDrink(Chara c)
1181 {
1182 return false;
1183 }
1184
1185 public virtual void OnDrink(Chara c)
1186 {
1187 }
1188
1189 public virtual void OnThrowGround(Chara c, Point p)
1190 {
1191 }
1192
1193 public virtual bool CanUse(Chara c)
1194 {
1195 return false;
1196 }
1197
1198 public virtual bool CanUse(Chara c, Card tg)
1199 {
1200 return false;
1201 }
1202
1203 public virtual bool CanUse(Chara c, Point p)
1204 {
1205 return false;
1206 }
1207
1208 public virtual bool OnUse(Chara c)
1209 {
1210 if (c.held != owner)
1211 {
1212 c.TryHoldCard(owner);
1213 }
1214 return true;
1215 }
1216
1217 public virtual bool OnUse(Chara c, Card tg)
1218 {
1219 return true;
1220 }
1221
1222 public virtual bool OnUse(Chara c, Point p)
1223 {
1224 return true;
1225 }
1226
1227 public virtual void TrySetAct(ActPlan p)
1228 {
1229 if (CanUse(owner.Chara))
1230 {
1231 p.TrySetAct(LangUse, () => OnUse(p.cc), owner);
1232 }
1233 }
1234
1235 public virtual void TrySetHeldAct(ActPlan p)
1236 {
1237 }
1238
1239 public virtual void OnHeld()
1240 {
1241 }
1242
1243 public virtual void OnTickHeld()
1244 {
1245 }
1246
1247 public virtual void OnSetCurrentItem()
1248 {
1249 }
1250
1251 public virtual void OnUnsetCurrentItem()
1252 {
1253 }
1254
1255 public virtual bool OnChildDecay(Card c, bool firstDecay)
1256 {
1257 return true;
1258 }
1259
1260 public virtual bool CanChildDecay(Card c)
1261 {
1262 return false;
1263 }
1264
1265 public virtual void OnSetCardGrid(ButtonGrid b)
1266 {
1267 }
1268
1269 public virtual void OnStepped(Chara c)
1270 {
1271 }
1272
1273 public virtual void OnSteppedOut(Chara c)
1274 {
1275 }
1276
1277 public virtual void OnOpenDoor(Chara c)
1278 {
1279 }
1280
1281 public void Install(bool byPlayer)
1282 {
1283 if (Electricity != 0)
1284 {
1285 EClass._zone.dirtyElectricity = true;
1286 if (Electricity > 0)
1287 {
1288 EClass._zone.electricity += Electricity;
1289 EClass.pc.PlaySound("electricity_on");
1290 }
1291 }
1292 TryToggle();
1293 owner.RecalculateFOV();
1294 if (EClass._zone.isStarted && ToggleType == ToggleType.Fire && owner.isOn)
1295 {
1296 owner.PlaySound("fire");
1297 }
1298 OnInstall(byPlayer);
1299 }
1300
1301 public void Uninstall()
1302 {
1303 if (Electricity != 0)
1304 {
1305 if (owner.isOn)
1306 {
1307 Toggle(on: false, silent: true);
1308 }
1309 EClass._zone.dirtyElectricity = true;
1310 if (Electricity > 0)
1311 {
1312 EClass._zone.electricity -= Electricity;
1313 EClass.pc.PlaySound("electricity_off");
1314 }
1315 }
1316 OnUninstall();
1317 }
1318
1319 public virtual void OnInstall(bool byPlayer)
1320 {
1321 }
1322
1323 public virtual void OnUninstall()
1324 {
1325 }
1326
1327 public virtual void TryToggle()
1328 {
1329 if (!owner.IsInstalled)
1330 {
1331 return;
1332 }
1333 if (Electricity < 0 && owner.isOn && EClass._zone.electricity < 0)
1334 {
1335 Toggle(on: false, silent: true);
1336 }
1337 else if (AutoToggle)
1338 {
1339 int num = ((EClass._map.config.hour == -1) ? EClass.world.date.hour : EClass._map.config.hour);
1340 bool flag = !IsNightOnlyLight || num >= 17 || num <= 5 || EClass._map.IsIndoor;
1342 {
1343 flag = false;
1344 }
1345 Toggle(flag, silent: true);
1346 }
1347 }
1348
1349 public virtual void Toggle(bool on, bool silent = false)
1350 {
1351 if (owner.isOn == on)
1352 {
1353 return;
1354 }
1355 if (Electricity < 0)
1356 {
1357 if (on)
1358 {
1359 if (EClass._zone.electricity + Electricity < 0)
1360 {
1362 {
1363 if (!silent)
1364 {
1365 owner.Say("notEnoughElectricity", owner);
1366 }
1367 owner.PlaySound("electricity_insufficient");
1368 }
1369 return;
1370 }
1371 EClass._zone.electricity += Electricity;
1372 }
1373 else
1374 {
1375 EClass._zone.electricity -= Electricity;
1376 }
1377 }
1378 owner.isOn = on;
1379 PlayToggleEffect(silent);
1380 OnToggle();
1381 }
1382
1383 public virtual void PlayToggleEffect(bool silent)
1384 {
1385 bool flag = ToggleType == ToggleType.Fire;
1386 bool isOn = owner.isOn;
1387 switch (ToggleType)
1388 {
1389 case ToggleType.Lever:
1390 if (!silent)
1391 {
1392 owner.Say("lever", EClass.pc, owner);
1393 owner.PlaySound("switch_lever");
1394 }
1395 return;
1396 case ToggleType.Curtain:
1397 if (!silent)
1398 {
1399 owner.Say(isOn ? "close" : "open", EClass.pc, owner);
1400 owner.PlaySound("Material/leather_drop");
1401 }
1402 owner.pos.RefreshNeighborTiles();
1404 return;
1405 case ToggleType.None:
1406 return;
1407 }
1408 if (isOn)
1409 {
1410 if (!silent)
1411 {
1412 owner.Say(flag ? "toggle_fire" : "toggle_ele", EClass.pc, owner);
1413 owner.PlaySound(IdSoundToggleOn);
1414 }
1415 RefreshRenderer();
1416 owner.RecalculateFOV();
1417 }
1418 else
1419 {
1420 if (!silent)
1421 {
1422 owner.PlaySound(IdSoundToggleOff);
1423 }
1424 RefreshRenderer();
1425 owner.RecalculateFOV();
1426 }
1427 }
1428
1429 public virtual void OnToggle()
1430 {
1431 }
1432
1433 public virtual void TrySetToggleAct(ActPlan p)
1434 {
1435 if (!p.IsSelfOrNeighbor)
1436 {
1437 return;
1438 }
1439 switch (ToggleType)
1440 {
1441 case ToggleType.Lever:
1442 p.TrySetAct("ActToggleLever", delegate
1443 {
1444 Toggle(!owner.isOn);
1445 return true;
1446 }, owner);
1447 break;
1448 case ToggleType.Curtain:
1449 p.TrySetAct(owner.isOn ? "actOpen" : "actClose", delegate
1450 {
1451 Toggle(!owner.isOn);
1452 return true;
1453 }, owner);
1454 break;
1455 case ToggleType.Fire:
1456 case ToggleType.Light:
1457 case ToggleType.Electronics:
1458 {
1459 bool flag = ToggleType == ToggleType.Fire;
1460 if (EClass._zone.IsPCFaction || p.altAction || this is TraitCrafter || Electricity < 0)
1461 {
1462 if (owner.isOn)
1463 {
1464 if (p.altAction)
1465 {
1466 p.TrySetAct(flag ? "ActExtinguishTorch" : "ActToggleOff", delegate
1467 {
1468 Toggle(on: false);
1469 return true;
1470 }, owner);
1471 }
1472 }
1473 else if (!(this is TraitFactory) && !(this is TraitIncubator) && (!IsRequireFuel || owner.c_charges > 0))
1474 {
1475 p.TrySetAct(flag ? "ActTorch" : "ActToggleOn", delegate
1476 {
1477 Toggle(on: true);
1478 return true;
1479 }, owner);
1480 }
1481 if (IsRequireFuel && ((p.altAction && owner.c_charges < MaxFuel) || (!owner.isOn && owner.c_charges == 0)) && ShowFuelWindow)
1482 {
1483 p.TrySetAct("ActFuel", delegate
1484 {
1486 return false;
1487 }, owner);
1488 }
1489 }
1490 if (p.altAction)
1491 {
1492 p.TrySetAct("disableAutoToggle".lang((owner.disableAutoToggle ? "off" : "on").lang()), delegate
1493 {
1494 owner.disableAutoToggle = !owner.disableAutoToggle;
1495 SE.Click();
1496 return true;
1497 }, owner);
1498 }
1499 break;
1500 }
1501 }
1502 }
1503
1504 public bool IsFuelEnough(int num = 1, List<Thing> excludes = null, bool tryRefuel = true)
1505 {
1506 if (!IsRequireFuel)
1507 {
1508 return true;
1509 }
1510 if (owner.c_charges >= FuelCost * num)
1511 {
1512 return true;
1513 }
1514 if (owner.autoRefuel)
1515 {
1516 TryRefuel(FuelCost * num - owner.c_charges, excludes);
1517 }
1518 return owner.c_charges >= FuelCost * num;
1519 }
1520
1521 public bool IsFuel(string s)
1522 {
1523 return GetFuelValue(s) > 0;
1524 }
1525
1526 public bool IsFuel(Thing t)
1527 {
1528 return GetFuelValue(t) > 0;
1529 }
1530
1531 public int GetFuelValue(Thing t)
1532 {
1533 if (t.c_isImportant)
1534 {
1535 return 0;
1536 }
1537 return GetFuelValue(t.id);
1538 }
1539
1540 public int GetFuelValue(string id)
1541 {
1542 if (ToggleType == ToggleType.Electronics)
1543 {
1544 if (id == "battery")
1545 {
1546 return 20;
1547 }
1548 }
1549 else
1550 {
1551 if (id == "log")
1552 {
1553 return 20;
1554 }
1555 if (id == "branch")
1556 {
1557 return 5;
1558 }
1559 }
1560 return 0;
1561 }
1562
1563 public void Refuel(Thing t)
1564 {
1565 t.PlaySoundDrop(spatial: false);
1566 owner.ModCharge(t.Num * GetFuelValue(t));
1567 Msg.Say("fueled", t);
1568 if (!owner.isOn)
1569 {
1570 owner.trait.Toggle(on: true);
1571 }
1572 t.Destroy();
1573 owner.renderer.PlayAnime(AnimeID.Shiver);
1574 }
1575
1576 public void TryRefuel(int dest, List<Thing> excludes)
1577 {
1578 if (FindFuel(refuel: false))
1579 {
1580 FindFuel(refuel: true);
1581 }
1582 bool FindFuel(bool refuel)
1583 {
1584 int num = dest;
1585 List<Thing> list = EClass._zone.TryListThingsInSpot<TraitSpotFuel>((Thing t) => IsFuel(t));
1586 EClass.pc.things.Foreach(delegate(Thing t)
1587 {
1588 if (IsFuel(t) && t.tier == 0 && (excludes == null || !excludes.Contains(t)))
1589 {
1590 list.Add(t);
1591 }
1592 });
1593 foreach (Thing item in list)
1594 {
1595 if (num > 0)
1596 {
1597 int num2 = Mathf.Min(item.Num, Mathf.CeilToInt((float)num / (float)GetFuelValue(item)));
1598 num -= GetFuelValue(item) * num2;
1599 if (refuel)
1600 {
1601 Refuel(item.Split(num2));
1602 }
1603 }
1604 }
1605 return num <= 0;
1606 }
1607 }
1608
1609 public virtual void OnEnterScreen()
1610 {
1611 RefreshRenderer();
1612 }
1613
1614 public virtual void RefreshRenderer()
1615 {
1616 if (owner.renderer.isSynced && !IdToggleExtra.IsEmpty())
1617 {
1618 if (owner.isOn)
1619 {
1620 owner.renderer.AddExtra(IdToggleExtra);
1621 }
1622 else
1623 {
1624 owner.renderer.RemoveExtra(IdToggleExtra);
1625 }
1626 }
1627 }
1628
1629 public virtual void SetMainText(UIText t, bool hotitem)
1630 {
1631 if (owner.isThing && !owner.Thing.source.attackType.IsEmpty() && owner.ammoData != null)
1632 {
1633 t.SetText(owner.c_ammo.ToString() ?? "", FontColor.Charge);
1634 t.SetActive(enable: true);
1635 }
1636 else if (owner.Num == 1 && ShowCharges && owner.IsIdentified)
1637 {
1638 t.SetText(owner.c_charges.ToString() ?? "", FontColor.Charge);
1639 t.SetActive(enable: true);
1640 }
1641 else
1642 {
1643 t.SetText(owner.Num.ToShortNumber(), FontColor.ButtonGrid);
1644 t.SetActive(owner.Num > 1);
1645 }
1646 }
1647
1648 public virtual bool CanCopy(Thing t)
1649 {
1650 return false;
1651 }
1652
1653 public string GetTextRestock(string lang, bool pet)
1654 {
1655 int rawDeadLine = 0;
1656 if (pet)
1657 {
1658 SlaverData obj = owner.GetObj<SlaverData>(5);
1659 if (obj != null)
1660 {
1661 rawDeadLine = obj.dateRefresh;
1662 }
1663 }
1664 else
1665 {
1666 rawDeadLine = owner.c_dateStockExpire;
1667 }
1668 int remainingHours = EClass.world.date.GetRemainingHours(rawDeadLine);
1669 if (remainingHours > 0)
1670 {
1671 return "nextRestock".lang(lang.lang(), Date.GetText(remainingHours) ?? "");
1672 }
1673 return lang.lang();
1674 }
1675
1677 {
1678 if (SlaverType != SlaverType.None)
1679 {
1680 SlaverData obj = owner.GetObj<SlaverData>(5);
1681 if (obj != null && EClass.world.date.IsExpired(obj.dateRefresh))
1682 {
1683 return Emo2.restock;
1684 }
1685 }
1686 int c_dateStockExpire = owner.c_dateStockExpire;
1687 if (c_dateStockExpire != 0 && EClass.world.date.IsExpired(c_dateStockExpire))
1688 {
1689 if (ShopType == ShopType.None)
1690 {
1691 return Emo2.blessing;
1692 }
1693 return Emo2.restock;
1694 }
1695 return Emo2.none;
1696 }
1697
1698 public virtual void OnBarter(bool reroll = false)
1699 {
1700 Thing t = owner.things.Find("chest_merchant");
1701 if (t == null)
1702 {
1703 t = ThingGen.Create("chest_merchant");
1704 owner.AddThing(t);
1705 }
1706 t.c_lockLv = 0;
1707 if (!EClass.world.date.IsExpired(owner.c_dateStockExpire) || (RestockDay < 0 && owner.isRestocking))
1708 {
1709 return;
1710 }
1711 owner.c_dateStockExpire = EClass.world.date.GetRaw(24 * RestockDay);
1712 owner.isRestocking = true;
1713 t.things.DestroyAll((Thing _t) => _t.GetInt(101) != 0);
1714 foreach (Thing thing9 in t.things)
1715 {
1716 thing9.invX = -1;
1717 }
1718 switch (ShopType)
1719 {
1720 case ShopType.Plat:
1721 NoRestock(ThingGen.Create("lucky_coin").SetNum(10));
1722 NoRestock(ThingGen.CreateSkillbook(6662));
1723 NoRestock(ThingGen.CreateSkillbook(6664));
1724 Add("book_exp", 10, 0);
1725 break;
1726 case ShopType.Copy:
1727 {
1728 Thing c_copyContainer = owner.c_copyContainer;
1729 if (c_copyContainer == null)
1730 {
1731 break;
1732 }
1733 int num11 = 0;
1734 foreach (Thing thing10 in c_copyContainer.things)
1735 {
1736 if (!owner.trait.CanCopy(thing10))
1737 {
1738 continue;
1739 }
1740 Thing thing6 = thing10.Duplicate(1);
1741 thing6.isStolen = false;
1742 thing6.isCopy = true;
1743 thing6.c_priceFix = 0;
1744 foreach (Element item in thing6.elements.dict.Values.Where((Element e) => e.HasTag("noInherit")).ToList())
1745 {
1746 thing6.elements.Remove(item.id);
1747 }
1748 int num12 = 1;
1749 switch (owner.trait.CopyShop)
1750 {
1751 case CopyShopType.Item:
1752 {
1753 num12 = (1000 + owner.c_invest * 100) / (thing6.GetPrice(CurrencyType.Money, sell: false, PriceType.CopyShop) + 50);
1754 int[] array = new int[3] { 704, 703, 702 };
1755 foreach (int ele in array)
1756 {
1757 if (thing6.HasElement(ele))
1758 {
1759 num12 = 1;
1760 }
1761 }
1762 break;
1763 }
1764 case CopyShopType.Spellbook:
1765 thing6.c_charges = thing10.c_charges;
1766 break;
1767 }
1768 if (num12 > 1 && thing6.trait.CanStack)
1769 {
1770 thing6.SetNum(num12);
1771 }
1772 AddThing(thing6);
1773 num11++;
1774 if (num11 > owner.trait.NumCopyItem)
1775 {
1776 break;
1777 }
1778 }
1779 Steam.GetAchievement((owner.trait is TraitKettle) ? ID_Achievement.KETTLE : ID_Achievement.DEMITAS);
1780 break;
1781 }
1782 case ShopType.Specific:
1783 switch (owner.id)
1784 {
1785 case "mogu":
1786 AddThing(ThingGen.Create("casino_coin").SetNum(5000));
1787 break;
1788 case "felmera":
1789 foreach (Thing item2 in new DramaOutcome().ListFelmeraBarter())
1790 {
1791 AddThing(item2);
1792 }
1793 AddThing(ThingGen.Create("crimale2"));
1794 break;
1795 case "mimu":
1796 AddCassette(10, null, 999);
1797 AddCassette(15, null, 999);
1798 AddCassette(17, null, 999);
1799 AddCassette(29, null, 999);
1800 AddCassette(40, null, 999);
1801 AddCassette(46, null, 999);
1802 AddCassette(47, null, 999);
1803 AddCassette(52, null, 999);
1804 AddCassette(54, null, 999);
1805 AddCassette(59, null, 999);
1806 AddCassette(65, null, 999);
1807 AddCassette(109, "debt", 0);
1808 AddCassette(110, "curry", 999);
1809 if (EClass.player.stats.married > 0)
1810 {
1811 AddCassette(122, null, 999);
1812 AddCassette(123, null, 999);
1813 }
1814 break;
1815 }
1816 break;
1817 case ShopType.Deed:
1818 Add("deed", 1, 0);
1819 Add("deed_move", 2 + EClass.rnd(5), 0);
1820 Add("deed_wedding", 1, 0);
1821 Add("deed_divorce", 1, 0);
1822 Add("deed_lostring", 1, 0);
1823 Add("license_illumination", 1, 0);
1824 Add("license_void", 1, 0);
1825 Add("license_adv", 1, 0);
1826 break;
1827 case ShopType.RedBook:
1828 {
1829 for (int num5 = 0; num5 < 30; num5++)
1830 {
1831 AddThing(ThingGen.CreateFromFilter("shop_seeker"));
1832 }
1833 break;
1834 }
1835 case ShopType.TravelMerchant2:
1836 {
1837 int seed = EClass.game.seed + EClass._zone.uid + EClass.world.date.year * 12 + EClass.world.date.month;
1838 Add("tool_talisman", 1, 0);
1839 Add("camera", 1, 0);
1840 Add("dreambug", EClass.rndHalf(10), 0);
1841 Add("mathammer", 1, 0).ChangeMaterial(MATERIAL.GetRandomMaterial(80));
1842 Add("unicorn_horn", 1, 0);
1843 Add("core_user", 1, 0);
1844 Add("generator_hamster1", 1, 0);
1845 Add("generator_hamster2", 1, 0);
1846 Add("generator_solar", 1, 0);
1847 Add("generator_wind", 1, 0);
1848 Add("curtainL", EClass.rndHalf(5), 0);
1849 Add("1337", EClass.rndHalf(5), 0);
1850 Add("1338", EClass.rndHalf(5), 0);
1851 Add("1339", EClass.rndHalf(5), 0);
1852 Add("1340", EClass.rndHalf(5), 0);
1853 Add("1301", EClass.rndHalf(5), 0);
1854 Add("1302", EClass.rndHalf(5), 0);
1855 Add("censored_item", 1, 0);
1856 Add("block_strawberry", EClass.rndHalf(6), 0);
1857 Add("block_cream", EClass.rndHalf(6), 0);
1858 Add("block_mango", EClass.rndHalf(6), 0);
1859 Add("block_cherry", EClass.rndHalf(6), 0);
1860 Add("block_chocoplate", EClass.rndHalf(6), 0);
1861 Add("block_banana", EClass.rndHalf(6), 0);
1862 Add("block_mousse", EClass.rndHalf(6), 0);
1863 Add("block_melon", EClass.rndHalf(6), 0);
1864 Add("block_kiwi", EClass.rndHalf(6), 0);
1865 Add("block_peach", EClass.rndHalf(6), 0);
1866 Add("water", 1, 0);
1867 if (EClass.rndSeed(EClass.debug.enable ? 1 : 3, seed) == 0)
1868 {
1869 Thing thing5 = Add("scrubber", 1, 0);
1870 thing5.rarity = Rarity.Legendary;
1871 thing5.elements.SetBase(770, 1 + EClass.rndSeed(EClass.rndSeed(20, seed) + 1, seed));
1872 }
1873 if (EClass.rndSeed(EClass.debug.enable ? 1 : 5, seed) == 0)
1874 {
1875 Add("hammer_garokk", 1, 0);
1876 }
1877 if (EClass.rndSeed(EClass.debug.enable ? 1 : 100, seed) == 0)
1878 {
1879 Add("water_jure", 1, 0);
1880 }
1881 break;
1882 }
1883 case ShopType.KeeperOfGarden:
1884 {
1885 string[] array2 = new string[11]
1886 {
1887 "stone_defense", "1325", "1326", "1327", "1328", "1330", "1331", "1332", "1333", "1283",
1888 "1268"
1889 };
1890 foreach (string id in array2)
1891 {
1892 AddThing(ThingGen.Create(id, MATERIAL.GetRandomMaterialFromCategory(50, "rock", EClass.sources.materials.alias["granite"]).id).SetNum(99));
1893 }
1894 Add("cloud", 99, 0);
1895 Add("scroll_alias", 99, 0);
1896 Add("scroll_biography", 99, 0);
1897 Add("1329", 1, 0);
1898 Add("statue_lulu", 1, 0);
1899 Add("statue_jure", 1, 0);
1900 Add("statue_ehe", 1, 0);
1901 break;
1902 }
1903 case ShopType.Seed:
1904 {
1905 AddThing(TraitSeed.MakeSeed("rice")).SetNum(4 + EClass.rnd(4));
1906 AddThing(TraitSeed.MakeSeed("cabbage")).SetNum(4 + EClass.rnd(4));
1907 AddThing(TraitSeed.MakeSeed("carrot")).SetNum(4 + EClass.rnd(4));
1908 AddThing(TraitSeed.MakeSeed("potato")).SetNum(4 + EClass.rnd(4));
1909 AddThing(TraitSeed.MakeSeed("corn")).SetNum(4 + EClass.rnd(4));
1910 AddThing(TraitSeed.MakeSeed("chanoki")).SetNum(4 + EClass.rnd(4));
1911 for (int num14 = 0; num14 < EClass.rnd(3) + 1; num14++)
1912 {
1913 Add("462", 1, 0);
1914 }
1915 for (int num15 = 0; num15 < EClass.rnd(3) + 1; num15++)
1916 {
1917 Add("1167", 1, 0);
1918 }
1919 break;
1920 }
1921 case ShopType.Loytel:
1922 Add("board_map", 1, 0);
1923 Add("board_build", 1, 0);
1924 Add("book_resident", 1, 0);
1925 Add("board_party", 1, 0);
1926 Add("board_party2", 1, 0);
1927 Add("book_roster", 1, 0);
1928 Add("3", 1, 0);
1929 Add("4", 1, 0);
1930 Add("5", 1, 0);
1931 AddThing(ThingGen.CreatePlan(2512));
1932 AddThing(ThingGen.CreatePlan(2810));
1933 NoRestock(ThingGen.Create("rp_block").SetLv(1).SetNum(10));
1935 {
1936 NoRestock(ThingGen.CreateRecipe("explosive"));
1937 }
1938 break;
1939 case ShopType.Starter:
1940 case ShopType.StarterEx:
1941 Add("board_home", 1, 0);
1942 Add("board_resident", 1, 0);
1943 Add("1", 1, 0);
1944 Add("2", 1, 0);
1945 if (ShopType == ShopType.StarterEx)
1946 {
1947 Add("board_expedition", 1, 0);
1948 Add("mailpost", 1, 0);
1949 Add("record", 1, 0);
1950 Add("tent2", 1, 0);
1951 Add("tent1", 1, 0);
1952 Add("wagon1", 1, 0);
1953 Add("wagon_big", 1, 0);
1954 Add("wagon_big2", 1, 0);
1955 Add("wagon_big3", 1, 0);
1956 Add("wagon_big4", 1, 0);
1957 Add("wagon_big5", 1, 0);
1958 Add("teleporter", 1, 0);
1959 Add("teleporter2", 1, 0);
1960 Add("recharger", 1, 0);
1961 Add("machine_gene2", 1, 0);
1962 NoRestock(ThingGen.CreateRecipe("torch_wall"));
1963 NoRestock(ThingGen.CreateRecipe("factory_sign"));
1964 NoRestock(ThingGen.CreateRecipe("beehive"));
1965 NoRestock(ThingGen.Create("rp_food").SetNum(5).SetLv(10)
1966 .Thing);
1967 }
1968 else
1969 {
1970 AddThing(ThingGen.CreatePlan(2119));
1971 NoRestock(ThingGen.Create("rp_food").SetNum(5).SetLv(5)
1972 .Thing);
1973 }
1974 break;
1975 case ShopType.Farris:
1976 AddThing(ThingGen.CreateScroll(8220, 4 + EClass.rnd(6)));
1977 AddThing(ThingGen.CreateScroll(8221, 4 + EClass.rnd(6)));
1978 Add("drawing_paper", 10, 0);
1979 Add("drawing_paper2", 10, 0);
1980 Add("stethoscope", 1, 0);
1981 Add("whip_love", 1, 0);
1982 Add("whip_interest", 1, 0);
1983 Add("syringe_blood", 20, 0);
1985 {
1986 Add("chest_tax", 1, 0);
1987 }
1988 break;
1989 case ShopType.Guild:
1990 if (this is TraitClerk_Merchant)
1991 {
1992 Add("flyer", 1, 0).SetNum(99);
1993 }
1994 break;
1995 case ShopType.Influence:
1996 {
1997 bool num7 = owner.id == "big_sister";
1998 TraitTicketFurniture.SetZone(num7 ? EClass.game.spatials.Find("little_garden") : EClass._zone, Add("ticket_furniture", 1, 0).SetNum(99));
1999 if (num7)
2000 {
2001 Add("littleball", 10, 0);
2002 if (!owner.Chara.affinity.CanGiveCard())
2003 {
2004 break;
2005 }
2006 if (!owner.Chara.elements.HasBase(287))
2007 {
2008 owner.Chara.elements.SetBase(287, (!EClass.debug.enable) ? 1 : 50);
2009 }
2010 if (!reroll)
2011 {
2012 for (int num8 = 0; num8 < 20; num8++)
2013 {
2014 owner.Chara.ModExp(287, 1000);
2015 }
2016 }
2017 Thing thing3 = CraftUtil.MakeLoveLunch(owner.Chara);
2018 thing3.elements.SetBase(1229, 1);
2019 AddThing(thing3);
2020 break;
2021 }
2022 for (int num9 = 0; num9 < 10; num9++)
2023 {
2024 Thing thing4 = ThingGen.Create(EClass._zone.IsFestival ? "1123" : ((EClass.rnd(3) == 0) ? "1169" : "1160"));
2025 thing4.DyeRandom();
2026 AddThing(thing4);
2027 }
2028 if (EClass._zone is Zone_Exile)
2029 {
2030 for (int num10 = 0; num10 < 30; num10++)
2031 {
2032 Add("1235", 1, -1);
2033 Add("1236", 1, -1);
2034 Add("1237", 1, -1);
2035 Add("1239", 1, -1);
2036 Add("candle9", 1, -1);
2037 Add("candle9", 1, -1);
2038 Add("candle9", 1, -1);
2039 Add("candle8", 1, 0);
2040 Add("candle8b", 1, 0);
2041 Add("candle8c", 1, 0);
2042 }
2043 }
2044 break;
2045 }
2046 case ShopType.Casino:
2047 {
2048 Add("chest_tax", 1, 0);
2049 Add("1165", 1, 0);
2050 Add("monsterball", 1, 0).SetNum(3).SetLv(10);
2051 Add("1175", 1, 0);
2052 Add("1176", 1, 0);
2053 Add("pillow_ehekatl", 1, 0);
2054 Add("grave_dagger1", 1, 0);
2055 Add("grave_dagger2", 1, 0);
2056 Add("434", 1, 0);
2057 Add("433", 1, 0);
2058 Add("714", 1, 0);
2059 Add("1017", 1, 0);
2060 Add("1313", 1, 0);
2061 Add("1155", 1, 0);
2062 Add("1287", 1, 0);
2063 Add("1288", 1, 0);
2064 Add("1289", 1, 0);
2065 Add("1290", 1, 0);
2066 Add("1011", 1, 0);
2067 AddThing(ThingGen.CreatePerfume(9500, 5));
2068 AddThing(ThingGen.CreatePerfume(9501, 5));
2069 AddThing(ThingGen.CreatePerfume(9502, 5));
2070 AddThing(ThingGen.CreatePerfume(9503, 5));
2071 for (int num6 = 0; num6 < 5; num6++)
2072 {
2073 Thing thing2 = ThingGen.CreateFromCategory("seasoning").SetNum(10);
2074 thing2.elements.SetBase(2, 40);
2075 thing2.c_priceFix = 1000;
2076 AddThing(thing2);
2077 }
2078 break;
2079 }
2080 case ShopType.Medal:
2081 NoRestockId("hammer_garokk", 3, 0);
2082 NoRestockId("sword_dragon", 1, 0);
2083 Add("sword_dragon", 1, 0).SetReplica(on: true);
2084 NoRestockId("point_stick", 1, 0);
2085 Add("point_stick", 1, 0).SetReplica(on: true);
2086 NoRestockId("blunt_bonehammer", 1, 0);
2087 Add("blunt_bonehammer", 1, 0).SetReplica(on: true);
2088 NoRestockId("pole_gunlance", 1, 0);
2089 Add("pole_gunlance", 1, 0).SetReplica(on: true);
2090 NoRestockId("sword_muramasa", 1, 0);
2091 Add("sword_muramasa", 1, 0).SetReplica(on: true);
2092 NoRestockId("sword_forgetmenot", 1, 0);
2093 Add("sword_forgetmenot", 1, 0).SetReplica(on: true);
2094 NoRestockId("dagger_fish", 1, 0);
2095 Add("dagger_fish", 1, 0).SetReplica(on: true);
2096 NoRestockId("sword_zephir", 1, 0);
2097 Add("sword_zephir", 1, 0).SetReplica(on: true);
2098 Add("bed_shiawase", 1, 0).SetReplica(on: true);
2099 Add("ribbon", 1, 0);
2100 Add("helm_sage", 1, 0);
2101 NoRestockId("wear_swim_danger", 1, 0);
2102 NoRestockId("wear_swim_danger", 1, 1);
2103 Add("diary_sister", 1, 0);
2104 Add("diary_catsister", 1, 0);
2105 Add("diary_lady", 1, 0);
2106 Add("1165", 1, 0).SetNum(5);
2107 AddThing(ThingGen.CreateScroll(9160).SetNum(5));
2108 Add("1282", 1, 0).SetNum(5);
2109 Add("monsterball", 1, 0).SetNum(3).SetLv(20);
2110 Add("monsterball", 1, 0).SetNum(3).SetLv(40);
2111 Add("bill_tax", 1, 0).c_bill = 1;
2112 Add("bill_tax", 1, 0).c_bill = 1;
2113 Add("bill_tax", 1, 0).c_bill = 1;
2114 AddThing(ThingGen.CreateScroll(8288).SetNum(5));
2115 Add("container_magic", 1, 0);
2116 Add("container_magic", 1, 0).ChangeMaterial("iron").idSkin = 1;
2117 Add("container_magic", 1, 0).ChangeMaterial("bamboo").idSkin = 2;
2118 Add("container_magic", 1, 0).ChangeMaterial("feywood").idSkin = 3;
2119 Add("wrench_tent_elec", 1, 0);
2120 Add("wrench_tent_soil", 1, 0);
2121 Add("wrench_tent_seabed", 1, 0);
2122 Add("wrench_bed", 1, 0).SetNum(20);
2123 Add("wrench_storage", 1, 0).SetNum(10);
2124 Add("wrench_fridge", 1, 0).SetNum(1);
2125 Add("wrench_extend_v", 1, 0).SetNum(2);
2126 Add("wrench_extend_h", 1, 0).SetNum(2);
2127 AddThing(ThingGen.CreateSpellbook(9155, 1, 3));
2128 break;
2129 default:
2130 {
2131 if (!owner.GetStr("merchant_override").IsEmpty())
2132 {
2133 break;
2134 }
2135 float num = (float)(3 + Mathf.Min(ShopLv / 5, 10)) + Mathf.Sqrt(ShopLv);
2136 int num2 = 300;
2137 switch (ShopType)
2138 {
2139 case ShopType.Ecopo:
2140 num2 = 30;
2141 break;
2142 case ShopType.StrangeGirl:
2143 num2 = 50;
2144 break;
2145 case ShopType.TravelMerchant:
2146 case ShopType.TravelMerchant2:
2147 num /= 3f;
2148 if (num < 12f)
2149 {
2150 num = 12f;
2151 }
2152 num2 = 30;
2153 break;
2154 }
2155 num = num * (float)(100 + EClass.pc.Evalue(1406) * 5) / 100f;
2156 num = Mathf.Min(num, num2);
2157 for (int num3 = 0; (float)num3 < num; num3++)
2158 {
2159 if (ShopType == ShopType.TravelMerchant)
2160 {
2161 int num4 = EClass.game.seed + (EClass.world.date.year * 12 + EClass.world.date.month) * 30 + EClass._zone.uid;
2162 Rand.SetBaseSeed(num4 + num3);
2163 Rand.SetSeed(num4 + num3);
2164 }
2165 Thing thing = CreateStock();
2166 Rand.SetBaseSeed();
2167 Rand.SetSeed();
2168 if ((!thing.trait.IsNoShop || (ShopType == ShopType.LoytelMart && (EClass.debug.enable || EClass.player.flags.loytelMartLv >= 2))) && (!(thing.trait is TraitRod) || thing.c_charges != 0) && thing.GetPrice() > 0)
2169 {
2170 bool tryStack = true;
2171 if (ShopType == ShopType.Curry)
2172 {
2173 tryStack = false;
2174 }
2175 t.AddThing(thing, tryStack);
2176 }
2177 }
2178 break;
2179 }
2180 }
2181 string str = owner.GetStr("merchant_override");
2182 if (!str.IsEmpty())
2183 {
2184 foreach (Thing item3 in ModUtil.GenerateMerchantStock(owner, str))
2185 {
2186 AddThing(item3);
2187 }
2188 }
2189 string text = ShopType.ToString();
2190 foreach (RecipeSource item4 in RecipeManager.list)
2191 {
2192 if (item4.row.recipeKey.IsEmpty())
2193 {
2194 continue;
2195 }
2196 string[] array2 = item4.row.recipeKey;
2197 for (int num13 = 0; num13 < array2.Length; num13++)
2198 {
2199 if (array2[num13] == text)
2200 {
2201 NoRestock(ThingGen.CreateRecipe(item4.id));
2202 break;
2203 }
2204 }
2205 }
2206 switch (ShopType)
2207 {
2208 case ShopType.Curry:
2209 if (EClass.game.quests.IsCompleted("curry"))
2210 {
2211 AddThing(TraitSeed.MakeSeed("redpepper").SetNum(5));
2212 }
2213 break;
2214 case ShopType.Moyer:
2215 {
2216 for (int num18 = 1; num18 <= 25; num18++)
2217 {
2218 AddAdvWeek(num18);
2219 }
2220 break;
2221 }
2222 case ShopType.StrangeGirl:
2223 {
2224 int num19 = (EClass.debug.enable ? 20 : (EClass._zone.development / 10));
2225 if (num19 > 0)
2226 {
2227 Add("syringe_gene", num19, 0);
2228 Add("diary_little", 1, 0);
2229 }
2230 if (num19 > 10)
2231 {
2232 Add("syringe_heaven", num19 / 5, 0);
2233 Add("1276", 1, 0);
2234 }
2235 Add("medal", 10, 0);
2236 Add("ticket_fortune", 10, 0);
2237 break;
2238 }
2239 case ShopType.GeneralExotic:
2240 Add("tool_talisman", 1, 0);
2241 break;
2242 case ShopType.Healer:
2243 AddThing(ThingGen.CreatePotion(8400).SetNum(4 + EClass.rnd(6)));
2244 AddThing(ThingGen.CreatePotion(8401).SetNum(2 + EClass.rnd(4)));
2245 AddThing(ThingGen.CreatePotion(8402).SetNum(1 + EClass.rnd(3)));
2246 break;
2247 case ShopType.Food:
2248 Add("ration", 2 + EClass.rnd(4), 0);
2249 break;
2250 case ShopType.Ecopo:
2251 Add("ecomark", 5, 0);
2252 Add("whip_egg", 1, 0);
2253 Add("helm_chef", 1, 0);
2254 Add("hammer_strip", 1, 0);
2255 Add("brush_strip", 1, 0);
2256 Add("1165", 1, 0);
2257 Add("plat", 100, 0);
2258 AddThing(ThingGen.CreateScroll(9160).SetNum(5));
2259 AddThing(ThingGen.CreateRune(450, 1, free: true));
2260 break;
2261 case ShopType.Gun:
2262 Add("bullet", 1, 0).SetNum(300 + EClass.rnd(100)).ChangeMaterial("iron");
2263 Add("bullet_energy", 1, 0).SetNum(100 + EClass.rnd(100)).ChangeMaterial("iron");
2264 break;
2265 case ShopType.Magic:
2266 if (!Guild.Mage.IsMember && ((EClass._zone.id == "lumiest" && EClass._zone.lv == 0) || (EClass._zone.id != "lumiest" && EClass.rnd(4) == 0)))
2267 {
2268 t.AddThing(ThingGen.Create("letter_trial"));
2269 }
2270 AddThing(ThingGen.CreateScroll(8220, 4 + EClass.rnd(6)));
2271 AddThing(ThingGen.CreateScroll(8221, 4 + EClass.rnd(6)));
2272 AddThing(ThingGen.CreateScroll(8200, 4 + EClass.rnd(6)));
2273 AddThing(ThingGen.CreateScroll(8201, 4 + EClass.rnd(6)));
2274 break;
2275 case ShopType.Festival:
2277 {
2278 Add("1085", 1, 0);
2279 if (EClass._zone.id == "noyel")
2280 {
2281 Add("holyFeather", 1, 0);
2282 }
2283 }
2284 break;
2285 case ShopType.Junk:
2286 case ShopType.LoytelMart:
2287 {
2288 if (ShopType == ShopType.LoytelMart)
2289 {
2290 Add("ticket_massage", 1, 0);
2291 Add("ticket_armpillow", 1, 0);
2292 Add("ticket_champagne", 1, 0);
2293 }
2294 for (int num16 = 0; num16 < 3; num16++)
2295 {
2296 if (EClass.rnd(5) == 0)
2297 {
2298 TreasureType treasureType = ((EClass.rnd(10) == 0) ? TreasureType.BossNefia : ((EClass.rnd(10) == 0) ? TreasureType.Map : TreasureType.RandomChest));
2299 int num17 = EClass.rnd(EClass.rnd(ShopLv + (EClass.debug.enable ? 200 : 50)) + 1) + 1;
2300 Thing thing7 = ThingGen.Create(treasureType switch
2301 {
2302 TreasureType.Map => "chest_treasure",
2303 TreasureType.BossNefia => "chest_boss",
2304 _ => "chest3",
2305 });
2306 thing7.c_lockedHard = true;
2307 thing7.c_lockLv = num17;
2308 thing7.c_priceAdd = 2000 + num17 * 250 * ((treasureType == TreasureType.RandomChest) ? 1 : 5);
2309 thing7.c_revealLock = true;
2310 ThingGen.CreateTreasureContent(thing7, num17, treasureType, clearContent: true);
2311 AddThing(thing7);
2312 }
2313 }
2314 break;
2315 }
2316 }
2317 switch (ShopType)
2318 {
2319 case ShopType.General:
2320 case ShopType.Food:
2321 {
2322 for (int num20 = 0; num20 < (EClass.debug.enable ? 3 : 3); num20++)
2323 {
2324 if (EClass.rnd(3) == 0)
2325 {
2326 int lv = EClass.rnd(EClass.rnd(ShopLv + (EClass.debug.enable ? 200 : 50)) + 1) + 1;
2327 Thing t2 = ThingGen.Create("chest_gamble", -1, lv).SetNum(1 + EClass.rnd(20));
2328 AddThing(t2);
2329 }
2330 }
2331 break;
2332 }
2333 case ShopType.Booze:
2334 if (EClass._zone is Zone_Yowyn && EClass._zone.lv == -1)
2335 {
2336 Add("churyu", EClass.rndHalf(10), 0);
2337 }
2338 break;
2339 }
2340 switch (owner.id)
2341 {
2342 case "rodwyn":
2343 AddThing(ThingGen.CreateSpellbook(8790));
2344 AddThing(ThingGen.CreatePotion(8791).SetNum(3 + EClass.rnd(3)));
2345 AddThing(ThingGen.CreatePotion(8792).SetNum(3 + EClass.rnd(3)));
2346 AddThing(ThingGen.CreatePotion(8794).SetNum(3 + EClass.rnd(3)));
2347 Add("1341", EClass.rndHalf(5), 0);
2348 break;
2349 case "girl_blue":
2350 Add("779", 1 + EClass.rnd(3), 0);
2351 break;
2352 case "nola":
2353 AddThing(ThingGen.CreateRecipe("ic").SetPriceFix(400));
2354 AddThing(ThingGen.CreateRecipe("bullet").SetPriceFix(300));
2355 AddThing(ThingGen.CreateRecipe("break_powder").SetPriceFix(1000));
2356 AddThing(ThingGen.CreateRecipe("quarrel").SetPriceFix(100));
2357 AddThing(ThingGen.CreateRecipe("1099").SetPriceFix(400));
2358 AddThing(ThingGen.CreateRecipe("detector").SetPriceFix(700));
2359 AddThing(ThingGen.CreatePlan(2710)).SetPriceFix(-100);
2360 AddThing(ThingGen.CreatePlan(2711)).SetPriceFix(-100);
2361 AddThing(ThingGen.CreatePlan(2712)).SetPriceFix(200);
2362 break;
2363 }
2365 {
2366 Add("lockpick", 1, 0);
2367 if (EClass.rnd(2) == 0)
2368 {
2369 Add("lockpick", 1, 0);
2370 }
2371 AddThing(ThingGen.CreateScroll(8780, EClass.rndHalf(5)));
2372 }
2373 foreach (Thing thing11 in t.things)
2374 {
2375 thing11.c_idBacker = 0;
2376 if (ShopType != ShopType.Copy)
2377 {
2378 thing11.TryMakeRandomItem(ShopLv);
2379 if (thing11.Num == 1)
2380 {
2381 thing11.SetNum(thing11.trait.DefaultStock);
2382 }
2383 if (thing11.trait is TraitFoodMeal)
2384 {
2385 CraftUtil.MakeDish(thing11, ShopLv, owner.Chara);
2386 }
2387 if (thing11.IsFood && owner.id == "rodwyn")
2388 {
2389 SourceElement.Row row = EClass.sources.elements.rows.Where((SourceElement.Row e) => !e.foodEffect.IsEmpty() && !e.tag.Contains("noRodwyn") && e.category != "feat" && e.chance > 0).RandomItem();
2390 thing11.elements.SetBase(row.id, 10 + EClass.rnd(10));
2391 }
2392 }
2393 if (CurrencyType == CurrencyType.Casino_coin)
2394 {
2395 thing11.noSell = true;
2396 }
2398 {
2399 thing11.isStolen = true;
2400 }
2401 if (!(thing11.trait is TraitErohon))
2402 {
2403 thing11.c_IDTState = 0;
2404 }
2405 if (CurrencyType == CurrencyType.Money && (thing11.category.IsChildOf("meal") || thing11.category.IsChildOf("preserved")) && thing11.id != "ration" && !thing11.IsUnique)
2406 {
2407 thing11.c_priceFix = -70;
2408 }
2409 if (ShopType == ShopType.TravelMerchant)
2410 {
2411 thing11.c_priceFix = 200;
2412 }
2413 if (thing11.trait is TraitErohon)
2414 {
2415 thing11.c_IDTState = 5;
2416 }
2417 if (thing11.IsContainer && !thing11.c_revealLock)
2418 {
2419 thing11.RemoveThings();
2420 t.c_lockLv = 0;
2421 }
2422 }
2423 if (t.things.Count <= t.things.GridSize)
2424 {
2425 return;
2426 }
2427 int num21 = t.things.width * 10;
2428 if (t.things.Count > num21)
2429 {
2430 int num22 = t.things.Count - num21;
2431 for (int num23 = 0; num23 < num22; num23++)
2432 {
2433 t.things.LastItem().Destroy();
2434 }
2435 }
2436 t.things.ChangeSize(t.things.width, Mathf.Min(t.things.Count / t.things.width + 1, 10));
2437 Thing Add(string id2, int a, int idSkin)
2438 {
2440 Thing thing8 = ThingGen.Create(id2, -1, ShopLv).SetNum(a);
2441 thing8.idSkin = ((idSkin == -1) ? EClass.rnd(thing8.source.skins.Length + 1) : idSkin);
2442 return t.AddThing(thing8);
2443 }
2444 void AddAdvWeek(int i)
2445 {
2446 Thing thing8 = ThingGen.CreateRedBook("advweek_" + i);
2447 thing8.c_priceFix = -90;
2448 AddThing(thing8);
2449 }
2450 void AddCassette(int idCas, string idQuest, int phase)
2451 {
2452 if (idQuest == null || EClass.game.quests.GetPhase(idQuest) >= phase)
2453 {
2454 AddThing(ThingGen.CreateCassette(idCas));
2455 }
2456 }
2457 Thing AddThing(Thing _t)
2458 {
2459 return t.AddThing(_t);
2460 }
2461 void NoRestock(Thing _t)
2462 {
2463 string text2 = owner.id;
2464 if (_t.idSkin != 0)
2465 {
2466 text2 = text2 + "_skin" + _t.idSkin;
2467 }
2468 HashSet<string> hashSet = EClass.player.noRestocks.TryGetValue(text2);
2469 if (hashSet == null)
2470 {
2471 hashSet = new HashSet<string>();
2472 }
2473 if (!hashSet.Contains(_t.trait.IdNoRestock))
2474 {
2475 hashSet.Add(_t.trait.IdNoRestock);
2476 EClass.player.noRestocks[text2] = hashSet;
2477 _t.SetInt(101, 1);
2478 AddThing(_t);
2479 }
2480 }
2481 void NoRestockId(string _id, int num24, int idSkin)
2482 {
2483 Thing thing8 = ThingGen.Create(_id).SetNum(num24);
2484 thing8.idSkin = idSkin;
2485 NoRestock(thing8);
2486 }
2487 }
2488
2490 {
2491 switch (ShopType)
2492 {
2493 case ShopType.Dye:
2494 {
2495 Thing thing4 = ThingGen.Create("dye").SetNum(15 + EClass.rnd(30));
2496 thing4.ChangeMaterial(EClass.sources.materials.rows.Where((SourceMaterial.Row r) => r.tier <= 4).RandomItem().alias);
2497 return thing4;
2498 }
2499 case ShopType.GeneralExotic:
2500 return FromFilter("shop_generalExotic");
2501 case ShopType.VMachine:
2502 if (EClass.rnd(10) == 0)
2503 {
2504 return Create("wear_swim");
2505 }
2506 if (EClass.rnd(10) == 0)
2507 {
2508 return Create("panty");
2509 }
2510 if (EClass.rnd(5) == 0)
2511 {
2512 return Create("234");
2513 }
2514 return FromFilter("shop_drink");
2515 case ShopType.Furniture:
2516 return FromFilter("shop_furniture");
2517 case ShopType.Book:
2518 return FromFilter("shop_book");
2519 case ShopType.Magic:
2520 return FromFilter("shop_magic");
2521 case ShopType.Ecopo:
2522 {
2523 Thing thing3 = TraitSeed.MakeRandomSeed(enc: true);
2524 if (EClass.rnd(2) == 0)
2525 {
2526 TraitSeed.LevelSeed(thing3, (thing3.trait as TraitSeed).row, 1);
2527 }
2528 return thing3;
2529 }
2530 case ShopType.AnimalGoods:
2531 if (EClass.rnd(3) == 0)
2532 {
2533 return Create("saddle");
2534 }
2535 if (EClass.rnd(3) == 0)
2536 {
2537 return Create("saddle_waist");
2538 }
2539 return Create("pasture").SetNum(EClass.rndHalf(8));
2540 case ShopType.Healer:
2541 {
2542 Thing thing2 = null;
2543 for (int num = 0; num < 1000; num++)
2544 {
2545 thing2 = FromFilter("shop_healer");
2546 if (thing2.trait is TraitScroll { source: not null } traitScroll)
2547 {
2548 if (!(traitScroll.source.aliasParent != "WIL") && !(traitScroll.source.categorySub == "attack"))
2549 {
2550 break;
2551 }
2552 }
2553 else if (thing2.trait is TraitPotionRandom { source: not null } traitPotionRandom)
2554 {
2555 if (!(traitPotionRandom.source.aliasParent != "WIL") && !(traitPotionRandom.source.categorySub == "attack"))
2556 {
2557 thing2.SetNum(EClass.rnd(5) + 1);
2558 break;
2559 }
2560 }
2561 else if (thing2.trait is TraitRodRandom { source: not null } traitRodRandom && !(traitRodRandom.source.aliasParent != "WIL") && !(traitRodRandom.source.categorySub == "attack"))
2562 {
2563 break;
2564 }
2565 }
2566 return thing2;
2567 }
2568 case ShopType.Milk:
2569 if (EClass._zone is Zone_Nefu && EClass.rnd(2) == 0)
2570 {
2571 Thing thing = ThingGen.Create("_milk");
2572 thing.MakeRefFrom(EClass.sources.charas.rows.Where((SourceChara.Row r) => r.race == "mifu" || r.race == "nefu").RandomItem().model);
2573 Debug.Log(thing);
2574 return thing;
2575 }
2576 return Create("_milk");
2577 case ShopType.Map:
2578 return ThingGen.CreateMap();
2579 case ShopType.Plan:
2580 return Create("book_plan");
2581 case ShopType.Weapon:
2582 return FromFilter("shop_weapon");
2583 case ShopType.Gun:
2584 if (EClass.rnd(8) == 0)
2585 {
2586 return Create("mod_ranged");
2587 }
2588 return FromFilter("shop_gun");
2589 case ShopType.Blackmarket:
2590 case ShopType.Exotic:
2591 case ShopType.TravelMerchant:
2592 {
2593 int num2 = 30;
2594 if (ShopType == ShopType.TravelMerchant)
2595 {
2596 num2 = 5;
2597 }
2599 {
2600 num2 = 25;
2601 }
2603 {
2604 num2 = 15;
2605 }
2606 CardBlueprint.SetRarity((EClass.rnd(num2 * 5) == 0) ? Rarity.Mythical : ((EClass.rnd(num2) == 0) ? Rarity.Legendary : ((EClass.rnd(5) == 0) ? Rarity.Superior : Rarity.Normal)));
2607 return FromFilter("shop_blackmarket");
2608 }
2609 case ShopType.Drink:
2610 return FromFilter("shop_drink");
2611 case ShopType.Booze:
2612 return FromFilter("shop_booze");
2613 case ShopType.Fruit:
2614 return FromFilter("shop_fruit");
2615 case ShopType.Fish:
2616 if (EClass.rnd(2) == 0)
2617 {
2618 return Create("bait");
2619 }
2620 if (EClass.rnd(3) == 0)
2621 {
2622 return Create("fishingRod");
2623 }
2624 return FromFilter("shop_fish");
2625 case ShopType.Meat:
2626 if (EClass.rnd(5) == 0)
2627 {
2628 return Create("seasoning");
2629 }
2630 return FromFilter("shop_meat");
2631 case ShopType.Bread:
2632 if (EClass.rnd(3) == 0)
2633 {
2634 return Create("dough");
2635 }
2636 return FromFilter("shop_bread");
2637 case ShopType.Sweet:
2638 if (EClass.rnd(6) == 0)
2639 {
2640 return Create("dough");
2641 }
2642 if (EClass.rnd(4) == 0)
2643 {
2644 return Create("cream");
2645 }
2646 return FromFilter("shop_sweet");
2647 case ShopType.Curry:
2648 if (EClass.rnd(3) == 0)
2649 {
2650 return Create("seasoning");
2651 }
2652 return Create("693");
2653 case ShopType.Food:
2654 if (EClass.rnd(5) == 0)
2655 {
2656 return Create("seasoning");
2657 }
2658 return FromFilter("shop_food");
2659 case ShopType.Drug:
2660 return FromFilter("shop_drug");
2661 case ShopType.LoytelMart:
2662 {
2663 int loytelMartLv = EClass.player.flags.loytelMartLv;
2664 if (loytelMartLv >= 1)
2665 {
2666 if (EClass.rnd(10) == 0)
2667 {
2668 return Create("monsterball").SetLv(40 + EClass.rnd(ShopLv)).Thing;
2669 }
2670 if (EClass.rnd(30) == 0)
2671 {
2672 return ThingGen.Create("rp_random", -1, ShopLv + 10);
2673 }
2674 if (EClass.rnd(100) == 0)
2675 {
2676 return ThingGen.Create("map_treasure", -1, EClass.rndHalf(ShopLv));
2677 }
2678 if (EClass.rnd(40) == 0)
2679 {
2680 return Create("water").SetPriceFix(1000);
2681 }
2682 if (EClass.rnd(1000) == 0)
2683 {
2684 return Create("1165");
2685 }
2686 }
2687 if ((loytelMartLv >= 2 || EClass.debug.enable) && EClass.rnd(10) == 0)
2688 {
2689 SourceElement.Row row = EClass.sources.elements.rows.Where((SourceElement.Row r) => r.tag.Contains("loytelMart") && ShopLv + 10 >= r.LV).ToList().RandomItemWeighted((SourceElement.Row r) => r.chance);
2690 switch ((from _s in row.thing.ToCharArray()
2691 where _s != ' '
2692 select _s).RandomItem())
2693 {
2694 case 'B':
2695 return ThingGen.CreateSpellbook(row.id);
2696 case 'P':
2697 return ThingGen.CreatePotion(row.id);
2698 case 'R':
2699 return ThingGen.CreateRod(row.id);
2700 case 'S':
2701 return ThingGen.CreateScroll(row.id);
2702 }
2703 }
2704 return FromFilter("shop_junk");
2705 }
2706 case ShopType.Junk:
2707 case ShopType.Moyer:
2708 return FromFilter("shop_junk");
2709 case ShopType.Souvenir:
2710 return FromFilter("shop_souvenir");
2711 case ShopType.StrangeGirl:
2712 return DNA.GenerateGene(SpawnList.Get("chara").Select(ShopLv + 10), DNA.Type.Brain);
2713 case ShopType.Fireworks:
2714 if (EClass.rnd(3) == 0)
2715 {
2716 return Create("firework_launcher");
2717 }
2718 return Create("firework");
2719 case ShopType.Festival:
2720 if (EClass.rnd(3) != 0)
2721 {
2722 if (IsFestival("olvina"))
2723 {
2724 return Create(new string[4] { "1125", "1126", "pillow_truth", "1230" }.RandomItem());
2725 }
2726 if (IsFestival("yowyn"))
2727 {
2728 return Create(new string[3] { "hat_mushroom", "hat_witch", "hat_kumiromi" }.RandomItem());
2729 }
2730 if (IsFestival("noyel"))
2731 {
2732 return Create(new string[13]
2733 {
2734 "1127", "1128", "xmas_sled", "xmas_bigbag", "xmas_bigbox", "xmas_blackcat", "xmas_blackcat", "xmas_jure", "xmas_crown", "xmas_ball",
2735 "xmas_ball", "xmas_ball", "xmas_string"
2736 }.RandomItem());
2737 }
2738 }
2739 if (EClass.rnd(2) == 0)
2740 {
2741 return Create(new string[4] { "1081", "1082", "1083", "1084" }.RandomItem());
2742 }
2743 if (EClass.rnd(3) == 0)
2744 {
2745 return FromFilter("shop_junk");
2746 }
2747 return FromFilter("shop_souvenir");
2748 case ShopType.Lamp:
2749 if (EClass.rnd(3) != 0)
2750 {
2751 if (IsFestival("kapul"))
2752 {
2753 return Create(new string[6] { "999", "1000", "1001", "1002", "1003", "1004" }.RandomItem());
2754 }
2755 if (IsFestival("yowyn"))
2756 {
2757 return Create(new string[2] { "1072", "1073" }.RandomItem());
2758 }
2759 if (IsFestival("noyel"))
2760 {
2761 return Create(new string[1] { "1069" }.RandomItem());
2762 }
2763 if (IsFestival("olvina"))
2764 {
2765 return Create(new string[2] { "1070", "1071" }.RandomItem());
2766 }
2767 }
2768 if (EClass._zone.IsFestival && EClass.rnd(2) == 0)
2769 {
2770 return Create(new string[4] { "953", "954", "955", "956" }.RandomItem());
2771 }
2772 return FromFilter("shop_lamp");
2773 default:
2774 if (EClass.rnd(100) == 0)
2775 {
2776 return Create("lockpick");
2777 }
2778 return FromFilter("shop_general");
2779 }
2780 Thing Create(string s)
2781 {
2782 return ThingGen.Create(s, -1, ShopLv);
2783 }
2784 Thing FromFilter(string s)
2785 {
2786 return ThingGen.CreateFromFilter(s, ShopLv);
2787 }
2788 static bool IsFestival(string id)
2789 {
2790 if (EClass._zone.id == id)
2791 {
2792 return EClass._zone.IsFestival;
2793 }
2794 return false;
2795 }
2796 }
2797 }
AnimeID
Definition: AnimeID.cs:2
CTAG
Definition: CTAG.cs:2
@ seed
ContainerType
Definition: ContainerType.cs:2
CurrencyType
Definition: CurrencyType.cs:2
if(!match.Success)
EffectDead
Definition: EffectDead.cs:2
Emo2
Definition: Emo2.cs:2
@ cook
FontColor
Definition: FontColor.cs:2
HitResult
Definition: HitResult.cs:2
ID_Achievement
InvGridSize
Definition: InvGridSize.cs:2
LockOpenState
Definition: LockOpenState.cs:2
PlaceState
Definition: PlaceState.cs:2
PriceType
Definition: PriceType.cs:2
Rarity
Definition: Rarity.cs:2
RefCardName
Definition: RefCardName.cs:2
ShopType
Definition: ShopType.cs:2
SlaverType
Definition: SlaverType.cs:2
ThrowType
Definition: ThrowType.cs:2
ToggleType
Definition: ToggleType.cs:2
TraitRadiusType
TreasureType
Definition: TreasureType.cs:2
Definition: AI_Eat.cs:5
bool altAction
Definition: ActPlan.cs:158
Chara cc
Definition: ActPlan.cs:204
bool IsSelfOrNeighbor
Definition: ActPlan.cs:178
bool TrySetAct(string lang, Func< bool > onPerform, Card tc, CursorInfo cursor=null, int dist=1, bool isHostileAct=false, bool localAct=true, bool canRepeat=false)
Definition: ActPlan.cs:372
bool CanGiveCard()
Definition: Affinity.cs:70
PointList points
Definition: BaseArea.cs:26
ScreenGuide guide
static void SetRarity(Rarity q=Rarity.Normal)
static void SetNormalRarity(bool fixedMat=false)
void PlayAnime(AnimeID id, bool force)
void AddExtra(string id)
void RemoveExtra(string id)
CardRow origin
Definition: CardRow.cs:49
string[] trait
Definition: CardRow.cs:33
string id
Definition: CardRow.cs:7
Definition: Card.cs:11
Thing TryMakeRandomItem(int lv=-1, TryMakeRandomItemSource itemSource=TryMakeRandomItemSource.Default, Chara crafter=null)
Definition: Card.cs:5751
virtual bool IsMultisize
Definition: Card.cs:2212
virtual bool isThing
Definition: Card.cs:2133
bool IsImportant
Definition: Card.cs:2157
virtual Chara Chara
Definition: Card.cs:2122
ElementContainerCard elements
Definition: Card.cs:42
int c_ammo
Definition: Card.cs:1501
string id
Definition: Card.cs:36
bool isNPCProperty
Definition: Card.cs:557
bool IsUnique
Definition: Card.cs:2143
virtual void Die(Element e=null, Card origin=null, AttackSource attackSource=AttackSource.None, Chara originalTarget=null)
Definition: Card.cs:5242
bool isRoofItem
Definition: Card.cs:581
bool c_lockedHard
Definition: Card.cs:1063
bool isLostProperty
Definition: Card.cs:809
SourceMaterial.Row material
Definition: Card.cs:2103
SoundSource PlaySound(string id, float v=1f, bool spatial=true)
Definition: Card.cs:6638
string c_idDeity
Definition: Card.cs:1621
int c_invest
Definition: Card.cs:1333
Card ChangeMaterial(int idNew, bool ignoreFixedMaterial=false)
Definition: Card.cs:3214
void SetInt(string id, int value=0)
Definition: Card.cs:2586
Card MakeRefFrom(string id)
Definition: Card.cs:6020
Thing Tool
Definition: Card.cs:2480
bool isRestocking
Definition: Card.cs:893
Thing ammoData
Definition: Card.cs:1825
int c_lockLv
Definition: Card.cs:991
string c_refText
Definition: Card.cs:1669
Thing AddThing(string id, int lv=-1)
Definition: Card.cs:3277
void Talk(string idTopic, string ref1=null, string ref2=null, bool forceSync=false)
Definition: Card.cs:7198
Card SetLv(int a)
Definition: Card.cs:3070
int hp
Definition: Card.cs:245
Rarity rarity
Definition: Card.cs:317
bool ExistsOnMap
Definition: Card.cs:2137
bool c_revealLock
Definition: Card.cs:1075
Thing SetNum(int a)
Definition: Card.cs:3673
bool autoRefuel
Definition: Card.cs:629
bool IsFood
Definition: Card.cs:2229
string GetStr(string id, string defaultStr=null)
Definition: Card.cs:2595
TileType TileType
Definition: Card.cs:2189
virtual SourcePref Pref
Definition: Card.cs:2159
void RecalculateFOV()
Definition: Card.cs:6854
int STR
Definition: Card.cs:2403
bool HasTag(CTAG tag)
Definition: Card.cs:2728
Point pos
Definition: Card.cs:60
void DyeRandom()
Definition: Card.cs:6466
void Dye(string idMat)
Definition: Card.cs:6471
Trait trait
Definition: Card.cs:54
bool disableAutoToggle
Definition: Card.cs:605
int c_dateStockExpire
Definition: Card.cs:1273
void ModCharge(int a, bool destroy=false)
Definition: Card.cs:4128
void Destroy()
Definition: Card.cs:5310
bool c_isImportant
Definition: Card.cs:1051
ThingContainer things
Definition: Card.cs:39
bool IsInstalled
Definition: Card.cs:2451
virtual bool IsPC
Definition: Card.cs:2197
bool IsMeleeWeapon
Definition: Card.cs:2295
string NameSimple
Definition: Card.cs:2193
virtual bool isChara
Definition: Card.cs:2135
virtual Thing Thing
Definition: Card.cs:2110
Card GetRootCard()
Definition: Card.cs:3604
int Evalue(int ele)
Definition: Card.cs:2704
bool GetBool(string id)
Definition: Card.cs:2557
int idSkin
Definition: Card.cs:365
bool isOn
Definition: Card.cs:545
Thing SetPriceFix(int a)
Definition: Card.cs:7664
Cell Cell
Definition: Card.cs:2107
Thing Duplicate(int num)
Definition: Card.cs:3622
void PlaySoundDrop(bool spatial=true)
Definition: Card.cs:6623
Thing c_copyContainer
Definition: Card.cs:1849
virtual CardRow sourceCard
Definition: Card.cs:2183
void ModExp(string alias, int a)
Definition: Card.cs:2781
Thing Add(string id, int num=1, int lv=1)
Definition: Card.cs:3254
int Num
Definition: Card.cs:161
void PlayAnime(AnimeID id, bool force=false)
Definition: Card.cs:6657
SourceCategory.Row category
Definition: Card.cs:2101
bool IsIdentified
Definition: Card.cs:2447
bool IsContainer
Definition: Card.cs:2141
int c_charges
Definition: Card.cs:1309
string c_editorTraitVal
Definition: Card.cs:1753
CardRenderer renderer
Definition: Card.cs:64
int GetInt(string id, int? defaultInt=null)
Definition: Card.cs:2567
bool HasElement(int ele, bool includeNagative=false)
Definition: Card.cs:6376
void Say(string lang, string ref1=null, string ref2=null)
Definition: Card.cs:7316
void RemoveThings()
Definition: Card.cs:3488
bool HasBlock
Definition: Cell.cs:663
bool HasRoof
Definition: Cell.cs:668
bool HasFloor
Definition: Cell.cs:665
Definition: Chara.cs:10
override bool IsAliveInCurrentZone
Definition: Chara.cs:567
Card held
Definition: Chara.cs:70
override bool IsPC
Definition: Chara.cs:630
bool TryHoldCard(Card t, int num=-1, bool pickHeld=false)
Definition: Chara.cs:4707
Stats stamina
Definition: Chara.cs:1205
Affinity affinity
Definition: Chara.cs:318
bool enable
Definition: CoreDebug.cs:301
static Thing MakeLoveLunch(Chara c)
Definition: CraftUtil.cs:221
static void MakeDish(Thing food, int lv, Chara crafter=null, int seed=-1)
Definition: CraftUtil.cs:62
Definition: DNA.cs:8
Type
Definition: DNA.cs:10
static Thing GenerateGene(Chara c, Type? type=null)
Definition: DNA.cs:116
Definition: Date.cs:4
int hour
Definition: Date.cs:74
int GetRaw(int offsetHours=0)
Definition: Date.cs:328
int month
Definition: Date.cs:50
bool IsExpired(int time)
Definition: Date.cs:338
string GetText(TextFormat format)
Definition: Date.cs:251
int GetRemainingHours(int rawDeadLine)
Definition: Date.cs:343
Definition: Dialog.cs:7
static Dialog InputName(string langDetail, string text, Action< bool, string > onClose, InputType inputType=InputType.Default)
Definition: Dialog.cs:536
Definition: EClass.cs:6
static Game game
Definition: EClass.cs:9
static Zone _zone
Definition: EClass.cs:21
static World world
Definition: EClass.cs:41
static Map _map
Definition: EClass.cs:19
static int rnd(long a)
Definition: EClass.cs:59
static SourceManager sources
Definition: EClass.cs:43
static int rndSeed(int a, int seed)
Definition: EClass.cs:51
static BaseGameScreen screen
Definition: EClass.cs:33
static int rndHalf(int a)
Definition: EClass.cs:97
static Player player
Definition: EClass.cs:13
static Chara pc
Definition: EClass.cs:15
static CoreDebug debug
Definition: EClass.cs:49
static GameSetting setting
Definition: EClass.cs:35
Element SetBase(string alias, int v, int potential=0)
void Remove(int id)
bool HasBase(int ele)
bool HasTag(string tag)
Definition: ELEMENT.cs:482
int Evalue(int ele)
RenderSetting render
Definition: GameSetting.cs:346
SpatialManager spatials
Definition: Game.cs:153
bool IsSurvival
Definition: Game.cs:276
QuestManager quests
Definition: Game.cs:183
override bool IsCurrentZone
Definition: GuildMerchant.cs:5
override bool IsCurrentZone
Definition: GuildThief.cs:6
Definition: Guild.cs:2
static GuildMerchant Merchant
Definition: Guild.cs:62
static GuildMage Mage
Definition: Guild.cs:58
bool IsMember
Definition: Guild.cs:72
static GuildThief Thief
Definition: Guild.cs:60
static LayerChara Instance
Definition: LayerChara.cs:3
static LayerDragGrid Create(InvOwnerDraglet owner, bool refuelFromLayerDragGrid=false)
Definition: Los.cs:5
static bool IsVisible(Point p1, Point p2, Action< Point, bool > _onVisit=null)
Definition: Los.cs:167
static SourceMaterial.Row GetRandomMaterial(int lv, string group=null, bool tryLevelMatTier=false)
Definition: MATERIAL.cs:56
static SourceMaterial.Row GetRandomMaterialFromCategory(int lv, string cat, SourceMaterial.Row fallback)
Definition: MATERIAL.cs:93
int hour
Definition: MapConfig.cs:95
bool IsIndoor
Definition: Map.cs:131
void ForeachSphere(int _x, int _z, float r, Action< Point > action)
Definition: Map.cs:2437
MapConfig config
Definition: Map.cs:37
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
int loytelMartLv
Definition: Player.cs:700
int married
Definition: Player.cs:129
Flags flags
Definition: Player.cs:1161
void ModKarma(int a)
Definition: Player.cs:2610
Stats stats
Definition: Player.cs:1083
Dictionary< string, HashSet< string > > noRestocks
Definition: Player.cs:1194
Definition: Point.cs:9
ref Vector3 Position(int height)
Definition: Point.cs:553
List< Card > ListCards(bool includeMasked=false)
Definition: Point.cs:1057
Point Copy()
Definition: Point.cs:491
bool IsValid
Definition: Point.cs:88
void RefreshNeighborTiles()
Definition: Point.cs:1282
Cell cell
Definition: Point.cs:51
bool HasChara
Definition: Point.cs:238
int GetPhase(string id)
bool IsCompleted(string id)
Definition: Rand.cs:4
static void SetBaseSeed(int a=-1)
Definition: Rand.cs:39
static void SetSeed(int a=-1)
Definition: Rand.cs:44
static List< RecipeSource > list
RenderRow row
Definition: RecipeSource.cs:5
Definition: Recipe.cs:7
static Recipe Create(RecipeSource _source, int idMat=-1, Thing ing=null)
Definition: Recipe.cs:325
string RecipeCat
Definition: RenderRow.cs:121
string[] recipeKey
Definition: RenderRow.cs:56
int value
Definition: RenderRow.cs:20
Definition: Room.cs:4
MeshPass passGuideFloor
Definition: ScreenGuide.cs:7
int dateRefresh
Definition: SlaverData.cs:10
string GetText(string id="name", bool returnNull=false)
Definition: SourceData.cs:688
SourceMaterial materials
SourceElement elements
SourceChara charas
SourceReligion religions
bool Surface
Definition: SourcePref.cs:342
Zone Find(string id)
int lv
Definition: Spatial.cs:142
int electricity
Definition: Spatial.cs:250
int uid
Definition: Spatial.cs:70
string id
Definition: Spatial.cs:13
int development
Definition: Spatial.cs:238
static SpawnList Get(string id, string parent=null, CardFilter filter=null)
Definition: SpawnList.cs:18
CardRow Select(int lv=-1, int levelRange=-1)
Definition: SpawnList.cs:139
virtual void Mod(int a)
Definition: Stats.cs:135
Definition: Steam.cs:12
static void GetAchievement(ID_Achievement id)
Definition: Steam.cs:53
List< Thing > List(Func< Thing, bool > func, bool onlyAccessible=false)
void DestroyAll(Func< Thing, bool > funcExclude=null)
Thing Find(int uid)
void Foreach(Action< Thing > action, bool onlyAccessible=true)
static Thing CreateRune(int ele, int v, bool free=false)
Definition: ThingGen.cs:209
static Thing CreatePotion(int ele, int num=1)
Definition: ThingGen.cs:224
static Thing CreateFromFilter(string id, int lv=-1)
Definition: ThingGen.cs:63
static Thing CreateMap(string idSource=null, int lv=-1)
Definition: ThingGen.cs:132
static Thing CreatePerfume(int ele, int num=1)
Definition: ThingGen.cs:231
static Thing CreateRedBook(string id, int num=1)
Definition: ThingGen.cs:175
static void CreateTreasureContent(Thing t, int lv, TreasureType type, bool clearContent)
Definition: ThingGen.cs:271
static Thing CreateCassette(int id)
Definition: ThingGen.cs:238
static Thing CreateSpellbook(string alias, int num=1)
Definition: ThingGen.cs:159
static Thing CreatePlan(int ele)
Definition: ThingGen.cs:145
static Thing CreateRecipe(string id)
Definition: ThingGen.cs:152
static Thing CreateSkillbook(int ele, int num=1)
Definition: ThingGen.cs:183
static Thing CreateFromCategory(string idCat, int lv=-1)
Definition: ThingGen.cs:75
static Thing CreateScroll(int ele, int num=1)
Definition: ThingGen.cs:190
static Thing CreateRod(int ele, int charge=-1)
Definition: ThingGen.cs:217
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
override int GetPrice(CurrencyType currency=CurrencyType.Money, bool sell=false, PriceType priceType=PriceType.Default, Chara c=null)
Definition: Thing.cs:829
void DoAct(Act act)
Definition: Thing.cs:2009
virtual bool IsBlockSight
Definition: TileType.cs:163
virtual bool IsBlockPass
Definition: TileType.cs:159
static Thing MakeSeed(string idSource)
Definition: TraitSeed.cs:105
static Thing MakeRandomSeed(bool enc=false)
Definition: TraitSeed.cs:97
static void LevelSeed(Thing t, SourceObj.Row obj, int num)
Definition: TraitSeed.cs:184
static void SetZone(Zone zone, Thing t)
Definition: Trait.cs:7
virtual string LangBarter
Definition: Trait.cs:577
virtual void OnImportMap()
Definition: Trait.cs:688
virtual bool IsBlendBase
Definition: Trait.cs:275
virtual bool RequireFullStackCheck
Definition: Trait.cs:209
virtual bool CanOffer(Chara cc, Card tg)
Definition: Trait.cs:953
virtual bool OnUse(Chara c, Card tg)
Definition: Trait.cs:1217
virtual bool CanExtendBuild
Definition: Trait.cs:181
bool IsFuel(string s)
Definition: Trait.cs:1521
virtual bool IsFactory
Definition: Trait.cs:143
virtual bool IsRestSpot
Definition: Trait.cs:269
virtual TileMode tileMode
Definition: Trait.cs:449
void OfferProcess(Chara cc)
Definition: Trait.cs:966
virtual bool IsBlockPath
Definition: Trait.cs:54
virtual bool CanBeMasked
Definition: Trait.cs:271
virtual bool IsBlockSight
Definition: Trait.cs:56
virtual bool HoldAsDefaultInteraction
Definition: Trait.cs:133
virtual int radius
Definition: Trait.cs:94
virtual int GetActDuration(Chara c)
Definition: Trait.cs:649
virtual bool CanBeAttacked
Definition: Trait.cs:177
virtual void Update()
Definition: Trait.cs:837
virtual bool CanBeHallucinated
Definition: Trait.cs:311
virtual string IDActorEx
Definition: Trait.cs:187
virtual void SetMainText(UIText t, bool hotitem)
Definition: Trait.cs:1629
virtual bool CanUse(Chara c)
Definition: Trait.cs:1193
virtual bool ShouldRefreshTile
Definition: Trait.cs:77
virtual string GetName()
Definition: Trait.cs:728
virtual bool ShowChildrenNumber
Definition: Trait.cs:345
virtual CopyShopType CopyShop
Definition: Trait.cs:527
virtual void OnChangePlaceState(PlaceState state)
Definition: Trait.cs:712
string IdToggleExtra
Definition: Trait.cs:479
virtual RenderData GetRenderData()
Definition: Trait.cs:610
virtual bool IsLocalAct
Definition: Trait.cs:273
virtual Recipe GetRecipe()
Definition: Trait.cs:921
virtual bool IsOpenPath
Definition: Trait.cs:62
virtual bool ShowAsTool
Definition: Trait.cs:347
virtual void OnSetCardGrid(ButtonGrid b)
Definition: Trait.cs:1265
virtual string IDInvStyle
Definition: Trait.cs:185
virtual string IdSoundToggleOff
Definition: Trait.cs:510
virtual HotItem GetHotItem()
Definition: Trait.cs:1157
virtual bool CanHarvest
Definition: Trait.cs:92
virtual float DropChance
Definition: Trait.cs:371
int GetSortVal(UIList.SortMode m)
Definition: Trait.cs:1151
virtual bool Contains(RecipeSource r)
Definition: Trait.cs:615
virtual void OnEquip(Chara c, bool onSetOwner)
Definition: Trait.cs:704
virtual void OnHeld()
Definition: Trait.cs:1239
virtual void OnTickHeld()
Definition: Trait.cs:1243
virtual void WriteNote(UINote n, bool identified)
Definition: Trait.cs:1147
int GetParamInt(int i, int def)
Definition: Trait.cs:596
virtual void OnSteppedOut(Chara c)
Definition: Trait.cs:1273
virtual bool TryProgress(AIProgress p)
Definition: Trait.cs:1005
virtual bool CanBeDisassembled
Definition: Trait.cs:318
virtual int OriginalElectricity
Definition: Trait.cs:103
virtual void OnRead(Chara c)
Definition: Trait.cs:1167
virtual bool UseAltTiles
Definition: Trait.cs:451
virtual bool IgnoreLastStackHeight
Definition: Trait.cs:121
virtual bool IsTool
Definition: Trait.cs:379
virtual void TryToggle()
Definition: Trait.cs:1327
Point GetRandomPoint(Func< Point, bool > func=null, Chara accessChara=null)
Definition: Trait.cs:846
virtual void OnInstall(bool byPlayer)
Definition: Trait.cs:1319
virtual bool CanChangeHeight
Definition: Trait.cs:161
virtual bool ShowOrbit
Definition: Trait.cs:137
virtual void TrySetAct(ActPlan p)
Definition: Trait.cs:1227
virtual bool IsAltar
Definition: Trait.cs:267
virtual bool CanSearchContent
Definition: Trait.cs:230
virtual int GetValue()
Definition: Trait.cs:620
virtual int FuelCost
Definition: Trait.cs:473
virtual bool CanChildDecay(Card c)
Definition: Trait.cs:1260
virtual void TrySetHeldAct(ActPlan p)
Definition: Trait.cs:1235
virtual string IdSoundToggleOn
Definition: Trait.cs:494
virtual void OnThrowGround(Chara c, Point p)
Definition: Trait.cs:1189
virtual bool RenderExtra
Definition: Trait.cs:369
Thing CreateStock()
Definition: Trait.cs:2489
virtual bool CanStackTo(Thing to)
Definition: Trait.cs:625
virtual string ReqHarvest
Definition: Trait.cs:315
virtual bool IgnoreOnSteppedWhenMoving
Definition: Trait.cs:383
virtual bool CanBeDestroyed
Definition: Trait.cs:307
bool IsToggle
Definition: Trait.cs:399
virtual bool CanRead(Chara c)
Definition: Trait.cs:1162
virtual int RestockDay
Definition: Trait.cs:573
virtual string langNote
Definition: Trait.cs:183
virtual bool AlwaysHideOnLowWall
Definition: Trait.cs:365
virtual bool CanCook(Card c)
Definition: Trait.cs:931
virtual string IdNoRestock
Definition: Trait.cs:373
virtual int CraftNum
Definition: Trait.cs:135
virtual bool CanBuildInTown
Definition: Trait.cs:280
virtual void SetOwner(Card _owner)
Definition: Trait.cs:673
virtual bool AllowSell
Definition: Trait.cs:548
virtual bool OnChildDecay(Card c, bool firstDecay)
Definition: Trait.cs:1255
virtual bool UseLowblock
Definition: Trait.cs:453
virtual bool HasCharges
Definition: Trait.cs:341
virtual void OnRenderTile(Point point, HitResult result, int dir)
Definition: Trait.cs:737
string GetTextRestock(string lang, bool pet)
Definition: Trait.cs:1653
virtual void OnOpenDoor(Chara c)
Definition: Trait.cs:1277
virtual bool NoHeldDir
Definition: Trait.cs:363
virtual LockOpenState TryOpenLock(Chara cc, bool msgFail=true)
Definition: Trait.cs:1010
virtual bool IsLightOn
Definition: Trait.cs:426
bool IsRequireFuel
Definition: Trait.cs:477
virtual bool IsNoShop
Definition: Trait.cs:66
virtual bool CanOpenContainer
Definition: Trait.cs:246
virtual int DefaultStock
Definition: Trait.cs:131
bool IsFuel(Thing t)
Definition: Trait.cs:1526
virtual void TrySetToggleAct(ActPlan p)
Definition: Trait.cs:1433
virtual bool ShowCharges
Definition: Trait.cs:343
virtual TileType tileType
Definition: Trait.cs:50
virtual bool IsFloating
Definition: Trait.cs:64
virtual void PlayToggleEffect(bool silent)
Definition: Trait.cs:1383
virtual bool CanUse(Chara c, Card tg)
Definition: Trait.cs:1198
virtual bool CanUseRoomRadius
Definition: Trait.cs:98
virtual bool CanCopy(Thing t)
Definition: Trait.cs:1648
virtual bool CanBeHeld
Definition: Trait.cs:291
virtual bool UseDummyTile
Definition: Trait.cs:207
virtual void OnUnequip(Chara c)
Definition: Trait.cs:708
virtual int DecaySpeedChild
Definition: Trait.cs:127
virtual Sprite GetRefSprite()
Definition: Trait.cs:659
virtual bool CanChangeAffinity
Definition: Trait.cs:581
virtual bool IsOnlyUsableByPc
Definition: Trait.cs:70
virtual bool RemoveGlobalOnBanish
Definition: Trait.cs:579
virtual bool IsHomeItem
Definition: Trait.cs:265
TileMode
Definition: Trait.cs:9
void Offer(Chara cc)
Definition: Trait.cs:988
virtual bool IsDoor
Definition: Trait.cs:58
virtual void OnAddedToZone()
Definition: Trait.cs:716
virtual bool CanName
Definition: Trait.cs:147
virtual void Toggle(bool on, bool silent=false)
Definition: Trait.cs:1349
string GetParam(int i, string def=null)
Definition: Trait.cs:587
virtual int IdSkin
Definition: Trait.cs:46
void Refuel(Thing t)
Definition: Trait.cs:1563
virtual void OnUnsetCurrentItem()
Definition: Trait.cs:1251
virtual void OnRenderExtra(RenderParam p)
Definition: Trait.cs:664
bool ExistsOnMap
Definition: Trait.cs:367
void DamageRandomProperty(Chara cc)
Definition: Trait.cs:1107
virtual bool IsAnimeOn
Definition: Trait.cs:388
virtual bool CanEat(Chara c)
Definition: Trait.cs:1171
virtual bool CanPutAway
Definition: Trait.cs:150
CopyShopType
Definition: Trait.cs:20
virtual bool IsOpenSight
Definition: Trait.cs:60
virtual Recipe GetBuildModeRecipe()
Definition: Trait.cs:926
virtual int CostRerollShop
Definition: Trait.cs:560
virtual void OnSimulateHour(VirtualDate date)
Definition: Trait.cs:724
int GetFuelValue(Thing t)
Definition: Trait.cs:1531
virtual bool OnUse(Chara c, Point p)
Definition: Trait.cs:1222
Point GetPoint()
Definition: Trait.cs:841
virtual bool IsThrowMainAction
Definition: Trait.cs:194
virtual bool HaveUpdate
Definition: Trait.cs:139
virtual void OnListInteraction(InvOwner.ListInteraction list, ButtonGrid b, bool context)
Definition: Trait.cs:752
virtual bool InvertHeldSprite
Definition: Trait.cs:72
virtual bool HideInAdv
Definition: Trait.cs:361
virtual bool CanBeHeldAsFurniture
Definition: Trait.cs:350
string TextNextRestockPet
Definition: Trait.cs:585
virtual string RecipeCat
Definition: Trait.cs:377
virtual bool UseExtra
Definition: Trait.cs:455
virtual int MaxFuel
Definition: Trait.cs:462
virtual bool IsChangeFloorHeight
Definition: Trait.cs:74
virtual void OnStepped(Chara c)
Definition: Trait.cs:1269
virtual bool CanBeTeleported
Definition: Trait.cs:179
bool IsLighting
Definition: Trait.cs:414
virtual string GetHoverText()
Definition: Trait.cs:630
string TextNextRestock
Definition: Trait.cs:583
virtual bool IsGround
Definition: Trait.cs:68
virtual void RefreshRenderer()
Definition: Trait.cs:1614
virtual bool CanUse(Chara c, Point p)
Definition: Trait.cs:1203
virtual bool DisableAutoCombat
Definition: Trait.cs:211
virtual void OnCreate(int lv)
Definition: Trait.cs:700
virtual bool IsSpot
Definition: Trait.cs:141
virtual ? Color ColorExtra
Definition: Trait.cs:459
virtual void OnBarter(bool reroll=false)
Definition: Trait.cs:1698
string[] Params
Definition: Trait.cs:33
virtual int Electricity
Definition: Trait.cs:119
virtual void OnSetCurrentItem()
Definition: Trait.cs:1247
virtual TraitRadiusType radiusType
Definition: Trait.cs:96
virtual bool CanCopyInBlueprint
Definition: Trait.cs:166
Emo2 GetRestockedIcon()
Definition: Trait.cs:1676
virtual bool OnUse(Chara c)
Definition: Trait.cs:1208
int GetFuelValue(string id)
Definition: Trait.cs:1540
virtual SourcePref GetPref()
Definition: Trait.cs:605
void TryRefuel(int dest, List< Thing > excludes)
Definition: Trait.cs:1576
virtual void OnLockOpen(Chara cc)
Definition: Trait.cs:1128
virtual bool CanBeShipped
Definition: Trait.cs:330
Card owner
Definition: Trait.cs:28
virtual void OnUninstall()
Definition: Trait.cs:1323
virtual bool IsOn
Definition: Trait.cs:385
void CookProgress()
Definition: Trait.cs:940
static List< Point > listRadiusPoints
Definition: Trait.cs:30
virtual void OnSetOwner()
Definition: Trait.cs:684
virtual bool CanBuiltAt(Point p)
Definition: Trait.cs:832
virtual bool CanUseContent
Definition: Trait.cs:227
virtual bool AutoToggle
Definition: Trait.cs:402
virtual bool IsNightOnlyLight
Definition: Trait.cs:438
virtual void OnDrink(Chara c)
Definition: Trait.cs:1185
virtual int GuidePriotiy
Definition: Trait.cs:100
virtual bool UseLightColor
Definition: Trait.cs:457
virtual bool MaskOnBuild
Definition: Trait.cs:189
virtual int DecaySpeed
Definition: Trait.cs:125
virtual void OnRemovedFromZone()
Definition: Trait.cs:720
virtual void OnToggle()
Definition: Trait.cs:1429
virtual bool ShouldTryRefreshRoom
Definition: Trait.cs:88
virtual int ShopLv
Definition: Trait.cs:525
virtual bool CanBlend(Thing t)
Definition: Trait.cs:640
virtual Emo2 GetHeldEmo(Chara c)
Definition: Trait.cs:668
virtual bool CanBeDropped
Definition: Trait.cs:313
virtual void OnCrafted(Recipe recipe, List< Thing > ings)
Definition: Trait.cs:696
virtual bool CanBeStolen
Definition: Trait.cs:294
bool IsFuelEnough(int num=1, List< Thing > excludes=null, bool tryRefuel=true)
Definition: Trait.cs:1504
virtual bool CanBeSmashedToDeath
Definition: Trait.cs:309
virtual bool LevelAsQuality
Definition: Trait.cs:205
virtual void OnEat(Chara c)
Definition: Trait.cs:1176
virtual Action GetHealAction(Chara c)
Definition: Trait.cs:635
virtual int IdleUseChance
Definition: Trait.cs:375
static TraitSelfFactory SelfFactory
Definition: Trait.cs:26
virtual bool CanStack
Definition: Trait.cs:163
virtual bool ShowContextOnPick
Definition: Trait.cs:191
virtual byte WeightMod
Definition: Trait.cs:44
virtual List< Point > ListPoints(Point center=null, bool onlyPassable=true, bool allowChara=true)
Definition: Trait.cs:864
virtual SourceElement.Row GetRefElement()
Definition: Trait.cs:654
virtual LockOpenState TryPryOpenLock(Chara cc, bool msgFail=true)
Definition: Trait.cs:1057
virtual bool IdleUse(Chara c, int dist)
Definition: Trait.cs:679
virtual int Decay
Definition: Trait.cs:123
virtual int NumCopyItem
Definition: Trait.cs:529
virtual void OnEnterScreen()
Definition: Trait.cs:1609
virtual bool IsSpecialContainer
Definition: Trait.cs:257
void Uninstall()
Definition: Trait.cs:1301
virtual bool ShowFuelWindow
Definition: Trait.cs:475
virtual string LangUse
Definition: Trait.cs:381
virtual void SetName(ref string s)
Definition: Trait.cs:733
virtual bool CanBeOnlyBuiltInHome
Definition: Trait.cs:277
virtual bool CanAutofire
Definition: Trait.cs:145
virtual bool IsFridge
Definition: Trait.cs:129
virtual void SetParams(params string[] s)
Definition: Trait.cs:692
virtual int CompareTo(Card b)
Definition: Trait.cs:827
virtual bool IsContainer
Definition: Trait.cs:225
virtual bool CanDrink(Chara c)
Definition: Trait.cs:1180
virtual int InstallBottomPriority
Definition: Trait.cs:90
virtual bool CanOnlyCarry
Definition: Trait.cs:305
void Install(bool byPlayer)
Definition: Trait.cs:1281
virtual string Name
Definition: Trait.cs:48
virtual bool AllowCriminal
Definition: Trait.cs:571
virtual void OnBlend(Thing t, Chara c)
Definition: Trait.cs:645
Definition: UIList.cs:9
SortMode
Definition: UIList.cs:27
Definition: UINote.cs:6
Definition: UIText.cs:6
void SetText(string s)
Definition: UIText.cs:163
bool IsRaining
Definition: Weather.cs:117
GameDate date
Definition: World.cs:6
Weather weather
Definition: World.cs:12
bool isStarted
Definition: Zone.cs:73
FactionBranch branch
Definition: Zone.cs:34
virtual bool IsFestival
Definition: Zone.cs:213
bool IsPCFaction
Definition: Zone.cs:477