From 2d9493a34eb091d9538adfdcf83d894fba547a1c Mon Sep 17 00:00:00 2001 From: shagu Date: Mon, 23 Jan 2017 15:12:13 +0100 Subject: [PATCH] target: use wow api to calculate levelcolor --- modules/target.lua | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/modules/target.lua b/modules/target.lua index 9add1521..8df6b96c 100644 --- a/modules/target.lua +++ b/modules/target.lua @@ -196,18 +196,12 @@ pfUI:RegisterModule("target", function () local r, g, b = r1 + (r2 - r1)*perc, g1 + (g2 - g1)*perc, b1 + (b2 - b1)*perc pfUI.uf.target.hpText:SetTextColor(r, g, b,1) - local leveldiff = UnitLevel("player") - UnitLevel("target") local levelcolor - if leveldiff >= 9 then - levelcolor = "555555" - elseif leveldiff >= 3 then - levelcolor = "55ff55" - elseif leveldiff >= -2 then - levelcolor = "aaff55" - elseif leveldiff >= -4 then - levelcolor = "ffaa55" - else + if UnitLevel("target") < 0 then levelcolor = "ff5555" + else + local lcol = GetDifficultyColor(UnitLevel("target")) + levelcolor = string.format("%02x%02x%02x", lcol.r*255, lcol.g*255, lcol.b*255) end local name = string.sub(UnitName("target"),1,25)