Thread Tools Display Modes
08-30-09, 04:48 PM   #1
v6o
An Onyxian Warder
AddOn Author - Click to view addons
Join Date: Mar 2009
Posts: 399
"growing" buff/debuffs rows

I'm trying to make my debuffs and buffs work like this* (see example below) and I'm just wondering if there's any smarter way. Last time I used "Auras" they only allowed to pad it with an empty icon(s?) and not actually lines/rows.


5 buff, 8 debuff

[d][d][d][d][d][d][d][d]
[b][b][b][b][b]
[_____unitframe_____]


12 buff, 9 debuff

[d]
[d][d][d][d][d][d][d][d]
[b][b][b][b]
[b][b][b][b][b][b][b][b]
[_____unitframe_____]


lua Code:
  1. local updateTargetDebuffPosition = function(self, icons, x)
  2.     if icons.visibleDebuffs and icons.visibleDebuffs > 0 then
  3.         if self.Buffs.visibleBuffs and self.Buffs.visibleBuffs > 0 then
  4.             -- 10 is my pad from unitframe, 26+2 is my buff size/spacing and 8 is how many i show per line
  5.             local calcpos = 10 + (28 * ceil(self.Buffs.visibleBuffs/8) )
  6.             icons:SetPoint("BOTTOMLEFT", self, "TOPLEFT", 1, calcpos)
  7.         else
  8.             icons:SetPoint("BOTTOMLEFT", self, "TOPLEFT", 1, 10)
  9.         end
  10.     end
  11. end
__________________
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 : 08-30-09 at 05:23 PM.
  Reply With Quote
08-30-09, 08:12 PM   #2
Krag72
A Deviate Faerie Dragon
Join Date: Sep 2008
Posts: 14
I don't know if it's a "smarter" way as such, but you can use a custom SetAuraPosition where you just copy the default one (from auras.lua) and instead of just incrementing the column position when it switches from buffs to debuffs you can increment the row and reset the column.

(not at my game computer right now so can't try it out at the moment, but it should work fine I think.)
  Reply With Quote
09-01-09, 01:44 AM   #3
Waverian
A Chromatic Dragonspawn
AddOn Author - Click to view addons
Join Date: Dec 2006
Posts: 188
I've never tried that type of aura layout, but does anchoring your debuffs to the top of your buffs frame not work?
  Reply With Quote
09-01-09, 06:39 AM   #4
v6o
An Onyxian Warder
AddOn Author - Click to view addons
Join Date: Mar 2009
Posts: 399
Originally Posted by Waverian View Post
I've never tried that type of aura layout, but does anchoring your debuffs to the top of your buffs frame not work?
The frame is only the container for the first row and will not grow in any direction so I'm afraid it doesn't work unless some extra code was added.
__________________
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
09-01-09, 06:41 AM   #5
v6o
An Onyxian Warder
AddOn Author - Click to view addons
Join Date: Mar 2009
Posts: 399
Originally Posted by Krag72 View Post
I don't know if it's a "smarter" way as such, but you can use a custom SetAuraPosition where you just copy the default one (from auras.lua) and instead of just incrementing the column position when it switches from buffs to debuffs you can increment the row and reset the column.

(not at my game computer right now so can't try it out at the moment, but it should work fine I think.)
Ah, I'm not using "Auras" at the moment but seperate buffs and debuffs. I'll try this.
__________________
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
09-17-09, 03:20 AM   #6
wurmfood
A Flamescale Wyrmkin
AddOn Author - Click to view addons
Join Date: Apr 2009
Posts: 122
Not sure if you found a solution to this or not, but here's the short version of what I did. It's not clear what direction you're wanting stuff to grow, but, assuming it's up, anchor the buffs frame normally and the debuffs frame to the top of the buffs frame. Set the height of each to an appropriate height for one layer of auras.

Then, in your preAuraSetPosition function, get a count of visible buffs:

Code:
local visBuffs = 0
for i=1, #buffs do
	if( buffs[i]:IsShown() ) then
		visBuffs = visBuffs + 1
	end
end
Then you're going to establish the appropriate frame height:

Code:
if(visBuffs == 0 ) then
	buffs:SetHeight(0)
else
	buffs:SetHeight(math.ceil((visBuffs/numBuffsPerRow)) * buffHeight )
end
This adjusts the height of the frames based on the number of buffs and how many rows you'd need.
  Reply With Quote
09-17-09, 04:10 AM   #7
haste
Featured Artist
 
haste's Avatar
Premium Member
Featured
Join Date: Dec 2005
Posts: 1,027
oUF already sets buffs.visibleBuffs for you.
  Reply With Quote
09-17-09, 05:51 AM   #8
wurmfood
A Flamescale Wyrmkin
AddOn Author - Click to view addons
Join Date: Apr 2009
Posts: 122
The only problem is that, assuming you're using Buffs and Debuffs, the Debuffs frame only sets .visibleDebuffs. I assume you could use the following, though I haven't tested it.

Code:
if(buffs.visibleBuffs == 0 or buffs.visibleDebuffs == 0) then
	buffs:SetHeight(0)
else
	buffs:SetHeight(math.ceil(((buffs.visibleBuffs or buffs.visibleDebuffs)/numBuffsPerRow)) * buffHeight )
end
  Reply With Quote
09-17-09, 06:20 AM   #9
v6o
An Onyxian Warder
AddOn Author - Click to view addons
Join Date: Mar 2009
Posts: 399
In no way did I say my script was broken, totally opposite, it was working perfectly but I wasn't sure it was the best way to go about so I asked for a smarter way and I am using Auras right now as Krag suggested.
__________________
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

WoWInterface » Featured Projects » oUF (Otravi Unit Frames) » "growing" buff/debuffs rows


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