WoWInterface (
-   oUF (Otravi Unit Frames) (
-   -   filter auras by duration (

Coldkil 04-11-13 04:15 AM

filter auras by duration
may be a newbie quatsion, but i need to filter auras (like player buffs) by duration, so anything that lasts longer than 1 minute for example isn't displayed.

I tried to do that in my PostUpdateAura, but while i managed to hide the unnecessary frames, this doesn't make them reposition.

I'm assuming i've to do somethign on the OnUpdate functions, but i'd like to have some more directions.

Thanks :)

Rainrider 04-11-13 04:54 PM

You could use auras.CustomFilter to do this.


auras.CustomFilter = function(_, _, aura, _, _, _, _, _, duration)
        if (aura.isDebuff) then
                return true
                if (duration <= 60 and duration > 0) then
                        return true

This won't work if you mean timeLeft btw.

Phanx 04-11-13 09:03 PM

Well, since the argument passed right after the duration is the time the aura expires, getting the time remaining is trivial:


element.CustomFilter = function(self, unit, iconFrame, name, rank, icon, count, debuffType, duration, expirationTime, caster, isStealable, shouldConsolidate, spellID, canApplyAura, isBossDebuff, isCastByPlayer, value1, value2, value3)
        local timeLeft = expirationTime - GetTime()
        return timeLeft < 60

Rainrider 04-12-13 11:14 AM

Yes, but CustomFilter is proccessed at UNIT_AURA for that button, at whitch time diration and timeLeft are equal. It won't update the visibility of the button after that, when timeLeft changed. I write this off the top of my head, sorry if it is incorrect.

Phanx 04-13-13 01:42 AM

Not necessarily. If your party roster changes, every aura on your party frames will get updated. If you target someone, every aura on your target frame gets updated. Relying on the duration when you really want the time remaining will work in some situations (eg. your player frame) but not always, and there's not really any reason to check X when you really want Y -- just check Y. :p

Rainrider 04-13-13 10:03 AM

It won't work on the player if you want to display auras that are about to expire. In that case you would probably have to hook an OnUpdate script to the button itself that will ForceUpdate the auras so you trigger SetPosition. Then you would check for timeLeft in your CustomFilter. If you just want to track short duration buffs like procs or heroism/time warp/ancient hysteria then you could use the duration argument instead of timeLeft, because they both hold the same information when the aura gets applied, but with duration you spare the call to GetTime().

All times are GMT -6. The time now is 09:57 PM.

vBulletin © 2020, Jelsoft Enterprises Ltd
© 2004 - 2020 MMOUI