Fixing emote announce while in raid

This commit is contained in:
Gonçalo Correia 2026-04-14 00:44:08 +01:00
parent 158c1742fe
commit f8182ca30a

View file

@ -28,6 +28,20 @@ local function BuildModifierString(modifiers)
return table.concat(parts, " ") return table.concat(parts, " ")
end end
-- Send a message to the given channel, handling EMOTE specially
-- to avoid the message being redirected to raid chat when in a raid group.
local function SendToChannel(msg, channel)
if channel == "EMOTE" then
local editBox = ChatFrame1 and ChatFrame1.editBox or ChatFrame1EditBox
if editBox then
ChatFrame_OpenChat("/e " .. msg, ChatFrame1)
ChatEdit_SendText(editBox)
end
return
end
SendChatMessage(msg, channel)
end
-- Announce the roll result to the selected chat channel -- Announce the roll result to the selected chat channel
local function AnnounceRoll(rollValue, modifiers, total) local function AnnounceRoll(rollValue, modifiers, total)
if not AltSystem.State.announceEnabled then return end if not AltSystem.State.announceEnabled then return end
@ -45,7 +59,7 @@ local function AnnounceRoll(rollValue, modifiers, total)
msg = name .. " rolled " .. rollValue .. " = " .. total msg = name .. " rolled " .. rollValue .. " = " .. total
end end
SendChatMessage(msg, channelDef.channel) SendToChannel(msg, channelDef.channel)
end end
-- Perform a roll: triggers the WoW native /roll 20 command -- Perform a roll: triggers the WoW native /roll 20 command
@ -82,7 +96,7 @@ function AltSystem:CalculateAndDisplayResult(rollType, rollValue)
if AltSystem.State.announceEnabled then if AltSystem.State.announceEnabled then
local channelDef = AltSystem.AnnounceChannels[AltSystem.State.announceChannelIndex] local channelDef = AltSystem.AnnounceChannels[AltSystem.State.announceChannelIndex]
if channelDef then if channelDef then
SendChatMessage(GetCharacterName() .. " rolled a Critical Failure!", channelDef.channel) SendToChannel(GetCharacterName() .. " rolled a Critical Failure!", channelDef.channel)
end end
end end
return return
@ -93,7 +107,7 @@ function AltSystem:CalculateAndDisplayResult(rollType, rollValue)
if AltSystem.State.announceEnabled then if AltSystem.State.announceEnabled then
local channelDef = AltSystem.AnnounceChannels[AltSystem.State.announceChannelIndex] local channelDef = AltSystem.AnnounceChannels[AltSystem.State.announceChannelIndex]
if channelDef then if channelDef then
SendChatMessage(GetCharacterName() .. " rolled a Critical Success!", channelDef.channel) SendToChannel(GetCharacterName() .. " rolled a Critical Success!", channelDef.channel)
end end
end end
return return