Elin Decompiled Documentation EA 23.102 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 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 731 of file InvOwner.cs.

732 {
733 currency = _currency;
734 priceType = _price;
735 this.owner = owner;
736 Container = container ?? owner;
737 if (currency == CurrencyType.BranchMoney)
738 {
740 }
741 }
CurrencyType
Definition: CurrencyType.cs:2
Definition: EClass.cs:5
static FactionBranch BranchOrHomeBranch
Definition: EClass.cs:24
HomeResourceManager resources
Card owner
Definition: InvOwner.cs:538
Card Container
Definition: InvOwner.cs:540
CurrencyType currency
Definition: InvOwner.cs:532
PriceType priceType
Definition: InvOwner.cs:534
HomeResource homeResource
Definition: InvOwner.cs:536

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

692 {
694 {
695 return t.trait is TraitAbility;
696 }
697 return true;
698 }
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 644 of file InvOwner.cs.

645 {
646 if (!t.trait.CanBeDropped)
647 {
648 return false;
649 }
650 if (t.isEquipped && t.IsCursed)
651 {
652 return false;
653 }
655 {
656 if (t.id == "money")
657 {
658 return false;
659 }
660 if (t.isGifted || t.isNPCProperty)
661 {
662 return false;
663 }
665 {
666 return false;
667 }
668 return true;
669 }
670 if (!t.trait.CanOnlyCarry)
671 {
673 {
674 return !FreeTransfer;
675 }
676 return true;
677 }
678 return false;
679 }
bool CanForceTradeEquip()
Definition: Affinity.cs:49
virtual Chara Chara
Definition: Card.cs:1946
string id
Definition: Card.cs:31
bool isNPCProperty
Definition: Card.cs:526
bool IsCursed
Definition: Card.cs:2115
Trait trait
Definition: Card.cs:49
virtual bool IsPC
Definition: Card.cs:2019
virtual bool isChara
Definition: Card.cs:1959
bool isGifted
Definition: Card.cs:754
Affinity affinity
Definition: Chara.cs:299
static bool FreeTransfer
Definition: InvOwner.cs:547
bool isEquipped
Definition: Thing.cs:17
virtual bool CanBeDropped
Definition: Trait.cs:289
virtual bool CanOnlyCarry
Definition: Trait.cs:283

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

682 {
683 return true;
684 }

Referenced by CanShiftClick(), and ListInteractions().

◆ AutoUse()

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

Definition at line 1681 of file InvOwner.cs.

1682 {
1683 _ = button.card;
1685 {
1686 return;
1687 }
1688 if (!EClass.pc.HasNoGoal)
1689 {
1690 SE.Beep();
1691 return;
1692 }
1693 ListInteraction listInteraction = ListInteractions(button, context: false);
1694 if (listInteraction.Count == 0)
1695 {
1696 SE.Beep();
1697 return;
1698 }
1699 foreach (Interaction item in listInteraction)
1700 {
1701 if (EClass.player.IsPriorityAction(item.idPriority, listInteraction.thing))
1702 {
1703 listInteraction.Insert(0, item);
1704 break;
1705 }
1706 }
1707 if (!repeat || listInteraction[0].repeatable)
1708 {
1709 listInteraction[0].action();
1710 }
1711 }
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:821
static Player player
Definition: EClass.cs:12
static Chara pc
Definition: EClass.cs:14
ListInteraction ListInteractions(ButtonGrid b, bool context)
Definition: InvOwner.cs:1306
bool IsPriorityAction(string id, Thing t)
Definition: Player.cs:1299

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

706 {
707 bool flag = Container.isChara && !Container.IsPC;
708 uiCurrency.SetActive(currency != CurrencyType.None || flag);
709 uiCurrency.target = owner;
710 if (currency != CurrencyType.None || flag)
711 {
712 uiCurrency.Build(new UICurrency.Options
713 {
714 weight = flag,
715 money = (currency == CurrencyType.Money),
716 plat = (currency == CurrencyType.Plat),
717 medal = (currency == CurrencyType.Medal),
718 money2 = (currency == CurrencyType.Money2),
719 influence = (currency == CurrencyType.Influence),
720 casino = (currency == CurrencyType.Casino_coin),
721 ecopo = (currency == CurrencyType.Ecopo)
722 });
723 }
724 }
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 1085 of file InvOwner.cs.

