Elin Decompiled Documentation EA 23.321 Nightly Patch 1
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 (long a)
 
static int rnd (int a)
 
static int curve (long _a, int start, int step, int rate=75)
 
static int sqrt (int a)
 
static int rndHalf (int a)
 
static float rndf (float a)
 
static int rndSqrt (int a)
 
static void Wait (float a, Card c)
 
static void Wait (float a, Point p)
 
static int Bigger (int a, int b)
 
static int Smaller (int a, int b)
 

Detailed Description

Definition at line 5 of file InvOwner.cs.

Constructor & Destructor Documentation

◆ InvOwner()

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

Definition at line 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:6
static FactionBranch BranchOrHomeBranch
Definition: EClass.cs:25
HomeResourceManager resources
Card owner
Definition: InvOwner.cs:533
Card Container
Definition: InvOwner.cs:535
CurrencyType currency
Definition: InvOwner.cs:527
PriceType priceType
Definition: InvOwner.cs:529
HomeResource homeResource
Definition: InvOwner.cs:531

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

Member Function Documentation

◆ AllowDrop()

virtual bool InvOwner.AllowDrop ( Thing  t)
inlinevirtual

Reimplemented in InvOwnerEquip.

Definition at line 686 of file InvOwner.cs.

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

References EClass._zone, and Spatial.IsRegion.

Referenced by CanAltClick().

◆ AllowHold()

virtual bool InvOwner.AllowHold ( Thing  t)
inlinevirtual

Reimplemented in InvOwnerAutoCombatBar, InvOwnerDraglet, and InvOwnerToolbelt.

Definition at line 639 of file InvOwner.cs.

