[Server] Add GetInventoryChangesAction() script function

Additionally, fix a typo in the description of GetSpellBookChangesAction()
pull/471/head
David Cernat 6 years ago
parent 45b011452e
commit 75a64a69c7

@ -31,6 +31,14 @@ unsigned int ItemFunctions::GetInventoryChangesSize(unsigned short pid) noexcept
return player->inventoryChanges.count; 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, void ItemFunctions::EquipItem(unsigned short pid, unsigned short slot, const char *refId, unsigned int count,
int charge, double enchantmentCharge) noexcept int charge, double enchantmentCharge) noexcept
{ {

@ -6,6 +6,7 @@
\ \
{"GetEquipmentSize", ItemFunctions::GetEquipmentSize},\ {"GetEquipmentSize", ItemFunctions::GetEquipmentSize},\
{"GetInventoryChangesSize", ItemFunctions::GetInventoryChangesSize},\ {"GetInventoryChangesSize", ItemFunctions::GetInventoryChangesSize},\
{"GetInventoryChangesAction", ItemFunctions::GetInventoryChangesAction},\
\ \
{"EquipItem", ItemFunctions::EquipItem},\ {"EquipItem", ItemFunctions::EquipItem},\
{"UnequipItem", ItemFunctions::UnequipItem},\ {"UnequipItem", ItemFunctions::UnequipItem},\
@ -67,6 +68,14 @@ public:
*/ */
static unsigned int GetInventoryChangesSize(unsigned short pid) noexcept; 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. * \brief Equip an item in a certain slot of the equipment of a player.
* *

@ -39,7 +39,7 @@ public:
/** /**
* \brief Get the action type used in a player's latest spellbook changes. * \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). * \return The action type (0 for SET, 1 for ADD, 2 for REMOVE).
*/ */
static unsigned int GetSpellbookChangesAction(unsigned short pid) noexcept; static unsigned int GetSpellbookChangesAction(unsigned short pid) noexcept;

Loading…
Cancel
Save