View Single Post
07-21-08, 01:01 PM   #9
xConStruct
A Chromatic Dragonspawn
 
xConStruct's Avatar
AddOn Author - Click to view addons
Join Date: May 2008
Posts: 199
You only need the function posted by Taffu and not the first three lines before.
So removing
Code:
local buttonName = button:GetName();
local buffName = buttonName..index;
local buff = getglobal(buffName);
should work.

There are also a lot of RIGHT's and TOPRIGHT's left in the function which could also be changed to LEFT or TOPLEFT. For example notice the fourth last line

I came up with this:
Code:
function BuffButton_UpdateAnchors(buttonName, index, filter)
	local rows = ceil(BUFF_ACTUAL_DISPLAY/BUFFS_PER_ROW);
	local buff = getglobal(buttonName..index);
	local buffHeight = TempEnchant1:GetHeight();
 
	if ( filter == "HELPFUL" ) then
		if ( (index > 1) and (mod(index, BUFFS_PER_ROW) == 1) ) then
			-- New row
			if ( index == BUFFS_PER_ROW+1 ) then
				buff:SetPoint("TOP", TempEnchant1, "BOTTOM", 0, -BUFF_ROW_SPACING);
			else
				buff:SetPoint("TOP", getglobal(buttonName..(index-BUFFS_PER_ROW)), "BOTTOM", 0, -BUFF_ROW_SPACING);
			end
		elseif ( index == 1 ) then
			buff:SetPoint("TOPLEFT", BuffFrame, "TOPLEFT", 0, 0);
		else
			buff:SetPoint("LEFT", getglobal(buttonName..(index-1)), "RIGHT", 5, 0);
		end
	else
		-- Position debuffs
		if ( (index > 1) and (mod(index, BUFFS_PER_ROW) == 1) ) then
			-- New row
			buff:SetPoint("TOP", getglobal(buttonName..(index-BUFFS_PER_ROW)), "BOTTOM", 0, -BUFF_ROW_SPACING);
		elseif ( index == 1 ) then
			if ( rows < 2 ) then
				buff:SetPoint("TOPLEFT", TempEnchant1, "BOTTOMLEFT", 0, -1*((2*BUFF_ROW_SPACING)+buffHeight));
			else
				buff:SetPoint("TOPLEFT", TempEnchant1, "BOTTOMLEFT", 0, -rows*(BUFF_ROW_SPACING+buffHeight));
			end
		else
			buff:SetPoint("LEFT", getglobal(buttonName..(index-1)), "RIGHT", 5, 0);
		end
	end
  Reply With Quote