1086 {
1087 if (!EInput.isAltDown)
1088 {
1089 return false;
1090 }
1092 {
1093 return false;
1094 }
1095 if (!AllowDrop(b.card.Thing))
1096 {
1097 return false;
1098 }
1099 return true;
1100 }
virtual Thing Thing
Definition: Card.cs:1934
Definition: EInput.cs:8
static bool isAltDown
Definition: EInput.cs:265
virtual bool AllowDrop(Thing t)
Definition: InvOwner.cs:691

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

1063 {
1064 if (!EInput.isCtrlDown)
1065 {
1066 return false;
1067 }
1068 if (!EClass.pc.HasNoGoal || Container.isNPCProperty || b.card.Num <= 1)
1069 {
1070 return false;
1071 }
1072 return true;
1073 }
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 1293 of file InvOwner.cs.

1294 {
1295 if (t.trait.CanOpenContainer)
1296 {
1297 if (t.parent != EClass.pc)
1298 {
1299 return (t.parent as Thing)?.trait is TraitToolBelt;
1300 }
1301 return true;
1302 }
1303 return false;
1304 }
ICardParent parent
Definition: Card.cs:51
Definition: Thing.cs:8
virtual bool CanOpenContainer
Definition: Trait.cs:226

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

982 {
983 if (!EInput.isShiftDown && !rightMouse)
984 {
985 return false;
986 }
988 {
989 return false;
990 }
991 if (rightMouse && !HasTrader)
992 {
993 return false;
994 }
995 if (HasTrader)
996 {
998 {
999 return false;
1000 }
1002 {
1003 return false;
1004 }
1005 Card card = b.card;
1006 if (card != null && card.c_isImportant)
1007 {
1008 return false;
1009 }
1010 }
1011 InvOwner shitDestOwner = GetShitDestOwner(b, rightMouse);
1012 if (shitDestOwner == null)
1013 {
1014 return false;
1015 }
1016 Thing thing = b.card.Thing;
1017 if (thing.trait.IsContainer && thing.things.Count > 0)
1018 {
1019 return false;
1020 }
1021 if (!AllowHold(thing))
1022 {
1023 return false;
1024 }
1025 if (HasTrader)
1026 {
1028 {
1029 return false;
1030 }
1031 if (!Trader.AllowMoved(thing))
1032 {
1033 return false;
1034 }
1035 }
1036 if (shitDestOwner.Container.isChara && !shitDestOwner.owner.IsPC && !shitDestOwner.owner.Chara.CanAcceptItem(thing))
1037 {
1038 return false;
1039 }
1041 {
1042 thing.ammoData = null;
1043 thing.c_ammo = 0;
1044 }
1045 if (EInput.isShiftDown)
1046 {
1047 LayerInventory.highlightInv = shitDestOwner;
1048 }
1049 return true;
1050 }
InvOwner invOwner
Definition: ButtonGrid.cs:28
Definition: Card.cs:11
bool IsRangedWeapon
Definition: Card.cs:2103
ThingContainer things
Definition: Card.cs:34
Card GetRootCard()
Definition: Card.cs:3173
bool CanAcceptItem(Card t, int num=-1)
Definition: Chara.cs:7434
override bool IsPCFaction
Definition: Chara.cs:656
static bool isShiftDown
Definition: EInput.cs:261
static InvOwner Trader
Definition: InvOwner.cs:524
InvOwner GetShitDestOwner(ButtonGrid b, bool rightMouse=false)
Definition: InvOwner.cs:917
static bool HasTrader
Definition: InvOwner.cs:544
virtual bool AllowHold(Thing t)
Definition: InvOwner.cs:644
virtual bool AllowMoved(Thing t)
Definition: InvOwner.cs:681
virtual bool IsContainer
Definition: Trait.cs:205

