[Server] Use script function to get spellbook action

pull/163/head
David Cernat 8 years ago
parent 5b3fabdb9d
commit eba7d8408f

@ -250,7 +250,7 @@ void Networking::processPlayerPacket(RakNet::Packet *packet)
DEBUG_PRINTF("ID_PLAYER_SPELLBOOK\n");
myPacket->Read(player);
Script::Call<Script::CallbackIdentity("OnPlayerSpellbookChange")>(player->getId(), player->spellbookChanges.action);
Script::Call<Script::CallbackIdentity("OnPlayerSpellbookChange")>(player->getId());
break;
}

@ -14,6 +14,14 @@ unsigned int SpellFunctions::GetSpellbookChangesSize(unsigned short pid) noexcep
return player->spellbookChanges.count;
}
unsigned int SpellFunctions::GetSpellbookAction(unsigned short pid) noexcept
{
Player *player;
GET_PLAYER(pid, player, 0);
return player->spellbookChanges.action;
}
void SpellFunctions::AddSpell(unsigned short pid, const char* spellId) noexcept
{
Player *player;

@ -3,6 +3,7 @@
#define SPELLAPI \
{"GetSpellbookChangesSize", SpellFunctions::GetSpellbookChangesSize},\
{"GetSpellbookAction", SpellFunctions::GetSpellbookAction},\
\
{"AddSpell", SpellFunctions::AddSpell},\
{"RemoveSpell", SpellFunctions::RemoveSpell},\
@ -17,6 +18,7 @@ class SpellFunctions
public:
static unsigned int GetSpellbookChangesSize(unsigned short pid) noexcept;
static unsigned int GetSpellbookAction(unsigned short pid) noexcept;
static void AddSpell(unsigned short pid, const char* spellId) noexcept;
static void RemoveSpell(unsigned short pid, const char* spellId) noexcept;

@ -115,7 +115,7 @@ public:
{"OnPlayerLevelChange", Function<void, unsigned short>()},
{"OnPlayerEquipmentChange", Function<void, unsigned short>()},
{"OnPlayerInventoryChange", Function<void, unsigned short>()},
{"OnPlayerSpellbookChange", Function<void, unsigned short, int>()},
{"OnPlayerSpellbookChange", Function<void, unsigned short>()},
{"OnPlayerJournalChange", Function<void, unsigned short>()},
{"OnObjectPlace", Function<void, unsigned short, const char*>()},
{"OnObjectDelete", Function<void, unsigned short, const char*>()},

Loading…
Cancel
Save