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
This commit is contained in:
Kitzunu
2024-07-19 15:26:34 +02:00
committed by GitHub
parent dc11b64b4b
commit 332446b8aa
2 changed files with 28 additions and 3 deletions

View File

@@ -697,6 +697,26 @@ Logger.spells.scripts=2,Console Errors
#Logger.bg.battleground=4,Console Server #Logger.bg.battleground=4,Console Server
#Logger.bg.reportpvpafk=4,Console Server #Logger.bg.reportpvpafk=4,Console Server
#Logger.calendar=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=4,Console Server
#Logger.chat.log.addon=4,Console Server #Logger.chat.log.addon=4,Console Server
#Logger.chat.system=4,Console Server #Logger.chat.system=4,Console Server

View File

@@ -64,10 +64,15 @@ public:
player->GetName(), chatType, lang, msg); 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 {}: {}", //! NOTE:
player->GetName(), receiver ? receiver->GetName() : "<unknown>", msg); //! 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() : "<unknown>", msg);
} }
void OnChat(Player* player, uint32 type, uint32 lang, std::string& msg, Group* group) override void OnChat(Player* player, uint32 type, uint32 lang, std::string& msg, Group* group) override