References AllowHold(), AllowMoved(), Chara.CanAcceptItem(), ButtonGrid.card, card, Card.Chara, Container, currency, Card.GetRootCard(), GetShitDestOwner(), Chara.HasNoGoal, HasTrader, ButtonGrid.invOwner, Card.isChara, Trait.IsContainer, Card.isNPCProperty, Card.IsPC, Chara.IsPCFaction, Card.IsRangedWeapon, 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 700 of file InvOwner.cs.

701 {
702 return ThingGen.Create("chest3");
703 }
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 1640 of file InvOwner.cs.

1641 {
1642 if (button == null || button.gameObject == null)
1643 {
1644 return "";
1645 }
1646 ListInteraction list = ListInteractions(button, context: false);
1647 foreach (Interaction item in list)
1648 {
1649 if (EClass.player.IsPriorityAction(item.idPriority, list.thing))
1650 {
1651 list.Insert(0, item);
1652 break;
1653 }
1654 }
1655 if (button.card.trait.HoldAsDefaultInteraction && list.Count > 0)
1656 {
1657 Interaction interaction = list[0];
1658 if (interaction.name == "actPick" || interaction.name == "actHold" || interaction.name == "actHoldTool")
1659 {
1660 return null;
1661 }
1662 }
1663 list.ForeachReverse(delegate(Interaction a)
1664 {
1665 if (a.name == "actPick" || a.name == "actHold" || a.name == "actHoldTool")
1666 {
1667 list.Remove(a);
1668 }
1669 });
1670 if (list.Count == 0)
1671 {
1672 return null;
1673 }
1674 if (list[0].name == "actTransfer")
1675 {
1676 return null;
1677 }
1678 return list[0].name.lang();
1679 }
virtual bool HoldAsDefaultInteraction
Definition: Trait.cs:125

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

1736 {
1737 return ShopTransaction.current.GetPrice(t, num, sell);
1738 }
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 917 of file InvOwner.cs.

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

1103 {
1104 return "actDrop".lang();
1105 }

◆ GetTextCtrlClick()

virtual string InvOwner.GetTextCtrlClick ( ButtonGrid  b)
inlinevirtual

Definition at line 1075 of file InvOwner.cs.

1076 {
1077 return "actSplit".lang();
1078 }

◆ GetTextDetail()

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

Reimplemented in InvOwnerDraglet.

Definition at line 1740 of file InvOwner.cs.

1741 {
1742 int price = GetPrice(t, currency, num, sell);
1743 string @ref = (Trader.UseHomeResource ? Trader.homeResource.Name : ((currency == CurrencyType.Influence) ? "influence".lang() : EClass.sources.things.map[IDCurrency].GetName()));
1744 string ref2 = ((price == 0) ? "" : "invInteraction3".lang(price.ToFormat() ?? "", @ref));
1745 string text = "invInteraction1".lang(num.ToString() ?? "", ref2, (sell ? "invSell" : "invBuy").lang());
1746 if (!sell && EClass.pc.GetCurrency(Currency.ToID(currency)) < price)
1747 {
1748 text = text.TagColor(FontColor.Bad, SkinManager.DarkColors);
1749 }
1750 return text;
1751 }
FontColor
Definition: FontColor.cs:2
int GetCurrency(string id="money")
Definition: Card.cs:3652
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:1735
string IDCurrency
Definition: InvOwner.cs:642
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 1052 of file InvOwner.cs.

1053 {
1054 return "actTransfer".lang();
1055 }

◆ Grab()

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

Definition at line 1107 of file InvOwner.cs.

1108 {
1109 bool isEquipped = from.thing.isEquipped;
1110 if (isEquipped)
1111 {
1112 from.invOwner.owner.Chara.body.Unequip(from.thing);
1113 }
1115 if (isEquipped)
1116 {
1117 from.list.Redraw();
1118 }
1120 }
virtual void Redraw()
Definition: BaseList.cs:57
void RemoveCard(Card c)
Definition: Card.cs:2892
void Unequip(Thing thing, bool refresh=true)
Definition: CharaBody.cs:49
CharaBody body
Definition: Chara.cs:91
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 1775 of file InvOwner.cs.

