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