Elin Decompiled Documentation EA 23.350.1 Nightly
Loading...
Searching...
No Matches
InvOwner Class Reference
Inheritance diagram for InvOwner:
EClass InvOwnerAlly InvOwnerAutoCombatBar InvOwnerChoose InvOwnerCopyShop InvOwnerDraglet InvOwnerEquip InvOwnerHotbar InvOwnerShop InvOwnerToolbelt

Classes

class  ErrorMessage
 
class  ForceGiveData
 
class  Interaction
 
class  ListInteraction
 
class  Transaction
 

Public Member Functions

virtual bool AllowHold (Thing t)
 
virtual bool AllowMoved (Thing t)
 
virtual bool ShouldShowGuide (Thing t)
 
virtual bool AllowDrop (Thing t)
 
virtual Thing CreateDefaultContainer ()
 
virtual void BuildUICurrency (UICurrency uiCurrency, bool canReroll=false)
 
bool IsWeightOver (Thing t)
 
 InvOwner (Card owner, Card container=null, CurrencyType _currency=CurrencyType.None, PriceType _price=PriceType.Default)
 
void Init ()
 
virtual void OnInit ()
 
virtual void OnClick (ButtonGrid button)
 
virtual void OnRightClick (ButtonGrid button)
 
virtual void OnRightPressed (ButtonGrid button)
 
InvOwner GetShitDestOwner (ButtonGrid b, bool rightMouse=false)
 
virtual void OnShiftClick (ButtonGrid b, bool rightMouse=false)
 
virtual bool CanShiftClick (ButtonGrid b, bool rightMouse=false)
 
virtual string GetTextShiftClick (ButtonGrid b)
 
virtual void OnCtrlClick (ButtonGrid button)
 
virtual bool CanCtrlClick (ButtonGrid b)
 
virtual string GetTextCtrlClick (ButtonGrid b)
 
virtual void OnAltClick (ButtonGrid button)
 
virtual bool CanAltClick (ButtonGrid b)
 
virtual string GetTextAltClick (ButtonGrid b)
 
void Grab (DragItemCard.DragInfo from)
 
Thing PutBack (DragItemCard.DragInfo from)
 
void OnStartDrag (DragItemCard.DragInfo from)
 
virtual bool OnCancelDrag (DragItemCard.DragInfo from)
 
virtual bool OnDrag (DragItemCard.DragInfo from, DragItemCard.DragInfo to, bool execute, bool cancel=false)
 
virtual void OnProcess (Thing t)
 
bool CanOpenContainer (Thing t)
 
ListInteraction ListInteractions (ButtonGrid b, bool context)
 
bool TryHold (Thing t)
 
virtual void ListInteractions (ListInteraction list, Thing t, Trait trait, ButtonGrid b, bool context)
 
virtual string GetAutoUseLang (ButtonGrid button)
 
void AutoUse (ButtonGrid button, bool repeat=false)
 
void ShowContextMenu (ButtonGrid button)
 
virtual int GetPrice (Thing t, CurrencyType currency, int num, bool sell)
 
virtual string GetTextDetail (Thing t, CurrencyType currency, int num, bool sell)
 
virtual void OnWriteNote (ButtonGrid button, UINote n)
 
virtual string IDCostIcon (Thing t)
 
virtual bool IsFailByCurse (Thing t)
 

Public Attributes

bool includeChildren
 
CurrencyType currency
 
PriceType priceType
 
HomeResource homeResource
 
Card owner
 
Card Container
 
List< ButtonGrid > buttons = new List<ButtonGrid>()
 

Static Public Attributes

static ForceGiveData forceGive = new ForceGiveData()
 
static InvOwner Trader
 
static InvOwner Main
 
static float clickTimer
 
- Static Public Attributes inherited from EClass
static Core core
 

Properties

static bool HasTrader [get]
 
static bool FreeTransfer [get]
 
virtual bool AllowAutouse [get]
 
virtual bool AllowContext [get]
 
virtual bool AllowSell [get]
 
virtual bool AlwaysShowTooltip [get]
 
virtual bool UseGuide [get]
 
virtual bool AllowTransfer [get]
 
virtual bool AllowDropOnDrag [get]
 
virtual string langTransfer [get]
 
virtual int destInvY [get]
 
virtual bool HasTransaction [get]
 
virtual bool CopyOnTransfer [get]
 
virtual bool SingleTarget [get]
 
bool UseHomeResource [get]
 
bool IsMagicChest [get]
 
List< Thing > Things [get]
 
Chara Chara [get]
 
ContainerType ContainerType [get]
 
virtual bool InvertSell [get]
 
virtual int numDragGrid [get]
 
virtual bool ShowNew [get]
 
virtual bool DenyImportant [get]
 
InvOwner destInvOwner [get]
 
string IDCurrency [get]
 
- Properties inherited from EClass
static Game game [get]
 
static bool AdvMode [get]
 
static Player player [get]
 
static Chara pc [get]
 
static UI ui [get]
 
static Map _map [get]
 
static Zone _zone [get]
 
static FactionBranch Branch [get]
 
static FactionBranch BranchOrHomeBranch [get]
 
static Faction Home [get]
 
static Faction Wilds [get]
 
static Scene scene [get]
 
static BaseGameScreen screen [get]
 
static GameSetting setting [get]
 
static GameData gamedata [get]
 
static ColorProfile Colors [get]
 
static World world [get]
 
static SourceManager sources [get]
 
static SourceManager editorSources [get]
 
static SoundManager Sound [get]
 
static CoreDebug debug [get]
 

Additional Inherited Members

- Static Public Member Functions inherited from EClass
static int rndSeed (int a, int seed)
 
static int rnd (long a)
 
static int rnd (int a)
 
static int curve (long _a, int start, int step, int rate=75)
 
static int sqrt (int a)
 
static int rndHalf (int a)
 
static float rndf (float a)
 
static int rndSqrt (int a)
 
static void Wait (float a, Card c)
 
static void Wait (float a, Point p)
 
static int Bigger (int a, int b)
 
static int Smaller (int a, int b)
 

Detailed Description

Definition at line 5 of file InvOwner.cs.

Constructor & Destructor Documentation

◆ InvOwner()

InvOwner.InvOwner ( Card  owner,
Card  container = null,
CurrencyType  _currency = CurrencyType::None,
PriceType  _price = PriceType::Default 
)
inline

Definition at line 734 of file InvOwner.cs.

735 {
736 currency = _currency;
737 priceType = _price;
738 this.owner = owner;
739 Container = container ?? owner;
740 if (currency == CurrencyType.BranchMoney)
741 {
743 }
744 }
CurrencyType
Definition: CurrencyType.cs:2
Definition: EClass.cs:6
static FactionBranch BranchOrHomeBranch
Definition: EClass.cs:25
HomeResourceManager resources
Card owner
Definition: InvOwner.cs:533
Card Container
Definition: InvOwner.cs:535
CurrencyType currency
Definition: InvOwner.cs:527
PriceType priceType
Definition: InvOwner.cs:529
HomeResource homeResource
Definition: InvOwner.cs:531

References EClass.BranchOrHomeBranch, Container, currency, homeResource, HomeResourceManager.money, owner, priceType, and FactionBranch.resources.

Member Function Documentation

◆ AllowDrop()

virtual bool InvOwner.AllowDrop ( Thing  t)
inlinevirtual

Reimplemented in InvOwnerEquip.

Definition at line 693 of file InvOwner.cs.

694 {
696 {
697 return t.trait is TraitAbility;
698 }
699 return true;
700 }
static Zone _zone
Definition: EClass.cs:21
virtual bool IsRegion
Definition: Spatial.cs:515

References EClass._zone, and Spatial.IsRegion.

Referenced by CanAltClick().

◆ AllowHold()

virtual bool InvOwner.AllowHold ( Thing  t)
inlinevirtual

Reimplemented in InvOwnerAutoCombatBar, InvOwnerDraglet, and InvOwnerToolbelt.

Definition at line 639 of file InvOwner.cs.

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 }
bool CanForceTradeEquip()
Definition: Affinity.cs:51
virtual Chara Chara
Definition: Card.cs:2122
string id
Definition: Card.cs:36
bool isNPCProperty
Definition: Card.cs:557
bool IsCursed
Definition: Card.cs:2309
Trait trait
Definition: Card.cs:54
virtual bool IsPC
Definition: Card.cs:2197
virtual bool isChara
Definition: Card.cs:2135
bool GetBool(string id)
Definition: Card.cs:2557
bool isGifted
Definition: Card.cs:785
Affinity affinity
Definition: Chara.cs:318
static bool FreeTransfer
Definition: InvOwner.cs:542
bool isEquipped
Definition: Thing.cs:17
virtual bool CanBeDropped
Definition: Trait.cs:313
virtual bool CanOnlyCarry
Definition: Trait.cs:305

References Chara.affinity, Trait.CanBeDropped, Affinity.CanForceTradeEquip(), Trait.CanOnlyCarry, Card.Chara, Container, FreeTransfer, Card.GetBool(), Card.id, Card.isChara, Card.IsCursed, Thing.isEquipped, Card.isGifted, Card.isNPCProperty, Card.IsPC, and Card.trait.

Referenced by CanShiftClick(), InvOwner.Transaction.IsValid(), ListInteractions(), and OnClick().

◆ AllowMoved()

virtual bool InvOwner.AllowMoved ( Thing  t)
inlinevirtual

Reimplemented in InvOwnerChoose, and InvOwnerCopyShop.

Definition at line 683 of file InvOwner.cs.

684 {
685 return true;
686 }

Referenced by CanShiftClick(), and ListInteractions().

◆ AutoUse()

void InvOwner.AutoUse ( ButtonGrid  button,
bool  repeat = false 
)
inline

Definition at line 1613 of file InvOwner.cs.

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 }
static AM_Region Region
Definition: ActionMode.cs:17
bool IsActive
Definition: ActionMode.cs:121
static AM_Adv Adv
Definition: ActionMode.cs:15
Card card
Definition: ButtonGrid.cs:24
bool HasNoGoal
Definition: Chara.cs:1047
static Player player
Definition: EClass.cs:13
static Chara pc
Definition: EClass.cs:15
ListInteraction ListInteractions(ButtonGrid b, bool context)
Definition: InvOwner.cs:1316
bool IsPriorityAction(string id, Thing t)
Definition: Player.cs:1573

References ActionMode.Adv, ButtonGrid.card, Chara.HasNoGoal, ActionMode.IsActive, Player.IsPriorityAction(), item, EClass.pc, EClass.player, and ActionMode.Region.

◆ BuildUICurrency()

virtual void InvOwner.BuildUICurrency ( UICurrency  uiCurrency,
bool  canReroll = false 
)
inlinevirtual

Reimplemented in InvOwnerDraglet, and InvOwnerRecycle.

Definition at line 707 of file InvOwner.cs.

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 }
void Build(Options _options)
Definition: UICurrency.cs:83

References UICurrency.Build(), Container, currency, Card.IsPC, and owner.

