View Single Post
05/22/17, 06:04 AM   #5
kitherel
AddOn Author - Click to view addons
Join Date: May 2017
Posts: 3
After a lot of digging around, I came up with the following code which I feel should do what I wanted and although the code doesn't produce any LUA errors, doesnt appear to update the permissions as desired:

Code:
  tmpRank = ZO_Object.New(ZO_GuildRank_Shared)
  tmpRank.guildId = 5
  tmpRank.name = GetFinalGuildRankName(tmpRank.guildId, 2) 
  tmpRank.iconIndex = GetGuildRankIconIndex(tmpRank.guildId, 2) 
  tmpRank.permissionSet = {} 
  for i = 1, GetNumGuildPermissions() do 
    tmpRank.permissionSet[i] = DoesGuildRankHavePermission(tmpRank.guildId, 2, i) 
  end
  --asign new permissions
  for i = 1, GetNumGuildPermissions() do
    if i == 16 then 
      newPermissions = ComposeGuildRankPermissions(newPermissions, i, false)
    else
      newPermissions = ComposeGuildRankPermissions(newPermissions, i, tmpRank.permissionSet[i])
    end
  end
  InitializePendingGuildRanks(2)
  AddPendingGuildRank(2, tmpRank.name, newPermissions, tmpRank.iconIndex)
  SavePendingGuildRanks()
If my guild (ID 5) rank 2, permission 16 (Guild bank removal) are set in the GUI to enabled (true) the code above doesn't update it to false but i'm at a loss as to why.

Any ideas anyone ? =) I'm still trying to scout through the base UI source to see if the guild rank is technically removed and re-added rather than overwritten.

Regards,

Kith

Last edited by kitherel : 05/24/17 at 02:57 AM. Reason: corrected some variable issues in code, still not working though :s
  Reply With Quote