1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-04-01 21:06:43 +00:00

[Server] Add server functions for reading equipment change indexes

This commit is contained in:
David Cernat 2020-07-07 15:41:03 +02:00
parent e85f506569
commit 3a8831dc15
2 changed files with 37 additions and 0 deletions

View file

@ -22,6 +22,14 @@ int ItemFunctions::GetEquipmentSize() noexcept
return MWWorld::InventoryStore::Slots;
}
unsigned int ItemFunctions::GetEquipmentChangesSize(unsigned short pid) noexcept
{
Player* player;
GET_PLAYER(pid, player, 0);
return player->equipmentIndexChanges.size();
}
unsigned int ItemFunctions::GetInventoryChangesSize(unsigned short pid) noexcept
{
Player *player;
@ -96,6 +104,15 @@ bool ItemFunctions::HasItemEquipped(unsigned short pid, const char* refId)
return false;
}
int ItemFunctions::GetEquipmentChangesSlot(unsigned short pid, unsigned int changeIndex) noexcept
{
Player* player;
GET_PLAYER(pid, player, 0);
return player->equipmentIndexChanges[changeIndex];
}
const char *ItemFunctions::GetEquipmentItemRefId(unsigned short pid, unsigned short slot) noexcept
{
Player *player;

View file

@ -5,6 +5,7 @@
{"ClearInventoryChanges", ItemFunctions::ClearInventoryChanges},\
\
{"GetEquipmentSize", ItemFunctions::GetEquipmentSize},\
{"GetEquipmentChangesSize", ItemFunctions::GetEquipmentChangesSize},\
{"GetInventoryChangesSize", ItemFunctions::GetInventoryChangesSize},\
{"GetInventoryChangesAction", ItemFunctions::GetInventoryChangesAction},\
\
@ -17,6 +18,7 @@
\
{"HasItemEquipped", ItemFunctions::HasItemEquipped},\
\
{"GetEquipmentChangesSlot", ItemFunctions::GetEquipmentChangesSlot},\
{"GetEquipmentItemRefId", ItemFunctions::GetEquipmentItemRefId},\
{"GetEquipmentItemCount", ItemFunctions::GetEquipmentItemCount},\
{"GetEquipmentItemCharge", ItemFunctions::GetEquipmentItemCharge},\
@ -64,6 +66,14 @@ public:
*/
static int GetEquipmentSize() noexcept;
/**
* \brief Get the number of indexes in a player's latest equipment changes.
*
* \param pid The player ID whose equipment changes should be used.
* \return The number of indexes.
*/
static unsigned int GetEquipmentChangesSize(unsigned short pid) noexcept;
/**
* \brief Get the number of indexes in a player's latest inventory changes.
*
@ -135,6 +145,16 @@ public:
*/
static bool HasItemEquipped(unsigned short pid, const char* refId);
/**
* \brief Get the slot used for the equipment item at a specific index in the most recent
* equipment changes.
*
* \param pid The player ID.
* \param changeIndex The index of the equipment change.
* \return The slot.
*/
static int GetEquipmentChangesSlot(unsigned short pid, unsigned int changeIndex) noexcept;
/**
* \brief Get the refId of the item in a certain slot of the equipment of a player.
*