Advertisement
Natalich94

Health % Value

Jun 22nd, 2018
304
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.03 KB | None | 0 0
  1. DEFAULT_CHAT_FRAME:AddMessage("Health.lua was successfully loaded.")
  2. --Health % Value
  3. PF=CreateFrame("Frame")
  4.  function sh(hp,hpm)
  5.  local a
  6.  if hp<1 then return b end -- if frame is death we do nothing
  7.  if hp<10000 then a=hp end
  8.  if hp>10000 then a=(hp-mod(hp,100))/1000 a=a.."k" end  --if hp>10k
  9.  if hp>100000 then a=(hp-mod(hp,1000))/1000 a=a.."k" end    --if hp>100k
  10.  if hp>1000000  then a=(hp-mod(hp,10000))/1000000 a=a.."m" end  --if hp>1M
  11.  if hp>10000000 then a=(hp-mod(hp,1000000))/1000000 a=a.."m" end    --if hp>10M
  12.  if hp>1000000000 then a=(hp-mod(hp,100000000))/1000000000 a=a.."b" end --if hp>1B
  13.  if hp>10000000000 then a=(hp-mod(hp,1000000000))/1000000000 a=a.."b" end   --if hp>10B
  14.  
  15.  a = a.." | "..format("%.0f", ((hp/hpm)*100)).."%"
  16.  return a
  17.  end
  18.  
  19. pf2={"Player", "Target", "Focus"}
  20. PF:SetScript("OnUpdate",
  21.  function()
  22.  for _,u in ipairs(pf2) do
  23.   _G[u.."FrameHealthBar"].TextString:SetText(sh(UnitHealth(u),UnitHealthMax(u)))
  24.   _G[u.."FrameManaBar"].TextString:SetText(sh(UnitPower(u),UnitPowerMax(u)))
  25.   end
  26.  end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement