Quantcast WoWInterface - View Single Post - PitBull4 Lua texts - Colored health and power?
View Single Post
06-22-11, 08:06 PM   #10
jeffy162
A Pyroguard Emberseer
 
jeffy162's Avatar
AddOn Author - Click to view addons
Join Date: May 2009
Posts: 2,349
Originally Posted by Nibelheim View Post
Woops, try this:
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") and (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)
  else
    return "|cff%02x%02x%02x%s", color[1]*255, color[2]*255, color[3]*255, Short(pCur, true)
  end
end
Yep, you should get two power bars, and two power texts. I.e. In cat form, it'll be Energy and Mana.
OK. Thank you for letting me know (for sure ) what the other bar was. I do have a question, though, if you don't mind. What is the difference between the last block of code and the one posted in post #6? That one seems to work OK, and, as I mentioned, I don't know when I'll get a chance to test the alternate power you get with several other things (for want of a better word).

Please, do not misunderstand. I am not complaining, rather trying to understand the differences between the two codes. Believe me, I appreciate the work you do and all the help you give. Thank you.
  Reply With Quote