This is an old revision of the document!
A collection of useful functions that are necessary to run my addons.
Feel free to use them for your personal stuff!
If you need support with this library or just wanna chat, join my discord server! :D
Updated on 08-05-2021.
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 }
--[[ 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) --[[ Get the normalization translation table @returns {table} ]] MashLib.Helpers.GetNormalizationTable() --[[ Get the special char normalization translation table @returns {table} ]] MashLib.Helpers.GetSpecialCharTable() --[[ Normalizes a string @param {string} string @param {boolean} parameterize @returns {string} ]] MashLib.Helpers.Normalize(string, parameterize) --[[ Returns the file name from path @param {string} path @returns {string} ]] MashLib.Helpers.GetFileNameFromPath(path) --[[ Split string @param {string} inputstr @param {string} separator @returns {string} ]] MashLib.Helpers.SplitString(inputstr, sep) --[[ Limit a string length @param {string} string @param {int} length @returns {string} ]] MashLib.Helpers.LimitLength(string, length) --[[ Validates an email string @param {string} str @returns {boolean} ]] MashLib.Helpers.ValidateEmail(str)
--[[ 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) --[[ Get expansion list @param {string} type @return {table} ]] MashLib.System.GetExpansionList(type) --[[ Get expansion by id @param {int} expansionid @return {table} ]] MashLib.System.GetExpansionByID(expansionid) --[[ Returns the file names inside a folder, and the files inside subfolders Thanks to xSalice! <3 @param {string} folder path @return {table} ]] MashLib.System.GetFilesInside(folder)
--[[ 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)
--[[ 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() --[[ Converts world coordinates to map coordinates @param optional {table} world coords @param optional {bool} exact @return {table} ]] MashLib.Space.WorldToMap(coords, exact) --[[ Converts map coordinates to world coordinates Thanks to Kali and Kitano <3 @BUG! https://trello.com/c/lACuNP4q/48-mashhunt-add-mark-manually @param {table} map coords @param {int} scale @return {table} ]] MashLib.Space.MapToWorld(coords, mapid) --[[ Gets a specific map's scale @param {int} mapid @return {int} ]] MashLib.Space.GetMapScale(id)
--[[ Get the list of buffs on your character @return {table} ]] MashLib.Character.GetBuffList() --[[ 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)
--[[ Get an API endpoint's info by name @param {string} name @return {table} ]] MashLib.API.GetEndpoint(name)
--[[ Get a craft condition by name @param {string} name @return {table} ]] MashLib.Crafting.GetCondition(name)
-- Nothing yet
--[[ Logs an entity @param {table} target @return {table} ]] MashLib.Logging.Entity(target)
--[[ 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 info by ID @param {int} job @param {id} id @return {int} id ]] MashLib.Battle.GetSkillInfoById(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 [(optional) on a specific job] @param {int} job @param {boolean} to_combo @param {int} specific job id @return {table} ]] MashLib.Battle.GetSkillListWithCD(to_combo, specific)
--[[ 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)
--[[ 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()