1776 {
1777 return "icon_" + IDCurrency;
1778 }

◆ Init()

void InvOwner.Init ( )
inline

Definition at line 743 of file InvOwner.cs.

744 {
745 if (owner == null)
746 {
749 owner.c_lockLv = 0;
750 owner.c_IDTState = 0;
752 }
753 OnInit();
754 forceGive = new ForceGiveData();
755 }
static void SetNormalRarity(bool fixedMat=false)
virtual void OnInit()
Definition: InvOwner.cs:757
virtual Thing CreateDefaultContainer()
Definition: InvOwner.cs:700
static ForceGiveData forceGive
Definition: InvOwner.cs:522

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

1781 {
1782 return false;
1783 }

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

◆ IsWeightOver()

bool InvOwner.IsWeightOver ( Thing  t)
inline

Definition at line 726 of file InvOwner.cs.

727 {
728 return false;
729 }

Referenced by InvOwner.Transaction.IsValid().

◆ ListInteractions() [1/2]

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

Definition at line 1306 of file InvOwner.cs.

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

1506 {
1507 if (!owner.IsPC)
1508 {
1509 return;
1510 }
1511 if (CanOpenContainer(t) && !list.Contains("actContainer"))
1512 {
1513 list.Add(LayerInventory.IsOpen(t) ? "close" : "actContainer", 100, delegate
1514 {
1515 (t.trait as TraitContainer).TryOpen();
1516 });
1517 }
1518 if (HasTrader)
1519 {
1520 return;
1521 }
1522 CharaBody body = owner.Chara.body;
1523 BodySlot slot = body.GetSlot(t, onlyEmpty: false, EInput.isShiftDown);
1524 if (slot != null)
1525 {
1526 Card tParent = t.parentCard;
1527 int tInvX = t.invX;
1528 int tInvY = t.invY;
1529 if (tInvY != 1)
1530 {
1531 list.Add("invEquip", 90, delegate
1532 {
1533 if (slot.thing != null && slot.thing.blessedState <= BlessedState.Cursed)
1534 {
1535 Msg.Say("unequipCursed", slot.thing);
1536 SE.Play("curse3");
1537 }
1538 else
1539 {
1540 if (EClass.pc.held == t)
1541 {
1542 EClass.pc.PickHeld();
1543 }
1544 Thing thing = slot.thing;
1545 body.Equip(t, slot);
1546 EClass.Sound.Play("equip");
1547 if (thing != null)
1548 {
1549 if (tParent != null)
1550 {
1551 tParent.AddThing(thing);
1552 thing.invX = tInvX;
1553 thing.invY = tInvY;
1554 }
1555 else if (thing.parent is Card && (thing.parent as Card).things.IsOverflowing())
1556 {
1557 thing.parent.RemoveCard(thing);
1558 EClass.pc.Pick(thing);
1559 }
1560 }
1561 }
1562 });
1563 }
1564 }
1565 if (trait.CanRead(EClass.pc))
1566 {
1567 list.Add("invRead", 110, delegate
1568 {
1569 t.DoAct(new AI_Read
1570 {
1571 target = t
1572 });
1573 }, "remove");
1574 }
1575 if (trait.CanUse(EClass.pc))
1576 {
1577 list.Add(trait.LangUse, 120, delegate
1578 {
1579 if (trait.OnUse(EClass.pc))
1580 {
1581 EClass.player.EndTurn();
1582 }
1583 }, "use");
1584 }
1585 if (trait.CanDrink(EClass.pc))
1586 {
1587 list.Add("invDrink", 130, delegate
1588 {
1589 t.DoAct(new AI_Drink
1590 {
1591 target = t
1592 });
1593 }, "remove");
1594 }
1595 if (trait.CanEat(EClass.pc))
1596 {
1597 list.Add("invFood", 140, delegate
1598 {
1599 t.DoAct(new AI_Eat
1600 {
1601 cook = false,
1602 target = t
1603 });
1604 }, "remove");
1605 }
1606 if (trait.IsBlendBase)
1607 {
1608 list.Add("invBlend", 150, delegate
1609 {
1611 }, "blend");
1612 }
1613 if (!context)
1614 {
1615 return;
1616 }
1617 if (trait is TraitCard)
1618 {
1619 list.Add("invCollect", 150, delegate
1620 {
1622 });
1623 }
1624 if (!trait.CanName)
1625 {
1626 return;
1627 }
1628 list.Add("changeName", 200, delegate
1629 {
1630 Dialog.InputName("dialogChangeName", t.c_refText.IsEmpty(""), delegate(bool cancel, string text)
1631 {
1632 if (!cancel)
1633 {
1634 t.c_refText = text;
1635 }
1636 });
1637 });
1638 }
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:1831
string c_refText
Definition: Card.cs:1529
Thing AddThing(string id, int lv=-1)
Definition: Card.cs:2901
int invX
Definition: Card.cs:1819
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:341
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:1836
virtual bool IsBlendBase
Definition: Trait.cs:253
virtual bool CanUse(Chara c)
Definition: Trait.cs:950
virtual bool CanRead(Chara c)
Definition: Trait.cs:919
virtual bool CanName
Definition: Trait.cs:139
virtual bool CanEat(Chara c)
Definition: Trait.cs:928
virtual string LangUse
Definition: Trait.cs:357
virtual bool CanDrink(Chara c)
Definition: Trait.cs:937

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

1081 {
1082 EClass.pc.DropThing(button.card.Thing);
1083 }

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

1166 {
1168 {
1169 return false;
1170 }
1171 PutBack(from);
1172 return true;
1173 }
Thing PutBack(DragItemCard.DragInfo from)
Definition: InvOwner.cs:1122

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

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

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

1058 {
1059 button.card.Thing.ShowSplitMenu(button, HasTransaction ? new Transaction(button) : null);
1060 }
virtual bool HasTransaction
Definition: InvOwner.cs:596

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

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

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

758 {
759 }

Referenced by Init().

◆ OnProcess()

virtual void InvOwner.OnProcess ( Thing  t)
inlinevirtual

Reimplemented in InvOwnerDraglet, and InvOwnerHotbar.

Definition at line 1289 of file InvOwner.cs.

1290 {
1291 }

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

◆ OnRightClick()

virtual void InvOwner.OnRightClick ( ButtonGrid  button)
inlinevirtual

Reimplemented in InvOwnerAlly, InvOwnerDraglet, and InvOwnerHotbar.

Definition at line 874 of file InvOwner.cs.

875 {
876 if (!AllowAutouse)
877 {
878 OnClick(button);
879 }
880 if (button.card != null)
881 {
882 AutoUse(button);
883 }
884 }
virtual void OnClick(ButtonGrid button)
Definition: InvOwner.cs:761
virtual bool AllowAutouse
Definition: InvOwner.cs:558

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

◆ OnRightPressed()

virtual void InvOwner.OnRightPressed ( ButtonGrid  button)
inlinevirtual

Reimplemented in InvOwnerAlly, and InvOwnerHotbar.

Definition at line 886 of file InvOwner.cs.

887 {
889 {
890 return;
891 }
892 float num = 1f;
893 float pressedTimer = EInput.rightMouse.pressedTimer;
894 if (pressedTimer > 2f)
895 {
896 num = 2f;
897 }
898 else if (pressedTimer > 4f)
899 {
900 num = 5f;
901 }
902 else if (pressedTimer > 6f)
903 {
904 num = 50f;
905 }
906 clickTimer -= Core.delta * num;
907 if (clickTimer < 0f)
908 {
909 clickTimer = 0.1f;
910 if (button.card != null)
911 {
912 AutoUse(button, repeat: true);
913 }
914 }
915 }
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:528

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

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

1152 {
1153 from.thing.PlaySoundDrop(spatial: false);
1154 if (from.thing.parent != null)
1155 {
1156 Grab(from);
1157 }
1158 if (from.thing.IsEquipment)
1159 {
1160 WidgetEquip.dragEquip = from.thing;
1162 }
1163 }
bool IsEquipment
Definition: Card.cs:2049
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 1753 of file InvOwner.cs.

