Table of Contents

MinionLib Lua

This minionlib library is holding the core functionality on which all our bots are running. You can freely use the available functions for your Addon, in order to do that, you just need to open your module.def and set the dependency of your Addon to the minionlib:

[Module]
Name=YourAddon
Dependencies=minionlib
Version=1
Files=myluacode.lua
Enabled=1

Minion Menu

The Minion Menu is the main menu used by minion to access all settings and addons. 3rd-party developers may add custom options to the menu in several different ways.

Structure

The minion is layered into 3 distinct parts, components, members, and submembers.

All components must have a header and (optionally) members, which are displayed when the header is clicked (and the menu is open).
All component headers require the following properties: bool expanded, string name, string id
All component headers optionally contain the following properties: string texture

Members are displayed below their component containers, and they represent the rows that appear directly below the header.
Members may optionally contain submembers.
All members require the following properties: string name, string id
All members optionally contain the following properties: string texture, string tooltip, function onClick, bool sort

Submembers are displayed to the right and grow vertically downward. They are useful if you wish to section off a large amount of events.
Submembers will be sorted in alphabetical order by name if the sort tag is specified on the parent member.
All submembers require the following properties: string name, string id
All submembers optionally contain the following properties: string texture, string tooltip, function onClick

API
Example
local ffxiv_mainmenu = {
	header = { id = "FFXIVMINION##MENU_HEADER", expanded = false, name = "FFXIVMinion", texture = GetStartupPath().."\\GUI\\UI_Textures\\ffxiv_shiny.png"},
	members = {	}
}
 
ml_gui.ui_mgr:AddComponent(ffxiv_mainmenu)
ml_gui.ui_mgr:AddMember({ id = "FFXIVMINION##MENU_DEV1", name = "Dev1", onClick = function() Dev.GUI.open = not Dev.GUI.open end, tooltip = "Open the Dev monitor."},"FFXIVMINION##MENU_HEADER")
ml_gui.ui_mgr:AddMember({ id = "FFXIVMINION##MENU_DEV2", name = "Dev2", onClick = function() Dev.GUI.open = not Dev.GUI.open end, tooltip = "Open the Dev monitor."},"FFXIVMINION##MENU_HEADER")
ml_gui.ui_mgr:AddMember({ id = "FFXIVMINION##MENU_DEV3", name = "Dev3", onClick = function() Dev.GUI.open = not Dev.GUI.open end, tooltip = "Open the Dev monitor."},"FFXIVMINION##MENU_HEADER")
ml_gui.ui_mgr:AddMember({ id = "FFXIVMINION##MENU_DEV4", name = "Dev4", onClick = function() Dev.GUI.open = not Dev.GUI.open end, tooltip = "Open the Dev monitor."},"FFXIVMINION##MENU_HEADER")
ml_gui.ui_mgr:AddMember({ id = "FFXIVMINION##MENU_DEV5", name = "Dev5", onClick = function() Dev.GUI.open = not Dev.GUI.open end, sort = true},"FFXIVMINION##MENU_HEADER")
ml_gui.ui_mgr:AddSubMember({ id = "FFXIVMINION##DEV_1", name = "DevA", onClick = function() Dev.GUI.open = not Dev.GUI.open end, tooltip = "Open the Dev monitor."},"FFXIVMINION##MENU_HEADER","FFXIVMINION##MENU_DEV5")
ml_gui.ui_mgr:AddSubMember({ id = "FFXIVMINION##DEV_2", name = "DevE", onClick = function() Dev.GUI.open = not Dev.GUI.open end, tooltip = "Open the Dev monitor."},"FFXIVMINION##MENU_HEADER","FFXIVMINION##MENU_DEV5")
ml_gui.ui_mgr:AddSubMember({ id = "FFXIVMINION##DEV_3", name = "DevM", onClick = function() Dev.GUI.open = not Dev.GUI.open end, tooltip = "Open the Dev monitor."},"FFXIVMINION##MENU_HEADER","FFXIVMINION##MENU_DEV5")
ml_gui.ui_mgr:AddSubMember({ id = "FFXIVMINION##DEV_4", name = "DevC", onClick = function() Dev.GUI.open = not Dev.GUI.open end, tooltip = "Open the Dev monitor."},"FFXIVMINION##MENU_HEADER","FFXIVMINION##MENU_DEV5")

Utility Functions

General
File I/O

For every I/O function, you need to use double dashes! Example: FolderExists(“c:\\minionapp\\ILikeBeer\\Folder”)

String

The following functions extend the default string from the lua library. Usage: string.contains(..)

Table

The following functions extend the default table from the lua library. Usage: table.valid(..)

Math

The following functions extend the default math from the lua library. Usage: math.distance3d(..)

Structure

The minion is layered into 3 distinct parts, components, members, and submembers.

All components must have a header and (optionally) members, which are displayed when the header is clicked (and the menu is open).
All component headers require the following properties: bool expanded, string name, string id
All component headers optionally contain the following properties: string texture

Members are displayed below their component containers, and they represent the rows that appear directly below the header.
Members may optionally contain submembers.
All members require the following properties: string name, string id
All members optionally contain the following properties: string texture, string tooltip, function onClick, bool sort

Submembers are displayed to the right and grow vertically downward. They are useful if you wish to section off a large amount of events.
Submembers will be sorted in alphabetical order by name if the sort tag is specified on the parent member.
All submembers require the following properties: string name, string id
All submembers optionally contain the following properties: string texture, string tooltip, function onClick

API

HTTPRequest

Use this function to do any kind of asynchronous http calls. Example:

function SendHttpRequest()
   local function success(str, header, statuscode)
      d("HTTP Request: success.")
      d("HTTP Result Header: " .. tostring(header))
      d("HTTP Result StatusCode: " .. tostring(statuscode))
 
      local data = json.decode(str)
      if data then
         d("HTTP Request: data valid. Currency Coin info:")
         d(data)
      end
 
      local function HeadersTable(header)
         if type(header) == "string" and #header > 0 then
            header = string.match(header,".?%c(.*)") -- Removing the first entry
            local tbl = {}
            for w in header:gmatch("[^%c]+") do
               local k,v = string.match(w,"(.*): (.*)")
               tbl[k] = v
            end
            table.print(tbl)
            return tbl
         end
      end
 
      header = HeadersTable(header) -- if you want to convert the header string to a table
   end
 
   local function failed(error, header, statuscode)
      d("HTTP Failed Error: " .. error)
      d("HTTP Failed Header: " .. header)
      d("HTTP Failed StatusCode: " .. tostring(statuscode))
   end
 
   local params = {
      host = "api.guildwars2.com",
      path = "/v2/currencies?ids=1",
      port = 443,
      method = "GET", -- "GET","POST","PUT","DELETE"
      https = true,
      onsuccess = success,
      onfailure = failed,
      getheaders = true, --true will return the headers, if you dont need it you can leave this at nil
      body = "", --optional, if not required for your call can be nil or ""
      headers = {}, --optional, if not required for your call can be nil or ""
   }
 
   HttpRequest(params)
end