WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   General Authoring Discussion (https://www.wowinterface.com/forums/forumdisplay.php?f=20)
-   -   Function to distinguish party from raid? (https://www.wowinterface.com/forums/showthread.php?t=45154)

indoviet 11-15-12 07:35 AM

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!

d87 11-15-12 07:52 AM

UnitInRaid("player"), IsInRaid()
UnitInParty, IsInGroup

indoviet 11-15-12 07:59 AM

Thanks heaps, I don't know why I couldn't find those.

Dridzt 11-15-12 08:46 AM

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)

indoviet 11-15-12 06:51 PM

Great tip, thanks a a lot.

Ketho 11-15-12 07:41 PM

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


All times are GMT -6. The time now is 11:23 AM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI