When using the raw slot access functions, such as GetSlot() and SetSlot(), the slots are numbered
consecutively, each ItemGrid has its offset and count. To future-proff your plugins, use the named
constants instead of hard-coded numbers.
Name | Parameters | Return value | Notes |
AddItem |
cItem, [AllowNewStacks] |
number |
Adds an item to the storage; if AllowNewStacks is true (default), will also create new stacks in empty slots. Returns the number of items added |
AddItems |
cItems, [AllowNewStacks] |
number |
Same as AddItem, but for several items at once |
ChangeSlotCount |
SlotNum, AddToCount |
number |
Adds AddToCount to the count of items in the specified slot. If the slot was empty, ignores the call. Returns the new count in the slot, or -1 if invalid SlotNum |
Clear |
|
|
Empties all slots |
CopyToItems |
cItems |
|
Copies all non-empty slots into the cItems object provided; original cItems contents are preserved |
DamageEquippedItem |
[DamageAmount] |
bool |
Adds the specified damage (1 by default) to the currently equipped it |
DamageItem |
SlotNum, [DamageAmount] |
bool |
Adds the specified damage (1 by default) to the specified item, returns true if the item reached its max damage and should be destroyed |
GetArmorGrid |
|
cItemGrid |
Returns the ItemGrid representing the armor grid (1 x 4 slots) |
GetArmorSlot |
ArmorSlotNum |
cItem |
Returns the specified armor slot contents. Note that the returned item is read-only |
GetEquippedBoots |
|
cItem |
Returns the item in the "boots" slot of the armor grid. Note that the returned item is read-only |
GetEquippedChestplate |
|
cItem |
Returns the item in the "chestplate" slot of the armor grid. Note that the returned item is read-only |
GetEquippedHelmet |
|
cItem |
Returns the item in the "helmet" slot of the armor grid. Note that the returned item is read-only |
GetEquippedItem |
|
cItem |
Returns the currently selected item from the hotbar. Note that the returned item is read-only |
GetEquippedLeggings |
|
cItem |
Returns the item in the "leggings" slot of the armor grid. Note that the returned item is read-only |
GetEquippedSlotNum |
|
number |
Returns the hotbar slot number for the currently selected item |
GetHotbarGrid |
|
cItemGrid |
Returns the ItemGrid representing the hotbar grid (9 x 1 slots) |
GetHotbarSlot |
HotBarSlotNum |
cItem |
Returns the specified hotbar slot contents. Note that the returned item is read-only |
GetInventoryGrid |
|
cItemGrid |
Returns the ItemGrid representing the main inventory (9 x 3 slots) |
GetInventorySlot |
InventorySlotNum |
cItem |
Returns the specified main inventory slot contents. Note that the returned item is read-only |
GetOwner |
|
cPlayer |
Returns the player whose inventory this object represents |
GetSlot |
SlotNum |
cItem |
Returns the contents of the specified slot. Note that the returned item is read-only |
HasItems |
cItem |
bool |
Returns true if there are at least as many items of the specified type as in the parameter |
HowManyCanFit |
ItemStack, BeginSlotNum, EndSlotNum, [AllowNewStacks] |
number |
Returns how many items of the specified type would fit into the slot range specified. If AllowNewStacks is false, only considers slots already containing the specified item. AllowNewStacks defaults to true if not given. |
HowManyCanFit |
ItemStack, [AllowNewStacks] |
number |
Returns number of items out of a_ItemStack that can fit in the storage. If AllowNewStacks is false, only considers slots already containing the specified item. AllowNewStacks defaults to true if not given. |
HowManyItems |
cItem |
number |
Returns the number of the specified items that are currently stored |
RemoveItem |
cItem |
number |
Removes the specified item from the inventory, as many as possible, up to the item's m_ItemCount. Returns the number of items that were removed. |
RemoveOneEquippedItem |
|
|
Removes one item from the hotbar's currently selected slot |
SendEquippedSlot |
|
|
Sends the equipped item slot to the client |
SetArmorSlot |
ArmorSlotNum, cItem |
|
Sets the specified armor slot contents |
SetEquippedSlotNum |
EquippedSlotNum |
|
Sets the currently selected hotbar slot number |
SetHotbarSlot |
HotbarSlotNum, cItem |
|
Sets the specified hotbar slot contents |
SetInventorySlot |
InventorySlotNum, cItem |
|
Sets the specified main inventory slot contents |
SetSlot |
SlotNum, cItem |
|
Sets the specified slot contents |