View Single Post
12-08-14, 03:10 AM   #1
eiszeit
A Chromatic Dragonspawn
 
eiszeit's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2007
Posts: 154
Aura filtering problems

Good Morning,

I am trying to create an aura filter for my oUF layout and I am a bit struggling because it doesn't really work like I want it - and I have no idea why.

Especially the target is the one who bothers me.

Here's my filter code, which I am adding to my layout per

Lua Code:
  1. self.Buffs.CustomFilter = lib.AurasCustomFilter.target
  2. self.Debuffs.CustomFilter = lib.AurasCustomFilter.target

I've commented inside the code, what I am trying to do ... but yeah, it doesn't work out exactly.

Lua Code:
  1. local whitelist = cfg.debuffList
  2.  
  3. local isPlayer = {
  4.     player  = true,
  5.     pet     = true,
  6.     vehicle = true,
  7. }
  8.  
  9. local dispelList = {
  10.     DRUID   =   {Curse = true, Poison = true},
  11.     MAGE    =   {Curse = true},
  12.     PALADIN =   {Disease = true, Magic = true, Poison = true},
  13.     PRIEST  =   {Disease = true, Magic = true},
  14.     SHAMAN  =   {Curse = true, Disease = true, Poison = true}
  15. }
  16.  
  17. local _, playerClass = UnitClass('player')
  18. local dispel = dispelList[playerClass]
  19.  
  20.     -- FILTER
  21. lib.AurasCustomFilter = {
  22.     target = function(icons, unit, icon, name, _, _, _, dtype, _, _, caster, isStealable, shouldConsolidate, spellID, _, isBossAura, isCastByPlayer)
  23.         local _, instanceType = IsInInstance()
  24.         -- show when on whitelist
  25.         if whitelist[spellID] then
  26.             return true
  27.         -- show when is cast by boss
  28.         elseif isBossAura then
  29.             return true
  30.         -- show when in instance/party and npc (i.e. not boss, because isBossAura doesn't affect normal npc enemies)
  31.         elseif (instanceType == 'party' or instanceType == 'raid') and not UnitPlayerControlled(caster) then
  32.             return true
  33.         -- show when debuff and by me
  34.         elseif icon.isDebuff and isPlayer[caster] then
  35.             return true
  36.         -- show stealable buffs
  37.         elseif isStealable and not icon.isDebuff then
  38.             return true
  39.         -- show when by me and is not debuff
  40.         elseif isPlayer[caster] and not icon.isDebuff then
  41.             return true
  42.         -- hide rest
  43.         else
  44.             return false
  45.         end
  46.     end,
  47.     party = function(icons, unit, icon, name, _, _, _, dtype, _, _, caster, isStealable, shouldConsolidate, spellID, _, isBossAura, isCastByPlayer)
  48.         if isBossAura then
  49.             return true
  50.         elseif (dispel and dispel[dtype]) then
  51.             return true
  52.         else
  53.             return false
  54.         end
  55.     end,
  56.     focus = function(icons, unit, icon, name, _, _, _, dtype, _, _, caster, isStealable, shouldConsolidate, spellID, _, isBossAura, isCastByPlayer)
  57.         if isBossAura then
  58.             return true
  59.         elseif isPlayer[caster] then
  60.             return true
  61.         else
  62.             return false
  63.         end
  64.     end,
  65. }

Hopefully someone can help me with that.

And sorry, if this is the wrong forum, I thought it would fit because it affects my oUF layout.
__________________
Lyn • I'm a mess of unfinished thoughts

Last edited by eiszeit : 12-08-14 at 04:09 AM. Reason: found the highlight bbcode =D
  Reply With Quote