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