local buffs = {}function MyAddon:UNIT_AURA(event, unit) if not buffs[unit] then buffs[unit] = {} end local unitBuffs = buffs[unit] -- Decrement all counts for k,v in pairs(unitBuffs) do unitBuffs[k] = v - 1 end local i = 1 do local name,rank,count = UnitBuff(unit, i) if not name then break end if not unitBuffs[name] then -- New buff unitBuffs[name] = 1 end i = i + 1 end -- Clean up any buffs with 0 for k,v in pairs(unitBuffs) do if v == 0 then unitBuffs[k] = nil -- Buff expired end endend