mirror of
https://github.com/brues-code/pfUI.git
synced 2026-09-28 02:16:02 +00:00
unitframes: option to use variable health bg color
This commit is contained in:
@@ -166,6 +166,7 @@ function pfUI:LoadConfig()
|
||||
pfUI:UpdateConfig("unitframes", nil, "disable", "0")
|
||||
pfUI:UpdateConfig("unitframes", nil, "pastel", "1")
|
||||
pfUI:UpdateConfig("unitframes", nil, "custom", "0")
|
||||
pfUI:UpdateConfig("unitframes", nil, "customfullhp", "0")
|
||||
pfUI:UpdateConfig("unitframes", nil, "customcolor", ".2,.2,.2,1")
|
||||
pfUI:UpdateConfig("unitframes", nil, "custombg", "0")
|
||||
pfUI:UpdateConfig("unitframes", nil, "custombgcolor", ".5,.2,.2,1")
|
||||
|
||||
+30
-17
@@ -1481,27 +1481,40 @@ function pfUI.uf:RefreshUnit(unit, component)
|
||||
end
|
||||
|
||||
local r, g, b, a = .2, .2, .2, 1
|
||||
if UnitIsPlayer(unitstr) then
|
||||
local _, class = UnitClass(unitstr)
|
||||
local color = RAID_CLASS_COLORS[class]
|
||||
if color then r, g, b = color.r, color.g, color.b end
|
||||
elseif unit.label == "pet" then
|
||||
local happiness = GetPetHappiness()
|
||||
if happiness == 1 then
|
||||
r, g, b = 1, 0, 0
|
||||
elseif happiness == 2 then
|
||||
r, g, b = 1, 1, 0
|
||||
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
|
||||
if UnitIsPlayer(unitstr) then
|
||||
local _, class = UnitClass(unitstr)
|
||||
local color = RAID_CLASS_COLORS[class]
|
||||
if color then r, g, b = color.r, color.g, color.b end
|
||||
elseif unit.label == "pet" then
|
||||
local happiness = GetPetHappiness()
|
||||
if happiness == 1 then
|
||||
r, g, b = 1, 0, 0
|
||||
elseif happiness == 2 then
|
||||
r, g, b = 1, 1, 0
|
||||
else
|
||||
r, g, b = 0, 1, 0
|
||||
end
|
||||
else
|
||||
r, g, b = 0, 1, 0
|
||||
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
|
||||
if UnitHealthMax(unitstr) > 0 then
|
||||
r, g, b = GetColorGradient(UnitHealth(unitstr) / UnitHealthMax(unitstr))
|
||||
else
|
||||
r, g, b = 0, 0, 0
|
||||
end
|
||||
else
|
||||
local color = UnitReactionColor[UnitReaction(unitstr, "player")]
|
||||
if color then r, g, b = color.r, color.g, color.b end
|
||||
end
|
||||
|
||||
if C.unitframes.custom == "1" then
|
||||
r, g, b, a = pfUI.api.strsplit(",", C.unitframes.customcolor)
|
||||
elseif C.unitframes.pastel == "1" then
|
||||
if C.unitframes.pastel == "1" and not custom then
|
||||
r, g, b = (r + .5) * .5, (g + .5) * .5, (b + .5) * .5
|
||||
end
|
||||
|
||||
|
||||
+7
-1
@@ -950,6 +950,11 @@ pfUI:RegisterModule("gui", 20400, function ()
|
||||
"default:" .. T["Default"],
|
||||
"tukui:TukUI"
|
||||
},
|
||||
["uf_color"] = {
|
||||
"0:" .. T["Class"],
|
||||
"1:" .. T["Custom"],
|
||||
"2:" .. T["Health"],
|
||||
},
|
||||
["uf_texts"] = {
|
||||
"none:" .. T["Disable"],
|
||||
"unit:" .. T["Unit String"],
|
||||
@@ -1411,8 +1416,9 @@ pfUI:RegisterModule("gui", 20400, function ()
|
||||
CreateGUIEntry(T["Unit Frames"], T["General"], function()
|
||||
CreateConfig(nil, T["Disable pfUI Unit Frames"], C.unitframes, "disable", "checkbox")
|
||||
CreateConfig(nil, T["Enable Pastel Colors"], C.unitframes, "pastel", "checkbox")
|
||||
CreateConfig(nil, T["Enable Custom Color Health Bars"], C.unitframes, "custom", "checkbox")
|
||||
CreateConfig(nil, T["Health Bar Color"], C.unitframes, "custom", "dropdown", pfUI.gui.dropdowns.uf_color)
|
||||
CreateConfig(nil, T["Custom Health Bar Color"], C.unitframes, "customcolor", "color")
|
||||
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["Healthbar Animation Speed"], C.unitframes, "animation_speed", "dropdown", pfUI.gui.dropdowns.uf_animationspeed)
|
||||
|
||||
Reference in New Issue
Block a user