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