Thread Tools Display Modes
04-12-18, 08:32 AM   #1
doofus
A Chromatic Dragonspawn
Join Date: Feb 2018
Posts: 158
GetRaidRosterInfo and GROUP_ROSTER_UPDATE

Some issues with these two.

I am in a raid. Logout. Log back in. I receive 3 invocations of GROUP_ROSTER_UPDATE, and I fire GetRaidRosterInfo as a result. It comes back with "name"= nil "class"=nil "zone"=nil.

If I call it again later it then comes back with the right information.

I am only calling GetRaidRosterInfo to get the "role" (who is the tank) but other than that I do not think I need it.

As an aside, the methods of enumerating raid members are to make up my own "unit" handles depending on I am in a group or in a raid, eg "player" "party1" or "raid1" "raid2". Another way is to get the unit names from the Blizzard's raid frames by constructing the handles "CompactRaidGroup1Member1" or "CompactPartyFrameMember1" but that is as "bad" as constructing the unit handles in the first place.

Because GetRaidRosterInfo cannot be trusted to return the right information maybe I can skip it altogether. Does anyone know a replacement or another way to enumerate party/raid members and their roles ?
  Reply With Quote
04-12-18, 09:12 AM   #2
Kanegasi
A Molten Giant
 
Kanegasi's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2007
Posts: 666
You can find out if it’s a raid or not using IsInRaid(), then just use a for loop with 1-4 in a party and 1-40 in a raid, concatenating "party"..i or "raid"..i. Use UnitName(unit) and UnitGroupRolesAssigned(unit).

Last edited by Kanegasi : 04-12-18 at 09:26 AM. Reason: party 1-4, not 5
  Reply With Quote
04-13-18, 02:11 AM   #3
myrroddin
A Pyroguard Emberseer
 
myrroddin's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 1,240
Lua Code:
  1. if IsInRaid() then
  2.     for i = 1, GetNumGroupMembers() do
  3.         print(UnitName(raid .. i))
  4.     end
  5. elseif IsInGroup()
  6.     for i = 1, GetNumGroupMembers() do
  7.         print(UnitName(party .. i))
  8.     end
  9. else
  10.     print("I am not in a group")
  11. end
GetNumGroupMembers() is great if the party is not a full 4 members or the raid is not a full 40 people. It prevents nil errors this way.
  Reply With Quote
04-13-18, 05:39 AM   #4
Kanegasi
A Molten Giant
 
Kanegasi's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2007
Posts: 666
Originally Posted by myrroddin View Post
Lua Code:
  1. if IsInRaid() then
  2.     for i = 1, GetNumGroupMembers() do
  3.         print(UnitName(raid .. i))
  4.     end
  5. elseif IsInGroup()
  6.     for i = 1, GetNumGroupMembers() do
  7.         print(UnitName(party .. i))
  8.     end
  9. else
  10.     print("I am not in a group")
  11. end
GetNumGroupMembers() is great if the party is not a full 4 members or the raid is not a full 40 people. It prevents nil errors this way.
FWIW, I have witnessed IsInGroup() returning false while in a group. I use the number of group members to reliably check group status, which returns 0 if you aren’t in a group.
  Reply With Quote
04-13-18, 08:54 AM   #5
myrroddin
A Pyroguard Emberseer
 
myrroddin's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 1,240
Originally Posted by Kanegasi View Post
FWIW, I have witnessed IsInGroup() returning false while in a group.
So have I, usually when you use ZONE_CHANGED or ZONE_CHANGED_INDOORS. Each time I've seen IsInGroup() fail, the player has zoned into or out of an instance, although there may be other occurrences.

Should that be the case, check the player's position for x, y. If both exist and both are 0, then register GROUP_ROSTER_UPDATE() and run the code I posted above.

You could also use C_Timer.After and call GRU on a couple of seconds' delay, but if you use this method, you will still have to make sure of x and y.
  Reply With Quote
04-13-18, 08:56 AM   #6
myrroddin
A Pyroguard Emberseer
 
myrroddin's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 1,240
Addenum: when zoning out of an instance, x, y need to exist and have values other than 0, 0 because actual zones have coordinates. 0, 0 is only true while inside instances. Just clarifying before someone calls me on that!
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » GetRaidRosterInfo and GROUP_ROSTER_UPDATE


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off