Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(PlayerHooks): OnLearnSpell(player, spellid) #46

Merged
merged 1 commit into from
Jun 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/ElunaLuaEngine_SC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -731,6 +731,11 @@ class Eluna_PlayerScript : public PlayerScript
{
sEluna->OnFirstLogin(player);
}

void OnLearnSpell(Player* player, uint32 spellId) override
{
sEluna->OnLearnSpell(player, spellId);
}
};

class Eluna_ServerScript : public ServerScript
Expand Down
1 change: 1 addition & 0 deletions src/LuaEngine/GlobalMethods.h
Original file line number Diff line number Diff line change
Expand Up @@ -706,6 +706,7 @@ namespace LuaGlobalFunctions
* // UNUSED = 41, // (event, player)
* PLAYER_EVENT_ON_COMMAND = 42, // (event, player, command, chatHandler) - player is nil if command used from console. Can return false
* PLAYER_EVENT_ON_PET_ADDED_TO_WORLD = 43, // (event, player, pet)
* * PLAYER_EVENT_ON_LEARN_SPELL = 44, // (event, player, spellId)
* };
* </pre>
*
Expand Down
1 change: 1 addition & 0 deletions src/LuaEngine/Hooks.h
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@ namespace Hooks
// UNUSED = 41, // (event, player)
PLAYER_EVENT_ON_COMMAND = 42, // (event, player, command, chatHandler) - player is nil if command used from console. Can return false
PLAYER_EVENT_ON_PET_ADDED_TO_WORLD = 43, // (event, player, pet)
PLAYER_EVENT_ON_LEARN_SPELL = 44, // (event, player, spellId)

PLAYER_EVENT_COUNT
};
Expand Down
1 change: 1 addition & 0 deletions src/LuaEngine/LuaEngine.h
Original file line number Diff line number Diff line change
Expand Up @@ -472,6 +472,7 @@ class ELUNA_GAME_API Eluna
void OnUpdateZone(Player* pPlayer, uint32 newZone, uint32 newArea);
void OnMapChanged(Player* pPlayer);
void HandleGossipSelectOption(Player* pPlayer, uint32 menuId, uint32 sender, uint32 action, const std::string& code);
void OnLearnSpell(Player* player, uint32 spellId);

#ifndef CLASSIC
#ifndef TBC
Expand Down
8 changes: 8 additions & 0 deletions src/LuaEngine/PlayerHooks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -558,3 +558,11 @@ void Eluna::OnPetAddedToWorld(Player* player, Creature* pet)
Push(pet);
CallAllFunctions(PlayerEventBindings, key);
}

void Eluna::OnLearnSpell(Player* player, uint32 spellId)
{
START_HOOK(PLAYER_EVENT_ON_LEARN_SPELL);
Push(player);
Push(spellId);
CallAllFunctions(PlayerEventBindings, key);
}