Fixing emote announce while in raid
This commit is contained in:
parent
158c1742fe
commit
f8182ca30a
1 changed files with 17 additions and 3 deletions
20
Roll.lua
20
Roll.lua
|
|
@ -28,6 +28,20 @@ local function BuildModifierString(modifiers)
|
|||
return table.concat(parts, " ")
|
||||
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
|
||||
local function AnnounceRoll(rollValue, modifiers, total)
|
||||
if not AltSystem.State.announceEnabled then return end
|
||||
|
|
@ -45,7 +59,7 @@ local function AnnounceRoll(rollValue, modifiers, total)
|
|||
msg = name .. " rolled " .. rollValue .. " = " .. total
|
||||
end
|
||||
|
||||
SendChatMessage(msg, channelDef.channel)
|
||||
SendToChannel(msg, channelDef.channel)
|
||||
end
|
||||
|
||||
-- Perform a roll: triggers the WoW native /roll 20 command
|
||||
|
|
@ -82,7 +96,7 @@ function AltSystem:CalculateAndDisplayResult(rollType, rollValue)
|
|||
if AltSystem.State.announceEnabled then
|
||||
local channelDef = AltSystem.AnnounceChannels[AltSystem.State.announceChannelIndex]
|
||||
if channelDef then
|
||||
SendChatMessage(GetCharacterName() .. " rolled a Critical Failure!", channelDef.channel)
|
||||
SendToChannel(GetCharacterName() .. " rolled a Critical Failure!", channelDef.channel)
|
||||
end
|
||||
end
|
||||
return
|
||||
|
|
@ -93,7 +107,7 @@ function AltSystem:CalculateAndDisplayResult(rollType, rollValue)
|
|||
if AltSystem.State.announceEnabled then
|
||||
local channelDef = AltSystem.AnnounceChannels[AltSystem.State.announceChannelIndex]
|
||||
if channelDef then
|
||||
SendChatMessage(GetCharacterName() .. " rolled a Critical Success!", channelDef.channel)
|
||||
SendToChannel(GetCharacterName() .. " rolled a Critical Success!", channelDef.channel)
|
||||
end
|
||||
end
|
||||
return
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue