Jump to content

Recommended Posts

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
https://wrobot.eu/forums/topic/13033-wotlk-raid-group-info/#findComment-62000
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...