mirror of
https://github.com/brues-code/pfUI.git
synced 2026-09-26 17:36:04 +00:00
unitframes: option to use custom colors per frame
This commit is contained in:
@@ -245,6 +245,12 @@ function pfUI:LoadConfig()
|
||||
pfUI:UpdateConfig("unitframes", "player", "hitindicator", "0")
|
||||
pfUI:UpdateConfig("unitframes", "player", "hitindicatorsize", "15")
|
||||
pfUI:UpdateConfig("unitframes", "player", "hitindicatorfont", "Interface\\AddOns\\pfUI\\fonts\\Continuum.ttf")
|
||||
pfUI:UpdateConfig("unitframes", "player", "defcolor", "1")
|
||||
pfUI:UpdateConfig("unitframes", "player", "custom", "0")
|
||||
pfUI:UpdateConfig("unitframes", "player", "customfullhp", "0")
|
||||
pfUI:UpdateConfig("unitframes", "player", "customcolor", ".2,.2,.2,1")
|
||||
pfUI:UpdateConfig("unitframes", "player", "custombg", "0")
|
||||
pfUI:UpdateConfig("unitframes", "player", "custombgcolor", ".5,.2,.2,1")
|
||||
|
||||
pfUI:UpdateConfig("unitframes", "target", "visible", "1")
|
||||
pfUI:UpdateConfig("unitframes", "target", "showPVP", "0")
|
||||
@@ -292,6 +298,12 @@ function pfUI:LoadConfig()
|
||||
pfUI:UpdateConfig("unitframes", "target", "hitindicator", "0")
|
||||
pfUI:UpdateConfig("unitframes", "target", "hitindicatorsize", "15")
|
||||
pfUI:UpdateConfig("unitframes", "target", "hitindicatorfont", "Interface\\AddOns\\pfUI\\fonts\\Continuum.ttf")
|
||||
pfUI:UpdateConfig("unitframes", "target", "defcolor", "1")
|
||||
pfUI:UpdateConfig("unitframes", "target", "custom", "0")
|
||||
pfUI:UpdateConfig("unitframes", "target", "customfullhp", "0")
|
||||
pfUI:UpdateConfig("unitframes", "target", "customcolor", ".2,.2,.2,1")
|
||||
pfUI:UpdateConfig("unitframes", "target", "custombg", "0")
|
||||
pfUI:UpdateConfig("unitframes", "target", "custombgcolor", ".5,.2,.2,1")
|
||||
|
||||
pfUI:UpdateConfig("unitframes", "focus", "visible", "1")
|
||||
pfUI:UpdateConfig("unitframes", "focus", "showPVP", "0")
|
||||
@@ -338,6 +350,12 @@ function pfUI:LoadConfig()
|
||||
pfUI:UpdateConfig("unitframes", "focus", "hitindicator", "0")
|
||||
pfUI:UpdateConfig("unitframes", "focus", "hitindicatorsize", "15")
|
||||
pfUI:UpdateConfig("unitframes", "focus", "hitindicatorfont", "Interface\\AddOns\\pfUI\\fonts\\Continuum.ttf")
|
||||
pfUI:UpdateConfig("unitframes", "focus", "defcolor", "1")
|
||||
pfUI:UpdateConfig("unitframes", "focus", "custom", "0")
|
||||
pfUI:UpdateConfig("unitframes", "focus", "customfullhp", "0")
|
||||
pfUI:UpdateConfig("unitframes", "focus", "customcolor", ".2,.2,.2,1")
|
||||
pfUI:UpdateConfig("unitframes", "focus", "custombg", "0")
|
||||
pfUI:UpdateConfig("unitframes", "focus", "custombgcolor", ".5,.2,.2,1")
|
||||
|
||||
pfUI:UpdateConfig("unitframes", "group", "visible", "1")
|
||||
pfUI:UpdateConfig("unitframes", "group", "showPVP", "0")
|
||||
@@ -385,6 +403,12 @@ function pfUI:LoadConfig()
|
||||
pfUI:UpdateConfig("unitframes", "group", "hitindicator", "0")
|
||||
pfUI:UpdateConfig("unitframes", "group", "hitindicatorsize", "15")
|
||||
pfUI:UpdateConfig("unitframes", "group", "hitindicatorfont", "Interface\\AddOns\\pfUI\\fonts\\Continuum.ttf")
|
||||
pfUI:UpdateConfig("unitframes", "group", "defcolor", "1")
|
||||
pfUI:UpdateConfig("unitframes", "group", "custom", "0")
|
||||
pfUI:UpdateConfig("unitframes", "group", "customfullhp", "0")
|
||||
pfUI:UpdateConfig("unitframes", "group", "customcolor", ".2,.2,.2,1")
|
||||
pfUI:UpdateConfig("unitframes", "group", "custombg", "0")
|
||||
pfUI:UpdateConfig("unitframes", "group", "custombgcolor", ".5,.2,.2,1")
|
||||
|
||||
pfUI:UpdateConfig("unitframes", "grouptarget", "visible", "1")
|
||||
pfUI:UpdateConfig("unitframes", "grouptarget", "showPVP", "0")
|
||||
@@ -431,6 +455,12 @@ function pfUI:LoadConfig()
|
||||
pfUI:UpdateConfig("unitframes", "grouptarget", "hitindicator", "0")
|
||||
pfUI:UpdateConfig("unitframes", "grouptarget", "hitindicatorsize", "15")
|
||||
pfUI:UpdateConfig("unitframes", "grouptarget", "hitindicatorfont", "Interface\\AddOns\\pfUI\\fonts\\Continuum.ttf")
|
||||
pfUI:UpdateConfig("unitframes", "grouptarget", "defcolor", "1")
|
||||
pfUI:UpdateConfig("unitframes", "grouptarget", "custom", "0")
|
||||
pfUI:UpdateConfig("unitframes", "grouptarget", "customfullhp", "0")
|
||||
pfUI:UpdateConfig("unitframes", "grouptarget", "customcolor", ".2,.2,.2,1")
|
||||
pfUI:UpdateConfig("unitframes", "grouptarget", "custombg", "0")
|
||||
pfUI:UpdateConfig("unitframes", "grouptarget", "custombgcolor", ".5,.2,.2,1")
|
||||
|
||||
pfUI:UpdateConfig("unitframes", "grouppet", "visible", "1")
|
||||
pfUI:UpdateConfig("unitframes", "grouppet", "showPVP", "0")
|
||||
@@ -477,6 +507,12 @@ function pfUI:LoadConfig()
|
||||
pfUI:UpdateConfig("unitframes", "grouppet", "hitindicator", "0")
|
||||
pfUI:UpdateConfig("unitframes", "grouppet", "hitindicatorsize", "15")
|
||||
pfUI:UpdateConfig("unitframes", "grouppet", "hitindicatorfont", "Interface\\AddOns\\pfUI\\fonts\\Continuum.ttf")
|
||||
pfUI:UpdateConfig("unitframes", "grouppet", "defcolor", "1")
|
||||
pfUI:UpdateConfig("unitframes", "grouppet", "custom", "0")
|
||||
pfUI:UpdateConfig("unitframes", "grouppet", "customfullhp", "0")
|
||||
pfUI:UpdateConfig("unitframes", "grouppet", "customcolor", ".2,.2,.2,1")
|
||||
pfUI:UpdateConfig("unitframes", "grouppet", "custombg", "0")
|
||||
pfUI:UpdateConfig("unitframes", "grouppet", "custombgcolor", ".5,.2,.2,1")
|
||||
|
||||
pfUI:UpdateConfig("unitframes", "raid", "visible", "1")
|
||||
pfUI:UpdateConfig("unitframes", "raid", "showPVP", "0")
|
||||
@@ -523,6 +559,12 @@ function pfUI:LoadConfig()
|
||||
pfUI:UpdateConfig("unitframes", "raid", "hitindicator", "0")
|
||||
pfUI:UpdateConfig("unitframes", "raid", "hitindicatorsize", "15")
|
||||
pfUI:UpdateConfig("unitframes", "raid", "hitindicatorfont", "Interface\\AddOns\\pfUI\\fonts\\Continuum.ttf")
|
||||
pfUI:UpdateConfig("unitframes", "raid", "defcolor", "1")
|
||||
pfUI:UpdateConfig("unitframes", "raid", "custom", "0")
|
||||
pfUI:UpdateConfig("unitframes", "raid", "customfullhp", "0")
|
||||
pfUI:UpdateConfig("unitframes", "raid", "customcolor", ".2,.2,.2,1")
|
||||
pfUI:UpdateConfig("unitframes", "raid", "custombg", "0")
|
||||
pfUI:UpdateConfig("unitframes", "raid", "custombgcolor", ".5,.2,.2,1")
|
||||
|
||||
pfUI:UpdateConfig("unitframes", "ttarget", "visible", "1")
|
||||
pfUI:UpdateConfig("unitframes", "ttarget", "showPVP", "0")
|
||||
@@ -569,6 +611,12 @@ function pfUI:LoadConfig()
|
||||
pfUI:UpdateConfig("unitframes", "ttarget", "hitindicator", "0")
|
||||
pfUI:UpdateConfig("unitframes", "ttarget", "hitindicatorsize", "15")
|
||||
pfUI:UpdateConfig("unitframes", "ttarget", "hitindicatorfont", "Interface\\AddOns\\pfUI\\fonts\\Continuum.ttf")
|
||||
pfUI:UpdateConfig("unitframes", "ttarget", "defcolor", "1")
|
||||
pfUI:UpdateConfig("unitframes", "ttarget", "custom", "0")
|
||||
pfUI:UpdateConfig("unitframes", "ttarget", "customfullhp", "0")
|
||||
pfUI:UpdateConfig("unitframes", "ttarget", "customcolor", ".2,.2,.2,1")
|
||||
pfUI:UpdateConfig("unitframes", "ttarget", "custombg", "0")
|
||||
pfUI:UpdateConfig("unitframes", "ttarget", "custombgcolor", ".5,.2,.2,1")
|
||||
|
||||
pfUI:UpdateConfig("unitframes", "pet", "visible", "1")
|
||||
pfUI:UpdateConfig("unitframes", "pet", "showPVP", "0")
|
||||
@@ -615,6 +663,12 @@ function pfUI:LoadConfig()
|
||||
pfUI:UpdateConfig("unitframes", "pet", "hitindicator", "0")
|
||||
pfUI:UpdateConfig("unitframes", "pet", "hitindicatorsize", "15")
|
||||
pfUI:UpdateConfig("unitframes", "pet", "hitindicatorfont", "Interface\\AddOns\\pfUI\\fonts\\Continuum.ttf")
|
||||
pfUI:UpdateConfig("unitframes", "pet", "defcolor", "1")
|
||||
pfUI:UpdateConfig("unitframes", "pet", "custom", "0")
|
||||
pfUI:UpdateConfig("unitframes", "pet", "customfullhp", "0")
|
||||
pfUI:UpdateConfig("unitframes", "pet", "customcolor", ".2,.2,.2,1")
|
||||
pfUI:UpdateConfig("unitframes", "pet", "custombg", "0")
|
||||
pfUI:UpdateConfig("unitframes", "pet", "custombgcolor", ".5,.2,.2,1")
|
||||
|
||||
pfUI:UpdateConfig("unitframes", "ptarget", "visible", "0")
|
||||
pfUI:UpdateConfig("unitframes", "ptarget", "showPVP", "0")
|
||||
@@ -661,6 +715,12 @@ function pfUI:LoadConfig()
|
||||
pfUI:UpdateConfig("unitframes", "ptarget", "hitindicator", "0")
|
||||
pfUI:UpdateConfig("unitframes", "ptarget", "hitindicatorsize", "15")
|
||||
pfUI:UpdateConfig("unitframes", "ptarget", "hitindicatorfont", "Interface\\AddOns\\pfUI\\fonts\\Continuum.ttf")
|
||||
pfUI:UpdateConfig("unitframes", "ptarget", "defcolor", "1")
|
||||
pfUI:UpdateConfig("unitframes", "ptarget", "custom", "0")
|
||||
pfUI:UpdateConfig("unitframes", "ptarget", "customfullhp", "0")
|
||||
pfUI:UpdateConfig("unitframes", "ptarget", "customcolor", ".2,.2,.2,1")
|
||||
pfUI:UpdateConfig("unitframes", "ptarget", "custombg", "0")
|
||||
pfUI:UpdateConfig("unitframes", "ptarget", "custombgcolor", ".5,.2,.2,1")
|
||||
|
||||
pfUI:UpdateConfig("unitframes", "fallback", "visible", "1")
|
||||
pfUI:UpdateConfig("unitframes", "fallback", "showPVP", "0")
|
||||
@@ -707,6 +767,12 @@ function pfUI:LoadConfig()
|
||||
pfUI:UpdateConfig("unitframes", "fallback", "hitindicator", "0")
|
||||
pfUI:UpdateConfig("unitframes", "fallback", "hitindicatorsize", "15")
|
||||
pfUI:UpdateConfig("unitframes", "fallback", "hitindicatorfont", "Interface\\AddOns\\pfUI\\fonts\\Continuum.ttf")
|
||||
pfUI:UpdateConfig("unitframes", "fallback", "defcolor", "1")
|
||||
pfUI:UpdateConfig("unitframes", "fallback", "custom", "0")
|
||||
pfUI:UpdateConfig("unitframes", "fallback", "customfullhp", "0")
|
||||
pfUI:UpdateConfig("unitframes", "fallback", "customcolor", ".2,.2,.2,1")
|
||||
pfUI:UpdateConfig("unitframes", "fallback", "custombg", "0")
|
||||
pfUI:UpdateConfig("unitframes", "fallback", "custombgcolor", ".5,.2,.2,1")
|
||||
|
||||
pfUI:UpdateConfig("bars", "bar1", "pageable", "1")
|
||||
pfUI:UpdateConfig("bars", "bar2", "pageable", "1")
|
||||
|
||||
+20
-12
@@ -240,8 +240,11 @@ function pfUI.uf:UpdateConfig()
|
||||
f.hp.bar:SetOrientation("HORIZONTAL")
|
||||
end
|
||||
|
||||
if C.unitframes.custombg == "1" then
|
||||
local cr, cg, cb, ca = pfUI.api.strsplit(",", C.unitframes.custombgcolor)
|
||||
local custombg = f.config.defcolor == "0" and f.config.custombg or C.unitframes.custombg
|
||||
local custombgcolor = f.config.defcolor == "0" and f.config.custombgcolor or C.unitframes.custombgcolor
|
||||
|
||||
if custombg == "1" then
|
||||
local cr, cg, cb, ca = pfUI.api.strsplit(",", custombgcolor)
|
||||
cr, cg, cb, ca = tonumber(cr), tonumber(cg), tonumber(cb), tonumber(ca)
|
||||
f.hp.bar.texture = f.hp.bar.texture or f.hp:CreateTexture(nil,"BACKGROUND")
|
||||
f.hp.bar.texture:SetTexture(cr,cg,cb,ca)
|
||||
@@ -1493,11 +1496,16 @@ function pfUI.uf:RefreshUnit(unit, component)
|
||||
end
|
||||
|
||||
local r, g, b, a = .2, .2, .2, 1
|
||||
local custom = nil
|
||||
if C.unitframes.customfullhp == "1" and UnitHealth(unitstr) == UnitHealthMax(unitstr) then
|
||||
r, g, b, a = pfUI.api.strsplit(",", C.unitframes.customcolor)
|
||||
custom = true
|
||||
elseif C.unitframes.custom == "0" then
|
||||
|
||||
local custom_active = nil
|
||||
local customfullhp = unit.config.defcolor == "0" and unit.config.customfullhp or C.unitframes.customfullhp
|
||||
local customcolor = unit.config.defcolor == "0" and unit.config.customcolor or C.unitframes.customcolor
|
||||
local custom = unit.config.defcolor == "0" and unit.config.custom or C.unitframes.custom
|
||||
|
||||
if customfullhp == "1" and UnitHealth(unitstr) == UnitHealthMax(unitstr) then
|
||||
r, g, b, a = pfUI.api.strsplit(",", customcolor)
|
||||
custom_active = true
|
||||
elseif custom == "0" then
|
||||
if UnitIsPlayer(unitstr) then
|
||||
local _, class = UnitClass(unitstr)
|
||||
local color = RAID_CLASS_COLORS[class]
|
||||
@@ -1515,10 +1523,10 @@ function pfUI.uf:RefreshUnit(unit, component)
|
||||
local color = UnitReactionColor[UnitReaction(unitstr, "player")]
|
||||
if color then r, g, b = color.r, color.g, color.b end
|
||||
end
|
||||
elseif C.unitframes.custom == "1" then
|
||||
r, g, b, a = pfUI.api.strsplit(",", C.unitframes.customcolor)
|
||||
custom = true
|
||||
elseif C.unitframes.custom == "2" then
|
||||
elseif custom == "1" then
|
||||
r, g, b, a = pfUI.api.strsplit(",", customcolor)
|
||||
custom_active = true
|
||||
elseif custom == "2" then
|
||||
if UnitHealthMax(unitstr) > 0 then
|
||||
r, g, b = GetColorGradient(UnitHealth(unitstr) / UnitHealthMax(unitstr))
|
||||
else
|
||||
@@ -1526,7 +1534,7 @@ function pfUI.uf:RefreshUnit(unit, component)
|
||||
end
|
||||
end
|
||||
|
||||
if C.unitframes.pastel == "1" and not custom then
|
||||
if C.unitframes.pastel == "1" and not custom_active then
|
||||
r, g, b = (r + .5) * .5, (g + .5) * .5, (b + .5) * .5
|
||||
end
|
||||
|
||||
|
||||
+12
-4
@@ -1525,10 +1525,10 @@ pfUI:RegisterModule("gui", 20400, function ()
|
||||
CreateConfig(U[c], T["Combat Text Size"], C.unitframes[c], "hitindicatorsize")
|
||||
|
||||
CreateConfig(U[c], T["Text Colors"], nil, nil, "header")
|
||||
CreateConfig(U[c], T["Enable Health Color"], C.unitframes[c], "healthcolor", "checkbox")
|
||||
CreateConfig(U[c], T["Enable Power Color"], C.unitframes[c], "powercolor", "checkbox")
|
||||
CreateConfig(U[c], T["Enable Level Color"], C.unitframes[c], "levelcolor", "checkbox")
|
||||
CreateConfig(U[c], T["Enable Class Color"], C.unitframes[c], "classcolor", "checkbox")
|
||||
CreateConfig(U[c], T["Automatic Health Text Color"], C.unitframes[c], "healthcolor", "checkbox")
|
||||
CreateConfig(U[c], T["Automatic Power Text Color"], C.unitframes[c], "powercolor", "checkbox")
|
||||
CreateConfig(U[c], T["Automatic Level Text Color"], C.unitframes[c], "levelcolor", "checkbox")
|
||||
CreateConfig(U[c], T["Automatic Class Text Color"], C.unitframes[c], "classcolor", "checkbox")
|
||||
|
||||
CreateConfig(U[c], T["Debuff Indicators"], nil, nil, "header")
|
||||
CreateConfig(U[c], T["Debuff Indicator Display"], C.unitframes[c], "debuff_indicator", "dropdown", pfUI.gui.dropdowns.uf_debuff_indicator)
|
||||
@@ -1546,6 +1546,14 @@ pfUI:RegisterModule("gui", 20400, function ()
|
||||
CreateConfig(U[c], T["Debuff Size"], C.unitframes[c], "debuffsize")
|
||||
CreateConfig(U[c], T["Debuff Limit"], C.unitframes[c], "debufflimit")
|
||||
CreateConfig(U[c], T["Debuffs Per Row"], C.unitframes[c], "debuffperrow")
|
||||
|
||||
CreateConfig(U[c], T["Overwrite Colors"], nil, nil, "header")
|
||||
CreateConfig(U[c], T["Inherit Default Colors"], C.unitframes[c], "defcolor", "checkbox")
|
||||
CreateConfig(U[c], T["Health Bar Color"], C.unitframes[c], "custom", "dropdown", pfUI.gui.dropdowns.uf_color)
|
||||
CreateConfig(U[c], T["Custom Health Bar Color"], C.unitframes[c], "customcolor", "color")
|
||||
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")
|
||||
end)
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user