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