Thread Tools Display Modes
02/27/24, 07:29 AM   #1
Shuba00
 
Shuba00's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2023
Posts: 20
SubMenu Question

Hello guys, do you know a method to create an item like LAM's submenu, or if is it possible to use directly LAM items in another tab. The problem is, i create a tab in guild section, and in this tab i want to put some info with the submenu items.

Edit: if u know there is a method that can tell me if a player is a GuildMaster?

Last edited by Shuba00 : 02/27/24 at 07:39 AM.
  Reply With Quote
02/27/24, 08:06 AM   #2
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 4,989
You can always call the "widget" functions of LAM controls directly in your lua code to e.g. create a LAM dropdown or checkbox somewhere else, not in a LAM panel, afaik, using the function that the widget uses itsself:
Code:
LAMCreateControl
But I'm not sure if this will work for all controls of LAM. You'd have to test this.
I guess it would work though.

At the bottom of each widget lua file you will find the name of the control that is created, e.g. for a slider
Code:
LAMCreateControl.slider(container, data, name)
Similar for a submenu then:
Code:
function LAMCreateControl.submenu(parent, submenuData, controlName)
The function returns the created container of the control then.


Edit:
You need to get the rank of a guildMemberIndex
and then check if the rank got a guildmaster.
IsGuildRankGuildMaster(guildId, guildRank)

Here is an example code, !!!untested!!!
Lua Code:
  1. --returns nilable:String nameofGuildMaster, nilable:number memberIndexOfGuildMaster
  2. local function getGuildMasterData(guildId)
  3.     local isPlayerGuildMaster = IsPlayerGuildMaster(guildId)
  4.     ---Player is not guild master, so search the guild master
  5.     if not isPlayerGuildMaster then
  6.         local numGuildMembers = GetNumGuildMembers(guildId)
  7.         for memberIndex=1, numGuildMembers, 1 do
  8.             --- @return name string, note string, rankIndex luaindex, playerStatus [PlayerStatus|#PlayerStatus], secsSinceLogoff integer
  9. --->Hint: Not sure if name is the character name or the @displayName (account) here, so test this and use accoridngly to your needs
  10.             local name, _, rankIndex = GetGuildMemberInfo(guildId, memberIndex)
  11.             if rankIndex ~= nil then
  12.                 local isGuildMemberRankGuildMaster = IsGuildRankGuildMaster(guildId, rankIndex)
  13.                 if isGuildMemberRankGuildMaster == true then return name, memberIndex end
  14.             end
  15.         end
  16.     else
  17.         --Player is guild master
  18.         local accountName = GetDisplayName()
  19.         local memberIndex = GetGuildMemberIndexFromDisplayName(guildId, accountName)
  20.         if memberIndex ~= nil then
  21.             return accountName, memberIndex
  22.         end
  23.     end
  24.     return nil, nil
  25. end

Last edited by Baertram : 02/27/24 at 08:17 AM.
  Reply With Quote

ESOUI » Developer Discussions » Lua/XML Help » SubMenu Question


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