iMod 99 Posted May 3, 2021 Share Posted May 3, 2021 (edited) Hi everyone, is there a efficent way to get the raid group number of a raid member or the whole raid? Edited May 3, 2021 by iMod Link to comment Share on other sites More sharing options...
iMod 99 Posted May 10, 2021 Author Share Posted May 10, 2021 (edited) 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 May 10, 2021 by iMod Link to comment Share on other sites More sharing options...
iMod 99 Posted May 10, 2021 Author Share Posted May 10, 2021 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now