1. #1

    Lightbulb LFG/FR Queued Time

    I am making a small addon to display the amount of time I have been waiting for a dungeon or Raid Finder along with the wait time I was supposed to be waiting for when I joined the Q in the label of an LDB plugin. I have begun with the following code and am frustrated so far:

    Code:
    hasData, leaderNeeds, tankNeeds, healerNeeds, dpsNeeds, instanceType, instanceName, averageWait, tankWait, healerWait, damageWait, myWait, queuedTime = GetLFGQueueStats()
    if hasData then -- we are in the Q
    -- get the time we haved waited, and the estimated time we are supposed to wait and output them.
    lfgWaited = GetTime() - queuedTime;
    end

    I would like to format the time into human readable numbers instead of the seconds, but am unsure how to do this (so it read something like "4:05 / 16:30" to show I have been waiting 4 minutes and 5 seconds out of the expected 16 minutes and 30 seconds). Also, there seems to be a few events revolving around queue status updates, and I am wondering which one I should be checking for? LFG_QUEUE_STATUS_UPDATE seems like it would be the one, but I am unable to find any information about it using WoWWiki, WoWPedia, or WowProgramming.com. Anyways, any help would be hot. Thanks MMO-Champion.
    My AddOns: SMQueue (@WoWInterface) (@Curse)

  2. #2
    Deleted
    Hi,

    try this:
    Code:
    local output = string.format("%d:%d", math.floor(deltatime/60), deltatime-(math.floor(deltatime/60)*60))
    Or date(). You can find all possible "tags" for the first argument of date() here: http://www.lua.org/pil/22.1.html
    Code:
    local output = date("%H:%M:%S", deltatime)

    And have you tried LFG_QUEUE_STATUS_UPDATE? Is it not what you are looking for? I couldn't find any documentation either but I found a paste on Curse (http://www.curseforge.com/paste/1540/) and starting at line 69 he or she calls GetLFGQueueStats() after receiving LFG_QUEUE_STATUS_UPDATE and discards everything but hasData. I recommend you try it out and see what happens.
    Last edited by mmoca92f6e820c; 2012-07-01 at 08:45 AM.

  3. #3
    Quote Originally Posted by Corbomite View Post
    Hi,

    try this:
    Code:
    local output = string.format("%d:%d", math.floor(deltatime/60), deltatime-(math.floor(deltatime/60)*60))
    This seems to work great. I changed the formatting string to add leading zero's to the numbers. Also,
    Code:
    GetTime() - queuedTime
    this is supposed to give me the length of time that I have been waiting in queue, but it doesn't seem to. And trying to format it using the same set code produces weird results, maybe I'm not understanding it or something. Any more help would be appreciated! Thanks.

    P.S. I have found a temporary solution to this, which is to use a AceTimer object and have it begin iterating when the player enter's the Q, but say they need to do a UI reload, and they are still in the Q, the timer will have to restart and the time elapsed since they have started the Q will be wrong based on the AceTimer object. So I'd like to be able to pull it from the GetLFGQueueStats() function. Anyways.
    Last edited by sorcerermerlin; 2012-07-01 at 11:17 AM.
    My AddOns: SMQueue (@WoWInterface) (@Curse)

  4. #4
    Deleted
    It seems that your code is expecting old return values from GetLFGQueueStats().

    This is how FrameXML/LFGFrame.lua (http://wowprogramming.com/utils/xmlb...L/LFGFrame.lua) uses GetLFGQueueStats().
    Code:
    local hasData,  leaderNeeds, tankNeeds, healerNeeds, dpsNeeds, totalTanks, totalHealers, totalDPS, instanceType, instanceSubType, instanceName, averageWait, tankWait, healerWait, damageWait, myWait, queuedTime = GetLFGQueueStats();

    Doing GetTime()-queuedTime should now return the correct information. Also, the UI uses the SecondsToTime() function to format the output to something like "6 Min 46 Sec". Maybe this helps you too.

  5. #5
    Quote Originally Posted by Corbomite View Post
    It seems that your code is expecting old return values from GetLFGQueueStats().

    This is how FrameXML/LFGFrame.lua (http://wowprogramming.com/utils/xmlb...L/LFGFrame.lua) uses GetLFGQueueStats().
    Code:
    local hasData,  leaderNeeds, tankNeeds, healerNeeds, dpsNeeds, totalTanks, totalHealers, totalDPS, instanceType, instanceSubType, instanceName, averageWait, tankWait, healerWait, damageWait, myWait, queuedTime = GetLFGQueueStats();

    Doing GetTime()-queuedTime should now return the correct information. Also, the UI uses the SecondsToTime() function to format the output to something like "6 Min 46 Sec". Maybe this helps you too.
    You were right about the return values, I guess I didn't get the memo! LOL. I should have looked up the FrameLUA code to see if it had changed. The correct time elapsed now works. I am packing this all into an addon that I plan to use as an alternative for iQueue/iWait. It will be called SMQueue and available soon at Curse.com. Thanks for your help!

    * Done! Check the signature for the Add-On Link!
    Last edited by sorcerermerlin; 2012-07-02 at 07:16 AM. Reason: Add-On Link
    My AddOns: SMQueue (@WoWInterface) (@Curse)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •