43 invInventoryCount = 9 * 3,
48 invInventoryOffset = invArmorOffset + invArmorCount,
49 invHotbarOffset = invInventoryOffset + invInventoryCount,
50 invShieldOffset = invHotbarOffset + invHotbarCount,
51 invNumSlots = invShieldOffset + invShieldCount
66 int HowManyCanFit(
const cItem & a_ItemStack,
bool a_ConsiderEmptySlots =
true);
69 int HowManyCanFit(
const cItem & a_ItemStack,
int a_BeginSlotNum,
int a_EndSlotNum,
bool a_ConsiderEmptySlots =
true);
76 int AddItem(
const cItem & a_ItemStack,
bool a_AllowNewStacks =
true);
84 int AddItems(
cItems & a_ItemStackList,
bool a_AllowNewStacks);
88 int RemoveItem(
const cItem & a_ItemStack);
91 bool RemoveOneEquippedItem(
void);
94 int HowManyItems(
const cItem & a_Item);
97 bool HasItems(
const cItem & a_ItemStack);
100 void SendEquippedSlot();
115 void CopyToItems(
cItems & a_Items);
125 const cItem & GetSlot(
int a_SlotNum)
const;
127 const cItem & GetArmorSlot(
int a_ArmorSlotNum)
const;
129 const cItem & GetInventorySlot(
int a_InventorySlotNum)
const;
131 const cItem & GetHotbarSlot(
int a_HotBarSlotNum)
const;
133 const cItem & GetShieldSlot()
const;
135 const cItem & GetEquippedItem(
void)
const;
137 void SetSlot(
int a_SlotNum,
const cItem & a_Item);
139 void SetArmorSlot(
int a_ArmorSlotNum,
const cItem & a_Item);
141 void SetInventorySlot(
int a_InventorySlotNum,
const cItem & a_Item);
143 void SetHotbarSlot(
int a_HotBarSlotNum,
const cItem & a_Item);
145 void SetShieldSlot(
const cItem & a_Item);
147 void SetEquippedSlotNum(
int a_SlotNum);
155 int ChangeSlotCount(
int a_SlotNum,
int a_AddToCount);
158 bool DamageItem(
int a_SlotNum,
short a_Amount);
161 bool DamageEquippedItem(
short a_Amount = 1);
171 void SendSlot(
int a_SlotNum);
174 void UpdateItems(
void);
177 static int ArmorSlotNumToEntityEquipmentID(
short a_ArmorSlotNum);
179 void SaveToJson(Json::Value & a_Value);
180 bool LoadFromJson(Json::Value & a_Value);
183 bool AddToBar(
cItem & a_Item,
const int a_Offset,
const int a_Size,
bool * a_bChangedSlots,
int a_Mode = 0);
195 const cItemGrid * GetGridForSlotNum(
int a_SlotNum,
int & a_GridSlotNum)
const;
198 cItemGrid * GetGridForSlotNum(
int a_SlotNum,
int & a_GridSlotNum);
201 virtual void OnSlotChanged(
cItemGrid * a_ItemGrid,
int a_SlotNum)
override;
cItemGrid & GetInventoryGrid(void)
Returns the cItemGrid object representing the main inventory slots.
const cItem & GetEquippedBoots(void) const
cItemGrid m_InventorySlots
cItemGrid & GetArmorGrid(void)
Returns the cItemGrid object representing the armor slots.
int GetEquippedSlotNum(void)
Returns slot number of equiped item.
This class is used as a callback for when a slot changes.
cPlayer & GetOwner(void)
Returns the player associated with this inventory.
virtual ~cInventory() override
const cItem & GetEquippedLeggings(void) const
const cItem & GetEquippedHelmet(void) const
const cPlayer & GetOwner(void) const
Returns the player associated with this inventory (const version)
cItemGrid & GetHotbarGrid(void)
Returns the cItemGrid object representing the hotbar slots.
This class represents the player's inventory The slots are divided into three areas: ...
const cItem & GetEquippedChestplate(void) const
This class bridges a vector of cItem for safe access via Lua.