View Single Post
07-16-19, 10:03 PM   #5
Ketho
A Pyroguard Emberseer
 
Ketho's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,026
Originally Posted by Aeriez View Post
That actually just appears to give rank permissions.

Just pointing you in the right direction. It's not that much of roundabout way

Lua Code:
  1. local members, ranks = {}, {}
  2.  
  3. local function GetPermissions()
  4.     for i = 1, GetNumGuildMembers() do
  5.         local name, _, rankIndex, _, _, _, _, _, _, _, _, _, _, _, _, _, guid = GetGuildRosterInfo(i)
  6.         members[guid] = rankIndex + 1
  7.     end
  8.     for i = 1, MAX_GUILDRANKS or 10 do
  9.         ranks[i] = C_GuildInfo.GuildControlGetRankFlags(i)
  10.     end
  11. end
  12.  
  13. -- /dump DoesPlayerHavePermissions("target", 12)
  14. function DoesPlayerHavePermissions(unit, flag)
  15.     if IsInGuild() then
  16.         if not next(members) then
  17.             GetPermissions()
  18.         end
  19.         local guid = UnitGUID(unit)
  20.         local member = ranks[members[guid]]
  21.         return member and member[flag]
  22.     end
  23. end

Modify it if you want it to check against names (GGRI includes realm) instead of guids

Last edited by Ketho : 07-16-19 at 10:43 PM.
  Reply With Quote