Referenced by UIInventory.SwitchTab().

◆ CanAltClick()

virtual bool InvOwner.CanAltClick ( ButtonGrid  b)
inlinevirtual

Definition at line 1087 of file InvOwner.cs.

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 }
virtual Thing Thing
Definition: Card.cs:2110
Definition: EInput.cs:8
static bool isAltDown
Definition: EInput.cs:276
virtual bool AllowDrop(Thing t)
Definition: InvOwner.cs:693

References AllowDrop(), ButtonGrid.card, Container, currency, Chara.HasNoGoal, EInput.isAltDown, Card.isNPCProperty, EClass.pc, and Card.Thing.

Referenced by OnClick().

◆ CanCtrlClick()

virtual bool InvOwner.CanCtrlClick ( ButtonGrid  b)
inlinevirtual

Definition at line 1064 of file InvOwner.cs.

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 }
int Num
Definition: Card.cs:161
static bool isCtrlDown
Definition: EInput.cs:274

References ButtonGrid.card, Container, Chara.HasNoGoal, EInput.isCtrlDown, Card.isNPCProperty, Card.Num, and EClass.pc.

Referenced by OnClick().

◆ CanOpenContainer()

bool InvOwner.CanOpenContainer ( Thing  t)
inline

Definition at line 1303 of file InvOwner.cs.

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 }
ICardParent parent
Definition: Card.cs:56
Definition: Thing.cs:8
virtual bool CanOpenContainer
Definition: Trait.cs:246

References Trait.CanOpenContainer, Card.parent, EClass.pc, and Card.trait.

Referenced by ListInteractions().

◆ CanShiftClick()

virtual bool InvOwner.CanShiftClick ( ButtonGrid  b,
bool  rightMouse = false 
)
inlinevirtual

Definition at line 988 of file InvOwner.cs.

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 }
Definition: Card.cs:11
ThingContainer things
Definition: Card.cs:39
Card GetRootCard()
Definition: Card.cs:3607
bool CanAcceptItem(Card t, int num=-1, bool skipImportantCheck=false)
Definition: Chara.cs:8759
static bool isShiftDown
Definition: EInput.cs:272
static InvOwner Trader
Definition: InvOwner.cs:519
InvOwner GetShitDestOwner(ButtonGrid b, bool rightMouse=false)
Definition: InvOwner.cs:924
static bool HasTrader
Definition: InvOwner.cs:539
virtual bool AllowHold(Thing t)
Definition: InvOwner.cs:639
virtual bool AllowMoved(Thing t)
Definition: InvOwner.cs:683
virtual bool IsContainer
Definition: Trait.cs:225

References AllowHold(), AllowMoved(), Chara.CanAcceptItem(), ButtonGrid.card, card, Card.Chara, Container, currency, Card.GetRootCard(), GetShitDestOwner(), Chara.HasNoGoal, HasTrader, Card.isChara, Trait.IsContainer, Card.isNPCProperty, Card.IsPC, EInput.isShiftDown, owner, EClass.pc, Card.Thing, Card.things, Trader, and Card.trait.

Referenced by OnClick(), and ActionMode.UpdateInput().

◆ CreateDefaultContainer()

virtual Thing InvOwner.CreateDefaultContainer ( )
inlinevirtual

Reimplemented in InvOwnerChangeMaterial, InvOwnerChangeRarity, InvOwnerEnchant, InvOwnerIdentify, InvOwnerLighten, InvOwnerReconstruction, and InvOwnerUncurse.

Definition at line 702 of file InvOwner.cs.

703 {
704 return ThingGen.Create("chest3");
705 }
static Thing Create(string id, int idMat=-1, int lv=-1)
Definition: ThingGen.cs:53

References ThingGen.Create().

Referenced by Init().

◆ GetAutoUseLang()

virtual string InvOwner.GetAutoUseLang ( ButtonGrid  button)
inlinevirtual

Reimplemented in InvOwnerAlly.

Definition at line 1572 of file InvOwner.cs.

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 }
virtual bool HoldAsDefaultInteraction
Definition: Trait.cs:133

References ButtonGrid.card, Trait.HoldAsDefaultInteraction, Player.IsPriorityAction(), item, InvOwner.Interaction.name, EClass.player, and Card.trait.

◆ GetPrice()

virtual int InvOwner.GetPrice ( Thing  t,
CurrencyType  currency,
int  num,
bool  sell 
)
inlinevirtual

Reimplemented in InvOwnerDraglet.

Definition at line 1667 of file InvOwner.cs.

1668 {
1669 return ShopTransaction.current.GetPrice(t, num, sell);
1670 }
static ShopTransaction current
int GetPrice(Thing t, int n, bool sell)

References ShopTransaction.current, and ShopTransaction.GetPrice().

Referenced by InvOwner.Transaction.GetPrice(), and InvOwner.Transaction.IsValid().

◆ GetShitDestOwner()

InvOwner InvOwner.GetShitDestOwner ( ButtonGrid  b,
bool  rightMouse = false 
)
inline

Definition at line 924 of file InvOwner.cs.

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 }
InvOwner invOwner
Definition: ButtonGrid.cs:28
static LayerInventory GetPCLayer()
static LayerInventory GetTopLayer(Thing t, bool includePlayer=false, InvOwner exclude=null)
bool IsFull(int y=0)

References ButtonGrid.card, Container, LayerInventory.GetPCLayer(), LayerInventory.GetTopLayer(), LayerInventory.Inv, ButtonGrid.invOwner, ThingContainer.IsFull(), Card.IsPC, owner, Card.Thing, Card.things, and Trader.

Referenced by CanShiftClick(), and OnShiftClick().

◆ GetTextAltClick()

virtual string InvOwner.GetTextAltClick ( ButtonGrid  b)
inlinevirtual

Definition at line 1104 of file InvOwner.cs.

1105 {
1106 return "actDrop".lang();
1107 }

◆ GetTextCtrlClick()

virtual string InvOwner.GetTextCtrlClick ( ButtonGrid  b)
inlinevirtual

Definition at line 1077 of file InvOwner.cs.

1078 {
1079 return "actSplit".lang();
1080 }

◆ GetTextDetail()

virtual string InvOwner.GetTextDetail ( Thing  t,
CurrencyType  currency,
int  num,
bool  sell 
)
inlinevirtual

Reimplemented in InvOwnerDraglet.

Definition at line 1672 of file InvOwner.cs.

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 }
FontColor
Definition: FontColor.cs:2
int GetCurrency(string id="money")
Definition: Card.cs:4156
static string ToID(CurrencyType currency)
Definition: Currency.cs:3
static SourceManager sources
Definition: EClass.cs:43
virtual int GetPrice(Thing t, CurrencyType currency, int num, bool sell)
Definition: InvOwner.cs:1667
string IDCurrency
Definition: InvOwner.cs:637
static SkinColorProfile DarkColors
Definition: SkinManager.cs:86
SourceThing things

References currency, SkinManager.DarkColors, Card.GetCurrency(), EClass.pc, EClass.sources, SourceManager.things, and Currency.ToID().

Referenced by InvOwner.Transaction.GetTextDetail().

◆ GetTextShiftClick()

virtual string InvOwner.GetTextShiftClick ( ButtonGrid  b)
inlinevirtual

Definition at line 1054 of file InvOwner.cs.

1055 {
1056 return "actTransfer".lang();
1057 }

◆ Grab()

void InvOwner.Grab ( DragItemCard::DragInfo  from)
inline

Definition at line 1109 of file InvOwner.cs.

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 }
virtual void Redraw()
Definition: BaseList.cs:57
void RemoveCard(Card c)
Definition: Card.cs:3271
void Unequip(Thing thing, bool refresh=true)
Definition: CharaBody.cs:49
CharaBody body
Definition: Chara.cs:94
static void SetDirty(Thing t)

References Chara.body, Card.Chara, Container, DragItemCard.DragInfo.invOwner, Thing.isEquipped, DragItemCard.DragInfo.list, owner, BaseList.Redraw(), Card.RemoveCard(), LayerInventory.SetDirty(), DragItemCard.DragInfo.thing, and CharaBody.Unequip().

Referenced by OnDrag(), and OnStartDrag().

◆ IDCostIcon()

virtual string InvOwner.IDCostIcon ( Thing  t)
inlinevirtual

Definition at line 1708 of file InvOwner.cs.

1709 {
1710 return "icon_" + IDCurrency;
1711 }

◆ Init()

void InvOwner.Init ( )
inline

Definition at line 746 of file InvOwner.cs.

747 {
748 if (owner == null)
749 {
752 owner.c_lockLv = 0;
753 owner.c_IDTState = 0;
755 }
756 OnInit();
757 forceGive = new ForceGiveData();
758 }
static void SetNormalRarity(bool fixedMat=false)
virtual void OnInit()
Definition: InvOwner.cs:760
virtual Thing CreateDefaultContainer()
Definition: InvOwner.cs:702
static ForceGiveData forceGive
Definition: InvOwner.cs:517

References Container, CreateDefaultContainer(), forceGive, OnInit(), owner, and CardBlueprint.SetNormalRarity().

Referenced by UIInventory.AddTab(), and LayerDragGrid.SetInv().

◆ IsFailByCurse()

virtual bool InvOwner.IsFailByCurse ( Thing  t)
inlinevirtual

Reimplemented in InvOwnerEquip.

Definition at line 1713 of file InvOwner.cs.

1714 {
1715 return false;
1716 }

Referenced by OnClick(), and InvOwner.Transaction.Process().

◆ IsWeightOver()

bool InvOwner.IsWeightOver ( Thing  t)
inline

Definition at line 729 of file InvOwner.cs.

730 {
731 return false;
732 }

Referenced by InvOwner.Transaction.IsValid().

◆ ListInteractions() [1/2]

ListInteraction InvOwner.ListInteractions ( ButtonGrid  b,
bool  context 
)
inline

Definition at line 1316 of file InvOwner.cs.

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 });
1413 {
1414 listInteraction.Remove(item);
1415 listInteraction.Insert(0, item);
1416 }
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 {
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 }
1447 {
1448 listInteraction.Add(flag ? "dragForget" : "actDrop", 300, delegate
1449 {
1450 EClass.pc.DropThing(t);
1451 });
1452 }
1453 }
1454 bool flag4 = false;
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 }
bool IsPCFactionOrMinion
Definition: Card.cs:2342
bool c_isImportant
Definition: Card.cs:1051
Card held
Definition: Chara.cs:70
void DropThing(Thing t, int num=-1)
Definition: Chara.cs:4923
InvOwner destInvOwner
Definition: InvOwner.cs:626
virtual bool DenyImportant
Definition: InvOwner.cs:623
bool CanOpenContainer(Thing t)
Definition: InvOwner.cs:1303
virtual string langTransfer
Definition: InvOwner.cs:587
virtual bool ShouldShowGuide(Thing t)
Definition: InvOwner.cs:688
virtual bool AllowSell
Definition: InvOwner.cs:558
bool CanSellBack(Thing t, int num=-1)
void ShowSplitMenu(ButtonGrid button, InvOwner.Transaction trans=null)
Definition: Thing.cs:1881
override int GetPrice(CurrencyType currency=CurrencyType.Money, bool sell=false, PriceType priceType=PriceType.Default, Chara c=null)
Definition: Thing.cs:829
Definition: Trait.cs:7
virtual bool CanBeHeldAsFurniture
Definition: Trait.cs:350

