mirror of
https://github.com/brues-code/pfUI.git
synced 2026-10-24 13:00:50 +00:00
Replace Nampower combat events with ClassicAPI events
Read casts from UNIT_SPELLCAST_* and heal amounts from COMBAT_LOG_EVENT_UNFILTERED in libpredict, swingtimer and the prowl page switch. Drop libdebuff's AURA_CAST/DEBUFF_* bookkeeping and hook tables, which nothing read: its aura readers already use C_UnitAuras. Drop the unitframe BUFF_ADDED_OTHER start-time tracker, since C_UnitAuras stamps an expiration for auras seen being applied.
This commit is contained in:
+16
-14
@@ -897,6 +897,10 @@ pfUI:RegisterModule("actionbar", function ()
|
||||
pageswitch:RegisterEvent("UPDATE_SHAPESHIFT_FORM")
|
||||
pageswitch:RegisterEvent("PLAYER_AURAS_CHANGED")
|
||||
pageswitch:RegisterEvent("PLAYER_LOGOUT")
|
||||
local PROWL_IDS = { [5215] = true, [6783] = true, [9913] = true }
|
||||
if class == "DRUID" then
|
||||
pageswitch:RegisterUnitEvent("UNIT_SPELLCAST_SUCCEEDED", "player")
|
||||
end
|
||||
pageswitch:SetScript("OnEvent", function()
|
||||
if event == "PLAYER_LOGOUT" then
|
||||
this:UnregisterAllEvents()
|
||||
@@ -919,6 +923,18 @@ pfUI:RegisterModule("actionbar", function ()
|
||||
return
|
||||
end
|
||||
|
||||
-- Eager prowl detection on the cast itself — zero-latency vs.
|
||||
-- PLAYER_AURAS_CHANGED, which can land a frame or two behind it.
|
||||
-- arg3 = spellID
|
||||
if event == "UNIT_SPELLCAST_SUCCEEDED" then
|
||||
if PROWL_IDS[arg3] then
|
||||
inCatForm = true
|
||||
prowlActive = true
|
||||
formpaging = true
|
||||
end
|
||||
return
|
||||
end
|
||||
|
||||
if event == "UPDATE_SHAPESHIFT_FORM" then
|
||||
-- Authoritative form-change signal — recompute and short-circuit.
|
||||
inCatForm = HasCatForm()
|
||||
@@ -942,20 +958,6 @@ pfUI:RegisterModule("actionbar", function ()
|
||||
end
|
||||
end)
|
||||
|
||||
-- Eager prowl detection via Nampower SPELL_GO_SELF — zero-latency vs.
|
||||
-- PLAYER_AURAS_CHANGED, which can land a frame or two behind the cast.
|
||||
-- Form changes are no longer hooked here; UPDATE_SHAPESHIFT_FORM covers
|
||||
-- those without needing a per-spellID watchlist.
|
||||
local PROWL_IDS = { [5215] = true, [6783] = true, [9913] = true }
|
||||
pfUI.libdebuff_spell_go_hooks = pfUI.libdebuff_spell_go_hooks or {}
|
||||
pfUI.libdebuff_spell_go_hooks["actionbar_prowl"] = function(spellId)
|
||||
if class ~= "DRUID" then return end
|
||||
if PROWL_IDS[spellId] then
|
||||
inCatForm = true
|
||||
prowlActive = true
|
||||
formpaging = true
|
||||
end
|
||||
end
|
||||
pageswitch:SetScript("OnUpdate", function()
|
||||
-- switch actionbar page depending on meta key that is pressed
|
||||
if C.bars.pagemastershift == "1" and IsShiftKeyDown() then
|
||||
|
||||
+20
-24
@@ -635,25 +635,6 @@ pfUI:RegisterModule("swingtimer", function ()
|
||||
end
|
||||
end)
|
||||
|
||||
-- SPELL_GO hook via libdebuff: an on-next-swing ability (HS / Cleave /
|
||||
-- Maul) resolving consumes the queue, so drop the queued color.
|
||||
pfUI.libdebuff_spell_go_hooks = pfUI.libdebuff_spell_go_hooks or {}
|
||||
pfUI.libdebuff_spell_go_hooks["swingtimer"] = function(spellId)
|
||||
if IsOnSwingSpell(spellId) then
|
||||
S.hsQueued = false; S.cleaveQueued = false; S.maulQueued = false
|
||||
end
|
||||
end
|
||||
|
||||
-- SPELL_CAST_EVENT hook: HS/Cleave/Maul queue tracking
|
||||
pfUI.libdebuff_spell_cast_hooks = pfUI.libdebuff_spell_cast_hooks or {}
|
||||
pfUI.libdebuff_spell_cast_hooks["swingtimer"] = function(success, spellId)
|
||||
local kind = ClassifyOnSwingSpell(spellId)
|
||||
if not kind then return end
|
||||
S.useSpellQueueEvent = true
|
||||
SetQueuedKind(kind)
|
||||
end
|
||||
|
||||
|
||||
local events = CreateFrame("Frame")
|
||||
events:RegisterEvent("PLAYER_SWING")
|
||||
events:RegisterEvent("PLAYER_ENTERING_WORLD")
|
||||
@@ -661,7 +642,9 @@ pfUI:RegisterModule("swingtimer", function ()
|
||||
events:RegisterEvent("PLAYER_REGEN_DISABLED")
|
||||
events:RegisterEvent("PLAYER_REGEN_ENABLED")
|
||||
events:RegisterEvent("ACTIONBAR_SLOT_CHANGED")
|
||||
events:RegisterUnitEvent("UNIT_DIED", UnitGUID("player"))
|
||||
events:RegisterEvent("PLAYER_DEAD")
|
||||
events:RegisterUnitEvent("UNIT_SPELLCAST_SENT", "player")
|
||||
events:RegisterUnitEvent("UNIT_SPELLCAST_SUCCEEDED", "player")
|
||||
events:RegisterEvent("SPELL_QUEUE_EVENT")
|
||||
events:RegisterEvent("START_AUTOATTACK")
|
||||
events:RegisterEvent("STOP_AUTOATTACK")
|
||||
@@ -679,6 +662,21 @@ pfUI:RegisterModule("swingtimer", function ()
|
||||
StartRanged(arg1)
|
||||
end
|
||||
|
||||
elseif event == "UNIT_SPELLCAST_SENT" then
|
||||
-- arg4 = spellID: an on-next-swing ability (HS / Cleave / Maul) queued
|
||||
local kind = ClassifyOnSwingSpell(arg4)
|
||||
if kind then
|
||||
S.useSpellQueueEvent = true
|
||||
SetQueuedKind(kind)
|
||||
end
|
||||
|
||||
elseif event == "UNIT_SPELLCAST_SUCCEEDED" then
|
||||
-- arg3 = spellID: the on-next-swing ability resolved, which consumes
|
||||
-- the queue, so drop the queued color
|
||||
if IsOnSwingSpell(arg3) then
|
||||
S.hsQueued = false; S.cleaveQueued = false; S.maulQueued = false
|
||||
end
|
||||
|
||||
elseif event == "SPELL_QUEUE_EVENT" then
|
||||
local eventCode = arg1 or -1
|
||||
local spellId = arg2 or 0
|
||||
@@ -728,10 +726,8 @@ pfUI:RegisterModule("swingtimer", function ()
|
||||
S.cleaveQueued = false
|
||||
S.maulQueued = false
|
||||
|
||||
elseif event == "UNIT_DIED" then
|
||||
if IsPlayerGuid(arg1) then
|
||||
ResetAll()
|
||||
end
|
||||
elseif event == "PLAYER_DEAD" then
|
||||
ResetAll()
|
||||
end
|
||||
end)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user