mirror of
https://github.com/brues-code/SuperCleveRoidMacros.git
synced 2026-09-16 03:38:00 +00:00
Retire the hasPfUI76 flag and the pfUI 7.6 branches it gated
Assume a modern pfUI, and drop the version-tiered branching entirely: 31 call sites across five files, plus the flag and its detector. Note which side was actually dead. HasPfUI76() required four things -- pfUI version >= 7.6, Nampower >= 2.40, pfUI.libdebuff_objects_guid, and pfUI.libdebuff_casts. The last one does not exist: pfUI exports 28 libdebuff_* tables and libdebuff_casts is not among them (libdebuff_recent_casts is a dedup table keyed [targetGuid][spellName][casterGuid], a different shape). So the detector returned false at any version, and it was the hasPfUI76-TRUE branches that never ran, not the fallbacks. Removing those is behaviour- preserving; keeping SCRM as the owner of castTracking is what the code has always actually done. Removed accordingly: - lib:HasPfUI76(), both flag declarations, and the block that would have aliased castTracking to pfUI.libdebuff_casts and re-pointed lib.objects/iconCache. - HookPfUILibdebuff's "7.6 handles durations internally" early return, so the GetDuration/AddEffect hooks below it are visibly the live path again. - The SPELL_START_OTHER / SPELL_FAILED_OTHER unregister arm, the pfUI branch of GetAuraTrackingData, the pfUI76 arm of the libdebuff zone/death cleanup, the pfUI backing table in the /cleveroid aura dump, and two status-string suffixes. - SyncComboDurationToPfUI (77 lines) with its two call sites: it returned immediately whenever hasPfUI76, and is inert once the tier split is gone. Unconditionalised the paths that were gated on `not hasPfUI76`: the castTracking populate/clear/sweep, InitPfUIIntegration on login, and ten libdebuff duration lookups. Verified no hasPfUI76 reference remains, and that per-file block balance is unchanged from HEAD.
This commit is contained in:
+1
-97
@@ -123,16 +123,6 @@ function Extension.HookPfUILibdebuff()
|
||||
|
||||
local pflib = pfUI.api.libdebuff
|
||||
|
||||
-- Check if pfUI 7.6+ with GetUnitField-based libdebuff is active
|
||||
-- If so, pfUI handles combo durations and Carnage internally - we only override on mismatch
|
||||
local hasPfUI76 = CleveRoids.hasPfUI76
|
||||
|
||||
-- pfUI 7.6+ handles all durations internally - no hooks needed
|
||||
if hasPfUI76 then
|
||||
Extension.DLOG("Skipped all libdebuff hooks (pfUI 7.6+ handles internally)")
|
||||
return false
|
||||
end
|
||||
|
||||
-- Hook GetDuration if it exists
|
||||
-- pfUI's GetDuration signature: function(effect, rank) where effect is spell NAME
|
||||
if pflib.GetDuration and not Extension.pfLibDebuffHooked then
|
||||
@@ -343,83 +333,6 @@ function Extension.HookPfUILibdebuff()
|
||||
return Extension.pfLibDebuffHooked or Extension.pfLibAddEffectHooked or Extension.pfLibUnitDebuffHooked or Extension.pfLibUnitOwnDebuffHooked
|
||||
end
|
||||
|
||||
-- Synchronize combo durations to pfUI's libdebuff objects
|
||||
-- NOTE: pfUI 7.6+ handles combo durations internally - skip sync entirely
|
||||
function Extension.SyncComboDurationToPfUI(guid, spellID, duration)
|
||||
if not pfUI or not pfUI.api or not pfUI.api.libdebuff then
|
||||
return
|
||||
end
|
||||
|
||||
-- pfUI 7.6+ handles all durations internally
|
||||
if CleveRoids.hasPfUI76 then
|
||||
return
|
||||
end
|
||||
|
||||
-- Get unit name from GUID
|
||||
local unitName = nil
|
||||
local unitLevel = 0
|
||||
|
||||
-- Check if this is the current target
|
||||
local targetGUID = CleveRoids.GetGUID("target")
|
||||
if targetGUID == guid then
|
||||
unitName = UnitName("target")
|
||||
unitLevel = UnitLevel("target") or 0
|
||||
end
|
||||
|
||||
-- If we couldn't find the unit, use GUID to name mapping from libdebuff
|
||||
if not unitName and CleveRoids.libdebuff and CleveRoids.libdebuff.guidToName then
|
||||
unitName = CleveRoids.libdebuff.guidToName[guid]
|
||||
-- Default to level 0 if we don't have the unit targeted
|
||||
unitLevel = 0
|
||||
end
|
||||
|
||||
if not unitName then
|
||||
if CleveRoids.debug then
|
||||
DEFAULT_CHAT_FRAME:AddMessage("|cffff0000[pfUI Sync]|r Could not find unit name for GUID")
|
||||
end
|
||||
return
|
||||
end
|
||||
|
||||
-- Get spell name from spell ID
|
||||
local spellName = C_Spell.GetSpellName(spellID)
|
||||
if not spellName then
|
||||
if CleveRoids.debug then
|
||||
DEFAULT_CHAT_FRAME:AddMessage("|cffff0000[pfUI Sync]|r Could not find spell name for ID " .. spellID)
|
||||
end
|
||||
return
|
||||
end
|
||||
|
||||
-- Remove rank from spell name to match pfUI's format
|
||||
local effectName = CleveRoids.StripRank(spellName)
|
||||
|
||||
-- Update pfUI's stored debuff duration
|
||||
local pflib = pfUI.api.libdebuff
|
||||
if pflib.objects and pflib.objects[unitName] then
|
||||
-- Try both the specific level and level 0 (fallback)
|
||||
for _, level in ipairs({unitLevel, 0}) do
|
||||
if pflib.objects[unitName][level] and pflib.objects[unitName][level][effectName] then
|
||||
local old_duration = pflib.objects[unitName][level][effectName].duration
|
||||
pflib.objects[unitName][level][effectName].duration = duration
|
||||
|
||||
if CleveRoids.debug then
|
||||
DEFAULT_CHAT_FRAME:AddMessage(
|
||||
string.format("|cff00ffaa[pfUI Sync]|r Updated %s on %s (L%d): %ds -> %ds",
|
||||
effectName, unitName, level, old_duration or 0, duration)
|
||||
)
|
||||
end
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if CleveRoids.debug then
|
||||
DEFAULT_CHAT_FRAME:AddMessage(
|
||||
string.format("|cffaaaa00[pfUI Sync]|r Effect not found in pfUI storage: %s on %s",
|
||||
effectName, unitName)
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
-- Register action event handler for pfUI button updates
|
||||
function Extension.RegisterPfUIActionEventHandler()
|
||||
if not pfUI or Extension.actionHandlerRegistered then
|
||||
@@ -643,12 +556,6 @@ function Extension.SetupPfUIEventHooks(lib)
|
||||
ev:UnregisterEvent("BUFF_REMOVED_SELF")
|
||||
ev:UnregisterEvent("BUFF_REMOVED_OTHER")
|
||||
|
||||
-- pfUI 7.6+ also handles cast tracking internally
|
||||
if lib.hasPfUI76 then
|
||||
ev:UnregisterEvent("SPELL_START_OTHER")
|
||||
ev:UnregisterEvent("SPELL_FAILED_OTHER")
|
||||
end
|
||||
|
||||
-- Keep registered: SPELL_START_SELF (channel duration capture before early return),
|
||||
-- UNIT_DIED (AllCasterAuraTracking + OverflowBuff cleanup), UNIT_CASTEVENT (SuperWoW),
|
||||
-- PLAYER_TARGET_CHANGED, UNIT_AURA (SeedUnit)
|
||||
@@ -751,7 +658,7 @@ end
|
||||
|
||||
function Extension.OnPlayerLogin()
|
||||
-- Ensure lib.objects is linked correctly (InitPfUIIntegration is idempotent).
|
||||
if pfUI and not CleveRoids.hasPfUI76 then
|
||||
if pfUI then
|
||||
local lib = CleveRoids.libdebuff
|
||||
if lib and lib.InitPfUIIntegration then
|
||||
lib:InitPfUIIntegration()
|
||||
@@ -783,9 +690,6 @@ function Extension.OnPlayerLogin()
|
||||
-- Print startup status only if pfUI global exists and compatibility was set up
|
||||
if Extension.pfUILoaded and pfUI then
|
||||
local statusMsg = "|cff00ff00[SCRM]|r pfUI compatibility loaded"
|
||||
if CleveRoids.hasPfUI76 then
|
||||
statusMsg = statusMsg .. " (7.6+ GUID cast tracking)"
|
||||
end
|
||||
-- statusMsg = statusMsg .. ". Use /pfuicd for debug."
|
||||
DEFAULT_CHAT_FRAME:AddMessage(statusMsg)
|
||||
if not Extension.actionHandlerRegistered then
|
||||
|
||||
+3
-11
@@ -779,14 +779,6 @@ CleveRoids.DownrankBlocked = CleveRoids.DownrankBlocked or {}
|
||||
function CleveRoids.GetAuraTrackingData(targetGuid)
|
||||
if not targetGuid then return nil, false end
|
||||
|
||||
-- pfUI path: read directly from pfUI's table (has downrank protection built-in)
|
||||
if CleveRoids.hasPfUI76 and pfUI and pfUI.libdebuff_all_auras then
|
||||
local data = pfUI.libdebuff_all_auras[targetGuid]
|
||||
if data then return data, true end
|
||||
-- Fall through: our table may have test entries even when pfUI is active
|
||||
end
|
||||
|
||||
-- Standalone path (or pfUI had no data for this GUID)
|
||||
local data = CleveRoids.AllCasterAuraTracking[targetGuid]
|
||||
if data then return data, false end
|
||||
return nil, false
|
||||
@@ -995,7 +987,7 @@ local function OnAutoAttackOther(attackerGuid, targetGuid, totalDamage, hitInfo,
|
||||
end
|
||||
|
||||
-- Sync to pfUI if loaded (pre-7.6 only)
|
||||
if not CleveRoids.hasPfUI76 and pfUI and pfUI.api and pfUI.api.libdebuff then
|
||||
if pfUI and pfUI.api and pfUI.api.libdebuff then
|
||||
local spellName = C_Spell.GetSpellName(spellID) or nil
|
||||
local baseName = CleveRoids.StripRank(spellName)
|
||||
local targetName = (lib.guidToName and lib.guidToName[normalizedTarget]) or UnitName("target")
|
||||
@@ -1175,7 +1167,7 @@ local function OnAuraCastOther(spellId, casterGuid, targetGuid, effect, effectAu
|
||||
-- full downrank protection — we read from that table via GetAuraTrackingData().
|
||||
if spellId and durationMs and durationMs > 0 then
|
||||
local spellName = C_Spell.GetSpellName(spellId)
|
||||
if spellName and not CleveRoids.hasPfUI76 then
|
||||
if spellName then
|
||||
CleveRoids._allCasterAuraDirty = true
|
||||
if not CleveRoids.AllCasterAuraTracking[targetGuid] then
|
||||
CleveRoids.AllCasterAuraTracking[targetGuid] = {}
|
||||
@@ -1378,7 +1370,7 @@ autoAttackFrame:SetScript("OnEvent", function()
|
||||
if spellId and spellId > 0 and durationMs and durationMs > 0 then
|
||||
local playerGUID = CleveRoids.GetGUID("player")
|
||||
local durSpellName = C_Spell.GetSpellName(spellId)
|
||||
if playerGUID and durSpellName and not CleveRoids.hasPfUI76 then
|
||||
if playerGUID and durSpellName then
|
||||
CleveRoids._allCasterAuraDirty = true
|
||||
if not CleveRoids.AllCasterAuraTracking[playerGUID] then
|
||||
CleveRoids.AllCasterAuraTracking[playerGUID] = {}
|
||||
|
||||
@@ -4205,18 +4205,30 @@ function CleveRoids.OnUpdate(self)
|
||||
guid, cast = nextGuid, nextGuid and spell_tracking[nextGuid]
|
||||
end
|
||||
|
||||
-- Clean stale castTracking entries (standalone mode only, pfUI 7.6 manages its own)
|
||||
if not CR.hasPfUI76 then
|
||||
local ct = CR.castTracking
|
||||
local ctGuid, ctEntry = next(ct)
|
||||
while ctGuid do
|
||||
local nextCtGuid = next(ct, ctGuid)
|
||||
if ctEntry.endTime and time > ctEntry.endTime + 0.5 then
|
||||
-- Clean stale castTracking entries. Instant casts are stored with endTime = nil
|
||||
-- (SPELL_START sets it only when the cast has a duration), so an endTime-only
|
||||
-- check could never evict them and every instant cast by every unit in range
|
||||
-- accumulated forever. Fall back to startTime for those: the matching SPELL_GO
|
||||
-- lands within a frame or two, so anything still here after the grace period is
|
||||
-- an entry whose completion we never observed.
|
||||
local ct = CR.castTracking
|
||||
local ctGuid, ctEntry = next(ct)
|
||||
while ctGuid do
|
||||
local nextCtGuid = next(ct, ctGuid)
|
||||
if ctEntry then
|
||||
if ctEntry.endTime then
|
||||
if time > ctEntry.endTime + 0.5 then
|
||||
ct[ctGuid] = nil
|
||||
end
|
||||
elseif ctEntry.startTime and time > ctEntry.startTime + 1 then
|
||||
-- No endTime: an instant cast. Its SPELL_GO lands within a frame or
|
||||
-- two, so a second is generous, and anything older is an entry whose
|
||||
-- completion we never saw.
|
||||
ct[ctGuid] = nil
|
||||
end
|
||||
ctGuid = nextCtGuid
|
||||
ctEntry = nextCtGuid and ct[nextCtGuid]
|
||||
end
|
||||
ctGuid = nextCtGuid
|
||||
ctEntry = nextCtGuid and ct[nextCtGuid]
|
||||
end
|
||||
|
||||
-- PERFORMANCE OPTIMIZATION: Run memory cleanup less frequently (every 5 seconds instead of every frame)
|
||||
@@ -4607,7 +4619,7 @@ function CleveRoids.Frame:UNIT_CASTEVENT(caster,target,action,spell_id,cast_time
|
||||
end
|
||||
|
||||
-- Also sync to pfUI if it's loaded (pre-7.6 only)
|
||||
if not CleveRoids.hasPfUI76 and pfUI and pfUI.api and pfUI.api.libdebuff then
|
||||
if pfUI and pfUI.api and pfUI.api.libdebuff then
|
||||
local targetName = (lib.guidToName and lib.guidToName[normalizedTarget]) or UnitName("target")
|
||||
local targetLevel = UnitLevel("target") or 0
|
||||
|
||||
@@ -6462,12 +6474,7 @@ SlashCmdList["CLEVEROID"] = function(msg)
|
||||
CleveRoids.Print("|cffffaa00Tracked Auras:|r")
|
||||
local trackingCount = 0
|
||||
local now = GetTime()
|
||||
-- Determine which backing table to iterate
|
||||
local isPfUI = CleveRoids.hasPfUI76 and pfUI and pfUI.libdebuff_all_auras
|
||||
local backingTable = isPfUI and pfUI.libdebuff_all_auras or CleveRoids.AllCasterAuraTracking or {}
|
||||
if isPfUI then
|
||||
CleveRoids.Print(" (reading from pfUI.libdebuff_all_auras)")
|
||||
end
|
||||
local backingTable = CleveRoids.AllCasterAuraTracking or {}
|
||||
for targetGuid, spellNames in pairs(backingTable) do
|
||||
local unitName = nil
|
||||
-- Try to find unit name for this GUID (use pcall to handle invalid units like "focus")
|
||||
|
||||
@@ -57,13 +57,11 @@ CleveRoids.unknownTexture = "Interface\\Icons\\INV_Misc_QuestionMark"
|
||||
|
||||
CleveRoids.spell_tracking = {}
|
||||
|
||||
-- GUID-based cast tracking (populated by pfUI 7.6 or standalone SPELL_START events)
|
||||
-- Format: [casterGuid] = {spellID, spellName, icon, startTime, duration, endTime}
|
||||
-- GUID-based cast tracking, populated from our own SPELL_START handlers and pruned
|
||||
-- in OnUpdate. Format: [casterGuid] = {spellID, spellName, icon, startTime, duration,
|
||||
-- endTime}
|
||||
CleveRoids.castTracking = {}
|
||||
|
||||
-- pfUI 7.6+ with Nampower 2.31.0+ detected (GUID-based cast tracking available)
|
||||
CleveRoids.hasPfUI76 = false
|
||||
|
||||
-- Combo point tracking (initialized early for /cast hook)
|
||||
CleveRoids.lastComboPoints = 0
|
||||
CleveRoids.lastComboPointsTime = 0
|
||||
|
||||
+24
-83
@@ -783,7 +783,6 @@ lib.pendingBuffCasts = lib.pendingBuffCasts or {} -- [targetGUID][spellId] = {ca
|
||||
-- Flag indicating whether enhanced pfUI tracking is available
|
||||
lib.hasPfUIEnhanced = false
|
||||
lib.hasStandaloneNampower = false
|
||||
lib.hasPfUI76 = false
|
||||
|
||||
-- Check if pfUI v7.4.3+ with enhanced libdebuff is available
|
||||
function lib:HasEnhancedPfUILibdebuff()
|
||||
@@ -844,33 +843,6 @@ function lib:HasEnhancedPfUILibdebuff()
|
||||
return true
|
||||
end
|
||||
|
||||
-- Check if pfUI v7.6+ with enhanced cast tracking is available
|
||||
-- pfUI 7.6+ requires Nampower v2.37.0+ and exposes additional tables
|
||||
function lib:HasPfUI76()
|
||||
if not pfUI then return false end
|
||||
|
||||
local v = pfUI.version
|
||||
if not v or not v.major then return false end
|
||||
|
||||
-- Version comparison: 7.6+
|
||||
if v.major < 7 then return false end
|
||||
if v.major == 7 and (v.minor or 0) < 6 then return false end
|
||||
|
||||
-- Verify Nampower v2.40.0+ (pfUI 7.6+ hard requirement, bumped from 2.38 on 2026-02-21;
|
||||
-- v2.40.0 fixes packed GUID parsing that caused target GUIDs to appear as 0x000000000
|
||||
-- for some players, which directly affects cast tracking reliability)
|
||||
if not GetNampowerVersion then return false end
|
||||
local npMajor, npMinor, npPatch = GetNampowerVersion()
|
||||
npPatch = npPatch or 0
|
||||
if npMajor < 2 then return false end
|
||||
if npMajor == 2 and npMinor < 40 then return false end
|
||||
|
||||
-- Verify the new tables exist
|
||||
if not pfUI.libdebuff_casts then return false end
|
||||
if not pfUI.libdebuff_objects_guid then return false end
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
-- Icon caching helper: DBC lookup via GetSpellRecField
|
||||
function lib:GetCachedIcon(spellId)
|
||||
@@ -904,19 +876,6 @@ function lib:InitPfUIIntegration()
|
||||
lib.hasPfUIEnhanced = true
|
||||
lib.hasStandaloneNampower = false
|
||||
|
||||
-- Check for pfUI 7.6+ additional tables (cast tracking, GUID objects, icon cache)
|
||||
if lib:HasPfUI76() then
|
||||
CleveRoids.hasPfUI76 = true
|
||||
lib.hasPfUI76 = true
|
||||
CleveRoids.castTracking = pfUI.libdebuff_casts
|
||||
lib.iconCache = pfUI.libdebuff_icon_cache or lib.iconCache
|
||||
-- lib.objects is already set by pfUI's CleveRoids.libdebuff = libdebuff override
|
||||
-- but explicitly sync if pfUI.libdebuff_objects_guid is available
|
||||
if pfUI.libdebuff_objects_guid then
|
||||
lib.objects = pfUI.libdebuff_objects_guid
|
||||
end
|
||||
end
|
||||
|
||||
-- Unregister chat log events since SPELL_GO provides miss detection
|
||||
if CleveRoidsLibDebuffLearnFrame then
|
||||
CleveRoidsLibDebuffLearnFrame:UnregisterEvent("CHAT_MSG_SPELL_SELF_DAMAGE")
|
||||
@@ -933,10 +892,9 @@ function lib:InitPfUIIntegration()
|
||||
|
||||
if CleveRoids.debug then
|
||||
local v = pfUI.version
|
||||
local tierMsg = lib.hasPfUI76 and " (7.6+ cast tracking)" or ""
|
||||
DEFAULT_CHAT_FRAME:AddMessage(
|
||||
string.format("|cff33ff99[libdebuff]|r pfUI v%d.%d.%d enhanced tracking enabled%s",
|
||||
v.major, v.minor, v.fix or 0, tierMsg)
|
||||
string.format("|cff33ff99[libdebuff]|r pfUI v%d.%d.%d enhanced tracking enabled",
|
||||
v.major, v.minor, v.fix or 0)
|
||||
)
|
||||
end
|
||||
|
||||
@@ -2141,7 +2099,7 @@ function lib:ShouldApplyDebuffRank(targetGUID, newSpellID)
|
||||
end
|
||||
|
||||
-- Also clean up pfUI's tracking to prevent it from showing old ranks
|
||||
if not CleveRoids.hasPfUI76 and pfUI and pfUI.api and pfUI.api.libdebuff and targetName then
|
||||
if pfUI and pfUI.api and pfUI.api.libdebuff and targetName then
|
||||
local pflib = pfUI.api.libdebuff
|
||||
|
||||
if pflib.objects and pflib.objects[targetName] then
|
||||
@@ -2293,7 +2251,7 @@ function lib:AddEffect(guid, unitName, spellID, duration, stacks, caster)
|
||||
|
||||
-- PFUI INTEGRATION: Inject all tracked debuffs into pfUI's libdebuff (pre-7.6 only)
|
||||
-- pfUI 7.6+ handles all duration tracking internally via GetUnitField
|
||||
if pfUI and pfUI.api and pfUI.api.libdebuff and unitName and not CleveRoids.hasPfUI76 then
|
||||
if pfUI and pfUI.api and pfUI.api.libdebuff and unitName then
|
||||
local pflib = pfUI.api.libdebuff
|
||||
local spellName = C_Spell.GetSpellName(spellID)
|
||||
|
||||
@@ -2529,7 +2487,7 @@ local function SeedUnit(unit)
|
||||
existing.duration = duration
|
||||
|
||||
-- PFUI INTEGRATION: Inject refreshed timer into pfUI (pre-7.6 only)
|
||||
if pfUI and pfUI.api and pfUI.api.libdebuff and unitName and not CleveRoids.hasPfUI76 then
|
||||
if pfUI and pfUI.api and pfUI.api.libdebuff and unitName then
|
||||
local pflib = pfUI.api.libdebuff
|
||||
local spellName = C_Spell.GetSpellName(spellID)
|
||||
if spellName and pflib.AddEffect then
|
||||
@@ -2618,7 +2576,7 @@ local function SeedUnit(unit)
|
||||
existing.duration = duration
|
||||
|
||||
-- PFUI INTEGRATION: Inject refreshed timer into pfUI (pre-7.6 only)
|
||||
if pfUI and pfUI.api and pfUI.api.libdebuff and unitName and not CleveRoids.hasPfUI76 then
|
||||
if pfUI and pfUI.api and pfUI.api.libdebuff and unitName then
|
||||
local pflib = pfUI.api.libdebuff
|
||||
local spellName = C_Spell.GetSpellName(spellID)
|
||||
if spellName and pflib.AddEffect then
|
||||
@@ -2890,7 +2848,7 @@ function lib.ApplyCarnageRefresh(targetGUID, targetName, biteSpellID)
|
||||
|
||||
-- DON'T call pfUI's AddEffect - just update the existing entry directly
|
||||
-- pfUI will pick up the new duration through our GetDuration/UnitDebuff hooks
|
||||
if not CleveRoids.hasPfUI76 and pfUI and pfUI.api and pfUI.api.libdebuff then
|
||||
if pfUI and pfUI.api and pfUI.api.libdebuff then
|
||||
local pflib = pfUI.api.libdebuff
|
||||
local ripSpellName = C_Spell.GetSpellName(ripSpellID)
|
||||
local baseName = CleveRoids.StripRank(ripSpellName) or "Rip"
|
||||
@@ -3003,7 +2961,7 @@ function lib.ApplyCarnageRefresh(targetGUID, targetName, biteSpellID)
|
||||
|
||||
-- DON'T call pfUI's AddEffect - just update the existing entry directly
|
||||
-- pfUI will pick up the new duration through our GetDuration/UnitDebuff hooks
|
||||
if not CleveRoids.hasPfUI76 and pfUI and pfUI.api and pfUI.api.libdebuff then
|
||||
if pfUI and pfUI.api and pfUI.api.libdebuff then
|
||||
local pflib = pfUI.api.libdebuff
|
||||
local rakeSpellName = C_Spell.GetSpellName(rakeSpellID)
|
||||
local baseName = CleveRoids.StripRank(rakeSpellName) or "Rake"
|
||||
@@ -4586,7 +4544,7 @@ ev:SetScript("OnEvent", function()
|
||||
|
||||
-- Update pfUI's duration database directly (pre-7.6 only)
|
||||
-- pfUI 7.6+ handles combo durations internally via GetStoredComboPoints()
|
||||
if not CleveRoids.hasPfUI76 and pfUI and pfUI.api and pfUI.api.libdebuff and pfUI.api.libdebuff.debuffs then
|
||||
if pfUI and pfUI.api and pfUI.api.libdebuff and pfUI.api.libdebuff.debuffs then
|
||||
pfUI.api.libdebuff.debuffs[baseName] = duration
|
||||
if CleveRoids.debug then
|
||||
DEFAULT_CHAT_FRAME:AddMessage(
|
||||
@@ -4842,12 +4800,6 @@ ev:SetScript("OnEvent", function()
|
||||
end
|
||||
end
|
||||
|
||||
-- Sync combo duration to pfUI if it's loaded
|
||||
if comboPoints and CleveRoids.Compatibility_pfUI and
|
||||
CleveRoids.Compatibility_pfUI.SyncComboDurationToPfUI then
|
||||
CleveRoids.Compatibility_pfUI.SyncComboDurationToPfUI(targetGUID, spellID, duration)
|
||||
end
|
||||
|
||||
-- ALWAYS set up learning for combo spells (even if we have calculated duration)
|
||||
if comboPoints then
|
||||
lib.learnCastTimers[targetGUID] = lib.learnCastTimers[targetGUID] or {}
|
||||
@@ -5008,7 +4960,6 @@ ev:SetScript("OnEvent", function()
|
||||
end
|
||||
|
||||
-- pfUI 7.6 manages castTracking via its own SPELL_START handler
|
||||
if lib.hasPfUI76 then return end
|
||||
|
||||
local spellId = arg2
|
||||
local casterGuid = arg3
|
||||
@@ -5055,7 +5006,6 @@ ev:SetScript("OnEvent", function()
|
||||
|
||||
elseif event == "SPELL_FAILED_OTHER" then
|
||||
-- pfUI 7.6 manages castTracking cleanup itself
|
||||
if lib.hasPfUI76 then return end
|
||||
|
||||
local casterGuid = arg1
|
||||
if casterGuid and CleveRoids.castTracking[casterGuid] then
|
||||
@@ -5074,18 +5024,23 @@ ev:SetScript("OnEvent", function()
|
||||
-- When pfUI is available, we use its tables directly instead.
|
||||
|
||||
elseif event == "SPELL_GO_SELF" or event == "SPELL_GO_OTHER" then
|
||||
-- Skip if pfUI enhanced tracking is active (it handles this)
|
||||
if lib.hasPfUIEnhanced then return end
|
||||
|
||||
-- Clear cast tracking entry - cast completed/fired (standalone mode only).
|
||||
-- Clear the cast tracking entry FIRST, before the hasPfUIEnhanced bail below.
|
||||
-- We always own castTracking (SPELL_START populates it unconditionally), whereas
|
||||
-- hasPfUIEnhanced only gates the miss/debuff work further down. Clearing used to
|
||||
-- sit after that bail, so with pfUI's enhanced libdebuff tables present
|
||||
-- SPELL_START kept adding entries while this cleanup never ran and castTracking
|
||||
-- grew without bound.
|
||||
-- v2.40+: Save the SPELL_START targetGuid before clearing so we can fall back
|
||||
-- to it below when SPELL_GO arg4 is empty (e.g. AoE spells with no single target).
|
||||
local startTargetGuid
|
||||
if not lib.hasPfUI76 and arg3 and CleveRoids.castTracking[arg3] then
|
||||
if arg3 and CleveRoids.castTracking[arg3] then
|
||||
startTargetGuid = CleveRoids.castTracking[arg3].targetGuid
|
||||
CleveRoids.castTracking[arg3] = nil
|
||||
end
|
||||
|
||||
-- Skip the remaining miss/debuff work if pfUI enhanced tracking is active
|
||||
if lib.hasPfUIEnhanced then return end
|
||||
|
||||
local spellId = arg2
|
||||
local casterGuid = arg3
|
||||
-- v2.40+: SPELL_GO targetGuid is now correct for friendly player GUIDs.
|
||||
@@ -5524,17 +5479,11 @@ ev:SetScript("OnEvent", function()
|
||||
confirmed = true
|
||||
}
|
||||
-- Update pfUI's duration database directly (pre-7.6 only)
|
||||
if not CleveRoids.hasPfUI76 and pfUI and pfUI.api and pfUI.api.libdebuff and pfUI.api.libdebuff.debuffs then
|
||||
if pfUI and pfUI.api and pfUI.api.libdebuff and pfUI.api.libdebuff.debuffs then
|
||||
pfUI.api.libdebuff.debuffs[baseName] = debuffDuration
|
||||
end
|
||||
end
|
||||
|
||||
-- Sync combo duration to pfUI
|
||||
if debuffComboPoints and CleveRoids.Compatibility_pfUI and
|
||||
CleveRoids.Compatibility_pfUI.SyncComboDurationToPfUI then
|
||||
CleveRoids.Compatibility_pfUI.SyncComboDurationToPfUI(targetGuid, spellId, debuffDuration)
|
||||
end
|
||||
|
||||
-- Set up learning for combo spells
|
||||
if debuffComboPoints then
|
||||
lib.learnCastTimers[targetGuid] = lib.learnCastTimers[targetGuid] or {}
|
||||
@@ -5994,7 +5943,7 @@ ev:SetScript("OnEvent", function()
|
||||
end
|
||||
|
||||
-- Clean up cast tracking for this unit (they can't be casting if dead)
|
||||
if not lib.hasPfUI76 and CleveRoids.castTracking[guid] then
|
||||
if CleveRoids.castTracking[guid] then
|
||||
CleveRoids.castTracking[guid] = nil
|
||||
end
|
||||
|
||||
@@ -6359,7 +6308,7 @@ evLearn:SetScript("OnEvent", function()
|
||||
|
||||
-- Sync refresh to pfUI
|
||||
local targetName = lib.guidToName[targetGUID]
|
||||
if not CleveRoids.hasPfUI76 and pfUI and pfUI.api and pfUI.api.libdebuff and targetName then
|
||||
if pfUI and pfUI.api and pfUI.api.libdebuff and targetName then
|
||||
local pflib = pfUI.api.libdebuff
|
||||
local spellName = C_Spell.GetSpellName(flameShockID)
|
||||
if spellName and pflib.AddEffect then
|
||||
@@ -6411,15 +6360,7 @@ evCleanup:SetScript("OnEvent", function()
|
||||
if event == "PLAYER_ENTERING_WORLD" or event == "PLAYER_DEAD" then
|
||||
-- Keep only current target's data
|
||||
local currentGUID = CleveRoids.GetGUID("target")
|
||||
if lib.hasPfUI76 then
|
||||
-- pfUI76: lib.objects is pfUI.libdebuff_objects_guid - never replace the reference!
|
||||
-- pfUI handles its own cleanup; just clear SCRM-side entries
|
||||
for guid in pairs(lib.objects) do
|
||||
if guid ~= currentGUID then
|
||||
lib.objects[guid] = nil
|
||||
end
|
||||
end
|
||||
elseif currentGUID then
|
||||
if currentGUID then
|
||||
local temp = lib.objects[currentGUID]
|
||||
lib.objects = {}
|
||||
if temp then
|
||||
@@ -6536,7 +6477,7 @@ evJudgement:SetScript("OnEvent", function()
|
||||
end
|
||||
|
||||
-- Also sync to pfUI if it's loaded (pre-7.6 only)
|
||||
if not CleveRoids.hasPfUI76 and pfUI and pfUI.api and pfUI.api.libdebuff then
|
||||
if pfUI and pfUI.api and pfUI.api.libdebuff then
|
||||
local targetName = lib.guidToName[targetGUID] or UnitName("target")
|
||||
local targetLevel = UnitLevel("target") or 0
|
||||
local spellName = C_Spell.GetSpellName(spellID)
|
||||
|
||||
Reference in New Issue
Block a user