feat: add chat handler methods

This commit is contained in:
Axel Cocat
2022-02-09 23:04:35 +01:00
parent 61d13b7ffc
commit b23b33713a
6 changed files with 223 additions and 4 deletions

View File

@@ -39,8 +39,9 @@ void Eluna::OnLearnTalents(Player* pPlayer, uint32 talentId, uint32 talentRank,
CallAllFunctions(PlayerEventBindings, key);
}
bool Eluna::OnCommand(Player* player, const char* text)
bool Eluna::OnCommand(ChatHandler& handler, const char* text)
{
Player* player = handler.IsConsole() ? nullptr : handler.GetSession()->GetPlayer();
// If from console, player is NULL
if (!player || player->GetSession()->GetSecurity() >= SEC_ADMINISTRATOR)
{
@@ -56,6 +57,7 @@ bool Eluna::OnCommand(Player* player, const char* text)
START_HOOK_WITH_RETVAL(PLAYER_EVENT_ON_COMMAND, true);
Push(player);
Push(text);
Push(&handler);
return CallAllFunctionsBool(PlayerEventBindings, key, true);
}