View Single Post
11-30-14, 09:35 AM   #2
Choonstertwo
A Chromatic Dragonspawn
 
Choonstertwo's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2011
Posts: 194
Try this:
Lua Code:
  1. hooksecurefunc("TextStatusBar_UpdateTextStringWithValues", function(statusFrame, textString, value, valueMin, valueMax)
  2.     if statusFrame == PlayerFrameHealthBar or ((statusFrame == TargetFrameHealthBar or statusFrame == FocusFrameHealthBar) and not UnitIsDeadOrGhost(statusFrame:GetParent().unit)) then
  3.         local formattedValue = (value > 1e6 and ("%.2fM"):format(value / 1e6)) or (value > 1e4 and ("%.0fk"):format(value / 1e3)) or value
  4.         textString:SetFormattedText("%s (%.0f%%)", formattedValue, value * 100 / valueMax)
  5.     end
  6. end)

I had to rename all the variables and reformat the code because the one-letter names and strange space-saving arithmetic operations made it very difficult to read.
  Reply With Quote