View Single Post
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: 5,000
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