mirror of
https://github.com/brues-code/pfUI.git
synced 2026-10-31 07:56:57 +00:00
Give pfUI its own EventRegistry and move event-only frames onto it
pfUI.events was a bare CallbackRegistry for pfUI's custom events. Build it from ClassicAPI's EventRegistry instead, so the same object also takes game events through RegisterFrameEventAndCallback, sharing one frame for all of them. Move the frames that existed only to listen for a few events onto it: libspell, focus, pixelperfect, innervatecall, loothistory, unusable, equipmentmanager (bank + window refresh), the actionbar grid, updatenotify, turtle-wow's steady shot, nampower's spell queue, superwow's group tracking and unitxp's notifications, plus newitem and mapreveal, which used the global EventRegistry. Handlers take their payload as arguments instead of the event/arg globals, and the per-frame PLAYER_LOGOUT teardown goes away, since the registry unregisters its frame on logout.
This commit is contained in:
@@ -46,22 +46,17 @@ pfUI:RegisterModule("innervatecall", function ()
|
||||
end)
|
||||
end
|
||||
|
||||
local frame = CreateFrame("Frame")
|
||||
frame:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
|
||||
frame:RegisterEvent("SPELL_UPDATE_COOLDOWN")
|
||||
frame:SetScript("OnEvent", function()
|
||||
if event == "SPELL_UPDATE_COOLDOWN" then
|
||||
if pending then ScheduleReady() end
|
||||
return
|
||||
end
|
||||
pfUI.events:RegisterFrameEventAndCallback("SPELL_UPDATE_COOLDOWN", function()
|
||||
if pending then ScheduleReady() end
|
||||
end)
|
||||
|
||||
pfUI.events:RegisterFrameEventAndCallback("COMBAT_LOG_EVENT_UNFILTERED", function()
|
||||
-- Innervate is instant, so it logs SPELL_CAST_SUCCESS with its target
|
||||
-- arg2=subevent, arg4=sourceGUID, arg9=destName, arg12=spellId
|
||||
if arg2 ~= "SPELL_CAST_SUCCESS" or arg12 ~= INNERVATE_SPELLID then return end
|
||||
local _, subevent, _, sourceGUID, _, _, _, _, destName, _, _, spellId = CombatLogGetCurrentEventInfo()
|
||||
if subevent ~= "SPELL_CAST_SUCCESS" or spellId ~= INNERVATE_SPELLID then return end
|
||||
|
||||
-- Only announce our own casts
|
||||
if not IsPlayerGuid(arg4) then return end
|
||||
local destName = arg9
|
||||
if not IsPlayerGuid(sourceGUID) then return end
|
||||
|
||||
-- Determine channel
|
||||
local channel = GetAnnounceChannel()
|
||||
|
||||
Reference in New Issue
Block a user