Elin Decompiled Documentation EA 23.153 Nightly
Loading...
Searching...
No Matches
InvOwner Class Reference
Inheritance diagram for InvOwner:
EClass InvOwnerAlly InvOwnerAutoCombatBar 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< ButtonGridbuttons = 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< ThingThings [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 (int a)
 
static int curve (int a, int start, int step, int rate=75)
 
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 726 of file InvOwner.cs.

727 {
728 currency = _currency;
729 priceType = _price;
730 this.owner = owner;
731 Container = container ?? owner;
732 if (currency == CurrencyType.BranchMoney)
733 {
735 }
736 }
CurrencyType
Definition: CurrencyType.cs:2
Definition: EClass.cs:5
static FactionBranch BranchOrHomeBranch
Definition: EClass.cs:24
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 686 of file InvOwner.cs.

687 {
689 {
690 return t.trait is TraitAbility;
691 }
692 return true;
693 }
static Zone _zone
Definition: EClass.cs:20
virtual bool IsRegion
Definition: Spatial.cs:501

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 && t.IsCursed)
646 {
647 return false;
648 }
650 {
651 if (t.id == "money")
652 {
653 return false;
654 }
655 if (t.isGifted || t.isNPCProperty)
656 {
657 return false;
658 }
660 {
661 return false;
662 }
663 return true;
664 }
665 if (!t.trait.CanOnlyCarry)
666 {
668 {
669 return !FreeTransfer;
670 }
671 return true;
672 }
673 return false;
674 }
bool CanForceTradeEquip()
Definition: Affinity.cs:49
virtual Chara Chara
Definition: Card.cs:2006
string id
Definition: Card.cs:31
bool isNPCProperty
Definition: Card.cs:538
bool IsCursed
Definition: Card.cs:2191
Trait trait
Definition: Card.cs:49
virtual bool IsPC
Definition: Card.cs:2079
virtual bool isChara
Definition: Card.cs:2019
bool isGifted
Definition: Card.cs:766
Affinity affinity
Definition: Chara.cs:310
static bool FreeTransfer
Definition: InvOwner.cs:542
bool isEquipped
Definition: Thing.cs:17
virtual bool CanBeDropped
Definition: Trait.cs:295
virtual bool CanOnlyCarry
Definition: Trait.cs:287

References Chara.affinity, Trait.CanBeDropped, Affinity.CanForceTradeEquip(), Trait.CanOnlyCarry, Card.Chara, Container, FreeTransfer, 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 InvOwnerCopyShop.

Definition at line 676 of file InvOwner.cs.

677 {
678 return true;
679 }

Referenced by CanShiftClick(), and ListInteractions().

◆ AutoUse()

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

Definition at line 1671 of file InvOwner.cs.

1672 {
1673 _ = button.card;
1675 {
1676 return;
1677 }
1678 if (!EClass.pc.HasNoGoal)
1679 {
1680 SE.Beep();
1681 return;
1682 }
1683 ListInteraction listInteraction = ListInteractions(button, context: false);
1684 if (listInteraction.Count == 0)
1685 {
1686 SE.Beep();
1687 return;
1688 }
1689 foreach (Interaction item in listInteraction)
1690 {
1691 if (EClass.player.IsPriorityAction(item.idPriority, listInteraction.thing))
1692 {
1693 listInteraction.Insert(0, item);
1694 break;
1695 }
1696 }
1697 if (!repeat || listInteraction[0].repeatable)
1698 {
1699 listInteraction[0].action();
1700 }
1701 }
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:864
static Player player
Definition: EClass.cs:12
static Chara pc
Definition: EClass.cs:14
ListInteraction ListInteractions(ButtonGrid b, bool context)
Definition: InvOwner.cs:1296
bool IsPriorityAction(string id, Thing t)
Definition: Player.cs:1314

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 700 of file InvOwner.cs.

701 {
702 bool flag = Container.isChara && !Container.IsPC;
703 uiCurrency.SetActive(currency != CurrencyType.None || flag);
704 uiCurrency.target = owner;
705 if (currency != CurrencyType.None || flag)
706 {
707 uiCurrency.Build(new UICurrency.Options
708 {
709 weight = flag,
710 money = (currency == CurrencyType.Money),
711 plat = (currency == CurrencyType.Plat),
712 medal = (currency == CurrencyType.Medal),
713 money2 = (currency == CurrencyType.Money2),
714 influence = (currency == CurrencyType.Influence),
715 casino = (currency == CurrencyType.Casino_coin),
716 ecopo = (currency == CurrencyType.Ecopo)
717 });
718 }
719 }
void Build(Options _options)
Definition: UICurrency.cs:79

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

Referenced by UIInventory.SwitchTab().

◆ CanAltClick()

virtual bool InvOwner.CanAltClick ( ButtonGrid  b)
inlinevirtual

Definition at line 1075 of file InvOwner.cs.

1076 {
1077 if (!EInput.isAltDown)
1078 {
1079 return false;
1080 }
1082 {
1083 return false;
1084 }
1085 if (!AllowDrop(b.card.Thing))
1086 {
1087 return false;
1088 }
1089 return true;
1090 }
virtual Thing Thing
Definition: Card.cs:1994
Definition: EInput.cs:8
static bool isAltDown
Definition: EInput.cs:265
virtual bool AllowDrop(Thing t)
Definition: InvOwner.cs:686

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 1052 of file InvOwner.cs.

1053 {
1054 if (!EInput.isCtrlDown)
1055 {
1056 return false;
1057 }
1058 if (!EClass.pc.HasNoGoal || Container.isNPCProperty || b.card.Num <= 1)
1059 {
1060 return false;
1061 }
1062 return true;
1063 }
int Num
Definition: Card.cs:154
static bool isCtrlDown
Definition: EInput.cs:263

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 1283 of file InvOwner.cs.

