Elin Decompiled Documentation EA 23.102 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,
15 }
16
17 public enum CopyShopType
18 {
19 None,
20 Item,
22 }
23
25
26 public Card owner;
27
28 protected static List<Point> listRadiusPoints = new List<Point>();
29
30 public string[] Params
31 {
32 get
33 {
34 if (!owner.c_editorTraitVal.IsEmpty())
35 {
36 return ("," + owner.c_editorTraitVal).Split(',');
37 }
38 return owner.sourceCard.trait;
39 }
40 }
41
42 public virtual byte WeightMod => 0;
43
44 public virtual int IdSkin => owner.idSkin;
45
46 public virtual string Name => owner.NameSimple;
47
48 public virtual TileType tileType => owner.TileType;
49
50 public virtual RefCardName RefCardName => RefCardName.Default;
51
52 public virtual bool IsBlockPath => tileType.IsBlockPass;
53
54 public virtual bool IsBlockSight => tileType.IsBlockSight;
55
56 public virtual bool IsDoor => false;
57
58 public virtual bool IsOpenSight => false;
59
60 public virtual bool IsOpenPath => false;
61
62 public virtual bool IsFloating => false;
63
64 public virtual bool IsGround => false;
65
66 public virtual bool InvertHeldSprite => false;
67
68 public virtual bool IsChangeFloorHeight => owner.Pref.Surface;
69
70 public virtual bool ShouldRefreshTile
71 {
72 get
73 {
74 if (!IsBlockPath && !IsOpenSight)
75 {
76 return IsBlockSight;
77 }
78 return true;
79 }
80 }
81
82 public virtual bool ShouldTryRefreshRoom => IsDoor;
83
84 public virtual int InstallBottomPriority => -1;
85
86 public virtual bool CanHarvest => true;
87
88 public virtual int radius => 0;
89
90 public virtual TraitRadiusType radiusType => TraitRadiusType.Default;
91
92 public virtual bool CanUseRoomRadius => true;
93
94 public virtual int GuidePriotiy => 0;
95
96 public virtual int Electricity
97 {
98 get
99 {
100 if (!owner.isThing)
101 {
102 return 0;
103 }
104 int electricity = owner.Thing.source.electricity;
105 if (electricity > 0 || EClass._zone == null || EClass._zone.branch == null)
106 {
107 return electricity;
108 }
109 return electricity * 100 / (100 + EClass._zone.branch.Evalue(2700) / 2);
110 }
111 }
112
113 public virtual bool IgnoreLastStackHeight => false;
114
115 public virtual int Decay => owner.material.decay;
116
117 public virtual int DecaySpeed => 100;
118
119 public virtual int DecaySpeedChild => 100;
120
121 public virtual bool IsFridge => false;
122
123 public virtual int DefaultStock => 1;
124
125 public virtual bool HoldAsDefaultInteraction => false;
126
127 public virtual int CraftNum => 1;
128
129 public virtual bool ShowOrbit => false;
130
131 public virtual bool HaveUpdate => false;
132
133 public virtual bool IsSpot => radius > 0;
134
135 public virtual bool IsFactory => false;
136
137 public virtual bool CanAutofire => false;
138
139 public virtual bool CanName => false;
140
141 public virtual bool CanPutAway => true;
142
143 public virtual bool CanChangeHeight => true;
144
145 public virtual bool CanStack => owner.category.maxStack > 1;
146
147 public virtual bool CanCopyInBlueprint
148 {
149 get
150 {
151 if (owner.rarity <= Rarity.Superior && owner.sourceCard.value > 0)
152 {
153 return CanBeDestroyed;
154 }
155 return false;
156 }
157 }
158
159 public virtual bool CanBeAttacked => false;
160
161 public virtual bool CanExtendBuild => false;
162
163 public virtual string langNote => "";
164
165 public virtual string IDInvStyle => "default";
166
167 public virtual string IDActorEx => owner.Thing.source.idActorEx;
168
169 public virtual bool MaskOnBuild => false;
170
171 public virtual bool ShowContextOnPick => false;
172
173 public virtual bool IsThrowMainAction
174 {
175 get
176 {
177 if (!owner.HasTag(CTAG.throwWeapon))
178 {
179 return owner.IsMeleeWeapon;
180 }
181 return true;
182 }
183 }
184
185 public virtual bool LevelAsQuality => false;
186
187 public virtual bool UseDummyTile => true;
188
189 public virtual bool RequireFullStackCheck => false;
190
191 public virtual bool DisableAutoCombat => false;
192
194 {
195 get
196 {
197 if (!owner.IsPC)
198 {
199 return InvGridSize.Default;
200 }
201 return InvGridSize.Backpack;
202 }
203 }
204
205 public virtual bool IsContainer => false;
206
207 public virtual bool CanUseContent => CanSearchContent;
208
209 public virtual bool CanSearchContent
210 {
211 get
212 {
213 if (!owner.isChara)
214 {
215 if (IsContainer)
216 {
217 return owner.c_lockLv == 0;
218 }
219 return false;
220 }
221 return true;
222 }
223 }
224
225 public virtual bool CanOpenContainer
226 {
227 get
228 {
229 if (IsContainer)
230 {
231 return !owner.isNPCProperty;
232 }
233 return false;
234 }
235 }
236
237 public virtual bool IsSpecialContainer => false;
238
239 public virtual ContainerType ContainerType => ContainerType.Default;
240
241 public virtual ThrowType ThrowType => ThrowType.Default;
242
243 public virtual EffectDead EffectDead => EffectDead.Default;
244
245 public virtual bool IsHomeItem => false;
246
247 public virtual bool IsAltar => false;
248
249 public virtual bool IsRestSpot => false;
250
251 public virtual bool CanBeMasked => false;
252
253 public virtual bool IsBlendBase => false;
254
255 public virtual bool CanBeOnlyBuiltInHome => false;
256
257 public virtual bool CanBuildInTown
258 {
259 get
260 {
262 {
264 }
265 return false;
266 }
267 }
268
269 public virtual bool CanBeHeld => ReqHarvest == null;
270
271 public virtual bool CanBeStolen
272 {
273 get
274 {
275 if (!CanOnlyCarry)
276 {
277 return CanBeHeld;
278 }
279 return false;
280 }
281 }
282
283 public virtual bool CanOnlyCarry => false;
284
285 public virtual bool CanBeDestroyed => true;
286
287 public virtual bool CanBeHallucinated => true;
288
289 public virtual bool CanBeDropped => true;
290
291 public virtual string ReqHarvest => null;
292
293 public virtual bool CanBeDisassembled
294 {
295 get
296 {
297 if (CanBeDestroyed && !(this is TraitTrap) && owner.things.Count == 0)
298 {
299 return owner.rarity < Rarity.Artifact;
300 }
301 return false;
302 }
303 }
304
305 public virtual bool CanBeShipped
306 {
307 get
308 {
309 if (!owner.IsImportant)
310 {
311 return !owner.IsUnique;
312 }
313 return false;
314 }
315 }
316
317 public virtual bool HasCharges => false;
318
319 public virtual bool ShowCharges => HasCharges;
320
321 public virtual bool ShowChildrenNumber => IsContainer;
322
323 public virtual bool ShowAsTool => false;
324
325 public virtual bool CanBeHeldAsFurniture
326 {
327 get
328 {
329 if (!(this is TraitTool))
330 {
331 return IsThrowMainAction;
332 }
333 return true;
334 }
335 }
336
337 public virtual bool HideInAdv => false;
338
339 public virtual bool NoHeldDir => false;
340
341 public virtual bool AlwaysHideOnLowWall => false;
342
344
345 public virtual bool RenderExtra => false;
346
347 public virtual float DropChance => 0f;
348
349 public virtual string IdNoRestock => owner.id;
350
351 public virtual int IdleUseChance => 3;
352
353 public virtual string RecipeCat => owner.sourceCard.RecipeCat;
354
355 public virtual bool IsTool => false;
356
357 public virtual string LangUse => "actUse";
358
359 public virtual bool IsOn => owner.isOn;
360
361 public virtual bool IsAnimeOn
362 {
363 get
364 {
365 if (!IsOn)
366 {
367 return !IsToggle;
368 }
369 return true;
370 }
371 }
372
373 public bool IsToggle => ToggleType != ToggleType.None;
374
375 public virtual bool AutoToggle
376 {
377 get
378 {
379 if (IsLighting || ToggleType == ToggleType.Curtain || ToggleType == ToggleType.Electronics)
380 {
381 return !owner.disableAutoToggle;
382 }
383 return false;
384 }
385 }
386
387 public bool IsLighting
388 {
389 get
390 {
391 if (ToggleType != ToggleType.Fire)
392 {
393 return ToggleType == ToggleType.Light;
394 }
395 return true;
396 }
397 }
398
399 public virtual bool IsLightOn
400 {
401 get
402 {
403 if (!owner.isChara)
404 {
405 return owner.isOn;
406 }
407 return true;
408 }
409 }
410
411 public virtual bool IsNightOnlyLight
412 {
413 get
414 {
415 if (ToggleType != ToggleType.Electronics && IsToggle)
416 {
417 return !owner.isRoofItem;
418 }
419 return false;
420 }
421 }
422
423 public virtual TileMode tileMode => TileMode.Default;
424
425 public virtual bool UseAltTiles => owner.isOn;
426
427 public virtual bool UseLowblock => false;
428
429 public virtual bool UseExtra => true;
430
431 public virtual bool UseLightColor => true;
432
433 public virtual Color? ColorExtra => null;
434
435 public virtual int MaxFuel
436 {
437 get
438 {
439 if (ToggleType != ToggleType.Fire)
440 {
441 return 0;
442 }
443 return 100;
444 }
445 }
446
447 public virtual int FuelCost => 1;
448
449 public virtual bool ShowFuelWindow => true;
450
451 public bool IsRequireFuel => MaxFuel > 0;
452
453 public string IdToggleExtra => owner.Thing?.source.idToggleExtra;
454
455 public virtual ToggleType ToggleType
456 {
457 get
458 {
459 if (Electricity >= 0)
460 {
461 return ToggleType.None;
462 }
463 return ToggleType.Electronics;
464 }
465 }
466
467 public virtual int ShopLv => Mathf.Max(1, EClass._zone.development / 10 + owner.c_invest + 1);
468
469 public virtual CopyShopType CopyShop => CopyShopType.None;
470
471 public virtual int NumCopyItem => 2 + Mathf.Min(owner.c_invest / 10, 3);
472
473 public virtual ShopType ShopType => ShopType.None;
474
475 public virtual CurrencyType CurrencyType => CurrencyType.Money;
476
477 public virtual PriceType PriceType => PriceType.Default;
478
479 public virtual bool AllowSell
480 {
481 get
482 {
483 if (CurrencyType != CurrencyType.Money)
484 {
485 return CurrencyType == CurrencyType.None;
486 }
487 return true;
488 }
489 }
490
491 public virtual int CostRerollShop
492 {
493 get
494 {
495 if (CurrencyType == CurrencyType.Money || CurrencyType == CurrencyType.Influence)
496 {
497 return 1;
498 }
499 return 0;
500 }
501 }
502
503 public virtual bool AllowCriminal => owner.isThing;
504
505 public virtual int RestockDay => 5;
506
507 public virtual SlaverType SlaverType => SlaverType.None;
508
509 public virtual string LangBarter => "daBuy";
510
511 public string TextNextRestock => GetTextRestock(LangBarter, pet: false);
512
513 public string TextNextRestockPet => GetTextRestock((SlaverType == SlaverType.Slave) ? "daBuySlave" : "daBuyPet", pet: true);
514
515 public string GetParam(int i, string def = null)
516 {
517 if (i < Params.Length)
518 {
519 return Params[i];
520 }
521 return def;
522 }
523
524 public int GetParamInt(int i, int def)
525 {
526 if (i < Params.Length)
527 {
528 return Params[i].ToInt();
529 }
530 return def;
531 }
532
533 public virtual bool Contains(RecipeSource r)
534 {
535 return r.idFactory == ((owner.sourceCard.origin != null) ? owner.sourceCard.origin.id : owner.id);
536 }
537
538 public virtual int GetValue()
539 {
540 return owner.sourceCard.value;
541 }
542
543 public virtual bool CanStackTo(Thing to)
544 {
545 return CanStack;
546 }
547
548 public virtual string GetHoverText()
549 {
550 return null;
551 }
552
553 public virtual Action GetHealAction(Chara c)
554 {
555 return null;
556 }
557
558 public virtual bool CanBlend(Thing t)
559 {
560 return false;
561 }
562
563 public virtual void OnBlend(Thing t, Chara c)
564 {
565 }
566
567 public virtual int GetActDuration(Chara c)
568 {
569 return 0;
570 }
571
573 {
574 return null;
575 }
576
577 public virtual Sprite GetRefSprite()
578 {
579 return null;
580 }
581
582 public virtual void OnRenderExtra(RenderParam p)
583 {
584 }
585
586 public virtual Emo2 GetHeldEmo(Chara c)
587 {
588 return Emo2.none;
589 }
590
591 public virtual void SetOwner(Card _owner)
592 {
593 owner = _owner;
594 OnSetOwner();
595 }
596
597 public virtual bool IdleUse(Chara c, int dist)
598 {
599 return false;
600 }
601
602 public virtual void OnSetOwner()
603 {
604 }
605
606 public virtual void OnImportMap()
607 {
608 }
609
610 public virtual void SetParams(params string[] s)
611 {
612 }
613
614 public virtual void OnCrafted(Recipe recipe)
615 {
616 }
617
618 public virtual void OnCreate(int lv)
619 {
620 }
621
622 public virtual void OnEquip(Chara c, bool onSetOwner)
623 {
624 }
625
626 public virtual void OnUnequip(Chara c)
627 {
628 }
629
630 public virtual void OnChangePlaceState(PlaceState state)
631 {
632 }
633
634 public virtual void OnAddedToZone()
635 {
636 }
637
638 public virtual void OnRemovedFromZone()
639 {
640 }
641
642 public virtual void OnSimulateHour(VirtualDate date)
643 {
644 }
645
646 public virtual string GetName()
647 {
648 return owner.sourceCard.GetText();
649 }
650
651 public virtual void SetName(ref string s)
652 {
653 }
654
655 public virtual void OnRenderTile(Point point, HitResult result, int dir)
656 {
657 if (radius == 0)
658 {
659 return;
660 }
661 Vector3 vector = point.Position();
662 vector.z += EClass.setting.render.thingZ;
663 foreach (Point item in ListPoints(point))
664 {
665 Vector3 vector2 = item.Position();
666 EClass.screen.guide.passGuideFloor.Add(vector2.x, vector2.y, vector2.z, 10f, 0.3f);
667 }
668 }
669
670 public virtual int CompareTo(Card b)
671 {
672 return 0;
673 }
674
675 public virtual bool CanBuiltAt(Point p)
676 {
677 return true;
678 }
679
680 public virtual void Update()
681 {
682 }
683
685 {
686 return owner.pos;
687 }
688
689 public Point GetRandomPoint(Func<Point, bool> func = null, Chara accessChara = null)
690 {
691 if (radius == 0)
692 {
693 return owner.pos;
694 }
695 List<Point> list = ListPoints();
696 for (int i = 0; i < 50; i++)
697 {
698 Point point = list.RandomItem();
699 if (point.IsValid && (func == null || func(point)) && (accessChara == null || accessChara.HasAccess(point)))
700 {
701 return point;
702 }
703 }
704 return list[0];
705 }
706
707 public virtual List<Point> ListPoints(Point center = null, bool onlyPassable = true)
708 {
709 listRadiusPoints.Clear();
710 if (center == null)
711 {
712 center = owner.pos;
713 }
714 if (radius == 0)
715 {
716 listRadiusPoints.Add(center.Copy());
717 return listRadiusPoints;
718 }
719 Room room = center.cell.room;
720 if (room != null && CanUseRoomRadius)
721 {
722 foreach (Point point in room.points)
723 {
724 if (radiusType == TraitRadiusType.Farm)
725 {
726 listRadiusPoints.Add(point.Copy());
727 }
728 else if ((!onlyPassable || !point.cell.blocked) && !point.cell.HasBlock && point.cell.HasFloor)
729 {
730 listRadiusPoints.Add(point.Copy());
731 }
732 }
733 }
734 else
735 {
736 EClass._map.ForeachSphere(center.x, center.z, radius + 1, delegate(Point p)
737 {
738 if (radiusType == TraitRadiusType.Farm)
739 {
740 if (!p.cell.HasBlock || p.cell.HasFence)
741 {
742 listRadiusPoints.Add(p.Copy());
743 }
744 }
745 else if ((!onlyPassable || !p.cell.blocked) && !p.cell.HasBlock && p.cell.HasFloor && (!onlyPassable || Los.IsVisible(center, p)))
746 {
747 listRadiusPoints.Add(p.Copy());
748 }
749 });
750 }
751 if (listRadiusPoints.Count == 0)
752 {
753 listRadiusPoints.Add(center.Copy());
754 }
755 return listRadiusPoints;
756 }
757
758 public virtual Recipe GetRecipe()
759 {
760 return Recipe.Create(owner.Thing);
761 }
762
763 public virtual Recipe GetBuildModeRecipe()
764 {
765 return Recipe.Create(owner.Thing);
766 }
767
768 public virtual bool CanCook(Card c)
769 {
770 if (c == null || !ExistsOnMap || !(c.trait is TraitFood))
771 {
772 return false;
773 }
774 return true;
775 }
776
777 public void CookProgress()
778 {
779 if (!ExistsOnMap)
780 {
781 return;
782 }
783 foreach (Card item in owner.pos.ListCards())
784 {
785 owner.PlaySound("cook");
786 item.renderer.PlayAnime(AnimeID.Jump);
787 }
788 }
789
790 public virtual bool CanOffer(Card tg)
791 {
792 if (tg == null || tg.isChara || tg.trait.CanOnlyCarry)
793 {
794 return false;
795 }
796 if (tg.rarity == Rarity.Artifact)
797 {
798 return false;
799 }
800 return true;
801 }
802
803 public void OfferProcess(Chara cc)
804 {
805 if (!ExistsOnMap)
806 {
807 return;
808 }
809 SourceReligion.Row row = EClass.sources.religions.map.TryGetValue(owner.c_idDeity, EClass.sources.religions.map["eyth"]);
810 string @ref = row.GetTextArray("name2")[1];
811 string ref2 = row.GetTextArray("name2")[0];
812 if (EClass.rnd(3) == 0)
813 {
814 cc.Talk("offer", @ref, ref2);
815 }
816 foreach (Card item in owner.pos.ListCards())
817 {
818 if (CanOffer(item))
819 {
820 item.renderer.PlayAnime(AnimeID.Shiver);
821 }
822 }
823 }
824
825 public void Offer(Chara cc)
826 {
827 if (!ExistsOnMap)
828 {
829 return;
830 }
831 foreach (Card item in owner.pos.ListCards())
832 {
833 if (CanOffer(item))
834 {
835 item.Destroy();
836 cc.depression.Mod(100);
837 owner.PlaySound("offering");
838 }
839 }
840 }
841
842 public virtual bool TryProgress(AIProgress p)
843 {
844 return true;
845 }
846
847 public virtual LockOpenState TryOpenLock(Chara cc, bool msgFail = true)
848 {
849 Thing thing = cc.things.FindBest<TraitLockpick>((Thing t) => -t.c_charges);
850 int num = ((thing == null) ? (cc.Evalue(280) / 2 + 2) : (cc.Evalue(280) + 10));
851 int num2 = owner.c_lockLv;
852 bool flag = this is TraitChestPractice;
853 if (flag)
854 {
855 num2 = num / 4 * 3 - 1;
856 }
857 if (num <= num2 && cc.IsPC)
858 {
859 cc.PlaySound("lock");
860 cc.Say("openLockFail2");
861 owner.PlayAnime(AnimeID.Shiver);
862 return LockOpenState.NotEnoughSkill;
863 }
864 if (thing != null && !flag)
865 {
866 thing.ModCharge(-1, destroy: true);
867 }
868 if (EClass.rnd(num + 6) > num2 + 5 || (!cc.IsPC && EClass.rnd(20) == 0) || EClass.rnd(200) == 0)
869 {
870 cc.PlaySound("lock_open");
871 cc.Say("lockpick_success", cc, owner);
872 int num3 = 100 + num2 * 10;
873 if (owner.c_lockedHard)
874 {
875 num3 *= 10;
876 }
877 cc.ModExp(280, num3);
878 owner.c_lockLv = 0;
879 if (owner.c_lockedHard)
880 {
881 owner.c_lockedHard = false;
882 owner.c_priceAdd = 0;
883 }
884 if (cc.IsPC && owner.isLostProperty)
885 {
887 }
888 owner.isLostProperty = false;
889 return LockOpenState.Success;
890 }
891 cc.PlaySound("lock");
892 if (cc.IsPC)
893 {
894 cc.Say("openLockFail");
895 }
896 cc.ModExp(280, (thing != null) ? 50 : 30);
897 if ((thing == null) | (EClass.rnd(2) == 0))
898 {
899 cc.stamina.Mod(-1);
900 }
901 return LockOpenState.Fail;
902 }
903
904 public virtual void WriteNote(UINote n, bool identified)
905 {
906 }
907
909 {
910 _ = 7;
911 return owner.sourceCard._index;
912 }
913
914 public virtual HotItem GetHotItem()
915 {
916 return new HotItemHeld(owner as Thing);
917 }
918
919 public virtual bool CanRead(Chara c)
920 {
921 return false;
922 }
923
924 public virtual void OnRead(Chara c)
925 {
926 }
927
928 public virtual bool CanEat(Chara c)
929 {
930 return owner.HasElement(10);
931 }
932
933 public virtual void OnEat(Chara c)
934 {
935 }
936
937 public virtual bool CanDrink(Chara c)
938 {
939 return false;
940 }
941
942 public virtual void OnDrink(Chara c)
943 {
944 }
945
946 public virtual void OnThrowGround(Chara c, Point p)
947 {
948 }
949
950 public virtual bool CanUse(Chara c)
951 {
952 return false;
953 }
954
955 public virtual bool CanUse(Chara c, Card tg)
956 {
957 return false;
958 }
959
960 public virtual bool CanUse(Chara c, Point p)
961 {
962 return false;
963 }
964
965 public virtual bool OnUse(Chara c)
966 {
967 if (c.held != owner)
968 {
969 c.TryHoldCard(owner);
970 }
971 return true;
972 }
973
974 public virtual bool OnUse(Chara c, Card tg)
975 {
976 return true;
977 }
978
979 public virtual bool OnUse(Chara c, Point p)
980 {
981 return true;
982 }
983
984 public virtual void TrySetAct(ActPlan p)
985 {
986 if (CanUse(owner.Chara))
987 {
988 p.TrySetAct(LangUse, () => OnUse(p.cc), owner);
989 }
990 }
991
992 public virtual void TrySetHeldAct(ActPlan p)
993 {
994 }
995
996 public virtual void OnHeld()
997 {
998 }
999
1000 public virtual void OnTickHeld()
1001 {
1002 }
1003
1004 public virtual void OnSetCurrentItem()
1005 {
1006 }
1007
1008 public virtual void OnUnsetCurrentItem()
1009 {
1010 }
1011
1012 public virtual bool OnChildDecay(Card c, bool firstDecay)
1013 {
1014 return true;
1015 }
1016
1017 public virtual bool CanChildDecay(Card c)
1018 {
1019 return false;
1020 }
1021
1022 public virtual void OnSetCardGrid(ButtonGrid b)
1023 {
1024 }
1025
1026 public virtual void OnStepped(Chara c)
1027 {
1028 }
1029
1030 public virtual void OnSteppedOut(Chara c)
1031 {
1032 }
1033
1034 public virtual void OnOpenDoor(Chara c)
1035 {
1036 }
1037
1038 public void Install(bool byPlayer)
1039 {
1040 if (Electricity != 0)
1041 {
1042 EClass._zone.dirtyElectricity = true;
1043 if (Electricity > 0)
1044 {
1045 EClass._zone.electricity += Electricity;
1046 EClass.pc.PlaySound("electricity_on");
1047 }
1048 }
1049 TryToggle();
1050 owner.RecalculateFOV();
1051 if (EClass._zone.isStarted && ToggleType == ToggleType.Fire && owner.isOn)
1052 {
1053 owner.PlaySound("fire");
1054 }
1055 OnInstall(byPlayer);
1056 }
1057
1058 public void Uninstall()
1059 {
1060 if (Electricity != 0)
1061 {
1062 if (owner.isOn)
1063 {
1064 Toggle(on: false, silent: true);
1065 }
1066 EClass._zone.dirtyElectricity = true;
1067 if (Electricity > 0)
1068 {
1069 EClass._zone.electricity -= Electricity;
1070 EClass.pc.PlaySound("electricity_off");
1071 }
1072 }
1073 OnUninstall();
1074 }
1075
1076 public virtual void OnInstall(bool byPlayer)
1077 {
1078 }
1079
1080 public virtual void OnUninstall()
1081 {
1082 }
1083
1084 public virtual void TryToggle()
1085 {
1086 if (!owner.IsInstalled)
1087 {
1088 return;
1089 }
1090 if (Electricity < 0 && owner.isOn && EClass._zone.electricity < 0)
1091 {
1092 Toggle(on: false, silent: true);
1093 }
1094 else if (AutoToggle)
1095 {
1096 int hour = EClass.world.date.hour;
1097 bool on = !IsNightOnlyLight || hour >= 17 || hour <= 5 || EClass._map.IsIndoor;
1099 {
1100 on = false;
1101 }
1102 Toggle(on, silent: true);
1103 }
1104 }
1105
1106 public virtual void Toggle(bool on, bool silent = false)
1107 {
1108 if (owner.isOn == on)
1109 {
1110 return;
1111 }
1112 if (Electricity < 0)
1113 {
1114 if (on)
1115 {
1116 if (EClass._zone.electricity + Electricity < 0)
1117 {
1119 {
1120 if (!silent)
1121 {
1122 owner.Say("notEnoughElectricity", owner);
1123 }
1124 owner.PlaySound("electricity_insufficient");
1125 }
1126 return;
1127 }
1128 EClass._zone.electricity += Electricity;
1129 }
1130 else
1131 {
1132 EClass._zone.electricity -= Electricity;
1133 }
1134 }
1135 owner.isOn = on;
1136 PlayToggleEffect(silent);
1137 OnToggle();
1138 }
1139
1140 public virtual void PlayToggleEffect(bool silent)
1141 {
1142 bool flag = ToggleType == ToggleType.Fire;
1143 bool isOn = owner.isOn;
1144 switch (ToggleType)
1145 {
1146 case ToggleType.Lever:
1147 if (!silent)
1148 {
1149 owner.Say("lever", EClass.pc, owner);
1150 owner.PlaySound("switch_lever");
1151 }
1152 return;
1153 case ToggleType.Curtain:
1154 if (!silent)
1155 {
1156 owner.Say(isOn ? "close" : "open", EClass.pc, owner);
1157 owner.PlaySound("Material/leather_drop");
1158 }
1159 owner.pos.RefreshNeighborTiles();
1161 return;
1162 case ToggleType.None:
1163 return;
1164 }
1165 if (isOn)
1166 {
1167 if (!silent)
1168 {
1169 owner.Say(flag ? "toggle_fire" : "toggle_ele", EClass.pc, owner);
1170 string id = ((Electricity < 0) ? "switch_on_electricity" : (flag ? "torch_lit" : "switch_on"));
1171 if (this is TraitMusicBox)
1172 {
1173 id = "switch_on_musicbox";
1174 }
1175 owner.PlaySound(id);
1176 }
1177 RefreshRenderer();
1178 owner.RecalculateFOV();
1179 return;
1180 }
1181 if (!silent)
1182 {
1183 string id2 = ((Electricity < 0) ? "switch_off_electricity" : (flag ? "torch_unlit" : "switch_off"));
1184 if (this is TraitMusicBox)
1185 {
1186 id2 = "switch_off_musicbox";
1187 }
1188 owner.PlaySound(id2);
1189 }
1190 RefreshRenderer();
1191 owner.RecalculateFOV();
1192 }
1193
1194 public virtual void OnToggle()
1195 {
1196 }
1197
1198 public virtual void TrySetToggleAct(ActPlan p)
1199 {
1200 if (!p.IsSelfOrNeighbor)
1201 {
1202 return;
1203 }
1204 switch (ToggleType)
1205 {
1206 case ToggleType.Lever:
1207 p.TrySetAct("ActToggleLever", delegate
1208 {
1209 Toggle(!owner.isOn);
1210 return true;
1211 }, owner);
1212 break;
1213 case ToggleType.Curtain:
1214 p.TrySetAct(owner.isOn ? "actOpen" : "actClose", delegate
1215 {
1216 Toggle(!owner.isOn);
1217 return true;
1218 }, owner);
1219 break;
1220 case ToggleType.Fire:
1221 case ToggleType.Light:
1222 case ToggleType.Electronics:
1223 {
1224 bool flag = ToggleType == ToggleType.Fire;
1225 if (EClass._zone.IsPCFaction || p.altAction || this is TraitCrafter || Electricity < 0)
1226 {
1227 if (owner.isOn)
1228 {
1229 if (p.altAction)
1230 {
1231 p.TrySetAct(flag ? "ActExtinguishTorch" : "ActToggleOff", delegate
1232 {
1233 Toggle(on: false);
1234 return true;
1235 }, owner);
1236 }
1237 }
1238 else if (!(this is TraitFactory) && !(this is TraitIncubator) && (!IsRequireFuel || owner.c_charges > 0))
1239 {
1240 p.TrySetAct(flag ? "ActTorch" : "ActToggleOn", delegate
1241 {
1242 Toggle(on: true);
1243 return true;
1244 }, owner);
1245 }
1246 if (IsRequireFuel && ((p.altAction && owner.c_charges < MaxFuel) || (!owner.isOn && owner.c_charges == 0)) && ShowFuelWindow)
1247 {
1248 p.TrySetAct("ActFuel", delegate
1249 {
1251 return false;
1252 }, owner);
1253 }
1254 }
1255 if (p.altAction)
1256 {
1257 p.TrySetAct("disableAutoToggle".lang((owner.disableAutoToggle ? "off" : "on").lang()), delegate
1258 {
1259 owner.disableAutoToggle = !owner.disableAutoToggle;
1260 SE.Click();
1261 return true;
1262 }, owner);
1263 }
1264 break;
1265 }
1266 }
1267 }
1268
1269 public bool IsFuelEnough(int num = 1, List<Thing> excludes = null, bool tryRefuel = true)
1270 {
1271 if (!IsRequireFuel)
1272 {
1273 return true;
1274 }
1275 if (owner.c_charges >= FuelCost * num)
1276 {
1277 return true;
1278 }
1279 if (owner.autoRefuel)
1280 {
1281 TryRefuel(FuelCost * num - owner.c_charges, excludes);
1282 }
1283 return owner.c_charges >= FuelCost * num;
1284 }
1285
1286 public bool IsFuel(string s)
1287 {
1288 return GetFuelValue(s) > 0;
1289 }
1290
1291 public bool IsFuel(Thing t)
1292 {
1293 return GetFuelValue(t) > 0;
1294 }
1295
1296 public int GetFuelValue(Thing t)
1297 {
1298 if (t.c_isImportant)
1299 {
1300 return 0;
1301 }
1302 return GetFuelValue(t.id);
1303 }
1304
1305 public int GetFuelValue(string id)
1306 {
1307 if (ToggleType == ToggleType.Electronics)
1308 {
1309 if (id == "battery")
1310 {
1311 return 20;
1312 }
1313 }
1314 else
1315 {
1316 if (id == "log")
1317 {
1318 return 20;
1319 }
1320 if (id == "branch")
1321 {
1322 return 5;
1323 }
1324 }
1325 return 0;
1326 }
1327
1328 public void Refuel(Thing t)
1329 {
1330 t.PlaySoundDrop(spatial: false);
1331 owner.ModCharge(t.Num * GetFuelValue(t));
1332 Msg.Say("fueled", t);
1333 if (!owner.isOn)
1334 {
1335 owner.trait.Toggle(on: true);
1336 }
1337 t.Destroy();
1338 owner.renderer.PlayAnime(AnimeID.Shiver);
1339 }
1340
1341 public void TryRefuel(int dest, List<Thing> excludes)
1342 {
1343 if (FindFuel(refuel: false))
1344 {
1345 FindFuel(refuel: true);
1346 }
1347 bool FindFuel(bool refuel)
1348 {
1349 int num = dest;
1350 List<Thing> list = EClass._zone.TryListThingsInSpot<TraitSpotFuel>((Thing t) => IsFuel(t));
1351 EClass.pc.things.Foreach(delegate(Thing t)
1352 {
1353 if (IsFuel(t) && t.qualityTier == 0 && (excludes == null || !excludes.Contains(t)))
1354 {
1355 list.Add(t);
1356 }
1357 });
1358 foreach (Thing item in list)
1359 {
1360 if (num > 0)
1361 {
1362 int num2 = Mathf.Min(item.Num, Mathf.CeilToInt((float)num / (float)GetFuelValue(item)));
1363 num -= GetFuelValue(item) * num2;
1364 if (refuel)
1365 {
1366 Refuel(item.Split(num2));
1367 }
1368 }
1369 }
1370 return num <= 0;
1371 }
1372 }
1373
1374 public virtual void OnEnterScreen()
1375 {
1376 RefreshRenderer();
1377 }
1378
1379 public virtual void RefreshRenderer()
1380 {
1381 if (owner.renderer.isSynced && !IdToggleExtra.IsEmpty())
1382 {
1383 if (owner.isOn)
1384 {
1385 owner.renderer.AddExtra(IdToggleExtra);
1386 }
1387 else
1388 {
1389 owner.renderer.RemoveExtra(IdToggleExtra);
1390 }
1391 }
1392 }
1393
1394 public virtual void SetMainText(UIText t, bool hotitem)
1395 {
1396 if (owner.isThing && !owner.Thing.source.attackType.IsEmpty() && owner.ammoData != null)
1397 {
1398 t.SetText(owner.c_ammo.ToString() ?? "", FontColor.Charge);
1399 t.SetActive(enable: true);
1400 }
1401 else if (owner.Num == 1 && ShowCharges && owner.IsIdentified)
1402 {
1403 t.SetText(owner.c_charges.ToString() ?? "", FontColor.Charge);
1404 t.SetActive(enable: true);
1405 }
1406 else
1407 {
1408 t.SetText(owner.Num.ToShortNumber(), FontColor.ButtonGrid);
1409 t.SetActive(owner.Num > 1);
1410 }
1411 }
1412
1413 public virtual bool CanCopy(Thing t)
1414 {
1415 return false;
1416 }
1417
1418 public string GetTextRestock(string lang, bool pet)
1419 {
1420 int rawDeadLine = 0;
1421 if (pet)
1422 {
1423 SlaverData obj = owner.GetObj<SlaverData>(5);
1424 if (obj != null)
1425 {
1426 rawDeadLine = obj.dateRefresh;
1427 }
1428 }
1429 else
1430 {
1431 rawDeadLine = owner.c_dateStockExpire;
1432 }
1433 int remainingHours = EClass.world.date.GetRemainingHours(rawDeadLine);
1434 if (remainingHours > 0)
1435 {
1436 return "nextRestock".lang(lang.lang(), Date.GetText(remainingHours) ?? "");
1437 }
1438 return lang.lang();
1439 }
1440
1442 {
1443 if (SlaverType != 0)
1444 {
1445 SlaverData obj = owner.GetObj<SlaverData>(5);
1446 if (obj != null && EClass.world.date.IsExpired(obj.dateRefresh))
1447 {
1448 return Emo2.restock;
1449 }
1450 }
1451 int c_dateStockExpire = owner.c_dateStockExpire;
1452 if (c_dateStockExpire != 0 && EClass.world.date.IsExpired(c_dateStockExpire))
1453 {
1454 if (ShopType == ShopType.None)
1455 {
1456 return Emo2.blessing;
1457 }
1458 return Emo2.restock;
1459 }
1460 return Emo2.none;
1461 }
1462
1463 public void OnBarter()
1464 {
1465 Thing t = owner.things.Find("chest_merchant");
1466 if (t == null)
1467 {
1468 t = ThingGen.Create("chest_merchant");
1469 owner.AddThing(t);
1470 }
1471 t.c_lockLv = 0;
1473 {
1474 return;
1475 }
1476 owner.c_dateStockExpire = EClass.world.date.GetRaw(24 * RestockDay);
1477 owner.isRestocking = true;
1478 t.things.DestroyAll((Thing _t) => _t.GetInt(101) != 0);
1479 foreach (Thing thing7 in t.things)
1480 {
1481 thing7.invX = -1;
1482 }
1483 switch (ShopType)
1484 {
1485 case ShopType.Plat:
1486 NoRestock(ThingGen.Create("lucky_coin").SetNum(10));
1487 break;
1488 case ShopType.Copy:
1489 {
1490 Thing c_copyContainer = owner.c_copyContainer;
1491 if (c_copyContainer == null)
1492 {
1493 break;
1494 }
1495 int num3 = 0;
1496 foreach (Thing thing8 in c_copyContainer.things)
1497 {
1498 if (!owner.trait.CanCopy(thing8))
1499 {
1500 continue;
1501 }
1502 Thing thing4 = thing8.Duplicate(1);
1503 thing4.isStolen = false;
1504 thing4.isCopy = true;
1505 thing4.c_priceFix = 0;
1506 foreach (Element item in thing4.elements.dict.Values.Where((Element e) => e.HasTag("noInherit")).ToList())
1507 {
1508 thing4.elements.Remove(item.id);
1509 }
1510 int num4 = 1;
1511 switch (owner.trait.CopyShop)
1512 {
1513 case CopyShopType.Item:
1514 {
1515 num4 = (1000 + owner.c_invest * 100) / (thing4.GetPrice() + 50);
1516 int[] array = new int[4] { 701, 704, 703, 702 };
1517 foreach (int ele in array)
1518 {
1519 if (thing4.HasElement(ele))
1520 {
1521 num4 = 1;
1522 }
1523 }
1524 break;
1525 }
1526 case CopyShopType.Spellbook:
1527 thing4.c_charges = thing8.c_charges;
1528 break;
1529 }
1530 if (num4 > 1 && thing4.trait.CanStack)
1531 {
1532 thing4.SetNum(num4);
1533 }
1534 AddThing(thing4);
1535 num3++;
1536 if (num3 > owner.trait.NumCopyItem)
1537 {
1538 break;
1539 }
1540 }
1541 break;
1542 }
1543 case ShopType.Specific:
1544 {
1545 string id2 = owner.id;
1546 if (!(id2 == "mogu"))
1547 {
1548 if (!(id2 == "felmera"))
1549 {
1550 break;
1551 }
1552 foreach (Thing item2 in new DramaOutcome().ListFelmeraBarter())
1553 {
1554 AddThing(item2);
1555 }
1556 }
1557 else
1558 {
1559 AddThing(ThingGen.Create("casino_coin").SetNum(5000));
1560 }
1561 break;
1562 }
1563 case ShopType.Deed:
1564 Add("deed", 1, 0);
1565 Add("deed_move", 2 + EClass.rnd(5), 0);
1566 Add("license_illumination", 1, 0);
1567 Add("license_void", 1, 0);
1568 Add("license_adv", 1, 0);
1569 break;
1570 case ShopType.RedBook:
1571 {
1572 for (int l = 0; l < 30; l++)
1573 {
1574 AddThing(ThingGen.CreateFromCategory("book"));
1575 }
1576 break;
1577 }
1578 case ShopType.Seed:
1579 {
1580 AddThing(TraitSeed.MakeSeed("rice")).SetNum(4 + EClass.rnd(4));
1581 AddThing(TraitSeed.MakeSeed("cabbage")).SetNum(4 + EClass.rnd(4));
1582 AddThing(TraitSeed.MakeSeed("carrot")).SetNum(4 + EClass.rnd(4));
1583 AddThing(TraitSeed.MakeSeed("potato")).SetNum(4 + EClass.rnd(4));
1584 AddThing(TraitSeed.MakeSeed("corn")).SetNum(4 + EClass.rnd(4));
1585 for (int n = 0; n < EClass.rnd(3) + 1; n++)
1586 {
1587 Add("462", 1, 0);
1588 }
1589 for (int num5 = 0; num5 < EClass.rnd(3) + 1; num5++)
1590 {
1591 Add("1167", 1, 0);
1592 }
1593 break;
1594 }
1595 case ShopType.Loytel:
1596 Add("board_map", 1, 0);
1597 Add("board_build", 1, 0);
1598 Add("book_resident", 1, 0);
1599 Add("3", 1, 0);
1600 Add("4", 1, 0);
1601 Add("5", 1, 0);
1602 AddThing(ThingGen.CreatePlan(2512));
1603 AddThing(ThingGen.CreatePlan(2810));
1604 NoRestock(ThingGen.Create("rp_block").SetLv(1).SetNum(10));
1605 if (EClass.game.quests.GetPhase<QuestVernis>() >= 3)
1606 {
1607 NoRestock(ThingGen.CreateRecipe("explosive"));
1608 }
1609 break;
1610 case ShopType.Starter:
1611 case ShopType.StarterEx:
1612 Add("board_home", 1, 0);
1613 Add("board_resident", 1, 0);
1614 Add("1", 1, 0);
1615 Add("2", 1, 0);
1616 if (ShopType == ShopType.StarterEx)
1617 {
1618 Add("board_expedition", 1, 0);
1619 Add("mailpost", 1, 0);
1620 Add("record", 1, 0);
1621 Add("tent2", 1, 0);
1622 Add("tent1", 1, 0);
1623 Add("wagon1", 1, 0);
1624 Add("wagon_big", 1, 0);
1625 Add("wagon_big2", 1, 0);
1626 Add("wagon_big3", 1, 0);
1627 Add("wagon_big4", 1, 0);
1628 Add("wagon_big5", 1, 0);
1629 Add("teleporter", 1, 0);
1630 Add("teleporter2", 1, 0);
1631 Add("recharger", 1, 0);
1632 Add("machine_gene2", 1, 0);
1633 NoRestock(ThingGen.CreateRecipe("torch_wall"));
1634 NoRestock(ThingGen.CreateRecipe("factory_sign"));
1635 NoRestock(ThingGen.CreateRecipe("beehive"));
1636 NoRestock(ThingGen.Create("rp_food").SetNum(5).SetLv(10)
1637 .Thing);
1638 }
1639 else
1640 {
1641 AddThing(ThingGen.CreatePlan(2119));
1642 NoRestock(ThingGen.Create("rp_food").SetNum(5).SetLv(5)
1643 .Thing);
1644 }
1645 break;
1646 case ShopType.Farris:
1647 AddThing(ThingGen.CreateScroll(8220, 4 + EClass.rnd(6)));
1648 AddThing(ThingGen.CreateScroll(8221, 4 + EClass.rnd(6)));
1649 Add("drawing_paper", 10, 0);
1650 Add("drawing_paper2", 10, 0);
1651 Add("stethoscope", 1, 0);
1652 Add("whip_love", 1, 0);
1653 Add("whip_interest", 1, 0);
1654 break;
1655 case ShopType.Guild:
1656 if (this is TraitClerk_Merchant)
1657 {
1658 Add("flyer", 1, 0).SetNum(99);
1659 }
1660 break;
1661 case ShopType.Influence:
1662 {
1663 bool num2 = owner.id == "big_sister";
1664 TraitTicketFurniture.SetZone(num2 ? EClass.game.spatials.Find("little_garden") : EClass._zone, Add("ticket_furniture", 1, 0).SetNum(99));
1665 if (num2)
1666 {
1667 Add("littleball", 10, 0);
1668 break;
1669 }
1670 for (int k = 0; k < 10; k++)
1671 {
1672 Thing thing3 = ThingGen.Create(EClass._zone.IsFestival ? "1123" : ((EClass.rnd(3) == 0) ? "1169" : "1160"));
1673 thing3.DyeRandom();
1674 AddThing(thing3);
1675 }
1676 break;
1677 }
1678 case ShopType.Casino:
1679 {
1680 Add("chest_tax", 1, 0);
1681 Add("1165", 1, 0);
1682 Add("monsterball", 1, 0).SetNum(3).SetLv(10);
1683 Add("1175", 1, 0);
1684 Add("1176", 1, 0);
1685 Add("pillow_ehekatl", 1, 0);
1686 Add("grave_dagger1", 1, 0);
1687 Add("grave_dagger2", 1, 0);
1688 Add("434", 1, 0);
1689 Add("433", 1, 0);
1690 Add("714", 1, 0);
1691 Add("1017", 1, 0);
1692 Add("1155", 1, 0);
1693 Add("1011", 1, 0);
1694 AddThing(ThingGen.CreatePerfume(9500, 5));
1695 AddThing(ThingGen.CreatePerfume(9501, 5));
1696 AddThing(ThingGen.CreatePerfume(9502, 5));
1697 AddThing(ThingGen.CreatePerfume(9503, 5));
1698 for (int j = 0; j < 5; j++)
1699 {
1700 Thing thing2 = ThingGen.CreateFromCategory("seasoning").SetNum(10);
1701 thing2.elements.SetBase(2, 40);
1702 thing2.c_priceFix = 1000;
1703 AddThing(thing2);
1704 }
1705 break;
1706 }
1707 case ShopType.Medal:
1708 NoRestock(ThingGen.Create("sword_dragon"));
1709 Add("sword_dragon", 1, 0).SetReplica(on: true);
1710 NoRestock(ThingGen.Create("axe_destruction"));
1711 Add("axe_destruction", 1, 0).SetReplica(on: true);
1712 NoRestock(ThingGen.Create("blunt_bonehammer"));
1713 Add("blunt_bonehammer", 1, 0).SetReplica(on: true);
1714 NoRestock(ThingGen.Create("pole_gunlance"));
1715 Add("pole_gunlance", 1, 0).SetReplica(on: true);
1716 NoRestock(ThingGen.Create("sword_muramasa"));
1717 Add("sword_muramasa", 1, 0).SetReplica(on: true);
1718 NoRestock(ThingGen.Create("sword_forgetmenot"));
1719 Add("sword_forgetmenot", 1, 0).SetReplica(on: true);
1720 NoRestock(ThingGen.Create("dagger_fish"));
1721 Add("dagger_fish", 1, 0).SetReplica(on: true);
1722 NoRestock(ThingGen.Create("sword_zephir"));
1723 Add("sword_zephir", 1, 0).SetReplica(on: true);
1724 Add("ribbon", 1, 0);
1725 Add("helm_sage", 1, 0);
1726 Add("diary_sister", 1, 0);
1727 Add("diary_catsister", 1, 0);
1728 Add("diary_lady", 1, 0);
1729 Add("1165", 1, 0).SetNum(5);
1730 AddThing(ThingGen.CreateScroll(9160).SetNum(5));
1731 Add("monsterball", 1, 0).SetNum(3).SetLv(20);
1732 Add("monsterball", 1, 0).SetNum(3).SetLv(40);
1733 Add("bill_tax", 1, 0).c_bill = 1;
1734 Add("bill_tax", 1, 0).c_bill = 1;
1735 Add("bill_tax", 1, 0).c_bill = 1;
1736 Add("container_magic", 1, 0);
1737 Add("container_magic", 1, 0).ChangeMaterial("iron").idSkin = 1;
1738 Add("container_magic", 1, 0).ChangeMaterial("bamboo").idSkin = 2;
1739 Add("wrench_tent_elec", 1, 0);
1740 Add("wrench_tent_soil", 1, 0);
1741 Add("wrench_bed", 1, 0).SetNum(20);
1742 Add("wrench_storage", 1, 0).SetNum(10);
1743 Add("wrench_fridge", 1, 0).SetNum(1);
1744 Add("wrench_extend_v", 1, 0).SetNum(2);
1745 Add("wrench_extend_h", 1, 0).SetNum(2);
1746 break;
1747 default:
1748 {
1749 float num = (float)(3 + Mathf.Min(ShopLv / 5, 10)) + Mathf.Sqrt(ShopLv);
1750 num = num * (float)(100 + EClass.pc.Evalue(1406) * 5) / 100f;
1751 num = Mathf.Min(num, 300f);
1752 for (int i = 0; (float)i < num; i++)
1753 {
1754 Thing thing = CreateStock();
1755 if ((!(thing.trait is TraitRod) || thing.c_charges != 0) && thing.GetPrice() > 0)
1756 {
1757 t.AddThing(thing);
1758 }
1759 }
1760 break;
1761 }
1762 }
1763 foreach (RecipeSource item3 in RecipeManager.list)
1764 {
1765 if (item3.row.recipeKey.IsEmpty())
1766 {
1767 continue;
1768 }
1769 string[] recipeKey = item3.row.recipeKey;
1770 for (int m = 0; m < recipeKey.Length; m++)
1771 {
1772 if (recipeKey[m] == ShopType.ToString())
1773 {
1774 NoRestock(ThingGen.CreateRecipe(item3.id));
1775 break;
1776 }
1777 }
1778 }
1779 switch (ShopType)
1780 {
1781 case ShopType.StrangeGirl:
1782 {
1783 int num8 = (EClass.debug.enable ? 20 : (EClass._zone.development / 10));
1784 if (num8 > 0)
1785 {
1786 Add("syringe_gene", num8, 0);
1787 }
1788 if (num8 > 10)
1789 {
1790 Add("syringe_heaven", num8 / 5, 0);
1791 }
1792 break;
1793 }
1794 case ShopType.GeneralExotic:
1795 Add("tool_talisman", 1, 0);
1796 break;
1797 case ShopType.Healer:
1798 AddThing(ThingGen.CreatePotion(8400).SetNum(4 + EClass.rnd(6)));
1799 AddThing(ThingGen.CreatePotion(8401).SetNum(2 + EClass.rnd(4)));
1800 AddThing(ThingGen.CreatePotion(8402).SetNum(1 + EClass.rnd(3)));
1801 break;
1802 case ShopType.Food:
1803 Add("ration", 2 + EClass.rnd(4), 0);
1804 break;
1805 case ShopType.Ecopo:
1806 Add("ecomark", 5, 0);
1807 Add("1165", 1, 0);
1808 AddThing(ThingGen.CreateScroll(9160).SetNum(5));
1809 break;
1810 case ShopType.Gun:
1811 Add("bullet", 1, 0).SetNum(300 + EClass.rnd(100)).ChangeMaterial("iron");
1812 Add("bullet_energy", 1, 0).SetNum(100 + EClass.rnd(100)).ChangeMaterial("iron");
1813 break;
1814 case ShopType.Magic:
1815 if ((EClass._zone.id == "lumiest" && EClass._zone.lv == 0) || (EClass._zone.id != "lumiest" && EClass.rnd(4) == 0))
1816 {
1817 t.AddThing(ThingGen.Create("letter_trial"));
1818 }
1819 break;
1820 case ShopType.Festival:
1822 {
1823 Add("1085", 1, 0);
1824 if (EClass._zone.id == "noyel")
1825 {
1826 Add("holyFeather", 1, 0);
1827 }
1828 }
1829 break;
1830 case ShopType.Junk:
1831 case ShopType.LoytelMart:
1832 {
1833 if (ShopType == ShopType.LoytelMart)
1834 {
1835 Add("ticket_massage", 1, 0);
1836 Add("ticket_armpillow", 1, 0);
1837 Add("ticket_champagne", 1, 0);
1838 }
1839 for (int num6 = 0; num6 < (EClass.debug.enable ? 30 : 3); num6++)
1840 {
1841 if (EClass.rnd(5) == 0)
1842 {
1843 TreasureType treasureType = ((EClass.rnd(10) == 0) ? TreasureType.BossNefia : ((EClass.rnd(10) == 0) ? TreasureType.Map : TreasureType.RandomChest));
1844 int num7 = EClass.rnd(EClass.rnd(ShopLv + (EClass.debug.enable ? 200 : 50)) + 1) + 1;
1845 Thing thing5 = ThingGen.Create(treasureType switch
1846 {
1847 TreasureType.Map => "chest_treasure",
1848 TreasureType.BossNefia => "chest_boss",
1849 _ => "chest3",
1850 });
1851 thing5.c_lockedHard = true;
1852 thing5.c_lockLv = num7;
1853 thing5.c_priceAdd = 2000 + num7 * 250 * ((treasureType == TreasureType.RandomChest) ? 1 : 5);
1854 thing5.c_revealLock = true;
1855 ThingGen.CreateTreasureContent(thing5, num7, treasureType, clearContent: true);
1856 AddThing(thing5);
1857 }
1858 }
1859 break;
1860 }
1861 }
1862 ShopType shopType = ShopType;
1863 if (shopType == ShopType.General || shopType == ShopType.Food)
1864 {
1865 for (int num9 = 0; num9 < (EClass.debug.enable ? 3 : 3); num9++)
1866 {
1867 if (EClass.rnd(3) == 0)
1868 {
1869 int lv = EClass.rnd(EClass.rnd(ShopLv + (EClass.debug.enable ? 200 : 50)) + 1) + 1;
1870 Thing t2 = ThingGen.Create("chest_gamble", -1, lv).SetNum(1 + EClass.rnd(20));
1871 AddThing(t2);
1872 }
1873 }
1874 }
1875 switch (owner.id)
1876 {
1877 case "rodwyn":
1878 AddThing(ThingGen.CreateSpellbook(8790));
1879 AddThing(ThingGen.CreatePotion(8791).SetNum(3 + EClass.rnd(3)));
1880 break;
1881 case "girl_blue":
1882 Add("779", 1 + EClass.rnd(3), 0);
1883 break;
1884 case "nola":
1885 AddThing(ThingGen.CreateRecipe("ic").SetPriceFix(400));
1886 AddThing(ThingGen.CreateRecipe("bullet").SetPriceFix(300));
1887 AddThing(ThingGen.CreateRecipe("break_powder").SetPriceFix(1000));
1888 AddThing(ThingGen.CreateRecipe("quarrel").SetPriceFix(100));
1889 AddThing(ThingGen.CreateRecipe("1099").SetPriceFix(400));
1890 AddThing(ThingGen.CreateRecipe("detector").SetPriceFix(700));
1891 AddThing(ThingGen.CreatePlan(2710)).SetPriceFix(-100);
1892 AddThing(ThingGen.CreatePlan(2711)).SetPriceFix(-100);
1893 AddThing(ThingGen.CreatePlan(2712)).SetPriceFix(200);
1894 break;
1895 }
1897 {
1898 Add("lockpick", 1, 0);
1899 if (EClass.rnd(2) == 0)
1900 {
1901 Add("lockpick", 1, 0);
1902 }
1903 AddThing(ThingGen.CreateScroll(8780, EClass.rndHalf(5)));
1904 }
1905 foreach (Thing thing9 in t.things)
1906 {
1907 thing9.c_idBacker = 0;
1908 if (ShopType != ShopType.Copy)
1909 {
1910 thing9.TryMakeRandomItem(ShopLv);
1911 if (thing9.Num == 1)
1912 {
1913 thing9.SetNum(thing9.trait.DefaultStock);
1914 }
1915 if (thing9.trait is TraitFoodMeal)
1916 {
1917 CraftUtil.MakeDish(thing9, ShopLv, owner.Chara);
1918 }
1919 if (thing9.IsFood && owner.id == "rodwyn")
1920 {
1921 SourceElement.Row row = EClass.sources.elements.rows.Where((SourceElement.Row e) => !e.foodEffect.IsEmpty() && e.category != "feat" && e.chance > 0).RandomItem();
1922 thing9.elements.SetBase(row.id, 10 + EClass.rnd(10));
1923 }
1924 }
1925 if (CurrencyType == CurrencyType.Casino_coin)
1926 {
1927 thing9.noSell = true;
1928 }
1930 {
1931 thing9.isStolen = true;
1932 }
1933 if (!(thing9.trait is TraitErohon))
1934 {
1935 thing9.c_IDTState = 0;
1936 }
1937 if (CurrencyType == CurrencyType.Money && (thing9.category.IsChildOf("meal") || thing9.category.IsChildOf("preserved")) && thing9.id != "ration")
1938 {
1939 thing9.c_priceFix = -70;
1940 }
1941 if (thing9.trait is TraitErohon)
1942 {
1943 thing9.c_IDTState = 5;
1944 }
1945 if (thing9.IsContainer && !thing9.c_revealLock)
1946 {
1947 thing9.RemoveThings();
1948 t.c_lockLv = 0;
1949 }
1950 }
1951 if (t.things.Count <= t.things.GridSize)
1952 {
1953 return;
1954 }
1955 int num10 = t.things.width * 10;
1956 if (t.things.Count > num10)
1957 {
1958 int num11 = t.things.Count - num10;
1959 for (int num12 = 0; num12 < num11; num12++)
1960 {
1961 t.things.LastItem().Destroy();
1962 }
1963 }
1964 t.things.ChangeSize(t.things.width, Mathf.Min(t.things.Count / t.things.width + 1, 10));
1965 Thing Add(string id, int a, int idSkin)
1966 {
1968 Thing thing6 = ThingGen.Create(id, -1, ShopLv).SetNum(a);
1969 thing6.idSkin = idSkin;
1970 return t.AddThing(thing6);
1971 }
1972 Thing AddThing(Thing _t)
1973 {
1974 return t.AddThing(_t);
1975 }
1976 void NoRestock(Thing _t)
1977 {
1978 HashSet<string> hashSet = EClass.player.noRestocks.TryGetValue(owner.id);
1979 if (hashSet == null)
1980 {
1981 hashSet = new HashSet<string>();
1982 }
1983 if (!hashSet.Contains(_t.trait.IdNoRestock))
1984 {
1985 hashSet.Add(_t.trait.IdNoRestock);
1986 EClass.player.noRestocks[owner.id] = hashSet;
1987 _t.SetInt(101, 1);
1988 AddThing(_t);
1989 }
1990 }
1991 }
1992
1994 {
1995 switch (ShopType)
1996 {
1997 case ShopType.Dye:
1998 {
1999 Thing thing4 = ThingGen.Create("dye").SetNum(15 + EClass.rnd(30));
2000 thing4.ChangeMaterial(EClass.sources.materials.rows.RandomItem().alias);
2001 return thing4;
2002 }
2003 case ShopType.GeneralExotic:
2004 return FromFilter("shop_generalExotic");
2005 case ShopType.VMachine:
2006 if (EClass.rnd(10) == 0)
2007 {
2008 return Create("panty");
2009 }
2010 if (EClass.rnd(5) == 0)
2011 {
2012 return Create("234");
2013 }
2014 return FromFilter("shop_drink");
2015 case ShopType.Furniture:
2016 return FromFilter("shop_furniture");
2017 case ShopType.Book:
2018 return FromFilter("shop_book");
2019 case ShopType.Magic:
2020 return FromFilter("shop_magic");
2021 case ShopType.Ecopo:
2022 {
2023 Thing thing = TraitSeed.MakeRandomSeed(enc: true);
2024 TraitSeed.LevelSeed(thing, (thing.trait as TraitSeed).row, 1);
2025 return thing;
2026 }
2027 case ShopType.Healer:
2028 {
2029 Thing thing2 = null;
2030 for (int i = 0; i < 1000; i++)
2031 {
2032 thing2 = FromFilter("shop_healer");
2033 if (thing2.trait is TraitScroll { source: not null } traitScroll)
2034 {
2035 if (!(traitScroll.source.aliasParent != "WIL") && !(traitScroll.source.categorySub == "attack"))
2036 {
2037 break;
2038 }
2039 }
2040 else if (thing2.trait is TraitPotionRandom { source: not null } traitPotionRandom)
2041 {
2042 if (!(traitPotionRandom.source.aliasParent != "WIL") && !(traitPotionRandom.source.categorySub == "attack"))
2043 {
2044 thing2.SetNum(EClass.rnd(5) + 1);
2045 break;
2046 }
2047 }
2048 else if (thing2.trait is TraitRodRandom { source: not null } traitRodRandom && !(traitRodRandom.source.aliasParent != "WIL") && !(traitRodRandom.source.categorySub == "attack"))
2049 {
2050 break;
2051 }
2052 }
2053 return thing2;
2054 }
2055 case ShopType.Milk:
2056 if (EClass._zone is Zone_Nefu && EClass.rnd(2) == 0)
2057 {
2058 Thing thing3 = ThingGen.Create("milk");
2059 thing3.MakeRefFrom(EClass.sources.charas.rows.Where((SourceChara.Row r) => r.race == "mifu" || r.race == "nefu").RandomItem().model);
2060 Debug.Log(thing3);
2061 return thing3;
2062 }
2063 return Create("milk");
2064 case ShopType.Map:
2065 return ThingGen.CreateMap();
2066 case ShopType.Plan:
2067 return Create("book_plan");
2068 case ShopType.Weapon:
2069 return FromFilter("shop_weapon");
2070 case ShopType.Gun:
2071 if (EClass.rnd(8) == 0)
2072 {
2073 return Create("mod_ranged");
2074 }
2075 return FromFilter("shop_gun");
2076 case ShopType.Blackmarket:
2077 case ShopType.Exotic:
2078 {
2079 int num = 30;
2081 {
2082 num = 25;
2083 }
2085 {
2086 num = 15;
2087 }
2088 if (EClass.debug.enable)
2089 {
2090 num = 1;
2091 }
2092 CardBlueprint.SetRarity((EClass.rnd(num * 5) == 0) ? Rarity.Mythical : ((EClass.rnd(num) == 0) ? Rarity.Legendary : ((EClass.rnd(5) == 0) ? Rarity.Superior : Rarity.Normal)));
2093 return FromFilter("shop_blackmarket");
2094 }
2095 case ShopType.Drink:
2096 return FromFilter("shop_drink");
2097 case ShopType.Booze:
2098 return FromFilter("shop_booze");
2099 case ShopType.Fruit:
2100 return FromFilter("shop_fruit");
2101 case ShopType.Fish:
2102 if (EClass.rnd(2) == 0)
2103 {
2104 return Create("bait");
2105 }
2106 if (EClass.rnd(3) == 0)
2107 {
2108 return Create("fishingRod");
2109 }
2110 return FromFilter("shop_fish");
2111 case ShopType.Meat:
2112 if (EClass.rnd(5) == 0)
2113 {
2114 return Create("seasoning");
2115 }
2116 return FromFilter("shop_meat");
2117 case ShopType.Bread:
2118 if (EClass.rnd(3) == 0)
2119 {
2120 return Create("dough");
2121 }
2122 return FromFilter("shop_bread");
2123 case ShopType.Sweet:
2124 if (EClass.rnd(3) == 0)
2125 {
2126 return Create("dough");
2127 }
2128 return FromFilter("shop_sweet");
2129 case ShopType.Food:
2130 if (EClass.rnd(5) == 0)
2131 {
2132 return Create("seasoning");
2133 }
2134 return FromFilter("shop_food");
2135 case ShopType.Drug:
2136 return FromFilter("shop_drug");
2137 case ShopType.LoytelMart:
2139 {
2140 if (EClass.rnd(10) == 0)
2141 {
2142 return Create("monsterball").SetLv(40 + EClass.rnd(ShopLv)).Thing;
2143 }
2144 if (EClass.rnd(30) == 0)
2145 {
2146 return ThingGen.Create("rp_random", -1, ShopLv + 10);
2147 }
2148 if (EClass.rnd(100) == 0)
2149 {
2150 return ThingGen.Create("map_treasure", -1, EClass.rndHalf(ShopLv));
2151 }
2152 if (EClass.rnd(40) == 0)
2153 {
2154 return Create("water").SetPriceFix(1000);
2155 }
2156 if (EClass.rnd(EClass.debug.enable ? 20 : 1000) == 0)
2157 {
2158 return Create("1165");
2159 }
2160 }
2161 return FromFilter("shop_junk");
2162 case ShopType.Junk:
2163 return FromFilter("shop_junk");
2164 case ShopType.Souvenir:
2165 return FromFilter("shop_souvenir");
2166 case ShopType.StrangeGirl:
2167 return DNA.GenerateGene(SpawnList.Get("chara").Select(ShopLv + 10), DNA.Type.Brain);
2168 case ShopType.Fireworks:
2169 if (EClass.rnd(3) == 0)
2170 {
2171 return Create("firework_launcher");
2172 }
2173 return Create("firework");
2174 case ShopType.Festival:
2175 if (EClass.rnd(3) == 0)
2176 {
2177 if (IsFestival("olvina"))
2178 {
2179 return Create(new string[4] { "1125", "1126", "pillow_truth", "1230" }.RandomItem());
2180 }
2181 if (IsFestival("yowyn"))
2182 {
2183 return Create(new string[3] { "hat_mushroom", "hat_witch", "hat_kumiromi" }.RandomItem());
2184 }
2185 if (IsFestival("noyel"))
2186 {
2187 return Create(new string[9] { "1127", "1128", "xmas_sled", "xmas_bigbag", "xmas_bigbox", "xmas_blackcat", "xmas_blackcat", "xmas_jure", "xmas_crown" }.RandomItem());
2188 }
2189 }
2190 if (EClass.rnd(2) == 0)
2191 {
2192 return Create(new string[4] { "1081", "1082", "1083", "1084" }.RandomItem());
2193 }
2194 if (EClass.rnd(3) == 0)
2195 {
2196 return FromFilter("shop_junk");
2197 }
2198 return FromFilter("shop_souvenir");
2199 case ShopType.Lamp:
2200 if (EClass.rnd(3) != 0)
2201 {
2202 if (IsFestival("kapul"))
2203 {
2204 return Create(new string[6] { "999", "1000", "1001", "1002", "1003", "1004" }.RandomItem());
2205 }
2206 if (IsFestival("yowyn"))
2207 {
2208 return Create(new string[2] { "1072", "1073" }.RandomItem());
2209 }
2210 if (IsFestival("noyel"))
2211 {
2212 return Create(new string[1] { "1069" }.RandomItem());
2213 }
2214 if (IsFestival("olvina"))
2215 {
2216 return Create(new string[2] { "1070", "1071" }.RandomItem());
2217 }
2218 }
2219 if (EClass._zone.IsFestival && EClass.rnd(2) == 0)
2220 {
2221 return Create(new string[4] { "953", "954", "955", "956" }.RandomItem());
2222 }
2223 return FromFilter("shop_lamp");
2224 default:
2225 if (EClass.rnd(100) == 0)
2226 {
2227 return Create("lockpick");
2228 }
2229 return FromFilter("shop_general");
2230 }
2231 Thing Create(string s)
2232 {
2233 return ThingGen.Create(s, -1, ShopLv);
2234 }
2235 Thing FromFilter(string s)
2236 {
2237 return ThingGen.CreateFromFilter(s, ShopLv);
2238 }
2239 static bool IsFestival(string id)
2240 {
2241 if (EClass._zone.id == id)
2242 {
2243 return EClass._zone.IsFestival;
2244 }
2245 return false;
2246 }
2247 }
2248 }
AnimeID
Definition: AnimeID.cs:2
CTAG
Definition: CTAG.cs:2
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
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:155
Chara cc
Definition: ActPlan.cs:201
bool IsSelfOrNeighbor
Definition: ActPlan.cs:175
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:344
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
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
virtual bool isThing
Definition: Card.cs:1957
bool IsImportant
Definition: Card.cs:1981
void MakeRefFrom(string id)
Definition: Card.cs:5094
virtual Chara Chara
Definition: Card.cs:1946
ElementContainerCard elements
Definition: Card.cs:37
int c_ammo
Definition: Card.cs:1385
string id
Definition: Card.cs:31
bool isNPCProperty
Definition: Card.cs:526
bool IsUnique
Definition: Card.cs:1967
bool HasElement(int ele, int req=1)
Definition: Card.cs:5214
bool isRoofItem
Definition: Card.cs:550
bool c_lockedHard
Definition: Card.cs:996
bool isLostProperty
Definition: Card.cs:778
SourceMaterial.Row material
Definition: Card.cs:1927
SoundSource PlaySound(string id, float v=1f, bool spatial=true)
Definition: Card.cs:5404
string c_idDeity
Definition: Card.cs:1481
int c_invest
Definition: Card.cs:1229
Card ChangeMaterial(int idNew, bool ignoreFixedMaterial=false)
Definition: Card.cs:2838
virtual int GetPrice(CurrencyType currency=CurrencyType.Money, bool sell=false, PriceType priceType=PriceType.Default, Chara c=null)
Definition: Card.cs:6449
Thing ammoData
Definition: Card.cs:1685
int c_lockLv
Definition: Card.cs:924
Thing AddThing(string id, int lv=-1)
Definition: Card.cs:2901
void Talk(string idTopic, string ref1=null, string ref2=null, bool forceSync=false)
Definition: Card.cs:5949
Card SetLv(int a)
Definition: Card.cs:2735
Rarity rarity
Definition: Card.cs:298
bool ExistsOnMap
Definition: Card.cs:1961
bool c_revealLock
Definition: Card.cs:1008
Thing SetNum(int a)
Definition: Card.cs:3242
bool autoRefuel
Definition: Card.cs:598
bool IsFood
Definition: Card.cs:2051
TileType TileType
Definition: Card.cs:2011
virtual SourcePref Pref
Definition: Card.cs:1983
void RecalculateFOV()
Definition: Card.cs:5616
bool HasTag(CTAG tag)
Definition: Card.cs:2455
Point pos
Definition: Card.cs:55
void DyeRandom()
Definition: Card.cs:5262
void Dye(string idMat)
Definition: Card.cs:5267
Trait trait
Definition: Card.cs:49
bool disableAutoToggle
Definition: Card.cs:574
int c_dateStockExpire
Definition: Card.cs:1169
void ModCharge(int a, bool destroy=false)
Definition: Card.cs:3627
void Destroy()
Definition: Card.cs:4538
bool c_isImportant
Definition: Card.cs:984
ThingContainer things
Definition: Card.cs:34
bool IsInstalled
Definition: Card.cs:2241
virtual bool IsPC
Definition: Card.cs:2019
bool IsMeleeWeapon
Definition: Card.cs:2101
string NameSimple
Definition: Card.cs:2015
virtual bool isChara
Definition: Card.cs:1959
virtual Thing Thing
Definition: Card.cs:1934
int Evalue(int ele)
Definition: Card.cs:2431
int idSkin
Definition: Card.cs:346
Thing TryMakeRandomItem(int lv=-1)
Definition: Card.cs:4861
bool isOn
Definition: Card.cs:514
Thing SetPriceFix(int a)
Definition: Card.cs:6360
Cell Cell
Definition: Card.cs:1931
Thing Duplicate(int num)
Definition: Card.cs:3191
void PlaySoundDrop(bool spatial=true)
Definition: Card.cs:5389
Thing c_copyContainer
Definition: Card.cs:1709
virtual CardRow sourceCard
Definition: Card.cs:2007
void ModExp(string alias, int a)
Definition: Card.cs:2508
int Num
Definition: Card.cs:154
void PlayAnime(AnimeID id, bool force=false)
Definition: Card.cs:5423
SourceCategory.Row category
Definition: Card.cs:1925
bool IsIdentified
Definition: Card.cs:2237
bool IsContainer
Definition: Card.cs:1965
int c_charges
Definition: Card.cs:1205
string c_editorTraitVal
Definition: Card.cs:1613
CardRenderer renderer
Definition: Card.cs:57
void Say(string lang, string ref1=null, string ref2=null)
Definition: Card.cs:6046
void RemoveThings()
Definition: Card.cs:3056
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:67
override bool IsPC
Definition: Chara.cs:597
bool TryHoldCard(Card t, int num=-1, bool pickHeld=false)
Definition: Chara.cs:4062
Stats stamina
Definition: Chara.cs:955
bool enable
Definition: CoreDebug.cs:285
static void MakeDish(Thing food, int lv, Chara crafter=null)
Definition: CraftUtil.cs:54
Definition: DNA.cs:8
Type
Definition: DNA.cs:10
static Thing GenerateGene(Chara c, Type? type=null)
Definition: DNA.cs:104
Definition: Date.cs:4
int hour
Definition: Date.cs:74
int GetRaw(int offsetHours=0)
Definition: Date.cs:322
bool IsExpired(int time)
Definition: Date.cs:332
string GetText(TextFormat format)
Definition: Date.cs:245
int GetRemainingHours(int rawDeadLine)
Definition: Date.cs:337
Definition: EClass.cs:5
static Game game
Definition: EClass.cs:8
static int rnd(int a)
Definition: EClass.cs:50
static Zone _zone
Definition: EClass.cs:20
static World world
Definition: EClass.cs:40
static Map _map
Definition: EClass.cs:18
static SourceManager sources
Definition: EClass.cs:42
static BaseGameScreen screen
Definition: EClass.cs:32
static int rndHalf(int a)
Definition: EClass.cs:74
static Player player
Definition: EClass.cs:12
static Chara pc
Definition: EClass.cs:14
static CoreDebug debug
Definition: EClass.cs:48
static GameSetting setting
Definition: EClass.cs:34
Element SetBase(string alias, int v, int potential=0)
void Remove(int id)
bool HasTag(string tag)
Definition: ELEMENT.cs:463
int Evalue(int ele)
RenderSetting render
Definition: GameSetting.cs:301
SpatialManager spatials
Definition: Game.cs:152
QuestManager quests
Definition: Game.cs:179
override bool IsCurrentZone
Definition: GuildMerchant.cs:5
override bool IsCurrentZone
Definition: GuildThief.cs:6
Definition: Guild.cs:2
static GuildMerchant Merchant
Definition: Guild.cs:29
static GuildThief Thief
Definition: Guild.cs:27
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
bool IsIndoor
Definition: Map.cs:131
void ForeachSphere(int _x, int _z, float r, Action< Point > action)
Definition: Map.cs:2358
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:522
Flags flags
Definition: Player.cs:895
void ModKarma(int a)
Definition: Player.cs:2289
Dictionary< string, HashSet< string > > noRestocks
Definition: Player.cs:928
Definition: Point.cs:9
ref Vector3 Position(int height)
Definition: Point.cs:524
List< Card > ListCards(bool includeMasked=false)
Definition: Point.cs:1015
Point Copy()
Definition: Point.cs:467
bool IsValid
Definition: Point.cs:88
void RefreshNeighborTiles()
Definition: Point.cs:1240
Cell cell
Definition: Point.cs:51
static List< RecipeSource > list
Definition: RecipeManager.cs:9
RenderRow row
Definition: RecipeSource.cs:5
Definition: Recipe.cs:7
static Recipe Create(RecipeSource _source, int idMat=-1, Thing ing=null)
Definition: Recipe.cs:308
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:553
SourceMaterial materials
SourceElement elements
SourceChara charas
SourceReligion religions
bool Surface
Definition: SourcePref.cs:314
Zone Find(string id)
int lv
Definition: Spatial.cs:142
int electricity
Definition: Spatial.cs:250
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
void DestroyAll(Func< Thing, bool > funcExclude=null)
Thing Find(int uid)
void Foreach(Action< Thing > action, bool onlyAccessible=true)
static Thing CreatePotion(int ele, int num=1)
Definition: ThingGen.cs:170
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:177
static void CreateTreasureContent(Thing t, int lv, TreasureType type, bool clearContent)
Definition: ThingGen.cs:210
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 CreateFromCategory(string idCat, int lv=-1)
Definition: ThingGen.cs:75
static Thing CreateScroll(int ele, int num=1)
Definition: ThingGen.cs:163
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:153
virtual bool IsBlockPass
Definition: TileType.cs:149
static Thing MakeSeed(SourceObj.Row obj, PlantData plant=null)
Definition: TraitSeed.cs:77
static Thing MakeRandomSeed(bool enc=false)
Definition: TraitSeed.cs:176
static void LevelSeed(Thing t, SourceObj.Row obj, int num)
Definition: TraitSeed.cs:129
static void SetZone(Zone zone, Thing t)
Definition: Trait.cs:7
virtual string LangBarter
Definition: Trait.cs:509
virtual void OnImportMap()
Definition: Trait.cs:606
virtual bool IsBlendBase
Definition: Trait.cs:253
virtual bool RequireFullStackCheck
Definition: Trait.cs:189
virtual bool OnUse(Chara c, Card tg)
Definition: Trait.cs:974
virtual bool CanExtendBuild
Definition: Trait.cs:161
bool IsFuel(string s)
Definition: Trait.cs:1286
virtual bool IsFactory
Definition: Trait.cs:135
virtual bool IsRestSpot
Definition: Trait.cs:249
virtual TileMode tileMode
Definition: Trait.cs:423
void OfferProcess(Chara cc)
Definition: Trait.cs:803
virtual bool IsBlockPath
Definition: Trait.cs:52
virtual bool CanBeMasked
Definition: Trait.cs:251
virtual bool IsBlockSight
Definition: Trait.cs:54
virtual bool HoldAsDefaultInteraction
Definition: Trait.cs:125
virtual int radius
Definition: Trait.cs:88
virtual int GetActDuration(Chara c)
Definition: Trait.cs:567
virtual bool CanBeAttacked
Definition: Trait.cs:159
virtual void Update()
Definition: Trait.cs:680
virtual bool CanBeHallucinated
Definition: Trait.cs:287
virtual string IDActorEx
Definition: Trait.cs:167
virtual void SetMainText(UIText t, bool hotitem)
Definition: Trait.cs:1394
virtual bool CanUse(Chara c)
Definition: Trait.cs:950
virtual bool ShouldRefreshTile
Definition: Trait.cs:71
virtual string GetName()
Definition: Trait.cs:646
virtual bool ShowChildrenNumber
Definition: Trait.cs:321
virtual List< Point > ListPoints(Point center=null, bool onlyPassable=true)
Definition: Trait.cs:707
virtual CopyShopType CopyShop
Definition: Trait.cs:469
virtual void OnChangePlaceState(PlaceState state)
Definition: Trait.cs:630
string IdToggleExtra
Definition: Trait.cs:453
virtual Recipe GetRecipe()
Definition: Trait.cs:758
void OnBarter()
Definition: Trait.cs:1463
virtual bool IsOpenPath
Definition: Trait.cs:60
virtual bool ShowAsTool
Definition: Trait.cs:323
virtual void OnSetCardGrid(ButtonGrid b)
Definition: Trait.cs:1022
virtual string IDInvStyle
Definition: Trait.cs:165
virtual HotItem GetHotItem()
Definition: Trait.cs:914
virtual bool CanHarvest
Definition: Trait.cs:86
virtual float DropChance
Definition: Trait.cs:347
int GetSortVal(UIList.SortMode m)
Definition: Trait.cs:908
virtual bool Contains(RecipeSource r)
Definition: Trait.cs:533
virtual void OnEquip(Chara c, bool onSetOwner)
Definition: Trait.cs:622
virtual void OnHeld()
Definition: Trait.cs:996
virtual void OnTickHeld()
Definition: Trait.cs:1000
virtual void WriteNote(UINote n, bool identified)
Definition: Trait.cs:904
int GetParamInt(int i, int def)
Definition: Trait.cs:524
virtual void OnSteppedOut(Chara c)
Definition: Trait.cs:1030
virtual bool TryProgress(AIProgress p)
Definition: Trait.cs:842
virtual bool CanBeDisassembled
Definition: Trait.cs:294
virtual void OnRead(Chara c)
Definition: Trait.cs:924
virtual bool UseAltTiles
Definition: Trait.cs:425
virtual bool IgnoreLastStackHeight
Definition: Trait.cs:113
virtual bool IsTool
Definition: Trait.cs:355
virtual void TryToggle()
Definition: Trait.cs:1084
Point GetRandomPoint(Func< Point, bool > func=null, Chara accessChara=null)
Definition: Trait.cs:689
virtual void OnInstall(bool byPlayer)
Definition: Trait.cs:1076
virtual bool CanChangeHeight
Definition: Trait.cs:143
virtual bool ShowOrbit
Definition: Trait.cs:129
virtual void TrySetAct(ActPlan p)
Definition: Trait.cs:984
virtual bool IsAltar
Definition: Trait.cs:247
virtual bool CanSearchContent
Definition: Trait.cs:210
virtual int GetValue()
Definition: Trait.cs:538
virtual int FuelCost
Definition: Trait.cs:447
virtual bool CanChildDecay(Card c)
Definition: Trait.cs:1017
virtual void TrySetHeldAct(ActPlan p)
Definition: Trait.cs:992
virtual void OnThrowGround(Chara c, Point p)
Definition: Trait.cs:946
virtual bool RenderExtra
Definition: Trait.cs:345
Thing CreateStock()
Definition: Trait.cs:1993
virtual bool CanStackTo(Thing to)
Definition: Trait.cs:543
virtual string ReqHarvest
Definition: Trait.cs:291
virtual bool CanBeDestroyed
Definition: Trait.cs:285
bool IsToggle
Definition: Trait.cs:373
virtual bool CanRead(Chara c)
Definition: Trait.cs:919
virtual int RestockDay
Definition: Trait.cs:505
virtual string langNote
Definition: Trait.cs:163
virtual bool AlwaysHideOnLowWall
Definition: Trait.cs:341
virtual bool CanCook(Card c)
Definition: Trait.cs:768
virtual string IdNoRestock
Definition: Trait.cs:349
virtual int CraftNum
Definition: Trait.cs:127
virtual bool CanBuildInTown
Definition: Trait.cs:258
virtual void SetOwner(Card _owner)
Definition: Trait.cs:591
virtual bool AllowSell
Definition: Trait.cs:480
virtual bool OnChildDecay(Card c, bool firstDecay)
Definition: Trait.cs:1012
virtual void OnCrafted(Recipe recipe)
Definition: Trait.cs:614
virtual bool UseLowblock
Definition: Trait.cs:427
virtual bool HasCharges
Definition: Trait.cs:317
virtual void OnRenderTile(Point point, HitResult result, int dir)
Definition: Trait.cs:655
string GetTextRestock(string lang, bool pet)
Definition: Trait.cs:1418
virtual void OnOpenDoor(Chara c)
Definition: Trait.cs:1034
virtual bool NoHeldDir
Definition: Trait.cs:339
virtual LockOpenState TryOpenLock(Chara cc, bool msgFail=true)
Definition: Trait.cs:847
virtual bool IsLightOn
Definition: Trait.cs:400
bool IsRequireFuel
Definition: Trait.cs:451
virtual bool CanOpenContainer
Definition: Trait.cs:226
virtual int DefaultStock
Definition: Trait.cs:123
bool IsFuel(Thing t)
Definition: Trait.cs:1291
virtual void TrySetToggleAct(ActPlan p)
Definition: Trait.cs:1198
virtual bool ShowCharges
Definition: Trait.cs:319
virtual TileType tileType
Definition: Trait.cs:48
virtual bool IsFloating
Definition: Trait.cs:62
virtual void PlayToggleEffect(bool silent)
Definition: Trait.cs:1140
virtual bool CanUse(Chara c, Card tg)
Definition: Trait.cs:955
virtual bool CanUseRoomRadius
Definition: Trait.cs:92
virtual bool CanCopy(Thing t)
Definition: Trait.cs:1413
virtual bool CanBeHeld
Definition: Trait.cs:269
virtual bool UseDummyTile
Definition: Trait.cs:187
virtual void OnUnequip(Chara c)
Definition: Trait.cs:626
virtual int DecaySpeedChild
Definition: Trait.cs:119
virtual Sprite GetRefSprite()
Definition: Trait.cs:577
virtual bool IsHomeItem
Definition: Trait.cs:245
TileMode
Definition: Trait.cs:9
void Offer(Chara cc)
Definition: Trait.cs:825
virtual bool IsDoor
Definition: Trait.cs:56
virtual void OnAddedToZone()
Definition: Trait.cs:634
virtual bool CanName
Definition: Trait.cs:139
virtual void Toggle(bool on, bool silent=false)
Definition: Trait.cs:1106
string GetParam(int i, string def=null)
Definition: Trait.cs:515
virtual int IdSkin
Definition: Trait.cs:44
void Refuel(Thing t)
Definition: Trait.cs:1328
virtual void OnUnsetCurrentItem()
Definition: Trait.cs:1008
virtual void OnRenderExtra(RenderParam p)
Definition: Trait.cs:582
bool ExistsOnMap
Definition: Trait.cs:343
virtual bool IsAnimeOn
Definition: Trait.cs:362
virtual bool CanEat(Chara c)
Definition: Trait.cs:928
virtual bool CanPutAway
Definition: Trait.cs:141
CopyShopType
Definition: Trait.cs:18
virtual bool IsOpenSight
Definition: Trait.cs:58
virtual Recipe GetBuildModeRecipe()
Definition: Trait.cs:763
virtual int CostRerollShop
Definition: Trait.cs:492
virtual void OnSimulateHour(VirtualDate date)
Definition: Trait.cs:642
int GetFuelValue(Thing t)
Definition: Trait.cs:1296
virtual bool OnUse(Chara c, Point p)
Definition: Trait.cs:979
Point GetPoint()
Definition: Trait.cs:684
virtual bool IsThrowMainAction
Definition: Trait.cs:174
virtual bool HaveUpdate
Definition: Trait.cs:131
virtual bool InvertHeldSprite
Definition: Trait.cs:66
virtual bool HideInAdv
Definition: Trait.cs:337
virtual bool CanBeHeldAsFurniture
Definition: Trait.cs:326
string TextNextRestockPet
Definition: Trait.cs:513
virtual string RecipeCat
Definition: Trait.cs:353
virtual bool UseExtra
Definition: Trait.cs:429
virtual int MaxFuel
Definition: Trait.cs:436
virtual bool IsChangeFloorHeight
Definition: Trait.cs:68
virtual void OnStepped(Chara c)
Definition: Trait.cs:1026
bool IsLighting
Definition: Trait.cs:388
virtual string GetHoverText()
Definition: Trait.cs:548
string TextNextRestock
Definition: Trait.cs:511
virtual bool IsGround
Definition: Trait.cs:64
virtual void RefreshRenderer()
Definition: Trait.cs:1379
virtual bool CanUse(Chara c, Point p)
Definition: Trait.cs:960
virtual bool CanOffer(Card tg)
Definition: Trait.cs:790
virtual bool DisableAutoCombat
Definition: Trait.cs:191
virtual void OnCreate(int lv)
Definition: Trait.cs:618
virtual bool IsSpot
Definition: Trait.cs:133
virtual ? Color ColorExtra
Definition: Trait.cs:433
string[] Params
Definition: Trait.cs:31
virtual int Electricity
Definition: Trait.cs:97
virtual void OnSetCurrentItem()
Definition: Trait.cs:1004
virtual TraitRadiusType radiusType
Definition: Trait.cs:90
virtual bool CanCopyInBlueprint
Definition: Trait.cs:148
Emo2 GetRestockedIcon()
Definition: Trait.cs:1441
virtual bool OnUse(Chara c)
Definition: Trait.cs:965
int GetFuelValue(string id)
Definition: Trait.cs:1305
void TryRefuel(int dest, List< Thing > excludes)
Definition: Trait.cs:1341
virtual bool CanBeShipped
Definition: Trait.cs:306
Card owner
Definition: Trait.cs:26
virtual void OnUninstall()
Definition: Trait.cs:1080
virtual bool IsOn
Definition: Trait.cs:359
void CookProgress()
Definition: Trait.cs:777
static List< Point > listRadiusPoints
Definition: Trait.cs:28
virtual void OnSetOwner()
Definition: Trait.cs:602
virtual bool CanBuiltAt(Point p)
Definition: Trait.cs:675
virtual bool CanUseContent
Definition: Trait.cs:207
virtual bool AutoToggle
Definition: Trait.cs:376
virtual bool IsNightOnlyLight
Definition: Trait.cs:412
virtual void OnDrink(Chara c)
Definition: Trait.cs:942
virtual int GuidePriotiy
Definition: Trait.cs:94
virtual bool UseLightColor
Definition: Trait.cs:431
virtual bool MaskOnBuild
Definition: Trait.cs:169
virtual int DecaySpeed
Definition: Trait.cs:117
virtual void OnRemovedFromZone()
Definition: Trait.cs:638
virtual void OnToggle()
Definition: Trait.cs:1194
virtual bool ShouldTryRefreshRoom
Definition: Trait.cs:82
virtual int ShopLv
Definition: Trait.cs:467
virtual bool CanBlend(Thing t)
Definition: Trait.cs:558
virtual Emo2 GetHeldEmo(Chara c)
Definition: Trait.cs:586
virtual bool CanBeDropped
Definition: Trait.cs:289
virtual bool CanBeStolen
Definition: Trait.cs:272
bool IsFuelEnough(int num=1, List< Thing > excludes=null, bool tryRefuel=true)
Definition: Trait.cs:1269
virtual bool LevelAsQuality
Definition: Trait.cs:185
virtual void OnEat(Chara c)
Definition: Trait.cs:933
virtual Action GetHealAction(Chara c)
Definition: Trait.cs:553
virtual int IdleUseChance
Definition: Trait.cs:351
static TraitSelfFactory SelfFactory
Definition: Trait.cs:24
virtual bool CanStack
Definition: Trait.cs:145
virtual bool ShowContextOnPick
Definition: Trait.cs:171
virtual byte WeightMod
Definition: Trait.cs:42
virtual SourceElement.Row GetRefElement()
Definition: Trait.cs:572
virtual bool IdleUse(Chara c, int dist)
Definition: Trait.cs:597
virtual int Decay
Definition: Trait.cs:115
virtual int NumCopyItem
Definition: Trait.cs:471
virtual void OnEnterScreen()
Definition: Trait.cs:1374
virtual bool IsSpecialContainer
Definition: Trait.cs:237
void Uninstall()
Definition: Trait.cs:1058
virtual bool ShowFuelWindow
Definition: Trait.cs:449
virtual string LangUse
Definition: Trait.cs:357
virtual void SetName(ref string s)
Definition: Trait.cs:651
virtual bool CanBeOnlyBuiltInHome
Definition: Trait.cs:255
virtual bool CanAutofire
Definition: Trait.cs:137
virtual bool IsFridge
Definition: Trait.cs:121
virtual void SetParams(params string[] s)
Definition: Trait.cs:610
virtual int CompareTo(Card b)
Definition: Trait.cs:670
virtual bool IsContainer
Definition: Trait.cs:205
virtual bool CanDrink(Chara c)
Definition: Trait.cs:937
virtual int InstallBottomPriority
Definition: Trait.cs:84
virtual bool CanOnlyCarry
Definition: Trait.cs:283
void Install(bool byPlayer)
Definition: Trait.cs:1038
virtual string Name
Definition: Trait.cs:46
virtual bool AllowCriminal
Definition: Trait.cs:503
virtual void OnBlend(Thing t, Chara c)
Definition: Trait.cs:563
Definition: UIList.cs:9
SortMode
Definition: UIList.cs:27
Definition: UINote.cs:6
Definition: UIText.cs:6
void SetText(string s)
Definition: UIText.cs:159
bool IsRaining
Definition: Weather.cs:117
GameDate date
Definition: World.cs:6
Weather weather
Definition: World.cs:12
bool isStarted
Definition: Zone.cs:70
FactionBranch branch
Definition: Zone.cs:34
virtual bool IsFestival
Definition: Zone.cs:206
bool IsPCFaction
Definition: Zone.cs:464