refactor(Core/Chat): Move SendNotification to ChatHander (#19491)

* refactor(Core/Chat): Move SendNotification to ChatHander

* Update Battleground.cpp

* fix build

* Update src/server/game/Chat/Chat.h
This commit is contained in:
Kitzunu
2024-08-10 16:39:46 +02:00
committed by GitHub
parent ebc6218275
commit e4df159f5c
21 changed files with 96 additions and 75 deletions

View File

@@ -68,22 +68,22 @@ public:
if (!enableArg)
{
if (!AccountMgr::IsPlayerAccount(session->GetSecurity()) && session->GetPlayer()->isGMChat())
session->SendNotification(LANG_GM_CHAT_ON);
handler->SendNotification(LANG_GM_CHAT_ON);
else
session->SendNotification(LANG_GM_CHAT_OFF);
handler->SendNotification(LANG_GM_CHAT_OFF);
return true;
}
if (*enableArg)
{
session->GetPlayer()->SetGMChat(true);
session->SendNotification(LANG_GM_CHAT_ON);
handler->SendNotification(LANG_GM_CHAT_ON);
return true;
}
else
{
session->GetPlayer()->SetGMChat(false);
session->SendNotification(LANG_GM_CHAT_OFF);
handler->SendNotification(LANG_GM_CHAT_OFF);
return true;
}
}
@@ -206,14 +206,14 @@ public:
_player->SetGMVisible(true);
_player->UpdateObjectVisibility();
handler->GetSession()->SendNotification(LANG_INVISIBLE_VISIBLE);
handler->SendNotification(LANG_INVISIBLE_VISIBLE);
}
else
{
_player->AddAura(VISUAL_AURA, _player);
_player->SetGMVisible(false);
_player->UpdateObjectVisibility();
handler->GetSession()->SendNotification(LANG_INVISIBLE_INVISIBLE);
handler->SendNotification(LANG_INVISIBLE_INVISIBLE);
}
return true;
@@ -223,7 +223,7 @@ public:
{
handler->GetPlayer()->SetGameMaster(true);
handler->GetPlayer()->UpdateTriggerVisibility();
handler->GetSession()->SendNotification(LANG_GM_ON);
handler->SendNotification(LANG_GM_ON);
return true;
}
@@ -231,7 +231,7 @@ public:
{
handler->GetPlayer()->SetGameMaster(false);
handler->GetPlayer()->UpdateTriggerVisibility();
handler->GetSession()->SendNotification(LANG_GM_OFF);
handler->SendNotification(LANG_GM_OFF);
return true;
}
};

View File

@@ -464,7 +464,7 @@ public:
auto SetCommentatorMod = [&](bool enable)
{
session->SendNotification(enable ? "Commentator mode on" : "Commentator mode off");
handler->SendNotification(enable ? "Commentator mode on" : "Commentator mode off");
session->GetPlayer()->SetCommentator(enable);
};
@@ -508,7 +508,7 @@ public:
auto SetDevMod = [&](bool enable)
{
session->SendNotification(enable ? LANG_DEV_ON : LANG_DEV_OFF);
handler->SendNotification(enable ? LANG_DEV_ON : LANG_DEV_OFF);
session->GetPlayer()->SetDeveloper(enable);
sScriptMgr->OnHandleDevCommand(handler->GetSession()->GetPlayer(), enable);
};

View File

@@ -16,6 +16,7 @@
*/
#include "CellImpl.h"
#include "Chat.h"
#include "CreatureScript.h"
#include "GameEventMgr.h"
#include "GameObjectAI.h"
@@ -1081,7 +1082,7 @@ public:
if (player->GetQuestRewardStatus(QUEST_TELE_CRYSTAL_FLAG))
return false;
player->GetSession()->SendNotification(GO_TELE_TO_DALARAN_CRYSTAL_FAILED);
ChatHandler(player->GetSession()).SendNotification(GO_TELE_TO_DALARAN_CRYSTAL_FAILED);
return true;
}
@@ -1599,7 +1600,7 @@ public:
else
{
CloseGossipMenuFor(player);
player->GetSession()->SendNotification(GO_ANDERHOLS_SLIDER_CIDER_NOT_FOUND);
ChatHandler(player->GetSession()).SendNotification(GO_ANDERHOLS_SLIDER_CIDER_NOT_FOUND);
return false;
}
}