mirror of
https://github.com/azerothcore/mod-ale
synced 2025-11-29 15:38:17 +08:00
Eluna
This commit is contained in:
33
HookMgr.cpp
33
HookMgr.cpp
@@ -215,21 +215,17 @@ bool HookMgr::OnPacketReceive(WorldSession* session, WorldPacket& packet)
|
||||
return result;
|
||||
}
|
||||
// AddOns
|
||||
void HookMgr::OnAddonMessage(Player* sender, uint32 type, std::string& msg, Player* receiver, Guild* guild, Group* group, Channel* channel)
|
||||
bool HookMgr::OnAddonMessage(Player* sender, uint32 type, std::string& msg, Player* receiver, Guild* guild, Group* group, Channel* channel)
|
||||
{
|
||||
if (!sEluna->ServerEventBindings.HasEvents(ADDON_EVENT_ON_MESSAGE))
|
||||
return;
|
||||
return false;
|
||||
ELUNA_GUARD();
|
||||
sEluna->ServerEventBindings.BeginCall(ADDON_EVENT_ON_MESSAGE);
|
||||
sEluna->Push(sEluna->L, sender);
|
||||
sEluna->Push(sEluna->L, type);
|
||||
const char* c_msg = msg.c_str();
|
||||
char* arg = strtok((char*)c_msg, "\t");
|
||||
while (arg)
|
||||
{
|
||||
sEluna->Push(sEluna->L, arg);
|
||||
arg = strtok(NULL, "\t");
|
||||
}
|
||||
sEluna->Push(sEluna->L, strtok((char*)c_msg, "\t")); // prefix
|
||||
sEluna->Push(sEluna->L, strtok(NULL, "")); // msg
|
||||
if (receiver)
|
||||
sEluna->Push(sEluna->L, receiver);
|
||||
else if (guild)
|
||||
@@ -242,6 +238,7 @@ void HookMgr::OnAddonMessage(Player* sender, uint32 type, std::string& msg, Play
|
||||
sEluna->Push(sEluna->L);
|
||||
sEluna->ServerEventBindings.ExecuteCall();
|
||||
sEluna->ServerEventBindings.EndCall();
|
||||
return true;
|
||||
}
|
||||
|
||||
#ifndef MANGOS
|
||||
@@ -982,8 +979,8 @@ void HookMgr::OnMapChanged(Player* player)
|
||||
|
||||
bool HookMgr::OnChat(Player* pPlayer, uint32 type, uint32 lang, std::string& msg)
|
||||
{
|
||||
if (lang == LANG_ADDON)
|
||||
OnAddonMessage(pPlayer, type, msg, NULL, NULL, NULL, NULL);
|
||||
if (lang == LANG_ADDON && OnAddonMessage(pPlayer, type, msg, NULL, NULL, NULL, NULL))
|
||||
return true;
|
||||
bool result = true;
|
||||
if (sEluna->PlayerEventBindings.HasEvents(PLAYER_EVENT_ON_CHAT))
|
||||
{
|
||||
@@ -1013,8 +1010,8 @@ bool HookMgr::OnChat(Player* pPlayer, uint32 type, uint32 lang, std::string& msg
|
||||
|
||||
bool HookMgr::OnChat(Player* pPlayer, uint32 type, uint32 lang, std::string& msg, Group* pGroup)
|
||||
{
|
||||
if (lang == LANG_ADDON)
|
||||
OnAddonMessage(pPlayer, type, msg, NULL, NULL, pGroup, NULL);
|
||||
if (lang == LANG_ADDON && OnAddonMessage(pPlayer, type, msg, NULL, NULL, pGroup, NULL))
|
||||
return true;
|
||||
bool result = true;
|
||||
if (sEluna->PlayerEventBindings.HasEvents(PLAYER_EVENT_ON_GROUP_CHAT))
|
||||
{
|
||||
@@ -1045,8 +1042,8 @@ bool HookMgr::OnChat(Player* pPlayer, uint32 type, uint32 lang, std::string& msg
|
||||
|
||||
bool HookMgr::OnChat(Player* pPlayer, uint32 type, uint32 lang, std::string& msg, Guild* pGuild)
|
||||
{
|
||||
if (lang == LANG_ADDON)
|
||||
OnAddonMessage(pPlayer, type, msg, NULL, pGuild, NULL, NULL);
|
||||
if (lang == LANG_ADDON && OnAddonMessage(pPlayer, type, msg, NULL, pGuild, NULL, NULL))
|
||||
return true;
|
||||
bool result = true;
|
||||
if (sEluna->PlayerEventBindings.HasEvents(PLAYER_EVENT_ON_GUILD_CHAT))
|
||||
{
|
||||
@@ -1077,8 +1074,8 @@ bool HookMgr::OnChat(Player* pPlayer, uint32 type, uint32 lang, std::string& msg
|
||||
|
||||
bool HookMgr::OnChat(Player* pPlayer, uint32 type, uint32 lang, std::string& msg, Channel* pChannel)
|
||||
{
|
||||
if (lang == LANG_ADDON)
|
||||
OnAddonMessage(pPlayer, type, msg, NULL, NULL, NULL, pChannel);
|
||||
if (lang == LANG_ADDON && OnAddonMessage(pPlayer, type, msg, NULL, NULL, NULL, pChannel))
|
||||
return true;
|
||||
bool result = true;
|
||||
if (sEluna->PlayerEventBindings.HasEvents(PLAYER_EVENT_ON_CHANNEL_CHAT))
|
||||
{
|
||||
@@ -1109,8 +1106,8 @@ bool HookMgr::OnChat(Player* pPlayer, uint32 type, uint32 lang, std::string& msg
|
||||
|
||||
bool HookMgr::OnChat(Player* pPlayer, uint32 type, uint32 lang, std::string& msg, Player* pReceiver)
|
||||
{
|
||||
if (lang == LANG_ADDON)
|
||||
OnAddonMessage(pPlayer, type, msg, pReceiver, NULL, NULL, NULL);
|
||||
if (lang == LANG_ADDON && OnAddonMessage(pPlayer, type, msg, pReceiver, NULL, NULL, NULL))
|
||||
return true;
|
||||
bool result = true;
|
||||
if (sEluna->PlayerEventBindings.HasEvents(PLAYER_EVENT_ON_WHISPER))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user