Thread Tools Display Modes
Prev Previous Post   Next Post Next
06-02-23, 06:41 PM   #1
lualoser
A Defias Bandit
Join Date: Jun 2023
Posts: 2
Move Player Debuffs (Default UI)

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:
  1. 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.
  2. 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:
  1. function DebuffButton_UpdateAnchors(buttonName, index)
  2.     local numBuffs = BUFF_ACTUAL_DISPLAY + BuffFrame.numEnchants;
  3.  
  4.     local rows = ceil(numBuffs/BUFFS_PER_ROW);
  5.     local buff = _G[buttonName..index];
  6.  
  7.  
  8.  
  9.     -- Position debuffs
  10.     if ( (index > 1) and (mod(index, BUFFS_PER_ROW) == 1) ) then
  11.         -- New row
  12.         buff:SetPoint("TOP", _G[buttonName..(index-BUFFS_PER_ROW)], "BOTTOM", 0, -BUFF_ROW_SPACING);
  13.     elseif ( index == 1 ) then
  14.         if ( rows < 2 ) then
  15.             DebuffButton1.offsetY = 1*((2*BUFF_ROW_SPACING)+BUFF_BUTTON_HEIGHT);
  16.         else
  17.             DebuffButton1.offsetY = rows*(BUFF_ROW_SPACING+BUFF_BUTTON_HEIGHT);
  18.         end
  19.         buff:SetPoint("CENTER", Screen, "CENTER", -(DEBUFF_ACTUAL_DISPLAY)*(BUFF_BUTTON_HEIGHT), -200);
  20.     else
  21.         buff:SetPoint("LEFT", _G[buttonName..(index-1)], "RIGHT", 5, 0);
  22.     end
  23. end

Last edited by lualoser : 06-04-23 at 04:29 PM.
  Reply With Quote
 

WoWInterface » Developer Discussions » Lua/XML Help » Move Player Debuffs (Default UI)


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