Skip to content

Instantly share code, notes, and snippets.

@mkb
Created December 12, 2014 03:57
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mkb/ea429a1e2d78fb602f94 to your computer and use it in GitHub Desktop.
Save mkb/ea429a1e2d78fb602f94 to your computer and use it in GitHub Desktop.
Return mana percentage in combat or if less than 100%
function()
local mana = math.max(0, UnitMana("player"));
local max = math.max(1, UnitManaMax("player"));
local p = math.floor(mana / max * 100)
if UnitAffectingCombat("player") or p < 100 then
return string.format("%.f", p);
else
return ""
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment