Thread Tools Display Modes
03-02-10, 09:36 AM   #1
coree
A Fallenroot Satyr
AddOn Author - Click to view addons
Join Date: Apr 2008
Posts: 28
Debuff filtering

Hello,

1. i'd like to filter debuffs on raidmembers by name/spellid.
2. only one debuff should be shown.
but now there is a problem when the first debuff of a raidmember is hidden, no other debuff will be shown (i.e.: Chill of Throne debuff in icecrown is hidden and no debuff from my whitelist will be shown)

therefore i thought i re-sort the debuffs based on being on my whitelist or not (debuffs on list before debuffs not on list)

Code:
local filter = {
  ["Aufgespießt"] = true, -- Impaled (Lord Marrowgar)
  ["Fluch der Starre"] = true, -- Curse of Torpor (Lady Deathwhisper)
  ["Mal des gefallenen Champions"] = true, -- Mark of the Fallen Champion (Deathbringer Saurfang)
  ["Rune des Blutes"] = true, -- Rune of Blood (Deathbringer Saurfang)
  ["Gasspore"] = true, -- Gas Spore (Festergut)
  ["Mutierte Infektion"] = true, -- Mutated Infection (Rotface)
  ["Pakt der Sinistren"] = true, -- Pact of the Darkfallen (Blood-Queen Lana'thel)
  ["Schw\195\164rmende Schatten"] = true, -- Swarming Shadows (Blood-Queen Lana'thel)
  ["Frostleuchtfeuer"] = true, -- Frost Beacon (Sindragosa)
  ["Nekrotische Seuche"] = true, -- Necrotic Plague (Arthas)
  ["Seele ernten"] = true, -- Harvest Soul (Arthas)
  ["K\195\164lte des Thrones"] = true, -- testing
  --["K\195\188rzlich bandagiert"] = true, -- testing
  ["Seltsame Aura"] = true, -- Strange Aura (Zone-Debuff, just for testing)
}

local CustomAuraFilter = function(icons, unit, icon, name, rank, texture, count, dtype)
  if icon.debuff then
    if  filter[name] then 
	  return true 
	end
  end
end
but i dont know how to sort debuffs by name

Code:
local AuraSort = function(a,b)
  
  if a.name == filter[name] then
  ??
  end

end  
  
local function preAuraSetPosition(self,debuffs,max)
	table.sort(debuffs,AuraSort)
end

example:

before filtering
1. Debuff A (not in list but shown)
2. Debuff B (in list and shown)

after filtering (more then 1 debuff shown)
1. Debuff A (not in list not shown)
2. Debuff B (in list and shown)

after filtering (only 1 debuff shown)
1. Debuff A (not in list not shown)
2. Debuff B (in list and not shown (because this debuff is not the 1.))

after re-sorting and filtering (only 1 debuff shown)
1. Debuff B (in list and shown)
2. Debuff A (not in list not shown)

maybe there is a much better solution for that problem. so please help
tia

Last edited by coree : 03-02-10 at 09:44 AM.
  Reply With Quote
03-02-10, 11:11 AM   #2
Dawn
A Molten Giant
 
Dawn's Avatar
AddOn Author - Click to view addons
Join Date: May 2006
Posts: 918
I just blacklist debuffs that I don't want to show (see oUF_viv). Shouldn't that do the trick for your needs, too? It's pretty much enough for PvE at least.

I'm currently writing another layout for PvP (arena to be specific). Which will filter out everything but some whitelist'ed buffs and debuffs. It's the same code though.
__________________
Rock: "We're sub-standard DPS. Nerf Paper, Scissors are fine."
Paper: "OMG, WTF, Scissors!"
Scissors: "Rock is OP and Paper are QQers. We need PvP buffs."

"neeh the game wont be remembered as the game who made blizz the most money, it will be remembered as the game who had the most QQ'ers that just couldnt quit the game for some reason..."

  Reply With Quote
03-02-10, 11:57 AM   #3
v6o
An Onyxian Warder
AddOn Author - Click to view addons
Join Date: Mar 2009
Posts: 399
1.

Your
local CustomAuraFilter = function(icons, unit, icon, name, rank, texture, count, dtype)
should now be; if you need it to.
local CustomAuraFilter = function(icons, unit, icon, name, rank, texture, count, dtype, duration, timeLeft, caster, isStealable, shouldConsolidate, spellID)
This makes filtering by ID a lot easier.

Notice that SpellID at the end?

2.

Yeah, not sure if you can get around that with the CustomAuraFilter. If you display 10 but have 20 on you and then filter 10 first, the rest (10) won't be displayed. (Hope Haste hasn't changed how it works so I'm speaking out of my nightcap)

You can however, if you only want to display dispellable debuffs then use "HARMFUL,RAID" as filter.

Or use oUF_RaidDebuffs.
__________________
I stopped playing back World of Warcraft in 2010 and I have no plans on returning.
This is a dead account and if you want to continue any of my addons or make a fork then feel free to do so.
This is your permission slip.

If you need to contact me, do so on Twitter @v6ooo

Best regards, v6.
  Reply With Quote
03-02-10, 02:08 PM   #4
coree
A Fallenroot Satyr
AddOn Author - Click to view addons
Join Date: Apr 2008
Posts: 28
Originally Posted by v6o View Post
1.

Your
should now be; if you need it to.
This makes filtering by ID a lot easier.

Notice that SpellID at the end?

2.

Yeah, not sure if you can get around that with the CustomAuraFilter. If you display 10 but have 20 on you and then filter 10 first, the rest (10) won't be displayed. (Hope Haste hasn't changed how it works so I'm speaking out of my nightcap)

You can however, if you only want to display dispellable debuffs then use "HARMFUL,RAID" as filter.

Or use oUF_RaidDebuffs.
ok, maybe you missunderstood. i know how to filter debuffs by name/spellid. the 2 points are just my needs on the filter and no requests.

therefore i'd like to know how to sort debuffs by name before filtering.

and if this isn't realizable i will use a plugin for that.


@Dawn: Try "self.Debuffs.num = 1" in icecrownraid. imo you wont see any debuff all the time on a raidmember.

Last edited by coree : 03-02-10 at 02:15 PM.
  Reply With Quote
03-03-10, 02:42 PM   #5
v6o
An Onyxian Warder
AddOn Author - Click to view addons
Join Date: Mar 2009
Posts: 399
Did you take a look at Sorting of auras and Auras sorting ?
__________________
I stopped playing back World of Warcraft in 2010 and I have no plans on returning.
This is a dead account and if you want to continue any of my addons or make a fork then feel free to do so.
This is your permission slip.

If you need to contact me, do so on Twitter @v6ooo

Best regards, v6.

Last edited by v6o : 03-03-10 at 03:07 PM.
  Reply With Quote
03-03-10, 06:14 PM   #6
coree
A Fallenroot Satyr
AddOn Author - Click to view addons
Join Date: Apr 2008
Posts: 28
Originally Posted by v6o View Post
Did you take a look at Sorting of auras and Auras sorting ?
my next try was:
Code:
local sort = function(a, b)
    if (a.name == filter[name] and not (b.name == filter[name])) then
	  return true
	elseif (not (a.name == filter[name]) and b.name == filter[name]) then
	  return false
	end
end

local PreAuraSetPosition = function(self, debuffs, max)
	for i=1, max do
		if debuffs[i] then
			local debuff = debuffs[i]:GetParent()
			local frame = debuff:GetParent()
			local unit = frame.unit
			debuffs[i].name, _, _, _, _, _, _, _, _, _,debuffs[i].Id = UnitAura(unit, i, "HARMFUL")
		end
	end 
    
	table.sort(debuffs, sort) 
end
but that didnt work either. the sort function is my problem and i currently have no idea how to solve my problem.
  Reply With Quote
03-03-10, 06:40 PM   #7
v6o
An Onyxian Warder
AddOn Author - Click to view addons
Join Date: Mar 2009
Posts: 399
Where's the name var being set for filter[name] ?
Shouldn't it be
if filter[a.name] and not filter[b.name] then
Not sure but don't you need to return a value at all times for it not to error out?
__________________
I stopped playing back World of Warcraft in 2010 and I have no plans on returning.
This is a dead account and if you want to continue any of my addons or make a fork then feel free to do so.
This is your permission slip.

If you need to contact me, do so on Twitter @v6ooo

Best regards, v6.

Last edited by v6o : 03-03-10 at 07:12 PM.
  Reply With Quote
03-04-10, 07:31 PM   #8
coree
A Fallenroot Satyr
AddOn Author - Click to view addons
Join Date: Apr 2008
Posts: 28
Originally Posted by v6o View Post
Where's the name var being set for filter[name] ?
Shouldn't it be

Not sure but don't you need to return a value at all times for it not to error out?
jeah, you are right. filter[a.name] is correct, but the sort function however didnt work.

Code:
local function sort(a,b)
  if (a and not filter[a.name]) and (b and filter[b.name]) then
    return false
  end
end
this case is the only one, the order has to change (first debuff is not in list and the other debuff is in list). and i dont need a return value for all times, but correct me if i'm wrong.
  Reply With Quote
03-05-10, 01:26 AM   #9
v6o
An Onyxian Warder
AddOn Author - Click to view addons
Join Date: Mar 2009
Posts: 399
Noticed another thing, shouldn't it be PreAuraSetPosition(debuffs, max)

Sorting with only returning true errors out because it means everything should be before everything else. Only returning false gives you some weird sort orders.
If you're gonna sort, you have to sort.

Basically the sorting function is; Should A (true) be before B (false) and it keeps going until it's looped over the whole table to get the new order.

Edit: Can't you use " return a:GetID() < b:GetID() " at the end for the default UnitAura() order?

if prio[a.name] and not prio[b.name] then return true -- A has priority over B
elseif prio[b.name] and not prio[a.name] then return false -- B has priority over A
else return a:GetID() < b:GetID() -- Default UnitDebuff index order
__________________
I stopped playing back World of Warcraft in 2010 and I have no plans on returning.
This is a dead account and if you want to continue any of my addons or make a fork then feel free to do so.
This is your permission slip.

If you need to contact me, do so on Twitter @v6ooo

Best regards, v6.

Last edited by v6o : 03-05-10 at 02:19 AM.
  Reply With Quote

WoWInterface » Featured Projects » oUF (Otravi Unit Frames) » Debuff filtering


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off