1284 {
1285 if (t.trait.CanOpenContainer)
1286 {
1287 if (t.parent != EClass.pc)
1288 {
1289 return (t.parent as Thing)?.trait is TraitToolBelt;
1290 }
1291 return true;
1292 }
1293 return false;
1294 }
ICardParent parent
Definition: Card.cs:51
Definition: Thing.cs:8
virtual bool CanOpenContainer
Definition: Trait.cs:230

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 976 of file InvOwner.cs.

977 {
978 if (!EInput.isShiftDown && !rightMouse)
979 {
980 return false;
981 }
983 {
984 return false;
985 }
986 if (rightMouse && !HasTrader)
987 {
988 return false;
989 }
990 if (HasTrader)
991 {
993 {
994 return false;
995 }
997 {
998 return false;
999 }
1000 Card card = b.card;
1001 if (card != null && card.c_isImportant)
1002 {
1003 return false;
1004 }
1005 }
1006 InvOwner shitDestOwner = GetShitDestOwner(b, rightMouse);
1007 if (shitDestOwner == null)
1008 {
1009 return false;
1010 }
1011 Thing thing = b.card.Thing;
1012 if (thing.trait.IsContainer && thing.things.Count > 0)
1013 {
1014 return false;
1015 }
1016 if (!AllowHold(thing))
1017 {
1018 return false;
1019 }
1020 if (HasTrader)
1021 {
1023 {
1024 return false;
1025 }
1026 if (!Trader.AllowMoved(thing))
1027 {
1028 return false;
1029 }
1030 }
1031 if (shitDestOwner.Container.isChara && !shitDestOwner.owner.IsPC && !shitDestOwner.owner.Chara.CanAcceptItem(thing))
1032 {
1033 return false;
1034 }
1035 if (EInput.isShiftDown)
1036 {
1037 LayerInventory.highlightInv = shitDestOwner;
1038 }
1039 return true;
1040 }
Definition: Card.cs:11
ThingContainer things
Definition: Card.cs:34
Card GetRootCard()
Definition: Card.cs:3287
bool CanAcceptItem(Card t, int num=-1)
Definition: Chara.cs:7582
static bool isShiftDown
Definition: EInput.cs:261
static InvOwner Trader
Definition: InvOwner.cs:519
InvOwner GetShitDestOwner(ButtonGrid b, bool rightMouse=false)
Definition: InvOwner.cs:912
static bool HasTrader
Definition: InvOwner.cs:539
virtual bool AllowHold(Thing t)
Definition: InvOwner.cs:639
virtual bool AllowMoved(Thing t)
Definition: InvOwner.cs:676
virtual bool IsContainer
Definition: Trait.cs:209

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, InvOwnerEnchant, InvOwnerIdentify, InvOwnerLighten, InvOwnerReconstruction, and InvOwnerUncurse.

Definition at line 695 of file InvOwner.cs.

696 {
697 return ThingGen.Create("chest3");
698 }
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 1630 of file InvOwner.cs.

1631 {
1632 if (button == null || button.gameObject == null)
1633 {
1634 return "";
1635 }
1636 ListInteraction list = ListInteractions(button, context: false);
1637 foreach (Interaction item in list)
1638 {
1639 if (EClass.player.IsPriorityAction(item.idPriority, list.thing))
1640 {
1641 list.Insert(0, item);
1642 break;
1643 }
1644 }
1645 if (button.card.trait.HoldAsDefaultInteraction && list.Count > 0)
1646 {
1647 Interaction interaction = list[0];
1648 if (interaction.name == "actPick" || interaction.name == "actHold" || interaction.name == "actHoldTool")
1649 {
1650 return null;
1651 }
1652 }
1653 list.ForeachReverse(delegate(Interaction a)
1654 {
1655 if (a.name == "actPick" || a.name == "actHold" || a.name == "actHoldTool")
1656 {
1657 list.Remove(a);
1658 }
1659 });
1660 if (list.Count == 0)
1661 {
1662 return null;
1663 }
1664 if (list[0].name == "actTransfer")
1665 {
1666 return null;
1667 }
1668 return list[0].name.lang();
1669 }
virtual bool HoldAsDefaultInteraction
Definition: Trait.cs:129

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 1725 of file InvOwner.cs.

1726 {
1727 return ShopTransaction.current.GetPrice(t, num, sell);
1728 }
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 912 of file InvOwner.cs.

913 {
914 Thing thing = b.card.Thing;
915 if (rightMouse && !b.invOwner.owner.IsPC)
916 {
917 return LayerInventory.GetPCLayer()?.Inv;
918 }
919 if (Trader != null)
920 {
921 if (b.invOwner.owner.IsPC)
922 {
923 if (!Trader.Container.things.IsFull(thing))
924 {
925 return Trader;
926 }
927 return null;
928 }
929 return LayerInventory.GetTopLayer(thing, includePlayer: true, Trader)?.Inv;
930 }
931 LayerInventory topLayer = LayerInventory.GetTopLayer(thing, includePlayer: true, this);
932 if (topLayer == null)
933 {
934 return null;
935 }
936 return topLayer.Inv;
937 }
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 1092 of file InvOwner.cs.

1093 {
1094 return "actDrop".lang();
1095 }

◆ GetTextCtrlClick()

virtual string InvOwner.GetTextCtrlClick ( ButtonGrid  b)
inlinevirtual

Definition at line 1065 of file InvOwner.cs.

1066 {
1067 return "actSplit".lang();
1068 }

◆ GetTextDetail()

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

Reimplemented in InvOwnerDraglet.

Definition at line 1730 of file InvOwner.cs.

1731 {
1732 int price = GetPrice(t, currency, num, sell);
1733 string @ref = (Trader.UseHomeResource ? Trader.homeResource.Name : ((currency == CurrencyType.Influence) ? "influence".lang() : EClass.sources.things.map[IDCurrency].GetName()));
1734 string ref2 = ((price == 0) ? "" : "invInteraction3".lang(price.ToFormat() ?? "", @ref));
1735 string text = "invInteraction1".lang(num.ToString() ?? "", ref2, (sell ? "invSell" : "invBuy").lang());
1736 if (!sell && EClass.pc.GetCurrency(Currency.ToID(currency)) < price)
1737 {
1738 text = text.TagColor(FontColor.Bad, SkinManager.DarkColors);
1739 }
1740 return text;
1741 }
FontColor
Definition: FontColor.cs:2
int GetCurrency(string id="money")
Definition: Card.cs:3820
static string ToID(CurrencyType currency)
Definition: Currency.cs:3
static SourceManager sources
Definition: EClass.cs:42
virtual int GetPrice(Thing t, CurrencyType currency, int num, bool sell)
Definition: InvOwner.cs:1725
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 1042 of file InvOwner.cs.

1043 {
1044 return "actTransfer".lang();
1045 }

◆ Grab()

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

Definition at line 1097 of file InvOwner.cs.

1098 {
1099 bool isEquipped = from.thing.isEquipped;
1100 if (isEquipped)
1101 {
1102 from.invOwner.owner.Chara.body.Unequip(from.thing);
1103 }
1105 if (isEquipped)
1106 {
1107 from.list.Redraw();
1108 }
1110 }
virtual void Redraw()
Definition: BaseList.cs:57
void RemoveCard(Card c)
Definition: Card.cs:3011
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 1765 of file InvOwner.cs.

1766 {
1767 return "icon_" + IDCurrency;
1768 }

◆ Init()

void InvOwner.Init ( )
inline

Definition at line 738 of file InvOwner.cs.

739 {
740 if (owner == null)
741 {
744 owner.c_lockLv = 0;
745 owner.c_IDTState = 0;
747 }
748 OnInit();
749 forceGive = new ForceGiveData();
750 }
static void SetNormalRarity(bool fixedMat=false)
virtual void OnInit()
Definition: InvOwner.cs:752
virtual Thing CreateDefaultContainer()
Definition: InvOwner.cs:695
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 1770 of file InvOwner.cs.

1771 {
1772 return false;
1773 }

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

◆ IsWeightOver()

bool InvOwner.IsWeightOver ( Thing  t)
inline

Definition at line 721 of file InvOwner.cs.

722 {
723 return false;
724 }

Referenced by InvOwner.Transaction.IsValid().

◆ ListInteractions() [1/2]

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

Definition at line 1296 of file InvOwner.cs.

1297 {
1298 ListInteraction listInteraction = new ListInteraction();
1299 if (b == null || b.card == null || this is InvOwnerAlly)
1300 {
1301 return listInteraction;
1302 }
1303 Thing t = b.card.Thing;
1304 if (t == null)
1305 {
1306 return listInteraction;
1307 }
1308 listInteraction.thing = t;
1309 Trait trait = t.trait;
1310 bool flag = trait is TraitAbility;
1311 if (HasTrader)
1312 {
1313 if (Trader == null || destInvOwner == null)
1314 {
1315 return listInteraction;
1316 }
1317 if (CanOpenContainer(t))
1318 {
1319 listInteraction.Add("actContainer", 10, delegate
1320 {
1321 (t.trait as TraitContainer).TryOpen();
1322 });
1323 }
1324 bool flag2 = !flag && !trait.CanOnlyCarry && (!destInvOwner.UseGuide || destInvOwner.ShouldShowGuide(t));
1325 bool flag3 = ShopTransaction.current != null && ShopTransaction.current.CanSellBack(t);
1326 if (destInvOwner == Trader && !Trader.AllowSell && !flag3)
1327 {
1328 flag2 = false;
1329 }
1330 if (!AllowHold(t))
1331 {
1332 flag2 = false;
1333 }
1334 if (!Trader.AllowMoved(t))
1335 {
1336 flag2 = false;
1337 }
1338 if (flag2 && (!t.c_isImportant || !destInvOwner.DenyImportant))
1339 {
1340 if (!flag3 && (Trader.currency == CurrencyType.None || t.GetPrice() == 0))
1341 {
1342 Transaction trans2 = new Transaction(b, t.Num);
1343 if (trans2.IsValid())
1344 {
1345 listInteraction.Add(Container.isNPCProperty ? "actSteal".lang().TagColor(FontColor.Bad, SkinManager.DarkColors) : destInvOwner.langTransfer, 0, delegate
1346 {
1347 if (Container.isNPCProperty)
1348 {
1349 Dialog.TryWarnCrime(delegate
1350 {
1351 trans2.Process();
1352 });
1353 }
1354 else
1355 {
1356 trans2.Process();
1357 }
1358 });
1359 }
1360 }
1361 else
1362 {
1363 bool isShiftDown = EInput.isShiftDown;
1364 Transaction trans = new Transaction(b);
1365 listInteraction.Add(trans.GetTextDetail(), 0, delegate
1366 {
1367 trans.Process();
1368 }).repeatable = true;
1369 if (t.Num > 1)
1370 {
1371 Transaction trans3 = new Transaction(b, t.Num);
1372 listInteraction.Add(trans3.GetTextDetail(), 10, delegate
1373 {
1374 trans3.Process();
1375 });
1376 if (isShiftDown)
1377 {
1378 listInteraction.Add(listInteraction[0]);
1379 listInteraction.RemoveAt(0);
1380 }
1381 }
1382 }
1383 }
1384 }
1385 ListInteractions(listInteraction, t, trait, b, context);
1386 if (context && trait is TraitLightSource)
1387 {
1388 listInteraction.Add("customBrightness", 300, delegate
1389 {
1390 UIContextMenu uIContextMenu = EClass.ui.CreateContextMenuInteraction();
1391 uIContextMenu.AddSlider("brightness", (float a) => a.ToString() ?? "", EClass.player.customLightMod, delegate(float b)
1392 {
1393 EClass.player.customLightMod = (int)b;
1395 }, 1f, 6f, isInt: true, hideOther: false);
1396 uIContextMenu.Show();
1397 });
1398 }
1399 if (AllowHold(t) && !t.isEquipped && !HasTrader)
1400 {
1401 Interaction item = listInteraction.Add((EClass.pc.held == t) ? "actPick" : "actHold", 60, delegate
1402 {
1403 TryHold(t);
1404 });
1406 {
1407 listInteraction.Remove(item);
1408 listInteraction.Insert(0, item);
1409 }
1411 {
1412 listInteraction.Add("actHoldTool", 70, delegate
1413 {
1414 if (t != EClass.pc.held)
1415 {
1416 if (TryHold(t))
1417 {
1418 HotItemHeld.disableTool = true;
1419 }
1420 }
1421 else
1422 {
1423 HotItemHeld.disableTool = true;
1424 }
1425 }, "remove");
1426 }
1427 }
1428 if (context)
1429 {
1430 bool flag4 = false;
1432 {
1433 if (t.Num > 1)
1434 {
1435 listInteraction.Add("actSplit", 50, delegate
1436 {
1437 t.ShowSplitMenu(b, (HasTrader && currency != 0 && !owner.IsPC) ? new Transaction(b) : null);
1438 });
1439 }
1440 if (owner.IsPC)
1441 {
1442 flag4 = true;
1443 listInteraction.Add(t.c_isImportant ? "important_off" : "important_on", 299, delegate
1444 {
1447 SE.ClickOk();
1448 });
1449 if (AllowDrop(t))
1450 {
1451 listInteraction.Add(flag ? "dragForget" : "actDrop", 300, delegate
1452 {
1453 EClass.pc.DropThing(t);
1454 });
1455 }
1456 }
1457 }
1458 if (!flag4 && t.c_isImportant)
1459 {
1460 listInteraction.Add(t.c_isImportant ? "important_off" : "important_on", 299, delegate
1461 {
1464 SE.ClickOk();
1465 });
1466 }
1467 }
1468 return listInteraction;
1469 }
virtual int GetPrice(CurrencyType currency=CurrencyType.Money, bool sell=false, PriceType priceType=PriceType.Default, Chara c=null)
Definition: Card.cs:6875
void RecalculateFOV()
Definition: Card.cs:5988
bool c_isImportant
Definition: Card.cs:996
Card held
Definition: Chara.cs:70
void DropThing(Thing t, int num=-1)
Definition: Chara.cs:4330
static UI ui
Definition: EClass.cs:16
InvOwner destInvOwner
Definition: InvOwner.cs:626
virtual bool DenyImportant
Definition: InvOwner.cs:623
bool CanOpenContainer(Thing t)
Definition: InvOwner.cs:1283
bool TryHold(Thing t)
Definition: InvOwner.cs:1471
virtual string langTransfer
Definition: InvOwner.cs:587
virtual bool ShouldShowGuide(Thing t)
Definition: InvOwner.cs:681
virtual bool AllowSell
Definition: InvOwner.cs:558
int customLightMod
Definition: Player.cs:778
bool CanSellBack(Thing t, int num=-1)
void ShowSplitMenu(ButtonGrid button, InvOwner.Transaction trans=null)
Definition: Thing.cs:1716
Definition: Trait.cs:7
virtual bool CanBeHeldAsFurniture
Definition: Trait.cs:332
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)

References InvOwner.ListInteraction.Add(), AllowHold(), AllowMoved(), AllowSell, Card.c_isImportant, CanOpenContainer(), ShopTransaction.CanSellBack(), ButtonGrid.card, Container, currency, ShopTransaction.current, SkinManager.DarkColors, DenyImportant, destInvOwner, Card.GetPrice(), InvOwner.Transaction.GetTextDetail(), HasTrader, Card.isNPCProperty, EInput.isShiftDown, InvOwner.Transaction.IsValid(), langTransfer, Card.Num, 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 1495 of file InvOwner.cs.

1496 {
1497 if (!owner.IsPC)
1498 {
1499 return;
1500 }
1501 if (CanOpenContainer(t) && !list.Contains("actContainer"))
1502 {
1503 list.Add(LayerInventory.IsOpen(t) ? "close" : "actContainer", 100, delegate
1504 {
1505 (t.trait as TraitContainer).TryOpen();
1506 });
1507 }
1508 if (HasTrader)
1509 {
1510 return;
1511 }
1512 CharaBody body = owner.Chara.body;
1513 BodySlot slot = body.GetSlot(t, onlyEmpty: false, EInput.isShiftDown);
1514 if (slot != null)
1515 {
1516 Card tParent = t.parentCard;
1517 int tInvX = t.invX;
1518 int tInvY = t.invY;
1519 if (tInvY != 1)
1520 {
1521 list.Add("invEquip", 90, delegate
1522 {
1523 if (slot.thing != null && slot.thing.blessedState <= BlessedState.Cursed)
1524 {
1525 Msg.Say("unequipCursed", slot.thing);
1526 SE.Play("curse3");
1527 }
1528 else
1529 {
1530 if (EClass.pc.held == t)
1531 {
1532 EClass.pc.PickHeld();
1533 }
1534 Thing thing = slot.thing;
1535 body.Equip(t, slot);
1536 EClass.Sound.Play("equip");
1537 if (thing != null)
1538 {
1539 if (tParent != null)
1540 {
1541 tParent.AddThing(thing);
1542 thing.invX = tInvX;
1543 thing.invY = tInvY;
1544 }
1545 else if (thing.parent is Card && (thing.parent as Card).things.IsOverflowing())
1546 {
1547 thing.parent.RemoveCard(thing);
1548 EClass.pc.Pick(thing);
1549 }
1550 }
1551 }
1552 });
1553 }
1554 }
1555 if (trait.CanRead(EClass.pc))
1556 {
1557 list.Add("invRead", 110, delegate
1558 {
1559 t.DoAct(new AI_Read
1560 {
1561 target = t
1562 });
1563 }, "remove");
1564 }
1565 if (trait.CanUse(EClass.pc))
1566 {
1567 list.Add(trait.LangUse, 120, delegate
1568 {
1569 if (trait.OnUse(EClass.pc))
1570 {
1571 EClass.player.EndTurn();
1572 }
1573 }, "use");
1574 }
1575 if (trait.CanDrink(EClass.pc))
1576 {
1577 list.Add("invDrink", 130, delegate
1578 {
1579 t.DoAct(new AI_Drink
1580 {
1581 target = t
1582 });
1583 }, "remove");
1584 }
1585 if (trait.CanEat(EClass.pc))
1586 {
1587 list.Add("invFood", 140, delegate
1588 {
1589 t.DoAct(new AI_Eat
1590 {
1591 cook = false,
1592 target = t
1593 });
1594 }, "remove");
1595 }
1596 if (trait.IsBlendBase)
1597 {
1598 list.Add("invBlend", 150, delegate
1599 {
1601 }, "blend");
1602 }
1603 if (!context)
1604 {
1605 return;
1606 }
1607 if (trait is TraitCard)
1608 {
1609 list.Add("invCollect", 150, delegate
1610 {
1612 });
1613 }
1614 if (!trait.CanName)
1615 {
1616 return;
1617 }
1618 list.Add("changeName", 200, delegate
1619 {
1620 Dialog.InputName("dialogChangeName", t.c_refText.IsEmpty(""), delegate(bool cancel, string text)
1621 {
1622 if (!cancel)
1623 {
1624 t.c_refText = text;
1625 }
1626 });
1627 });
1628 }
BlessedState
Definition: BlessedState.cs:2
@ cook
if(item3.idFile==idFirstFile &&item3.id==idFirstTopic)
Definition: UIBook.cs:627
Definition: AI_Eat.cs:5
Thing thing
Definition: BodySlot.cs:8
int invY
Definition: Card.cs:1891
string c_refText
Definition: Card.cs:1589
Thing AddThing(string id, int lv=-1)
Definition: Card.cs:3020
int invX
Definition: Card.cs:1879
BlessedState blessedState
Definition: Card.cs:262
Card parentCard
Definition: Card.cs:99
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:347
static void Collect(Thing t)
Definition: Dialog.cs:7
static Dialog InputName(string langDetail, string text, Action< bool, string > onClose, InputType inputType=InputType.Default)
Definition: Dialog.cs:528
static SoundManager Sound
Definition: EClass.cs:46
static LayerDragGrid Create(InvOwnerDraglet owner, bool refuelFromLayerDragGrid=false)
static bool IsOpen(Thing t)
void DoAct(Act act)
Definition: Thing.cs:1857
virtual bool IsBlendBase
Definition: Trait.cs:257
virtual bool CanUse(Chara c)
Definition: Trait.cs:988
virtual bool CanRead(Chara c)
Definition: Trait.cs:957
virtual bool CanName
Definition: Trait.cs:143
virtual bool CanEat(Chara c)
Definition: Trait.cs:966
virtual string LangUse
Definition: Trait.cs:363
virtual bool CanDrink(Chara c)
Definition: Trait.cs:975

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

◆ OnAltClick()

virtual void InvOwner.OnAltClick ( ButtonGrid  button)
inlinevirtual

Definition at line 1070 of file InvOwner.cs.

1071 {
1072 EClass.pc.DropThing(button.card.Thing);
1073 }

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, and InvOwnerShop.

Definition at line 1155 of file InvOwner.cs.

1156 {
1158 {
1159 return false;
1160 }
1161 PutBack(from);
1162 return true;
1163 }
Thing PutBack(DragItemCard.DragInfo from)
Definition: InvOwner.cs:1112

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

Referenced by OnDrag().

◆ OnClick()

virtual void InvOwner.OnClick ( ButtonGrid  button)
inlinevirtual

Reimplemented in InvOwnerAlly, InvOwnerDraglet, InvOwnerHotbar, and InvOwnerToolbelt.

Definition at line 756 of file InvOwner.cs.

757 {
758 Card card = button.card;
759 Card card2 = button.invOwner.owner;
760 if (card == null || EClass.ui.currentDrag != null)
761 {
762 return;
763 }
764 bool flag = false;
765 if (card.Thing.isEquipped && card.Thing.IsEquipmentOrRanged && card.Thing.IsCursed)
766 {
767 SE.Play("curse3");
768 }
769 else if (!AllowHold(card.Thing) && card2.isChara && !card2.IsPC && card2.IsPCFaction)
770 {
771 if (forceGive.card != card)
772 {
773 forceGive.card = card;
774 forceGive.tries = 0;
775 }
776 else
777 {
778 if (!EInput.isShiftDown)
779 {
781 }
782 if (forceGive.tries >= 2)
783 {
784 if (card.HasTag(CTAG.gift) && card.isGifted)
785 {
786 EClass.ui.CloseLayers();
787 card2.Say("angry", card2);
788 card2.ShowEmo(Emo.angry);
789 card2.Talk("noGiveRing");
790 card2.Chara.ModAffinity(EClass.pc, -30);
791 card2.Chara.InstantEat(card.Thing);
792 return;
793 }
794 forceGive.card = null;
795 flag = true;
796 bool flag2 = card.trait is TraitCurrency;
797 card.isGifted = false;
798 card.isNPCProperty = false;
799 card2.Talk(flag2 ? "forceGiveCurrency" : "forceGive");
800 int num = ((!flag2) ? 1 : 3);
801 if (card.id == "money")
802 {
803 num += card.Num / 1000;
804 }
805 if (num >= 5)
806 {
807 num = 5;
808 }
809 EClass.player.ModKarma(-num);
810 EClass.pc.Pick(card.Thing);
811 return;
812 }
813 }
814 }
815 if (AllowHold(card.Thing) || flag)
816 {
817 if (EInput.isAltDown)
818 {
819 if (CanAltClick(button))
820 {
821 OnAltClick(button);
822 }
823 else
824 {
825 SE.BeepSmall();
826 }
827 }
828 else if (EInput.isCtrlDown)
829 {
830 if (CanCtrlClick(button))
831 {
832 OnCtrlClick(button);
833 }
834 else
835 {
836 SE.BeepSmall();
837 }
838 }
839 else if (EInput.isShiftDown)
840 {
841 if (CanShiftClick(button))
842 {
843 OnShiftClick(button);
844 }
845 else
846 {
847 SE.BeepSmall();
848 }
849 }
850 else if (!owner.IsPC)
851 {
852 new Transaction(button, (HasTrader && !FreeTransfer) ? 1 : card.Num).Process(startTransaction: true);
853 }
854 else if (button.card == null || !IsFailByCurse(button.card.Thing))
855 {
856 EClass.ui.StartDrag(new DragItemCard(button));
857 }
858 }
859 else
860 {
861 SE.BeepSmall();
862 if (card2.isChara && !card2.IsPC)
863 {
864 card2.Talk("noGive");
865 }
866 }
867 }
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:6326
void ShowEmo(Emo _emo=Emo.none, float duration=0f, bool skipSame=true)
Definition: Card.cs:5744
virtual bool IsPCFaction
Definition: Card.cs:2205
void Say(string lang, string ref1=null, string ref2=null)
Definition: Card.cs:6423
void InstantEat(Thing t=null, bool sound=true)
Definition: Chara.cs:7025
void ModAffinity(Chara c, int a, bool show=true, bool showOnlyEmo=false)
Definition: Chara.cs:7360
Thing Pick(Thing t, bool msg=true, bool tryStack=true)
Definition: Chara.cs:4017
virtual bool CanCtrlClick(ButtonGrid b)
Definition: InvOwner.cs:1052
virtual void OnShiftClick(ButtonGrid b, bool rightMouse=false)
Definition: InvOwner.cs:939
virtual void OnCtrlClick(ButtonGrid button)
Definition: InvOwner.cs:1047
virtual void OnAltClick(ButtonGrid button)
Definition: InvOwner.cs:1070
virtual bool IsFailByCurse(Thing t)
Definition: InvOwner.cs:1770
virtual bool CanAltClick(ButtonGrid b)
Definition: InvOwner.cs:1075
virtual bool CanShiftClick(ButtonGrid b, bool rightMouse=false)
Definition: InvOwner.cs:976
void ModKarma(int a)
Definition: Player.cs:2311

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 1047 of file InvOwner.cs.

1048 {
1049 button.card.Thing.ShowSplitMenu(button, HasTransaction ? new Transaction(button) : null);
1050 }
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 1165 of file InvOwner.cs.

1166 {
1167 if (cancel)
1168 {
1169 return OnCancelDrag(from);
1170 }
1171 bool flag = false;
1172 string text = "";
1173 if ((object)EClass.ui.GetLayer<LayerRegisterHotbar>() == null)
1174 {
1175 EClass.ui.AddLayer<LayerRegisterHotbar>().SetItem(from.thing);
1176 }
1177 LayerInventory componentOf = InputModuleEX.GetComponentOf<LayerInventory>();
1178 if (!EClass.ui.isPointerOverUI && !EClass._zone.IsRegion)
1179 {
1180 flag = AllowDropOnDrag;
1181 text = ((!AllowDropOnDrag) ? "" : ((from.thing.trait is TraitAbility) ? "dragForget" : "dragDropThing"));
1182 if (execute)
1183 {
1184 if (!AllowDropOnDrag || from.thing.c_isImportant)
1185 {
1186 return OnCancelDrag(from);
1187 }
1188 EClass.pc.DropThing(from.thing);
1189 return true;
1190 }
1191 }
1192 else if (!EClass.core.config.game.useGrid && (bool)componentOf)
1193 {
1194 if ((bool)to.button && to.invOwner != null && to.thing != null && to.thing.CanStackTo(from.thing))
1195 {
1196 Transaction transaction = new Transaction(from, to, from.thing.Num);
1197 flag = transaction.IsValid();
1198 text = transaction.GetTextDetail();
1199 if (execute)
1200 {
1201 return transaction.Process();
1202 }
1203 }
1204 else
1205 {
1206 Transaction transaction2 = new Transaction(from, componentOf.invs[0], from.thing.Num);
1207 flag = transaction2.IsValid();
1208 text = transaction2.GetTextDetail();
1209 if (execute)
1210 {
1211 return transaction2.Process();
1212 }
1213 }
1214 }
1215 else if ((bool)to.button && to.invOwner != null && to.button.interactable)
1216 {
1217 if (to.invOwner is InvOwnerEquip)
1218 {
1219 InvOwnerEquip invOwnerEquip = to.invOwner as InvOwnerEquip;
1220 Chara chara = invOwnerEquip.owner.Chara;
1221 BodySlot slot = invOwnerEquip.slot;
1222 if (execute && to.thing != null && to.thing.blessedState <= BlessedState.Cursed)
1223 {
1224 Msg.Say("unequipCursed", to.thing);
1225 return false;
1226 }
1227 if (from.thing.category.slot == slot.elementId)
1228 {
1229 flag = true;
1230 text = "dragEquip";
1231 if (execute)
1232 {
1233 if (!chara.body.IsEquippable(from.thing, slot))
1234 {
1235 return false;
1236 }
1237 chara.AddCard(from.thing);
1238 if (to.thing != null)
1239 {
1240 EClass.ui.nextDrag = new DragItemCard(to.button);
1241 Grab(to);
1242 }
1243 chara.body.Equip(from.thing, invOwnerEquip.slot);
1244 EClass.Sound.Play("equip");
1245 if (EClass.game.UseGrid)
1246 {
1247 from.list.Redraw();
1248 }
1249 to.list.Redraw();
1250 to.invOwner.OnProcess(from.thing);
1251 return true;
1252 }
1253 }
1254 }
1255 else
1256 {
1257 if (to.invOwner is InvOwnerCopyShop && !to.invOwner.owner.trait.CanCopy(from.thing))
1258 {
1259 return false;
1260 }
1261 if (!to.invOwner.AllowTransfer)
1262 {
1263 return false;
1264 }
1265 Transaction transaction3 = new Transaction(from, to, from.thing.Num);
1266 flag = transaction3.IsValid();
1267 text = transaction3.GetTextDetail();
1268 if (execute)
1269 {
1270 return transaction3.Process();
1271 }
1272 }
1273 }
1274 EClass.ui.hud.SetDragText(flag ? text : "", (from.thing.Num > 1) ? (from.thing.Num.ToString() ?? "") : null);
1275 CursorSystem.SetCursor(flag ? null : CursorSystem.Invalid, 100);
1276 return false;
1277 }
int elementId
Definition: BodySlot.cs:6
Card AddCard(Card c)
Definition: Card.cs:3006
SourceCategory.Row category
Definition: Card.cs:1985
bool IsEquippable(Thing thing, BodySlot slot, bool text=true)
Definition: CharaBody.cs:106
Definition: Chara.cs:10
new GameConfig game
Definition: CoreConfig.cs:600
CoreConfig config
Definition: Core.cs:70
static CursorInfo Invalid
static void SetCursor(CursorInfo info=null, int _priority=0)
static Game game
Definition: EClass.cs:8
static Core core
Definition: EClass.cs:6
bool UseGrid
Definition: Game.cs:259
BodySlot slot
Definition: InvOwnerEquip.cs:3
virtual bool AllowDropOnDrag
Definition: InvOwner.cs:585
void Grab(DragItemCard.DragInfo from)
Definition: InvOwner.cs:1097
virtual bool OnCancelDrag(DragItemCard.DragInfo from)
Definition: InvOwner.cs:1155
virtual void OnProcess(Thing t)
Definition: InvOwner.cs:1279
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:1559
virtual bool CanCopy(Thing t)
Definition: Trait.cs:1443

References EClass._zone, Card.AddCard(), AllowDropOnDrag, AllowTransfer, Card.blessedState, Chara.body, DragItemCard.DragInfo.button, 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, 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 752 of file InvOwner.cs.

753 {
754 }

Referenced by Init().

◆ OnProcess()

virtual void InvOwner.OnProcess ( Thing  t)
inlinevirtual

Reimplemented in InvOwnerDraglet, and InvOwnerHotbar.

Definition at line 1279 of file InvOwner.cs.

1280 {
1281 }

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

◆ OnRightClick()

virtual void InvOwner.OnRightClick ( ButtonGrid  button)
inlinevirtual

Reimplemented in InvOwnerAlly, InvOwnerDraglet, and InvOwnerHotbar.

Definition at line 869 of file InvOwner.cs.

870 {
871 if (!AllowAutouse)
872 {
873 OnClick(button);
874 }
875 if (button.card != null)
876 {
877 AutoUse(button);
878 }
879 }
virtual void OnClick(ButtonGrid button)
Definition: InvOwner.cs:756
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, and InvOwnerHotbar.

Definition at line 881 of file InvOwner.cs.

882 {
884 {
885 return;
886 }
887 float num = 1f;
888 float pressedTimer = EInput.rightMouse.pressedTimer;
889 if (pressedTimer > 2f)
890 {
891 num = 2f;
892 }
893 else if (pressedTimer > 4f)
894 {
895 num = 5f;
896 }
897 else if (pressedTimer > 6f)
898 {
899 num = 50f;
900 }
901 clickTimer -= Core.delta * num;
902 if (clickTimer < 0f)
903 {
904 clickTimer = 0.1f;
905 if (button.card != null)
906 {
907 AutoUse(button, repeat: true);
908 }
909 }
910 }
float pressedTimer
Definition: ButtonState.cs:17
bool pressedLong
Definition: ButtonState.cs:64
static ButtonState rightMouse
Definition: EInput.cs:351
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 939 of file InvOwner.cs.

940 {
941 InvOwner shitDestOwner = GetShitDestOwner(b, rightMouse);
942 Thing thing = b.card.Thing;
943 if (thing == null || thing.isDestroyed)
944 {
945 return;
946 }
947 Card container = shitDestOwner.Container;
948 if (rightMouse && !owner.IsPC)
949 {
950 EClass.pc.Pick(thing, msg: false);
951 return;
952 }
953 if ((thing.parent == container || thing == container) && !thing.IsHotItem)
954 {
956 {
957 SE.BeepSmall();
958 }
959 return;
960 }
961 thing.PlaySoundDrop(spatial: false);
962 if (thing.IsHotItem && thing.parent == container)
963 {
964 container.RemoveCard(thing);
965 }
966 if (container.things.CanStack(thing) != thing)
967 {
968 container.things.TryStack(thing);
969 }
970 else
971 {
972 container.AddThing(thing);
973 }
974 }
bool isDestroyed
Definition: Card.cs:71
bool IsHotItem
Definition: Card.cs:115
void PlaySoundDrop(bool spatial=true)
Definition: Card.cs:5761
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 1141 of file InvOwner.cs.

1142 {
1143 from.thing.PlaySoundDrop(spatial: false);
1144 if (from.thing.parent != null)
1145 {
1146 Grab(from);
1147 }
1148 if (from.thing.IsEquipment)
1149 {
1150 WidgetEquip.dragEquip = from.thing;
1152 }
1153 }
bool IsEquipment
Definition: Card.cs:2109
static void Redraw()
Definition: WidgetEquip.cs:69

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 1743 of file InvOwner.cs.

1744 {
1745 if (button.card is Thing t)
1746 {
1747 bool flag = HasTrader && Trader.currency != 0 && (destInvOwner != Trader || Trader.AllowSell || (ShopTransaction.current?.CanSellBack(t) ?? false));
1748 if (flag && Trader.UseGuide && !Trader.ShouldShowGuide(t))
1749 {
1750 flag = false;
1751 }
1752 if (flag)
1753 {
1754 Transaction transaction = new Transaction(button);
1755 n.Space(8);
1756 UIItem uIItem = n.AddExtra<UIItem>("costPrice");
1757 string id = IDCostIcon(t);
1758 int price = transaction.GetPrice();
1759 uIItem.text1.SetText(Lang._currency(price), transaction.IsValid() ? FontColor.Good : FontColor.Bad);
1760 uIItem.image1.sprite = (Trader.UseHomeResource ? Trader.homeResource.Sprite : SpriteSheet.Get(id));
1761 }
1762 }
1763 }
virtual bool UseGuide
Definition: InvOwner.cs:571
virtual string IDCostIcon(Thing t)
Definition: InvOwner.cs:1765
Definition: Lang.cs:6
static string _currency(object a, string IDCurrency)
Definition: Lang.cs:162
static Sprite Get(string id)
Definition: SpriteSheet.cs:28
Definition: UIItem.cs:5
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:159

References Lang._currency(), ShopTransaction.CanSellBack(), ButtonGrid.card, ShopTransaction.current, SpriteSheet.Get(), InvOwner.Transaction.GetPrice(), InvOwner.Transaction.IsValid(), UIText.SetText(), ShouldShowGuide(), UINote.Space(), UIItem.text1, and UseGuide.

◆ PutBack()

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

Definition at line 1112 of file InvOwner.cs.

1113 {
1114 Thing thing = from.thing;
1115 if (from.invY == 1 && from.container.things.IsOccupied(from.invX, from.invY))
1116 {
1117 return EClass.pc.Pick(thing, msg: false);
1118 }
1119 if (from.container.things.IsFull(thing, recursive: false, tryStack: false))
1120 {
1121 return EClass.pc.Pick(thing, msg: false);
1122 }
1123 thing.invY = from.invY;
1124 thing = from.container.AddThing(thing, tryStack: true, from.invX, from.invY);
1125 if (from.equippedSlot != null)
1126 {
1127 from.invOwner.owner.Chara.body.Equip(thing, from.equippedSlot);
1128 from.list.Redraw();
1129 }
1130 else
1131 {
1132 thing.invX = from.invX;
1133 }
1134 if (from.invY == 1)
1135 {
1136 WidgetCurrentTool.dirty = true;
1137 }
1138 return thing;
1139 }
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 1703 of file InvOwner.cs.

1704 {
1705 if (!EClass.pc.HasNoGoal)
1706 {
1707 SE.Beep();
1708 return;
1709 }
1710 ListInteraction listInteraction = ListInteractions(button, context: true);
1711 if (listInteraction.Count == 0)
1712 {
1713 SE.BeepSmall();
1714 return;
1715 }
1716 UIContextMenu uIContextMenu = EClass.ui.CreateContextMenuInteraction();
1717 listInteraction.Sort((Interaction a, Interaction b) => a.priority - b.priority);
1718 foreach (Interaction item in listInteraction)
1719 {
1720 uIContextMenu.AddButton(item.name, item.action);
1721 }
1722 uIContextMenu.Show();
1723 }
void AddButton(Func< string > funcText, UnityAction action=null)

References UIContextMenu.AddButton(), Chara.HasNoGoal, item, EClass.pc, InvOwner.Interaction.priority, UIContextMenu.Show(), and EClass.ui.

Referenced by ButtonGrid.OnMiddleClick().

◆ TryHold()

bool InvOwner.TryHold ( Thing  t)
inline

Definition at line 1471 of file InvOwner.cs.

1472 {
1473 if (!AllowHold(t) || t.isEquipped || HasTrader)
1474 {
1475 return false;
1476 }
1477 if (EClass.pc.held == t)
1478 {
1479 if (t.trait.CanOnlyCarry)
1480 {
1481 SE.Beep();
1482 return true;
1483 }
1484 EClass.pc.PickHeld();
1485 }
1486 else
1487 {
1488 EClass.pc.HoldCard(t);
1489 }
1491 SE.SelectHotitem();
1492 return true;
1493 }
void HoldCard(Card t, int num=-1)
Definition: Chara.cs:4181
void PickHeld(bool msg=false)
Definition: Chara.cs:4233
void RefreshCurrentHotItem()
Definition: Player.cs:1998

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

Definition at line 529 of file InvOwner.cs.

Referenced by ShopTransaction.GetPrice(), InvOwner(), and ShopTransaction.Process().

◆ 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 != 0)
562 {
563 return owner.trait.AllowSell;
564 }
565 return true;
566 }
567 }
virtual bool AllowSell
Definition: Trait.cs:518

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: