From 332446b8aa4e744c9e33008a00b407e2bafbc78c Mon Sep 17 00:00:00 2001 From: Kitzunu <24550914+Kitzunu@users.noreply.github.com> Date: Fri, 19 Jul 2024 15:26:34 +0200 Subject: [PATCH] fix(Scripts/ChatLogger): Differentiate addon whisper from player whisper (#19441) * fix(Scripts/ChatLogger): Differentiate addon whisper from player whisper * closes https://github.com/azerothcore/azerothcore-wotlk/issues/19439 * closes https://github.com/azerothcore/azerothcore-wotlk/issues/17570 * fix build --- .../apps/worldserver/worldserver.conf.dist | 20 +++++++++++++++++++ src/server/scripts/World/chat_log.cpp | 11 +++++++--- 2 files changed, 28 insertions(+), 3 deletions(-) diff --git a/src/server/apps/worldserver/worldserver.conf.dist b/src/server/apps/worldserver/worldserver.conf.dist index 01ed59c7b..883885e3a 100644 --- a/src/server/apps/worldserver/worldserver.conf.dist +++ b/src/server/apps/worldserver/worldserver.conf.dist @@ -697,6 +697,26 @@ Logger.spells.scripts=2,Console Errors #Logger.bg.battleground=4,Console Server #Logger.bg.reportpvpafk=4,Console Server #Logger.calendar=4,Console Server +#Logger.chat.say=4,Console Chat +#Logger.chat.emote=4,Console Chat +#Logger.chat.yell=4,Console Chat +#Logger.chat.whisper=4,Console Chat +#Logger.chat.party=4,Console Chat +#Logger.chat.raid=4,Console Chat +#Logger.chat.bg=4,Console Chat +#Logger.chat.guild=4,Console Chat +#Logger.chat.guild.officer=4,Console Chat +#Logger.chat.channel=4,Console Chat +#Logger.chat.addon.msg=4,Console Chat +#Logger.chat.addon.emote=4,Console Chat +#Logger.chat.addon.yell=4,Console Chat +#Logger.chat.addon.whisper=4,Console Chat +#Logger.chat.addon.party=4,Console Chat +#Logger.chat.addon.raid=4,Console Chat +#Logger.chat.addon.bg=4,Console Chat +#Logger.chat.addon.guild=4,Console Chat +#Logger.chat.addon.guild.officer=4,Console Chat +#Logger.chat.addon.channel=4,Console Chat #Logger.chat.log=4,Console Server #Logger.chat.log.addon=4,Console Server #Logger.chat.system=4,Console Server diff --git a/src/server/scripts/World/chat_log.cpp b/src/server/scripts/World/chat_log.cpp index 8426fc65f..9dc05ab0d 100644 --- a/src/server/scripts/World/chat_log.cpp +++ b/src/server/scripts/World/chat_log.cpp @@ -64,10 +64,15 @@ public: player->GetName(), chatType, lang, msg); } - void OnChat(Player* player, uint32 /*type*/, uint32 /*lang*/, std::string& msg, Player* receiver) override + void OnChat(Player* player, uint32 /*type*/, uint32 lang, std::string& msg, Player* receiver) override { - LOG_INFO("chat.whisper", "Player {} tells {}: {}", - player->GetName(), receiver ? receiver->GetName() : "", msg); + //! NOTE: + //! LANG_ADDON can only be sent by client in "PARTY", "RAID", "GUILD", "BATTLEGROUND", "WHISPER" + std::string logType = (lang != LANG_ADDON) ? "chat." : "chat.addon."; + std::string msgType = "whisper"; + + LOG_INFO(logType + msgType, "Player {} {} {}: {}", + player->GetName(), msgType, receiver ? receiver->GetName() : "", msg); } void OnChat(Player* player, uint32 type, uint32 lang, std::string& msg, Group* group) override