From 37434911e4f822091e064a4feb90b560dbe9c71f Mon Sep 17 00:00:00 2001 From: Brues <5278969+brues-code@users.noreply.github.com> Date: Tue, 28 Jul 2026 09:20:23 -0500 Subject: [PATCH] Resolve tracked aura texture/stacks via C_UnitAuras, not slot scans FindPlayerDebuff and FindPlayerBuff hand-scanned debuff/buff slots for a spellID to pull icon + stacks. Both now use ClassicAPI.GetUnitAuraBySpellID (AuraData.icon / .applications) -- FindPlayerDebuff unfiltered (walks both ranges, was debuff-then-buff), FindPlayerBuff HELPFUL-filtered (buff-only). Search order is immaterial since a spellID is only ever a buff or a debuff. --- Utility.lua | 45 +++++++++++---------------------------------- 1 file changed, 11 insertions(+), 34 deletions(-) diff --git a/Utility.lua b/Utility.lua index fadcb36..57e5ae3 100644 --- a/Utility.lua +++ b/Utility.lua @@ -2441,31 +2441,13 @@ function lib:FindPlayerDebuff(unit, spellID) return nil end - -- Find the texture by searching debuff and buff slots + -- Find the texture/stacks via one by-ID lookup (walks both debuff and buff + -- ranges), replacing the 16 debuff + 32 buff slot scan. local texture, stacks = nil, rec.stacks - - -- Search debuff slots first - for i = 1, 16 do - local tex, st, dtype, sid = UnitDebuff(unit, i) - if not tex then break end - if sid == spellID then - texture = tex - stacks = st or stacks - break - end - end - - -- If not found in debuffs, search buff slots - if not texture then - for i = 1, 32 do - local tex, st, sid = UnitBuff(unit, i) - if not tex then break end - if sid == spellID then - texture = tex - stacks = st or stacks - break - end - end + local aura = CleveRoids.ClassicAPI.GetUnitAuraBySpellID(unit, spellID) + if aura then + texture = aura.icon + stacks = aura.applications or stacks end if not texture then return nil end @@ -2493,17 +2475,12 @@ function lib:FindPlayerBuff(unit, spellID) return nil end - -- Find the texture by searching buff slots only + -- Find the texture/stacks via one by-ID lookup restricted to buffs. local texture, stacks = nil, rec.stacks - - for i = 1, 32 do - local tex, st, sid = UnitBuff(unit, i) - if not tex then break end - if sid == spellID then - texture = tex - stacks = st or stacks - break - end + local aura = CleveRoids.ClassicAPI.GetUnitAuraBySpellID(unit, spellID, "HELPFUL") + if aura then + texture = aura.icon + stacks = aura.applications or stacks end if not texture then return nil end