Go Back   WowAce Forums > General > Lua Code Discussion
Lua Code Discussion You scared? Terrified. Mortified. Petrified. Stupefied... by [coding].

Reply
 
Thread Tools
Old 01-17-2012   #1
andr0id
Member
 
Join Date: Nov 2010
Posts: 25
Default How do I figure out what size raid group I am in?

Alright, I'm in a forming raid group and there GetNumRaidMembers() returns 7.

How do I know if that's 7/10, 7/25 or even possibly 7/40?

I see no way to get the M part of n/M where n is how many members are now present, but M is what "Raid Difficulty" is set to under the leaders drop down menu.

Surely this should be easy, but I'm missing it completely.

Thanks for any help,
Andy
andr0id is offline   Reply With Quote
Old 01-17-2012   #2
Dridzt
Hero Member
 
Dridzt's Avatar
 
Join Date: Nov 2005
Posts: 872
Default Re: How do I figure out what size raid group I am in?

GetInstanceInfo
Dridzt is offline   Reply With Quote
Old 01-17-2012   #3
Phanx
Seal Cub Clubbing Club
 
Phanx's Avatar
 
Join Date: May 2005
Location: United States
Posts: 8,154
Default Re: How do I figure out what size raid group I am in?

GetInstanceInfo will only work if you're already inside the target instance.

To get the currently selected raid difficulty before you enter the instance, use GetRaidDifficulty (return values match passable parameters for SetRaidDifficulty). You may also wish to check whether you are in a battleground or outdoor combat zone (usually treated as a 40-player raid), a battleground, etc. Here is the relevant code from Grid that determines which group type the player is currently in:
Code:
	local function GetPartyState()
		local _, instance_type = IsInInstance()

		if instance_type == "arena" then
			return "arena"
		end

		if instance_type == "pvp" then
			return "bg"
		end

		if GetNumRaidMembers() > 0 then
			if instance_type == "none" and GetZonePVPInfo() == "combat" then
				return "bg"
			end
			if instance_type == "raid" then
				local _, _, _, _, max_players = GetInstanceInfo()
				return max_players > 10 and "raid_25" or "raid_10"
			else
				local raid_difficulty = GetRaidDifficulty()
				return (raid_difficulty == 2 or raid_difficulty == 4) and "raid_25" or "raid_10"
			end
		end

		if GetNumPartyMembers() > 0 then
			return "party"
		end

		return "solo"
	end
This function is called in response to the following events:
  • PLAYER_ENTERING_WORLD
  • PARTY_MEMBERS_CHANGED
  • RAID_ROSTER_UPDATE
  • UNIT_NAME_UPDATE
  • UNIT_PET
  • UNIT_PORTRAIT_UPDATE
  • ZONE_CHANGED_NEW_AREA
__________________
Author/maintainer of Grid, PhanxChat, and many more. | PM me on CurseForge
Troubleshoot an addon | Turn any code into an addon | More addon resources
Need help with your code? Attach or paste your whole, real files.
Please don't PM me about addon bugs, requests, or code help. Post a comment, ticket, or thread instead!
Phanx is offline   Reply With Quote
Old 01-17-2012   #4
andr0id
Member
 
Join Date: Nov 2010
Posts: 25
Default Re: How do I figure out what size raid group I am in?

Thank you, I will give that a try.
andr0id is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

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

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

Forum Jump


All times are GMT. The time now is 02:23 AM.