[Solved] UnitBuffLeftTime question (use UnitBuff not UnitBuffInfo)

  • Probably I'm doing something wrong... Somehow the indices in UnitBuffInfo( unit, int index ) and UnitBuffLeftTime( unit, int index ) seem to be mixed up...


    I have the following buffs

    an this code:

    Code
    for j=1,100 do 
        local buff_name, _, _, buff_id = UnitBuffInfo("player", j)
        if buff_name ~= nil then
            local buff_time_left = UnitBuffLeftTime("player", j)
            
            DEFAULT_CHAT_FRAME:AddMessage(buff_name.."-"..tostring(buff_id).."-"..tostring(buff_time_left))
        end
    end

    which gives


    Fine:

    * Fioletowa Aura-1500333-nil

    * Cierpliwość Arcadii-1500765-nil

    * Opieka nad Wierzchowcem VIII-502986-438.4860534668

    * Wiążąca Umowa-620951-nil

    * Kryształ Natury-503948-nil

    * Sys1501924_name-1501924-nil (probably, no idea :P)


    But the rest is mess:

    * Modlitwa Zniszczenia-1501466-6136.5874023438 - left time should be nil, seems to be time left for Dusza Trenera Broni-1500352

    * Sys1500766_name-1500766-5.334990978241 - this seems like time for Przyspieszenie Kryształu-620703?

    * Dusza Trenera Broni-1500352-nil - the 6.1k above would be right

    * Przyspieszenie Kryształu-620703-nil - the 5 seconds above would be right


    I'm probably doing it wrong: what is the correct way to find matching UnitBuffInfo and UnitBuffLeftTime?

  • BTW 1: using combined UnitBuffsInfo("player") gives correct values (Acradia specific API, with "s")


    BTW 2: but I'm pretty sure that UnitBuffInfo( unit, int index ) (without "s") and UnitBuffLeftTime( unit, int index ) based on index as above used to work... Is it possible that it got broken/the meaning of parameters has changed?

  • Hi,


    UnitBuffInfo will read out invisible buffs too and I made the experience, that UnitBuffLeftTime not really working with such buffs. (you want to read out bufftime of invisible buff, but the index for UnitBuffLeftTime will result in left time for an other buff)

    Try use UnitBuff(unit, index) instead of UnitBuffInfo and then your function should work

  • Ah, yes, for UnitBuff and UnitBuffLeftTime indices match.


    Thank you!


    (PS: Also, now I see: UnitBuffInfo gives not only hidden buffs but also debuffs without any indication what is what...)

  • Uure

    Changed the title of the thread from “UnitBuffLeftTime question” to “[Solved] UnitBuffLeftTime question (use UnitBuff not UnitBuffInfo)”.
  • Moderator

    Closed the thread.
  • Moderator

    Added the Label Graphics/Engine