User Tools

Site Tools



mashlib

This is an old revision of the document!


A collection of useful commands that are going to be necessary to run my future addons.

Support

If you need support with this library or just wanna chat, join my discord server! :D

Structure

MashLib = {
    Helpers, -- Helpful stuff
    System, -- FFXIV related stuff (servers, regions, etc)
    Powershell, -- Powershell related stuff
    Space, -- Spatial related stuff
    Character, -- Character related stuff
    API, -- API Requests
    Crafting, -- Crafting related stuff
    Gathering, -- Gathering related stuff
    Logging, -- In-dept logging
    Misc, -- Temporary values
    Battle, -- Battle related stuff
    Hunt, -- The Hunt related stuff
    Hacks -- Useful hacks
}

Helpers

--[[
    Get current time
    @param {type} type = 'epoch', 'formatted' or 'formatted_no_spec'
    @return {string}
]]
MashLib.Helpers.GetTime(type)
 
--[[
    Returns the time since the param
    @param {string} time
    @return {int}
]]
MashLib.Helpers.TimeSince(time)
 
--[[
    Get a keyboard's key info
    @param {string} key
    @returns {table}
]]
MashLib.Helpers.GetKeyInfo(key)
 
--[[
    Get a map's name
    @param {int} id
    @param {string} mode - 'default' or 'to_log'
    @returns {string}
]]
MashLib.Helpers.GetMapName(id, mode)
 
--[[
    Returns float with a specific decimal
    @param {bool} float
    @returns {int}
]]
MashLib.Helpers.ToFixed(float, dec)
 
--[[
    Return the size of the table
    @param {table} tbl
    @returns {int}
]]
MashLib.Helpers.SizeOf(tbl)
 
--[[
    Turns seconds into milliseconds
    @param {int} time
    @returns {int}
]]
MashLib.Helpers.HandleCoolDowns(time)
 
--[[
    Get the highest value from table
    @param {table} tbl
    @returns {int}
]]
MashLib.Helpers.GetMax(tbl)
 
--[[
    Get the lowest value from table
    @param {table} tbl
    @returns {int}
]]
MashLib.Helpers.GetMin(tbl)

System

--[[
    Get most common keys from the keyboard.
    @returns {Table}
]]
MashLib.System.GetCommonKeys()
 
--[[
    Get a Server by it's ID
    @param {int} id
    @returns {table}
]]
MashLib.System.GetServer(id)
 
--[[
    Get channel list
    @param {int} id
    @returns {table}
]]
MashLib.System.GetChannelList()
 
--[[
    Get channel by id
    @returns {table}
]]
MashLib.System.GetChannel(id)
 
--[[
    Get a Region by it's ID
    @param {int} id
    @returns {string}
]]
MashLib.System.GetRegion(id)
 
--[[
    Get a Job's name by it's ID
    @param {int} id
    @returns {string}
]]
MashLib.System.GetJob(id)
 
--[[
    Get a Job's ID by it's name
    @param {string} name
    @returns {int}
]]
MashLib.System.GetJobId(name)
 
--[[
    Get the job list by all or by dominion
    @param {string} dominion - 'battle', 'h-l', 'any'
    @returns {int}
]]
MashLib.System.GetJobList(dominion)
 
--[[
    Check if the character is logged in or not
    @returns {boolean}
]]
MashLib.System.CheckLogin()
 
--[[
    Get current map's ID by name
    @param {string} name
    @return {int}
]]
MashLib.System.GetMapId(name)
 
--[[
    Get current map's info by Id
    @param {int} id
    @return {table}
]]
MashLib.System.GetMap(id)
 
--[[
    Loads and run a lua file
    @param {string} filePath
    @return {variant} Code return
]]
MashLib.System.Require(filePath)
 
--[[
    Converts TerritoryId to MapId
    @param {int} territoryid
    @return {int}
]]
MashLib.System.GetMapIDFromTerritoryID(id)

Powershell

--[[
    Execute a powershell file (.ps1)
    @param {string} path
]]
MashLib.Powershell.ExecuteFile(path)
 
--[[
    Downloads a file
    @param {string} url
    @param {string} path on system
]]
MashLib.Powershell.DownloadFile(url, path)
 
