diff --git a/apps/openmw-mp/Script/Functions/Items.cpp b/apps/openmw-mp/Script/Functions/Items.cpp index 93f998b5f..a1ec2f043 100644 --- a/apps/openmw-mp/Script/Functions/Items.cpp +++ b/apps/openmw-mp/Script/Functions/Items.cpp @@ -31,6 +31,14 @@ unsigned int ItemFunctions::GetInventoryChangesSize(unsigned short pid) noexcept return player->inventoryChanges.count; } +unsigned int ItemFunctions::GetInventoryChangesAction(unsigned short pid) noexcept +{ + Player *player; + GET_PLAYER(pid, player, 0); + + return player->inventoryChanges.action; +} + void ItemFunctions::EquipItem(unsigned short pid, unsigned short slot, const char *refId, unsigned int count, int charge, double enchantmentCharge) noexcept { diff --git a/apps/openmw-mp/Script/Functions/Items.hpp b/apps/openmw-mp/Script/Functions/Items.hpp index 4735a4675..9a9869eaf 100644 --- a/apps/openmw-mp/Script/Functions/Items.hpp +++ b/apps/openmw-mp/Script/Functions/Items.hpp @@ -6,6 +6,7 @@ \ {"GetEquipmentSize", ItemFunctions::GetEquipmentSize},\ {"GetInventoryChangesSize", ItemFunctions::GetInventoryChangesSize},\ + {"GetInventoryChangesAction", ItemFunctions::GetInventoryChangesAction},\ \ {"EquipItem", ItemFunctions::EquipItem},\ {"UnequipItem", ItemFunctions::UnequipItem},\ @@ -67,6 +68,14 @@ public: */ static unsigned int GetInventoryChangesSize(unsigned short pid) noexcept; + /** + * \brief Get the action type used in a player's latest inventory changes. + * + * \param pid The player ID whose inventory changes should be used. + * \return The action type (0 for SET, 1 for ADD, 2 for REMOVE). + */ + static unsigned int GetInventoryChangesAction(unsigned short pid) noexcept; + /** * \brief Equip an item in a certain slot of the equipment of a player. * diff --git a/apps/openmw-mp/Script/Functions/Spells.hpp b/apps/openmw-mp/Script/Functions/Spells.hpp index 29aa66c10..9e3dabc70 100644 --- a/apps/openmw-mp/Script/Functions/Spells.hpp +++ b/apps/openmw-mp/Script/Functions/Spells.hpp @@ -39,7 +39,7 @@ public: /** * \brief Get the action type used in a player's latest spellbook changes. * - * \param pid The player ID whose faction changes should be used. + * \param pid The player ID whose spellbook changes should be used. * \return The action type (0 for SET, 1 for ADD, 2 for REMOVE). */ static unsigned int GetSpellbookChangesAction(unsigned short pid) noexcept;