--CLEU
function(e, ...)
	local se = select(2, ...)
	if se == "SPELL_AURA_APPLIED_DOSE" or e == "PLAYER_TARGET_CHANGED" then
		aura_env.owndebuff = {["stacks"] = 0, ["damage"] = 0,}
		aura_env.totaldebuff = {["stacks"] = 0, ["damage"] = 0,}
		for i = 1, 40 do
			local name = UnitDebuff("target", i)
			if name == "Conductive Ink" then
				aura_env.totaldebuff.stacks = aura_env.totaldebuff.stacks + select(3, UnitDebuff("target", i))
				aura_env.totaldebuff.damage = aura_env.totaldebuff.stacks * aura_env.config.mediandamage
			end
		end
		for i = 1, 40 do
			local name = UnitDebuff("target", i, PLAYER)
			if name == "Conductive Ink" then
				aura_env.owndebuff.stacks = select(3, UnitDebuff("target", i, PLAYER))
				aura_env.owndebuff.damage = aura_env.owndebuff.stacks * aura_env.config.mediandamage
				break
			end
		end
		return true
	end
end

--DISPLAY
function()
	if aura_env.config.sh == true then aura_env.owndebuff.damage = aura_env.shorten(aura_env.owndebuff.damage); aura_env.totaldebuff.damage = aura_env.shorten(aura_env.totaldebuff.damage) end
	aura_env.region.text2:SetText(aura_env.owndebuff.stacks .. "\n" .. aura_env.owndebuff.damage .. "\n" .. aura_env.totaldebuff.stacks .. "\n" .. aura_env.totaldebuff.damage)
	return "Player stacks\nPlayer damage\nTotal stacks\nTotal damage"
end

--INIT
aura_env.owndebuff = {["stacks"] = 0, ["damage"] = 0,}
aura_env.totaldebuff = {["stacks"] = 0, ["damage"] = 0,}
if not aura_env.region.text2 then
	local text2 = aura_env.region:CreateFontString(nil, aura_env.region)
	aura_env.region.text2 = text2
end
local font, size, flags = aura_env.region.text:GetFont()
aura_env.region.text2:SetFont(font, size, flags)
aura_env.region.text2:SetTextColor(aura_env.config.color[1], aura_env.config.color[2], aura_env.config.color[3], aura_env.config.color[4])
aura_env.region.text2:SetPoint("CENTER", aura_env.region, "CENTER", aura_env.config.x, 0)
aura_env.region.text2:SetText("")
aura_env.region.text2:Show()
aura_env.shorten = function(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