mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-28 09:33:52 +00:00
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'.
This commit is contained in:
parent
491dd2b673
commit
96c5f27160
1 changed files with 17 additions and 0 deletions
|
|
@ -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_) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue