Hi,
Since I wanted to adjust the Blizzard default UI (in Classic Wow) to my liking, I created an addon in order to move the position of the
player debuffs. To be more specific I wanted to achieve the following two things:
- The player debuffs should appear at the center of the screen while the player buffs stay at their default position in the top right corner.
- The alignment of the player debuffs should be centered. So instead of having a fixed anchor from which the debuffs grow to the left or to the right, I want to have a dynamic anchor that adjusts depending on the amount of debuffs. My goal is that all the debuffs combined are always perfectly centered.
Here is what I did:
Basically I copy+pasted some of the code of
BlizzardInterfaceCode\Interface\FrameXML\BuffFrame into my addon and adjusted some numbers and anchors. It worked out partially. The debuffs are at the center of the screen, as I wanted it. The alignment-part however did not work. As it is now the anchor is fixed in the center from where the debuffs grow to the right. I think there might be a problem with
"DEBUFF_ACTUAL_DISPLAY" in line 19 of my lua code but I'm unable to fix it.
It goes without saying that I have no idea of what I'm doing. If there is a more elegant way to achieve what I want, I'd be eager to hear. I really appreciate any help. Thanks in advance!
Lua Code:
function DebuffButton_UpdateAnchors(buttonName, index)
local numBuffs = BUFF_ACTUAL_DISPLAY + BuffFrame.numEnchants;
local rows = ceil(numBuffs/BUFFS_PER_ROW);
local buff = _G[buttonName..index];
-- Position debuffs
if ( (index > 1) and (mod(index, BUFFS_PER_ROW) == 1) ) then
-- New row
buff:SetPoint("TOP", _G[buttonName..(index-BUFFS_PER_ROW)], "BOTTOM", 0, -BUFF_ROW_SPACING);
elseif ( index == 1 ) then
if ( rows < 2 ) then
DebuffButton1.offsetY = 1*((2*BUFF_ROW_SPACING)+BUFF_BUTTON_HEIGHT);
else
DebuffButton1.offsetY = rows*(BUFF_ROW_SPACING+BUFF_BUTTON_HEIGHT);
end
buff:SetPoint("CENTER", Screen, "CENTER", -(DEBUFF_ACTUAL_DISPLAY)*(BUFF_BUTTON_HEIGHT), -200);
else
buff:SetPoint("LEFT", _G[buttonName..(index-1)], "RIGHT", 5, 0);
end
end