Advertisement
Guest User

Untitled

a guest
Dec 11th, 2014
212
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.93 KB | None | 0 0
  1. tags.Events['Terenna:healthtext'] = 'UNIT_HEALTH_FREQUENT'
  2. tags.Methods['Terenna:healthtext'] = function(u)
  3.     if UnitIsGhost('player') then
  4.         return '|cffb40000Ghost'
  5.     elseif UnitIsDead('player') then
  6.         return '|cffb40000Dead'
  7.     end
  8.    
  9.     local healthcurrent, healthmax = UnitHealth(u), UnitHealthMax(u)
  10.     local r, g
  11.    
  12.     if healthcurrent < healthmax then
  13.         r, g = 180, 0
  14.     else
  15.         r, g = 0, 180
  16.     end
  17.    
  18.     if healthcurrent >= 1000000 then
  19.         healthcurrent = format('%.1fm', healthcurrent/1000000)
  20.     elseif healthcurrent >= 1000 then
  21.         healthcurrent = format('%.0fk', healthcurrent/1000)
  22.     end
  23.    
  24.     return format('|cff%02x%02x%02x%s', r, g, 0, healthcurrent)
  25. end
  26.  
  27. tags.Events['Terenna:healthpercenttext'] = 'UNIT_HEALTH_FREQUENT'
  28. tags.Methods['Terenna:healthpercenttext'] = function(u)
  29.     if UnitIsDead(u) or UnitIsGhost(u) then
  30.         return
  31.     end
  32.    
  33.     local r, g = 0, 180
  34.     local healthcurrent, healthmax = UnitHealth(u), UnitHealthMax(u)
  35.         if healthcurrent < healthmax then
  36.             r, g = g, r
  37.         end
  38.         return format('|cff%02x%02x00%.0f%%', r, g, 100 * (healthcurrent / healthmax))
  39.     end
  40.  
  41. tags.Events['Terenna:powertext'] = 'UNIT_POWER_FREQUENT UNIT_DISPLAYPOWER'
  42. tags.Methods['Terenna:powertext'] = function(u)
  43.     local powercurrent, powertype, pr, pg, pb
  44.     powertype = select(2,UnitPowerType(u))
  45.     powercurrent = UnitPower(u)
  46.    
  47.     if powertype and powercurrent > 0 then
  48.         if powertype == 'MANA' then
  49.             pr, pg, pb = 0, 100, 255
  50.             if powercurrent >= 1000000 then
  51.                 powercurrent = format('%.1fm', powercurrent / 1000000)
  52.             elseif powercurrent >= 1000 then
  53.                 powercurrent = format('%.0fk', powercurrent / 1000)
  54.             end
  55.         elseif powertype == 'FOCUS' then
  56.             pr, pg, pb = 255, 128, 65
  57.         elseif powertype == 'ENERGY' then
  58.             pr, pg, pb = 255, 255, 0
  59.         elseif powertype == 'RUNIC_POWER' then
  60.             pr, pg, pb = 0, 209, 255
  61.         else
  62.             pr, pg, pb = 255, 0, 0
  63.         end
  64.         return format('|cff%02x%02x%02x%s', pr, pg, pb, powercurrent)
  65.     else
  66.         return
  67.     end
  68. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement