mirror of
https://github.com/brues-code/pfUI.git
synced 2026-09-27 01:46:03 +00:00
unitframes: option to fade health to custom color
This commit is contained in:
@@ -1800,6 +1800,7 @@ function pfUI.uf:RefreshUnit(unit, component)
|
||||
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 customfade = unit.config.defcolor == "0" and unit.config.customfade or C.unitframes.customfade
|
||||
local custom = unit.config.defcolor == "0" and unit.config.custom or C.unitframes.custom
|
||||
|
||||
local r, g, b, a = .2, .2, .2, 1
|
||||
@@ -1839,6 +1840,16 @@ function pfUI.uf:RefreshUnit(unit, component)
|
||||
r, g, b = (r + .5) * .5, (g + .5) * .5, (b + .5) * .5
|
||||
end
|
||||
|
||||
if customfade == "1" then
|
||||
-- fade custom color into default color
|
||||
local perc = UnitHealth(unitstr) / UnitHealthMax(unitstr) * 2 - 1
|
||||
local cr, cg, cb, ca = pfUI.api.strsplit(",", customcolor)
|
||||
|
||||
r = (cr*perc) + (r*(1-perc))
|
||||
g = (cr*perc) + (g*(1-perc))
|
||||
b = (cr*perc) + (b*(1-perc))
|
||||
end
|
||||
|
||||
unit.hp.bar:SetStatusBarColor(r, g, b, a)
|
||||
|
||||
-- set powerbar color
|
||||
|
||||
Reference in New Issue
Block a user