--UNIT_AURA COMBAT_LOG_EVENT_UNFILTERED PLAYER_REGEN_ENABLED PLAYER_REGEN_DISABLED
function(e, unit, ...)
	if e == "UNIT_AURA" then
		if UnitExists(unit) then
			if aura_env.UnitDebuffC(aura_env.debuff, unit) and not aura_env.auras[UnitGUID(unit)] and select(7, aura_env.UnitDebuffC(aura_env.debuff, unit)) == "player" then
				aura_env.auras[UnitGUID(unit)] = 1
				aura_env.count = aura_env.count + 1
				return true
			elseif not aura_env.UnitDebuffC(aura_env.debuff, unit) and aura_env.auras[UnitGUID(unit)] then
				aura_env.auras[UnitGUID(unit)] = nil
				aura_env.count = aura_env.count - 1
				return true
			end
		end
	elseif e == "COMBAT_LOG_EVENT_UNFILTERED" then
		local se = select(1, ...)
		if se == "UNIT_DIED" then
			local GUID = select(7, ...)
			if aura_env.auras[GUID] then
				aura_env.auras[GUID] = nil
				aura_env.count = aura_env.count - 1
				return true
			end
		end
	elseif e == "PLAYER_REGEN_ENABLED" or e == "PLAYER_REGEN_DISABLED" then
		for k,v in pairs(aura_env.auras) do
			k = nil
			v = nil
		end
	end
end

--UNTRIGGER
function()
    if aura_env.count == 0 then return true end
end

--DISPLAY
function()
	if aura_env.count > 0 then return aura_env.count else return "" end
end

--INIT
aura_env.debuff = "Dagger in the Back"
aura_env.count = 0
aura_env.auras = {}
aura_env.UnitDebuffC = function(spell, unit)
    for i = 1, 40 do
        local name = UnitDebuff(unit, i)
        if name then
            if name == spell then
                return UnitDebuff(unit, i)
            end
        else
            return nil
        end
    end
end