unitframes: add options to disable text-colors

This commit is contained in:
shagu
2017-06-07 19:25:50 +02:00
parent 9acd92bf4d
commit 64639ca3f0
3 changed files with 89 additions and 6 deletions
+40
View File
@@ -116,6 +116,10 @@ function pfUI:LoadConfig()
pfUI:UpdateConfig("unitframes", "player", "txtleft", "unit")
pfUI:UpdateConfig("unitframes", "player", "txtcenter", "none")
pfUI:UpdateConfig("unitframes", "player", "txtright", "healthdyn")
pfUI:UpdateConfig("unitframes", "player", "healthcolor", "1")
pfUI:UpdateConfig("unitframes", "player", "powercolor", "1")
pfUI:UpdateConfig("unitframes", "player", "levelcolor", "1")
pfUI:UpdateConfig("unitframes", "player", "classcolor", "1")
pfUI:UpdateConfig("unitframes", "player", "showPVPMinimap", "0")
pfUI:UpdateConfig("unitframes", "player", "showPVP", "0")
@@ -143,6 +147,10 @@ function pfUI:LoadConfig()
pfUI:UpdateConfig("unitframes", "target", "txtleft", "unit")
pfUI:UpdateConfig("unitframes", "target", "txtcenter", "none")
pfUI:UpdateConfig("unitframes", "target", "txtright", "healthdyn")
pfUI:UpdateConfig("unitframes", "target", "healthcolor", "1")
pfUI:UpdateConfig("unitframes", "target", "powercolor", "1")
pfUI:UpdateConfig("unitframes", "target", "levelcolor", "1")
pfUI:UpdateConfig("unitframes", "target", "classcolor", "1")
pfUI:UpdateConfig("unitframes", "target", "animation", "0")
pfUI:UpdateConfig("unitframes", "focus", "visible", "1")
@@ -167,6 +175,10 @@ function pfUI:LoadConfig()
pfUI:UpdateConfig("unitframes", "focus", "txtleft", "unit")
pfUI:UpdateConfig("unitframes", "focus", "txtcenter", "none")
pfUI:UpdateConfig("unitframes", "focus", "txtright", "healthdyn")
pfUI:UpdateConfig("unitframes", "focus", "healthcolor", "1")
pfUI:UpdateConfig("unitframes", "focus", "powercolor", "1")
pfUI:UpdateConfig("unitframes", "focus", "levelcolor", "1")
pfUI:UpdateConfig("unitframes", "focus", "classcolor", "1")
pfUI:UpdateConfig("unitframes", "group", "visible", "1")
pfUI:UpdateConfig("unitframes", "group", "portrait", "off")
@@ -190,6 +202,10 @@ function pfUI:LoadConfig()
pfUI:UpdateConfig("unitframes", "group", "txtleft", "unit")
pfUI:UpdateConfig("unitframes", "group", "txtcenter", "none")
pfUI:UpdateConfig("unitframes", "group", "txtright", "healthmiss")
pfUI:UpdateConfig("unitframes", "group", "healthcolor", "1")
pfUI:UpdateConfig("unitframes", "group", "powercolor", "1")
pfUI:UpdateConfig("unitframes", "group", "levelcolor", "1")
pfUI:UpdateConfig("unitframes", "group", "classcolor", "1")
pfUI:UpdateConfig("unitframes", "group", "hide_in_raid", "0")
pfUI:UpdateConfig("unitframes", "grouptarget", "visible", "1")
@@ -214,6 +230,10 @@ function pfUI:LoadConfig()
pfUI:UpdateConfig("unitframes", "grouptarget", "txtleft", "unit")
pfUI:UpdateConfig("unitframes", "grouptarget", "txtcenter", "none")
pfUI:UpdateConfig("unitframes", "grouptarget", "txtright", "healthperc")
pfUI:UpdateConfig("unitframes", "grouptarget", "healthcolor", "1")
pfUI:UpdateConfig("unitframes", "grouptarget", "powercolor", "1")
pfUI:UpdateConfig("unitframes", "grouptarget", "levelcolor", "1")
pfUI:UpdateConfig("unitframes", "grouptarget", "classcolor", "1")
pfUI:UpdateConfig("unitframes", "grouppet", "visible", "1")
pfUI:UpdateConfig("unitframes", "grouppet", "portrait", "off")
@@ -237,6 +257,10 @@ function pfUI:LoadConfig()
pfUI:UpdateConfig("unitframes", "grouppet", "txtleft", "unit")
pfUI:UpdateConfig("unitframes", "grouppet", "txtcenter", "none")
pfUI:UpdateConfig("unitframes", "grouppet", "txtright", "healthperc")
pfUI:UpdateConfig("unitframes", "grouppet", "healthcolor", "1")
pfUI:UpdateConfig("unitframes", "grouppet", "powercolor", "1")
pfUI:UpdateConfig("unitframes", "grouppet", "levelcolor", "1")
pfUI:UpdateConfig("unitframes", "grouppet", "classcolor", "1")
pfUI:UpdateConfig("unitframes", "raid", "visible", "1")
pfUI:UpdateConfig("unitframes", "raid", "portrait", "off")
@@ -260,6 +284,10 @@ function pfUI:LoadConfig()
pfUI:UpdateConfig("unitframes", "raid", "txtleft", "name")
pfUI:UpdateConfig("unitframes", "raid", "txtcenter", "none")
pfUI:UpdateConfig("unitframes", "raid", "txtright", "healthmiss")
pfUI:UpdateConfig("unitframes", "raid", "healthcolor", "1")
pfUI:UpdateConfig("unitframes", "raid", "powercolor", "1")
pfUI:UpdateConfig("unitframes", "raid", "levelcolor", "1")
pfUI:UpdateConfig("unitframes", "raid", "classcolor", "1")
pfUI:UpdateConfig("unitframes", "ttarget", "visible", "1")
pfUI:UpdateConfig("unitframes", "ttarget", "portrait", "bar")
@@ -283,6 +311,10 @@ function pfUI:LoadConfig()
pfUI:UpdateConfig("unitframes", "ttarget", "txtleft", "none")
pfUI:UpdateConfig("unitframes", "ttarget", "txtcenter", "name")
pfUI:UpdateConfig("unitframes", "ttarget", "txtright", "none")
pfUI:UpdateConfig("unitframes", "ttarget", "healthcolor", "1")
pfUI:UpdateConfig("unitframes", "ttarget", "powercolor", "1")
pfUI:UpdateConfig("unitframes", "ttarget", "levelcolor", "1")
pfUI:UpdateConfig("unitframes", "ttarget", "classcolor", "1")
pfUI:UpdateConfig("unitframes", "pet", "visible", "1")
pfUI:UpdateConfig("unitframes", "pet", "portrait", "bar")
@@ -306,6 +338,10 @@ function pfUI:LoadConfig()
pfUI:UpdateConfig("unitframes", "pet", "txtleft", "none")
pfUI:UpdateConfig("unitframes", "pet", "txtcenter", "name")
pfUI:UpdateConfig("unitframes", "pet", "txtright", "none")
pfUI:UpdateConfig("unitframes", "pet", "healthcolor", "1")
pfUI:UpdateConfig("unitframes", "pet", "powercolor", "1")
pfUI:UpdateConfig("unitframes", "pet", "levelcolor", "1")
pfUI:UpdateConfig("unitframes", "pet", "classcolor", "1")
pfUI:UpdateConfig("unitframes", "fallback", "visible", "1")
pfUI:UpdateConfig("unitframes", "fallback", "portrait", "bar")
@@ -329,6 +365,10 @@ function pfUI:LoadConfig()
pfUI:UpdateConfig("unitframes", "fallback", "txtleft", "unit")
pfUI:UpdateConfig("unitframes", "fallback", "txtcenter", "none")
pfUI:UpdateConfig("unitframes", "fallback", "txtright", "healthdyn")
pfUI:UpdateConfig("unitframes", "fallback", "healthcolor", "1")
pfUI:UpdateConfig("unitframes", "fallback", "powercolor", "1")
pfUI:UpdateConfig("unitframes", "fallback", "levelcolor", "1")
pfUI:UpdateConfig("unitframes", "fallback", "classcolor", "1")
pfUI:UpdateConfig("bars", nil, "icon_size", "20")
pfUI:UpdateConfig("bars", nil, "background", "1")
+9 -6
View File
@@ -1287,9 +1287,12 @@ function pfUI.uf:GetStatusValue(unit, pos)
end
function pfUI.uf.GetColor(self, preset)
local config = self.config
local unitstr = self.label .. self.id
local r, g, b = 1, 1, 1
if preset == "unit" then
if preset == "unit" and config["classcolor"] == "1" then
if UnitIsPlayer(unitstr) then
local _, class = UnitClass(unitstr)
if RAID_CLASS_COLORS[class] then
@@ -1301,18 +1304,18 @@ function pfUI.uf.GetColor(self, preset)
end
end
elseif preset == "class" then
elseif preset == "class" and config["classcolor"] == "1" then
local _, class = UnitClass(unitstr)
r = RAID_CLASS_COLORS[class].r
g = RAID_CLASS_COLORS[class].g
b = RAID_CLASS_COLORS[class].b
elseif preset == "reaction" then
elseif preset == "reaction" and config["classcolor"] == "1" then
r = UnitReactionColor[UnitReaction(unitstr, "player")].r
g = UnitReactionColor[UnitReaction(unitstr, "player")].g
b = UnitReactionColor[UnitReaction(unitstr, "player")].b
elseif preset == "health" then
elseif preset == "health" and config["healthcolor"] == "1" then
local perc = UnitHealth(unitstr) / UnitHealthMax(unitstr)
local r1, g1, b1, r2, g2, b2
if perc <= 0.5 then
@@ -1328,12 +1331,12 @@ function pfUI.uf.GetColor(self, preset)
g = g1 + (g2 - g1)*perc
b = b1 + (b2 - b1)*perc
elseif preset == "power" then
elseif preset == "power" and config["powercolor"] == "1" then
r = ManaBarColor[UnitPowerType(unitstr)].r
g = ManaBarColor[UnitPowerType(unitstr)].g
b = ManaBarColor[UnitPowerType(unitstr)].b
elseif preset == "level" then
elseif preset == "level" and config["levelcolor"] == "1" then
r = GetDifficultyColor(UnitLevel(unitstr)).r
g = GetDifficultyColor(UnitLevel(unitstr)).g
b = GetDifficultyColor(UnitLevel(unitstr)).b