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:
@@ -247,11 +247,7 @@ pfUI:RegisterModule("turtle-wow", function ()
|
||||
local STEADY_SHOT_DURATION_MS = 1400 -- not haste-scaled; close enough for the visual cue
|
||||
local ON_SWING_QUEUED, ON_SWING_QUEUE_POPPED = 0, 1
|
||||
|
||||
local steadyShot = CreateFrame("Frame")
|
||||
steadyShot:RegisterEvent("SPELL_QUEUE_EVENT")
|
||||
steadyShot:SetScript("OnEvent", function()
|
||||
if event ~= "SPELL_QUEUE_EVENT" then return end
|
||||
local eventCode, spellId = arg1, arg2
|
||||
pfUI.events:RegisterFrameEventAndCallback("SPELL_QUEUE_EVENT", function(_, eventCode, spellId)
|
||||
if eventCode ~= ON_SWING_QUEUED and eventCode ~= ON_SWING_QUEUE_POPPED then return end
|
||||
if C_Spell.GetSpellName(spellId) ~= steadyShotName then return end
|
||||
if eventCode == ON_SWING_QUEUED then
|
||||
|
||||
Reference in New Issue
Block a user