1. This is my UNIT_AURA handler. I'd like to track the Dark Intent proc, not the Buff with the same name. It looks like the only way I can get this is be enumerating buffs by index and then comparing spell IDs to the one I want. If I call UnitBuff(unit, "Dark Intent") I just get the 30 minute self buff, not the proc.

    Do you know of a more efficient way to handle this or is looping through buffs by index the best we got?

    Thanks, Andy

    Don't look at the math too hard, it's not right yet...

     local i_darkintent_bs          = 85768             -- Dark Intent (buff to self)
     local i_darkintent_p           = 94310             -- Dark Intent (proc, stacks up to 3 times)
    
     -----------------------------------------------------------
     -- UNIT_AURA
     -----------------------------------------------------------
     function edm:UNIT_AURA(unitID)
        --print("UNIT_AURA")
        local _ctime = GetTime()
        local idx = 1
        repeat
            local name, rank, icon, count, debuffType, duration, expirationTime, unitCaster, isStealable, shouldConsolidate, spellID = UnitAura(unitID, idx, nil, "PLAYER|HELPFUL") 
            if spellID and spellID == i_darkintent_p then
                print(name, " count: ", count, ", duration: ", duration, ", expirationTime: ", expirationTime)
    
                if count == 1 then
    
                    print("DI 1 stack")
    
                    di1beg_t = expirationTime - duration
                    di1end_t = expirationTime
    
                elseif count == 2 then
    
                    print("DI 2 stacks")
    
                    -- if we bump up, total out the 1 stack timer
                    di1end_t = _ctime
                    di1total_t = di1total_t + (di1end_t - di1beg_t)
                    print((di1end_t - di1beg_t), " seconds of 1 stack")
    
                    di2beg_t = expirationTime - duration
                    di2end_t = expiration
    
                elseif count == 3 then
                    print("DI 3 stacks")
    
                    -- if we bump up, total out 2 stack timer
                    di2end_t = _ctime
                    di2total_t = di2total_t + (di2end_t - di2beg_t)
                    print((di2end_t - di2beg_t), " seconds of 2 stacks")
    
                    -- we get 7 seconds of 3 stacks, so just add it on
                    di3beg_t = expirationTime - duration
                    di3total_t = di3total_t + duration
                end
            end 
            idx = idx + 1
        until name == nil
     end
    

    Try UnitBuff(unit, spellId), but I don't think it works. The best way, failing that, is to iterate like you are.

    You can use UnitBuff(Unit,GetSpellInfo(SpellID)).