View Single Post
09-10-14, 07:18 PM   #1
galvin
A Frostmaul Preserver
AddOn Author - Click to view addons
Join Date: Nov 2006
Posts: 265
GetRaidRosterInfo bug

Will return nil if a new person joins the raid. But only one time.
I tested this on the leveling realm, had someone join from the pve 100 realm.
once the game sees the player, even if that player logs out back in, the function won't return nil
anymore. ignore the print functions, that's just debug testing code.
I use this function when GROUP_ROSTER_UPDATE fires.

Code:
function GWL:GROUP_ROSTER_UPDATE()
  local Found = false
  local MaxMembers = GetNumGroupMembers()

  -- Preset the waitlist to Outside
  if WaitList then
    for Index, _ in pairs(WaitList) do
      WaitList[Index] = Outside
    end
  end

  -- Return if not in a group/raid.
  if MaxMembers > 0 then

    -- If first time joining a raid then start a new waitlist.
    if not RaidActive then
      ClearWaitList()
      RaidActive = true
    end

    for Index = 1, MaxMembers do

      -- Set player as in raid.
      local Player = GetRaidRosterInfo(Index)
      print('>', Player, Player == nil)
      if Player and Player ~= '' then
        Player = Ambiguate(GetRaidRosterInfo(Index), 'none')
        if Player then
          print(':', Player)
          WaitList[Player] = InRaid
        end
      end
    end
  else
    RaidActive = false
  end

  -- Save RaidActive status
  GalvinWaitListDB.RaidActive = RaidActive

  return Found
end