1754 {
1755 if (button.card is Thing t)
1756 {
1757 bool flag = HasTrader && Trader.currency != 0 && (destInvOwner != Trader || Trader.AllowSell || (ShopTransaction.current?.CanSellBack(t) ?? false));
1758 if (flag && Trader.UseGuide && !Trader.ShouldShowGuide(t))
1759 {
1760 flag = false;
1761 }
1762 if (flag)
1763 {
1764 Transaction transaction = new Transaction(button);
1765 n.Space(8);
1766 UIItem uIItem = n.AddExtra<UIItem>("costPrice");
1767 string id = IDCostIcon(t);
1768 int price = transaction.GetPrice();
1769 uIItem.text1.SetText(Lang._currency(price), transaction.IsValid() ? FontColor.Good : FontColor.Bad);
1770 uIItem.image1.sprite = (Trader.UseHomeResource ? Trader.homeResource.Sprite : SpriteSheet.Get(id));
1771 }
1772 }
1773 }
virtual bool UseGuide
Definition: InvOwner.cs:576
virtual string IDCostIcon(Thing t)
Definition: InvOwner.cs:1775
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 1122 of file InvOwner.cs.

1123 {
1124 Thing thing = from.thing;
1125 if (from.invY == 1 && from.container.things.IsOccupied(from.invX, from.invY))
1126 {
1127 return EClass.pc.Pick(thing, msg: false);
1128 }
1129 if (from.container.things.IsFull(thing, recursive: false, tryStack: false))
1130 {
1131 return EClass.pc.Pick(thing, msg: false);
1132 }
1133 thing.invY = from.invY;
1134 thing = from.container.AddThing(thing, tryStack: true, from.invX, from.invY);
1135 if (from.equippedSlot != null)
1136 {
1137 from.invOwner.owner.Chara.body.Equip(thing, from.equippedSlot);
1138 from.list.Redraw();
1139 }
1140 else
1141 {
1142 thing.invX = from.invX;
1143 }
1144 if (from.invY == 1)
1145 {
1146 WidgetCurrentTool.dirty = true;
1147 }
1148 return thing;
1149 }
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 1713 of file InvOwner.cs.

1714 {
1715 if (!EClass.pc.HasNoGoal)
1716 {
1717 SE.Beep();
1718 return;
1719 }
1720 ListInteraction listInteraction = ListInteractions(button, context: true);
1721 if (listInteraction.Count == 0)
1722 {
1723 SE.BeepSmall();
1724 return;
1725 }
1726 UIContextMenu uIContextMenu = EClass.ui.CreateContextMenuInteraction();
1727 listInteraction.Sort((Interaction a, Interaction b) => a.priority - b.priority);
1728 foreach (Interaction item in listInteraction)
1729 {
1730 uIContextMenu.AddButton(item.name, item.action);
1731 }
1732 uIContextMenu.Show();
1733 }
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 1481 of file InvOwner.cs.

1482 {
1483 if (!AllowHold(t) || t.isEquipped || HasTrader)
1484 {
1485 return false;
1486 }
1487 if (EClass.pc.held == t)
1488 {
1489 if (t.trait.CanOnlyCarry)
1490 {
1491 SE.Beep();
1492 return true;
1493 }
1494 EClass.pc.PickHeld();
1495 }
1496 else
1497 {
1498 EClass.pc.HoldCard(t);
1499 }
1501 SE.SelectHotitem();
1502 return true;
1503 }
void HoldCard(Card t, int num=-1)
Definition: Chara.cs:4084
void PickHeld(bool msg=false)
Definition: Chara.cs:4136
void RefreshCurrentHotItem()
Definition: Player.cs:1977

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

Referenced by OnRightPressed().

◆ Container

◆ currency

◆ forceGive

ForceGiveData InvOwner.forceGive = new ForceGiveData()
static

Definition at line 522 of file InvOwner.cs.

Referenced by Init(), and OnClick().

◆ homeResource

HomeResource InvOwner.homeResource

◆ includeChildren

bool InvOwner.includeChildren

Definition at line 530 of file InvOwner.cs.

◆ Main

InvOwner InvOwner.Main
static

