From e302d9b9ef36f3cba37360080e4a12f919c24f27 Mon Sep 17 00:00:00 2001 From: p3lim-52096 Date: Sun, 15 Feb 2009 18:04:54 +0000 Subject: [PATCH] Fixed color tag errors Fixed portrait function git-svn-id: svn://svn.wowinterface.com/oUF_P3lim-52/trunk@61 8c7459ed-49dc-4bc8-85d7-b6381a8f5413 --- oUF_P3lim/oUF_P3lim.lua | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/oUF_P3lim/oUF_P3lim.lua b/oUF_P3lim/oUF_P3lim.lua index 17ec9a3..ff07ac7 100644 --- a/oUF_P3lim/oUF_P3lim.lua +++ b/oUF_P3lim/oUF_P3lim.lua @@ -47,6 +47,11 @@ local function Hex(r, g, b) if(type(r) == 'table') then if(r.r) then r, g, b = r.r, r.g, r.b else r, g, b = unpack(r) end end + + if(not r or not g or not b) then + r, g, b = 1, 1, 1 + end + return string.format('|cff%02x%02x%02x', r*255, g*255, b*255) end @@ -133,11 +138,15 @@ local function UpdateDruidPower(self) end local function UpdatePortrait(self) + local min, max = UnitHealth(self.unit), UnitHealthMax(self.unit) if(UnitIsDeadOrGhost(self.unit)) then self.Portrait:Hide() + elseif(min <= max) then + self.Portrait:Show() + self.Portrait:SetWidth(230 * min / max) else self.Portrait:Show() - self.Portrait:SetWidth(230 * UnitHealth(self.unit) / UnitHealthMax(self.unit)) + self.Portrait:SetWidth(230) end end -- 1.7.9.5