mirror of
https://github.com/brues-code/pfUI.git
synced 2026-10-05 05:00:02 +00:00
swingtimer fix for warriors
Heoric strike now is shown within the swing timer.
This commit is contained in:
@@ -160,6 +160,12 @@ pfUI.libdebuff_all_slots = pfUI.libdebuff_all_slots or {}
|
||||
-- [targetGuid][spellName][casterGuid] = timestamp
|
||||
pfUI.libdebuff_recent_casts = pfUI.libdebuff_recent_casts or {}
|
||||
local recentCasts = pfUI.libdebuff_recent_casts
|
||||
|
||||
-- Callbacks fired after SPELL_GO_SELF is processed: fn(spellId, arg1, arg2, arg3, arg4, arg5, arg6, arg7)
|
||||
pfUI.libdebuff_spell_go_hooks = pfUI.libdebuff_spell_go_hooks or {}
|
||||
|
||||
-- Callbacks fired after SPELL_CAST_EVENT is processed: fn(success, spellId, castType, targetGuid)
|
||||
pfUI.libdebuff_spell_cast_hooks = pfUI.libdebuff_spell_cast_hooks or {}
|
||||
local AURA_CAST_DEDUPE_WINDOW = 0.1 -- Ignore duplicates within 100ms
|
||||
|
||||
-- Captured combo points from SPELL_CAST_EVENT (before client consumes them)
|
||||
@@ -1262,6 +1268,13 @@ if hasNampower then
|
||||
carnageCheckFrame:Show()
|
||||
end
|
||||
end
|
||||
|
||||
-- Fire registered SPELL_GO_SELF hooks (only for own casts)
|
||||
if event == "SPELL_GO_SELF" and pfUI.libdebuff_spell_go_hooks then
|
||||
for _, fn in pairs(pfUI.libdebuff_spell_go_hooks) do
|
||||
fn(spellId, arg1, arg2, arg3, arg4, arg5, arg6, arg7)
|
||||
end
|
||||
end
|
||||
|
||||
elseif event == "SPELL_FAILED_OTHER" then
|
||||
local casterGuid = arg1
|
||||
@@ -1311,6 +1324,13 @@ if hasNampower then
|
||||
if spellName and IsComboPointAbility(spellName) then
|
||||
capturedCP = GetComboPoints() or 0
|
||||
end
|
||||
|
||||
-- Fire registered SPELL_CAST_EVENT hooks
|
||||
if pfUI.libdebuff_spell_cast_hooks then
|
||||
for _, fn in pairs(pfUI.libdebuff_spell_cast_hooks) do
|
||||
fn(success, spellId, castType, targetGuid)
|
||||
end
|
||||
end
|
||||
|
||||
elseif event == "AURA_CAST_ON_SELF" or event == "AURA_CAST_ON_OTHER" then
|
||||
local spellId = arg1
|
||||
|
||||
@@ -89,9 +89,9 @@ pfUI:RegisterModule("raidmarkers", "vanilla:tbc", function ()
|
||||
pfUI.raidmarkers = CreateFrame("Frame", "pfMarkerTracker", UIParent)
|
||||
pfUI.raidmarkers:SetFrameStrata("MEDIUM")
|
||||
if GROW == "up" then
|
||||
pfUI.raidmarkers:SetPoint("BOTTOMRIGHT", UIParent, "BOTTOMRIGHT", -20, 200)
|
||||
pfUI.raidmarkers:SetPoint("BOTTOM", UIParent, "CENTER", 0, 0)
|
||||
else
|
||||
pfUI.raidmarkers:SetPoint("TOPRIGHT", UIParent, "TOPRIGHT", -20, -200)
|
||||
pfUI.raidmarkers:SetPoint("TOP", UIParent, "CENTER", 0, 0)
|
||||
end
|
||||
pfUI.raidmarkers:SetWidth(TOTAL_ROW_WIDTH)
|
||||
pfUI.raidmarkers:SetHeight(8 * (ROW_HEIGHT + 1) + border * 2 - 1)
|
||||
|
||||
+36
-11
@@ -293,11 +293,15 @@ pfUI:RegisterModule("swingtimer", "vanilla:tbc", function ()
|
||||
end
|
||||
|
||||
if isOffhand and swingState.offhand.speed > 0 then
|
||||
swingState.offhand.nextSwing = now + swingState.offhand.speed
|
||||
-- Continue from previous nextSwing to avoid timer jumps
|
||||
local base = (swingState.offhand.swinging and swingState.offhand.nextSwing > (now - 0.5)) and swingState.offhand.nextSwing or now
|
||||
swingState.offhand.nextSwing = base + swingState.offhand.speed
|
||||
swingState.offhand.swinging = true
|
||||
if sw_showoh then pfUI.swingtimer.offhand:Show() end
|
||||
else
|
||||
swingState.mainhand.nextSwing = now + swingState.mainhand.speed
|
||||
-- Continue from previous nextSwing to avoid timer jumps on HS/normal swing
|
||||
local base = (swingState.mainhand.swinging and swingState.mainhand.nextSwing > (now - 0.5)) and swingState.mainhand.nextSwing or now
|
||||
swingState.mainhand.nextSwing = base + swingState.mainhand.speed
|
||||
swingState.mainhand.swinging = true
|
||||
pfUI.swingtimer.mainhand:Show()
|
||||
end
|
||||
@@ -481,7 +485,31 @@ pfUI:RegisterModule("swingtimer", "vanilla:tbc", function ()
|
||||
events:RegisterEvent("ACTIONBAR_SLOT_CHANGED")
|
||||
events:RegisterEvent("UNIT_DIED")
|
||||
events:RegisterEvent("SPELL_QUEUE_EVENT")
|
||||
events:RegisterEvent("SPELL_GO_SELF")
|
||||
|
||||
-- Use libdebuff SPELL_GO_SELF hook instead of registering the event separately
|
||||
pfUI.libdebuff_spell_go_hooks = pfUI.libdebuff_spell_go_hooks or {}
|
||||
pfUI.libdebuff_spell_go_hooks["swingtimer"] = function(spellId)
|
||||
if RANGED_SPELLIDS[spellId] then
|
||||
StartRangedSwing()
|
||||
elseif hsSpellIDs[spellId] then
|
||||
hsQueued = false; cleaveQueued = false
|
||||
StartSwing(false)
|
||||
elseif cleaveSpellIDs[spellId] then
|
||||
hsQueued = false; cleaveQueued = false
|
||||
StartSwing(false)
|
||||
end
|
||||
end
|
||||
|
||||
-- Use libdebuff SPELL_CAST_EVENT hook instead of registering the event separately
|
||||
pfUI.libdebuff_spell_cast_hooks = pfUI.libdebuff_spell_cast_hooks or {}
|
||||
pfUI.libdebuff_spell_cast_hooks["swingtimer"] = function(success, spellId)
|
||||
if success ~= 1 then return end
|
||||
if hsSpellIDs[spellId] then
|
||||
hsQueued = true; cleaveQueued = false
|
||||
elseif cleaveSpellIDs[spellId] then
|
||||
cleaveQueued = true; hsQueued = false
|
||||
end
|
||||
end
|
||||
|
||||
local function ResetSwingTimers()
|
||||
swingState.mainhand.swinging = false
|
||||
@@ -498,9 +526,10 @@ pfUI:RegisterModule("swingtimer", "vanilla:tbc", function ()
|
||||
events:SetScript("OnEvent", function()
|
||||
if event == "AUTO_ATTACK_SELF" then
|
||||
local hitInfo = arg4 or 0
|
||||
-- HITINFO_NOACTION: server did not advance the swing clock, ignore
|
||||
if bit.band(hitInfo, HITINFO_NOACTION) ~= 0 then return end
|
||||
local isOffhand = bit.band(hitInfo, HITINFO_LEFTSWING) ~= 0
|
||||
local noAction = bit.band(hitInfo, HITINFO_NOACTION) ~= 0
|
||||
-- HITINFO_NOACTION: server did not advance the swing clock, ignore
|
||||
if noAction then return end
|
||||
StartSwing(isOffhand)
|
||||
|
||||
elseif event == "AUTO_ATTACK_OTHER" then
|
||||
@@ -530,9 +559,11 @@ pfUI:RegisterModule("swingtimer", "vanilla:tbc", function ()
|
||||
hsQueued = true; cleaveQueued = false
|
||||
elseif cleaveSpellIDs[spellId] then
|
||||
cleaveQueued = true; hsQueued = false
|
||||
else
|
||||
end
|
||||
elseif eventCode == ON_SWING_QUEUE_POPPED then
|
||||
hsQueued = false; cleaveQueued = false
|
||||
else
|
||||
end
|
||||
|
||||
elseif event == "PLAYER_ENTERING_WORLD" then
|
||||
@@ -543,12 +574,6 @@ pfUI:RegisterModule("swingtimer", "vanilla:tbc", function ()
|
||||
UpdateWeaponSpeeds()
|
||||
RebuildQueueSlotCache()
|
||||
|
||||
elseif event == "SPELL_GO_SELF" then
|
||||
local spellId = arg2 or 0
|
||||
if RANGED_SPELLIDS[spellId] then
|
||||
StartRangedSwing()
|
||||
end
|
||||
|
||||
elseif event == "UNIT_INVENTORY_CHANGED" then
|
||||
if arg1 and arg1 ~= "player" then return end
|
||||
UpdateWeaponSpeeds()
|
||||
|
||||
Reference in New Issue
Block a user