View Single Post
06-21-11, 01:14 AM   #6
Nibelheim
local roygbi-
 
Nibelheim's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2010
Posts: 1,600
Another attempt at full Power functionality. May work, may not
Code:
local color
local pType, pToken, altR, altG, altB = UnitPowerType(unit)
local pCur, pMax, pCurMana, pMaxMana = Power(unit), MaxPower(unit), Power(unit, 0), MaxPower(unit, 0)

if (pMax > 0) then
  if PitBull4.PowerColors[pToken] then
    color = PitBull4.PowerColors[pToken]
  else
    if (altR == nil) then
      color = PitBull4.PowerColors["MANA"]
    else
      color = {[1] = altR, [2] = altG, [3] = altB}
    end
  end
  
  if (pToken ~= "MANA") then
    if (pMaxMana > 0) then
      local DManaColor = PitBull4.PowerColors["MANA"]
      return "|cff%02x%02x%02x%s |cff%02x%02x%02x%s", color[1]*255, color[2]*255, color[3]*255, Short(pCur, true), DManaColor[1]*255, DManaColor[2]*255, DManaColor[3]*255, Short(pCurMana, true)
    end
  else
    return "|cff%02x%02x%02x%s", color[1]*255, color[2]*255, color[3]*255, Short(pCur, true)
  end
end
  Reply With Quote