This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
mashlib [2021/02/04 23:15] – masshirodev | mashlib [2021/12/25 22:01] (current) – masshirodev | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ===== MashLib ===== | ||
A collection of useful commands that are going to be necessary to run my future addons. | A collection of useful commands that are going to be necessary to run my future addons. | ||
==== Support ==== | ==== Support ==== | ||
- | If you need support with this library or just wanna chat, join my [[https:// | + | If you need support with this library or just wanna chat, join my [Discord Server](https:// |
==== Structure ==== | ==== Structure ==== | ||
Line 16: | Line 17: | ||
Misc, -- Temporary values | Misc, -- Temporary values | ||
Battle, -- Battle related stuff | Battle, -- Battle related stuff | ||
- | Hacks -- Useful hacks | + | Hacks, -- Useful hacks |
+ | Hunt, -- The Hunt related stuff | ||
+ | Logging, -- Entity Logging | ||
+ | Space, -- 2D and 3D space related stuff | ||
} | } | ||
</ | </ | ||
Line 24: | Line 28: | ||
<code lua> | <code lua> | ||
--[[ | --[[ | ||
- | | + | |
- | @param {string} log | + | @param {type} type = 'epoch', |
- | @param {string} type = 'string' or 'block' | + | @return {string} |
]] | ]] | ||
- | MashLib.Helpers.Log(log, type) | + | function |
--[[ | --[[ | ||
- | Get current | + | Get current |
- | @param {type} type = ' | + | @param {type} type ' |
@return {string} | @return {string} | ||
]] | ]] | ||
- | MashLib.Helpers.GetTime(type) | + | function |
--[[ | --[[ | ||
Line 42: | Line 46: | ||
@return {int} | @return {int} | ||
]] | ]] | ||
- | MashLib.Helpers.TimeSince(time) | + | function |
--[[ | --[[ | ||
Line 49: | Line 53: | ||
@returns {table} | @returns {table} | ||
]] | ]] | ||
- | MashLib.Helpers.GetKeyInfo(key) | + | function |
--[[ | --[[ | ||
Line 57: | Line 61: | ||
@returns {string} | @returns {string} | ||
]] | ]] | ||
- | MashLib.Helpers.GetMapName(id, | + | function |
--[[ | --[[ | ||
- | | + | |
@param {bool} float | @param {bool} float | ||
@returns {int} | @returns {int} | ||
]] | ]] | ||
- | MashLib.Helpers.ToFixed(float) | + | function |
--[[ | --[[ | ||
Line 71: | Line 75: | ||
@returns {int} | @returns {int} | ||
]] | ]] | ||
- | MashLib.Helpers.SizeOf(tbl) | + | function |
- | + | ||
- | --[[ | + | |
- | Return the size of the table | + | |
- | @param {string} expansion -- shb or sb | + | |
- | @returns {int} | + | |
- | ]] | + | |
- | MashLib.Helpers.GetMapsByExpansion(expansion) | + | |
--[[ | --[[ | ||
Line 85: | Line 82: | ||
@returns {int} | @returns {int} | ||
]] | ]] | ||
- | MashLib.Helpers.HandleCoolDowns(time) | + | function |
--[[ | --[[ | ||
Line 92: | Line 89: | ||
@returns {int} | @returns {int} | ||
]] | ]] | ||
- | MashLib.Helpers.GetMax(tbl) | + | function |
--[[ | --[[ | ||
Line 99: | Line 96: | ||
@returns {int} | @returns {int} | ||
]] | ]] | ||
- | MashLib.Helpers.GetMin(tbl) | + | function |
+ | |||
+ | --[[ | ||
+ | Get the normalization translation table | ||
+ | @returns {table} | ||
+ | ]] | ||
+ | function MashLib.Helpers.GetNormalizationTable() | ||
+ | |||
+ | --[[ | ||
+ | Get the special char normalization translation table | ||
+ | @returns {table} | ||
+ | ]] | ||
+ | function MashLib.Helpers.GetSpecialCharTable() | ||
+ | |||
+ | --[[ | ||
+ | Normalizes a string | ||
+ | @param {string} string | ||
+ | @param {boolean} parameterize | ||
+ | @returns {string} | ||
+ | ]] | ||
+ | function MashLib.Helpers.Normalize(string, | ||
+ | |||
+ | --[[ | ||
+ | Returns the file name from path | ||
+ | @param {string} path | ||
+ | @returns {string} | ||
+ | ]] | ||
+ | function MashLib.Helpers.GetFileNameFromPath(path) | ||
+ | |||
+ | --[[ | ||
+ | Split string | ||
+ | @param {string} inputstr | ||
+ | @param {string} separator | ||
+ | @param {string} datatype | ||
+ | @returns {string} | ||
+ | ]] | ||
+ | function MashLib.Helpers.SplitString(inputstr, | ||
+ | |||
+ | --[[ | ||
+ | Join table into a string | ||
+ | @param {string} delimiter | ||
+ | @param {table} table | ||
+ | @returns {table} | ||
+ | ]] | ||
+ | function MashLib.Helpers.Join(delimiter, | ||
+ | |||
+ | --[[ | ||
+ | Limit a string length | ||
+ | @param {string} string | ||
+ | @param {int} length | ||
+ | @returns {string} | ||
+ | ]] | ||
+ | function MashLib.Helpers.LimitLength(string, | ||
+ | |||
+ | --[[ | ||
+ | Validates an email string | ||
+ | @param {string} str | ||
+ | @returns {boolean} | ||
+ | ]] | ||
+ | function MashLib.Helpers.ValidateEmail(str) | ||
+ | |||
+ | --[[ | ||
+ | Returns the percentage of a value | ||
+ | @param {number} percent | ||
+ | @param {number} value | ||
+ | @returns {number} | ||
+ | ]] | ||
+ | function MashLib.Helpers.PercentOf(percent, | ||
+ | |||
+ | --[[ | ||
+ | Removes a value from a table | ||
+ | @param {table} table | ||
+ | @param {string} value | ||
+ | @returns {table} | ||
+ | ]] | ||
+ | function MashLib.Helpers.RemoveByValue(table, | ||
+ | |||
+ | --[[ | ||
+ | Gets a key/value from a value | ||
+ | @param {table} table | ||
+ | @param {string} value | ||
+ | @param {boolean} keyonly | ||
+ | @returns {table} | ||
+ | ]] | ||
+ | function MashLib.Helpers.GetByValue(table, | ||
+ | |||
+ | --[[ | ||
+ | Formats a number with commas | ||
+ | @param {string} number | ||
+ | @returns {string} | ||
+ | ]] | ||
+ | function MashLib.Helpers.FormatNumber(number) | ||
+ | |||
+ | --[[ | ||
+ | Escapes slashes / | ||
+ | @param {string} string | ||
+ | ]] | ||
+ | function MashLib.Helpers.EscapeSlash(string) | ||
+ | |||
+ | --[[ | ||
+ | Returns the first entry in a table | ||
+ | @param {table} table | ||
+ | @param {bool} key | ||
+ | ]] | ||
+ | function MashLib.Helpers.First(table, | ||
+ | |||
+ | --[[ | ||
+ | Returns the last entry in a table | ||
+ | @param {table} table | ||
+ | @param {bool} key | ||
+ | ]] | ||
+ | function MashLib.Helpers.Last(table, | ||
+ | |||
+ | --[[ | ||
+ | Returns the table without empty key/ | ||
+ | @param {table} table | ||
+ | @return {table} | ||
+ | ]] | ||
+ | function MashLib.Helpers.DeleteEmpty(table) | ||
+ | |||
+ | --[[ | ||
+ | Returns a table without the key/value passed | ||
+ | @param {table} table | ||
+ | @param {string} key | ||
+ | @return {table} | ||
+ | ]] | ||
+ | function MashLib.Helpers.DeleteByKey(table, | ||
+ | |||
+ | --[[ | ||
+ | Returns a table without the key/value passed | ||
+ | @param {table} table | ||
+ | @param {any} value | ||
+ | @return {table} | ||
+ | ]] | ||
+ | function MashLib.Helpers.DeleteByValue(table, | ||
+ | |||
+ | --[[ | ||
+ | Returns minion' | ||
+ | @param {int} questId | ||
+ | @return {int} | ||
+ | ]] | ||
+ | function MashLib.Helpers.GetMinionQuestId(questId) | ||
</ | </ | ||
Line 108: | Line 247: | ||
@returns {Table} | @returns {Table} | ||
]] | ]] | ||
- | MashLib.System.GetCommonKeys() | + | function |
--[[ | --[[ | ||
Line 115: | Line 254: | ||
@returns {table} | @returns {table} | ||
]] | ]] | ||
- | MashLib.System.GetServer(id) | + | function |
+ | |||
+ | --[[ | ||
+ | Get channel list | ||
+ | @param {int} id | ||
+ | @returns {table} | ||
+ | ]] | ||
+ | function MashLib.System.GetChannelList() | ||
+ | |||
+ | --[[ | ||
+ | Get channel by id | ||
+ | @returns {table} | ||
+ | ]] | ||
+ | function MashLib.System.GetChannel(id) | ||
--[[ | --[[ | ||
Line 122: | Line 274: | ||
@returns {string} | @returns {string} | ||
]] | ]] | ||
- | MashLib.System.GetRegion(id) | + | function |
--[[ | --[[ | ||
Line 129: | Line 281: | ||
@returns {string} | @returns {string} | ||
]] | ]] | ||
- | MashLib.System.GetJob(id) | + | function |
--[[ | --[[ | ||
Line 136: | Line 288: | ||
@returns {int} | @returns {int} | ||
]] | ]] | ||
- | MashLib.System.GetJobId(name) | + | function |
--[[ | --[[ | ||
Line 143: | Line 295: | ||
@returns {int} | @returns {int} | ||
]] | ]] | ||
- | MashLib.System.GetJobList(dominion) | + | function |
--[[ | --[[ | ||
Line 149: | Line 301: | ||
@returns {boolean} | @returns {boolean} | ||
]] | ]] | ||
- | MashLib.System.CheckLogin() | + | function |
--[[ | --[[ | ||
- | Get current | + | |
+ | @returns {boolean} | ||
+ | ]] | ||
+ | function MashLib.System.IsLoading() | ||
+ | |||
+ | --[[ | ||
+ | | ||
@param {string} name | @param {string} name | ||
- | @param {string} continent | ||
@return {int} | @return {int} | ||
]] | ]] | ||
- | MashLib.System.GetMap(continent, | + | function |
--[[ | --[[ | ||
- | Get player | + | Get current map' |
+ | @param {int} id | ||
@return {table} | @return {table} | ||
]] | ]] | ||
- | MashLib.System.GetUserInfo() | + | function |
+ | |||
+ | --[[ | ||
+ | Loads and run a lua file | ||
+ | @param {string} filePath | ||
+ | @return {variant} Code return | ||
+ | ]] | ||
+ | function MashLib.System.Require(filePath) | ||
+ | |||
+ | --[[ | ||
+ | Converts TerritoryId to MapId | ||
+ | @param {int} territoryid | ||
+ | @return {int} | ||
+ | ]] | ||
+ | function MashLib.System.GetMapIDFromTerritoryID(id) | ||
+ | |||
+ | --[[ | ||
+ | Get expansion list | ||
+ | @param {string} type | ||
+ | @return {table} | ||
+ | ]] | ||
+ | function MashLib.System.GetExpansionList(type) | ||
+ | |||
+ | --[[ | ||
+ | Get expansion by id | ||
+ | @param {int} expansionid | ||
+ | @return {table} | ||
+ | ]] | ||
+ | function 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} | ||
+ | ]] | ||
+ | function MashLib.System.GetFilesInside(folder) | ||
+ | |||
+ | --[[ | ||
+ | Changes to and enables Assist Bot Mode | ||
+ | ]] | ||
+ | function MashLib.System.EnableAssistMode() | ||
+ | |||
+ | --[[ | ||
+ | Disables Bot Mode | ||
+ | ]] | ||
+ | function MashLib.System.TurnOffBotMode() | ||
+ | |||
+ | --[[ | ||
+ | Searchs for an action by Name | ||
+ | @param {int} type | ||
+ | @param {string} name | ||
+ | ]] | ||
+ | function MashLib.System.SearchAction(type, | ||
+ | |||
+ | --[[ | ||
+ | Searchs for an action by Id | ||
+ | @param {int} type | ||
+ | @param {int} id | ||
+ | ]] | ||
+ | function MashLib.System.SearchActionById(type, | ||
+ | |||
+ | --[[ | ||
+ | Searchs for an entity nearby | ||
+ | @param {int} contentId | ||
+ | ]] | ||
+ | function MashLib.System.FindEntityAroundPlayer(contentId) | ||
</ | </ | ||
Line 172: | Line 396: | ||
@param {string} path | @param {string} path | ||
]] | ]] | ||
- | MashLib.Powershell.ExecuteFile(path) | + | function |
--[[ | --[[ | ||
Line 179: | Line 403: | ||
@param {string} path on system | @param {string} path on system | ||
]] | ]] | ||
- | MashLib.Powershell.DownloadFile(url, | + | function |
--[[ | --[[ | ||
Line 185: | Line 409: | ||
@param {string} url | @param {string} url | ||
]] | ]] | ||
- | MashLib.Powershell.OpenLink(url) | + | function |
+ | |||
+ | --[[ | ||
+ | Executes a command on powershell | ||
+ | @param {string} command | ||
+ | ]] | ||
+ | function MashLib.Powershell.Execute(command) | ||
+ | |||
+ | --[[ | ||
+ | Plays a sound | ||
+ | @NOTE: Not yet implemented | ||
+ | ]] | ||
+ | function MashLib.Powershell.PlaySound() | ||
</ | </ | ||
Line 194: | Line 430: | ||
@return {table} | @return {table} | ||
]] | ]] | ||
- | MashLib.Character.GetBuffList() | + | function |
--[[ | --[[ | ||
- | | + | |
- | @param {table} | + | @return |
]] | ]] | ||
- | MashLib.Character.MoveTo(coords) | + | function |
--[[ | --[[ | ||
- | | + | |
- | @param {bool} exact | + | @param {int} aetheryteid |
- | @returns {table} | + | |
]] | ]] | ||
- | MashLib.Character.GetMapCoords(exact) | + | function |
--[[ | --[[ | ||
- | Teleports the player to the map with corresponding id | + | Teleports the player to the first aetheryte of a map |
@param {int} mapid | @param {int} mapid | ||
]] | ]] | ||
- | MashLib.Character.TeleportTo(mapid) | + | function |
+ | |||
+ | --[[ | ||
+ | Teleports the player to the first aetheryte of a map, skips if already there | ||
+ | @param {int} mapid | ||
+ | ]] | ||
+ | function MashLib.Character.TeleportToMap(mapid) | ||
+ | |||
+ | --[[ | ||
+ | Checks if character is casting teleport | ||
+ | @return {boolean} | ||
+ | ]] | ||
+ | function MashLib.Character.IsCastingTeleport() | ||
--[[ | --[[ | ||
Line 219: | Line 466: | ||
@param {int} id | @param {int} id | ||
]] | ]] | ||
- | MashLib.Character.SetMoveModeTo(id) | + | function |
+ | </ | ||
+ | === Character.Inventory === | ||
+ | <code lua> | ||
--[[ | --[[ | ||
Return an inventory item info by id | Return an inventory item info by id | ||
Line 246: | Line 496: | ||
.isbinding | .isbinding | ||
]] | ]] | ||
- | MashLib.Character.Inventory.GetItemDetails(id) | + | function |
+ | |||
+ | --[[ | ||
+ | Get inventory item list to a txt file for speeder | ||
+ | @param {string} search | ||
+ | @param {string} norepeat | ||
+ | ]] | ||
+ | function MashLib.Character.Inventory.GetSpeederInventory(search, | ||
+ | |||
+ | --[[ | ||
+ | Get inventory item list or search | ||
+ | @param {string} search | ||
+ | @param {string} norepeat | ||
+ | @return {table} items | ||
+ | ]] | ||
+ | function MashLib.Character.Inventory.Get(search, | ||
+ | |||
+ | --[[ | ||
+ | Get item from inventory by Id if quantity == 1 | ||
+ | @param {string} id | ||
+ | @return {table} | ||
+ | ]] | ||
+ | function MashLib.Character.Inventory.GetOneById(id) | ||
+ | |||
+ | --[[ | ||
+ | Get item from inventory by Id | ||
+ | @param {string} id | ||
+ | @param {string} norepeat | ||
+ | @return {table} | ||
+ | ]] | ||
+ | function MashLib.Character.Inventory.GetById(id, | ||
+ | |||
+ | --[[ | ||
+ | Get item list or search in a specific inventory | ||
+ | @param {string} inventory | ||
+ | @param {string} search | ||
+ | @param {boolean} norepeat | ||
+ | @return {table} items | ||
+ | ]] | ||
+ | function MashLib.Character.Inventory.GetFromSpecific(inventory, | ||
+ | |||
+ | --[[ | ||
+ | Move an item to another slot | ||
+ | @param {int} inventory | ||
+ | @param {int} slot | ||
+ | @param {int} toinventory | ||
+ | @param {int} toslot | ||
+ | ]] | ||
+ | function MashLib.Character.Inventory.Move(inventory, | ||
+ | |||
+ | --[[ | ||
+ | Move an item object to another slot | ||
+ | @param {int} toinventory | ||
+ | @param {int} toslot | ||
+ | ]] | ||
+ | function MashLib.Character.Inventory.MoveObject(object, | ||
</ | </ | ||
Line 256: | Line 561: | ||
@return {table} | @return {table} | ||
]] | ]] | ||
- | MashLib.API.GetEndpoint(name) | + | function |
</ | </ | ||
Line 266: | Line 571: | ||
@return {table} | @return {table} | ||
]] | ]] | ||
- | MashLib.Crafting.GetCondition(name) | + | function |
</ | </ | ||
=== Gathering === | === Gathering === | ||
- | |||
=== Battle === | === Battle === | ||
<code lua> | <code lua> | ||
Line 278: | Line 582: | ||
@return {table} | @return {table} | ||
]] | ]] | ||
- | MashLib.Battle.GetEncounter(id) | + | function |
--[[ | --[[ | ||
- | Get encounter | + | Get a list of skills on a specific job |
+ | @param {int} job | ||
@return {table} | @return {table} | ||
]] | ]] | ||
- | MashLib.Battle.GetEncounterList() | + | function |
+ | </ | ||
+ | === Hacks === | ||
+ | <code lua> | ||
--[[ | --[[ | ||
- | | + | |
- | @return | + | @param {int|nil} fly |
+ | @param {int|nil} walk | ||
+ | @param {int|nil} mount | ||
]] | ]] | ||
- | MashLib.Battle.GetLastCastID() | + | function |
+ | </ | ||
+ | === Hunt === | ||
+ | <code lua> | ||
--[[ | --[[ | ||
- | Get skill ID by Name | + | Get a mark's name by it's id |
- | @param {int} job | + | @param {string} expansion |
- | @param {string} | + | @param {string} |
- | @return | + | @param {int} contentid |
+ | @retun {string} | ||
]] | ]] | ||
- | MashLib.Battle.GetSkillId(job, name) | + | function |
--[[ | --[[ | ||
- | Get skill Name by ID | + | Get mark list |
- | @param {int} job | + | @param {string} expansion |
- | @param {id} id | + | @param {string} rank |
- | @return | + | @retun {table} |
]] | ]] | ||
- | MashLib.Battle.GetSkillNameByID(job, id) | + | function |
--[[ | --[[ | ||
- | | + | |
- | @param {int} job | + | @param {int} mapid |
+ | @retun {table} | ||
+ | ]] | ||
+ | function MashLib.Hunt.GetMarkListOnMap(mapid) | ||
+ | |||
+ | --[[ | ||
+ | Gets the mark list per map | ||
+ | @param {string} option | to_combo | ||
+ | @retun {table} | ||
+ | ]] | ||
+ | function MashLib.Hunt.GetMarkListPerMap(option) | ||
+ | </ | ||
+ | |||
+ | === Space === | ||
+ | <code lua> | ||
+ | --[[ | ||
+ | Moves character to coords | ||
+ | @param {table} coords | ||
+ | ]] | ||
+ | function MashLib.Space.MoveTo(coords) | ||
+ | |||
+ | --[[ | ||
+ | Stops character from moving | ||
+ | ]] | ||
+ | function MashLib.Space.Stop() | ||
+ | |||
+ | --[[ | ||
+ | Get random coordinates around another coordinates, | ||
+ | Thanks to Kitanoi <3 | ||
+ | @param {table} coords | ||
+ | @param {int} radius | ||
@return {table} | @return {table} | ||
]] | ]] | ||
- | MashLib.Battle.GetSkillListByJobID(job) | + | function |
--[[ | --[[ | ||
- | | + | |
- | @param {int} job | + | Thanks to Kali <3 |
- | @param {boolean} to_combo | + | @param {table} pos |
+ | @param {table} pos2 | ||
+ | @param {bool} ignoreradius | ||
+ | @return {int} | ||
+ | ]] | ||
+ | function MashLib.Space.Distance2D(pos, | ||
+ | |||
+ | --[[ | ||
+ | Calculates the 3D distance between two points | ||
+ | Thanks to Kali <3 | ||
+ | @param {table} pos | ||
+ | @param {table} pos2 | ||
+ | @param {bool} ignoreradius | ||
+ | @return {int} | ||
+ | ]] | ||
+ | function MashLib.Space.Distance3D(pos, | ||
+ | |||
+ | --[[ | ||
+ | Places | ||
+ | @param {int} territoryid | ||
+ | @param {table} world coords -> x, z | ||
+ | @param optinal {int} mapid | ||
+ | ]] | ||
+ | function MashLib.Space.SetMapFlag(territoryid, | ||
+ | |||
+ | --[[ | ||
+ | Gets the flag position in the map | ||
@return {table} | @return {table} | ||
]] | ]] | ||
- | MashLib.Battle.GetSkillListWithCDByJobID(job, to_combo) | + | function |
--[[ | --[[ | ||
- | | + | |
- | @param {strng} key | + | @param |
+ | @param optional {int} mapid | ||
+ | @param optional {bool} exact | ||
+ | @return {table} | ||
]] | ]] | ||
- | MashLib.Battle.NIN.HoldTCJ(key) | + | function |
- | </ | + | |
- | === Hacks === | ||
- | <code lua> | ||
--[[ | --[[ | ||
- | | + | |
- | @param {int} fly | + | Thanks to Kali and Kitano <3 |
- | @param {int} walk | + | @param {table} map coords |
- | @param {int} mount | + | @param {int} scale |
+ | @return | ||
]] | ]] | ||
- | MashLib.Hacks.SpeedHacks.Set(fly, walk, mount) | + | function |
--[[ | --[[ | ||
- | | + | |
+ | @param {int} mapid | ||
+ | @return {int} | ||
+ | ]] | ||
+ | function MashLib.Space.GetMapScale(id) | ||
+ | </ | ||
+ | |||
+ | === Logging === | ||
+ | <code lua> | ||
+ | --[[ | ||
+ | Logs an entity | ||
+ | @param {table} target | ||
+ | @return {table} | ||
]] | ]] | ||
- | MashLib.Hacks.SpeedHacks.Reset() | + | function |
</ | </ |