Created
September 25, 2016 08:59
-
-
Save obble/692bf18ebeafd7bbc7d61652506f92a9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local playerUnits = { | |
player = true, | |
pet = true, | |
vehicle = true | |
} | |
local dispelTypes = { | |
Magic = true, | |
Curse = true, | |
Disease = true, | |
Poison = true | |
} | |
ns.CustomAuraFilter = function(element, unit, icon, name, rank, texture, count, dType, duration, timeLeft, caster, isStealable, shouldConsolidate, spellID, canApplyAura, isBossCast,_, nameplateShowAll) | |
local filter = icon.filter | |
local hostile = UnitCanAttack('player', unit) or not UnitCanAssist('player', unit) | |
if isBossCast then -- all boss auras go through | |
return true | |
-- as do all vehicle-cast auras | |
elseif caster and UnitIsUnit(caster, 'vehicle') and not UnitIsPlayer'vehicle' then | |
return true | |
end | |
if hostile then -- enemy | |
if filter == 'HELPFUL' then -- buff | |
if isStealable or (caster and UnitIsUnit(unit, caster)) or nameplateShowAll then | |
return true | |
end | |
elseif filter == 'HARMFUL' then -- debuff | |
local custom, _, showforSpec = SpellGetVisibilityInfo(spellID, 'ENEMY_TARGET') | |
if playerUnits[icon.owner] or SpellIsAlwaysShown(spellID) or (custom and showforSpec) or nameplateShowAll then | |
return true | |
end | |
end | |
else -- friend | |
local custom, _, showforSpec = SpellGetVisibilityInfo(spellID, UnitAffectingCombat'player' and 'RAID_INCOMBAT' or 'RAID_OUTOFCOMBAT') | |
if filter == 'HELPFUL' then -- buff | |
if UnitAura(unit, name, nil, filter..'|RAID') or (custom and showforSpec) or UnitIsUnit(caster, 'player') then | |
return true | |
end | |
elseif filter == 'HARMFUL' then -- debuff | |
if (dispelTypes[dType] and UnitAura(unit, name, nil, filter..'|RAID')) or (custom and showforSpec) or UnitIsUnit(caster, 'player') then | |
return true | |
end | |
end | |
end | |
return false | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment