Thread Tools Display Modes
11-27-09, 02:45 PM   #1
Tastyfrog
A Deviate Faerie Dragon
Join Date: Mar 2009
Posts: 15
Sorting of auras

This might be a stupid question (because im really new to oUF), but is it possible to sort buffs?
  Reply With Quote
11-27-09, 04:07 PM   #2
haste
Featured Artist
 
haste's Avatar
Premium Member
Featured
Join Date: Dec 2005
Posts: 1,027
Originally Posted by Tastyfrog View Post
This might be a stupid question (because im really new to oUF), but is it possible to sort buffs?
Yes, you can sort buffs with :PreAuraSetPosition(auras, max). It does however require you to implement your own sort function. The oUF aura/buffs/debuffs tables are designed to support table.sort however.
__________________
「貴方は1人じゃないよ」
  Reply With Quote
11-27-09, 04:10 PM   #3
Dawn
A Molten Giant
 
Dawn's Avatar
AddOn Author - Click to view addons
Join Date: May 2006
Posts: 918
It's damn tricky and I don't know if anyone got a working way that doesn't bug out now and then.

Edit: haste beat me to it... however, it's surely possible, just not sure if anyone (besides haste) is clever enough to code it.
__________________
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
11-27-09, 04:12 PM   #4
haste
Featured Artist
 
haste's Avatar
Premium Member
Featured
Join Date: Dec 2005
Posts: 1,027
Depends on how you want to sort really. But what issues did you run into and with what sort function?
__________________
「貴方は1人じゃないよ」
  Reply With Quote
11-27-09, 04:32 PM   #5
Dawn
A Molten Giant
 
Dawn's Avatar
AddOn Author - Click to view addons
Join Date: May 2006
Posts: 918
I managed to sort it by time left, but from time to time some buffs disappeared from the buff list.

Like
BUFFICON 1, BUFFICON 2, BUFFICON 3
becomes
BUFFICON 1, BUFFICON 3

while BUFF 2 is still there, just the icon got "overridden" ... strange thing.
__________________
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
11-27-09, 04:54 PM   #6
haste
Featured Artist
 
haste's Avatar
Premium Member
Featured
Join Date: Dec 2005
Posts: 1,027
That doesn't show any code tho' :P. Anyway, a quick and dirty example on how to do aura sorting can found on this post.
__________________
「貴方は1人じゃないよ」
  Reply With Quote
11-27-09, 06:39 PM   #7
Tastyfrog
A Deviate Faerie Dragon
Join Date: Mar 2009
Posts: 15
wow, it is actually kinda easy to sort buffs. thanks.

my code:
Code:
local prePosition = function(self, a, n)
	table.sort(a, function(a,b) return a.timeLeft>b.timeLeft end)
end
  Reply With Quote
11-28-09, 04:13 AM   #8
Dawn
A Molten Giant
 
Dawn's Avatar
AddOn Author - Click to view addons
Join Date: May 2006
Posts: 918
Originally Posted by haste View Post
That doesn't show any code tho' :P. Anyway, a quick and dirty example on how to do aura sorting can found on this post.
I was doing it similar to this:

Code:
local preAuraSetPosition = function(self, buffs, max)
	local visBuffs = 0
	for i=1, #buffs do
		if( buffs[i].timeLeft == nil ) then
			buffs[i].timeLeft = 0
		end
		if( buffs[i]:IsShown() ) then
			visBuffs = visBuffs + 1
		end
	end
	
	if(visBuffs == 0 ) then
		buffs:SetHeight(0)
	else
		buffs:SetHeight(math.ceil((visBuffs/10)) * 26 )
	end
	
	table.sort(buffs, function(a,b) return a.timeLeft > b.timeLeft end)
end
note:
This is taken from oUF_Banthis, since I don't have the exact piece of code I used, still around. However, that code above is having the same issues of "disappearing" buff icons, with still active buffs.


*In some strange cases, the auras (which are divided into those that expire and don't, aka auras and buffs) will jump around with blank spaces between them. I have no idea why. Adding an aura (like a hunter aspect) makes it stop.

The thing with the code you linked in that post is that it still crits me for over NIIIINEEEETHOOOOOUSAAAND. And I didn't find the time to play around with it, until now. Seems like I have to take enough time to look into it.
__________________
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

WoWInterface » Featured Projects » oUF (Otravi Unit Frames) » Sorting of auras


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