Well. You could do sth else. You could register UNIT_AURA to a specific event frame.
Each time UNIT_AURA triggers you can check
Lua Code:
--get db via VARIABLES LOADED and saved variables
local debuffList = DB.debuffList or {}
local name, rank, icon, count, debuffType, duration, expirationTime, unitCaster, isStealable, shouldConsolidate, spellId = nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil
local function SearchAuras(self,event,unit)
if not debuffList then return end
for i=1,40 do
name, rank, icon, count, debuffType, duration, expirationTime, unitCaster, isStealable, shouldConsolidate, spellId = UnitDebuff(unit,i)
if not name then break end
if not debuffList[spellId] then
debuffList[spellid] = {name = name, rank = rank, icon = icon, debuffType = debuffType, spellId = spellId}
end
end
end
local auraCheck = CreateFrame("Frame")
auraCheck:SetScript("OnEvent",SearchAuras)
auraCheck:RegisterEvent("UNIT_AURA")
All spells are spells. Some spells are auras. Some less spells are debuffs.
UnitDebuff (aka. UnitAura, HARMFUL) may deliver even more values. You can check that by doing print(UnitDebuff(unit,i)).
http://wowprogramming.com/docs/api/UnitAura