Elin Decompiled Documentation EA 23.344.1 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 != CurrencyType.None && (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 != CurrencyType.None)
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 != CurrencyType.None)
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)
646 {
647 if (t.IsCursed)
648 {
649 return false;
650 }
651 if (t.GetBool(135))
652 {
653 return false;
654 }
655 }
657 {
658 if (t.id == "money")
659 {
660 return false;
661 }
662 if (t.isGifted || t.isNPCProperty)
663 {
664 return false;
665 }
667 {
668 return false;
669 }
670 return true;
671 }
672 if (!t.trait.CanOnlyCarry)
673 {
675 {
676 return !FreeTransfer;
677 }
678 return true;
679 }
680 return false;
681 }
682
683 public virtual bool AllowMoved(Thing t)
684 {
685 return true;
686 }
687
688 public virtual bool ShouldShowGuide(Thing t)
689 {
690 return false;
691 }
692
693 public virtual bool AllowDrop(Thing t)
694 {
696 {
697 return t.trait is TraitAbility;
698 }
699 return true;
700 }
701
703 {
704 return ThingGen.Create("chest3");
705 }
706
707 public virtual void BuildUICurrency(UICurrency uiCurrency, bool canReroll = false)
708 {
709 bool flag = Container.isChara && !Container.IsPC;
710 uiCurrency.SetActive(currency != CurrencyType.None || flag);
711 uiCurrency.target = owner;
712 if (currency != CurrencyType.None || flag)
713 {
714 uiCurrency.Build(new UICurrency.Options
715 {
716 weight = flag,
717 money = (currency == CurrencyType.Money),
718 plat = (currency == CurrencyType.Plat),
719 medal = (currency == CurrencyType.Medal),
720 money2 = (currency == CurrencyType.Money2),
721 influence = (currency == CurrencyType.Influence),
722 casino = (currency == CurrencyType.Casino_coin),
723 ecopo = (currency == CurrencyType.Ecopo)
724 });
725 }
726 }
727
728 public bool IsWeightOver(Thing t)
729 {
730 return false;
731 }
732
733 public InvOwner(Card owner, Card container = null, CurrencyType _currency = CurrencyType.None, PriceType _price = PriceType.Default)
734 {
735 currency = _currency;
736 priceType = _price;
737 this.owner = owner;
738 Container = container ?? owner;
739 if (currency == CurrencyType.BranchMoney)
740 {
742 }
743 }
744
745 public void Init()
746 {
747 if (owner == null)
748 {
751 owner.c_lockLv = 0;
752 owner.c_IDTState = 0;
754 }
755 OnInit();
756 forceGive = new ForceGiveData();
757 }
758
759 public virtual void OnInit()
760 {
761 }
762
763 public virtual void OnClick(ButtonGrid button)
764 {
765 Card card = button.card;
766 Card card2 = button.invOwner.owner;
767 if (card == null || EClass.ui.currentDrag != null)
768 {
769 return;
770 }
771 bool flag = false;
772 if (card.Thing.isEquipped && card.GetBool(135))
773 {
774 SE.Play("curse3");
775 }
776 else if (card.Thing.isEquipped && card.Thing.IsEquipmentOrRanged && card.Thing.IsCursed)
777 {
778 SE.Play("curse3");
779 }
780 else if (!AllowHold(card.Thing) && card2.isChara && !card2.IsPC && card2.IsPCFaction)
781 {
782 if (forceGive.card != card)
783 {
784 forceGive.card = card;
785 forceGive.tries = 0;
786 }
787 else
788 {
789 if (!EInput.isShiftDown)
790 {
792 }
793 if (forceGive.tries >= 2)
794 {
795 if (card.HasTag(CTAG.gift) && card.isGifted)
796 {
797 EClass.ui.CloseLayers();
798 card2.Say("angry", card2);
799 card2.ShowEmo(Emo.angry);
800 card2.Talk("noGiveRing");
801 card2.Chara.ModAffinity(EClass.pc, -30);
802 card2.Chara.InstantEat(card.Thing);
803 return;
804 }
805 forceGive.card = null;
806 flag = true;
807 bool flag2 = card.trait is TraitCurrency;
808 card.isGifted = false;
809 card.isNPCProperty = false;
810 card2.Talk(flag2 ? "forceGiveCurrency" : "forceGive");
811 int num = ((!flag2) ? 1 : 3);
812 if (card.id == "money")
813 {
814 num += card.Num / 1000;
815 }
816 if (num >= 5)
817 {
818 num = 5;
819 }
820 EClass.player.ModKarma(-num);
821 EClass.pc.Pick(card.Thing);
822 return;
823 }
824 }
825 }
826 if (AllowHold(card.Thing) || flag)
827 {
828 if (EInput.isAltDown)
829 {
830 if (CanAltClick(button))
831 {
832 OnAltClick(button);
833 }
834 else
835 {
836 SE.BeepSmall();
837 }
838 }
839 else if (EInput.isCtrlDown)
840 {
841 if (CanCtrlClick(button))
842 {
843 OnCtrlClick(button);
844 }
845 else
846 {
847 SE.BeepSmall();
848 }
849 }
850 else if (EInput.isShiftDown)
851 {
852 if (CanShiftClick(button))
853 {
854 OnShiftClick(button);
855 }
856 else
857 {
858 SE.BeepSmall();
859 }
860 }
861 else if (!owner.IsPC)
862 {
863 new Transaction(button, (HasTrader && !FreeTransfer) ? 1 : card.Num).Process(startTransaction: true);
864 }
865 else if (button.card == null || !IsFailByCurse(button.card.Thing))
866 {
867 EClass.ui.StartDrag(new DragItemCard(button));
868 }
869 }
870 else
871 {
872 SE.BeepSmall();
873 if (card2.isChara && !card2.IsPC)
874 {
875 card2.Talk("noGive");
876 }
877 }
878 }
879
880 public virtual void OnRightClick(ButtonGrid button)
881 {
882 if (!AllowAutouse)
883 {
884 OnClick(button);
885 }
886 if (button.card != null)
887 {
888 AutoUse(button);
889 }
890 }
891
892 public virtual void OnRightPressed(ButtonGrid button)
893 {
895 {
896 return;
897 }
898 float num = 1f;
899 float pressedTimer = EInput.rightMouse.pressedTimer;
900 if (pressedTimer > 2f)
901 {
902 num = 2f;
903 }
904 else if (pressedTimer > 4f)
905 {
906 num = 5f;
907 }
908 else if (pressedTimer > 6f)
909 {
910 num = 50f;
911 }
912 clickTimer -= Core.delta * num;
913 if (clickTimer < 0f)
914 {
915 clickTimer = 0.1f;
916 if (button.card != null)
917 {
918 AutoUse(button, repeat: true);
919 }
920 }
921 }
922
923 public InvOwner GetShitDestOwner(ButtonGrid b, bool rightMouse = false)
924 {
925 Thing thing = b.card.Thing;
926 if (rightMouse && !b.invOwner.owner.IsPC)
927 {
928 return LayerInventory.GetPCLayer()?.Inv;
929 }
930 if (Trader != null)
931 {
932 if (b.invOwner.owner.IsPC)
933 {
934 if (!Trader.Container.things.IsFull(thing))
935 {
936 return Trader;
937 }
938 return null;
939 }
940 return LayerInventory.GetTopLayer(thing, includePlayer: true, Trader)?.Inv;
941 }
942 LayerInventory topLayer = LayerInventory.GetTopLayer(thing, includePlayer: true, this);
943 if (topLayer == null)
944 {
945 return null;
946 }
947 return topLayer.Inv;
948 }
949
950 public virtual void OnShiftClick(ButtonGrid b, bool rightMouse = false)
951 {
952 InvOwner shitDestOwner = GetShitDestOwner(b, rightMouse);
953 Thing thing = b.card.Thing;
954 if (thing == null || thing.isDestroyed)
955 {
956 return;
957 }
958 Card container = shitDestOwner.Container;
959 if (rightMouse && !owner.IsPC)
960 {
961 EClass.pc.Pick(thing, msg: false);
962 return;
963 }
964 if ((thing.parent == container || thing == container) && !thing.IsHotItem)
965 {
967 {
968 SE.BeepSmall();
969 }
970 return;
971 }
972 thing.PlaySoundDrop(spatial: false);
973 if (thing.IsHotItem && thing.parent == container)
974 {
975 container.RemoveCard(thing);
976 }
977 if (container.things.CanStack(thing) != thing)
978 {
979 container.things.TryStack(thing);
980 }
981 else
982 {
983 container.AddThing(thing);
984 }
985 }
986
987 public virtual bool CanShiftClick(ButtonGrid b, bool rightMouse = false)
988 {
989 if (!EInput.isShiftDown && !rightMouse)
990 {
991 return false;
992 }
994 {
995 return false;
996 }
997 if (rightMouse && !HasTrader)
998 {
999 return false;
1000 }
1001 if (HasTrader)
1002 {
1004 {
1005 return false;
1006 }
1008 {
1009 return false;
1010 }
1011 Card card = b.card;
1012 if (card != null && card.c_isImportant)
1013 {
1014 return false;
1015 }
1016 }
1017 InvOwner shitDestOwner = GetShitDestOwner(b, rightMouse);
1018 if (shitDestOwner == null)
1019 {
1020 return false;
1021 }
1022 Thing thing = b.card.Thing;
1023 if (thing.trait.IsContainer && thing.things.Count > 0)
1024 {
1025 return false;
1026 }
1027 if (!AllowHold(thing))
1028 {
1029 return false;
1030 }
1031 if (HasTrader)
1032 {
1034 {
1035 return false;
1036 }
1037 if (!Trader.AllowMoved(thing))
1038 {
1039 return false;
1040 }
1041 }
1042 if (shitDestOwner.Container.isChara && !shitDestOwner.owner.IsPC && !shitDestOwner.owner.Chara.CanAcceptItem(thing))
1043 {
1044 return false;
1045 }
1046 if (EInput.isShiftDown)
1047 {
1048 LayerInventory.highlightInv = shitDestOwner;
1049 }
1050 return true;
1051 }
1052
1053 public virtual string GetTextShiftClick(ButtonGrid b)
1054 {
1055 return "actTransfer".lang();
1056 }
1057
1058 public virtual void OnCtrlClick(ButtonGrid button)
1059 {
1060 button.card.Thing.ShowSplitMenu(button, HasTransaction ? new Transaction(button) : null);
1061 }
1062
1063 public virtual bool CanCtrlClick(ButtonGrid b)
1064 {
1065 if (!EInput.isCtrlDown)
1066 {
1067 return false;
1068 }
1069 if (!EClass.pc.HasNoGoal || Container.isNPCProperty || b.card.Num <= 1)
1070 {
1071 return false;
1072 }
1073 return true;
1074 }
1075
1076 public virtual string GetTextCtrlClick(ButtonGrid b)
1077 {
1078 return "actSplit".lang();
1079 }
1080
1081 public virtual void OnAltClick(ButtonGrid button)
1082 {
1083 EClass.pc.DropThing(button.card.Thing);
1084 }
1085
1086 public virtual bool CanAltClick(ButtonGrid b)
1087 {
1088 if (!EInput.isAltDown)
1089 {
1090 return false;
1091 }
1093 {
1094 return false;
1095 }
1096 if (!AllowDrop(b.card.Thing))
1097 {
1098 return false;
1099 }
1100 return true;
1101 }
1102
1103 public virtual string GetTextAltClick(ButtonGrid b)
1104 {
1105 return "actDrop".lang();
1106 }
1107
1108 public void Grab(DragItemCard.DragInfo from)
1109 {
1110 bool isEquipped = from.thing.isEquipped;
1111 if (isEquipped)
1112 {
1113 from.invOwner.owner.Chara.body.Unequip(from.thing);
1114 }
1116 if (isEquipped)
1117 {
1118 from.list.Redraw();
1119 }
1121 }
1122
1124 {
1125 Thing thing = from.thing;
1126 if (from.invY == 1 && from.container.things.IsOccupied(from.invX, from.invY))
1127 {
1128 return EClass.pc.Pick(thing, msg: false);
1129 }
1130 if (from.container.things.IsFull(thing, recursive: false, tryStack: false))
1131 {
1132 return EClass.pc.Pick(thing, msg: false);
1133 }
1134 thing.invY = from.invY;
1135 thing = from.container.AddThing(thing, tryStack: true, from.invX, from.invY);
1136 if (from.equippedSlot != null)
1137 {
1138 from.invOwner.owner.Chara.body.Equip(thing, from.equippedSlot);
1139 from.list.Redraw();
1140 }
1141 else
1142 {
1143 thing.invX = from.invX;
1144 }
1145 if (from.invY == 1)
1146 {
1147 WidgetCurrentTool.dirty = true;
1148 }
1149 return thing;
1150 }
1151
1153 {
1154 from.thing.PlaySoundDrop(spatial: false);
1155 if (from.thing.parent != null)
1156 {
1157 Grab(from);
1158 }
1159 if (from.thing.IsEquipment)
1160 {
1161 WidgetEquip.dragEquip = from.thing;
1163 }
1164 }
1165
1166 public virtual bool OnCancelDrag(DragItemCard.DragInfo from)
1167 {
1169 {
1170 return false;
1171 }
1172 PutBack(from);
1173 return true;
1174 }
1175
1176 public virtual bool OnDrag(DragItemCard.DragInfo from, DragItemCard.DragInfo to, bool execute, bool cancel = false)
1177 {
1178 if (cancel)
1179 {
1180 return OnCancelDrag(from);
1181 }
1182 bool flag = false;
1183 string text = "";
1184 if ((object)EClass.ui.GetLayer<LayerRegisterHotbar>() == null)
1185 {
1186 EClass.ui.AddLayer<LayerRegisterHotbar>().SetItem(from.thing);
1187 }
1188 LayerInventory componentOf = InputModuleEX.GetComponentOf<LayerInventory>();
1189 if (!EClass.ui.isPointerOverUI && !EClass._zone.IsRegion)
1190 {
1191 flag = AllowDropOnDrag;
1192 text = ((!AllowDropOnDrag) ? "" : ((from.thing.trait is TraitAbility) ? "dragForget" : "dragDropThing"));
1193 if (execute)
1194 {
1195 if (!AllowDropOnDrag || from.thing.c_isImportant)
1196 {
1197 return OnCancelDrag(from);
1198 }
1199 EClass.pc.DropThing(from.thing);
1200 return true;
1201 }
1202 }
1203 else if (!EClass.core.config.game.useGrid && (bool)componentOf)
1204 {
1205 if ((bool)to.button && to.invOwner != null && to.thing != null && to.thing.CanStackTo(from.thing))
1206 {
1207 Transaction transaction = new Transaction(from, to, from.thing.Num);
1208 flag = transaction.IsValid();
1209 text = transaction.GetTextDetail();
1210 if (execute)
1211 {
1212 return transaction.Process();
1213 }
1214 }
1215 else
1216 {
1217 Transaction transaction2 = new Transaction(from, componentOf.invs[0], from.thing.Num);
1218 flag = transaction2.IsValid();
1219 text = transaction2.GetTextDetail();
1220 if (execute)
1221 {
1222 return transaction2.Process();
1223 }
1224 }
1225 }
1226 else if ((bool)to.button && to.invOwner != null && to.button.interactable)
1227 {
1228 if (to.invOwner is InvOwnerEquip)
1229 {
1230 InvOwnerEquip invOwnerEquip = to.invOwner as InvOwnerEquip;
1231 Chara chara = invOwnerEquip.owner.Chara;
1232 BodySlot slot = invOwnerEquip.slot;
1233 if (execute && to.thing != null)
1234 {
1235 if (to.thing.blessedState <= BlessedState.Cursed)
1236 {
1237 Msg.Say("unequipCursed", to.thing);
1238 return false;
1239 }
1240 if (to.thing.c_DNA != null && to.thing.GetBool(135))
1241 {
1242 Msg.Say("isSleepLock", to.thing);
1243 return false;
1244 }
1245 }
1246 if (from.thing.category.slot == slot.elementId)
1247 {
1248 flag = true;
1249 text = "dragEquip";
1250 if (execute)
1251 {
1252 if (!chara.body.IsEquippable(from.thing, slot))
1253 {
1254 return false;
1255 }
1256 chara.AddCard(from.thing);
1257 if (to.thing != null)
1258 {
1259 EClass.ui.nextDrag = new DragItemCard(to.button);
1260 Grab(to);
1261 }
1262 chara.body.Equip(from.thing, invOwnerEquip.slot);
1263 EClass.Sound.Play("equip");
1264 if (EClass.game.UseGrid)
1265 {
1266 from.list.Redraw();
1267 }
1268 to.list.Redraw();
1269 to.invOwner.OnProcess(from.thing);
1270 return true;
1271 }
1272 }
1273 }
1274 else
1275 {
1276 if (to.invOwner is InvOwnerCopyShop && !to.invOwner.owner.trait.CanCopy(from.thing))
1277 {
1278 return false;
1279 }
1280 if (!to.invOwner.AllowTransfer)
1281 {
1282 return false;
1283 }
1284 Transaction transaction3 = new Transaction(from, to, from.thing.Num);
1285 flag = transaction3.IsValid();
1286 text = transaction3.GetTextDetail();
1287 if (execute)
1288 {
1289 return transaction3.Process();
1290 }
1291 }
1292 }
1293 EClass.ui.hud.SetDragText(flag ? text : "", (from.thing.Num > 1) ? (from.thing.Num.ToString() ?? "") : null);
1294 CursorSystem.SetCursor(flag ? null : CursorSystem.Invalid, 100);
1295 return false;
1296 }
1297
1298 public virtual void OnProcess(Thing t)
1299 {
1300 }
1301
1303 {
1304 if (t.trait.CanOpenContainer)
1305 {
1306 if (t.parent != EClass.pc)
1307 {
1308 return (t.parent as Thing)?.trait is TraitToolBelt;
1309 }
1310 return true;
1311 }
1312 return false;
1313 }
1314
1316 {
1317 ListInteraction listInteraction = new ListInteraction();
1318 if (b == null || b.card == null || this is InvOwnerAlly)
1319 {
1320 return listInteraction;
1321 }
1322 Thing t = b.card.Thing;
1323 if (t == null)
1324 {
1325 return listInteraction;
1326 }
1327 listInteraction.thing = t;
1328 Trait trait = t.trait;
1329 bool flag = trait is TraitAbility;
1330 if (HasTrader)
1331 {
1332 if (Trader == null || destInvOwner == null)
1333 {
1334 return listInteraction;
1335 }
1336 if (CanOpenContainer(t))
1337 {
1338 listInteraction.Add("actContainer", 10, delegate
1339 {
1340 (t.trait as TraitContainer).TryOpen();
1341 });
1342 }
1343 bool flag2 = !flag && !trait.CanOnlyCarry && (!destInvOwner.UseGuide || destInvOwner.ShouldShowGuide(t));
1344 bool flag3 = ShopTransaction.current != null && ShopTransaction.current.CanSellBack(t);
1345 if (destInvOwner == Trader && !Trader.AllowSell && !flag3)
1346 {
1347 flag2 = false;
1348 }
1349 if (!AllowHold(t))
1350 {
1351 flag2 = false;
1352 }
1353 if (!Trader.AllowMoved(t))
1354 {
1355 flag2 = false;
1356 }
1357 if (flag2 && (!t.c_isImportant || !destInvOwner.DenyImportant))
1358 {
1359 if (!flag3 && (Trader.currency == CurrencyType.None || (Trader.currency != CurrencyType.Influence && t.GetPrice(Trader.currency, sell: false, Trader.priceType) == 0)))
1360 {
1361 Transaction trans = new Transaction(b, t.Num);
1362 if (trans.IsValid())
1363 {
1364 listInteraction.Add(Container.isNPCProperty ? "actSteal".lang().TagColor(FontColor.Bad, SkinManager.DarkColors) : destInvOwner.langTransfer, 0, delegate
1365 {
1366 if (Container.isNPCProperty)
1367 {
1368 Dialog.TryWarnCrime(delegate
1369 {
1370 trans.Process();
1371 });
1372 }
1373 else
1374 {
1375 trans.Process();
1376 }
1377 });
1378 }
1379 }
1380 else
1381 {
1382 bool isShiftDown = EInput.isShiftDown;
1383 Transaction trans2 = new Transaction(b);
1384 listInteraction.Add(trans2.GetTextDetail(), 0, delegate
1385 {
1386 trans2.Process();
1387 }).repeatable = true;
1388 if (t.Num > 1)
1389 {
1390 Transaction trans3 = new Transaction(b, t.Num);
1391 listInteraction.Add(trans3.GetTextDetail(), 10, delegate
1392 {
1393 trans3.Process();
1394 });
1395 if (isShiftDown)
1396 {
1397 listInteraction.Add(listInteraction[0]);
1398 listInteraction.RemoveAt(0);
1399 }
1400 }
1401 }
1402 }
1403 }
1404 ListInteractions(listInteraction, t, trait, b, context);
1405 if (AllowHold(t) && !t.isEquipped && !HasTrader)
1406 {
1407 Interaction item = listInteraction.Add((EClass.pc.held == t) ? "actPick" : "actHold", 60, delegate
1408 {
1409 TryHold(t);
1410 });
1411 if (t.trait.HoldAsDefaultInteraction)
1412 {
1413 listInteraction.Remove(item);
1414 listInteraction.Insert(0, item);
1415 }
1416 if (t.trait.CanBeHeldAsFurniture)
1417 {
1418 listInteraction.Add("actHoldTool", 70, delegate
1419 {
1420 if (t != EClass.pc.held)
1421 {
1422 if (TryHold(t))
1423 {
1424 HotItemHeld.disableTool = true;
1425 }
1426 }
1427 else
1428 {
1429 HotItemHeld.disableTool = true;
1430 }
1431 }, "remove");
1432 }
1433 }
1434 if (context)
1435 {
1436 if (AllowHold(t) && !Container.isNPCProperty)
1437 {
1438 if (t.Num > 1)
1439 {
1440 listInteraction.Add("actSplit", 50, delegate
1441 {
1442 t.ShowSplitMenu(b, (HasTrader && currency != CurrencyType.None && !owner.IsPC) ? new Transaction(b) : null);
1443 });
1444 }
1445 if ((owner.IsPC || Container.IsPCFactionOrMinion) && AllowDrop(t))
1446 {
1447 listInteraction.Add(flag ? "dragForget" : "actDrop", 300, delegate
1448 {
1449 EClass.pc.DropThing(t);
1450 });
1451 }
1452 }
1453 bool flag4 = false;
1454 if (owner.IsPC || Container.IsPCFactionOrMinion)
1455 {
1456 flag4 = true;
1457 listInteraction.Add(t.c_isImportant ? "important_off" : "important_on", 299, delegate
1458 {
1459 t.c_isImportant = !t.c_isImportant;
1460 LayerInventory.SetDirty(t);
1461 SE.ClickOk();
1462 });
1463 }
1464 if (!flag4 && t.c_isImportant)
1465 {
1466 listInteraction.Add(t.c_isImportant ? "important_off" : "important_on", 299, delegate
1467 {
1468 t.c_isImportant = !t.c_isImportant;
1469 LayerInventory.SetDirty(t);
1470 SE.ClickOk();
1471 });
1472 }
1473 }
1474 return listInteraction;
1475 }
1476
1477 public bool TryHold(Thing t)
1478 {
1479 if (!AllowHold(t) || t.isEquipped || HasTrader)
1480 {
1481 return false;
1482 }
1483 if (EClass.pc.held == t)
1484 {
1485 if (t.trait.CanOnlyCarry)
1486 {
1487 SE.Beep();
1488 return true;
1489 }
1490 EClass.pc.PickHeld();
1491 }
1492 else
1493 {
1494 EClass.pc.HoldCard(t);
1495 }
1497 SE.SelectHotitem();
1498 return true;
1499 }
1500
1501 public virtual void ListInteractions(ListInteraction list, Thing t, Trait trait, ButtonGrid b, bool context)
1502 {
1503 if (!owner.IsPC)
1504 {
1505 return;
1506 }
1507 if (CanOpenContainer(t) && !list.Contains("actContainer"))
1508 {
1509 list.Add(LayerInventory.IsOpen(t) ? "close" : "actContainer", 100, delegate
1510 {
1511 (t.trait as TraitContainer).TryOpen();
1512 });
1513 }
1514 if (HasTrader)
1515 {
1516 return;
1517 }
1518 CharaBody body = owner.Chara.body;
1519 BodySlot slot = body.GetSlot(t, onlyEmpty: false, EInput.isShiftDown);
1520 if (slot != null)
1521 {
1522 Card tParent = t.parentCard;
1523 int tInvX = t.invX;
1524 int tInvY = t.invY;
1525 if (tInvY != 1)
1526 {
1527 list.Add("invEquip", 90, delegate
1528 {
1529 if (slot.thing != null)
1530 {
1531 if (slot.thing.blessedState <= BlessedState.Cursed)
1532 {
1533 Msg.Say("unequipCursed", slot.thing);
1534 SE.Play("curse3");
1535 return;
1536 }
1537 if (slot.thing.c_DNA != null && slot.thing.GetBool(135))
1538 {
1539 Msg.Say("isSleepLock", slot.thing);
1540 SE.Play("curse3");
1541 return;
1542 }
1543 }
1544 if (EClass.pc.held == t)
1545 {
1546 EClass.pc.PickHeld();
1547 }
1548 Thing thing = slot.thing;
1549 body.Equip(t, slot);
1550 EClass.Sound.Play("equip");
1551 if (thing != null)
1552 {
1553 if (tParent != null)
1554 {
1555 tParent.AddThing(thing);
1556 thing.invX = tInvX;
1557 thing.invY = tInvY;
1558 }
1559 else if (thing.parent is Card && (thing.parent as Card).things.IsOverflowing())
1560 {
1561 thing.parent.RemoveCard(thing);
1562 EClass.pc.Pick(thing);
1563 }
1564 }
1565 });
1566 }
1567 }
1568 trait.OnListInteraction(list, b, context);
1569 }
1570
1571 public virtual string GetAutoUseLang(ButtonGrid button)
1572 {
1573 if (button == null || button.gameObject == null)
1574 {
1575 return "";
1576 }
1577 ListInteraction list = ListInteractions(button, context: false);
1578 foreach (Interaction item in list)
1579 {
1580 if (EClass.player.IsPriorityAction(item.idPriority, list.thing))
1581 {
1582 list.Insert(0, item);
1583 break;
1584 }
1585 }
1586 if (button.card.trait.HoldAsDefaultInteraction && list.Count > 0)
1587 {
1588 Interaction interaction = list[0];
1589 if (interaction.name == "actPick" || interaction.name == "actHold" || interaction.name == "actHoldTool")
1590 {
1591 return null;
1592 }
1593 }
1594 list.ForeachReverse(delegate(Interaction a)
1595 {
1596 if (a.name == "actPick" || a.name == "actHold" || a.name == "actHoldTool")
1597 {
1598 list.Remove(a);
1599 }
1600 });
1601 if (list.Count == 0)
1602 {
1603 return null;
1604 }
1605 if (list[0].name == "actTransfer")
1606 {
1607 return null;
1608 }
1609 return list[0].name.lang();
1610 }
1611
1612 public void AutoUse(ButtonGrid button, bool repeat = false)
1613 {
1614 _ = button.card;
1616 {
1617 return;
1618 }
1619 if (!EClass.pc.HasNoGoal)
1620 {
1621 SE.Beep();
1622 return;
1623 }
1624 ListInteraction listInteraction = ListInteractions(button, context: false);
1625 if (listInteraction.Count == 0)
1626 {
1627 SE.Beep();
1628 return;
1629 }
1630 foreach (Interaction item in listInteraction)
1631 {
1632 if (EClass.player.IsPriorityAction(item.idPriority, listInteraction.thing))
1633 {
1634 listInteraction.Insert(0, item);
1635 break;
1636 }
1637 }
1638 if (!repeat || listInteraction[0].repeatable)
1639 {
1640 listInteraction[0].action();
1641 }
1642 }
1643
1644 public void ShowContextMenu(ButtonGrid button)
1645 {
1646 if (!EClass.pc.HasNoGoal)
1647 {
1648 SE.Beep();
1649 return;
1650 }
1651 ListInteraction listInteraction = ListInteractions(button, context: true);
1652 if (listInteraction.Count == 0)
1653 {
1654 SE.BeepSmall();
1655 return;
1656 }
1657 UIContextMenu uIContextMenu = EClass.ui.CreateContextMenuInteraction();
1658 listInteraction.Sort((Interaction a, Interaction b) => a.priority - b.priority);
1659 foreach (Interaction item in listInteraction)
1660 {
1661 uIContextMenu.AddButton(item.name, item.action);
1662 }
1663 uIContextMenu.Show();
1664 }
1665
1666 public virtual int GetPrice(Thing t, CurrencyType currency, int num, bool sell)
1667 {
1668 return ShopTransaction.current.GetPrice(t, num, sell);
1669 }
1670
1671 public virtual string GetTextDetail(Thing t, CurrencyType currency, int num, bool sell)
1672 {
1673 int price = GetPrice(t, currency, num, sell);
1674 string @ref = (Trader.UseHomeResource ? Trader.homeResource.Name : ((currency == CurrencyType.Influence) ? "influence".lang() : EClass.sources.things.map[IDCurrency].GetName()));
1675 string ref2 = ((price == 0) ? "" : "invInteraction3".lang(price.ToFormat() ?? "", @ref));
1676 string text = "invInteraction1".lang(num.ToString() ?? "", ref2, (sell ? "invSell" : "invBuy").lang());
1677 if (!sell && EClass.pc.GetCurrency(Currency.ToID(currency)) < price)
1678 {
1679 text = text.TagColor(FontColor.Bad, SkinManager.DarkColors);
1680 }
1681 return text;
1682 }
1683
1684 public virtual void OnWriteNote(ButtonGrid button, UINote n)
1685 {
1686 if (button.card is Thing t)
1687 {
1688 bool flag = HasTrader && Trader.currency != CurrencyType.None && (destInvOwner != Trader || Trader.AllowSell || (ShopTransaction.current?.CanSellBack(t) ?? false));
1689 if (flag && Trader.UseGuide && !Trader.ShouldShowGuide(t))
1690 {
1691 flag = false;
1692 }
1693 if (flag)
1694 {
1695 Transaction transaction = new Transaction(button);
1696 n.Space(8);
1697 UIItem uIItem = n.AddExtra<UIItem>("costPrice");
1698 string id = IDCostIcon(t);
1699 int price = transaction.GetPrice();
1700 uIItem.text1.SetText(Lang._currency(price), transaction.IsValid() ? FontColor.Good : FontColor.Bad);
1701 uIItem.image1.sprite = (Trader.UseHomeResource ? Trader.homeResource.Sprite : SpriteSheet.Get(id));
1702 }
1703 }
1704 }
1705
1706 public virtual string IDCostIcon(Thing t)
1707 {
1708 return "icon_" + IDCurrency;
1709 }
1710
1711 public virtual bool IsFailByCurse(Thing t)
1712 {
1713 return false;
1714 }
1715}
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:2342
virtual Chara Chara
Definition: Card.cs:2122
Thing Split(int a)
Definition: Card.cs:3665
string id
Definition: Card.cs:36
bool isNPCProperty
Definition: Card.cs:557
void SetInt(string id, int value=0)
Definition: Card.cs:2586
int c_lockLv
Definition: Card.cs:991
Card AddCard(Card c)
Definition: Card.cs:3266
int invY
Definition: Card.cs:2007
bool IsCursed
Definition: Card.cs:2309
Thing AddThing(string id, int lv=-1)
Definition: Card.cs:3280
void Talk(string idTopic, string ref1=null, string ref2=null, bool forceSync=false)
Definition: Card.cs:7205
ICardParent parent
Definition: Card.cs:56
bool IsHotItem
Definition: Card.cs:122
int GetCurrency(string id="money")
Definition: Card.cs:4156
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:6613
Trait trait
Definition: Card.cs:54
void ModCurrency(int a, string id="money")
Definition: Card.cs:4142
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:3607
bool GetBool(string id)
Definition: Card.cs:2557
int invX
Definition: Card.cs:1995
virtual bool IsPCFaction
Definition: Card.cs:2339
bool isGifted
Definition: Card.cs:785
BlessedState blessedState
Definition: Card.cs:281
void PlaySoundDrop(bool spatial=true)
Definition: Card.cs:6630
Card parentCard
Definition: Card.cs:106
DNA c_DNA
Definition: Card.cs:1933
int Num
Definition: Card.cs:161
SourceCategory.Row category
Definition: Card.cs:2101
bool IsIdentified
Definition: Card.cs:2447
void RemoveCard(Card c)
Definition: Card.cs:3271
void Say(string lang, string ref1=null, string ref2=null)
Definition: Card.cs:7323
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:114
bool Equip(Thing thing, BodySlot slot=null, bool msg=true)
Definition: CharaBody.cs:213
BodySlot GetSlot(Thing t, bool onlyEmpty=false, bool secondSlot=false)
Definition: CharaBody.cs:398
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:8028
void ModAffinity(Chara c, int a, bool show=true, bool showOnlyEmo=false)
Definition: Chara.cs:8409
override bool IsPC
Definition: Chara.cs:630
bool CanAcceptItem(Card t, int num=-1, bool skipImportantCheck=false)
Definition: Chara.cs:8723
void HoldCard(Card t, int num=-1)
Definition: Chara.cs:4741
void PickHeld(bool msg=false)
Definition: Chara.cs:4797
void GiveLovePotion(Chara c, Thing t)
Definition: Chara.cs:8910
Affinity affinity
Definition: Chara.cs:318
bool HasNoGoal
Definition: Chara.cs:1047
void DropThing(Thing t, int num=-1)
Definition: Chara.cs:4894
bool TryEquip(Thing t, bool useFav=false)
Definition: Chara.cs:8190
Thing Pick(Thing t, bool msg=true, bool tryStack=true)
Definition: Chara.cs:4577
new GameConfig game
Definition: CoreConfig.cs:627
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:745
void Grab(DragItemCard.DragInfo from)
Definition: InvOwner.cs:1108
virtual int destInvY
Definition: InvOwner.cs:589
virtual void OnInit()
Definition: InvOwner.cs:759
bool includeChildren
Definition: InvOwner.cs:525
virtual bool OnCancelDrag(DragItemCard.DragInfo from)
Definition: InvOwner.cs:1166
virtual bool CanCtrlClick(ButtonGrid b)
Definition: InvOwner.cs:1063
virtual void BuildUICurrency(UICurrency uiCurrency, bool canReroll=false)
Definition: InvOwner.cs:707
virtual void OnShiftClick(ButtonGrid b, bool rightMouse=false)
Definition: InvOwner.cs:950
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:923
virtual void OnProcess(Thing t)
Definition: InvOwner.cs:1298
static float clickTimer
Definition: InvOwner.cs:523
static bool HasTrader
Definition: InvOwner.cs:539
void ShowContextMenu(ButtonGrid button)
Definition: InvOwner.cs:1644
virtual string GetTextDetail(Thing t, CurrencyType currency, int num, bool sell)
Definition: InvOwner.cs:1671
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:1058
virtual int GetPrice(Thing t, CurrencyType currency, int num, bool sell)
Definition: InvOwner.cs:1666
virtual bool AllowTransfer
Definition: InvOwner.cs:574
InvOwner(Card owner, Card container=null, CurrencyType _currency=CurrencyType.None, PriceType _price=PriceType.Default)
Definition: InvOwner.cs:733
virtual void OnAltClick(ButtonGrid button)
Definition: InvOwner.cs:1081
string IDCurrency
Definition: InvOwner.cs:637
void AutoUse(ButtonGrid button, bool repeat=false)
Definition: InvOwner.cs:1612
virtual string GetTextAltClick(ButtonGrid b)
Definition: InvOwner.cs:1103
virtual Thing CreateDefaultContainer()
Definition: InvOwner.cs:702
virtual bool IsFailByCurse(Thing t)
Definition: InvOwner.cs:1711
virtual string GetTextCtrlClick(ButtonGrid b)
Definition: InvOwner.cs:1076
bool IsWeightOver(Thing t)
Definition: InvOwner.cs:728
virtual bool AllowMoved(Thing t)
Definition: InvOwner.cs:683
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:880
List< ButtonGrid > buttons
Definition: InvOwner.cs:537
virtual bool OnDrag(DragItemCard.DragInfo from, DragItemCard.DragInfo to, bool execute, bool cancel=false)
Definition: InvOwner.cs:1176
virtual bool UseGuide
Definition: InvOwner.cs:571
ListInteraction ListInteractions(ButtonGrid b, bool context)
Definition: InvOwner.cs:1315
virtual bool CanAltClick(ButtonGrid b)
Definition: InvOwner.cs:1086
virtual bool AllowDrop(Thing t)
Definition: InvOwner.cs:693
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:1501
Chara Chara
Definition: InvOwner.cs:613
static ForceGiveData forceGive
Definition: InvOwner.cs:517
virtual void OnRightPressed(ButtonGrid button)
Definition: InvOwner.cs:892
virtual void OnClick(ButtonGrid button)
Definition: InvOwner.cs:763
virtual void OnWriteNote(ButtonGrid button, UINote n)
Definition: InvOwner.cs:1684
bool CanOpenContainer(Thing t)
Definition: InvOwner.cs:1302
void OnStartDrag(DragItemCard.DragInfo from)
Definition: InvOwner.cs:1152
virtual string GetTextShiftClick(ButtonGrid b)
Definition: InvOwner.cs:1053
virtual string GetAutoUseLang(ButtonGrid button)
Definition: InvOwner.cs:1571
bool TryHold(Thing t)
Definition: InvOwner.cs:1477
virtual bool CanShiftClick(ButtonGrid b, bool rightMouse=false)
Definition: InvOwner.cs:987
virtual string IDCostIcon(Thing t)
Definition: InvOwner.cs:1706
virtual string langTransfer
Definition: InvOwner.cs:587
virtual bool AllowContext
Definition: InvOwner.cs:555
Thing PutBack(DragItemCard.DragInfo from)
Definition: InvOwner.cs:1123
bool IsMagicChest
Definition: InvOwner.cs:599
virtual bool ShowNew
Definition: InvOwner.cs:621
virtual bool ShouldShowGuide(Thing t)
Definition: InvOwner.cs:688
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:161
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:1573
void SetPriorityAction(string id, Thing t)
Definition: Player.cs:1543
void ModKarma(int a)
Definition: Player.cs:2636
void RefreshCurrentHotItem()
Definition: Player.cs:2297
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:1881
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:1718
Thing Identify(bool show=true, IDTSource idtSource=IDTSource.Identify)
Definition: Thing.cs:2155
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:1654
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:81
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