Advertisement
Senit

Tags

Aug 20th, 2012
27
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.29 KB | None | 0 0
  1.   --oUF_Senit 2012--
  2.  
  3.   --TAGS--
  4.  
  5. local numFormat = function(v)
  6.     if v > 1E9 then
  7.         return (floor(v/1E9)).."b"
  8.     elseif v > 1E6 then
  9.         return (floor(v/1E6)).."m"
  10.     elseif v > 1E3 then
  11.         return (floor(v/1E3)).."k"
  12.     else
  13.         return v
  14.     end  
  15. end
  16. oUF.Tags["senit:hpdefault"] = function(unit)
  17.     if not UnitIsConnected(unit) then
  18.         return ""
  19.     end  
  20.     if(UnitIsDead(unit) or UnitIsGhost(unit)) then
  21.         return "|cff9999990|r"
  22.     end
  23.     local min, max = UnitHealth(unit), UnitHealthMax(unit)
  24.     local val = numFormat(min)  
  25.     return val.."|cffcccccc|r"  
  26. end
  27. oUF.TagEvents["senit:hpdefault"] = "UNIT_HEALTH UNIT_MAXHEALTH UNIT_CONNECTION"
  28.  
  29. oUF.Tags["senit:hpperc"] = function(unit)
  30.     if not UnitIsConnected(unit) then
  31.         return "|cff999999Off|r"
  32.     end  
  33.     if(UnitIsDead(unit) or UnitIsGhost(unit)) then
  34.         return "|cff999999Dead|r"
  35.     end
  36.     local min, max = UnitHealth(unit), UnitHealthMax(unit)
  37.     local per = 0
  38.     if max > 0 then
  39.         per = floor(min/max*100)
  40.     end
  41.     return per.."%"  
  42. end
  43. oUF.TagEvents["senit:hpperc"] = "UNIT_HEALTH UNIT_MAXHEALTH UNIT_CONNECTION"
  44.  
  45. oUF.Tags["senit:ppdefault"] = function(unit)
  46.     local min, max = UnitPower(unit), UnitPowerMax(unit)
  47.     local val = numFormat(min)  
  48.     return val.."|cffcccccc|r"  
  49. end
  50. oUF.TagEvents["senit:ppdefault"] = "UNIT_POWER UNIT_MAXPOWER UNIT_CONNECTION"
  51.  
  52. oUF.Tags["unitcolor"] = function(unit)
  53.     local color
  54.     if UnitIsPlayer(unit) then
  55.         local _, class = UnitClass(unit)
  56.         color = oUF.colors.class[class]
  57.     end
  58.     return color and ("|cff%02x%02x%02x"):format(color[1] * 255, color[2] * 255, color[3] * 255) or "|cffffffff"
  59. end
  60. oUF.TagEvents["unitcolor"] = "UNIT_HEALTH UNIT_CLASSIFICATION UNIT_REACTION"
  61.  
  62. -- ComboPoints
  63. oUF.Tags["myComboPoints"] = function(unit)
  64.  
  65.     local cp, str      
  66.     if(UnitExists'vehicle') then
  67.         cp = GetComboPoints('vehicle', 'target')
  68.     else
  69.         cp = GetComboPoints('player', 'target')
  70.     end
  71.  
  72.     if (cp == 1) then
  73.         str = string.format("|cff69e80c%d|r",cp)
  74.     elseif cp == 2 then
  75.         str = string.format("|cffb2e80c%d|r",cp)
  76.     elseif cp == 3 then
  77.         str = string.format("|cffffd800%d|r",cp)
  78.     elseif cp == 4 then
  79.         str = string.format("|cffffba00%d|r",cp)
  80.     elseif cp == 5 then
  81.         str = string.format("|cfff10b0b%d|r",cp)
  82.     end
  83.    
  84.     return str
  85. end
  86. oUF.TagEvents["myComboPoints"] = "UNIT_COMBO_POINTS PLAYER_TARGET_CHANGED"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement