forked from teamnwah/openmw-tes3coop
[Server] Use script function to get spellbook action
This commit is contained in:
parent
5b3fabdb9d
commit
eba7d8408f
4 changed files with 12 additions and 2 deletions
|
@ -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…
Reference in a new issue