TRIGGER
function()
    local buff = UnitBuff("player", "Xavaric's Magnum Opus") or 0
    if buff ~= 0 then return true else return false end
end

DURATION TRIGGER
function()
    return aura_env.absorb, aura_env.maxAbsorb, true
end

NAME TRIGGER
function()
	local function shorten(val)
		local function round(var, n)
			if (n) then
				var = math.floor((var * 10^n) + 0.5) / (10^n)
			else
				var = math.floor(var+0.5)
			end
			return var
		end
		local n = 2
		if val < 1e3 then
			return round(val, n)
		elseif val > 1e3 and val < 1e6 then
			return round(val / 1e3, n) .. "k"
		elseif val > 1e6 and val < 1e9 then
			return round(val / 1e6, n) .. "M"
		elseif val > 1e9 then
			return round(val / 1e9, n) .. "G"
		end
	end
	return shorten(aura_env.absorb)
end

DISPLAY
function()
	if UnitGroupRolesAssigned("player") == "TANK" then
	    aura_env.maxAbsorb = math.floor(UnitHealthMax("player") * 0.15)
	    aura_env.absorb = select(17, UnitBuff("player", "Xavaric's Magnum Opus")) or 0
	    return math.floor((aura_env.absorb / aura_env.maxAbsorb) * 100)
	else
		aura_env.maxAbsorb = math.floor(UnitHealthMax("player") * 0.25)
	    aura_env.absorb = select(17, UnitBuff("player", "Xavaric's Magnum Opus")) or 0
	    return math.floor((aura_env.absorb / aura_env.maxAbsorb) * 100)
	end
end

INIT
aura_env.maxAbsorb = 0
aura_env.absorb = 0