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