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