
--COMBAT_LOG_EVENT_UNFILTERED
--TSU
function(allstates, e, ...)
    if e and e == "COMBAT_LOG_EVENT_UNFILTERED" then
        local se = select(2, ...)
        local t = debugprofilestop()
        if se and se == "SPELL_DAMAGE" then
            local casterGUID = select(4, ...)
            local spell = select(13, ...)
            local damage = select(15, ...)
            local sid = select(12, ...)
            if casterGUID and spell and sid and damage and casterGUID == UnitGUID("player") and aura_env.spells[spell] then
                if not allstates[t] then
                    allstates[t] = {
                        show = true,
                        changed = true,
                        icon = select(3, GetSpellInfo(sid)),
                        progressType = "timed",
                        duration = debugprofilestop(),
                        expirationTime = GetTime() + 2.5,
                        autoHide = true,
                        damage = damage,
                    }
                    print(spell, sid, damage)
                    return true
                end
            end
        end
    end
end

--INIT
aura_env.spells = {
    ["Judgment"] = true,
    ["Mark of the Hidden Satyr"] = true,
}
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
