Elin Decompiled Documentation EA 23.153 Nightly
Loading...
Searching...
No Matches
InvOwner.cs
Go to the documentation of this file.
1using System;
2using System.Collections.Generic;
3using UnityEngine;
4
5public class InvOwner : EClass
6{
7 public class ErrorMessage
8 {
9 public string sound = "beep_small";
10
11 public string lang = "";
12
13 public Card card;
14
15 public void Set(string _lang, Card c = null, string _sound = "beep_small")
16 {
17 lang = _lang;
18 if (c != null)
19 {
20 card = c;
21 }
22 sound = _sound;
23 }
24 }
25
26 public class ForceGiveData
27 {
28 public Card card;
29
30 public int tries;
31 }
32
33 public class Transaction
34 {
35 public static ErrorMessage error = new ErrorMessage();
36
37 public Thing thing;
38
40
41 public int num = 1;
42
44
46
48
49 public InvOwner inv;
50
52 {
53 get
54 {
55 if (to == null)
56 {
57 if (!(destUIInv != null))
58 {
59 if (!inv.owner.IsPC)
60 {
61 return Main;
62 }
63 return Trader;
64 }
65 return destUIInv.owner;
66 }
67 return to.invOwner;
68 }
69 }
70
71 public bool sell
72 {
73 get
74 {
76 {
78 {
79 return destInv.owner.IsPC;
80 }
81 return false;
82 }
83 return true;
84 }
85 }
86
87 public string IDCurrency => currency.ToString().ToLower();
88
90
91 public bool FreeTrade
92 {
93 get
94 {
95 if (HasTrader && currency != 0 && (to == null || to.invOwner.owner != EClass.pc))
96 {
97 if ((bool)destUIInv)
98 {
99 return destUIInv.owner.owner == EClass.pc;
100 }
101 return false;
102 }
103 return true;
104 }
105 }
106
108 {
109 this.from = from;
111 thing = from.thing;
112 this.num = num;
113 inv = from.invOwner;
114 this.destUIInv = destUIInv;
115 }
116
118 {
119 this.from = from;
120 this.to = to;
122 thing = from.thing;
123 this.num = num;
124 inv = from.invOwner;
125 }
126
128 {
129 this.button = button;
130 thing = button.card as Thing;
131 this.num = num;
133 }
134
135 public bool Process(bool startTransaction = false)
136 {
137 error = new ErrorMessage
138 {
139 card = this.thing
140 };
141 if (!IsValid())
142 {
143 SE.Play(error.sound);
144 if (!error.lang.IsEmpty())
145 {
147 }
148 return false;
149 }
150 if (inv.IsFailByCurse(this.thing))
151 {
152 return false;
153 }
155 {
156 int num = this.thing.Num;
157 if (from != null && !(from.invOwner is InvOwnerAlly))
158 {
159 this.thing = from.invOwner.PutBack(from);
160 }
161 else if (this.thing.parent != inv.Container)
162 {
163 this.thing = inv.Container.AddThing(this.thing);
164 }
165 if (num != this.thing.Num)
166 {
167 this.thing = this.thing.Split(num);
168 this.thing = EClass.pc.Pick(this.thing, msg: false, tryStack: false);
169 }
171 {
172 this.thing = this.thing.Split(1);
173 }
174 if (to != null)
175 {
176 to.button.SetCardGrid(this.thing, to.button.invOwner);
177 }
178 else
179 {
180 int currentIndex = LayerDragGrid.Instance.currentIndex;
181 destInv.buttons[currentIndex].SetCardGrid(this.thing, destInv.buttons[currentIndex].invOwner);
182 }
183 destInv.OnProcess(this.thing);
184 if (GetPrice() != 0)
185 {
186 SE.Play("buy");
188 }
189 return true;
190 }
191 if (!startTransaction && to == null && (destInv.owner.IsPC ? EClass.pc : destInv.Container).things.IsFull(this.thing))
192 {
193 if (destInv.owner == EClass.pc)
194 {
195 error.Set("backpack_full");
196 }
197 SE.Beep();
198 return false;
199 }
200 Thing thing = this.thing.parent as Thing;
201 if (thing != null && thing.isNPCProperty)
202 {
203 Msg.Say("steal_container", thing, this.thing);
204 this.thing.isNPCProperty = false;
207 }
208 DragItemCard dragItemCard = new DragItemCard(button, startTransaction);
209 Thing thing2 = this.thing.Split(this.num);
210 Thing thing3 = thing2;
211 bool flag = false;
212 if (FreeTrade)
213 {
214 flag = true;
215 }
216 else
217 {
218 SE.Play(sell ? "sell" : "buy");
219 int price = GetPrice();
221 {
222 Trader.homeResource.Mod(sell ? price : (-price));
223 }
224 else
225 {
226 if (sell)
227 {
229 }
230 else
231 {
233 }
234 if (sell && !thing2.IsIdentified)
235 {
236 thing2.Identify(show: true, IDTSource.SuperiorIdentify);
237 }
238 else
239 {
240 ShopTransaction.current.Process(thing2, thing2.Num, sell);
241 }
242 Msg.Say(sell ? "sold" : "bought", thing2, Lang._currency(Mathf.Abs(price), IDCurrency));
243 if (thing2.id == "statue_weird" && sell)
244 {
245 EClass.pc.Say("statue_install");
246 }
247 }
248 }
250 {
251 destInv.owner.Chara.Talk("tooHeavy");
252 return false;
253 }
255 {
256 Msg.Say("markedImportant");
257 return false;
258 }
259 if (startTransaction)
260 {
261 dragItemCard.from.thing = thing2;
262 EClass.ui.StartDrag(dragItemCard);
263 }
264 else
265 {
266 if (to != null)
267 {
268 thing2.invY = to.invY;
269 thing3 = to.container.AddThing(thing2, tryStack: true, to.invX, to.invY);
270 if (thing3 == thing2)
271 {
272 if (to.thing != null)
273 {
275 {
276 if (!EClass.core.config.game.doubleClickToHold || !EInput.leftMouse.down || !(EClass.ui.dragDuration < 0.35f) || from == null || !(from.button == to.button) || to.button.invOwner is InvOwnerHotbar)
277 {
278 EClass.ui.nextDrag = new DragItemCard(to.button);
279 to.invOwner.Grab(to);
280 flag = false;
281 }
282 }
283 else if (destInv.Container != thing2.parent)
284 {
285 thing3 = destInv.Container.AddThing(thing2);
286 }
287 }
288 to.grid[to.invX] = thing2;
289 thing2.invX = to.invX;
290 to.button.card = thing2;
291 }
292 }
293 else
294 {
295 bool useGrid = EClass.game.UseGrid;
296 if (!EClass.game.UseGrid && (bool)destUIInv)
297 {
298 RectTransform rectTransform = new GameObject().AddComponent<RectTransform>();
299 rectTransform.SetParent(destUIInv.list.transform);
300 rectTransform.SetAnchor(0f, 0f, 0f, 0f);
301 rectTransform.localScale = Vector3.one;
302 rectTransform.sizeDelta = Vector3.one;
303 rectTransform.position = Input.mousePosition;
304 from.thing.posInvX = (int)rectTransform.anchoredPosition.x;
305 from.thing.posInvY = (int)rectTransform.anchoredPosition.y;
306 }
307 thing3 = ((!destInv.owner.IsPC) ? destInv.Container.AddThing(thing2, useGrid) : EClass.pc.Pick(thing2, msg: false));
308 }
309 destInv.OnProcess(thing3);
310 }
312 {
313 thing2.SetInt(102, EClass._zone.uid);
314 }
315 else
316 {
317 thing2.SetInt(102);
318 }
320 if (chara != null && !chara.IsPC)
321 {
322 chara.TryEquip(thing2);
323 if (thing2.id == "lovepotion" || thing2.id == "dreambug")
324 {
325 EClass.pc.GiveLovePotion(chara, thing2);
326 EClass.ui.CloseLayers();
327 return true;
328 }
329 }
330 if (thing2.id == "statue_weird")
331 {
332 if (!destInv.owner.IsPC)
333 {
334 EClass.pc.Say("statue_sell");
335 }
336 else if (thing == null || thing.GetRootCard() != EClass.pc)
337 {
338 EClass.pc.Say("statue_pick");
339 }
340 }
341 if (flag)
342 {
343 SE.Drop();
344 }
345 return true;
346 }
347
348 public int GetPrice()
349 {
350 if (Trader != null)
351 {
353 }
354 return 0;
355 }
356
357 public bool IsValid()
358 {
360 {
361 return false;
362 }
364 {
365 return false;
366 }
367 if (destInv.Container.c_lockLv != 0)
368 {
369 return false;
370 }
372 {
373 return false;
374 }
376 {
377 return false;
378 }
380 {
381 return false;
382 }
384 {
385 error.Set("errorUnemptyContainer");
386 return false;
387 }
388 if (HasTrader && Trader.currency != 0)
389 {
390 int price = GetPrice();
391 if (sell)
392 {
394 {
395 return false;
396 }
398 {
399 return false;
400 }
402 {
403 if (!Trader.AllowSell)
404 {
405 return false;
406 }
407 if (!FreeTrade && price == 0)
408 {
409 return false;
410 }
411 }
412 }
413 else if (!FreeTrade)
414 {
416 {
417 if (Trader.homeResource.value < price)
418 {
419 return false;
420 }
421 }
422 else if (EClass.pc.GetCurrency(IDCurrency) < price || price < 0 || (price == 0 && Trader.GetPrice(thing, currency, 1, sell) > 0))
423 {
424 return false;
425 }
426 }
427 }
428 if (to != null)
429 {
430 if (to.invOwner.IsMagicChest && to.container.things.IsFull())
431 {
432 return false;
433 }
434 if (to.thing != null && !to.thing.isDestroyed && !destInv.AllowHold(to.thing))
435 {
436 return false;
437 }
438 }
440 {
441 error.Set("errorOverweight");
442 return false;
443 }
444 return true;
445 }
446
447 public string GetTextDetail()
448 {
450 {
451 return "";
452 }
454 }
455 }
456
457 public class Interaction
458 {
459 public string name;
460
461 public string idPriority;
462
463 public Action action;
464
465 public int priority;
466
467 public bool repeatable;
468 }
469
470 public class ListInteraction : List<Interaction>
471 {
472 public Thing thing;
473
474 public Interaction Add(string s, int priority, Action action, string idPriority = null)
475 {
476 Interaction interaction = new Interaction
477 {
478 name = s,
479 priority = priority,
480 idPriority = idPriority,
481 action = delegate
482 {
483 if (!idPriority.IsEmpty())
484 {
485 if (idPriority == "remove")
486 {
488 }
489 else
490 {
492 }
493 }
494 action();
495 }
496 };
497 Add(interaction);
498 return interaction;
499 }
500
501 public bool Contains(string s)
502 {
503 using (Enumerator enumerator = GetEnumerator())
504 {
505 while (enumerator.MoveNext())
506 {
507 if (enumerator.Current.name == s)
508 {
509 return true;
510 }
511 }
512 }
513 return false;
514 }
515 }
516
517 public static ForceGiveData forceGive = new ForceGiveData();
518
519 public static InvOwner Trader;
520
521 public static InvOwner Main;
522
523 public static float clickTimer;
524
525 public bool includeChildren;
526
528
530
532
533 public Card owner;
534
536
537 public List<ButtonGrid> buttons = new List<ButtonGrid>();
538
539 public static bool HasTrader => Trader != null;
540
541 public static bool FreeTransfer
542 {
543 get
544 {
545 if (HasTrader)
546 {
547 return Trader.currency == CurrencyType.None;
548 }
549 return true;
550 }
551 }
552
553 public virtual bool AllowAutouse => true;
554
555 public virtual bool AllowContext => true;
556
557 public virtual bool AllowSell
558 {
559 get
560 {
561 if (currency != 0)
562 {
563 return owner.trait.AllowSell;
564 }
565 return true;
566 }
567 }
568
569 public virtual bool AlwaysShowTooltip => false;
570
571 public virtual bool UseGuide => false;
572
573 public virtual bool AllowTransfer
574 {
575 get
576 {
577 if (!Container.isChara)
578 {
579 return !Container.isNPCProperty;
580 }
581 return true;
582 }
583 }
584
585 public virtual bool AllowDropOnDrag => true;
586
587 public virtual string langTransfer => "actTransfer";
588
589 public virtual int destInvY => 0;
590
591 public virtual bool HasTransaction => false;
592
593 public virtual bool CopyOnTransfer => false;
594
595 public virtual bool SingleTarget => false;
596
597 public bool UseHomeResource => homeResource != null;
598
599 public bool IsMagicChest => Container.trait is TraitMagicChest;
600
601 public List<Thing> Things
602 {
603 get
604 {
606 {
607 return Container.things;
608 }
609 return Container.things.grid;
610 }
611 }
612
613 public Chara Chara => owner as Chara;
614
616
617 public virtual bool InvertSell => false;
618
619 public virtual int numDragGrid => 1;
620
621 public virtual bool ShowNew => owner.IsPC;
622
623 public virtual bool DenyImportant => true;
624
626 {
627 get
628 {
629 if (!owner.IsPC)
630 {
631 return Main;
632 }
633 return Trader;
634 }
635 }
636
638
639 public virtual bool AllowHold(Thing t)
640 {
641 if (!t.trait.CanBeDropped)
642 {
643 return false;
644 }
645 if (t.isEquipped && t.IsCursed)
646 {
647 return false;
648 }
650 {
651 if (t.id == "money")
652 {
653 return false;
654 }
655 if (t.isGifted || t.isNPCProperty)
656 {
657 return false;
658 }
660 {
661 return false;
662 }
663 return true;
664 }
665 if (!t.trait.CanOnlyCarry)
666 {
668 {
669 return !FreeTransfer;
670 }
671 return true;
672 }
673 return false;
674 }
675
676 public virtual bool AllowMoved(Thing t)
677 {
678 return true;
679 }
680
681 public virtual bool ShouldShowGuide(Thing t)
682 {
683 return false;
684 }
685
686 public virtual bool AllowDrop(Thing t)
687 {
689 {
690 return t.trait is TraitAbility;
691 }
692 return true;
693 }
694
696 {
697 return ThingGen.Create("chest3");
698 }
699
700 public virtual void BuildUICurrency(UICurrency uiCurrency, bool canReroll = false)
701 {
702 bool flag = Container.isChara && !Container.IsPC;
703 uiCurrency.SetActive(currency != CurrencyType.None || flag);
704 uiCurrency.target = owner;
705 if (currency != CurrencyType.None || flag)
706 {
707 uiCurrency.Build(new UICurrency.Options
708 {
709 weight = flag,
710 money = (currency == CurrencyType.Money),
711 plat = (currency == CurrencyType.Plat),
712 medal = (currency == CurrencyType.Medal),
713 money2 = (currency == CurrencyType.Money2),
714 influence = (currency == CurrencyType.Influence),
715 casino = (currency == CurrencyType.Casino_coin),
716 ecopo = (currency == CurrencyType.Ecopo)
717 });
718 }
719 }
720
721 public bool IsWeightOver(Thing t)
722 {
723 return false;
724 }
725
726 public InvOwner(Card owner, Card container = null, CurrencyType _currency = CurrencyType.None, PriceType _price = PriceType.Default)
727 {
728 currency = _currency;
729 priceType = _price;
730 this.owner = owner;
731 Container = container ?? owner;
732 if (currency == CurrencyType.BranchMoney)
733 {
735 }
736 }
737
738 public void Init()
739 {
740 if (owner == null)
741 {
744 owner.c_lockLv = 0;
745 owner.c_IDTState = 0;
747 }
748 OnInit();
749 forceGive = new ForceGiveData();
750 }
751
752 public virtual void OnInit()
753 {
754 }
755
756 public virtual void OnClick(ButtonGrid button)
757 {
758 Card card = button.card;
759 Card card2 = button.invOwner.owner;
760 if (card == null || EClass.ui.currentDrag != null)
761 {
762 return;
763 }
764 bool flag = false;
765 if (card.Thing.isEquipped && card.Thing.IsEquipmentOrRanged && card.Thing.IsCursed)
766 {
767 SE.Play("curse3");
768 }
769 else if (!AllowHold(card.Thing) && card2.isChara && !card2.IsPC && card2.IsPCFaction)
770 {
771 if (forceGive.card != card)
772 {
773 forceGive.card = card;
774 forceGive.tries = 0;
775 }
776 else
777 {
778 if (!EInput.isShiftDown)
779 {
781 }
782 if (forceGive.tries >= 2)
783 {
784 if (card.HasTag(CTAG.gift) && card.isGifted)
785 {
786 EClass.ui.CloseLayers();
787 card2.Say("angry", card2);
788 card2.ShowEmo(Emo.angry);
789 card2.Talk("noGiveRing");
790 card2.Chara.ModAffinity(EClass.pc, -30);
791 card2.Chara.InstantEat(card.Thing);
792 return;
793 }
794 forceGive.card = null;
795 flag = true;
796 bool flag2 = card.trait is TraitCurrency;
797 card.isGifted = false;
798 card.isNPCProperty = false;
799 card2.Talk(flag2 ? "forceGiveCurrency" : "forceGive");
800 int num = ((!flag2) ? 1 : 3);
801 if (card.id == "money")
802 {
803 num += card.Num / 1000;
804 }
805 if (num >= 5)
806 {
807 num = 5;
808 }
809 EClass.player.ModKarma(-num);
810 EClass.pc.Pick(card.Thing);
811 return;
812 }
813 }
814 }
815 if (AllowHold(card.Thing) || flag)
816 {
817 if (EInput.isAltDown)
818 {
819 if (CanAltClick(button))
820 {
821 OnAltClick(button);
822 }
823 else
824 {
825 SE.BeepSmall();
826 }
827 }
828 else if (EInput.isCtrlDown)
829 {
830 if (CanCtrlClick(button))
831 {
832 OnCtrlClick(button);
833 }
834 else
835 {
836 SE.BeepSmall();
837 }
838 }
839 else if (EInput.isShiftDown)
840 {
841 if (CanShiftClick(button))
842 {
843 OnShiftClick(button);
844 }
845 else
846 {
847 SE.BeepSmall();
848 }
849 }
850 else if (!owner.IsPC)
851 {
852 new Transaction(button, (HasTrader && !FreeTransfer) ? 1 : card.Num).Process(startTransaction: true);
853 }
854 else if (button.card == null || !IsFailByCurse(button.card.Thing))
855 {
856 EClass.ui.StartDrag(new DragItemCard(button));
857 }
858 }
859 else
860 {
861 SE.BeepSmall();
862 if (card2.isChara && !card2.IsPC)
863 {
864 card2.Talk("noGive");
865 }
866 }
867 }
868
869 public virtual void OnRightClick(ButtonGrid button)
870 {
871 if (!AllowAutouse)
872 {
873 OnClick(button);
874 }
875 if (button.card != null)
876 {
877 AutoUse(button);
878 }
879 }
880
881 public virtual void OnRightPressed(ButtonGrid button)
882 {
884 {
885 return;
886 }
887 float num = 1f;
888 float pressedTimer = EInput.rightMouse.pressedTimer;
889 if (pressedTimer > 2f)
890 {
891 num = 2f;
892 }
893 else if (pressedTimer > 4f)
894 {
895 num = 5f;
896 }
897 else if (pressedTimer > 6f)
898 {
899 num = 50f;
900 }
901 clickTimer -= Core.delta * num;
902 if (clickTimer < 0f)
903 {
904 clickTimer = 0.1f;
905 if (button.card != null)
906 {
907 AutoUse(button, repeat: true);
908 }
909 }
910 }
911
912 public InvOwner GetShitDestOwner(ButtonGrid b, bool rightMouse = false)
913 {
914 Thing thing = b.card.Thing;
915 if (rightMouse && !b.invOwner.owner.IsPC)
916 {
917 return LayerInventory.GetPCLayer()?.Inv;
918 }
919 if (Trader != null)
920 {
921 if (b.invOwner.owner.IsPC)
922 {
923 if (!Trader.Container.things.IsFull(thing))
924 {
925 return Trader;
926 }
927 return null;
928 }
929 return LayerInventory.GetTopLayer(thing, includePlayer: true, Trader)?.Inv;
930 }
931 LayerInventory topLayer = LayerInventory.GetTopLayer(thing, includePlayer: true, this);
932 if (topLayer == null)
933 {
934 return null;
935 }
936 return topLayer.Inv;
937 }
938
939 public virtual void OnShiftClick(ButtonGrid b, bool rightMouse = false)
940 {
941 InvOwner shitDestOwner = GetShitDestOwner(b, rightMouse);
942 Thing thing = b.card.Thing;
943 if (thing == null || thing.isDestroyed)
944 {
945 return;
946 }
947 Card container = shitDestOwner.Container;
948 if (rightMouse && !owner.IsPC)
949 {
950 EClass.pc.Pick(thing, msg: false);
951 return;
952 }
953 if ((thing.parent == container || thing == container) && !thing.IsHotItem)
954 {
956 {
957 SE.BeepSmall();
958 }
959 return;
960 }
961 thing.PlaySoundDrop(spatial: false);
962 if (thing.IsHotItem && thing.parent == container)
963 {
964 container.RemoveCard(thing);
965 }
966 if (container.things.CanStack(thing) != thing)
967 {
968 container.things.TryStack(thing);
969 }
970 else
971 {
972 container.AddThing(thing);
973 }
974 }
975
976 public virtual bool CanShiftClick(ButtonGrid b, bool rightMouse = false)
977 {
978 if (!EInput.isShiftDown && !rightMouse)
979 {
980 return false;
981 }
983 {
984 return false;
985 }
986 if (rightMouse && !HasTrader)
987 {
988 return false;
989 }
990 if (HasTrader)
991 {
993 {
994 return false;
995 }
997 {
998 return false;
999 }
1000 Card card = b.card;
1001 if (card != null && card.c_isImportant)
1002 {
1003 return false;
1004 }
1005 }
1006 InvOwner shitDestOwner = GetShitDestOwner(b, rightMouse);
1007 if (shitDestOwner == null)
1008 {
1009 return false;
1010 }
1011 Thing thing = b.card.Thing;
1012 if (thing.trait.IsContainer && thing.things.Count > 0)
1013 {
1014 return false;
1015 }
1016 if (!AllowHold(thing))
1017 {
1018 return false;
1019 }
1020 if (HasTrader)
1021 {
1023 {
1024 return false;
1025 }
1026 if (!Trader.AllowMoved(thing))
1027 {
1028 return false;
1029 }
1030 }
1031 if (shitDestOwner.Container.isChara && !shitDestOwner.owner.IsPC && !shitDestOwner.owner.Chara.CanAcceptItem(thing))
1032 {
1033 return false;
1034 }
1035 if (EInput.isShiftDown)
1036 {
1037 LayerInventory.highlightInv = shitDestOwner;
1038 }
1039 return true;
1040 }
1041
1042 public virtual string GetTextShiftClick(ButtonGrid b)
1043 {
1044 return "actTransfer".lang();
1045 }
1046
1047 public virtual void OnCtrlClick(ButtonGrid button)
1048 {
1049 button.card.Thing.ShowSplitMenu(button, HasTransaction ? new Transaction(button) : null);
1050 }
1051
1052 public virtual bool CanCtrlClick(ButtonGrid b)
1053 {
1054 if (!EInput.isCtrlDown)
1055 {
1056 return false;
1057 }
1058 if (!EClass.pc.HasNoGoal || Container.isNPCProperty || b.card.Num <= 1)
1059 {
1060 return false;
1061 }
1062 return true;
1063 }
1064
1065 public virtual string GetTextCtrlClick(ButtonGrid b)
1066 {
1067 return "actSplit".lang();
1068 }
1069
1070 public virtual void OnAltClick(ButtonGrid button)
1071 {
1072 EClass.pc.DropThing(button.card.Thing);
1073 }
1074
1075 public virtual bool CanAltClick(ButtonGrid b)
1076 {
1077 if (!EInput.isAltDown)
1078 {
1079 return false;
1080 }
1082 {
1083 return false;
1084 }
1085 if (!AllowDrop(b.card.Thing))
1086 {
1087 return false;
1088 }
1089 return true;
1090 }
1091
1092 public virtual string GetTextAltClick(ButtonGrid b)
1093 {
1094 return "actDrop".lang();
1095 }
1096
1097 public void Grab(DragItemCard.DragInfo from)
1098 {
1099 bool isEquipped = from.thing.isEquipped;
1100 if (isEquipped)
1101 {
1102 from.invOwner.owner.Chara.body.Unequip(from.thing);
1103 }
1105 if (isEquipped)
1106 {
1107 from.list.Redraw();
1108 }
1110 }
1111
1113 {
1114 Thing thing = from.thing;
1115 if (from.invY == 1 && from.container.things.IsOccupied(from.invX, from.invY))
1116 {
1117 return EClass.pc.Pick(thing, msg: false);
1118 }
1119 if (from.container.things.IsFull(thing, recursive: false, tryStack: false))
1120 {
1121 return EClass.pc.Pick(thing, msg: false);
1122 }
1123 thing.invY = from.invY;
1124 thing = from.container.AddThing(thing, tryStack: true, from.invX, from.invY);
1125 if (from.equippedSlot != null)
1126 {
1127 from.invOwner.owner.Chara.body.Equip(thing, from.equippedSlot);
1128 from.list.Redraw();
1129 }
1130 else
1131 {
1132 thing.invX = from.invX;
1133 }
1134 if (from.invY == 1)
1135 {
1136 WidgetCurrentTool.dirty = true;
1137 }
1138 return thing;
1139 }
1140
1142 {
1143 from.thing.PlaySoundDrop(spatial: false);
1144 if (from.thing.parent != null)
1145 {
1146 Grab(from);
1147 }
1148 if (from.thing.IsEquipment)
1149 {
1150 WidgetEquip.dragEquip = from.thing;
1152 }
1153 }
1154
1155 public virtual bool OnCancelDrag(DragItemCard.DragInfo from)
1156 {
1158 {
1159 return false;
1160 }
1161 PutBack(from);
1162 return true;
1163 }
1164
1165 public virtual bool OnDrag(DragItemCard.DragInfo from, DragItemCard.DragInfo to, bool execute, bool cancel = false)
1166 {
1167 if (cancel)
1168 {
1169 return OnCancelDrag(from);
1170 }
1171 bool flag = false;
1172 string text = "";
1173 if ((object)EClass.ui.GetLayer<LayerRegisterHotbar>() == null)
1174 {
1175 EClass.ui.AddLayer<LayerRegisterHotbar>().SetItem(from.thing);
1176 }
1177 LayerInventory componentOf = InputModuleEX.GetComponentOf<LayerInventory>();
1178 if (!EClass.ui.isPointerOverUI && !EClass._zone.IsRegion)
1179 {
1180 flag = AllowDropOnDrag;
1181 text = ((!AllowDropOnDrag) ? "" : ((from.thing.trait is TraitAbility) ? "dragForget" : "dragDropThing"));
1182 if (execute)
1183 {
1184 if (!AllowDropOnDrag || from.thing.c_isImportant)
1185 {
1186 return OnCancelDrag(from);
1187 }
1188 EClass.pc.DropThing(from.thing);
1189 return true;
1190 }
1191 }
1192 else if (!EClass.core.config.game.useGrid && (bool)componentOf)
1193 {
1194 if ((bool)to.button && to.invOwner != null && to.thing != null && to.thing.CanStackTo(from.thing))
1195 {
1196 Transaction transaction = new Transaction(from, to, from.thing.Num);
1197 flag = transaction.IsValid();
1198 text = transaction.GetTextDetail();
1199 if (execute)
1200 {
1201 return transaction.Process();
1202 }
1203 }
1204 else
1205 {
1206 Transaction transaction2 = new Transaction(from, componentOf.invs[0], from.thing.Num);
1207 flag = transaction2.IsValid();
1208 text = transaction2.GetTextDetail();
1209 if (execute)
1210 {
1211 return transaction2.Process();
1212 }
1213 }
1214 }
1215 else if ((bool)to.button && to.invOwner != null && to.button.interactable)
1216 {
1217 if (to.invOwner is InvOwnerEquip)
1218 {
1219 InvOwnerEquip invOwnerEquip = to.invOwner as InvOwnerEquip;
1220 Chara chara = invOwnerEquip.owner.Chara;
1221 BodySlot slot = invOwnerEquip.slot;
1222 if (execute && to.thing != null && to.thing.blessedState <= BlessedState.Cursed)
1223 {
1224 Msg.Say("unequipCursed", to.thing);
1225 return false;
1226 }
1227 if (from.thing.category.slot == slot.elementId)
1228 {
1229 flag = true;
1230 text = "dragEquip";
1231 if (execute)
1232 {
1233 if (!chara.body.IsEquippable(from.thing, slot))
1234 {
1235 return false;
1236 }
1237 chara.AddCard(from.thing);
1238 if (to.thing != null)
1239 {
1240 EClass.ui.nextDrag = new DragItemCard(to.button);
1241 Grab(to);
1242 }
1243 chara.body.Equip(from.thing, invOwnerEquip.slot);
1244 EClass.Sound.Play("equip");
1245 if (EClass.game.UseGrid)
1246 {
1247 from.list.Redraw();
1248 }
1249 to.list.Redraw();
1250 to.invOwner.OnProcess(from.thing);
1251 return true;
1252 }
1253 }
1254 }
1255 else
1256 {
1257 if (to.invOwner is InvOwnerCopyShop && !to.invOwner.owner.trait.CanCopy(from.thing))
1258 {
1259 return false;
1260 }
1261 if (!to.invOwner.AllowTransfer)
1262 {
1263 return false;
1264 }
1265 Transaction transaction3 = new Transaction(from, to, from.thing.Num);
1266 flag = transaction3.IsValid();
1267 text = transaction3.GetTextDetail();
1268 if (execute)
1269 {
1270 return transaction3.Process();
1271 }
1272 }
1273 }
1274 EClass.ui.hud.SetDragText(flag ? text : "", (from.thing.Num > 1) ? (from.thing.Num.ToString() ?? "") : null);
1275 CursorSystem.SetCursor(flag ? null : CursorSystem.Invalid, 100);
1276 return false;
1277 }
1278
1279 public virtual void OnProcess(Thing t)
1280 {
1281 }
1282
1284 {
1285 if (t.trait.CanOpenContainer)
1286 {
1287 if (t.parent != EClass.pc)
1288 {
1289 return (t.parent as Thing)?.trait is TraitToolBelt;
1290 }
1291 return true;
1292 }
1293 return false;
1294 }
1295
1297 {
1298 ListInteraction listInteraction = new ListInteraction();
1299 if (b == null || b.card == null || this is InvOwnerAlly)
1300 {
1301 return listInteraction;
1302 }
1303 Thing t = b.card.Thing;
1304 if (t == null)
1305 {
1306 return listInteraction;
1307 }
1308 listInteraction.thing = t;
1309 Trait trait = t.trait;
1310 bool flag = trait is TraitAbility;
1311 if (HasTrader)
1312 {
1313 if (Trader == null || destInvOwner == null)
1314 {
1315 return listInteraction;
1316 }
1317 if (CanOpenContainer(t))
1318 {
1319 listInteraction.Add("actContainer", 10, delegate
1320 {
1321 (t.trait as TraitContainer).TryOpen();
1322 });
1323 }
1324 bool flag2 = !flag && !trait.CanOnlyCarry && (!destInvOwner.UseGuide || destInvOwner.ShouldShowGuide(t));
1325 bool flag3 = ShopTransaction.current != null && ShopTransaction.current.CanSellBack(t);
1326 if (destInvOwner == Trader && !Trader.AllowSell && !flag3)
1327 {
1328 flag2 = false;
1329 }
1330 if (!AllowHold(t))
1331 {
1332 flag2 = false;
1333 }
1334 if (!Trader.AllowMoved(t))
1335 {
1336 flag2 = false;
1337 }
1338 if (flag2 && (!t.c_isImportant || !destInvOwner.DenyImportant))
1339 {
1340 if (!flag3 && (Trader.currency == CurrencyType.None || t.GetPrice() == 0))
1341 {
1342 Transaction trans2 = new Transaction(b, t.Num);
1343 if (trans2.IsValid())
1344 {
1345 listInteraction.Add(Container.isNPCProperty ? "actSteal".lang().TagColor(FontColor.Bad, SkinManager.DarkColors) : destInvOwner.langTransfer, 0, delegate
1346 {
1347 if (Container.isNPCProperty)
1348 {
1349 Dialog.TryWarnCrime(delegate
1350 {
1351 trans2.Process();
1352 });
1353 }
1354 else
1355 {
1356 trans2.Process();
1357 }
1358 });
1359 }
1360 }
1361 else
1362 {
1363 bool isShiftDown = EInput.isShiftDown;
1364 Transaction trans = new Transaction(b);
1365 listInteraction.Add(trans.GetTextDetail(), 0, delegate
1366 {
1367 trans.Process();
1368 }).repeatable = true;
1369 if (t.Num > 1)
1370 {
1371 Transaction trans3 = new Transaction(b, t.Num);
1372 listInteraction.Add(trans3.GetTextDetail(), 10, delegate
1373 {
1374 trans3.Process();
1375 });
1376 if (isShiftDown)
1377 {
1378 listInteraction.Add(listInteraction[0]);
1379 listInteraction.RemoveAt(0);
1380 }
1381 }
1382 }
1383 }
1384 }
1385 ListInteractions(listInteraction, t, trait, b, context);
1386 if (context && trait is TraitLightSource)
1387 {
1388 listInteraction.Add("customBrightness", 300, delegate
1389 {
1390 UIContextMenu uIContextMenu = EClass.ui.CreateContextMenuInteraction();
1391 uIContextMenu.AddSlider("brightness", (float a) => a.ToString() ?? "", EClass.player.customLightMod, delegate(float b)
1392 {
1393 EClass.player.customLightMod = (int)b;
1395 }, 1f, 6f, isInt: true, hideOther: false);
1396 uIContextMenu.Show();
1397 });
1398 }
1399 if (AllowHold(t) && !t.isEquipped && !HasTrader)
1400 {
1401 Interaction item = listInteraction.Add((EClass.pc.held == t) ? "actPick" : "actHold", 60, delegate
1402 {
1403 TryHold(t);
1404 });
1405 if (t.trait.HoldAsDefaultInteraction)
1406 {
1407 listInteraction.Remove(item);
1408 listInteraction.Insert(0, item);
1409 }
1410 if (t.trait.CanBeHeldAsFurniture)
1411 {
1412 listInteraction.Add("actHoldTool", 70, delegate
1413 {
1414 if (t != EClass.pc.held)
1415 {
1416 if (TryHold(t))
1417 {
1418 HotItemHeld.disableTool = true;
1419 }
1420 }
1421 else
1422 {
1423 HotItemHeld.disableTool = true;
1424 }
1425 }, "remove");
1426 }
1427 }
1428 if (context)
1429 {
1430 bool flag4 = false;
1432 {
1433 if (t.Num > 1)
1434 {
1435 listInteraction.Add("actSplit", 50, delegate
1436 {
1437 t.ShowSplitMenu(b, (HasTrader && currency != 0 && !owner.IsPC) ? new Transaction(b) : null);
1438 });
1439 }
1440 if (owner.IsPC)
1441 {
1442 flag4 = true;
1443 listInteraction.Add(t.c_isImportant ? "important_off" : "important_on", 299, delegate
1444 {
1445 t.c_isImportant = !t.c_isImportant;
1447 SE.ClickOk();
1448 });
1449 if (AllowDrop(t))
1450 {
1451 listInteraction.Add(flag ? "dragForget" : "actDrop", 300, delegate
1452 {
1453 EClass.pc.DropThing(t);
1454 });
1455 }
1456 }
1457 }
1458 if (!flag4 && t.c_isImportant)
1459 {
1460 listInteraction.Add(t.c_isImportant ? "important_off" : "important_on", 299, delegate
1461 {
1462 t.c_isImportant = !t.c_isImportant;
1464 SE.ClickOk();
1465 });
1466 }
1467 }
1468 return listInteraction;
1469 }
1470
1471 public bool TryHold(Thing t)
1472 {
1473 if (!AllowHold(t) || t.isEquipped || HasTrader)
1474 {
1475 return false;
1476 }
1477 if (EClass.pc.held == t)
1478 {
1479 if (t.trait.CanOnlyCarry)
1480 {
1481 SE.Beep();
1482 return true;
1483 }
1484 EClass.pc.PickHeld();
1485 }
1486 else
1487 {
1488 EClass.pc.HoldCard(t);
1489 }
1491 SE.SelectHotitem();
1492 return true;
1493 }
1494
1495 public virtual void ListInteractions(ListInteraction list, Thing t, Trait trait, ButtonGrid b, bool context)
1496 {
1497 if (!owner.IsPC)
1498 {
1499 return;
1500 }
1501 if (CanOpenContainer(t) && !list.Contains("actContainer"))
1502 {
1503 list.Add(LayerInventory.IsOpen(t) ? "close" : "actContainer", 100, delegate
1504 {
1505 (t.trait as TraitContainer).TryOpen();
1506 });
1507 }
1508 if (HasTrader)
1509 {
1510 return;
1511 }
1512 CharaBody body = owner.Chara.body;
1513 BodySlot slot = body.GetSlot(t, onlyEmpty: false, EInput.isShiftDown);
1514 if (slot != null)
1515 {
1516 Card tParent = t.parentCard;
1517 int tInvX = t.invX;
1518 int tInvY = t.invY;
1519 if (tInvY != 1)
1520 {
1521 list.Add("invEquip", 90, delegate
1522 {
1523 if (slot.thing != null && slot.thing.blessedState <= BlessedState.Cursed)
1524 {
1525 Msg.Say("unequipCursed", slot.thing);
1526 SE.Play("curse3");
1527 }
1528 else
1529 {
1530 if (EClass.pc.held == t)
1531 {
1532 EClass.pc.PickHeld();
1533 }
1534 Thing thing = slot.thing;
1535 body.Equip(t, slot);
1536 EClass.Sound.Play("equip");
1537 if (thing != null)
1538 {
1539 if (tParent != null)
1540 {
1541 tParent.AddThing(thing);
1542 thing.invX = tInvX;
1543 thing.invY = tInvY;
1544 }
1545 else if (thing.parent is Card && (thing.parent as Card).things.IsOverflowing())
1546 {
1547 thing.parent.RemoveCard(thing);
1548 EClass.pc.Pick(thing);
1549 }
1550 }
1551 }
1552 });
1553 }
1554 }
1555 if (trait.CanRead(EClass.pc))
1556 {
1557 list.Add("invRead", 110, delegate
1558 {
1559 t.DoAct(new AI_Read
1560 {
1561 target = t
1562 });
1563 }, "remove");
1564 }
1565 if (trait.CanUse(EClass.pc))
1566 {
1567 list.Add(trait.LangUse, 120, delegate
1568 {
1569 if (trait.OnUse(EClass.pc))
1570 {
1571 EClass.player.EndTurn();
1572 }
1573 }, "use");
1574 }
1575 if (trait.CanDrink(EClass.pc))
1576 {
1577 list.Add("invDrink", 130, delegate
1578 {
1579 t.DoAct(new AI_Drink
1580 {
1581 target = t
1582 });
1583 }, "remove");
1584 }
1585 if (trait.CanEat(EClass.pc))
1586 {
1587 list.Add("invFood", 140, delegate
1588 {
1589 t.DoAct(new AI_Eat
1590 {
1591 cook = false,
1592 target = t
1593 });
1594 }, "remove");
1595 }
1596 if (trait.IsBlendBase)
1597 {
1598 list.Add("invBlend", 150, delegate
1599 {
1601 }, "blend");
1602 }
1603 if (!context)
1604 {
1605 return;
1606 }
1607 if (trait is TraitCard)
1608 {
1609 list.Add("invCollect", 150, delegate
1610 {
1612 });
1613 }
1614 if (!trait.CanName)
1615 {
1616 return;
1617 }
1618 list.Add("changeName", 200, delegate
1619 {
1620 Dialog.InputName("dialogChangeName", t.c_refText.IsEmpty(""), delegate(bool cancel, string text)
1621 {
1622 if (!cancel)
1623 {
1624 t.c_refText = text;
1625 }
1626 });
1627 });
1628 }
1629
1630 public virtual string GetAutoUseLang(ButtonGrid button)
1631 {
1632 if (button == null || button.gameObject == null)
1633 {
1634 return "";
1635 }
1636 ListInteraction list = ListInteractions(button, context: false);
1637 foreach (Interaction item in list)
1638 {
1639 if (EClass.player.IsPriorityAction(item.idPriority, list.thing))
1640 {
1641 list.Insert(0, item);
1642 break;
1643 }
1644 }
1645 if (button.card.trait.HoldAsDefaultInteraction && list.Count > 0)
1646 {
1647 Interaction interaction = list[0];
1648 if (interaction.name == "actPick" || interaction.name == "actHold" || interaction.name == "actHoldTool")
1649 {
1650 return null;
1651 }
1652 }
1653 list.ForeachReverse(delegate(Interaction a)
1654 {
1655 if (a.name == "actPick" || a.name == "actHold" || a.name == "actHoldTool")
1656 {
1657 list.Remove(a);
1658 }
1659 });
1660 if (list.Count == 0)
1661 {
1662 return null;
1663 }
1664 if (list[0].name == "actTransfer")
1665 {
1666 return null;
1667 }
1668 return list[0].name.lang();
1669 }
1670
1671 public void AutoUse(ButtonGrid button, bool repeat = false)
1672 {
1673 _ = button.card;
1675 {
1676 return;
1677 }
1678 if (!EClass.pc.HasNoGoal)
1679 {
1680 SE.Beep();
1681 return;
1682 }
1683 ListInteraction listInteraction = ListInteractions(button, context: false);
1684 if (listInteraction.Count == 0)
1685 {
1686 SE.Beep();
1687 return;
1688 }
1689 foreach (Interaction item in listInteraction)
1690 {
1691 if (EClass.player.IsPriorityAction(item.idPriority, listInteraction.thing))
1692 {
1693 listInteraction.Insert(0, item);
1694 break;
1695 }
1696 }
1697 if (!repeat || listInteraction[0].repeatable)
1698 {
1699 listInteraction[0].action();
1700 }
1701 }
1702
1703 public void ShowContextMenu(ButtonGrid button)
1704 {
1705 if (!EClass.pc.HasNoGoal)
1706 {
1707 SE.Beep();
1708 return;
1709 }
1710 ListInteraction listInteraction = ListInteractions(button, context: true);
1711 if (listInteraction.Count == 0)
1712 {
1713 SE.BeepSmall();
1714 return;
1715 }
1716 UIContextMenu uIContextMenu = EClass.ui.CreateContextMenuInteraction();
1717 listInteraction.Sort((Interaction a, Interaction b) => a.priority - b.priority);
1718 foreach (Interaction item in listInteraction)
1719 {
1720 uIContextMenu.AddButton(item.name, item.action);
1721 }
1722 uIContextMenu.Show();
1723 }
1724
1725 public virtual int GetPrice(Thing t, CurrencyType currency, int num, bool sell)
1726 {
1727 return ShopTransaction.current.GetPrice(t, num, sell);
1728 }
1729
1730 public virtual string GetTextDetail(Thing t, CurrencyType currency, int num, bool sell)
1731 {
1732 int price = GetPrice(t, currency, num, sell);
1733 string @ref = (Trader.UseHomeResource ? Trader.homeResource.Name : ((currency == CurrencyType.Influence) ? "influence".lang() : EClass.sources.things.map[IDCurrency].GetName()));
1734 string ref2 = ((price == 0) ? "" : "invInteraction3".lang(price.ToFormat() ?? "", @ref));
1735 string text = "invInteraction1".lang(num.ToString() ?? "", ref2, (sell ? "invSell" : "invBuy").lang());
1736 if (!sell && EClass.pc.GetCurrency(Currency.ToID(currency)) < price)
1737 {
1738 text = text.TagColor(FontColor.Bad, SkinManager.DarkColors);
1739 }
1740 return text;
1741 }
1742
1743 public virtual void OnWriteNote(ButtonGrid button, UINote n)
1744 {
1745 if (button.card is Thing t)
1746 {
1747 bool flag = HasTrader && Trader.currency != 0 && (destInvOwner != Trader || Trader.AllowSell || (ShopTransaction.current?.CanSellBack(t) ?? false));
1748 if (flag && Trader.UseGuide && !Trader.ShouldShowGuide(t))
1749 {
1750 flag = false;
1751 }
1752 if (flag)
1753 {
1754 Transaction transaction = new Transaction(button);
1755 n.Space(8);
1756 UIItem uIItem = n.AddExtra<UIItem>("costPrice");
1757 string id = IDCostIcon(t);
1758 int price = transaction.GetPrice();
1759 uIItem.text1.SetText(Lang._currency(price), transaction.IsValid() ? FontColor.Good : FontColor.Bad);
1760 uIItem.image1.sprite = (Trader.UseHomeResource ? Trader.homeResource.Sprite : SpriteSheet.Get(id));
1761 }
1762 }
1763 }
1764
1765 public virtual string IDCostIcon(Thing t)
1766 {
1767 return "icon_" + IDCurrency;
1768 }
1769
1770 public virtual bool IsFailByCurse(Thing t)
1771 {
1772 return false;
1773 }
1774}
BlessedState
Definition: BlessedState.cs:2
CTAG
Definition: CTAG.cs:2
@ currency
ContainerType
Definition: ContainerType.cs:2
CurrencyType
Definition: CurrencyType.cs:2
Emo
Definition: Emo.cs:2
@ cook
FontColor
Definition: FontColor.cs:2
IDTSource
Definition: IDTSource.cs:2
PriceType
Definition: PriceType.cs:2
if(item3.idFile==idFirstFile &&item3.id==idFirstTopic)
Definition: UIBook.cs:627
Definition: AI_Eat.cs:5
static AM_Region Region
Definition: ActionMode.cs:17
bool IsActive
Definition: ActionMode.cs:121
static AM_Adv Adv
Definition: ActionMode.cs:15
bool CanForceTradeEquip()
Definition: Affinity.cs:49
void SetInt(int id, int value=0)
Definition: BaseCard.cs:39
virtual void Redraw()
Definition: BaseList.cs:57
int elementId
Definition: BodySlot.cs:6
Thing thing
Definition: BodySlot.cs:8
Card card
Definition: ButtonGrid.cs:24
InvOwner invOwner
Definition: ButtonGrid.cs:28
void SetCardGrid(Card c, InvOwner owner=null)
Definition: ButtonGrid.cs:145
float pressedTimer
Definition: ButtonState.cs:17
bool pressedLong
Definition: ButtonState.cs:64
static void SetNormalRarity(bool fixedMat=false)
Definition: Card.cs:11
bool isDestroyed
Definition: Card.cs:71
virtual Chara Chara
Definition: Card.cs:2006
Thing Split(int a)
Definition: Card.cs:3345
string id
Definition: Card.cs:31
bool isNPCProperty
Definition: Card.cs:538
virtual int GetPrice(CurrencyType currency=CurrencyType.Money, bool sell=false, PriceType priceType=PriceType.Default, Chara c=null)
Definition: Card.cs:6875
int c_lockLv
Definition: Card.cs:936
Card AddCard(Card c)
Definition: Card.cs:3006
int invY
Definition: Card.cs:1891
bool IsCursed
Definition: Card.cs:2191
Thing AddThing(string id, int lv=-1)
Definition: Card.cs:3020
void Talk(string idTopic, string ref1=null, string ref2=null, bool forceSync=false)
Definition: Card.cs:6326
ICardParent parent
Definition: Card.cs:51
bool IsHotItem
Definition: Card.cs:115
int GetCurrency(string id="money")
Definition: Card.cs:3820
void RecalculateFOV()
Definition: Card.cs:5988
Point pos
Definition: Card.cs:55
void ShowEmo(Emo _emo=Emo.none, float duration=0f, bool skipSame=true)
Definition: Card.cs:5744
Trait trait
Definition: Card.cs:49
void ModCurrency(int a, string id="money")
Definition: Card.cs:3806
bool IsEquipment
Definition: Card.cs:2109
bool c_isImportant
Definition: Card.cs:996
ThingContainer things
Definition: Card.cs:34
virtual bool IsPC
Definition: Card.cs:2079
virtual bool isChara
Definition: Card.cs:2019
virtual Thing Thing
Definition: Card.cs:1994
Card GetRootCard()
Definition: Card.cs:3287
int invX
Definition: Card.cs:1879
virtual bool IsPCFaction
Definition: Card.cs:2205
bool isGifted
Definition: Card.cs:766
BlessedState blessedState
Definition: Card.cs:262
void PlaySoundDrop(bool spatial=true)
Definition: Card.cs:5761
Card parentCard
Definition: Card.cs:99
int Num
Definition: Card.cs:154
SourceCategory.Row category
Definition: Card.cs:1985
bool IsIdentified
Definition: Card.cs:2313
void RemoveCard(Card c)
Definition: Card.cs:3011
void Say(string lang, string ref1=null, string ref2=null)
Definition: Card.cs:6423
void Unequip(Thing thing, bool refresh=true)
Definition: CharaBody.cs:49
bool IsEquippable(Thing thing, BodySlot slot, bool text=true)
Definition: CharaBody.cs:106
bool Equip(Thing thing, BodySlot slot=null, bool msg=true)
Definition: CharaBody.cs:182
BodySlot GetSlot(Thing t, bool onlyEmpty=false, bool secondSlot=false)
Definition: CharaBody.cs:347
Definition: Chara.cs:10
CharaBody body
Definition: Chara.cs:94
Card held
Definition: Chara.cs:70
void InstantEat(Thing t=null, bool sound=true)
Definition: Chara.cs:7025
void ModAffinity(Chara c, int a, bool show=true, bool showOnlyEmo=false)
Definition: Chara.cs:7360
override bool IsPC
Definition: Chara.cs:608
bool CanAcceptItem(Card t, int num=-1)
Definition: Chara.cs:7582
void HoldCard(Card t, int num=-1)
Definition: Chara.cs:4181
void PickHeld(bool msg=false)
Definition: Chara.cs:4233
void GiveLovePotion(Chara c, Thing t)
Definition: Chara.cs:7761
Affinity affinity
Definition: Chara.cs:310
bool HasNoGoal
Definition: Chara.cs:864
void DropThing(Thing t, int num=-1)
Definition: Chara.cs:4330
bool TryEquip(Thing t, bool useFav=false)
Definition: Chara.cs:7150
Thing Pick(Thing t, bool msg=true, bool tryStack=true)
Definition: Chara.cs:4017
static void Collect(Thing t)
new GameConfig game
Definition: CoreConfig.cs:600
CoreConfig config
Definition: Core.cs:70
static string ToID(CurrencyType currency)
Definition: Currency.cs:3
static CursorInfo Invalid
static void SetCursor(CursorInfo info=null, int _priority=0)
Definition: Dialog.cs:7
static Dialog InputName(string langDetail, string text, Action< bool, string > onClose, InputType inputType=InputType.Default)
Definition: Dialog.cs:528
ButtonGrid button
Definition: DragItemCard.cs:52
Definition: EClass.cs:5
static Game game
Definition: EClass.cs:8
static Core core
Definition: EClass.cs:6
static Zone _zone
Definition: EClass.cs:20
static SourceManager sources
Definition: EClass.cs:42
static Player player
Definition: EClass.cs:12
static Chara pc
Definition: EClass.cs:14
static FactionBranch BranchOrHomeBranch
Definition: EClass.cs:24
static SoundManager Sound
Definition: EClass.cs:46
static UI ui
Definition: EClass.cs:16
Definition: EInput.cs:8
static bool isCtrlDown
Definition: EInput.cs:263
static bool isAltDown
Definition: EInput.cs:265
static ButtonState leftMouse
Definition: EInput.cs:349
static bool isShiftDown
Definition: EInput.cs:261
static ButtonState rightMouse
Definition: EInput.cs:351
HomeResourceManager resources
bool UseGrid
Definition: Game.cs:259
override void Mod(int a, bool popText=true)
Definition: HomeResource.cs:64
BodySlot slot
Definition: InvOwnerEquip.cs:3
void Set(string _lang, Card c=null, string _sound="beep_small")
Definition: InvOwner.cs:15
bool Contains(string s)
Definition: InvOwner.cs:501
Interaction Add(string s, int priority, Action action, string idPriority=null)
Definition: InvOwner.cs:474
InvOwner destInv
Definition: InvOwner.cs:52
Transaction(DragItemCard.DragInfo from, DragItemCard.DragInfo to, int num=1)
Definition: InvOwner.cs:117
Transaction(ButtonGrid button, int num=1, InvOwner owner=null)
Definition: InvOwner.cs:127
static ErrorMessage error
Definition: InvOwner.cs:35
string GetTextDetail()
Definition: InvOwner.cs:447
CurrencyType currency
Definition: InvOwner.cs:89
DragItemCard.DragInfo to
Definition: InvOwner.cs:45
bool Process(bool startTransaction=false)
Definition: InvOwner.cs:135
UIInventory destUIInv
Definition: InvOwner.cs:47
DragItemCard.DragInfo from
Definition: InvOwner.cs:43
Transaction(DragItemCard.DragInfo from, UIInventory destUIInv, int num=1)
Definition: InvOwner.cs:107
ButtonGrid button
Definition: InvOwner.cs:39
virtual bool AllowDropOnDrag
Definition: InvOwner.cs:585
static InvOwner Trader
Definition: InvOwner.cs:519
void Init()
Definition: InvOwner.cs:738
void Grab(DragItemCard.DragInfo from)
Definition: InvOwner.cs:1097
virtual int destInvY
Definition: InvOwner.cs:589
virtual void OnInit()
Definition: InvOwner.cs:752
bool includeChildren
Definition: InvOwner.cs:525
virtual bool OnCancelDrag(DragItemCard.DragInfo from)
Definition: InvOwner.cs:1155
virtual bool CanCtrlClick(ButtonGrid b)
Definition: InvOwner.cs:1052
virtual void BuildUICurrency(UICurrency uiCurrency, bool canReroll=false)
Definition: InvOwner.cs:700
virtual void OnShiftClick(ButtonGrid b, bool rightMouse=false)
Definition: InvOwner.cs:939
Card owner
Definition: InvOwner.cs:533
bool UseHomeResource
Definition: InvOwner.cs:597
InvOwner destInvOwner
Definition: InvOwner.cs:626
virtual bool DenyImportant
Definition: InvOwner.cs:623
InvOwner GetShitDestOwner(ButtonGrid b, bool rightMouse=false)
Definition: InvOwner.cs:912
virtual void OnProcess(Thing t)
Definition: InvOwner.cs:1279
static float clickTimer
Definition: InvOwner.cs:523
static bool HasTrader
Definition: InvOwner.cs:539
void ShowContextMenu(ButtonGrid button)
Definition: InvOwner.cs:1703
virtual string GetTextDetail(Thing t, CurrencyType currency, int num, bool sell)
Definition: InvOwner.cs:1730
List< Thing > Things
Definition: InvOwner.cs:602
virtual bool AllowHold(Thing t)
Definition: InvOwner.cs:639
virtual bool AlwaysShowTooltip
Definition: InvOwner.cs:569
Card Container
Definition: InvOwner.cs:535
virtual void OnCtrlClick(ButtonGrid button)
Definition: InvOwner.cs:1047
virtual int GetPrice(Thing t, CurrencyType currency, int num, bool sell)
Definition: InvOwner.cs:1725
virtual bool AllowTransfer
Definition: InvOwner.cs:574
InvOwner(Card owner, Card container=null, CurrencyType _currency=CurrencyType.None, PriceType _price=PriceType.Default)
Definition: InvOwner.cs:726
virtual void OnAltClick(ButtonGrid button)
Definition: InvOwner.cs:1070
string IDCurrency
Definition: InvOwner.cs:637
void AutoUse(ButtonGrid button, bool repeat=false)
Definition: InvOwner.cs:1671
virtual string GetTextAltClick(ButtonGrid b)
Definition: InvOwner.cs:1092
virtual Thing CreateDefaultContainer()
Definition: InvOwner.cs:695
virtual bool IsFailByCurse(Thing t)
Definition: InvOwner.cs:1770
virtual string GetTextCtrlClick(ButtonGrid b)
Definition: InvOwner.cs:1065
bool IsWeightOver(Thing t)
Definition: InvOwner.cs:721
virtual bool AllowMoved(Thing t)
Definition: InvOwner.cs:676
virtual bool SingleTarget
Definition: InvOwner.cs:595
static InvOwner Main
Definition: InvOwner.cs:521
CurrencyType currency
Definition: InvOwner.cs:527
virtual bool InvertSell
Definition: InvOwner.cs:617
virtual void OnRightClick(ButtonGrid button)
Definition: InvOwner.cs:869
List< ButtonGrid > buttons
Definition: InvOwner.cs:537
virtual bool OnDrag(DragItemCard.DragInfo from, DragItemCard.DragInfo to, bool execute, bool cancel=false)
Definition: InvOwner.cs:1165
virtual bool UseGuide
Definition: InvOwner.cs:571
ListInteraction ListInteractions(ButtonGrid b, bool context)
Definition: InvOwner.cs:1296
virtual bool CanAltClick(ButtonGrid b)
Definition: InvOwner.cs:1075
virtual bool AllowDrop(Thing t)
Definition: InvOwner.cs:686
virtual int numDragGrid
Definition: InvOwner.cs:619
PriceType priceType
Definition: InvOwner.cs:529
virtual void ListInteractions(ListInteraction list, Thing t, Trait trait, ButtonGrid b, bool context)
Definition: InvOwner.cs:1495
Chara Chara
Definition: InvOwner.cs:613
static ForceGiveData forceGive
Definition: InvOwner.cs:517
virtual void OnRightPressed(ButtonGrid button)
Definition: InvOwner.cs:881
virtual void OnClick(ButtonGrid button)
Definition: InvOwner.cs:756
virtual void OnWriteNote(ButtonGrid button, UINote n)
Definition: InvOwner.cs:1743
bool CanOpenContainer(Thing t)
Definition: InvOwner.cs:1283
void OnStartDrag(DragItemCard.DragInfo from)
Definition: InvOwner.cs:1141
virtual string GetTextShiftClick(ButtonGrid b)
Definition: InvOwner.cs:1042
virtual string GetAutoUseLang(ButtonGrid button)
Definition: InvOwner.cs:1630
bool TryHold(Thing t)
Definition: InvOwner.cs:1471
virtual bool CanShiftClick(ButtonGrid b, bool rightMouse=false)
Definition: InvOwner.cs:976
virtual string IDCostIcon(Thing t)
Definition: InvOwner.cs:1765
virtual string langTransfer
Definition: InvOwner.cs:587
virtual bool AllowContext
Definition: InvOwner.cs:555
Thing PutBack(DragItemCard.DragInfo from)
Definition: InvOwner.cs:1112
bool IsMagicChest
Definition: InvOwner.cs:599
virtual bool ShowNew
Definition: InvOwner.cs:621
virtual bool ShouldShowGuide(Thing t)
Definition: InvOwner.cs:681
HomeResource homeResource
Definition: InvOwner.cs:531
virtual bool CopyOnTransfer
Definition: InvOwner.cs:593
static bool FreeTransfer
Definition: InvOwner.cs:542
virtual bool AllowSell
Definition: InvOwner.cs:558
virtual bool HasTransaction
Definition: InvOwner.cs:591
virtual bool AllowAutouse
Definition: InvOwner.cs:553
Definition: Lang.cs:6
static string _currency(object a, string IDCurrency)
Definition: Lang.cs:162
static LayerDragGrid Create(InvOwnerDraglet owner, bool refuelFromLayerDragGrid=false)
static LayerDragGrid Instance
List< UIInventory > invs
static void SetDirty(Thing t)
static LayerInventory GetPCLayer()
static bool IsOpen(Thing t)
static LayerInventory GetTopLayer(Thing t, bool includePlayer=false, InvOwner exclude=null)
Definition: Msg.cs:5
static string Say(string idLang, string ref1, string ref2=null, string ref3=null, string ref4=null)
Definition: Msg.cs:58
bool IsPriorityAction(string id, Thing t)
Definition: Player.cs:1314
void SetPriorityAction(string id, Thing t)
Definition: Player.cs:1284
void ModKarma(int a)
Definition: Player.cs:2311
int customLightMod
Definition: Player.cs:778
void RefreshCurrentHotItem()
Definition: Player.cs:1998
bool TryWitnessCrime(Chara criminal, Chara target=null, int radius=4, Func< Chara, bool > funcWitness=null)
Definition: Point.cs:857
bool HasBought(Thing t)
static ShopTransaction current
bool CanSellBack(Thing t, int num=-1)
int GetPrice(Thing t, int n, bool sell)
void Process(Thing t, int n, bool sell)
static SkinColorProfile DarkColors
Definition: SkinManager.cs:86
SourceThing things
int uid
Definition: Spatial.cs:70
virtual bool IsRegion
Definition: Spatial.cs:501
static Sprite Get(string id)
Definition: SpriteSheet.cs:28
Thing TryStack(Thing target, int destInvX=-1, int destInvY=-1)
List< Thing > grid
bool IsOccupied(int x, int y)
Thing CanStack(Thing target, int destInvX=-1, int destInvY=-1)
bool IsFull(int y=0)
static Thing Create(string id, int idMat=-1, int lv=-1)
Definition: ThingGen.cs:53
Definition: Thing.cs:8
bool isEquipped
Definition: Thing.cs:17
void ShowSplitMenu(ButtonGrid button, InvOwner.Transaction trans=null)
Definition: Thing.cs:1716
override bool CanStackTo(Thing to)
Definition: Thing.cs:1559
Thing Identify(bool show=true, IDTSource idtSource=IDTSource.Identify)
Definition: Thing.cs:1980
Definition: Trait.cs:7
virtual bool HoldAsDefaultInteraction
Definition: Trait.cs:129
virtual bool AllowSell
Definition: Trait.cs:518
virtual bool CanOpenContainer
Definition: Trait.cs:230
virtual bool CanCopy(Thing t)
Definition: Trait.cs:1443
virtual ContainerType ContainerType
Definition: Trait.cs:243
virtual bool CanBeDropped
Definition: Trait.cs:295
virtual bool IsContainer
Definition: Trait.cs:209
virtual bool CanOnlyCarry
Definition: Trait.cs:287
void Show(UIItem i)
UIContextMenuItem AddSlider(string text, Func< float, string > textFunc, float value, Action< float > action, float min=0f, float max=1f, bool isInt=false, bool hideOther=true, bool useInput=false)
void AddButton(Func< string > funcText, UnityAction action=null)
void Build(Options _options)
Definition: UICurrency.cs:79
InvOwner owner
Definition: UIInventory.cs:137
UIList list
Definition: UIInventory.cs:79
Definition: UIItem.cs:5
UIText text1
Definition: UIItem.cs:6
Definition: UINote.cs:6
void Space(int sizeY=0, int sizeX=1)
Definition: UINote.cs:62
void SetText(string s)
Definition: UIText.cs:159
static void Redraw()
Definition: WidgetEquip.cs:69