Item functions¶
-
class ItemFunctions¶
Public Static Functions
-
static void ClearInventoryChanges(unsigned short pid) noexcept¶
Clear the last recorded inventory changes for a player.
This is used to initialize the sending of new PlayerInventory packets.
- Parameters
pid – The player ID whose inventory changes should be used.
- Returns
void
-
static int GetEquipmentSize() noexcept¶
Get the number of slots used for equipment.
The number is 19 before any dehardcoding is done in OpenMW.
- Returns
The number of slots.
-
static unsigned int GetEquipmentChangesSize(unsigned short pid) noexcept¶
Get the number of indexes in a player’s latest equipment changes.
- Parameters
pid – The player ID whose equipment changes should be used.
- Returns
The number of indexes.
-
static unsigned int GetInventoryChangesSize(unsigned short pid) noexcept¶
Get the number of indexes in a player’s latest inventory changes.
- Parameters
pid – The player ID whose inventory changes should be used.
- Returns
The number of indexes.
-
static unsigned int GetInventoryChangesAction(unsigned short pid) noexcept¶
Get the action type used in a player’s latest inventory changes.
- Parameters
pid – The player ID whose inventory changes should be used.
- Returns
The action type (0 for SET, 1 for ADD, 2 for REMOVE).
-
static void SetInventoryChangesAction(unsigned short pid, unsigned char action) noexcept¶
Set the action type in a player’s inventory changes.
- Parameters
pid – The player ID whose inventory changes should be used.
action – The action (0 for SET, 1 for ADD, 2 for REMOVE).
- Returns
void
-
static void EquipItem(unsigned short pid, unsigned short slot, const char *refId, unsigned int count, int charge, double enchantmentCharge = -1) noexcept¶
Equip an item in a certain slot of the equipment of a player.
- Parameters
pid – The player ID.
slot – The equipment slot.
refId – The refId of the item.
count – The count of the item.
charge – The charge of the item.
enchantmentCharge – The enchantment charge of the item.
- Returns
void
-
static void UnequipItem(unsigned short pid, unsigned short slot) noexcept¶
Unequip the item in a certain slot of the equipment of a player.
- Parameters
pid – The player ID.
slot – The equipment slot.
- Returns
void
-
static void AddItemChange(unsigned short pid, const char *refId, unsigned int count, int charge, double enchantmentCharge, const char *soul) noexcept¶
Add an item change to a player’s inventory changes.
- Parameters
pid – The player ID.
refId – The refId of the item.
count – The count of the item.
charge – The charge of the item.
enchantmentCharge – The enchantment charge of the item.
soul – The soul of the item.
- Returns
void
-
static bool HasItemEquipped(unsigned short pid, const char *refId)¶
Check whether a player has equipped an item with a certain refId in any slot.
- Parameters
pid – The player ID.
refId – The refId of the item.
- Returns
Whether the player has the item equipped.
-
static int GetEquipmentChangesSlot(unsigned short pid, unsigned int changeIndex) noexcept¶
Get the slot used for the equipment item at a specific index in the most recent equipment changes.
- Parameters
pid – The player ID.
changeIndex – The index of the equipment change.
- Returns
The slot.
-
static const char *GetEquipmentItemRefId(unsigned short pid, unsigned short slot) noexcept¶
Get the refId of the item in a certain slot of the equipment of a player.
- Parameters
pid – The player ID.
slot – The slot of the equipment item.
- Returns
The refId.
-
static int GetEquipmentItemCount(unsigned short pid, unsigned short slot) noexcept¶
Get the count of the item in a certain slot of the equipment of a player.
- Parameters
pid – The player ID.
slot – The slot of the equipment item.
- Returns
The item count.
-
static int GetEquipmentItemCharge(unsigned short pid, unsigned short slot) noexcept¶
Get the charge of the item in a certain slot of the equipment of a player.
- Parameters
pid – The player ID.
slot – The slot of the equipment item.
- Returns
The charge.
-
static double GetEquipmentItemEnchantmentCharge(unsigned short pid, unsigned short slot) noexcept¶
Get the enchantment charge of the item in a certain slot of the equipment of a player.
- Parameters
pid – The player ID.
slot – The slot of the equipment item.
- Returns
The enchantment charge.
-
static const char *GetInventoryItemRefId(unsigned short pid, unsigned int index) noexcept¶
Get the refId of the item at a certain index in a player’s latest inventory changes.
- Parameters
pid – The player ID whose inventory changes should be used.
index – The index of the inventory item.
- Returns
The refId.
-
static int GetInventoryItemCount(unsigned short pid, unsigned int index) noexcept¶
Get the count of the item at a certain index in a player’s latest inventory changes.
- Parameters
pid – The player ID whose inventory changes should be used.
index – The index of the inventory item.
- Returns
The item count.
-
static int GetInventoryItemCharge(unsigned short pid, unsigned int index) noexcept¶
Get the charge of the item at a certain index in a player’s latest inventory changes.
- Parameters
pid – The player ID whose inventory changes should be used.
index – The index of the inventory item.
- Returns
The charge.
-
static double GetInventoryItemEnchantmentCharge(unsigned short pid, unsigned int index) noexcept¶
Get the enchantment charge of the item at a certain index in a player’s latest inventory changes.
- Parameters
pid – The player ID whose inventory changes should be used.
index – The index of the inventory item.
- Returns
The enchantment charge.
-
static const char *GetInventoryItemSoul(unsigned short pid, unsigned int index) noexcept¶
Get the soul of the item at a certain index in a player’s latest inventory changes.
- Parameters
pid – The player ID whose inventory changes should be used.
index – The index of the inventory item.
- Returns
The soul.
-
static const char *GetUsedItemRefId(unsigned short pid) noexcept¶
Get the refId of the item last used by a player.
- Parameters
pid – The player ID.
- Returns
The refId.
-
static int GetUsedItemCount(unsigned short pid) noexcept¶
Get the count of the item last used by a player.
- Parameters
pid – The player ID.
- Returns
The item count.
-
static int GetUsedItemCharge(unsigned short pid) noexcept¶
Get the charge of the item last used by a player.
- Parameters
pid – The player ID.
- Returns
The charge.
-
static double GetUsedItemEnchantmentCharge(unsigned short pid) noexcept¶
Get the enchantment charge of the item last used by a player.
- Parameters
pid – The player ID.
- Returns
The enchantment charge.
-
static const char *GetUsedItemSoul(unsigned short pid) noexcept¶
Get the soul of the item last used by a player.
- Parameters
pid – The player ID.
- Returns
The soul.
-
static void SendEquipment(unsigned short pid) noexcept¶
Send a PlayerEquipment packet with a player’s equipment.
It is always sent to all players.
- Parameters
pid – The player ID whose equipment should be sent.
- Returns
void
-
static void SendInventoryChanges(unsigned short pid, bool sendToOtherPlayers, bool skipAttachedPlayer) noexcept¶
Send a PlayerInventory packet with a player’s recorded inventory changes.
- Parameters
pid – The player ID whose inventory changes should be used.
sendToOtherPlayers – Whether this packet should be sent to players other than the player attached to the packet (false by default).
skipAttachedPlayer – Whether the packet should skip being sent to the player attached to the packet (false by default).
- Returns
void
-
static void SendItemUse(unsigned short pid) noexcept¶
Send a PlayerItemUse causing a player to use their recorded usedItem.
- Parameters
pid – The player ID affected.
- Returns
void
-
static void ClearInventoryChanges(unsigned short pid) noexcept¶