Quantcast
filter auras by duration - WoWInterface
Thread Tools Display Modes
04-11-13, 04:15 AM   #1
Coldkil
A Theradrim Guardian
 
Coldkil's Avatar
AddOn Author - Click to view addons
Join Date: Jun 2010
Posts: 68
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
  Reply With Quote
04-11-13, 04:54 PM   #2
Rainrider
A Firelord
AddOn Author - Click to view addons
Join Date: Nov 2008
Posts: 453
You could use auras.CustomFilter to do this.

Code:
auras.CustomFilter = function(_, _, aura, _, _, _, _, _, duration)
	if (aura.isDebuff) then
		return true
	else
		if (duration <= 60 and duration > 0) then
			return true
		end
	end
end
This won't work if you mean timeLeft btw.

Last edited by Rainrider : 04-11-13 at 04:56 PM.
  Reply With Quote
04-11-13, 09:03 PM   #3
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Well, since the argument passed right after the duration is the time the aura expires, getting the time remaining is trivial:

Code:
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
end
__________________
Author/maintainer of Grid, PhanxChat, oUF_Phanx, and many more.
Troubleshoot an addonTurn any code into an addonMore addon resources
Need help with your code? Post all of your actual code! Attach or paste your files.
Please don’t PM me about addon bugs or code questions. Post a comment or forum thread instead!
  Reply With Quote
04-12-13, 11:14 AM   #4
Rainrider
A Firelord
AddOn Author - Click to view addons
Join Date: Nov 2008
Posts: 453
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.
  Reply With Quote
04-13-13, 01:42 AM   #5
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
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.
__________________
Author/maintainer of Grid, PhanxChat, oUF_Phanx, and many more.
Troubleshoot an addonTurn any code into an addonMore addon resources
Need help with your code? Post all of your actual code! Attach or paste your files.
Please don’t PM me about addon bugs or code questions. Post a comment or forum thread instead!
  Reply With Quote
04-13-13, 10:03 AM   #6
Rainrider
A Firelord
AddOn Author - Click to view addons
Join Date: Nov 2008
Posts: 453
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().
  Reply With Quote

WoWInterface » Featured Projects » oUF (Otravi Unit Frames) » filter auras by duration

Thread Tools
Display Modes

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