Jump to content

[WOTLK] Raid group info


iMod

Recommended Posts

Hi everyone,

is there a efficent way to get the raid group number of a raid member or the whole raid?

Edited by iMod
Link to comment
Share on other sites

On 5/7/2021 at 2:14 AM, Sye24 said:

I'd recommend using lua.



			List<string> RaidDatabase = new List<string>();
            int GetRaidMembers = Lua.LuaDoString<int>("return GetNumRaidMembers();");
            for (int i = 0; i <= GetRaidMembers; i++)
            {
                List<string> RaidMemberNames = Lua.LuaDoString<List<string>>("unpack(UnitName(\"raid\".." + i + "));");
                foreach(string Members in RaidMemberNames)
                {
                    if(!RaidDatabase.Contains(Members))
                    {
                        RaidDatabase.Add(Members);
                        Logging.Write("Raid Database built.");
                    }
                }
            }
            return RaidDatabase;

 

Thanks for your anwer.

I'm currently using

        public static int? GetGroupNumber(this WoWUnit instance)
        {
            // Create lua command
            string luaCommand = $@"for i = 1, GetNumRaidMembers() do
                                                    name, rank, groupNumber = GetRaidRosterInfo(i);
                                                    if(name == '{instance.Name}') then
                                                        return groupNumber;
                                                     end
                                                  end
                                                  ";

            // Get index number of the unit
            int result = Framelock.Lock(() =>
            {
                // Return
                return Lua.LuaDoString<int>(command: luaCommand);
            });

            // Failed?
            if (result == 0)
            {
                // Return
                return null;
            }

            // Return
            return result;
        }

But I will compare both methods and check what performs better.

Edited by iMod
Link to comment
Share on other sites

11 minutes ago, Sye24 said:

I’d recommend locking the frame to run the Lua, makes getting the results faster

Thanks I modified my version above and will test it later.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...