Definition at line 526 of file InvOwner.cs.

◆ owner

◆ priceType

PriceType InvOwner.priceType

Definition at line 534 of file InvOwner.cs.

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

◆ Trader

Property Documentation

◆ AllowAutouse

virtual bool InvOwner.AllowAutouse
get

Definition at line 558 of file InvOwner.cs.

Referenced by OnRightClick().

◆ AllowContext

virtual bool InvOwner.AllowContext
get

Definition at line 560 of file InvOwner.cs.

Referenced by ButtonGrid.OnMiddleClick().

◆ AllowDropOnDrag

virtual bool InvOwner.AllowDropOnDrag
get

Definition at line 590 of file InvOwner.cs.

Referenced by OnDrag().

◆ AllowSell

virtual bool InvOwner.AllowSell
get

Definition at line 562 of file InvOwner.cs.

563 {
564 get
565 {
566 if (currency != 0)
567 {
568 return owner.trait.AllowSell;
569 }
570 return true;
571 }
572 }
virtual bool AllowSell
Definition: Trait.cs:480

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

◆ AllowTransfer

virtual bool InvOwner.AllowTransfer
get

Definition at line 578 of file InvOwner.cs.

579 {
580 get
581 {
582 if (!Container.isChara)
583 {
584 return !Container.isNPCProperty;
585 }
586 return true;
587 }
588 }

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

◆ AlwaysShowTooltip

virtual bool InvOwner.AlwaysShowTooltip
get

Definition at line 574 of file InvOwner.cs.

◆ Chara

Chara InvOwner.Chara
get

Definition at line 618 of file InvOwner.cs.

Referenced by UIInventory.OnInit().

◆ ContainerType

ContainerType InvOwner.ContainerType
get

Definition at line 620 of file InvOwner.cs.

◆ CopyOnTransfer

virtual bool InvOwner.CopyOnTransfer
get

Definition at line 598 of file InvOwner.cs.

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

◆ DenyImportant

virtual bool InvOwner.DenyImportant
get

Definition at line 628 of file InvOwner.cs.

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

◆ destInvOwner

InvOwner InvOwner.destInvOwner
get

Definition at line 630 of file InvOwner.cs.

631 {
632 get
633 {
634 if (!owner.IsPC)
635 {
636 return Main;
637 }
638 return Trader;
639 }
640 }
static InvOwner Main
Definition: InvOwner.cs:526

Referenced by ListInteractions().

◆ destInvY

virtual int InvOwner.destInvY
get

Definition at line 594 of file InvOwner.cs.

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

◆ FreeTransfer

bool InvOwner.FreeTransfer
staticget

Definition at line 546 of file InvOwner.cs.

547 {
548 get
549 {
550 if (HasTrader)
551 {
552 return Trader.currency == CurrencyType.None;
553 }
554 return true;
555 }
556 }

Referenced by AllowHold(), and OnClick().

◆ HasTrader

bool InvOwner.HasTrader
staticget

◆ HasTransaction

virtual bool InvOwner.HasTransaction
get

Definition at line 596 of file InvOwner.cs.

Referenced by OnCtrlClick().

◆ IDCurrency

string InvOwner.IDCurrency
get

Definition at line 642 of file InvOwner.cs.

Referenced by LayerDragGrid.RefreshCost().

◆ InvertSell

virtual bool InvOwner.InvertSell
get

Definition at line 622 of file InvOwner.cs.

◆ IsMagicChest

bool InvOwner.IsMagicChest
get

Definition at line 604 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 626 of file InvOwner.cs.

◆ SingleTarget

virtual bool InvOwner.SingleTarget
get

Definition at line 600 of file InvOwner.cs.

Referenced by InvOwner.Transaction.Process().

◆ Things

List<Thing> InvOwner.Things
get

Definition at line 606 of file InvOwner.cs.

607 {
608 get
609 {
611 {
612 return Container.things;
613 }
614 return Container.things.grid;
615 }
616 }
List< Thing > grid

◆ UseGuide

◆ UseHomeResource

bool InvOwner.UseHomeResource
get

Definition at line 602 of file InvOwner.cs.

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


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