Skip to content

Commit

Permalink
Release
Browse files Browse the repository at this point in the history
  • Loading branch information
Christoffer Stokbæk committed Feb 3, 2018
1 parent 210bbfd commit ff2c18b
Show file tree
Hide file tree
Showing 4 changed files with 94 additions and 0 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,8 @@
# ResurrectionAnnounce
Plugin for HealComm (WoW 1.12.1) to announce who you are resurrecting

Usage:|cffffff55 /sayres {chat|help}
chat {number}:
* 0: Dynamic (Party/Raid)
* 1: Raid
* 2: Say
11 changes: 11 additions & 0 deletions ResurrectionAnnounce.toc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
## Interface: 11200
## Title: |cFFFF8080R|resurrection |cFFFF8080A|rnnouncement
## Author: stokbaek
## Notes: Plugin That Adds Resurrection Announce to Chat
## Version: 1.0
## Note: This Plugin needs to either have HealComm or LunaFrames installed to work
## SavedVariablesPerCharacter: sayres_options

# main
core.lua
cmd.lua
29 changes: 29 additions & 0 deletions cmd.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
SLASH_SAYRES1, SLASH_SAYRES2 = '/sayres', '/sr'
function SlashCmdList.SAYRES(msg, editbox)
local cmd, opt = strsplit(" ", msg)
local chatformat_cmd = "|cFFFF8080rA |\124|cffffff55"
local chatformat_info = "|cFFFF8080rA |\124|cffff0000"
if cmd == "chat" then
if opt == "0" then
DEFAULT_CHAT_FRAME:AddMessage(chatformat_cmd.."Chat Output set to: |cff00ff00DYNAMIC")
elseif opt == "1" then
DEFAULT_CHAT_FRAME:AddMessage(chatformat_cmd.."Chat Output set to: |cffff7d00RAID")
elseif opt == "2" then
DEFAULT_CHAT_FRAME:AddMessage(chatformat_cmd.."Chat Output set to: |rSAY")
else
DEFAULT_CHAT_FRAME:AddMessage(chatformat_info.."Unknown Chat Option")
return
end
ra_options[cmd] = opt
elseif msg == "help" or "" then
if msg ~= "help" then
DEFAULT_CHAT_FRAME:AddMessage(chatformat_info.."Unkown Command")
DEFAULT_CHAT_FRAME:AddMessage(chatformat_info.."----")
end
DEFAULT_CHAT_FRAME:AddMessage(chatformat_info.."About:|cffffff55 Announces when you resurrect a player in your Raid/Party")
DEFAULT_CHAT_FRAME:AddMessage(chatformat_info.."Usage:|cffffff55 /sayres {chat\124|help}")
DEFAULT_CHAT_FRAME:AddMessage(chatformat_info.."chat {number}:|cffffff55 0, Dynamic (Party/Raid); 1, Party; 2, Say")
DEFAULT_CHAT_FRAME:AddMessage(chatformat_info.."help:|cffffff55 Shows this message")
return
end
end
48 changes: 48 additions & 0 deletions core.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
local events = {}
local ress = {}

ra_options = {}

rahealcomm = CreateFrame("Frame")
rahealcomm:RegisterEvent("CHAT_MSG_ADDON")
rahealcomm:SetScript("OnEvent", function()
if event == "CHAT_MSG_ADDON" and arg1 == "HealComm" then
this:ParseChatMessage(arg4, arg2)
end
end)

rahealcomm:SetScript("OnUpdate", function()
for timestamp, targets in pairs(events) do
if GetTime() >= timestamp then
for id, target in pairs(targets) do
rahealcomm:TriggerUpdate(target)
end
events[timestamp] = nil
end
end
end)

function rahealcomm:ParseChatMessage(sender, msg)
local _, _, evtype, target = string.find(msg, '(Resurrection)/(%a+)/(start)/')
if evtype and target then
rahealcomm:Ress(sender, target)
return
end
end

function rahealcomm:Ress(sender, target)
ress[target] = ress[target] or {}
ress[target][sender] = true

if sender == UnitName("player") and target ~= UnitName("player") then
if ra_options.chat == "0" then
SendChatMessage("Resurrecting " .. target, UnitInRaid("player") and "Raid" or "Party")
elseif ra_options.chat == "1" then
if UnitInRaid("player") and "Raid" then
SendChatMessage("Resurrecting " .. target, "Raid")
end
else
SendChatMessage("Resurrecting " .. target, "Say")
end
end
end

0 comments on commit ff2c18b

Please sign in to comment.