Elin Decompiled Documentation EA 23.317 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().ToLowerInvariant();
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 && !ShopTransaction.current.HasBought(thing2))
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 || (Trader.currency != CurrencyType.Influence && t.GetPrice(Trader.currency, sell: false, Trader.priceType) == 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 (AllowHold(t) && !t.isEquipped && !HasTrader)
1387 {
1388 Interaction item = listInteraction.Add((EClass.pc.held == t) ? "actPick" : "actHold", 60, delegate
1389 {
1390 TryHold(t);
1391 });
1392 if (t.trait.HoldAsDefaultInteraction)
1393 {
1394 listInteraction.Remove(item);
1395 listInteraction.Insert(0, item);
1396 }
1397 if (t.trait.CanBeHeldAsFurniture)
1398 {
1399 listInteraction.Add("actHoldTool", 70, delegate
1400 {
1401 if (t != EClass.pc.held)
1402 {
1403 if (TryHold(t))
1404 {
1405 HotItemHeld.disableTool = true;
1406 }
1407 }
1408 else
1409 {
1410 HotItemHeld.disableTool = true;
1411 }
1412 }, "remove");
1413 }
1414 }
1415 if (context)
1416 {
1417 if (AllowHold(t) && !Container.isNPCProperty)
1418 {
1419 if (t.Num > 1)
1420 {
1421 listInteraction.Add("actSplit", 50, delegate
1422 {
1423 t.ShowSplitMenu(b, (HasTrader && currency != 0 && !owner.IsPC) ? new Transaction(b) : null);
1424 });
1425 }
1426 if ((owner.IsPC || Container.IsPCFactionOrMinion) && AllowDrop(t))
1427 {
1428 listInteraction.Add(flag ? "dragForget" : "actDrop", 300, delegate
1429 {
1430 EClass.pc.DropThing(t);
1431 });
1432 }
1433 }
1434 bool flag4 = false;
1435 if (owner.IsPC || Container.IsPCFactionOrMinion)
1436 {
1437 flag4 = true;
1438 listInteraction.Add(t.c_isImportant ? "important_off" : "important_on", 299, delegate
1439 {
1440 t.c_isImportant = !t.c_isImportant;
1441 LayerInventory.SetDirty(t);
1442 SE.ClickOk();
1443 });
1444 }
1445 if (!flag4 && t.c_isImportant)
1446 {
1447 listInteraction.Add(t.c_isImportant ? "important_off" : "important_on", 299, delegate
1448 {
1449 t.c_isImportant = !t.c_isImportant;
1450 LayerInventory.SetDirty(t);
1451 SE.ClickOk();
1452 });
1453 }
1454 }
1455 return listInteraction;
1456 }
1457
1458 public bool TryHold(Thing t)
1459 {
1460 if (!AllowHold(t) || t.isEquipped || HasTrader)
1461 {
1462 return false;
1463 }
1464 if (EClass.pc.held == t)
1465 {
1466 if (t.trait.CanOnlyCarry)
1467 {
1468 SE.Beep();
1469 return true;
1470 }
1471 EClass.pc.PickHeld();
1472 }
1473 else
1474 {
1475 EClass.pc.HoldCard(t);
1476 }
1478 SE.SelectHotitem();
1479 return true;
1480 }
1481
1482 public virtual void ListInteractions(ListInteraction list, Thing t, Trait trait, ButtonGrid b, bool context)
1483 {
1484 if (!owner.IsPC)
1485 {
1486 return;
1487 }
1488 if (CanOpenContainer(t) && !list.Contains("actContainer"))
1489 {
1490 list.Add(LayerInventory.IsOpen(t) ? "close" : "actContainer", 100, delegate
1491 {
1492 (t.trait as TraitContainer).TryOpen();
1493 });
1494 }
1495 if (HasTrader)
1496 {
1497 return;
1498 }
1499 CharaBody body = owner.Chara.body;
1500 BodySlot slot = body.GetSlot(t, onlyEmpty: false, EInput.isShiftDown);
1501 if (slot != null)
1502 {
1503 Card tParent = t.parentCard;
1504 int tInvX = t.invX;
1505 int tInvY = t.invY;
1506 if (tInvY != 1)
1507 {
1508 list.Add("invEquip", 90, delegate
1509 {
1510 if (slot.thing != null && slot.thing.blessedState <= BlessedState.Cursed)
1511 {
1512 Msg.Say("unequipCursed", slot.thing);
1513 SE.Play("curse3");
1514 }
1515 else
1516 {
1517 if (EClass.pc.held == t)
1518 {
1519 EClass.pc.PickHeld();
1520 }
1521 Thing thing = slot.thing;
1522 body.Equip(t, slot);
1523 EClass.Sound.Play("equip");
1524 if (thing != null)
1525 {
1526 if (tParent != null)
1527 {
1528 tParent.AddThing(thing);
1529 thing.invX = tInvX;
1530 thing.invY = tInvY;
1531 }
1532 else if (thing.parent is Card && (thing.parent as Card).things.IsOverflowing())
1533 {
1534 thing.parent.RemoveCard(thing);
1535 EClass.pc.Pick(thing);
1536 }
1537 }
1538 }
1539 });
1540 }
1541 }
1542 trait.OnListInteraction(list, b, context);
1543 }
1544
1545 public virtual string GetAutoUseLang(ButtonGrid button)
1546 {
1547 if (button == null || button.gameObject == null)
1548 {
1549 return "";
1550 }
1551 ListInteraction list = ListInteractions(button, context: false);
1552 foreach (Interaction item in list)
1553 {
1554 if (EClass.player.IsPriorityAction(item.idPriority, list.thing))
1555 {
1556 list.Insert(0, item);
1557 break;
1558 }
1559 }
1560 if (button.card.trait.HoldAsDefaultInteraction && list.Count > 0)
1561 {
1562 Interaction interaction = list[0];
1563 if (interaction.name == "actPick" || interaction.name == "actHold" || interaction.name == "actHoldTool")
1564 {
1565 return null;
1566 }
1567 }
1568 list.ForeachReverse(delegate(Interaction a)
1569 {
1570 if (a.name == "actPick" || a.name == "actHold" || a.name == "actHoldTool")
1571 {
1572 list.Remove(a);
1573 }
1574 });
1575 if (list.Count == 0)
1576 {
1577 return null;
1578 }
1579 if (list[0].name == "actTransfer")
1580 {
1581 return null;
1582 }
1583 return list[0].name.lang();
1584 }
1585
1586 public void AutoUse(ButtonGrid button, bool repeat = false)
1587 {
1588 _ = button.card;
1590 {
1591 return;
1592 }
1593 if (!EClass.pc.HasNoGoal)
1594 {
1595 SE.Beep();
1596 return;
1597 }
1598 ListInteraction listInteraction = ListInteractions(button, context: false);
1599 if (listInteraction.Count == 0)
1600 {
1601 SE.Beep();
1602 return;
1603 }
1604 foreach (Interaction item in listInteraction)
1605 {
1606 if (EClass.player.IsPriorityAction(item.idPriority, listInteraction.thing))
1607 {
1608 listInteraction.Insert(0, item);
1609 break;
1610 }
1611 }
1612 if (!repeat || listInteraction[0].repeatable)
1613 {
1614 listInteraction[0].action();
1615 }
1616 }
1617
1618 public void ShowContextMenu(ButtonGrid button)
1619 {
1620 if (!EClass.pc.HasNoGoal)
1621 {
1622 SE.Beep();
1623 return;
1624 }
1625 ListInteraction listInteraction = ListInteractions(button, context: true);
1626 if (listInteraction.Count == 0)
1627 {
1628 SE.BeepSmall();
1629 return;
1630 }
1631 UIContextMenu uIContextMenu = EClass.ui.CreateContextMenuInteraction();
1632 listInteraction.Sort((Interaction a, Interaction b) => a.priority - b.priority);
1633 foreach (Interaction item in listInteraction)
1634 {
1635 uIContextMenu.AddButton(item.name, item.action);
1636 }
1637 uIContextMenu.Show();
1638 }
1639
1640 public virtual int GetPrice(Thing t, CurrencyType currency, int num, bool sell)
1641 {
1642 return ShopTransaction.current.GetPrice(t, num, sell);
1643 }
1644
1645 public virtual string GetTextDetail(Thing t, CurrencyType currency, int num, bool sell)
1646 {
1647 int price = GetPrice(t, currency, num, sell);
1648 string @ref = (Trader.UseHomeResource ? Trader.homeResource.Name : ((currency == CurrencyType.Influence) ? "influence".lang() : EClass.sources.things.map[IDCurrency].GetName()));
1649 string ref2 = ((price == 0) ? "" : "invInteraction3".lang(price.ToFormat() ?? "", @ref));
1650 string text = "invInteraction1".lang(num.ToString() ?? "", ref2, (sell ? "invSell" : "invBuy").lang());
1651 if (!sell && EClass.pc.GetCurrency(Currency.ToID(currency)) < price)
1652 {
1653 text = text.TagColor(FontColor.Bad, SkinManager.DarkColors);
1654 }
1655 return text;
1656 }
1657
1658 public virtual void OnWriteNote(ButtonGrid button, UINote n)
1659 {
1660 if (button.card is Thing t)
1661 {
1662 bool flag = HasTrader && Trader.currency != 0 && (destInvOwner != Trader || Trader.AllowSell || (ShopTransaction.current?.CanSellBack(t) ?? false));
1663 if (flag && Trader.UseGuide && !Trader.ShouldShowGuide(t))
1664 {
1665 flag = false;
1666 }
1667 if (flag)
1668 {
1669 Transaction transaction = new Transaction(button);
1670 n.Space(8);
1671 UIItem uIItem = n.AddExtra<UIItem>("costPrice");
1672 string id = IDCostIcon(t);
1673 int price = transaction.GetPrice();
1674 uIItem.text1.SetText(Lang._currency(price), transaction.IsValid() ? FontColor.Good : FontColor.Bad);
1675 uIItem.image1.sprite = (Trader.UseHomeResource ? Trader.homeResource.Sprite : SpriteSheet.Get(id));
1676 }
1677 }
1678 }
1679
1680 public virtual string IDCostIcon(Thing t)
1681 {
1682 return "icon_" + IDCurrency;
1683 }
1684
1685 public virtual bool IsFailByCurse(Thing t)
1686 {
1687 return false;
1688 }
1689}
BlessedState
Definition: BlessedState.cs:2
CTAG
Definition: CTAG.cs:2
@ currency
ContainerType
Definition: ContainerType.cs:2
CurrencyType
Definition: CurrencyType.cs:2
if(!match.Success)
Emo
Definition: Emo.cs:2
FontColor
Definition: FontColor.cs:2
IDTSource
Definition: IDTSource.cs:2
PriceType
Definition: PriceType.cs:2
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:51
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:78
bool IsPCFactionOrMinion
Definition: Card.cs:2326
virtual Chara Chara
Definition: Card.cs:2122
Thing Split(int a)
Definition: Card.cs:3642
string id
Definition: Card.cs:36
bool isNPCProperty
Definition: Card.cs:557
void SetInt(string id, int value=0)
Definition: Card.cs:2570
int c_lockLv
Definition: Card.cs:991
Card AddCard(Card c)
Definition: Card.cs:3243
int invY
Definition: Card.cs:2007
bool IsCursed
Definition: Card.cs:2309
Thing AddThing(string id, int lv=-1)
Definition: Card.cs:3257
void Talk(string idTopic, string ref1=null, string ref2=null, bool forceSync=false)
Definition: Card.cs:7121
ICardParent parent
Definition: Card.cs:56
bool IsHotItem
Definition: Card.cs:122
int GetCurrency(string id="money")
Definition: Card.cs:4133
Point pos
Definition: Card.cs:60
int uid
Definition: Card.cs:125
void ShowEmo(Emo _emo=Emo.none, float duration=0f, bool skipSame=true)
Definition: Card.cs:6529
Trait trait
Definition: Card.cs:54
void ModCurrency(int a, string id="money")
Definition: Card.cs:4119
bool IsEquipment
Definition: Card.cs:2227
bool c_isImportant
Definition: Card.cs:1051
ThingContainer things
Definition: Card.cs:39
virtual bool IsPC
Definition: Card.cs:2197
virtual bool isChara
Definition: Card.cs:2135
virtual Thing Thing
Definition: Card.cs:2110
Card GetRootCard()
Definition: Card.cs:3584
int invX
Definition: Card.cs:1995
virtual bool IsPCFaction
Definition: Card.cs:2323
bool isGifted
Definition: Card.cs:785
BlessedState blessedState
Definition: Card.cs:281
void PlaySoundDrop(bool spatial=true)
Definition: Card.cs:6546
Card parentCard
Definition: Card.cs:106
int Num
Definition: Card.cs:161
SourceCategory.Row category
Definition: Card.cs:2101
bool IsIdentified
Definition: Card.cs:2431
void RemoveCard(Card c)
Definition: Card.cs:3248
void Say(string lang, string ref1=null, string ref2=null)
Definition: Card.cs:7239
int c_uidAttune
Definition: Card.cs:1212
void Unequip(Thing thing, bool refresh=true)
Definition: CharaBody.cs:49
bool IsEquippable(Thing thing, BodySlot slot, bool text=true)
Definition: CharaBody.cs:110
bool Equip(Thing thing, BodySlot slot=null, bool msg=true)
Definition: CharaBody.cs:194
BodySlot GetSlot(Thing t, bool onlyEmpty=false, bool secondSlot=false)
Definition: CharaBody.cs:369
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:7868
void ModAffinity(Chara c, int a, bool show=true, bool showOnlyEmo=false)
Definition: Chara.cs:8236
override bool IsPC
Definition: Chara.cs:630
bool CanAcceptItem(Card t, int num=-1, bool skipImportantCheck=false)
Definition: Chara.cs:8540
void HoldCard(Card t, int num=-1)
Definition: Chara.cs:4624
void PickHeld(bool msg=false)
Definition: Chara.cs:4680
void GiveLovePotion(Chara c, Thing t)
Definition: Chara.cs:8723
Affinity affinity
Definition: Chara.cs:318
bool HasNoGoal
Definition: Chara.cs:1023
void DropThing(Thing t, int num=-1)
Definition: Chara.cs:4777
bool TryEquip(Thing t, bool useFav=false)
Definition: Chara.cs:8026
Thing Pick(Thing t, bool msg=true, bool tryStack=true)
Definition: Chara.cs:4460
new GameConfig game
Definition: CoreConfig.cs:617
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)
ButtonGrid button
Definition: DragItemCard.cs:52
DragInfo from
Definition: DragItemCard.cs:54
Definition: EClass.cs:6
static Game game
Definition: EClass.cs:9
static Core core
Definition: EClass.cs:7
static Zone _zone
Definition: EClass.cs:21
static SourceManager sources
Definition: EClass.cs:43
static Player player
Definition: EClass.cs:13
static Chara pc
Definition: EClass.cs:15
static FactionBranch BranchOrHomeBranch
Definition: EClass.cs:25
static SoundManager Sound
Definition: EClass.cs:47
static UI ui
Definition: EClass.cs:17
Definition: EInput.cs:8
static bool isCtrlDown
Definition: EInput.cs:274
static bool isAltDown
Definition: EInput.cs:276
static ButtonState leftMouse
Definition: EInput.cs:360
static bool isShiftDown
Definition: EInput.cs:272
static ButtonState rightMouse
Definition: EInput.cs:362
HomeResourceManager resources
bool UseGrid
Definition: Game.cs:266
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:1618
virtual string GetTextDetail(Thing t, CurrencyType currency, int num, bool sell)
Definition: InvOwner.cs:1645
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:1640
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:1586
virtual string GetTextAltClick(ButtonGrid b)
Definition: InvOwner.cs:1092
virtual Thing CreateDefaultContainer()
Definition: InvOwner.cs:695
virtual bool IsFailByCurse(Thing t)
Definition: InvOwner.cs:1685
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:1482
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:1658
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:1545
bool TryHold(Thing t)
Definition: InvOwner.cs:1458
virtual bool CanShiftClick(ButtonGrid b, bool rightMouse=false)
Definition: InvOwner.cs:976
virtual string IDCostIcon(Thing t)
Definition: InvOwner.cs:1680
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:7
static string _currency(object a, string IDCurrency)
Definition: Lang.cs:165
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:1570
void SetPriorityAction(string id, Thing t)
Definition: Player.cs:1540
void ModKarma(int a)
Definition: Player.cs:2610
void RefreshCurrentHotItem()
Definition: Player.cs:2271
bool TryWitnessCrime(Chara criminal, Chara target=null, int radius=4, Func< Chara, bool > funcWitness=null)
Definition: Point.cs:878
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:515
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:1854
override int GetPrice(CurrencyType currency=CurrencyType.Money, bool sell=false, PriceType priceType=PriceType.Default, Chara c=null)
Definition: Thing.cs:829
override bool CanStackTo(Thing to)
Definition: Thing.cs:1697
Thing Identify(bool show=true, IDTSource idtSource=IDTSource.Identify)
Definition: Thing.cs:2128
Definition: Trait.cs:7
virtual bool HoldAsDefaultInteraction
Definition: Trait.cs:133
virtual bool AllowSell
Definition: Trait.cs:548
virtual bool CanOpenContainer
Definition: Trait.cs:246
virtual bool CanCopy(Thing t)
Definition: Trait.cs:1642
virtual ContainerType ContainerType
Definition: Trait.cs:259
virtual bool CanBeDropped
Definition: Trait.cs:313
virtual bool IsContainer
Definition: Trait.cs:225
virtual bool CanOnlyCarry
Definition: Trait.cs:305
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:163
static void Redraw()
Definition: WidgetEquip.cs:77