Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Player buff displaying #111

Open
cbb356 opened this issue Jul 21, 2016 · 10 comments
Open

Player buff displaying #111

cbb356 opened this issue Jul 21, 2016 · 10 comments

Comments

@cbb356
Copy link

cbb356 commented Jul 21, 2016

Player buff are displayed on default Blizzlike place. But its must be moved to the right.
wowscrnshot_072116_215056

@muffz
Copy link

muffz commented Jul 24, 2016

Take a peek into issue #109

@cbb356
Copy link
Author

cbb356 commented Jul 24, 2016

Tried this correction. It's in the file /scripts/buffs.lua, right?
Not work for me :(

@muffz
Copy link

muffz commented Jul 24, 2016

Hmm works like a charm for me. Just edit the latest /scripts/buffs.lua and add in line 84: BuffFrame.SetPoint = F.dummy

ReloadUI afterwards.

@cbb356
Copy link
Author

cbb356 commented Jul 24, 2016

Now works :)
I did a mistake first time - place this in wrong line (in function reposition below).
Thanks a lot.
But don't close issue now. It is necessary to change it in Master branch.

@Toora
Copy link

Toora commented Jul 29, 2016

Although F.dummy puts the buffs where they should be, I'm only getting 8 buffs displayed. Any more than that don't show up; no second row.

@muffz
Copy link

muffz commented Aug 1, 2016

I updated it from Roth. You can shorten it a bit but I don't really care. In this form it's easier to update it from source.

-- rBuffFrame by Roth, modified.

local F, C, L = unpack(select(2, ...))

local framePadding  = 0
local buttonWidth       = 26
local buttonHeight  = 26
local buttonMargin  = 4
local numCols           = 10
local startPoint        = "TOPRIGHT"

local function SetDurationText(duration, arg1, arg2)
    duration:SetText(format("|cffffffff"..string.gsub(arg1, " ", "").."|r", arg2))
end

local function SkinButton(button)
    if button.styled then return end

    local name = button:GetName()

    local border = _G[name.."Border"]
    if border then border:Hide() end

    local icon = _G[name.."Icon"]
    icon:SetTexCoord(.08, .92, .08, .92)
    icon:SetDrawLayer("BACKGROUND", -8)
    icon:SetPoint("TOPLEFT", button, "TOPLEFT", 1, -1)
  icon:SetPoint("BOTTOMRIGHT", button, "BOTTOMRIGHT", -1, 1)

    F.SetFS(button.duration)
    button.duration:ClearAllPoints()
    button.duration:SetPoint("BOTTOM")
    button.duration:SetJustifyH("CENTER")

    hooksecurefunc(button.duration, "SetFormattedText", SetDurationText)

    F.SetFS(button.count, 12)
    button.count:ClearAllPoints()
    button.count:SetPoint("TOP")
    button.count:SetJustifyH("CENTER")

    F.CreateBG(b)

    button.styled = true
end

local function GetButtonList(buttonName,numButtons,buttonList)
  buttonList = buttonList or {}
  for i=1, numButtons do
    local button = _G[buttonName..i]
    if not button then break end
    if button:IsShown() then
      table.insert(buttonList,button)
    end
  end
  return buttonList
end

local function SetupButtonPoints(frame, buttonList, buttonWidth, buttonHeight, numCols, p1, fp1, fp2, p2, p3, bm1, bm2, p4, p5, bm3, bm4)
  for index, button in next, buttonList do
    if not button.styled then SkinButton(button) end

    button:SetSize(buttonWidth, buttonHeight)
    button:ClearAllPoints()
    if index == 1 then
      button:SetPoint(p1, frame, fp1, fp2)
    elseif numCols == 1 or mod(index, numCols) == 1 then
      button:SetPoint(p2, buttonList[index-numCols], p3, bm1, bm2)
    else
      button:SetPoint(p4, buttonList[index-1], p5, bm3, bm4)
    end
  end
end

local function SetupButtonFrame(frame, framePadding, buttonList, buttonWidth, buttonHeight, buttonMargin, numCols, startPoint)
  local numButtons = # buttonList
  numCols = max(min(numButtons, numCols),1)
  local numRows = max(ceil(numButtons/numCols),1)
  local frameWidth = numCols*buttonWidth + (numCols-1)*buttonMargin + 2*framePadding
  local frameHeight = numRows*buttonHeight + (numRows-1)*buttonMargin + 2*framePadding
  frame:SetSize(frameWidth,frameHeight)
  if startPoint == "TOPLEFT" then
    SetupButtonPoints(frame, buttonList, buttonWidth, buttonHeight, numCols, startPoint, framePadding, -framePadding, "TOP", "BOTTOM", 0, -buttonMargin, "LEFT", "RIGHT", buttonMargin, 0)
  elseif startPoint == "TOPRIGHT" then
    SetupButtonPoints(frame, buttonList, buttonWidth, buttonHeight, numCols, startPoint, -framePadding, -framePadding, "TOP", "BOTTOM", 0, -buttonMargin, "RIGHT", "LEFT", -buttonMargin, 0)
  elseif startPoint == "BOTTOMRIGHT" then
    SetupButtonPoints(frame, buttonList, buttonWidth, buttonHeight, numCols, startPoint, -framePadding, framePadding, "BOTTOM", "TOP", 0, buttonMargin, "RIGHT", "LEFT", -buttonMargin, 0)
  else
    startPoint = "BOTTOMLEFT"
    SetupButtonPoints(frame, buttonList, buttonWidth, buttonHeight, numCols, startPoint, framePadding, framePadding, "BOTTOM", "TOP", 0, buttonMargin, "LEFT", "RIGHT", buttonMargin, 0)
  end
end

local buffFrame = CreateFrame("Frame", "FreeUIBuffFrame", UIParent, nil)
buffFrame:SetPoint("TOPRIGHT", UIParent, "TOPRIGHT", -32, -32)
local function UpdateAllBuffAnchors()
  --add temp enchant buttons
  local buttonList = GetButtonList("TempEnchant",BuffFrame.numEnchants)
  --add all other buff buttons
  buttonList = GetButtonList("BuffButton",BUFF_MAX_DISPLAY,buttonList)
  --adjust frame by button list
  SetupButtonFrame(buffFrame, framePadding, buttonList, buttonWidth, buttonHeight, buttonMargin, numCols, startPoint)
end
hooksecurefunc("BuffFrame_UpdateAllBuffAnchors", UpdateAllBuffAnchors)

local debuffFrame = CreateFrame("Frame", "FreeUIDebuffFrame", UIParent, nil)
local function UpdateAllDebuffAnchors(buttonName, index)
  _G["DebuffButton"..index]:Hide()
end
hooksecurefunc("DebuffButton_UpdateAnchors", UpdateAllDebuffAnchors)

@cbb356 cbb356 closed this as completed Sep 5, 2016
@cbb356 cbb356 reopened this Sep 5, 2016
@cbb356
Copy link
Author

cbb356 commented Sep 5, 2016

9.0.2 Buffs still on wrong place
wowscrnshot_090516_183954

Added BuffFrame.SetPoint = F.dummy in buffs.lua again manually

@Toora
Copy link

Toora commented Sep 12, 2016

As I mentioned above, using F.dummy doesn't fix the issue of only one buff row displaying.

@Zenjaa
Copy link

Zenjaa commented Oct 2, 2016

I edited the above posted version of rBuffframe, because it didn't work. This seems to work just fine. Multiple rows of buffs are displayed and the anchoring is fixed.


-- rBuffFrame by Roth, modified.

local F, C, L = unpack(select(2, ...))


local BuffFrame = BuffFrame

local framePadding  = 0
local buttonWidth       = 32
local buttonHeight  = 32
local buttonMargin  = 3
local numCols           = 10
local startPoint        = "TOPRIGHT"

local function SetDurationText(duration, arg1, arg2)
    duration:SetText(format("|cffffffff"..string.gsub(arg1, " ", "").."|r", arg2))
end

local function SkinButton(button)
    if button.styled then return end

    local name = button:GetName()

    local border = _G[name.."Border"]
    if border then border:Hide() end

    local icon = _G[name.."Icon"]
    icon:SetTexCoord(.08, .92, .08, .92)
    icon:SetDrawLayer("BACKGROUND", 1)
    --icon:SetPoint("TOPLEFT", button, "TOPLEFT", 1, -1)
    --icon:SetPoint("BOTTOMRIGHT", button, "BOTTOMRIGHT", -1, 1)

    F.SetFS(button.duration)
    button.duration:ClearAllPoints()
    button.duration:SetPoint("BOTTOM", -1, -2)
    --button.duration:SetJustifyH("CENTER")

    hooksecurefunc(button.duration, "SetFormattedText", SetDurationText)

    F.SetFS(button.count, 12)
    button.count:ClearAllPoints()
    button.count:SetPoint("TOP", 2, -2)
    --button.count:SetJustifyH("CENTER")

    F.CreateBG(button)

    button.styled = true
