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

@@ -1306,7 +1306,7 @@ void Battleground::ReadyMarkerClicked(Player* p)
readyMarkerClickedSet.insert(p->GetGUID());
uint32 count = readyMarkerClickedSet.size();
uint32 req = ArenaTeam::GetReqPlayersForType(GetArenaType());
p->GetSession()->SendNotification("You are marked as ready %u/%u", count, req);
ChatHandler(p->GetSession()).SendNotification("You are marked as ready {}/{}", count, req);
if (count == req)
{
m_Events |= BG_STARTING_EVENT_2;

View File

@@ -99,6 +99,23 @@ bool ChatHandler::HasLowerSecurityAccount(WorldSession* target, uint32 target_ac
return false;
}
void ChatHandler::SendNotification(std::string_view str)
{
if (!m_session)
{
LOG_ERROR("chat.chat", "ChatHandler::SendNotification sent without a session. Skipped.");
return;
}
std::vector<std::string_view> lines = Acore::Tokenize(str, '\n', true);
for (std::string_view line : lines)
{
WorldPacket data(SMSG_NOTIFICATION, line.size() + 1);
data << line.data();
m_session->SendPacket(&data);
}
}
void ChatHandler::SendGMText(std::string_view str)
{
std::vector<std::string_view> lines = Acore::Tokenize(str, '\n', true);
@@ -157,6 +174,12 @@ void ChatHandler::SendWorldTextOptional(std::string_view str, uint32 flag)
void ChatHandler::SendSysMessage(std::string_view str, bool escapeCharacters)
{
if (!m_session)
{
LOG_ERROR("chat.chat", "ChatHandler::SendSysMessage sent without a session. Skipped.");
return;
}
std::string msg{ str };
// Replace every "|" with "||" in msg

View File

@@ -51,11 +51,23 @@ public:
static char* LineFromMessage(char*& pos) { char* start = strtok(pos, "\n"); pos = nullptr; return start; }
void SendNotification(std::string_view str);
template<typename... Args>
void SendNotification(uint32 strId, Args&&... args)
{
SendNotification(Acore::StringFormatFmt(GetAcoreString(strId), std::forward<Args>(args)...));
}
template<typename... Args>
void SendNotification(char const* fmt, Args&&... args)
{
SendNotification(Acore::StringFormatFmt(fmt, std::forward<Args>(args)...));
}
void SendGMText(std::string_view str);
template<typename... Args>
void SendGMText(uint32 strId, Args&&... args)
{
// WorldText should be sent to all sessions
// GMText should be sent to all sessions
SessionMap::const_iterator itr;
for (itr = sWorld->GetAllSessions().begin(); itr != sWorld->GetAllSessions().end(); ++itr)
{

View File

@@ -16,6 +16,7 @@
*/
#include "BattlegroundMgr.h"
#include "Chat.h"
#include "GossipDef.h"
#include "Language.h"
#include "ObjectMgr.h"
@@ -262,9 +263,9 @@ void Player::OnGossipSelect(WorldObject* source, uint32 gossipListId, uint32 men
ToggleInstantFlight();
if (m_isInstantFlightOn)
GetSession()->SendNotification(LANG_INSTANT_FLIGHT_ON);
ChatHandler(GetSession()).SendNotification(LANG_INSTANT_FLIGHT_ON);
else
GetSession()->SendNotification(LANG_INSTANT_FLIGHT_OFF);
ChatHandler(GetSession()).SendNotification(LANG_INSTANT_FLIGHT_OFF);
PlayerTalkClass->SendCloseGossip();
return;

View File

@@ -55,7 +55,7 @@ void WorldSession::SendAuctionHello(ObjectGuid guid, Creature* unit)
{
if (GetPlayer()->GetLevel() < sWorld->getIntConfig(CONFIG_AUCTION_LEVEL_REQ))
{
SendNotification(LANG_AUCTION_REQ, sWorld->getIntConfig(CONFIG_AUCTION_LEVEL_REQ));
ChatHandler(this).SendNotification(LANG_AUCTION_REQ, sWorld->getIntConfig(CONFIG_AUCTION_LEVEL_REQ));
return;
}

View File

@@ -55,7 +55,7 @@ void WorldSession::HandleBattlemasterHelloOpcode(WorldPacket& recvData)
if (!_player->GetBGAccessByLevel(bgTypeId))
{
// temp, must be gossip message...
SendNotification(LANG_YOUR_BG_LEVEL_REQ_ERROR);
ChatHandler(this).SendNotification(LANG_YOUR_BG_LEVEL_REQ_ERROR);
return;
}
@@ -414,7 +414,7 @@ void WorldSession::HandleBattleFieldPortOpcode(WorldPacket& recvData)
if (_player->GetCharmGUID() || _player->IsInCombat())
{
_player->GetSession()->SendNotification(LANG_YOU_IN_COMBAT);
ChatHandler(_player->GetSession()).SendNotification(LANG_YOU_IN_COMBAT);
return;
}

View File

@@ -971,14 +971,14 @@ void WorldSession::HandlePlayerLoginFromDB(LoginQueryHolder const& holder)
if (pCurrChar->HasAtLoginFlag(AT_LOGIN_RESET_SPELLS))
{
pCurrChar->resetSpells();
SendNotification(LANG_RESET_SPELLS);
ChatHandler(this).SendNotification(LANG_RESET_SPELLS);
}
if (pCurrChar->HasAtLoginFlag(AT_LOGIN_RESET_TALENTS))
{
pCurrChar->resetTalents(true);
pCurrChar->SendTalentsInfoData(false); // original talents send already in to SendInitialPacketsBeforeAddToMap, resend reset state
SendNotification(LANG_RESET_TALENTS);
ChatHandler(this).SendNotification(LANG_RESET_TALENTS);
}
if (pCurrChar->HasAtLoginFlag(AT_LOGIN_CHECK_ACHIEVS))
@@ -1044,7 +1044,7 @@ void WorldSession::HandlePlayerLoginFromDB(LoginQueryHolder const& holder)
pCurrChar->SetTaxiCheater(true);
if (pCurrChar->IsGameMaster())
SendNotification(LANG_GM_ON);
ChatHandler(this).SendNotification(LANG_GM_ON);
std::string IP_str = GetRemoteAddress();
LOG_INFO("entities.player", "Account: {} (IP: {}) Login Character:[{}] ({}) Level: {}",
@@ -1239,7 +1239,7 @@ void WorldSession::HandlePlayerLoginToCharInWorld(Player* pCurrChar)
sWorld->ShutdownMsg(true, pCurrChar);
if (pCurrChar->IsGameMaster())
SendNotification(LANG_GM_ON);
ChatHandler(pCurrChar->GetSession()).SendNotification(LANG_GM_ON);
m_playerLoading = false;
}

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;
}

View File

@@ -15,6 +15,7 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "Chat.h"
#include "DatabaseEnv.h"
#include "Group.h"
#include "GroupMgr.h"
@@ -725,7 +726,7 @@ void WorldSession::HandleRaidReadyCheckOpcode(WorldPacket& recvData)
// Check if player is in BG
if (_player->InBattleground())
{
_player->GetSession()->SendNotification(LANG_BG_READY_CHECK_ERROR);
ChatHandler(_player->GetSession()).SendNotification(LANG_BG_READY_CHECK_ERROR);
return;
}
}

View File

@@ -16,6 +16,7 @@
*/
#include "AccountMgr.h"
#include "Chat.h"
#include "CharacterCache.h"
#include "DBCStores.h"
#include "DatabaseEnv.h"
@@ -117,7 +118,7 @@ void WorldSession::HandleSendMail(WorldPacket& recvData)
if (player->GetLevel() < sWorld->getIntConfig(CONFIG_MAIL_LEVEL_REQ))
{
SendNotification(LANG_MAIL_SENDER_REQ, sWorld->getIntConfig(CONFIG_MAIL_LEVEL_REQ));
ChatHandler(this).SendNotification(LANG_MAIL_SENDER_REQ, sWorld->getIntConfig(CONFIG_MAIL_LEVEL_REQ));
return;
}

View File

@@ -1118,7 +1118,7 @@ void WorldSession::HandleWorldTeleportOpcode(WorldPacket& recv_data)
if (AccountMgr::IsAdminAccount(GetSecurity()))
GetPlayer()->TeleportTo(mapid, PositionX, PositionY, PositionZ, Orientation);
else
SendNotification(LANG_PERMISSION_DENIED);
ChatHandler(this).SendNotification(LANG_PERMISSION_DENIED);
}
void WorldSession::HandleWhoisOpcode(WorldPacket& recv_data)
@@ -1129,13 +1129,13 @@ void WorldSession::HandleWhoisOpcode(WorldPacket& recv_data)
if (!AccountMgr::IsAdminAccount(GetSecurity()))
{
SendNotification(LANG_PERMISSION_DENIED);
ChatHandler(this).SendNotification(LANG_PERMISSION_DENIED);
return;
}
if (charname.empty() || !normalizePlayerName (charname))
{
SendNotification(LANG_NEED_CHARACTER_NAME);
ChatHandler(this).SendNotification(LANG_NEED_CHARACTER_NAME);
return;
}
@@ -1143,7 +1143,7 @@ void WorldSession::HandleWhoisOpcode(WorldPacket& recv_data)
if (!player)
{
SendNotification(LANG_PLAYER_NOT_EXIST_OR_OFFLINE, charname.c_str());
ChatHandler(this).SendNotification(LANG_PLAYER_NOT_EXIST_OR_OFFLINE, charname.c_str());
return;
}
@@ -1157,7 +1157,7 @@ void WorldSession::HandleWhoisOpcode(WorldPacket& recv_data)
if (!result)
{
SendNotification(LANG_ACCOUNT_FOR_PLAYER_NOT_FOUND, charname.c_str());
ChatHandler(this).SendNotification(LANG_ACCOUNT_FOR_PLAYER_NOT_FOUND, charname.c_str());
return;
}

View File

@@ -17,6 +17,7 @@
#include "Battleground.h"
#include "BattlegroundAV.h"
#include "Chat.h"
#include "GameObjectAI.h"
#include "Group.h"
#include "Language.h"
@@ -586,7 +587,7 @@ void WorldSession::HandlePushQuestToParty(WorldPacket& recvPacket)
// Check if player is in BG
if (_player->InBattleground())
{
_player->GetSession()->SendNotification(LANG_BG_SHARE_QUEST_ERROR);
ChatHandler(_player->GetSession()).SendNotification(LANG_BG_SHARE_QUEST_ERROR);
continue;
}
}

View File

@@ -35,7 +35,7 @@ void WorldSession::HandleGMTicketCreateOpcode(WorldPacket& recvData)
if (GetPlayer()->GetLevel() < sWorld->getIntConfig(CONFIG_TICKET_LEVEL_REQ))
{
SendNotification(LANG_TICKET_REQ, sWorld->getIntConfig(CONFIG_TICKET_LEVEL_REQ));
ChatHandler(this).SendNotification(LANG_TICKET_REQ, sWorld->getIntConfig(CONFIG_TICKET_LEVEL_REQ));
return;
}

View File

@@ -15,6 +15,7 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "Chat.h"
#include "Item.h"
#include "Language.h"
#include "Log.h"
@@ -264,7 +265,7 @@ void WorldSession::HandleAcceptTradeOpcode(WorldPacket& /*recvPacket*/)
// not accept case incorrect money amount
if (!_player->HasEnoughMoney(my_trade->GetMoney()))
{
SendNotification(LANG_NOT_ENOUGH_GOLD);
ChatHandler(this).SendNotification(LANG_NOT_ENOUGH_GOLD);
my_trade->SetAccepted(false, true);
return;
}
@@ -272,7 +273,7 @@ void WorldSession::HandleAcceptTradeOpcode(WorldPacket& /*recvPacket*/)
// not accept case incorrect money amount
if (!trader->HasEnoughMoney(his_trade->GetMoney()))
{
trader->GetSession()->SendNotification(LANG_NOT_ENOUGH_GOLD);
ChatHandler(trader->GetSession()).SendNotification(LANG_NOT_ENOUGH_GOLD);
his_trade->SetAccepted(false, true);
return;
}
@@ -422,8 +423,8 @@ void WorldSession::HandleAcceptTradeOpcode(WorldPacket& /*recvPacket*/)
{
clearAcceptTradeMode(my_trade, his_trade);
SendNotification(LANG_NOT_FREE_TRADE_SLOTS);
trader->GetSession()->SendNotification(LANG_NOT_PARTNER_FREE_TRADE_SLOTS);
ChatHandler(this).SendNotification(LANG_NOT_FREE_TRADE_SLOTS);
ChatHandler(trader->GetSession()).SendNotification(LANG_NOT_PARTNER_FREE_TRADE_SLOTS);
my_trade->SetAccepted(false);
his_trade->SetAccepted(false);
delete my_spell;
@@ -434,8 +435,8 @@ void WorldSession::HandleAcceptTradeOpcode(WorldPacket& /*recvPacket*/)
{
clearAcceptTradeMode(my_trade, his_trade);
SendNotification(LANG_NOT_PARTNER_FREE_TRADE_SLOTS);
trader->GetSession()->SendNotification(LANG_NOT_FREE_TRADE_SLOTS);
ChatHandler(this).SendNotification(LANG_NOT_PARTNER_FREE_TRADE_SLOTS);
ChatHandler(trader->GetSession()).SendNotification(LANG_NOT_FREE_TRADE_SLOTS);
my_trade->SetAccepted(false);
his_trade->SetAccepted(false);
delete my_spell;
@@ -574,7 +575,7 @@ void WorldSession::HandleInitiateTradeOpcode(WorldPacket& recvPacket)
if (GetPlayer()->GetLevel() < sWorld->getIntConfig(CONFIG_TRADE_LEVEL_REQ))
{
SendNotification(LANG_TRADE_REQ, sWorld->getIntConfig(CONFIG_TRADE_LEVEL_REQ));
ChatHandler(this).SendNotification(LANG_TRADE_REQ, sWorld->getIntConfig(CONFIG_TRADE_LEVEL_REQ));
return;
}
@@ -639,7 +640,7 @@ void WorldSession::HandleInitiateTradeOpcode(WorldPacket& recvPacket)
if (pOther->GetLevel() < sWorld->getIntConfig(CONFIG_TRADE_LEVEL_REQ))
{
SendNotification(LANG_TRADE_OTHER_REQ, sWorld->getIntConfig(CONFIG_TRADE_LEVEL_REQ));
ChatHandler(this).SendNotification(LANG_TRADE_OTHER_REQ, sWorld->getIntConfig(CONFIG_TRADE_LEVEL_REQ));
return;
}

View File

@@ -16,6 +16,7 @@
*/
#include "InstanceScript.h"
#include "Chat.h"
#include "Creature.h"
#include "DatabaseEnv.h"
#include "GameObject.h"
@@ -602,7 +603,7 @@ void InstanceScript::DoSendNotifyToInstance(char const* format, ...)
instance->DoForAllPlayers([&, buff](Player* player)
{
player->GetSession()->SendNotification("%s", buff);
ChatHandler(player->GetSession()).SendNotification("{}", buff);
});
}
}

View File

@@ -787,16 +787,6 @@ bool WorldSession::DisallowHyperlinksAndMaybeKick(std::string_view str)
return false;
}
void WorldSession::SendNotification(std::string_view str)
{
WorldPacket data(SMSG_NOTIFICATION, str.size() + 1);
for (std::string_view line : Acore::Tokenize(str, '\n', true))
{
data << line.data();
SendPacket(&data);
}
}
char const* WorldSession::GetAcoreString(uint32 entry) const
{
return sObjectMgr->GetAcoreString(entry, GetSessionDbLocaleIndex());

View File

@@ -345,18 +345,6 @@ public:
void ReadMovementInfo(WorldPacket& data, MovementInfo* mi);
void WriteMovementInfo(WorldPacket* data, MovementInfo* mi);
void SendNotification(std::string_view str);
template<typename... Args>
void SendNotification(uint32 strId, Args&&... args)
{
SendNotification(Acore::StringFormatFmt(GetAcoreString(strId), std::forward<Args>(args)...));
}
template<typename... Args>
void SendNotification(char const* fmt, Args&&... args)
{
SendNotification(Acore::StringFormatFmt(fmt, std::forward<Args>(args)...));
}
void SendPacket(WorldPacket const* packet);
void SendPetNameInvalid(uint32 error, std::string const& name, DeclinedName* declinedName);
void SendPartyResult(PartyOperation operation, std::string const& member, PartyResult res, uint32 val = 0);

View File

@@ -22,6 +22,7 @@
#include "BattlegroundSA.h"
#include "BattlegroundWS.h"
#include "CellImpl.h"
#include "Chat.h"
#include "Common.h"
#include "Creature.h"
#include "DynamicObject.h"
@@ -6168,7 +6169,7 @@ void Spell::EffectPlaySound(SpellEffIndex effIndex)
{
case 58730: // Restricted Flight Area
case 58600: // Restricted Flight Area
player->GetSession()->SendNotification(LANG_ZONE_NOFLYZONE);
ChatHandler(player->GetSession()).SendNotification(LANG_ZONE_NOFLYZONE);
break;
default:
break;

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;
}
}