Title changed as well. I'm using this and it works to some extent for power bars, but it doesn't show the value when it's full and I'd like to remove the class coloring too.
I have no idea how to hide the level text if it's 120, in other words, the cap.
function(unit)
local pCur, pMax, mCur, mMax = UnitPower(unit), UnitPowerMax(unit), UnitPower(unit, 0), UnitPowerMax(unit, 0)
if pMax > 0 then
local pType, pToken = UnitPowerType(unit)
local pColor = PowerBarColor[pType]
if ( (pToken ~= "MANA") and (mMax > 0) ) then -- Druid in Bear/Cat form
local mColor = PowerBarColor[0]
local mPer = ceil((mCur / mMax)*100)
local ShowPower, ShowMana
if ((pToken == "RAGE") and (pCur > 0)) or ((pToken == "ENERGY") and (pCur < pMax)) then
ShowPower = true
end
if mPer < 100 then
ShowMana = true
end
if ShowPower and ShowMana then
return "|cff%02x%02x%02x%s|r %s|cff05cbe5%%|r", pColor.r * 255, pColor.g * 255, pColor.b * 255, pCur, mPer
elseif ShowPower then
return "|cff%02x%02x%02x%s|r", pColor.r * 255, pColor.g * 255, pColor.b * 255, pCur
elseif ShowMana then
return "%s|cff05cbe5%%|r . |cff05cbe5%s|r", mPer, mCur
end
if pToken == "LUNAR_POWER" or pToken == "MAELSTROM" or pToken == "INSANITY" then
if pCur > 0 then
return "|cff%02x%02x%02x%s|r", pColor.r * 255, pColor.g * 255, pColor.b * 255, pCur
end
end
elseif pToken == "RAGE" or pToken == "RUNIC_POWER" or pToken == "FURY" or pToken == "PAIN" then -- Warrior / DK
if pCur > 0 then
return "|cff%02x%02x%02x%s|r", pColor.r * 255, pColor.g * 255, pColor.b * 255, pCur
end
elseif pToken == "MANA" then -- Mage
local pPer = ceil((pCur / pMax)*100)
if pCur < pMax then
return "%s|cff05cbe5%%|r", pPer
end
else -- Everything else
if pCur < pMax then
return "|cff%02x%02x%02x%s|r", pColor.r * 255, pColor.g * 255, pColor.b * 255, pCur
end
end
end
end
|