References InvOwner.ListInteraction.Add(), AllowHold(), AllowMoved(), AllowSell, Card.c_isImportant, CanOpenContainer(), ShopTransaction.CanSellBack(), ButtonGrid.card, Container, currency, ShopTransaction.current, SkinManager.DarkColors, DenyImportant, destInvOwner, Thing.GetPrice(), InvOwner.Transaction.GetTextDetail(), HasTrader, Card.isNPCProperty, EInput.isShiftDown, InvOwner.Transaction.IsValid(), langTransfer, Card.Num, priceType, InvOwner.Interaction.repeatable, ShouldShowGuide(), Card.Thing, Trader, and Card.trait.

◆ ListInteractions() [2/2]

virtual void InvOwner.ListInteractions ( ListInteraction  list,
Thing  t,
Trait  trait,
ButtonGrid  b,
bool  context 
)
inlinevirtual

Reimplemented in InvOwnerAlly, InvOwnerEquip, and InvOwnerShop.

Definition at line 1502 of file InvOwner.cs.

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 }
if(!match.Success)
Thing thing
Definition: BodySlot.cs:8
int invY
Definition: Card.cs:2007
Thing AddThing(string id, int lv=-1)
Definition: Card.cs:3280
int invX
Definition: Card.cs:1995
Card parentCard
Definition: Card.cs:106
DNA c_DNA
Definition: Card.cs:1933
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
static SoundManager Sound
Definition: EClass.cs:47
static bool IsOpen(Thing t)
virtual void OnListInteraction(InvOwner.ListInteraction list, ButtonGrid b, bool context)
Definition: Trait.cs:756

References InvOwner.ListInteraction.Add(), Card.AddThing(), Chara.body, Card.c_DNA, Card.Chara, InvOwner.ListInteraction.Contains(), CharaBody.Equip(), Card.GetBool(), CharaBody.GetSlot(), Chara.held, if(), Card.invX, Card.invY, LayerInventory.IsOpen(), ThingContainer.IsOverflowing(), Card.IsPC, EInput.isShiftDown, Card.parent, Card.parentCard, EClass.pc, EClass.Sound, BodySlot.thing, and Card.things.

◆ OnAltClick()

virtual void InvOwner.OnAltClick ( ButtonGrid  button)
inlinevirtual

Definition at line 1082 of file InvOwner.cs.

1083 {
1084 EClass.pc.DropThing(button.card.Thing);
1085 }

References ButtonGrid.card, Chara.DropThing(), EClass.pc, and Card.Thing.

Referenced by OnClick().

◆ OnCancelDrag()

virtual bool InvOwner.OnCancelDrag ( DragItemCard::DragInfo  from)
inlinevirtual

Reimplemented in InvOwnerAlly, InvOwnerChoose, and InvOwnerShop.

Definition at line 1167 of file InvOwner.cs.

1168 {
1170 {
1171 return false;
1172 }
1173 PutBack(from);
1174 return true;
1175 }
Thing PutBack(DragItemCard.DragInfo from)
Definition: InvOwner.cs:1124

References Container, Card.isNPCProperty, and PutBack().

Referenced by OnDrag().

◆ OnClick()

virtual void InvOwner.OnClick ( ButtonGrid  button)
inlinevirtual

Reimplemented in InvOwnerAlly, InvOwnerChoose, InvOwnerDraglet, InvOwnerHotbar, and InvOwnerToolbelt.

Definition at line 764 of file InvOwner.cs.

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 }
CTAG
Definition: CTAG.cs:2
Emo
Definition: Emo.cs:2
void Talk(string idTopic, string ref1=null, string ref2=null, bool forceSync=false)
Definition: Card.cs:7206
void ShowEmo(Emo _emo=Emo.none, float duration=0f, bool skipSame=true)
Definition: Card.cs:6613
virtual bool IsPCFaction
Definition: Card.cs:2339
void Say(string lang, string ref1=null, string ref2=null)
Definition: Card.cs:7324
void InstantEat(Thing t=null, bool sound=true)
Definition: Chara.cs:8064
void ModAffinity(Chara c, int a, bool show=true, bool showOnlyEmo=false)
Definition: Chara.cs:8445
Thing Pick(Thing t, bool msg=true, bool tryStack=true)
Definition: Chara.cs:4606
static UI ui
Definition: EClass.cs:17
virtual bool CanCtrlClick(ButtonGrid b)
Definition: InvOwner.cs:1064
virtual void OnShiftClick(ButtonGrid b, bool rightMouse=false)
Definition: InvOwner.cs:951
virtual void OnCtrlClick(ButtonGrid button)
Definition: InvOwner.cs:1059
virtual void OnAltClick(ButtonGrid button)
Definition: InvOwner.cs:1082
virtual bool IsFailByCurse(Thing t)
Definition: InvOwner.cs:1713
virtual bool CanAltClick(ButtonGrid b)
Definition: InvOwner.cs:1087
virtual bool CanShiftClick(ButtonGrid b, bool rightMouse=false)
Definition: InvOwner.cs:988
void ModKarma(int a)
Definition: Player.cs:2636

References AllowHold(), CanAltClick(), CanCtrlClick(), CanShiftClick(), ButtonGrid.card, InvOwner.ForceGiveData.card, card, Card.Chara, forceGive, FreeTransfer, HasTrader, Chara.InstantEat(), ButtonGrid.invOwner, EInput.isAltDown, Card.isChara, EInput.isCtrlDown, IsFailByCurse(), Card.IsPC, Card.IsPCFaction, EInput.isShiftDown, Chara.ModAffinity(), Player.ModKarma(), OnAltClick(), OnCtrlClick(), OnShiftClick(), owner, EClass.pc, Chara.Pick(), EClass.player, InvOwner.Transaction.Process(), Card.Say(), Card.ShowEmo(), Card.Talk(), Card.Thing, InvOwner.ForceGiveData.tries, and EClass.ui.

Referenced by OnRightClick().

◆ OnCtrlClick()

virtual void InvOwner.OnCtrlClick ( ButtonGrid  button)
inlinevirtual

Definition at line 1059 of file InvOwner.cs.

1060 {
1061 button.card.Thing.ShowSplitMenu(button, HasTransaction ? new Transaction(button) : null);
1062 }
virtual bool HasTransaction
Definition: InvOwner.cs:591

References ButtonGrid.card, HasTransaction, Thing.ShowSplitMenu(), and Card.Thing.

Referenced by OnClick().

◆ OnDrag()

virtual bool InvOwner.OnDrag ( DragItemCard::DragInfo  from,
DragItemCard::DragInfo  to,
bool  execute,
bool  cancel = false 
)
inlinevirtual

Definition at line 1177 of file InvOwner.cs.

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 }
BlessedState
Definition: BlessedState.cs:2
int elementId
Definition: BodySlot.cs:6
Card AddCard(Card c)
Definition: Card.cs:3266
BlessedState blessedState
Definition: Card.cs:281
SourceCategory.Row category
Definition: Card.cs:2101
bool IsEquippable(Thing thing, BodySlot slot, bool text=true)
Definition: CharaBody.cs:114
Definition: Chara.cs:10
new GameConfig game
Definition: CoreConfig.cs:629
CoreConfig config
Definition: Core.cs:70
static CursorInfo Invalid
static void SetCursor(CursorInfo info=null, int _priority=0)
static Game game
Definition: EClass.cs:9
static Core core
Definition: EClass.cs:7
bool UseGrid
Definition: Game.cs:266
BodySlot slot
Definition: InvOwnerEquip.cs:3
virtual bool AllowDropOnDrag
Definition: InvOwner.cs:585
void Grab(DragItemCard.DragInfo from)
Definition: InvOwner.cs:1109
virtual bool OnCancelDrag(DragItemCard.DragInfo from)
Definition: InvOwner.cs:1167
virtual void OnProcess(Thing t)
Definition: InvOwner.cs:1299
virtual bool AllowTransfer
Definition: InvOwner.cs:574
Definition: Msg.cs:5
static string Say(string idLang, string ref1, string ref2=null, string ref3=null, string ref4=null)
Definition: Msg.cs:58
override bool CanStackTo(Thing to)
Definition: Thing.cs:1718
virtual bool CanCopy(Thing t)
Definition: Trait.cs:1660

References EClass._zone, Card.AddCard(), AllowDropOnDrag, AllowTransfer, Card.blessedState, Chara.body, DragItemCard.DragInfo.button, Card.c_DNA, Card.c_isImportant, Trait.CanCopy(), Thing.CanStackTo(), Card.category, Card.Chara, Core.config, EClass.core, Chara.DropThing(), BodySlot.elementId, CharaBody.Equip(), CoreConfig.game, EClass.game, Card.GetBool(), InvOwner.Transaction.GetTextDetail(), Grab(), CursorSystem.Invalid, DragItemCard.DragInfo.invOwner, LayerInventory.invs, CharaBody.IsEquippable(), Spatial.IsRegion, InvOwner.Transaction.IsValid(), DragItemCard.DragInfo.list, Card.Num, OnCancelDrag(), OnProcess(), owner, EClass.pc, InvOwner.Transaction.Process(), BaseList.Redraw(), Msg.Say(), CursorSystem.SetCursor(), InvOwnerEquip.slot, EClass.Sound, DragItemCard.DragInfo.thing, Card.trait, EClass.ui, CoreConfig.GameConfig.useGrid, and Game.UseGrid.

Referenced by DragItemCard.OnDrag().

◆ OnInit()

virtual void InvOwner.OnInit ( )
inlinevirtual

Reimplemented in InvOwnerDraglet.

Definition at line 760 of file InvOwner.cs.

761 {
762 }

Referenced by Init().

◆ OnProcess()

virtual void InvOwner.OnProcess ( Thing  t)
inlinevirtual

Reimplemented in InvOwnerDraglet, and InvOwnerHotbar.

Definition at line 1299 of file InvOwner.cs.

1300 {
1301 }

Referenced by OnDrag(), and InvOwner.Transaction.Process().

◆ OnRightClick()

virtual void InvOwner.OnRightClick ( ButtonGrid  button)
inlinevirtual

Reimplemented in InvOwnerAlly, InvOwnerChoose, InvOwnerDraglet, and InvOwnerHotbar.

Definition at line 881 of file InvOwner.cs.

882 {
883 if (!AllowAutouse)
884 {
885 OnClick(button);
886 }
887 if (button.card != null)
888 {
889 AutoUse(button);
890 }
891 }
virtual void OnClick(ButtonGrid button)
Definition: InvOwner.cs:764
virtual bool AllowAutouse
Definition: InvOwner.cs:553