end

local function GetButtonList(buttonName,numButtons,buttonList)






  buttonList = buttonList or {}
  for i=1, numButtons do
    local button = _G[buttonName..i]
    if not button then break end
    if button:IsShown() then
      table.insert(buttonList,button)
    end
  end
  return buttonList
end

local function SetupButtonPoints(frame, buttonList, buttonWidth, buttonHeight, numCols, p1, fp1, fp2, p2, p3, bm1, bm2, p4, p5, bm3, bm4)
  for index, button in next, buttonList do
    if not button.styled then SkinButton(button) end





    button:SetSize(buttonWidth, buttonHeight)
    button:ClearAllPoints()
    if index == 1 then





      button:SetPoint(p1, frame, fp1, fp2)
    elseif numCols == 1 or mod(index, numCols) == 1 then




      button:SetPoint(p2, buttonList[index-numCols], p3, bm1, bm2)
    else


      button:SetPoint(p4, buttonList[index-1], p5, bm3, bm4)
    end

  end
end



local function SetupButtonFrame(frame, framePadding, buttonList, buttonWidth, buttonHeight, buttonMargin, numCols, startPoint)
  local numButtons = # buttonList
  numCols = max(min(numButtons, numCols),1)
  local numRows = max(ceil(numButtons/numCols),1)
  local frameWidth = numCols*buttonWidth + (numCols-1)*buttonMargin + 2*framePadding
  local frameHeight = numRows*buttonHeight + (numRows-1)*buttonMargin + 2*framePadding
  frame:SetSize(frameWidth,frameHeight)
  if startPoint == "TOPLEFT" then
    SetupButtonPoints(frame, buttonList, buttonWidth, buttonHeight, numCols, startPoint, framePadding, -framePadding, "TOP", "BOTTOM", 0, -buttonMargin, "LEFT", "RIGHT", buttonMargin, 0)
  elseif startPoint == "TOPRIGHT" then
    SetupButtonPoints(frame, buttonList, buttonWidth, buttonHeight, numCols, startPoint, -framePadding, -framePadding, "TOP", "BOTTOM", 0, -buttonMargin, "RIGHT", "LEFT", -buttonMargin, 0)
  elseif startPoint == "BOTTOMRIGHT" then
    SetupButtonPoints(frame, buttonList, buttonWidth, buttonHeight, numCols, startPoint, -framePadding, framePadding, "BOTTOM", "TOP", 0, buttonMargin, "RIGHT", "LEFT", -buttonMargin, 0)
  else
    startPoint = "BOTTOMLEFT"
    SetupButtonPoints(frame, buttonList, buttonWidth, buttonHeight, numCols, startPoint, framePadding, framePadding, "BOTTOM", "TOP", 0, buttonMargin, "LEFT", "RIGHT", buttonMargin, 0)
  end
end

local buffFrame = CreateFrame("Frame", "FreeUIBuffFrame", UIParent, nil)

buffFrame:SetPoint("TOPRIGHT", UIParent, "TOPRIGHT", -32, -32)




local function UpdateAllBuffAnchors()
  --add temp enchant buttons
  local buttonList = GetButtonList("TempEnchant",BuffFrame.numEnchants)









  --add all other buff buttons
  buttonList = GetButtonList("BuffButton",BUFF_MAX_DISPLAY,buttonList)
  --adjust frame by button list
  SetupButtonFrame(buffFrame, framePadding, buttonList, buttonWidth, buttonHeight, buttonMargin, numCols, startPoint)
end

hooksecurefunc("BuffFrame_UpdateAllBuffAnchors", UpdateAllBuffAnchors)





local debuffFrame = CreateFrame("Frame", "FreeUIDebuffFrame", UIParent, nil)
local function UpdateAllDebuffAnchors(buttonName, index)
  _G["DebuffButton"..index]:Hide()
end




hooksecurefunc("DebuffButton_UpdateAnchors", UpdateAllDebuffAnchors)

@cbb356
Copy link
Author

cbb356 commented Nov 1, 2016

It is working version.
But still it not integrated in 9.0.3 version

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants