Compare commits
2 commits
865404ffb7
...
88f09f4fe4
| Author | SHA1 | Date | |
|---|---|---|---|
| 88f09f4fe4 | |||
| c4075d1ee9 |
2 changed files with 26 additions and 17 deletions
|
|
@ -2,7 +2,7 @@
|
|||
## Title: AltSystem
|
||||
## Notes: Enhances RP gameplay with a custom rolling system
|
||||
## Author: Rukira
|
||||
## Version: 0.3
|
||||
## Version: 0.4
|
||||
## Dependencies: totalRP3, totalRP3_Extended
|
||||
## SavedVariables: AltSystemDB
|
||||
|
||||
|
|
|
|||
35
Roll.lua
35
Roll.lua
|
|
@ -26,17 +26,11 @@ 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.
|
||||
-- Send a message to the given channel.
|
||||
-- Note: EMOTE channel uses SendChatMessage like all others. The WoW API
|
||||
-- SendChatMessage(msg, "EMOTE") sends a proper /e emote from any context,
|
||||
-- unlike RunMacroText which is a protected function requiring a hardware event.
|
||||
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
|
||||
|
||||
|
|
@ -47,15 +41,24 @@ local function AnnounceRoll(rollValue, modifiers, total)
|
|||
local channelDef = AltSystem.AnnounceChannels[AltSystem.State.announceChannelIndex]
|
||||
if not channelDef then return end
|
||||
|
||||
local name = GetCharacterName()
|
||||
local isEmote = channelDef.channel == "EMOTE"
|
||||
local modStr = BuildModifierString(modifiers)
|
||||
|
||||
local msg
|
||||
if isEmote then
|
||||
if modStr ~= "" then
|
||||
msg = "rolled " .. rollValue .. " " .. modStr .. " = " .. total
|
||||
else
|
||||
msg = "rolled " .. rollValue .. " = " .. total
|
||||
end
|
||||
else
|
||||
local name = GetCharacterName()
|
||||
if modStr ~= "" then
|
||||
msg = name .. " rolled " .. rollValue .. " " .. modStr .. " = " .. total
|
||||
else
|
||||
msg = name .. " rolled " .. rollValue .. " = " .. total
|
||||
end
|
||||
end
|
||||
|
||||
SendToChannel(msg, channelDef.channel)
|
||||
end
|
||||
|
|
@ -94,7 +97,10 @@ function AltSystem:CalculateAndDisplayResult(rollType, rollValue)
|
|||
if AltSystem.State.announceEnabled then
|
||||
local channelDef = AltSystem.AnnounceChannels[AltSystem.State.announceChannelIndex]
|
||||
if channelDef then
|
||||
SendToChannel(GetCharacterName() .. " rolled a Critical Failure!", channelDef.channel)
|
||||
local critMsg = channelDef.channel == "EMOTE"
|
||||
and "rolled a Critical Failure!"
|
||||
or (GetCharacterName() .. " rolled a Critical Failure!")
|
||||
SendToChannel(critMsg, channelDef.channel)
|
||||
end
|
||||
end
|
||||
return
|
||||
|
|
@ -105,7 +111,10 @@ function AltSystem:CalculateAndDisplayResult(rollType, rollValue)
|
|||
if AltSystem.State.announceEnabled then
|
||||
local channelDef = AltSystem.AnnounceChannels[AltSystem.State.announceChannelIndex]
|
||||
if channelDef then
|
||||
SendToChannel(GetCharacterName() .. " rolled a Critical Success!", channelDef.channel)
|
||||
local critMsg = channelDef.channel == "EMOTE"
|
||||
and "rolled a Critical Success!"
|
||||
or (GetCharacterName() .. " rolled a Critical Success!")
|
||||
SendToChannel(critMsg, channelDef.channel)
|
||||
end
|
||||
end
|
||||
return
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue