WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   oUF (Otravi Unit Frames) (https://www.wowinterface.com/forums/forumdisplay.php?f=87)
-   -   Debuff filtering (https://www.wowinterface.com/forums/showthread.php?t=31018)

coree 03-02-10 09:36 AM

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

Dawn 03-02-10 11:11 AM

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.

v6o 03-02-10 11:57 AM

1.

Your
Quote:

local CustomAuraFilter = function(icons, unit, icon, name, rank, texture, count, dtype)
should now be; if you need it to.
Quote:

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.

coree 03-02-10 02:08 PM

Quote:

Originally Posted by v6o (Post 180347)
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.

v6o 03-03-10 02:42 PM

Did you take a look at Sorting of auras and Auras sorting ?

coree 03-03-10 06:14 PM

Quote:

Originally Posted by v6o (Post 180483)
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.

v6o 03-03-10 06:40 PM

Where's the name var being set for filter[name] ?
Shouldn't it be
Quote:

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?

coree 03-04-10 07:31 PM

Quote:

Originally Posted by v6o (Post 180515)
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.

v6o 03-05-10 01:26 AM

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?

Quote:

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


All times are GMT -6. The time now is 08:00 AM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI