nameplates: add option to set debuff position

This commit is contained in:
shagu
2020-07-12 11:46:14 +02:00
parent d610f2509c
commit 5828d18a1e
3 changed files with 22 additions and 4 deletions
+1
View File
@@ -666,6 +666,7 @@ function pfUI:LoadConfig()
pfUI:UpdateConfig("nameplates", "debuffs", "whitelist", "")
pfUI:UpdateConfig("nameplates", "debuffs", "blacklist", "")
pfUI:UpdateConfig("nameplates", "debuffs", "showstacks", "0")
pfUI:UpdateConfig("nameplates", "debuffs", "position", "BOTTOM")
pfUI:UpdateConfig("abuttons", nil, "enable", "0")
pfUI:UpdateConfig("abuttons", nil, "position", "bottom")
+5
View File
@@ -1065,6 +1065,10 @@ pfUI:RegisterModule("gui", "vanilla:tbc", function ()
"left:" .. T["Left"],
"right:" .. T["Right"]
},
["debuffposition"] = {
"TOP:" .. T["Top"],
"BOTTOM:" .. T["Bottom"],
},
["gmserver_text"] = {
"elysium:" .. T["Elysium Based Core"],
},
@@ -2110,6 +2114,7 @@ pfUI:RegisterModule("gui", "vanilla:tbc", function ()
CreateConfig(nil, T["Debuffs"], nil, nil, "header")
CreateConfig(U["nameplates"], T["Enable Debuffs"], C.nameplates, "showdebuffs", "checkbox")
CreateConfig(U["nameplates"], T["Debuff Position"], C.nameplates.debuffs, "position", "dropdown", pfUI.gui.dropdowns.debuffposition)
CreateConfig(U["nameplates"], T["Estimate Debuffs"], C.nameplates, "guessdebuffs", "checkbox")
CreateConfig(U["nameplates"], T["Debuff Icon Size"], C.nameplates, "debuffsize")
CreateConfig(U["nameplates"], T["Show Debuff Stacks"], C.nameplates.debuffs, "showstacks", "checkbox")
+16 -4
View File
@@ -292,11 +292,15 @@ pfUI:RegisterModule("nameplates", "vanilla:tbc", function ()
castbar:Hide()
castbar:SetScript("OnShow", function()
nameplate.debuffs[1]:SetPoint("TOPLEFT", this, "BOTTOMLEFT", 0, -4)
if C.nameplates.debuffs["position"] == "BOTTOM" then
nameplate.debuffs[1]:SetPoint("TOPLEFT", this, "BOTTOMLEFT", 0, -4)
end
end)
castbar:SetScript("OnHide", function()
nameplate.debuffs[1]:SetPoint("TOPLEFT", this:GetParent(), "BOTTOMLEFT", 0, -4)
if C.nameplates.debuffs["position"] == "BOTTOM" then
nameplate.debuffs[1]:SetPoint("TOPLEFT", this, "BOTTOMLEFT", 0, -4)
end
end)
castbar.text = castbar:CreateFontString("Status", "DIALOG", "GameFontNormal")
@@ -378,15 +382,23 @@ pfUI:RegisterModule("nameplates", "vanilla:tbc", function ()
-- update debuff positions
local limit = floor(width / debuffsize)
local aligna, alignb, offs, space
if C.nameplates.debuffs["position"] == "BOTTOM" then
aligna, alignb, offs, space = "TOPLEFT", "BOTTOMLEFT", -4, -1
else
aligna, alignb, offs, space = "BOTTOMLEFT", "TOPLEFT", 20, 1
end
for i=1,16 do
nameplate.debuffs[i].stacks:SetFont(font, font_size, font_style)
nameplate.debuffs[i]:ClearAllPoints()
if i == 1 then
nameplate.debuffs[i]:SetPoint("TOPLEFT", nameplate.health, "BOTTOMLEFT", 0, -4)
nameplate.debuffs[i]:SetPoint(aligna, nameplate.health, alignb, 0, offs)
elseif i <= limit then
nameplate.debuffs[i]:SetPoint("LEFT", nameplate.debuffs[i-1], "RIGHT", 1, 0)
elseif i > limit then
nameplate.debuffs[i]:SetPoint("TOPLEFT", nameplate.debuffs[i-limit], "BOTTOMLEFT", 0, -1)
nameplate.debuffs[i]:SetPoint(aligna, nameplate.debuffs[i-limit], alignb, 0, space)
end
nameplate.debuffs[i]:SetWidth(tonumber(C.nameplates.debuffsize))