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