forked from wow/OmicronFrames
Make status colors configurable
The aura based status colors can now be configured in frames.lua. This is important in TBC where some healers don't care about e.g. magic debuffs.
This commit is contained in:
1 parent
949e3686aa
commit
99f3a10ede
2 files changed
+65
-21
No files matched your search
+18
-21
@@ -50,12 +50,6 @@ local colors = {
|
||||
low = { 1.0, 0.0, 0 },
|
||||
offline = { 0.7, 0.7, 0.7 },
|
||||
dead = { 0.7, 0.7, 0.7 },
|
||||
magic = { 0.4, 0.4, 1.0 },
|
||||
disease = { 0.4, 0.2, 0.0 },
|
||||
poison = { 0.0, 0.7, 0.7 },
|
||||
curse = { 0.7, 0.0, 0.7 },
|
||||
immune = { 0.0, 0.2, 0.4 },
|
||||
bomb = { 1.0, 0.7, 0.7 },
|
||||
cyan = { 0.0, 0.8, 0.8 },
|
||||
white = { 1.0, 1.0, 1.0 },
|
||||
shield = { 0.85, 0.95, 1.0 },
|
||||
@@ -90,6 +84,8 @@ function UnitFrame:Init(unit, config)
|
||||
self.rangeEnemy = config.range.enemy
|
||||
self.rangeFade = config.range.fade
|
||||
|
||||
self.statusColors = config.statusColors
|
||||
|
||||
local secure = self:CreateSecureFrame(width, height)
|
||||
secure:Hide()
|
||||
|
||||
@@ -652,23 +648,24 @@ function UnitFrame:UpdateHealthColor()
|
||||
|
||||
if not isFriend then
|
||||
self.hp:SetColor(unpack(colors.hostile))
|
||||
elseif self.auras.statusCount["Immune"] then
|
||||
self.hp:SetColor(unpack(colors.immune))
|
||||
elseif self.auras.statusCount["Bomb"] then
|
||||
self.hp:SetColor(unpack(colors.bomb))
|
||||
elseif self.auras.statusCount["Magic"] then
|
||||
self.hp:SetColor(unpack(colors.magic))
|
||||
elseif self.auras.statusCount["Curse"] then
|
||||
self.hp:SetColor(unpack(colors.curse))
|
||||
elseif self.auras.statusCount["Poison"] then
|
||||
self.hp:SetColor(unpack(colors.poison))
|
||||
elseif self.auras.statusCount["Disease"] then
|
||||
self.hp:SetColor(unpack(colors.disease))
|
||||
elseif isFriend and UnitIsDead(unit) then
|
||||
return
|
||||
end
|
||||
|
||||
local statusColor = nil
|
||||
for _, entry in ipairs(self.statusColors) do
|
||||
if self.auras.statusCount[entry.status] then
|
||||
statusColor = entry.color
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
if statusColor then
|
||||
self.hp:SetColor(unpack(statusColor))
|
||||
elseif UnitIsDead(unit) then
|
||||
self.hp:SetColor(unpack(colors.dead))
|
||||
elseif isFriend and pct >= 0.90 then
|
||||
elseif pct >= 0.90 then
|
||||
self.hp:SetColor(unpack(colors.healthy))
|
||||
elseif isFriend and pct >= 0.75 then
|
||||
elseif pct >= 0.75 then
|
||||
local progress = (pct - 0.75) / (0.90 - 0.75)
|
||||
self.hp:SetInterpolatedColor(colors.mid, colors.high, progress)
|
||||
else
|
||||
|
||||
Reference in new issue
Block a user