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

@@ -74,7 +74,7 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recvData)
if (lang == LANG_UNIVERSAL && type != CHAT_MSG_AFK && type != CHAT_MSG_DND)
{
LOG_ERROR("entities.player.cheat", "CMSG_MESSAGECHAT: Possible hacking-attempt: {} tried to send a message in universal language", GetPlayerInfo());
SendNotification(LANG_UNKNOWN_LANGUAGE);
ChatHandler(this).SendNotification(LANG_UNKNOWN_LANGUAGE);
recvData.rfinish();
return;
}
@@ -85,7 +85,7 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recvData)
LanguageDesc const* langDesc = GetLanguageDescByID(lang);
if (!langDesc)
{
SendNotification(LANG_UNKNOWN_LANGUAGE);
ChatHandler(this).SendNotification(LANG_UNKNOWN_LANGUAGE);
recvData.rfinish();
return;
}
@@ -105,7 +105,7 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recvData)
if (!foundAura)
{
SendNotification(LANG_NOT_LEARNED_LANGUAGE);
ChatHandler(this).SendNotification(LANG_NOT_LEARNED_LANGUAGE);
recvData.rfinish();
return;
}
@@ -137,7 +137,7 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recvData)
if (sender->GetTotalPlayedTime() < minutes * MINUTE)
{
SendNotification(LANG_MUTED_PLAYER, minutes);
ChatHandler(this).SendNotification(LANG_MUTED_PLAYER, minutes);
recvData.rfinish();
return;
}
@@ -164,7 +164,7 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recvData)
if (sender->HasAura(1852) && type != CHAT_MSG_WHISPER)
{
SendNotification(LANG_GM_SILENCE, sender->GetName());
ChatHandler(this).SendNotification(LANG_GM_SILENCE, sender->GetName());
recvData.rfinish();
return;
}
@@ -296,7 +296,7 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recvData)
if (!_player->CanSpeak())
{
std::string timeStr = secsToTimeString(m_muteTime - GameTime::GetGameTime().count());
SendNotification(LANG_WAIT_BEFORE_SPEAKING, timeStr);
ChatHandler(this).SendNotification(LANG_WAIT_BEFORE_SPEAKING, timeStr);
return;
}
}
@@ -361,7 +361,7 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recvData)
if (sender->GetLevel() < sWorld->getIntConfig(CONFIG_CHAT_SAY_LEVEL_REQ))
{
SendNotification(LANG_SAY_REQ, sWorld->getIntConfig(CONFIG_CHAT_SAY_LEVEL_REQ));
ChatHandler(this).SendNotification(LANG_SAY_REQ, sWorld->getIntConfig(CONFIG_CHAT_SAY_LEVEL_REQ));
return;
}
@@ -387,7 +387,7 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recvData)
if (sender->GetLevel() < sWorld->getIntConfig(CONFIG_CHAT_WHISPER_LEVEL_REQ) && receiver != sender)
{
SendNotification(LANG_WHISPER_REQ, sWorld->getIntConfig(CONFIG_CHAT_WHISPER_LEVEL_REQ));
ChatHandler(this).SendNotification(LANG_WHISPER_REQ, sWorld->getIntConfig(CONFIG_CHAT_WHISPER_LEVEL_REQ));
return;
}
@@ -407,7 +407,7 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recvData)
// pussywizard: optimization
if (GetPlayer()->HasAura(1852) && !receiver->IsGameMaster())
{
SendNotification(LANG_GM_SILENCE, GetPlayer()->GetName());
ChatHandler(this).SendNotification(LANG_GM_SILENCE, GetPlayer()->GetName());
return;
}
@@ -590,7 +590,7 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recvData)
{
if (sender->GetLevel() < sWorld->getIntConfig(CONFIG_CHAT_CHANNEL_LEVEL_REQ))
{
SendNotification(LANG_CHANNEL_REQ, sWorld->getIntConfig(CONFIG_CHAT_CHANNEL_LEVEL_REQ));
ChatHandler(this).SendNotification(LANG_CHANNEL_REQ, sWorld->getIntConfig(CONFIG_CHAT_CHANNEL_LEVEL_REQ));
return;
}
}
@@ -735,7 +735,7 @@ void WorldSession::HandleTextEmoteOpcode(WorldPacket& recvData)
if (!GetPlayer()->CanSpeak())
{
std::string timeStr = secsToTimeString(m_muteTime - GameTime::GetGameTime().count());
SendNotification(LANG_WAIT_BEFORE_SPEAKING, timeStr);
ChatHandler(this).SendNotification(LANG_WAIT_BEFORE_SPEAKING, timeStr);
return;
}