Detect Banish via C_UnitAuras.GetUnitAuraBySpellID, not slot scan

The Banish immunity check hand-scanned 16 debuff slots plus 32 buff slots
(NPC overflow) for spellID 710/18647. ClassicAPI.GetUnitAuraBySpellID walks
the whole aura array in one call per rank, so it finds the debuff wherever it
lands -- including an NPC's overflow buff slots -- dropping the two loops and
the UnitIsPlayer gate. Wrapper added alongside UnitHasDispelType.
This commit is contained in:
Brues
2026-07-28 09:12:29 -05:00
parent dd61767eb9
commit d82eeabf22
2 changed files with 19 additions and 25 deletions
+13
View File
@@ -82,6 +82,19 @@ function API.UnitHasDispelType(unit, dispelType, helpful)
return scanDispel(indexFn, unit, dispelType, wantAny)
end
-- First matching aura on `unit` by spellID, or nil. With no filter it walks the
-- whole aura array (helpful then harmful), so it finds a debuff even when it has
-- overflowed into an NPC's buff slots -- no 16+32 slot scan, no UnitIsPlayer
-- gate. filter ("HELPFUL"/"HARMFUL") restricts the search. Returns the modern
-- AuraData (spellId, name, applications, duration, expirationTime, dispelName, ...).
function API.GetUnitAuraBySpellID(unit, spellID, filter)
if not unit or not spellID then return nil end
if type(C_UnitAuras) ~= "table" or type(C_UnitAuras.GetUnitAuraBySpellID) ~= "function" then
return nil
end
return C_UnitAuras.GetUnitAuraBySpellID(unit, spellID, filter)
end
--------------------------------------------------------------------------------
-- GetUnitSpeed
--------------------------------------------------------------------------------