640 {
641 if (!t.trait.CanBeDropped)
642 {
643 return false;
644 }
645 if (t.isEquipped && 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:51
virtual Chara Chara
Definition: Card.cs:2122
string id
Definition: Card.cs:36
bool isNPCProperty
Definition: Card.cs:557
bool IsCursed
Definition: Card.cs:2309
Trait trait
Definition: Card.cs:54
virtual bool IsPC
Definition: Card.cs:2197
virtual bool isChara
Definition: Card.cs:2135
bool isGifted
Definition: Card.cs:785
Affinity affinity
Definition: Chara.cs:318
static bool FreeTransfer
Definition: InvOwner.cs:542
bool isEquipped
Definition: Thing.cs:17
virtual bool CanBeDropped
Definition: Trait.cs:313
virtual bool CanOnlyCarry
Definition: Trait.cs:305

References Chara.affinity, Trait.CanBeDropped, Affinity.CanForceTradeEquip(), Trait.CanOnlyCarry, Card.Chara, Container, FreeTransfer, Card.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 1586 of file InvOwner.cs.

1587 {
1588 _ = button.card;
1590 {
1591 return;
1592 }
1593 if (!EClass.pc.HasNoGoal)
1594 {
1595 SE.Beep();
1596 return;
1597 }
1598 ListInteraction listInteraction = ListInteractions(button, context: false);
1599 if (listInteraction.Count == 0)
1600 {
1601 SE.Beep();
1602 return;
1603 }
1604 foreach (Interaction item in listInteraction)
1605 {
1606 if (EClass.player.IsPriorityAction(item.idPriority, listInteraction.thing))
1607 {
1608 listInteraction.Insert(0, item);
1609 break;
1610 }
1611 }
1612 if (!repeat || listInteraction[0].repeatable)
1613 {
1614 listInteraction[0].action();
1615 }
1616 }
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:1023
static Player player
Definition: EClass.cs:13
static Chara pc
Definition: EClass.cs:15
ListInteraction ListInteractions(ButtonGrid b, bool context)
Definition: InvOwner.cs:1296
bool IsPriorityAction(string id, Thing t)
Definition: Player.cs:1570

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:2110
Definition: EInput.cs:8
static bool isAltDown
Definition: EInput.cs:276
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:161
static bool isCtrlDown
Definition: EInput.cs:274

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

Referenced by OnClick().

◆ CanOpenContainer()

bool InvOwner.CanOpenContainer ( Thing  t)
inline

Definition at line 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:56
Definition: Thing.cs:8
virtual bool CanOpenContainer
Definition: Trait.cs:246

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

Referenced by ListInteractions().

◆ CanShiftClick()

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

Definition at line 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:39
Card GetRootCard()
Definition: Card.cs:3600
bool CanAcceptItem(Card t, int num=-1, bool skipImportantCheck=false)
Definition: Chara.cs:8594
static bool isShiftDown
Definition: EInput.cs:272
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:225

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

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

◆ CreateDefaultContainer()

virtual Thing InvOwner.CreateDefaultContainer ( )
inlinevirtual

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

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

1546 {
1547 if (button == null || button.gameObject == null)
1548 {
1549 return "";
1550 }
1551 ListInteraction list = ListInteractions(button, context: false);
1552 foreach (Interaction item in list)
1553 {
1554 if (EClass.player.IsPriorityAction(item.idPriority, list.thing))
1555 {
1556 list.Insert(0, item);
1557 break;
1558 }
1559 }
1560 if (button.card.trait.HoldAsDefaultInteraction && list.Count > 0)
1561 {
1562 Interaction interaction = list[0];
1563 if (interaction.name == "actPick" || interaction.name == "actHold" || interaction.name == "actHoldTool")
1564 {
1565 return null;
1566 }
1567 }
1568 list.ForeachReverse(delegate(Interaction a)
1569 {
1570 if (a.name == "actPick" || a.name == "actHold" || a.name == "actHoldTool")
1571 {
1572 list.Remove(a);
1573 }
1574 });
1575 if (list.Count == 0)
1576 {
1577 return null;
1578 }
1579 if (list[0].name == "actTransfer")
1580 {
1581 return null;
1582 }
1583 return list[0].name.lang();
1584 }
virtual bool HoldAsDefaultInteraction
Definition: Trait.cs:133

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

◆ GetPrice()

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

Reimplemented in InvOwnerDraglet.

Definition at line 1640 of file InvOwner.cs.

1641 {
1642 return ShopTransaction.current.GetPrice(t, num, sell);
1643 }
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 1645 of file InvOwner.cs.

1646 {
1647 int price = GetPrice(t, currency, num, sell);
1648 string @ref = (Trader.UseHomeResource ? Trader.homeResource.Name : ((currency == CurrencyType.Influence) ? "influence".lang() : EClass.sources.things.map[IDCurrency].GetName()));
1649 string ref2 = ((price == 0) ? "" : "invInteraction3".lang(price.ToFormat() ?? "", @ref));
1650 string text = "invInteraction1".lang(num.ToString() ?? "", ref2, (sell ? "invSell" : "invBuy").lang());
1651 if (!sell && EClass.pc.GetCurrency(Currency.ToID(currency)) < price)
1652 {
1653 text = text.TagColor(FontColor.Bad, SkinManager.DarkColors);
1654 }
1655 return text;
1656 }
FontColor
Definition: FontColor.cs:2
int GetCurrency(string id="money")
Definition: Card.cs:4149
static string ToID(CurrencyType currency)
Definition: Currency.cs:3
static SourceManager sources
Definition: EClass.cs:43
virtual int GetPrice(Thing t, CurrencyType currency, int num, bool sell)
Definition: InvOwner.cs:1640
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:3264
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 1680 of file InvOwner.cs.

1681 {
1682 return "icon_" + IDCurrency;
1683 }

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

1686 {
1687 return false;
1688 }

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 || (Trader.currency != CurrencyType.Influence && t.GetPrice(Trader.currency, sell: false, Trader.priceType) == 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 (AllowHold(t) && !t.isEquipped && !HasTrader)
1387 {
1388 Interaction item = listInteraction.Add((EClass.pc.held == t) ? "actPick" : "actHold", 60, delegate
1389 {
1390 TryHold(t);
1391 });
1393 {
1394 listInteraction.Remove(item);
1395 listInteraction.Insert(0, item);
1396 }
1398 {
1399 listInteraction.Add("actHoldTool", 70, delegate
1400 {
1401 if (t != EClass.pc.held)
1402 {
1403 if (TryHold(t))
1404 {
1405 HotItemHeld.disableTool = true;
1406 }
1407 }
1408 else
1409 {
1410 HotItemHeld.disableTool = true;
1411 }
1412 }, "remove");
1413 }
1414 }
1415 if (context)
1416 {
1418 {
1419 if (t.Num > 1)
1420 {
1421 listInteraction.Add("actSplit", 50, delegate
1422 {
1423 t.ShowSplitMenu(b, (HasTrader && currency != 0 && !owner.IsPC) ? new Transaction(b) : null);
1424 });
1425 }
1427 {
1428 listInteraction.Add(flag ? "dragForget" : "actDrop", 300, delegate
1429 {
1430 EClass.pc.DropThing(t);
1431 });
1432 }
1433 }
1434 bool flag4 = false;
1436 {
1437 flag4 = true;
1438 listInteraction.Add(t.c_isImportant ? "important_off" : "important_on", 299, delegate
1439 {
1440 t.c_isImportant = !t.c_isImportant;
1441 LayerInventory.SetDirty(t);
1442 SE.ClickOk();
1443 });
1444 }
1445 if (!flag4 && t.c_isImportant)
1446 {
1447 listInteraction.Add(t.c_isImportant ? "important_off" : "important_on", 299, delegate
1448 {
1449 t.c_isImportant = !t.c_isImportant;
1450 LayerInventory.SetDirty(t);
1451 SE.ClickOk();
1452 });
1453 }
1454 }
1455 return listInteraction;
1456 }
bool IsPCFactionOrMinion
Definition: Card.cs:2342
bool c_isImportant
Definition: Card.cs:1051
Card held
Definition: Chara.cs:70
void DropThing(Thing t, int num=-1)
Definition: Chara.cs:4832
InvOwner destInvOwner
Definition: InvOwner.cs:626
virtual bool DenyImportant
Definition: InvOwner.cs:623
bool CanOpenContainer(Thing t)
Definition: InvOwner.cs:1283
virtual string langTransfer
Definition: InvOwner.cs:587
virtual bool ShouldShowGuide(Thing t)
Definition: InvOwner.cs:681
virtual bool AllowSell
Definition: InvOwner.cs:558
bool CanSellBack(Thing t, int num=-1)
void ShowSplitMenu(ButtonGrid button, InvOwner.Transaction trans=null)
Definition: Thing.cs:1858
override int GetPrice(CurrencyType currency=CurrencyType.Money, bool sell=false, PriceType priceType=PriceType.Default, Chara c=null)
Definition: Thing.cs:829
Definition: Trait.cs:7
virtual bool CanBeHeldAsFurniture
Definition: Trait.cs:350

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

◆ ListInteractions() [2/2]

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

Reimplemented in InvOwnerAlly, InvOwnerEquip, and InvOwnerShop.

Definition at line 1482 of file InvOwner.cs.

1483 {
1484 if (!owner.IsPC)
1485 {
1486 return;
1487 }
1488 if (CanOpenContainer(t) && !list.Contains("actContainer"))
1489 {
1490 list.Add(LayerInventory.IsOpen(t) ? "close" : "actContainer", 100, delegate
1491 {
1492 (t.trait as TraitContainer).TryOpen();
1493 });
1494 }
1495 if (HasTrader)
1496 {
1497 return;
1498 }
1499 CharaBody body = owner.Chara.body;
1500 BodySlot slot = body.GetSlot(t, onlyEmpty: false, EInput.isShiftDown);
1501 if (slot != null)
1502 {
1503 Card tParent = t.parentCard;
1504 int tInvX = t.invX;
1505 int tInvY = t.invY;
1506 if (tInvY != 1)
1507 {
1508 list.Add("invEquip", 90, delegate
1509 {
1510 if (slot.thing != null && slot.thing.blessedState <= BlessedState.Cursed)
1511 {
1512 Msg.Say("unequipCursed", slot.thing);
1513 SE.Play("curse3");
1514 }
1515 else
1516 {
1517 if (EClass.pc.held == t)
1518 {
1519 EClass.pc.PickHeld();
1520 }
1521 Thing thing = slot.thing;
1522 body.Equip(t, slot);
1523 EClass.Sound.Play("equip");
1524 if (thing != null)
1525 {
1526 if (tParent != null)
1527 {
1528 tParent.AddThing(thing);
1529 thing.invX = tInvX;
1530 thing.invY = tInvY;
1531 }
1532 else if (thing.parent is Card && (thing.parent as Card).things.IsOverflowing())
1533 {
1534 thing.parent.RemoveCard(thing);
1535 EClass.pc.Pick(thing);
1536 }
1537 }
1538 }
1539 });
1540 }
1541 }
1542 trait.OnListInteraction(list, b, context);
1543 }
BlessedState
Definition: BlessedState.cs:2
if(!match.Success)
Thing thing
Definition: BodySlot.cs:8
int invY
Definition: Card.cs:2007
Thing AddThing(string id, int lv=-1)
Definition: Card.cs:3273
int invX
Definition: Card.cs:1995
BlessedState blessedState
Definition: Card.cs:281
Card parentCard
Definition: Card.cs:106
bool Equip(Thing thing, BodySlot slot=null, bool msg=true)
Definition: CharaBody.cs:194
BodySlot GetSlot(Thing t, bool onlyEmpty=false, bool secondSlot=false)
Definition: CharaBody.cs:369
static SoundManager Sound
Definition: EClass.cs:47
static bool IsOpen(Thing t)
virtual void OnListInteraction(InvOwner.ListInteraction list, ButtonGrid b, bool context)
Definition: Trait.cs:752

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:7138
void ShowEmo(Emo _emo=Emo.none, float duration=0f, bool skipSame=true)
Definition: Card.cs:6546
virtual bool IsPCFaction
Definition: Card.cs:2339
void Say(string lang, string ref1=null, string ref2=null)
Definition: Card.cs:7256
void InstantEat(Thing t=null, bool sound=true)
Definition: Chara.cs:7922
void ModAffinity(Chara c, int a, bool show=true, bool showOnlyEmo=false)
Definition: Chara.cs:8290
Thing Pick(Thing t, bool msg=true, bool tryStack=true)
Definition: Chara.cs:4515
static UI ui
Definition: EClass.cs:17
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:1685
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:2610

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:3259
SourceCategory.Row category
Definition: Card.cs:2101
bool IsEquippable(Thing thing, BodySlot slot, bool text=true)
Definition: CharaBody.cs:110
Definition: Chara.cs:10
new GameConfig game
Definition: CoreConfig.cs:617
CoreConfig config
Definition: Core.cs:70
static CursorInfo Invalid
static void SetCursor(CursorInfo info=null, int _priority=0)
static Game game
Definition: EClass.cs:9
static Core core
Definition: EClass.cs:7
bool UseGrid
Definition: Game.cs:266
BodySlot slot
Definition: InvOwnerEquip.cs:3
virtual bool AllowDropOnDrag
Definition: InvOwner.cs:585
void Grab(DragItemCard.DragInfo from)
Definition: InvOwner.cs: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:1701
virtual bool CanCopy(Thing t)
Definition: Trait.cs:1642

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:362
static float clickTimer
Definition: InvOwner.cs:523

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

◆ OnShiftClick()

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

Definition at line 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:78
bool IsHotItem
Definition: Card.cs:122
void PlaySoundDrop(bool spatial=true)
Definition: Card.cs:6563
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:2227
static void Redraw()
Definition: WidgetEquip.cs:77

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

Referenced by DragItemCard.OnStartDrag().

◆ OnWriteNote()

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

Reimplemented in InvOwnerEquip.

Definition at line 1658 of file InvOwner.cs.

1659 {
1660 if (button.card is Thing t)
1661 {
1662 bool flag = HasTrader && Trader.currency != 0 && (destInvOwner != Trader || Trader.AllowSell || (ShopTransaction.current?.CanSellBack(t) ?? false));
1663 if (flag && Trader.UseGuide && !Trader.ShouldShowGuide(t))
1664 {
1665 flag = false;
1666 }
1667 if (flag)
1668 {
1669 Transaction transaction = new Transaction(button);
1670 n.Space(8);
1671 UIItem uIItem = n.AddExtra<UIItem>("costPrice");
1672 string id = IDCostIcon(t);
1673 int price = transaction.GetPrice();
1674 uIItem.text1.SetText(Lang._currency(price), transaction.IsValid() ? FontColor.Good : FontColor.Bad);
1675 uIItem.image1.sprite = (Trader.UseHomeResource ? Trader.homeResource.Sprite : SpriteSheet.Get(id));
1676 }
1677 }
1678 }
virtual bool UseGuide
Definition: InvOwner.cs:571
virtual string IDCostIcon(Thing t)
Definition: InvOwner.cs:1680
Definition: Lang.cs:7
static string _currency(object a, string IDCurrency)
Definition: Lang.cs:161
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:163

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

1619 {
1620 if (!EClass.pc.HasNoGoal)
1621 {
1622 SE.Beep();
1623 return;
1624 }
1625 ListInteraction listInteraction = ListInteractions(button, context: true);
1626 if (listInteraction.Count == 0)
1627 {
1628 SE.BeepSmall();
1629 return;
1630 }
1631 UIContextMenu uIContextMenu = EClass.ui.CreateContextMenuInteraction();
1632 listInteraction.Sort((Interaction a, Interaction b) => a.priority - b.priority);
1633 foreach (Interaction item in listInteraction)
1634 {
1635 uIContextMenu.AddButton(item.name, item.action);
1636 }
1637 uIContextMenu.Show();
1638 }
void Show(UIItem i)
void AddButton(Func< string > funcText, UnityAction action=null)

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

Referenced by ButtonGrid.OnMiddleClick().

◆ TryHold()

bool InvOwner.TryHold ( Thing  t)
inline

Definition at line 1458 of file InvOwner.cs.

1459 {
1460 if (!AllowHold(t) || t.isEquipped || HasTrader)
1461 {
1462 return false;
1463 }
1464 if (EClass.pc.held == t)
1465 {
1466 if (t.trait.CanOnlyCarry)
1467 {
1468 SE.Beep();
1469 return true;
1470 }
1471 EClass.pc.PickHeld();
1472 }
1473 else
1474 {
1475 EClass.pc.HoldCard(t);
1476 }
1478 SE.SelectHotitem();
1479 return true;
1480 }
void HoldCard(Card t, int num=-1)
Definition: Chara.cs:4679
void PickHeld(bool msg=false)
Definition: Chara.cs:4735
void RefreshCurrentHotItem()
Definition: Player.cs:2271

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

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

Member Data Documentation

◆ buttons

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

◆ clickTimer

float InvOwner.clickTimer
static

Definition at line 523 of file InvOwner.cs.

Referenced by OnRightPressed().

◆ Container

◆ currency

◆ forceGive

ForceGiveData InvOwner.forceGive = new ForceGiveData()
static

Definition at line 517 of file InvOwner.cs.

Referenced by Init(), and OnClick().

◆ homeResource

HomeResource InvOwner.homeResource

◆ includeChildren

bool InvOwner.includeChildren

Definition at line 525 of file InvOwner.cs.

◆ Main

InvOwner InvOwner.Main
static

Definition at line 521 of file InvOwner.cs.

◆ owner

◆ priceType

PriceType InvOwner.priceType

◆ Trader

Property Documentation

◆ AllowAutouse

virtual bool InvOwner.AllowAutouse
get

Definition at line 553 of file InvOwner.cs.

Referenced by OnRightClick().

◆ AllowContext

virtual bool InvOwner.AllowContext
get

Definition at line 555 of file InvOwner.cs.

Referenced by ButtonGrid.OnMiddleClick().

◆ AllowDropOnDrag

virtual bool InvOwner.AllowDropOnDrag
get

Definition at line 585 of file InvOwner.cs.

Referenced by OnDrag().

◆ AllowSell

virtual bool InvOwner.AllowSell
get

Definition at line 557 of file InvOwner.cs.

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

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: