--PLAYER_SPELLBOOK_UPDATE PLAYER_SPELLBOOK_EXCLUSION_ADD PLAYER_SPELLBOOK_EXCLUSION_REMOVE PLAYER_SPELLBOOK_EXCLUSION_LIST COOLDOWN_MANAGER_SWITCH_SCAN_MODES PLAYER_SPELLBOOK_WHITELIST_ADD PLAYER_SPELLBOOK_WHITELIST_REMOVE PLAYER_SPELLBOOK_WHITELIST_LIST
function(e, msg)
	if not aura_env.mode then aura_env.mode = 1 end 
	if e == "COOLDOWN_MANAGER_SWITCH_SCAN_MODES" then
		if aura_env.mode == 0 then
			aura_env.mode = 1
			print(aura_env.mode)
		else
			aura_env.mode = 0
			print(aura_env.mode)
		end
	elseif e == "PLAYER_SPELLBOOK_UPDATE" then
		if not WeakAurasSaved.CustomTrash then WeakAurasSaved.CustomTrash = {} end
		if not WeakAurasSaved.CustomTrash.SpellExclusion then WeakAurasSaved.CustomTrash.SpellExclusion = {} end
		if not WeakAurasSaved.CustomTrash.SpellWhitelist then WeakAurasSaved.CustomTrash.SpellWhitelist = {			
			["Fortifying Brew"] = 1,
			["Life Cocoon"] = 1,
			["Revival"] = 1,
			["Paralysis"] = 1,
		} end
		aura_env.spells = {}
		if aura_env.mode == 0 then
			local index = 1
			while GetSpellBookItemName(index, "spell") do
				local name = GetSpellInfo(index, "spell")
				local id = select(7, GetSpellInfo(index, "spell"))
				if IsPlayerSpell(id) == true and GetSpellBaseCooldown(id) > 10000 and (not (WeakAurasSaved.CustomTrash.SpellExclusion[name] or WeakAurasSaved.CustomTrash.SpellExclusion[id])) then
					aura_env.spells[name] = id
				end
				index = index + 1
			end
		else
			for k,v in pairs(WeakAurasSaved.CustomTrash.SpellWhitelist) do
				local name = GetSpellInfo(k)
				local id = select(7, GetSpellInfo(k))
				if id and IsPlayerSpell(id) == true then
					aura_env.spells[name] = id
				end
			end
		end
		WeakAuras.ScanEvents("RESET_COOLDOWN_MANAGER_SPELLS")
	elseif e == "PLAYER_SPELLBOOK_EXCLUSION_ADD" then
		if GetSpellInfo(msg) then
			if not WeakAurasSaved.CustomTrash.SpellExclusion[msg] then WeakAurasSaved.CustomTrash.SpellExclusion[msg] = 1 end
			print("Spell <", msg, "> added")
		else
			print("Spell <", msg, "> is invalid")
		end
		WeakAuras.ScanEvents("PLAYER_SPELLBOOK_UPDATE")
		WeakAuras.ScanEvents("RESET_COOLDOWN_MANAGER_SPELLS")
	elseif e == "PLAYER_SPELLBOOK_EXCLUSION_REMOVE" then
		if GetSpellInfo(msg) then
			if  WeakAurasSaved.CustomTrash.SpellExclusion[msg] then WeakAurasSaved.CustomTrash.SpellExclusion[msg] = nil else print("Spell <", msg, "> is not excluded"); return end
			print("Spell <", msg, "> removed")
		else
			print("Spell <", msg, "> is invalid")
		end
		WeakAuras.ScanEvents("PLAYER_SPELLBOOK_UPDATE")
		WeakAuras.ScanEvents("RESET_COOLDOWN_MANAGER_SPELLS")
	elseif e == "PLAYER_SPELLBOOK_EXCLUSION_LIST" then
		for k,v in pairs(WeakAurasSaved.CustomTrash.SpellExclusion) do
			print(k,v)
		end
	elseif e == "PLAYER_SPELLBOOK_WHITELIST_ADD" then
		if GetSpellInfo(msg) then
			if not WeakAurasSaved.CustomTrash.SpellWhitelist[msg] then WeakAurasSaved.CustomTrash.SpellWhitelist[msg] = 1 end
			print("Spell <", msg, "> added")
		else
			print("Spell <", msg, "> is invalid")
		end
		WeakAuras.ScanEvents("PLAYER_SPELLBOOK_UPDATE")
		WeakAuras.ScanEvents("RESET_COOLDOWN_MANAGER_SPELLS")
	elseif e == "PLAYER_SPELLBOOK_WHITELIST_REMOVE" then
		if GetSpellInfo(msg) then
			if  WeakAurasSaved.CustomTrash.SpellWhitelist[msg] then WeakAurasSaved.CustomTrash.SpellWhitelist[msg] = nil else print("Spell <", msg, "> is not excluded"); return end
			print("Spell <", msg, "> removed")
		else
			print("Spell <", msg, "> is invalid")
		end
		WeakAuras.ScanEvents("PLAYER_SPELLBOOK_UPDATE")
		WeakAuras.ScanEvents("RESET_COOLDOWN_MANAGER_SPELLS")
	elseif e == "PLAYER_SPELLBOOK_WHITELIST_LIST" then
		for k,v in pairs(WeakAurasSaved.CustomTrash.SpellWhitelist) do
			print(k,v)
		end
	end
end