unitframes: add option to change and hide buffs

This commit is contained in:
shagu
2016-12-12 17:53:32 +01:00
parent 6116b3ae73
commit 3bab0d0caa
4 changed files with 96 additions and 10 deletions
+2
View File
@@ -40,10 +40,12 @@ function pfUI:LoadConfig()
pfUI:UpdateConfig("unitframes", "player", "pspace", "-3")
pfUI:UpdateConfig("unitframes", "player", "showPVPMinimap", "0")
pfUI:UpdateConfig("unitframes", "player", "showPVP", "0")
pfUI:UpdateConfig("unitframes", "player", "buffs", "top")
pfUI:UpdateConfig("unitframes", "target", "width", "200")
pfUI:UpdateConfig("unitframes", "target", "height", "50")
pfUI:UpdateConfig("unitframes", "target", "pheight", "10")
pfUI:UpdateConfig("unitframes", "target", "pspace", "-3")
pfUI:UpdateConfig("unitframes", "target", "buffs", "top")
pfUI:UpdateConfig("unitframes", "ttarget", "pspace", "-3")
pfUI:UpdateConfig("unitframes", "pet", "pspace", "-3")
pfUI:UpdateConfig("unitframes", "group", "hide_in_raid", "0")
+2
View File
@@ -703,10 +703,12 @@ pfUI:RegisterModule("gui", function ()
pfUI.gui:CreateConfig(pfUI.gui.uf, "Player powerbar spacing", pfUI_config.unitframes.player, "pspace")
pfUI.gui:CreateConfig(pfUI.gui.uf, "Show PvP Icon", pfUI_config.unitframes.player, "showPVP", "checkbox")
pfUI.gui:CreateConfig(pfUI.gui.uf, "Align PvP Icon to Minimap", pfUI_config.unitframes.player, "showPVPMinimap", "checkbox")
pfUI.gui:CreateConfig(pfUI.gui.uf, "Player buff position", pfUI_config.unitframes.player, "buffs", "dropdown", { "top", "bottom", "hide"})
pfUI.gui:CreateConfig(pfUI.gui.uf, "Target width", pfUI_config.unitframes.target, "width")
pfUI.gui:CreateConfig(pfUI.gui.uf, "Target height", pfUI_config.unitframes.target, "height")
pfUI.gui:CreateConfig(pfUI.gui.uf, "Target powerbar height", pfUI_config.unitframes.target, "pheight")
pfUI.gui:CreateConfig(pfUI.gui.uf, "Target powerbar spacing", pfUI_config.unitframes.target, "pspace")
pfUI.gui:CreateConfig(pfUI.gui.uf, "Target buff position", pfUI_config.unitframes.target, "buffs", "dropdown", { "top", "bottom", "hide"})
pfUI.gui:CreateConfig(pfUI.gui.uf, "TargetTarget powerbar spacing", pfUI_config.unitframes.ttarget, "pspace")
pfUI.gui:CreateConfig(pfUI.gui.uf, "Pet powerbar spacing", pfUI_config.unitframes.pet, "pspace")
pfUI.gui:CreateConfig(pfUI.gui.uf, "Group powerbar spacing", pfUI_config.unitframes.group, "pspace")
+46 -5
View File
@@ -307,9 +307,30 @@ pfUI:RegisterModule("player", function ()
pfUI.uf.player.buff.buffs[i]:RegisterForClicks("RightButtonUp")
pfUI.uf.player.buff.buffs[i]:ClearAllPoints()
pfUI.uf.player.buff.buffs[i]:SetPoint("BOTTOMLEFT", pfUI.uf.player, "TOPLEFT",
local invert, af, as
if pfUI_config.unitframes.player.buffs == "top" then
invert = 1
af = "BOTTOMLEFT"
as = "TOPLEFT"
elseif pfUI_config.unitframes.player.buffs == "bottom" then
invert = -1
af = "TOPLEFT"
as = "BOTTOMLEFT"
else
-- set fallback values
invert = 1
af = "BOTTOMLEFT"
as = "TOPLEFT"
-- disable bufs
pfUI.uf.player.buff.buffs[i]:Hide()
pfUI.uf.player.buff:UnregisterAllEvents()
end
pfUI.uf.player.buff.buffs[i]:SetPoint(af, pfUI.uf.player, as,
(i-1-8*row)*((2*default_border) + pfUI_config.unitframes.buff_size + 1),
(row)*((2*default_border) + pfUI_config.unitframes.buff_size + 1) + 2*default_border + 1)
invert * (row)*((2*default_border) + pfUI_config.unitframes.buff_size + 1) + invert*(2*default_border + 1))
pfUI.uf.player.buff.buffs[i]:SetWidth(pfUI_config.unitframes.buff_size)
pfUI.uf.player.buff.buffs[i]:SetHeight(pfUI_config.unitframes.buff_size)
pfUI.uf.player.buff.buffs[i]:SetScript("OnEnter", function()
@@ -444,10 +465,30 @@ pfUI:RegisterModule("player", function ()
if pfUI.uf.player.buff.buffs[9]:IsShown() then top = top + 1 end
pfUI.uf.player.debuff.debuffs[i]:SetPoint("BOTTOMLEFT", pfUI.uf.player, "TOPLEFT",
local invert, af, as
if pfUI_config.unitframes.player.buffs == "top" then
invert = 1
af = "BOTTOMLEFT"
as = "TOPLEFT"
elseif pfUI_config.unitframes.player.buffs == "bottom" then
invert = -1
af = "TOPLEFT"
as = "BOTTOMLEFT"
else
-- set fallback values
invert = 1
af = "BOTTOMLEFT"
as = "TOPLEFT"
-- disable bufs
pfUI.uf.player.debuff.debuffs[i]:Hide()
pfUI.uf.player.debuff:UnregisterAllEvents()
end
pfUI.uf.player.debuff.debuffs[i]:SetPoint(af, pfUI.uf.player, as,
(i-1-8*row)*((2*default_border) + pfUI_config.unitframes.debuff_size + 1),
(top)*((2*default_border) + pfUI_config.unitframes.buff_size + 1) +
(row)*((2*default_border) + pfUI_config.unitframes.debuff_size + 1) + (2*default_border + 1))
invert * (top)*((2*default_border) + pfUI_config.unitframes.buff_size + 1) +
invert * (row)*((2*default_border) + pfUI_config.unitframes.debuff_size + 1) + invert*(2*default_border + 1))
local stacks = GetPlayerBuffApplications(GetPlayerBuff(i-1,"HARMFUL"))
+46 -5
View File
@@ -387,9 +387,30 @@ pfUI:RegisterModule("target", function ()
pfUI.uf.target.buff.buffs[i]:RegisterForClicks("RightButtonUp")
pfUI.uf.target.buff.buffs[i]:ClearAllPoints()
pfUI.uf.target.buff.buffs[i]:SetPoint("BOTTOMLEFT", pfUI.uf.target, "TOPLEFT",
local invert, af, as
if pfUI_config.unitframes.target.buffs == "top" then
invert = 1
af = "BOTTOMLEFT"
as = "TOPLEFT"
elseif pfUI_config.unitframes.target.buffs == "bottom" then
invert = -1
af = "TOPLEFT"
as = "BOTTOMLEFT"
else
-- set fallback values
invert = 1
af = "BOTTOMLEFT"
as = "TOPLEFT"
-- disable bufs
pfUI.uf.target.buff.buffs[i]:Hide()
pfUI.uf.target.buff:UnregisterAllEvents()
end
pfUI.uf.target.buff.buffs[i]:SetPoint(af, pfUI.uf.target, as,
(i-1-8*row)*((2*default_border) + pfUI_config.unitframes.buff_size + 1),
(row)*((2*default_border) + pfUI_config.unitframes.buff_size + 1) + 2*default_border + 1)
invert * (row)*((2*default_border) + pfUI_config.unitframes.buff_size + 1) + invert*(2*default_border + 1))
pfUI.uf.target.buff.buffs[i]:SetWidth(pfUI_config.unitframes.buff_size)
pfUI.uf.target.buff.buffs[i]:SetHeight(pfUI_config.unitframes.buff_size)
pfUI.uf.target.buff.buffs[i]:SetNormalTexture(nil)
@@ -470,10 +491,30 @@ pfUI:RegisterModule("target", function ()
if pfUI.uf.target.buff.buffs[1]:IsShown() then top = top + 1 end
if pfUI.uf.target.buff.buffs[9]:IsShown() then top = top + 1 end
pfUI.uf.target.debuff.debuffs[i]:SetPoint("BOTTOMLEFT", pfUI.uf.target, "TOPLEFT",
local invert, af, as
if pfUI_config.unitframes.target.buffs == "top" then
invert = 1
af = "BOTTOMLEFT"
as = "TOPLEFT"
elseif pfUI_config.unitframes.target.buffs == "bottom" then
invert = -1
af = "TOPLEFT"
as = "BOTTOMLEFT"
else
-- set fallback values
invert = 1
af = "BOTTOMLEFT"
as = "TOPLEFT"
-- disable bufs
pfUI.uf.target.debuff.debuffs[i]:Hide()
pfUI.uf.target.debuff:UnregisterAllEvents()
end
pfUI.uf.target.debuff.debuffs[i]:SetPoint(af, pfUI.uf.target, as,
(i-1-8*row)*((2*default_border) + pfUI_config.unitframes.debuff_size + 1),
(top)*((2*default_border) + pfUI_config.unitframes.buff_size + 1) +
(row)*((2*default_border) + pfUI_config.unitframes.debuff_size + 1) + (2*default_border + 1))
invert * (top)*((2*default_border) + pfUI_config.unitframes.buff_size + 1) +
invert * (row)*((2*default_border) + pfUI_config.unitframes.debuff_size + 1) + invert * (2*default_border + 1))
local texture, stacks = UnitDebuff("target",i)
pfUI.utils:CreateBackdrop(pfUI.uf.target.debuff.debuffs[i], default_border)