mirror of
https://github.com/brues-code/SuperCleveRoidMacros.git
synced 2026-09-16 03:38:00 +00:00
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:
@@ -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
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user