Thread Tools Display Modes
01-24-11, 07:15 AM   #1
Pyrates
A Cliff Giant
 
Pyrates's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 77
Originally Posted by MMOGames View Post
Can you give me an example?
Ok, this is c&p from a working addon, so it might not actually work, but give you the idea. I think I was wrong with UpdateAllBuffAnchors being not protected, by one can securehook it and then just redo everything it does anyways. The lines marked with "--SAF" are new code, they change the anchors because some of the buffs might be hidden, and you don't want an empty space (this is done in another portion of the code). But what you can do is just replace the "SetPoint" executions by some that you like (maybe you'd need to use ClearAllPoint() first) and anchor the buffs to your ouf_player frame:

Code:
local function MyBuffFrame_UpdateAllBuffAnchors()
	local buff, previousBuff, aboveBuff;
	local numBuffs = 0;
	local hidden = 0; -- SAF
	local slack = BuffFrame.numEnchant or 0
	local inde = 0;
	
	if ( BuffFrame.numConsolidated > 0 ) then
		slack = slack + 1;	-- one icon for all consolidated buffs
	end
	
	for i = 1, BUFF_ACTUAL_DISPLAY do
		buff = _G["BuffButton"..i];
		if not buff:IsShown() then --SAF
			hidden = hidden + 1 --SAF
			numBuffs = numBuffs + 1; --SAF
		else
			if ( buff.consolidated ) then	
				if ( buff.parent == BuffFrame ) then
					buff:SetParent(ConsolidatedBuffsContainer);
					buff.parent = ConsolidatedBuffsContainer;
				end
			else
				numBuffs = numBuffs + 1;
				inde = numBuffs + slack;
				if ( buff.parent ~= BuffFrame ) then
					buff.count:SetFontObject(NumberFontNormal);
					buff:SetParent(BuffFrame);
					buff.parent = BuffFrame;
				end
				buff:ClearAllPoints();
				if ( (inde > 1) and (mod(inde, BUFFS_PER_ROW) == 1) ) then
					-- New row
					if ( inde == BUFFS_PER_ROW+1 ) then
						buff:SetPoint("TOP", ConsolidatedBuffs, "BOTTOM", 0, -BUFF_ROW_SPACING);
					else
						buff:SetPoint("TOP", aboveBuff, "BOTTOM", 0, -BUFF_ROW_SPACING);
					end
					aboveBuff = buff;
				elseif ( inde == 1 ) then
					buff:SetPoint("TOPRIGHT", BuffFrame, "TOPRIGHT", 0, 0);
				else
					if ( numBuffs == 1 ) then
						if ( BuffFrame.numEnchants > 0 ) then
							buff:SetPoint("TOPRIGHT", "TemporaryEnchantFrame", "TOPLEFT", -5, 0);
						else
							buff:SetPoint("TOPRIGHT", ConsolidatedBuffs, "TOPLEFT", -5, 0);
						end
					else
						buff:SetPoint("RIGHT", previousBuff, "LEFT", -5, 0);
					end
				end
				previousBuff = buff;
			end
		end --SAF
	end

	if ( ConsolidatedBuffsTooltip:IsShown() ) then
		ConsolidatedBuffs_UpdateAllAnchors();
	end
end

hooksecurefunc("BuffFrame_UpdateAllBuffAnchors",MyBuffFrame_UpdateAllBuffAnchors)
__________________
" ... and the Vogon will do things to you that you wish you'd never been born, or, if you're a clearer minded thinker, that the Vogon had never been born."
  Reply With Quote

WoWInterface » Featured Projects » oUF (Otravi Unit Frames) » Cancel Aura


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