Haleth / FreeUI

A World of Warcraft user interface
http://www.wowinterface.com/downloads/info17892-FreeUI.html
54 stars 29 forks source link

Player buff displaying #111

Open cbb356 opened 8 years ago

cbb356 commented 8 years ago

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

muffz commented 8 years ago

Take a peek into issue #109

cbb356 commented 8 years ago

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

muffz commented 8 years ago

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 commented 8 years ago

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 commented 8 years ago

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 commented 8 years ago

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 commented 8 years ago

9.0.2 Buffs still on wrong place wowscrnshot_090516_183954

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

Toora commented 7 years ago

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

Zenjaa commented 7 years ago

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 commented 7 years ago

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