mirror of
https://github.com/brues-code/pfUI.git
synced 2026-10-25 05:20:49 +00:00
Read spell fields through ClassicAPI instead of nampower
Replace GetSpellRecField (nampower) with the C_Spell field readers. libdebuff reads the dispel type with C_Spell.GetSpellDispelType. swingtimer detects on-next-swing spells with C_Spell.IsNextMeleeSpell, and the swing-reset rule with C_Spell.ResetsMeleeSwing. The on-next-swing check now covers both attribute bits, and the freeze check folds in the keep-swings attribute, both matching the server rule. Note: needs the ClassicAPI release that adds these functions. Bump PFUI_CLASSIC_API_MIN when that version is out.
This commit is contained in:
+3
-5
@@ -376,11 +376,9 @@ local function GetDebuffSlotMap(guid)
|
|||||||
local texture = libdebuff:GetSpellIcon(spellId)
|
local texture = libdebuff:GetSpellIcon(spellId)
|
||||||
local stacks = (auraApps and auraApps[auraSlot] or 0) + 1
|
local stacks = (auraApps and auraApps[auraSlot] or 0) + 1
|
||||||
local dtype = nil
|
local dtype = nil
|
||||||
if GetSpellRecField then
|
local dispelId = C_Spell.GetSpellDispelType(spellId)
|
||||||
local dispelId = GetSpellRecField(spellId, "dispel")
|
if dispelId and dispelId > 0 then
|
||||||
if dispelId and dispelId > 0 then
|
dtype = dispelTypeMap[dispelId]
|
||||||
dtype = dispelTypeMap[dispelId]
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
map[displaySlot] = {
|
map[displaySlot] = {
|
||||||
auraSlot = auraSlot,
|
auraSlot = auraSlot,
|
||||||
|
|||||||
+14
-25
@@ -9,11 +9,6 @@ pfUI:RegisterModule("swingtimer", function ()
|
|||||||
local ON_SWING_QUEUED = 0
|
local ON_SWING_QUEUED = 0
|
||||||
local ON_SWING_QUEUE_POPPED = 1
|
local ON_SWING_QUEUE_POPPED = 1
|
||||||
|
|
||||||
-- Spell.dbc bits used to mirror server-side swing-reset rules.
|
|
||||||
local FLAG_AUTOATTACK = tonumber("0x08", 16) -- SPELL_INTERRUPT_FLAG_AUTOATTACK
|
|
||||||
local ATTR_KEEP_SWINGS = tonumber("0x20000", 16) -- SPELL_ATTR_EX2_NOT_RESET_AUTO_ACTIONS
|
|
||||||
local ATTR_ON_NEXT_SWING = tonumber("0x04", 16) -- SPELL_ATTR_ON_NEXT_SWING
|
|
||||||
|
|
||||||
-- Consolidate state into a table to avoid Lua 5.0 upvalue limit (32 max)
|
-- Consolidate state into a table to avoid Lua 5.0 upvalue limit (32 max)
|
||||||
local S = {
|
local S = {
|
||||||
mhTimer = 0, mhTimerMax = 1,
|
mhTimer = 0, mhTimerMax = 1,
|
||||||
@@ -43,12 +38,11 @@ pfUI:RegisterModule("swingtimer", function ()
|
|||||||
local WAND_SHOOT_SPELLID = 5019
|
local WAND_SHOOT_SPELLID = 5019
|
||||||
local THROW_SPELLID = 2764 -- one-shot ranged, not auto-repeat
|
local THROW_SPELLID = 2764 -- one-shot ranged, not auto-repeat
|
||||||
|
|
||||||
-- ATTR_ON_NEXT_SWING: spell replaces next auto-attack swing.
|
-- On-next-swing spells replace the next auto-attack swing.
|
||||||
-- Covers Raptor Strike, Maul, Mongoose Bite, Holy Strike, etc. automatically.
|
-- Covers Raptor Strike, Maul, Mongoose Bite, Holy Strike, etc. automatically.
|
||||||
local function IsOnSwingSpell(spellId)
|
local function IsOnSwingSpell(spellId)
|
||||||
if S.onSwingCache[spellId] ~= nil then return S.onSwingCache[spellId] end
|
if S.onSwingCache[spellId] ~= nil then return S.onSwingCache[spellId] end
|
||||||
local attr = GetSpellRecField(spellId, "attributes") or 0
|
local result = C_Spell.IsNextMeleeSpell(spellId)
|
||||||
local result = bit.band(attr, ATTR_ON_NEXT_SWING) ~= 0
|
|
||||||
S.onSwingCache[spellId] = result
|
S.onSwingCache[spellId] = result
|
||||||
return result
|
return result
|
||||||
end
|
end
|
||||||
@@ -734,13 +728,12 @@ pfUI:RegisterModule("swingtimer", function ()
|
|||||||
S.pendingCastSpellId = arg1
|
S.pendingCastSpellId = arg1
|
||||||
-- Freeze the swing timer for cast-time spells that DON'T reset auto-
|
-- Freeze the swing timer for cast-time spells that DON'T reset auto-
|
||||||
-- attack on completion (Slam, Hammer of Wrath on Turtle, etc.) — those
|
-- attack on completion (Slam, Hammer of Wrath on Turtle, etc.) — those
|
||||||
-- let the swing resume from where it paused. Detect dynamically via the
|
-- let the swing resume from where it paused. C_Spell.ResetsMeleeSwing
|
||||||
-- absent AUTOATTACK interrupt flag (8); spells with that bit reset on
|
-- mirrors the server rule; spells that reset don't need freezing (they
|
||||||
-- SPELL_GO_SELF so freezing isn't necessary. Subsumes the old hardcoded
|
-- reset on SPELL_GO_SELF). Subsumes the old hardcoded swingDelaySpells
|
||||||
-- swingDelaySpells list (no list maintenance for new Slam-style spells).
|
-- list (no list maintenance for new Slam-style spells).
|
||||||
if S.mhActive then
|
if S.mhActive then
|
||||||
local iflags = GetSpellRecField(arg1, "interruptFlags") or 0
|
if not C_Spell.ResetsMeleeSwing(arg1) then
|
||||||
if bit.band(iflags, FLAG_AUTOATTACK) == 0 then
|
|
||||||
S.mhFrozenAt = GetTime()
|
S.mhFrozenAt = GetTime()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -777,17 +770,13 @@ pfUI:RegisterModule("swingtimer", function ()
|
|||||||
S.hsQueued = false; S.cleaveQueued = false; S.maulQueued = false
|
S.hsQueued = false; S.cleaveQueued = false; S.maulQueued = false
|
||||||
ResetMH()
|
ResetMH()
|
||||||
else
|
else
|
||||||
-- Mirror the server rule for "does this spell reset the auto-attack
|
-- C_Spell.ResetsMeleeSwing mirrors the server rule (Turtle's
|
||||||
-- swing" (Spell::IsMeleeAttackResetSpell in Turtle's core):
|
-- Spell::IsMeleeAttackResetSpell): InterruptFlags has AUTOATTACK and
|
||||||
-- InterruptFlags has SPELL_INTERRUPT_FLAG_AUTOATTACK (0x08)
|
-- AttributesEx2 lacks NOT_RESET_AUTO_ACTIONS. When the spell resets the
|
||||||
-- AND AttributesEx2 lacks NOT_RESET_AUTO_ACTIONS (0x20000).
|
-- swing, snap the timers to full. Otherwise (elseif) a frozen-swing-
|
||||||
-- If neither path resets and we're holding a frozen-swing-during-cast
|
-- during-cast is a Slam-style cast — push the timer forward by the cast
|
||||||
-- (mhFrozenAt set by SPELL_START_SELF for non-AUTOATTACK spells), this
|
-- duration so the bar resumes from where it paused.
|
||||||
-- is a Slam-style cast — push the timer forward by the cast duration
|
if C_Spell.ResetsMeleeSwing(spellId) then
|
||||||
-- so the bar resumes from where it paused.
|
|
||||||
local iflags = GetSpellRecField(spellId, "interruptFlags") or 0
|
|
||||||
if bit.band(iflags, FLAG_AUTOATTACK) ~= 0
|
|
||||||
and bit.band(GetSpellRecField(spellId, "attributesEx2") or 0, ATTR_KEEP_SWINGS) == 0 then
|
|
||||||
if S.mhActive and S.mhSpeed > 0 then
|
if S.mhActive and S.mhSpeed > 0 then
|
||||||
UpdateWeaponSpeeds()
|
UpdateWeaponSpeeds()
|
||||||
S.mhTimerMax = S.mhSpeed
|
S.mhTimerMax = S.mhSpeed
|
||||||
|
|||||||
Reference in New Issue
Block a user