--[[
    Opens a url in your browser
    @param {string} url
]]
MashLib.Powershell.OpenLink(url)

Space

--[[
    Moves character to coords
    @param {table} coords
]]
MashLib.Space.MoveTo(coords)
 
--[[
    Stops character from moving
]]
MashLib.Space.Stop()
 
--[[
    Get random coordinates around another coordinates, in a circular area
    Thanks to Kitanoi <3
    @param {table} coords
    @param {int} radius
    @return {table}
]]
MashLib.Space.RandomPosCloseToCoords(coords, radius)
 
--[[
    Calculates the 2D distance between two points
    Thanks to Kali <3
    @param {table} pos
    @param {table} pos2
    @param {bool} ignoreradius
    @return {int}
]]
MashLib.Space.Distance2D(pos, pos2, ignoreradius)
 
--[[
    Calculates the 3D distance between two points
    Thanks to Kali <3
    @param {table} pos
    @param {table} pos2
    @param {bool} ignoreradius
    @return {int}
]]
MashLib.Space.Distance3D(pos, pos2, ignoreradius)
 
--[[
    Places a flag in the map
    @param {int} territoryid
    @param {table} world coords -> x, z
    @param optinal {int} mapid
]]
MashLib.Space.SetMapFlag(territoryid, coords, mapid)
 
--[[
    Gets the flag position in the map
    @return {table}
]]
MashLib.Space.GetMapFlag()

Character

--[[
    Get the list of buffs on your character
    @return {table}
]]
MashLib.Character.GetBuffList()
 
--[[
    Converts world coordinates to map coordinates
    @param optional {table} world coords
    @param optional {bool} exact
    @return {table}
]]
MashLib.Character.GetMapCoords(coords, exact)
 
--[[
    Teleports the player to the map with corresponding id
    @param {int} aetheryteid
]]
MashLib.Character.TeleportTo(aetheryteid)
 
--[[
    Checks if character is casting teleport
    @return {boolean}
]]
MashLib.Character.IsCastingTeleport()
 
--[[
    Switch between Standard (0) and Legacy (1) move modes
    @param {int} id
]]
MashLib.Character.SetMoveModeTo(id)

API

--[[
    Get an API endpoint's info by name
    @param {string} name
    @return {table}
]]
MashLib.API.GetEndpoint(name)

Crafting

--[[
    Get a craft condition by name
    @param {string} name
    @return {table}
]]
MashLib.Crafting.GetCondition(name)

Gathering

-- Nothing yet

Logging

--[[
    Logs an entity
    @param {table} target
    @return {table}
]]
MashLib.Logging.Entity(target)

Battle

--[[
    Get an encounter info by ID
    @param {int} id
    @return {table}
]]
MashLib.Battle.GetEncounter(id)
 
--[[
    Get encounter list
    @return {table}
]]
MashLib.Battle.GetEncounterList()
 
--[[
    Get last skill casted's id
    @return {int} id
]]
MashLib.Battle.GetLastCastID()
 
--[[
    Get skill ID by Name
    @param {int} job
    @param {string} name
    @return {int} id
]]
MashLib.Battle.GetSkillId(job, name)
 
--[[
    Get skill Name by ID
    @param {int} job
    @param {id} id
    @return {int} id
]]
MashLib.Battle.GetSkillNameByID(job, id)
 
--[[
    Get a list of skills on a specific job
    @param {int} job
    @return {table}
]]
MashLib.Battle.GetSkillListByJobID(job)
 
--[[
    Get a list of skills with specified cooldowns on a specific job
    @param {int} job
    @param {boolean} to_combo
    @return {table}
]]
MashLib.Battle.GetSkillListWithCDByJobID(job, to_combo)

Hunt

--[[
    Get a mark's name by it's id
    @param {string} expansion
    @param {string} rank
    @param {int} contentid
    @retun {string}
]]
MashLib.Hunt.GetMarkNameByID(expansion, rank, contentid)

Hacks

--[[
    Set character's speed
    @param {int} fly
    @param {int} walk
    @param {int} mount
]]
MashLib.Hacks.Speed.Set(fly, walk, mount)
 
--[[
    Reset character's speed
]]
MashLib.Hacks.Speed.Reset()
mashlib.1616521802.txt.gz · Last modified: 2021/03/23 17:50 by masshirodev