mirror of
https://github.com/brues-code/pfUI.git
synced 2026-10-09 15:10:00 +00:00
superwow: move into its own module
Moving superwow integration from thirdparty into a seperate module. It's a client mod, not an addon and therefore should not bloat the thirdparty section that is already huge enough. It was a mistake to treat it as an addon-compat in first place. Now having it as a seperate module also allows it to grow better over time as new SuperWoW features are integrated into pfUI.
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
-- Compatibility layer to use castbars provided by SuperWoW:
|
||||
-- https://github.com/balakethelock/SuperWoW
|
||||
pfUI:RegisterModule("superwow", "vanilla", function ()
|
||||
local unitcast = CreateFrame("Frame")
|
||||
unitcast:RegisterEvent("UNIT_CASTEVENT")
|
||||
unitcast:SetScript("OnEvent", function()
|
||||
if arg3 == "START" or arg3 == "CAST" or arg3 == "CHANNEL" then
|
||||
-- human readable argument list
|
||||
local guid = arg1
|
||||
local target = arg2
|
||||
local event_type = arg3
|
||||
local spell_id = arg4
|
||||
local timer = arg5
|
||||
local start = GetTime()
|
||||
|
||||
-- get spell info from spell id
|
||||
local spell, icon, _
|
||||
if SpellInfo and SpellInfo(spell_id) then
|
||||
spell, _, icon = SpellInfo(spell_id)
|
||||
end
|
||||
|
||||
-- set fallback values
|
||||
spell = spell or UNKNOWN
|
||||
icon = icon or "Interface\\Icons\\INV_Misc_QuestionMark"
|
||||
|
||||
-- add cast action to the database
|
||||
if not libcast.db[guid] then libcast.db[guid] = {} end
|
||||
libcast.db[guid].cast = spell
|
||||
libcast.db[guid].rank = nil
|
||||
libcast.db[guid].start = GetTime()
|
||||
libcast.db[guid].casttime = timer
|
||||
libcast.db[guid].icon = icon
|
||||
libcast.db[guid].channel = event_type == "CHANNEL" or false
|
||||
|
||||
-- write state variable
|
||||
superwow_active = true
|
||||
elseif arg3 == "FAIL" then
|
||||
local guid = arg1
|
||||
|
||||
-- delete all cast entries of guid
|
||||
libcast.db[guid].cast = nil
|
||||
libcast.db[guid].rank = nil
|
||||
libcast.db[guid].start = nil
|
||||
libcast.db[guid].casttime = nil
|
||||
libcast.db[guid].icon = nil
|
||||
libcast.db[guid].channel = nil
|
||||
end
|
||||
end)
|
||||
end)
|
||||
Reference in New Issue
Block a user