Advertisement
Guest User

Combustion Separate Digits

a guest
Aug 24th, 2014
375
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.03 KB | None | 0 0
  1. function combustion.OnUpdate()
  2.     local amount = GetCombustionTotal()
  3.     if combustionConfig.combatHide and amount == 0 and not UnitAffectingCombat("player") then
  4.         combustion.frame:Hide()
  5.         combatHidden = true
  6.     else
  7.         if amount >= turnGreenDps then
  8.             combustion.FontString:SetFont(combustionConfig.font, combustionConfig.fontSize, "THICKOUTLINE")
  9.             combustion.FontString:SetTextColor(0,1,0)
  10.         elseif amount >= turnYellowDps then
  11.             combustion.FontString:SetFont(combustionConfig.font, combustionConfig.fontSize, "OUTLINE")
  12.             combustion.FontString:SetTextColor(1,1,0)
  13.         else
  14.             combustion.FontString:SetFont(combustionConfig.font, combustionConfig.fontSize, "OUTLINE")
  15.             combustion.FontString:SetTextColor(1,0,0)
  16.         end
  17.  
  18.         function format_thousand(v)
  19.             local s = string.format("%d", math.floor(v))
  20.             local pos = string.len(s) % 3
  21.             if pos == 0 then pos = 3 end
  22.             return string.sub(s, 1, pos)
  23.             .. string.gsub(string.sub(s, pos+1), "(...)", ",%1")
  24.         end
  25.  
  26.     combustion.FontString:SetText(format_thousand(amount))
  27.  
  28.     end
  29.  
  30. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement