[Server] Make spell script functions consistent with others

0.6.1
David Cernat 8 years ago
parent 7173a48f4b
commit cc91b32b2f

@ -38,7 +38,7 @@ public:
* \brief Add a new book to the book changes for a player.
*
* \param pid The player ID whose book changes should be used.
* \param topicId The bookId of the book.
* \param bookId The bookId of the book.
* \return void
*/
static void AddBook(unsigned short pid, const char* bookId) noexcept;

@ -12,7 +12,6 @@ void SpellFunctions::InitializeSpellbookChanges(unsigned short pid) noexcept
GET_PLAYER(pid, player, );
player->spellbookChanges.spells.clear();
player->spellbookChanges.action = SpellbookChanges::SET;
}
unsigned int SpellFunctions::GetSpellbookChangesSize(unsigned short pid) noexcept
@ -23,7 +22,7 @@ unsigned int SpellFunctions::GetSpellbookChangesSize(unsigned short pid) noexcep
return player->spellbookChanges.count;
}
unsigned int SpellFunctions::GetSpellbookAction(unsigned short pid) noexcept
unsigned int SpellFunctions::GetSpellbookChangesAction(unsigned short pid) noexcept
{
Player *player;
GET_PLAYER(pid, player, 0);
@ -31,19 +30,15 @@ unsigned int SpellFunctions::GetSpellbookAction(unsigned short pid) noexcept
return player->spellbookChanges.action;
}
void SpellFunctions::AddSpell(unsigned short pid, const char* spellId) noexcept
void SpellFunctions::SetSpellbookChangesAction(unsigned short pid, unsigned char action) noexcept
{
Player *player;
GET_PLAYER(pid, player, );
ESM::Spell spell;
spell.mId = spellId;
player->spellbookChanges.spells.push_back(spell);
player->spellbookChanges.action = SpellbookChanges::ADD;
player->spellbookChanges.action = action;
}
void SpellFunctions::RemoveSpell(unsigned short pid, const char* spellId) noexcept
void SpellFunctions::AddSpell(unsigned short pid, const char* spellId) noexcept
{
Player *player;
GET_PLAYER(pid, player, );
@ -52,7 +47,6 @@ void SpellFunctions::RemoveSpell(unsigned short pid, const char* spellId) noexce
spell.mId = spellId;
player->spellbookChanges.spells.push_back(spell);
player->spellbookChanges.action = SpellbookChanges::REMOVE;
}
const char *SpellFunctions::GetSpellId(unsigned short pid, unsigned int i) noexcept

@ -5,10 +5,10 @@
{"InitializeSpellbookChanges", SpellFunctions::InitializeSpellbookChanges},\
\
{"GetSpellbookChangesSize", SpellFunctions::GetSpellbookChangesSize},\
{"GetSpellbookAction", SpellFunctions::GetSpellbookAction},\
{"GetSpellbookChangesAction", SpellFunctions::GetSpellbookChangesAction},\
\
{"SetSpellbookChangesAction", SpellFunctions::SetSpellbookChangesAction},\
{"AddSpell", SpellFunctions::AddSpell},\
{"RemoveSpell", SpellFunctions::RemoveSpell},\
\
{"GetSpellId", SpellFunctions::GetSpellId},\
\
@ -42,31 +42,25 @@ public:
* \param pid The player ID whose faction changes should be used.
* \return The action type (0 for SET, 1 for ADD, 2 for REMOVE).
*/
static unsigned int GetSpellbookAction(unsigned short pid) noexcept;
static unsigned int GetSpellbookChangesAction(unsigned short pid) noexcept;
/**
* \brief Prepare the addition of a spell to a player.
*
* In practice, this changes the action type of the PlayerSpellbook packet to
* ADD and adds this spell to it.
* \brief Set the action type in a player's spellbook changes.
*
* \param pid The player ID whose spellbook changes should be used.
* \param topicId The spellId of the spell.
* \param action The action (0 for SET, 1 for ADD, 2 for REMOVE).
* \return void
*/
static void AddSpell(unsigned short pid, const char* spellId) noexcept;
static void SetSpellbookChangesAction(unsigned short pid, unsigned char action) noexcept;
/**
* \brief Prepare the removal of a spell from a player.
*
* In practice, this changes the action type of the PlayerSpellbook packet to
* REMOVE and adds this spell to it.
* \brief Add a new spell to the spellbook changes for a player.
*
* \param pid The player ID whose spellbook changes should be used.
* \param topicId The spellId of the spell.
* \return void
*/
static void RemoveSpell(unsigned short pid, const char* spellId) noexcept;
static void AddSpell(unsigned short pid, const char* spellId) noexcept;
/**
* \brief Get the spellId at a certain index in a player's latest spellbook changes.

Loading…
Cancel
Save