From 8d91394259287c126ccf0a54857ba642ad780890 Mon Sep 17 00:00:00 2001 From: shagu Date: Thu, 19 Dec 2019 19:44:37 +0100 Subject: [PATCH] unitframes: option for custom powerbar background --- api/config.lua | 4 ++++ api/unitframes.lua | 11 +++++++++++ modules/gui.lua | 4 ++++ 3 files changed, 19 insertions(+) diff --git a/api/config.lua b/api/config.lua index cd99d012..17637fd6 100644 --- a/api/config.lua +++ b/api/config.lua @@ -174,6 +174,8 @@ function pfUI:LoadConfig() pfUI:UpdateConfig("unitframes", nil, "customcolor", ".2,.2,.2,1") pfUI:UpdateConfig("unitframes", nil, "custombg", "0") pfUI:UpdateConfig("unitframes", nil, "custombgcolor", ".5,.2,.2,1") + pfUI:UpdateConfig("unitframes", nil, "custompbg", "0") + pfUI:UpdateConfig("unitframes", nil, "custompbgcolor", ".5,.2,.2,1") pfUI:UpdateConfig("unitframes", nil, "manacolor", ".5,.5,1,1") pfUI:UpdateConfig("unitframes", nil, "energycolor", "1,1,.5,1") pfUI:UpdateConfig("unitframes", nil, "ragecolor", "1,.5,.5,1") @@ -360,6 +362,8 @@ function pfUI:LoadConfig() pfUI:UpdateConfig("unitframes", unit, "customcolor", ".2,.2,.2,1") pfUI:UpdateConfig("unitframes", unit, "custombg", "0") pfUI:UpdateConfig("unitframes", unit, "custombgcolor", ".5,.2,.2,1") + pfUI:UpdateConfig("unitframes", unit, "custompbg", "0") + pfUI:UpdateConfig("unitframes", unit, "custompbgcolor", ".5,.2,.2,1") pfUI:UpdateConfig("unitframes", unit, "manacolor", ".5,.5,1,1") pfUI:UpdateConfig("unitframes", unit, "energycolor", "1,1,.5,1") pfUI:UpdateConfig("unitframes", unit, "ragecolor", "1,.5,.5,1") diff --git a/api/unitframes.lua b/api/unitframes.lua index edb6229c..d7c31d0c 100644 --- a/api/unitframes.lua +++ b/api/unitframes.lua @@ -324,6 +324,17 @@ function pfUI.uf:UpdateConfig() f.power.bar:SetAllPoints(f.power) f.power.bar:SetFrameStrata("LOW") + local custompbg = f.config.defcolor == "0" and f.config.custompbg or C.unitframes.custompbg + local custompbgcolor = f.config.defcolor == "0" and f.config.custompbgcolor or C.unitframes.custompbgcolor + + if custompbg == "1" then + local cr, cg, cb, ca = pfUI.api.strsplit(",", custompbgcolor) + cr, cg, cb, ca = tonumber(cr), tonumber(cg), tonumber(cb), tonumber(ca) + f.power.bar.texture = f.power.bar.texture or f.hp:CreateTexture(nil,"BACKGROUND") + f.power.bar.texture:SetTexture(cr,cg,cb,ca) + f.power.bar.texture:SetAllPoints(f.power.bar) + end + f.portrait:SetFrameStrata("LOW") f.portrait.tex:SetAllPoints(f.portrait) f.portrait.tex:SetTexCoord(.1, .9, .1, .9) diff --git a/modules/gui.lua b/modules/gui.lua index 21154abc..9751d5b7 100644 --- a/modules/gui.lua +++ b/modules/gui.lua @@ -1471,6 +1471,8 @@ pfUI:RegisterModule("gui", "vanilla:tbc", function () CreateConfig(nil, T["Use Custom Color On Full Health"], C.unitframes, "customfullhp", "checkbox") CreateConfig(nil, T["Enable Custom Color Health Bar Background"], C.unitframes, "custombg", "checkbox") CreateConfig(nil, T["Custom Health Bar Background Color"], C.unitframes, "custombgcolor", "color") + CreateConfig(nil, T["Enable Custom Color Power Bar Background"], C.unitframes, "custompbg", "checkbox") + CreateConfig(nil, T["Custom Power Bar Background Color"], C.unitframes, "custompbgcolor", "color") CreateConfig(nil, T["Mana Color"], C.unitframes, "manacolor", "color") CreateConfig(nil, T["Rage Color"], C.unitframes, "ragecolor", "color") CreateConfig(nil, T["Energy Color"], C.unitframes, "energycolor", "color") @@ -1602,6 +1604,8 @@ pfUI:RegisterModule("gui", "vanilla:tbc", function () CreateConfig(U[c], T["Use Custom Color On Full Health"], C.unitframes[c], "customfullhp", "checkbox") CreateConfig(U[c], T["Custom Health Bar Background Color"], C.unitframes[c], "custombgcolor", "color") CreateConfig(U[c], T["Use Custom Color Health Bar Background"], C.unitframes[c], "custombg", "checkbox") + CreateConfig(U[c], T["Custom Power Bar Background Color"], C.unitframes[c], "custompbgcolor", "color") + CreateConfig(U[c], T["Use Custom Color Power Bar Background"], C.unitframes[c], "custompbg", "checkbox") CreateConfig(U[c], T["Mana Color"], C.unitframes[c], "manacolor", "color") CreateConfig(U[c], T["Rage Color"], C.unitframes[c], "ragecolor", "color") CreateConfig(U[c], T["Energy Color"], C.unitframes[c], "energycolor", "color")