Thread Tools Display Modes
05/21/17, 11:48 AM   #1
kitherel
AddOn Author - Click to view addons
Join Date: May 2017
Posts: 3
Guild rank permissions change via code only

Hi,

Has anyone got any addons which change guild rank permissions without the need to click stuff in the interface? Or know if/how I can edit the rank permissions via LUA.

The scenario i'm looking at is being able trigger the removal of guild withdrawal permissions from certain ranks via an addon. I'm looking at having this triggered during logoff/quit and have the pre-hooks working for that, therefore I dont want any further gui interaction to be necessary.

Any advice or pointers would be appreciated.

Regards,

Kith
  Reply With Quote
05/21/17, 11:58 AM   #2
Rhyono
AddOn Author - Click to view addons
Join Date: Sep 2016
Posts: 659
Originally Posted by kitherel View Post
The scenario i'm looking at is being able trigger the removal of guild withdrawal permissions from certain ranks via an addon. I'm looking at having this triggered during logoff/quit and have the pre-hooks working for that, therefore I dont want any further gui interaction to be necessary.
So for example: rank X has withdrawal permissions while you are logged in, but when you log off, you want to turn it off for them?

I don't have permission editing in any of the guilds I'm in, so I can't test things.

I'm not sure if this function is relevant: ComposeGuildRankPermissions
  Reply With Quote
05/21/17, 01:07 PM   #3
kitherel
AddOn Author - Click to view addons
Join Date: May 2017
Posts: 3
Hi Rhyono,

Yes, exactly that, to protect guild bank when not logged on, have addon that monitors removals etc but it wont be in effect when our guild leader logs off.

I made a guild for testing purposes and have looked at the function:

ComposeGuildRankPermissions(number permissions, number permission, boolean enabled)

I cant quite fathom out if this is actually setting a change, or just pending the change, but moreover, since it doesn't have a parameter for the guild, how do I set a guild i'm working with first?

Appreciate your suggestion and i'll keep digging also.

Regards,

Kith
  Reply With Quote
05/21/17, 02:44 PM   #4
Dolgubon
 
Dolgubon's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2016
Posts: 409
The only person who can change guild permissions is the GM, and you can only be GM of one guild, so it is possible that the function is correct.
  Reply With Quote
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

ESOUI » AddOns » AddOn Help/Support » Guild rank permissions change via code only


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off