Thread Tools Display Modes
11-15-12, 07:35 AM   #1
indoviet
A Murloc Raider
AddOn Author - Click to view addons
Join Date: Jan 2009
Posts: 8
Function to distinguish party from raid?

Hi,
I've scoured the WoW API for a function that can return whether the player is in a party or a raid but can't seem to find one that does the job. Is there a function specifically designated for this or another way to check this?

Thanks!
  Reply With Quote
11-15-12, 07:52 AM   #2
d87
A Chromatic Dragonspawn
 
d87's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2006
Posts: 163
UnitInRaid("player"), IsInRaid()
UnitInParty, IsInGroup
  Reply With Quote
11-15-12, 07:59 AM   #3
indoviet
A Murloc Raider
AddOn Author - Click to view addons
Join Date: Jan 2009
Posts: 8
Thanks heaps, I don't know why I couldn't find those.
  Reply With Quote
11-15-12, 08:46 AM   #4
Dridzt
A Pyroguard Emberseer
 
Dridzt's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2005
Posts: 1,360
Just a note that IsInGroup() returns true for both party and raid.

A typical check is
Code:
if IsInRaid() then
  -- we're in a raid
elseif IsInGroup() then
  -- we're not in a raid but we are in a group, hence party
end
Similarly GetNumGroupMembers() always returns the size of the widest group the player belongs to (raid members if in raid, party members if in party)
while GetNumSubGroupMembers() always returns the size of the narrowest group the player belongs to (Group2 members if player is in G2 in a raid, party members if in a party)

Last edited by Dridzt : 11-15-12 at 08:48 AM.
  Reply With Quote
11-15-12, 06:51 PM   #5
indoviet
A Murloc Raider
AddOn Author - Click to view addons
Join Date: Jan 2009
Posts: 8
Great tip, thanks a a lot.
  Reply With Quote
11-15-12, 07:41 PM   #6
Ketho
A Pyroguard Emberseer
 
Ketho's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,026
This is probably trivial and superfluous information now but here is also some kind of truth table to compare against
Lua Code:
  1. .                      solo     party(5)  raid(25)
  2.  
  3. IsInRaid               false    false     true
  4. IsInGroup              false    true      true
  5.  
  6. GetNumGroupMembers     0        5         25
  7. GetNumSubgroupMembers  0        4         4
  8.  
  9. UnitInRaid("player")   nil      nil       11
  10. UnitInParty("player")  nil      1         1

Last edited by Ketho : 11-15-12 at 07:55 PM.
  Reply With Quote

WoWInterface » Developer Discussions » General Authoring Discussion » Function to distinguish party from raid?

Thread Tools
Display Modes

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