From 96c5f27160a9e296f29b26405d60c221ddbe19bb Mon Sep 17 00:00:00 2001 From: Kelsi Date: Sun, 22 Mar 2026 19:08:51 -0700 Subject: [PATCH] feat: fire CHAT_MSG_ADDON for inter-addon communication messages Detect addon messages in the SMSG_MESSAGECHAT handler by looking for the 'prefix\ttext' format (tab delimiter). When detected, fire CHAT_MSG_ADDON with args (prefix, message, channel, sender) instead of the regular CHAT_MSG_* event, and suppress the raw message from appearing in chat. This enables inter-addon communication used by: - Boss mods (DBM, BigWigs) for timer/alert synchronization - Raid tools (oRA3) for ready checks and cooldown tracking - Group coordination addons for pull countdowns and assignments Works with the existing SendAddonMessage/RegisterAddonMessagePrefix functions that format outgoing messages as 'prefix\ttext'. --- src/game/game_handler.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/game/game_handler.cpp b/src/game/game_handler.cpp index 30848ced..c0447c27 100644 --- a/src/game/game_handler.cpp +++ b/src/game/game_handler.cpp @@ -13523,6 +13523,23 @@ void GameHandler::handleMessageChat(network::Packet& packet) { LOG_DEBUG("[", getChatTypeString(data.type), "] ", channelInfo, senderInfo, ": ", data.message); + // Detect addon messages: format is "prefix\ttext" in the message body. + // Fire CHAT_MSG_ADDON instead of the regular chat event for these. + if (addonEventCallback_) { + auto tabPos = data.message.find('\t'); + if (tabPos != std::string::npos && tabPos > 0 && tabPos < data.message.size() - 1) { + std::string prefix = data.message.substr(0, tabPos); + std::string body = data.message.substr(tabPos + 1); + std::string channel = getChatTypeString(data.type); + char guidBuf2[32]; + snprintf(guidBuf2, sizeof(guidBuf2), "0x%016llX", (unsigned long long)data.senderGuid); + // Fire CHAT_MSG_ADDON: prefix, message, channel, sender + addonEventCallback_("CHAT_MSG_ADDON", {prefix, body, channel, data.senderName}); + // Also add to chat history but don't show the raw addon message in chat + return; + } + } + // Fire CHAT_MSG_* addon events so Lua chat frames and addons receive messages. // WoW event args: message, senderName, language, channelName if (addonEventCallback_) {