References AllowAutouse, AutoUse, ButtonGrid.card, and OnClick().

◆ OnRightPressed()

virtual void InvOwner.OnRightPressed ( ButtonGrid  button)
inlinevirtual

Reimplemented in InvOwnerAlly, InvOwnerChoose, and InvOwnerHotbar.

Definition at line 893 of file InvOwner.cs.

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 }
float pressedTimer
Definition: ButtonState.cs:17
bool pressedLong
Definition: ButtonState.cs:64
static ButtonState rightMouse
Definition: EInput.cs:362
static float clickTimer
Definition: InvOwner.cs:523

References AutoUse, ButtonGrid.card, clickTimer, ButtonState.pressedLong, ButtonState.pressedTimer, and EInput.rightMouse.

◆ OnShiftClick()

virtual void InvOwner.OnShiftClick ( ButtonGrid  b,
bool  rightMouse = false 
)
inlinevirtual

Definition at line 951 of file InvOwner.cs.

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 }
bool isDestroyed
Definition: Card.cs:78
bool IsHotItem
Definition: Card.cs:122
void PlaySoundDrop(bool spatial=true)
Definition: Card.cs:6630
Thing TryStack(Thing target, int destInvX=-1, int destInvY=-1)
Thing CanStack(Thing target, int destInvX=-1, int destInvY=-1)

References Card.AddThing(), ThingContainer.CanStack(), ButtonGrid.card, Container, GetShitDestOwner(), Card.isDestroyed, Card.IsHotItem, Card.IsPC, EInput.isShiftDown, owner, Card.parent, EClass.pc, Chara.Pick(), Card.PlaySoundDrop(), Card.RemoveCard(), Card.Thing, Card.things, and ThingContainer.TryStack().

Referenced by OnClick(), and ActionMode.UpdateInput().

◆ OnStartDrag()

void InvOwner.OnStartDrag ( DragItemCard::DragInfo  from)
inline

Definition at line 1153 of file InvOwner.cs.

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 }
bool IsEquipment
Definition: Card.cs:2227
static void Redraw()
Definition: WidgetEquip.cs:77

References Grab(), Card.IsEquipment, Card.parent, Card.PlaySoundDrop(), WidgetEquip.Redraw(), and DragItemCard.DragInfo.thing.

Referenced by DragItemCard.OnStartDrag().

◆ OnWriteNote()

virtual void InvOwner.OnWriteNote ( ButtonGrid  button,
UINote  n 
)
inlinevirtual

Reimplemented in InvOwnerEquip.

Definition at line 1685 of file InvOwner.cs.

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 }
virtual bool UseGuide
Definition: InvOwner.cs:571
virtual string IDCostIcon(Thing t)
Definition: InvOwner.cs:1708
Definition: Lang.cs:7
static string _currency(object a, string IDCurrency)
Definition: Lang.cs:161
Dictionary< string, CardRow > map
Definition: SourceCard.cs:9
SourceCard cards
static Sprite Get(string id)
Definition: SpriteSheet.cs:28
Definition: UIItem.cs:5
Image image1
Definition: UIItem.cs:14
UIText text1
Definition: UIItem.cs:6
void Space(int sizeY=0, int sizeX=1)
Definition: UINote.cs:62
void SetText(string s)
Definition: UIText.cs:163

References Lang._currency(), ShopTransaction.CanSellBack(), ButtonGrid.card, SourceManager.cards, ShopTransaction.current, SpriteSheet.Get(), InvOwner.Transaction.GetPrice(), UIItem.image1, InvOwner.Transaction.IsValid(), SourceCard.map, UIText.SetText(), ShouldShowGuide(), EClass.sources, UINote.Space(), UIItem.text1, and UseGuide.

◆ PutBack()

Thing InvOwner.PutBack ( DragItemCard::DragInfo  from)
inline

Definition at line 1124 of file InvOwner.cs.

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 }
bool IsOccupied(int x, int y)

References Card.AddThing(), Chara.body, Card.Chara, DragItemCard.DragInfo.container, CharaBody.Equip(), DragItemCard.DragInfo.equippedSlot, DragItemCard.DragInfo.invOwner, DragItemCard.DragInfo.invX, DragItemCard.DragInfo.invY, ThingContainer.IsFull(), ThingContainer.IsOccupied(), DragItemCard.DragInfo.list, owner, EClass.pc, Chara.Pick(), BaseList.Redraw(), DragItemCard.DragInfo.thing, and Card.things.

Referenced by OnCancelDrag().

◆ ShouldShowGuide()

◆ ShowContextMenu()

void InvOwner.ShowContextMenu ( ButtonGrid  button)
inline

Definition at line 1645 of file InvOwner.cs.

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 }
void Show(UIItem i)
void AddButton(Func< string > funcText, UnityAction action=null)

References Chara.HasNoGoal, item, EClass.pc, InvOwner.Interaction.priority, and EClass.ui.

Referenced by ButtonGrid.OnMiddleClick().

◆ TryHold()

bool InvOwner.TryHold ( Thing  t)
inline

Definition at line 1478 of file InvOwner.cs.

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 }
void HoldCard(Card t, int num=-1)
Definition: Chara.cs:4770
void PickHeld(bool msg=false)
Definition: Chara.cs:4826
void RefreshCurrentHotItem()
Definition: Player.cs:2297

References Trait.CanOnlyCarry, Chara.held, Chara.HoldCard(), Thing.isEquipped, EClass.pc, Chara.PickHeld(), EClass.player, Player.RefreshCurrentHotItem(), and Card.trait.

Referenced by DragItemCard.OnDrag(), and ButtonGrid.OnMiddleClick().

Member Data Documentation

◆ buttons

List<ButtonGrid> InvOwner.buttons = new List<ButtonGrid>()

◆ clickTimer

float InvOwner.clickTimer
static

Definition at line 523 of file InvOwner.cs.

Referenced by OnRightPressed().

◆ Container

◆ currency

◆ forceGive

ForceGiveData InvOwner.forceGive = new ForceGiveData()
static

Definition at line 517 of file InvOwner.cs.

Referenced by Init(), and OnClick().

◆ homeResource

HomeResource InvOwner.homeResource

◆ includeChildren

bool InvOwner.includeChildren

Definition at line 525 of file InvOwner.cs.

◆ Main

InvOwner InvOwner.Main
static

Definition at line 521 of file InvOwner.cs.

◆ owner

◆ priceType

PriceType InvOwner.priceType

◆ Trader

Property Documentation

◆ AllowAutouse

virtual bool InvOwner.AllowAutouse
get

Definition at line 553 of file InvOwner.cs.

Referenced by OnRightClick().

◆ AllowContext

virtual bool InvOwner.AllowContext
get

Definition at line 555 of file InvOwner.cs.

Referenced by ButtonGrid.OnMiddleClick().

◆ AllowDropOnDrag

virtual bool InvOwner.AllowDropOnDrag
get

Definition at line 585 of file InvOwner.cs.

Referenced by OnDrag().

◆ AllowSell

virtual bool InvOwner.AllowSell
get

Definition at line 557 of file InvOwner.cs.

558 {
559 get
560 {
561 if (currency != CurrencyType.None)
562 {
563 return owner.trait.AllowSell;
564 }
565 return true;
566 }
567 }
virtual bool AllowSell
Definition: Trait.cs:550

Referenced by InvOwner.Transaction.IsValid(), and ListInteractions().

◆ AllowTransfer

virtual bool InvOwner.AllowTransfer
get

Definition at line 573 of file InvOwner.cs.

574 {
575 get
576 {
577 if (!Container.isChara)
578 {
579 return !Container.isNPCProperty;
580 }
581 return true;
582 }
583 }

Referenced by InvOwner.Transaction.IsValid(), and OnDrag().

◆ AlwaysShowTooltip

virtual bool InvOwner.AlwaysShowTooltip
get

Definition at line 569 of file InvOwner.cs.

◆ Chara

Chara InvOwner.Chara
get

Definition at line 613 of file InvOwner.cs.

Referenced by UIInventory.OnInit().

◆ ContainerType

ContainerType InvOwner.ContainerType
get

Definition at line 615 of file InvOwner.cs.

◆ CopyOnTransfer

virtual bool InvOwner.CopyOnTransfer
get

Definition at line 593 of file InvOwner.cs.

Referenced by InvOwner.Transaction.IsValid(), and InvOwner.Transaction.Process().

◆ DenyImportant

virtual bool InvOwner.DenyImportant
get

Definition at line 623 of file InvOwner.cs.

Referenced by ListInteractions(), and InvOwner.Transaction.Process().

◆ destInvOwner

InvOwner InvOwner.destInvOwner
get

Definition at line 625 of file InvOwner.cs.

626 {
627 get
628 {
629 if (!owner.IsPC)
630 {
631 return Main;
632 }
633 return Trader;
634 }
635 }
static InvOwner Main
Definition: InvOwner.cs:521

Referenced by ListInteractions().

◆ destInvY

virtual int InvOwner.destInvY
get

Definition at line 589 of file InvOwner.cs.

Referenced by DragItemCard.DragInfo.DragInfo(), and InvOwner.Transaction.IsValid().

◆ FreeTransfer

bool InvOwner.FreeTransfer
staticget

Definition at line 541 of file InvOwner.cs.

542 {
543 get
544 {
545 if (HasTrader)
546 {
547 return Trader.currency == CurrencyType.None;
548 }
549 return true;
550 }
551 }

Referenced by AllowHold(), and OnClick().

◆ HasTrader

bool InvOwner.HasTrader
staticget

◆ HasTransaction

virtual bool InvOwner.HasTransaction
get

Definition at line 591 of file InvOwner.cs.

Referenced by OnCtrlClick().

◆ IDCurrency

string InvOwner.IDCurrency
get

Definition at line 637 of file InvOwner.cs.

Referenced by LayerDragGrid.RefreshCost().

◆ InvertSell

virtual bool InvOwner.InvertSell
get

Definition at line 617 of file InvOwner.cs.

◆ IsMagicChest

bool InvOwner.IsMagicChest
get

Definition at line 599 of file InvOwner.cs.

Referenced by InvOwner.Transaction.Process().

◆ langTransfer

virtual string InvOwner.langTransfer
get

◆ numDragGrid

◆ ShowNew

virtual bool InvOwner.ShowNew
get

Definition at line 621 of file InvOwner.cs.

◆ SingleTarget

virtual bool InvOwner.SingleTarget
get

Definition at line 595 of file InvOwner.cs.

Referenced by InvOwner.Transaction.Process().

◆ Things

List<Thing> InvOwner.Things
get

Definition at line 601 of file InvOwner.cs.

602 {
603 get
604 {
606 {
607 return Container.things;
608 }
609 return Container.things.grid;
610 }
611 }
List< Thing > grid

◆ UseGuide

◆ UseHomeResource

bool InvOwner.UseHomeResource
get

Definition at line 597 of file InvOwner.cs.

Referenced by InvOwner.Transaction.IsValid(), and InvOwner.Transaction.Process().


The documentation for this class was generated from the following file: