From c5fb5155f3b57ba641bc1787a31bbdd80052c6c1 Mon Sep 17 00:00:00 2001 From: Olivier Gagnon Date: Wed, 3 Nov 2021 18:16:10 -0400 Subject: [PATCH] work on making sure all the functions are accounted for --- dist/bitburner.d.ts | 401 ++++-- electron/icon.icns | Bin 0 -> 20887 bytes electron/icon.ico | Bin 0 -> 15406 bytes electron/main.js | 4 +- electron/package.json | 19 +- input/bitburner.api.json | 464 +++---- markdown/bitburner.augmentationstats.md | 2 +- markdown/bitburner.augmentpair.md | 2 +- markdown/bitburner.basichgwoptions.md | 2 +- markdown/bitburner.bitnodemultipliers.md | 2 +- markdown/bitburner.bladeburnercuraction.md | 2 +- markdown/bitburner.characterinfo.md | 2 +- markdown/bitburner.charactermult.md | 2 +- markdown/bitburner.codingattemptoptions.md | 2 +- markdown/bitburner.codingcontract.md | 2 +- markdown/bitburner.crimestats.md | 2 +- markdown/bitburner.equipmentstats.md | 2 +- markdown/bitburner.gang.creategang.md | 32 + markdown/bitburner.gang.ingang.md | 23 + markdown/bitburner.gang.md | 4 +- markdown/bitburner.ganggeninfo.md | 2 +- markdown/bitburner.gangmemberascension.md | 2 +- markdown/bitburner.gangmemberinfo.md | 2 +- markdown/bitburner.gangotherinfo.md | 2 +- markdown/bitburner.gangotherinfoobject.md | 2 +- markdown/bitburner.gangtaskstats.md | 2 +- markdown/bitburner.gangterritory.md | 2 +- markdown/bitburner.hackingmultipliers.md | 2 +- markdown/bitburner.hacknet.md | 2 +- markdown/bitburner.hacknetmultipliers.md | 2 +- markdown/bitburner.nodestats.md | 2 +- markdown/bitburner.ns.args.md | 4 +- markdown/bitburner.ns.brutessh.md | 4 +- markdown/bitburner.ns.clear.md | 14 +- markdown/bitburner.ns.deleteserver.md | 8 +- markdown/bitburner.ns.disablelog.md | 4 +- markdown/bitburner.ns.enablelog.md | 4 +- markdown/bitburner.ns.exec.md | 16 +- markdown/bitburner.ns.fileexists.md | 8 +- markdown/bitburner.ns.ftpcrack.md | 4 +- .../bitburner.ns.getbitnodemultipliers.md | 8 +- markdown/bitburner.ns.getgrowtime.md | 8 +- .../bitburner.ns.gethackingmultipliers.md | 4 +- .../bitburner.ns.gethacknetmultipliers.md | 4 +- markdown/bitburner.ns.gethacktime.md | 10 +- markdown/bitburner.ns.getporthandle.md | 10 +- .../bitburner.ns.getpurchasedservercost.md | 4 +- markdown/bitburner.ns.getpurchasedservers.md | 2 +- markdown/bitburner.ns.getscriptexpgain.md | 8 +- markdown/bitburner.ns.getscriptincome.md | 8 +- markdown/bitburner.ns.getscriptlogs.md | 8 +- markdown/bitburner.ns.getscriptram.md | 4 +- ...bitburner.ns.getserverbasesecuritylevel.md | 30 - markdown/bitburner.ns.getservergrowth.md | 4 +- markdown/bitburner.ns.getservermaxmoney.md | 4 +- .../bitburner.ns.getservermoneyavailable.md | 4 +- markdown/bitburner.ns.getserverram.md | 39 - .../bitburner.ns.getserversecuritylevel.md | 4 +- markdown/bitburner.ns.getweakentime.md | 8 +- markdown/bitburner.ns.grow.md | 4 +- markdown/bitburner.ns.growthanalyze.md | 8 +- .../bitburner.ns.growthanalyzesecurity.md | 4 +- markdown/bitburner.ns.hack.md | 4 +- markdown/bitburner.ns.hackanalyzepercent.md | 4 +- markdown/bitburner.ns.hackanalyzesecurity.md | 4 +- markdown/bitburner.ns.hackanalyzethreads.md | 4 +- markdown/bitburner.ns.hackchance.md | 8 +- markdown/bitburner.ns.hasrootaccess.md | 4 +- markdown/bitburner.ns.httpworm.md | 4 +- markdown/bitburner.ns.isrunning.md | 4 +- markdown/bitburner.ns.kill.md | 4 +- markdown/bitburner.ns.kill_1.md | 4 +- markdown/bitburner.ns.killall.md | 4 +- markdown/bitburner.ns.ls.md | 4 +- markdown/bitburner.ns.md | 118 +- markdown/bitburner.ns.nformat.md | 6 +- markdown/bitburner.ns.nuke.md | 4 +- markdown/bitburner.ns.peek.md | 4 +- markdown/bitburner.ns.prompt.md | 4 +- markdown/bitburner.ns.ps.md | 4 +- markdown/bitburner.ns.purchaseserver.md | 16 +- markdown/bitburner.ns.read.md | 12 +- markdown/bitburner.ns.relaysmtp.md | 4 +- markdown/bitburner.ns.rm.md | 4 +- markdown/bitburner.ns.run.md | 16 +- markdown/bitburner.ns.scan.md | 4 +- markdown/bitburner.ns.scp.md | 4 +- markdown/bitburner.ns.scp_1.md | 4 +- markdown/bitburner.ns.scriptkill.md | 4 +- markdown/bitburner.ns.scriptrunning.md | 8 +- markdown/bitburner.ns.spawn.md | 8 +- markdown/bitburner.ns.sprintf.md | 4 +- markdown/bitburner.ns.sqlinject.md | 2 +- markdown/bitburner.ns.tail.md | 12 +- markdown/bitburner.ns.trywrite.md | 4 +- markdown/bitburner.ns.vsprintf.md | 4 +- markdown/bitburner.ns.weaken.md | 4 +- markdown/bitburner.ns.weakenanalyze.md | 4 +- markdown/bitburner.ns.wget.md | 12 +- markdown/bitburner.ns.write.md | 12 +- markdown/bitburner.playerskills.md | 2 +- markdown/bitburner.processinfo.md | 2 +- markdown/bitburner.server.md | 2 +- markdown/bitburner.singularity.md | 2 +- markdown/bitburner.sleeve.md | 2 +- markdown/bitburner.sleeveinformation.md | 2 +- markdown/bitburner.sleeveskills.md | 2 +- markdown/bitburner.sleevetask.md | 2 +- markdown/bitburner.sleeveworkgains.md | 2 +- markdown/bitburner.sourcefilelvl.md | 2 +- markdown/bitburner.stockorder.md | 2 +- markdown/bitburner.stockorderobject.md | 2 +- package.json | 2 +- src/Netscript/RamCostGenerator.ts | 3 + src/NetscriptFunctions.ts | 1045 +------------- src/NetscriptFunctions/Augmentations.ts | 224 --- src/NetscriptFunctions/CodingContract.ts | 11 +- src/NetscriptFunctions/Formulas.ts | 7 +- src/NetscriptFunctions/Gang.ts | 25 +- src/NetscriptFunctions/Hacknet.ts | 29 +- src/NetscriptFunctions/INetscriptHelper.ts | 3 +- src/NetscriptFunctions/Singularity.ts | 1219 +++++++++++++++++ src/NetscriptFunctions/Sleeve.ts | 42 +- src/ScriptEditor/NetscriptDefinitions.d.ts | 767 ++++++++--- 124 files changed, 2775 insertions(+), 2204 deletions(-) create mode 100644 electron/icon.icns create mode 100644 electron/icon.ico create mode 100644 markdown/bitburner.gang.creategang.md create mode 100644 markdown/bitburner.gang.ingang.md delete mode 100644 markdown/bitburner.ns.getserverbasesecuritylevel.md delete mode 100644 markdown/bitburner.ns.getserverram.md delete mode 100644 src/NetscriptFunctions/Augmentations.ts create mode 100644 src/NetscriptFunctions/Singularity.ts diff --git a/dist/bitburner.d.ts b/dist/bitburner.d.ts index 9037fcbf4..8363c513c 100644 --- a/dist/bitburner.d.ts +++ b/dist/bitburner.d.ts @@ -901,6 +901,24 @@ export declare interface EquipmentStats { * @public */ export declare interface Gang { + /** + * Create a gang. + * @remarks + * RAM cost: 1GB + * + * Create a gang with the specified faction. + * @returns True if the gang was created, false otherwise. + */ + createGang(faction: string): boolean; + + /** + * Check if you're in a gang. + * @remarks + * RAM cost: 1GB + * @returns True if you're in a gang, false otherwise. + */ + inGang(): boolean; + /** * List all gang members. * @remarks @@ -1642,14 +1660,17 @@ export declare interface NS extends Singularity { /** * * Namespace for stock related functions. - * @remarks RAM cost: 0 GB + * @remarks + * RAM cost: 0 GB */ readonly stock: TIX; /** * Arguments passed into the script. * - * @remarks RAM cost: 0 GB + * @remarks + * RAM cost: 0 GB + * * Arguments passed into a script can be accessed using a normal * array using the [] operator (args[0], args[1], etc…). * @@ -1662,6 +1683,7 @@ export declare interface NS extends Singularity { * Steal a servers money. * @remarks * RAM cost: 0.1 GB + * * Function that is used to try and hack servers to steal money and gain hacking experience. * The runtime for this command depends on your hacking level and the target server’s * security level. In order to hack a server you must first gain root access to that server @@ -1688,6 +1710,7 @@ export declare interface NS extends Singularity { * Spoof money in a servers bank account, increasing the amount available. * @remarks * RAM cost: 0.15 GB + * * Use your hacking skills to increase the amount of money available on a server. * The runtime for this command depends on your hacking level and the target server’s * security level. When `grow` completes, the money available on a target server will @@ -1715,6 +1738,7 @@ export declare interface NS extends Singularity { * Reduce a server security level. * @remarks * RAM cost: 0.15 GB + * * Use your hacking skills to attack a server’s security, lowering the server’s security level. * The runtime for this command depends on your hacking level and the target server’s security * level. This function lowers the security level of the target server by 0.05. @@ -1738,6 +1762,7 @@ export declare interface NS extends Singularity { * Predict the effect of weaken. * @remarks * RAM cost: 1 GB + * * Returns the security decrease that would occur if a weaken with this many threads happened. * * @param threads - Amount of threads that will be used. @@ -1750,6 +1775,7 @@ export declare interface NS extends Singularity { * Predict the effect of hack. * @remarks * RAM cost: 1 GB + * * This function returns the number of script threads you need when running the hack command * to steal the specified amount of money from the target server. * If hackAmount is less than zero or greater than the amount of money available on the server, @@ -1770,6 +1796,10 @@ export declare interface NS extends Singularity { hackAnalyzeThreads(host: string, hackAmount: number): number; /** + * Get the percent of money stolen with a single thread. + * @remarks + * RAM cost: 1 GB + * * Returns the percentage of the specified server’s money you will steal with a single hack. * This value is returned in percentage form, not decimal * (Netscript functions typically return in decimal form, but not this one). @@ -1780,33 +1810,42 @@ export declare interface NS extends Singularity { * hackAnalyzePercent("foodnstuff"); * //This means that if hack the foodnstuff server, then you will steal 1% of its total money. If you hack using N threads, then you will steal N% of its total money. * ``` - * @remarks RAM cost: 1 GB * @param host - Hostname of the target server. * @returns The percentage of money you will steal from the target server with a single hack. */ hackAnalyzePercent(host: string): number; /** + * Get the security increase for a number of thread. + * @remarks + * RAM cost: 1 GB + * * Returns the security increase that would occur if a hack with this many threads happened. * - * @remarks RAM cost: 1 GB * @param threads - Amount of threads that will be used. * @returns The security increase. */ hackAnalyzeSecurity(threads: number): number; /** + * Get the chance of successfully hacking a server. + * @remarks + * RAM cost: 1 GB + * * Returns the chance you have of successfully hacking the specified server. * * This returned value is in decimal form, not percentage. * - * @remarks RAM cost: 1 GB * @param host - Hostname of the target server. * @returns The chance you have of successfully hacking the target server. */ hackChance(host: string): number; /** + * Calculate the number of grow thread needed to grow a server by a certain multiplier. + * @remarks + * RAM cost: 1 GB + * * This function returns the number of “growths” needed in order to increase * the amount of money available on the specified server by the specified amount. * The specified amount is multiplicative and is in decimal form, not percentage. @@ -1819,7 +1858,6 @@ export declare interface NS extends Singularity { * growthAnalyze("foodnstuff", 2); * //If this returns 100, then this means you need to call grow 100 times in order to double the money (or once with 100 threads). * ``` - * @remarks RAM cost: 1 GB * @param host - Hostname of the target server. * @param growthAmount - Multiplicative factor by which the server is grown. Decimal form.. * @returns The amount of grow calls needed to grow the specified server by the specified amount @@ -1827,9 +1865,12 @@ export declare interface NS extends Singularity { growthAnalyze(host: string, growthAmount: number): number; /** + * Calculate the security increase for a number of thread. + * @remarks + * RAM cost: 1 GB + * * Returns the security increase that would occur if a grow with this many threads happened. * - * @remarks RAM cost: 1 GB * @param threads - Amount of threads that will be used. * @returns The security increase. */ @@ -1837,8 +1878,9 @@ export declare interface NS extends Singularity { /** * Suspends the script for n milliseconds. + * @remarks + * RAM cost: 0 GB * - * @remarks RAM cost: 0 GB * @param millis - Number of milliseconds to sleep. * @returns */ @@ -1846,24 +1888,26 @@ export declare interface NS extends Singularity { /** * Prints a value or a variable to the script’s logs. + * @remarks + * RAM cost: 0 GB * - * @remarks RAM cost: 0 GB * @param msg - Value to be printed. */ print(msg: any): void; /** * Prints a value or a variable to the Terminal. + * @remarks + * RAM cost: 0 GB * - * @remarks RAM cost: 0 GB * @param msg - Value to be printed. */ tprint(msg: any): void; /** * Clears the script’s logs. - * - * @remarks RAM cost: 0 GB + * @remarks + * RAM cost: 0 GB */ clearLog(): void; @@ -1871,6 +1915,7 @@ export declare interface NS extends Singularity { * Disables logging for the given function. * @remarks * RAM cost: 0 GB + * * Logging can be disabled for all functions by passing `ALL` as the argument. * * Note that this does not completely remove all logging functionality. @@ -1885,24 +1930,32 @@ export declare interface NS extends Singularity { disableLog(fn: string): void; /** + * Enable logging for a certain function. + * @remarks + * RAM cost: 0 GB + * * Re-enables logging for the given function. If `ALL` is passed into this * function as an argument, then it will revert the effects of disableLog(`ALL`). * - * @remarks RAM cost: 0 GB * @param fn - Name of function for which to enable logging. */ enableLog(fn: string): void; /** * Checks the status of the logging for the given function. + * @remarks + * RAM cost: 0 GB * - * @remarks RAM cost: 0 GB * @param fn - Name of function to check. * @returns Returns a boolean indicating whether or not logging is enabled for that function (or `ALL`) */ isLogEnabled(fn: string): boolean; /** + * Get all the logs of a script. + * @remarks + * RAM cost: 0 GB + * * Returns a script’s logs. The logs are returned as an array, where each line is an element in the array. * The most recently logged line is at the end of the array. * Note that there is a maximum number of lines that a script stores in its logs. This is configurable in the game’s options. @@ -1926,7 +1979,6 @@ export declare interface NS extends Singularity { * //Open logs from foo.script on the foodnstuff server that was run with the arguments [1, "test"] * getScriptLogs("foo.script", "foodnstuff", 1, "test"); * ``` - * @remarks RAM cost: 0 GB * @param fn - Optional. Filename of script to get logs from. * @param host - Optional. Hostname of the server that the script is on. * @param args - Arguments to identify which scripts to get logs for. @@ -1935,6 +1987,10 @@ export declare interface NS extends Singularity { getScriptLogs(fn?: string, host?: string, ...args: any[]): string[]; /** + * Open the tail window of a script. + * @remarks + * RAM cost: 0 GB + * * Opens a script’s logs. This is functionally the same as the tail Terminal command. * * If the function is called with no arguments, it will open the current script’s logs. @@ -1957,7 +2013,6 @@ export declare interface NS extends Singularity { * //Get logs from foo.script on the foodnstuff server that was run with the arguments [1, "test"] * tail("foo.script", "foodnstuff", 1, "test"); * ``` - * @remarks RAM cost: 0 GB * @param fn - Optional. Filename of the script being tailed. If omitted, the current script is tailed. * @param host - Optional. Hostname of the script being tailed. Defaults to the server this script is running on. If args are specified, this is not optional. * @param args - Arguments for the script being tailed. @@ -1965,11 +2020,14 @@ export declare interface NS extends Singularity { tail(fn?: string, host?: string, ...args: any[]): void; /** + * Get the list servers connected to a server. + * @remarks + * RAM cost: 0.2 GB + * * Returns an array containing the hostnames or IPs of all servers that are one * node way from the specified target server. The hostnames/IPs in the returned * array are strings. * - * @remarks RAM cost: 0.2 GB * @param host - Hostname of the server to scan. * @param hostnames - Optional boolean specifying whether the function should output hostnames (if true) or IP addresses (if false). * @returns Returns an string of hostnames or IP. @@ -1977,66 +2035,85 @@ export declare interface NS extends Singularity { scan(host: string, hostnames?: boolean): string[]; /** + * Runs NUKE.exe on a server. + * @remarks + * RAM cost: 0.05 GB + * * Runs the NUKE.exe program on the target server. NUKE.exe must exist on your home computer. * * @example * ```ts * nuke("foodnstuff"); * ``` - * @remarks RAM cost: 0.05 GB * @param host - Hostname of the target server. */ nuke(host: string): void; /** + * Runs BruteSSH.exe on a server. + * @remarks + * RAM cost: 0.05 GB + * * Runs the BruteSSH.exe program on the target server. BruteSSH.exe must exist on your home computer. * * @example * ```ts * brutessh("foodnstuff"); * ``` - * @remarks RAM cost: 0.05 GB * @param host - Hostname of the target server. */ brutessh(host: string): void; /** + * Runs FTPCrack.exe on a server. + * @remarks + * RAM cost: 0.05 GB + * * Runs the FTPCrack.exe program on the target server. FTPCrack.exe must exist on your home computer. * * @example * ```ts * ftpcrack("foodnstuff"); * ``` - * @remarks RAM cost: 0.05 GB * @param host - Hostname of the target server. */ ftpcrack(host: string): void; /** + * Runs relaySMTP.exe on a server. + * @remarks + * RAM cost: 0.05 GB + * * Runs the relaySMTP.exe program on the target server. relaySMTP.exe must exist on your home computer. * * @example * ```ts * relaysmtp("foodnstuff"); * ``` - * @remarks RAM cost: 0.05 GB * @param host - Hostname of the target server. */ relaysmtp(host: string): void; /** + * Runs HTTPWorm.exe on a server. + * @remarks + * RAM cost: 0.05 GB + * * Runs the HTTPWorm.exe program on the target server. HTTPWorm.exe must exist on your home computer. * * @example * ```ts * httpworm("foodnstuff"); * ``` - * @remarks RAM cost: 0.05 GB * @param host - Hostname of the target server. */ httpworm(host: string): void; /** + * Runs SQLInject.exe on a server. + * @remarks + * RAM cost: 0.05 GB + * * Runs the SQLInject.exe program on the target server. SQLInject.exe must exist on your home computer. * * @example @@ -2049,6 +2126,10 @@ export declare interface NS extends Singularity { sqlinject(host: string): void; /** + * Start another script on the current server. + * @remarks + * RAM cost: 1 GB + * * Run a script as a separate process. This function can only be used to run scripts located on the * current server (the server running the script that calls this function). Requires a significant * amount of RAM to run this command. @@ -2077,7 +2158,6 @@ export declare interface NS extends Singularity { * //This next example will run ‘foo.script’ single-threaded, and will pass the string ‘foodnstuff’ into the script as an argument: * run("foo.script", 1, 'foodnstuff'); * ``` - * @remarks RAM cost: 1 GB * @param script - Filename of script to run. * @param numThreads - Optional thread count for new script. Set to 1 by default. Will be rounded to nearest integer. * @param args - Additional arguments to pass into the new script that is being run. Note that if any arguments are being passed into the new script, then the second argument numThreads must be filled in with a value. @@ -2086,6 +2166,10 @@ export declare interface NS extends Singularity { run(script: string, numThreads?: number, ...args: string[]): number; /** + * Start another script on any server. + * @remarks + * RAM cost: 1.3 GB + * * Run a script as a separate process on a specified server. This is similar to the run function * except that it can be used to run a script on any server, instead of just the current server. * @@ -2113,7 +2197,6 @@ export declare interface NS extends Singularity { * //This last example will try to run the script foo.script on the foodnstuff server with 5 threads. It will also pass the number 1 and the string “test” in as arguments to the script: * exec("foo.script", "foodnstuff", 5, 1, "test"); * ``` - * @remarks RAM cost: 1.3 GB * @param script - Filename of script to execute. * @param host - Hostname of the `target server` on which to execute the script. * @param numThreads - Optional thread count for new script. Set to 1 by default. Will be rounded to nearest integer. @@ -2123,6 +2206,10 @@ export declare interface NS extends Singularity { exec(script: string, host: string, numThreads?: number, ...args: string[]): number; /** + * Terminate current script and start another in 10s. + * @remarks + * RAM cost: 2 GB + * * Terminates the current script, and then after a delay of about 10 seconds it will execute the * newly-specified script. The purpose of this function is to execute a new script without being * constrained by the RAM usage of the current one. This function can only be used to run scripts @@ -2135,7 +2222,6 @@ export declare interface NS extends Singularity { * //The following example will execute the script ‘foo.script’ with 10 threads and the arguments ‘foodnstuff’ and 90: * spawn('foo.script', 10, 'foodnstuff', 90); * ``` - * @remarks RAM cost: 2 GB * @param script - Filename of script to execute. * @param numThreads - Number of threads to spawn new script with. Will be rounded to nearest integer. * @param args - Additional arguments to pass into the new script that is being run. @@ -2143,6 +2229,10 @@ export declare interface NS extends Singularity { spawn(script: string, numThreads?: number, ...args: string[]): void; /** + * Terminate another script. + * @remarks + * RAM cost: 0.5 GB + * * Kills the script on the target server specified by the script’s name and arguments. * Remember that scripts are uniquely identified by both their name and arguments. * For example, if `foo.script` is run with the argument 1, then this is not the same as @@ -2163,7 +2253,6 @@ export declare interface NS extends Singularity { * //The following will try to kill a script named foo.script on the current server that was ran with the arguments 1 and “foodnstuff”: * kill("foo.script", getHostname(), 1, "foodnstuff"); * ``` - * @remarks RAM cost: 0.5 GB * @param script - Filename of the script to kill * @param host - Hostname of the server on which to kill the script. * @param args - Arguments to identify which script to kill. @@ -2172,6 +2261,10 @@ export declare interface NS extends Singularity { kill(script: string, host: string, ...args: string[]): boolean; /** + * Terminate another script. + * @remarks + * RAM cost: 0.5 GB + * * Kills the script with the specified PID. * Killing a script by its PID will typically have better performance, * especially if you have many scripts running. @@ -2184,18 +2277,20 @@ export declare interface NS extends Singularity { * print("Killed script with PID 10!"); * } * ``` - * @remarks RAM cost: 0.5 GB * @param scriptPid - PID of the script to kill * @returns True if the script is successfully killed, and false otherwise. */ kill(scriptPid: number): boolean; /** + * Terminate all scripts on a server. + * @remarks + * RAM cost: 0.5 GB + * * Kills all running scripts on the specified server. This function returns true * if any scripts were killed, and false otherwise. In other words, it will return * true if there are any scripts running on the target server. * - * @remarks RAM cost: 0.5 GB * @param host - IP or hostname of the server on which to kill all scripts. * @returns True if any scripts were killed, and false otherwise. */ @@ -2203,12 +2298,16 @@ export declare interface NS extends Singularity { /** * Terminates the current script immediately. - * - * @remarks RAM cost: 0 GB + * @remarks + * RAM cost: 0 GB */ exit(): void; /** + * Copy file between servers. + * @remarks + * RAM cost: 0.6 GB + * * Copies a script or literature (.lit) file(s) to another server. The files argument can be either a string * specifying a single file to copy, or an array of strings specifying multiple files to copy. * @@ -2217,7 +2316,6 @@ export declare interface NS extends Singularity { * //Copies hack-template.script from the current server to foodnstuff: * scp("hack-template.script", "foodnstuff"); * ``` - * @remarks RAM cost: 0.6 GB * @param files - Filename or an array of filenames of script/literature files to copy. * @param destination - Host of the destination server, which is the server to which the file will be copied. * @returns True if the script/literature file is successfully copied over and false otherwise. If the files argument is an array then this function will return true if at least one of the files in the array is successfully copied. @@ -2225,6 +2323,10 @@ export declare interface NS extends Singularity { scp(files: string[], destination: string): boolean; /** + * Copy file between servers. + * @remarks + * RAM cost: 0.6 GB + * * Copies a script or literature (.lit) file(s) to another server. The files argument can be either a string * specifying a single file to copy, or an array of strings specifying multiple files to copy. * @@ -2239,7 +2341,6 @@ export declare interface NS extends Singularity { * files = ["foo1.lit", "foo2.script", "foo3.script"]; * scp(files, "rothman-uni", "home"); * ``` - * @remarks RAM cost: 0.6 GB * @param files - Filename or an array of filenames of script/literature files to copy. * @param source - Host of the source server, which is the server from which the file will be copied. This argument is optional and if it’s omitted the source will be the current server. * @param destination - Host of the destination server, which is the server to which the file will be copied. @@ -2253,10 +2354,13 @@ export declare interface NS extends Singularity { ): boolean; /** + * List files on a server. + * @remarks + * RAM cost: 0.2 GB + * * Returns an array with the filenames of all files on the specified server * (as strings). The returned array is sorted in alphabetic order. * - * @remarks RAM cost: 0.2 GB * @param host - Host of the target server. * @param grep - A substring to search for in the filename. * @returns Array with the filenames of all files on the specified server. @@ -2264,6 +2368,10 @@ export declare interface NS extends Singularity { ls(host: string, grep?: string): string[]; /** + * List running scripts on a server. + * @remarks + * RAM cost: 0.2 GB + * * Returns an array with general information about all scripts running on the specified target server. * * @example @@ -2277,13 +2385,16 @@ export declare interface NS extends Singularity { * } * } * ``` - * @remarks RAM cost: 0.2 GB * @param host - Host address of the target server. If not specified, it will be the current server’s IP by default. * @returns Array with general information about all scripts running on the specified target server. */ ps(host?: string): ProcessInfo[]; /** + * Check if your have root access on a server. + * @remarks + * RAM cost: 0.05 GB + * * Returns a boolean indicating whether or not the player has root access to the specified target server. * * @example @@ -2292,7 +2403,6 @@ export declare interface NS extends Singularity { * nuke("foodnstuff"); * } * ``` - * @remarks RAM cost: 0.05 GB * @param host - Host of the target server * @returns True if player has root access to the specified target server, and false otherwise. */ @@ -2301,7 +2411,8 @@ export declare interface NS extends Singularity { /** * Returns a string with the hostname of the server that the script is running on. * - * @remarks RAM cost: 0.05 GB + * @remarks + * RAM cost: 0.05 GB * @returns Hostname of the server that the script is on. */ getHostname(): string; @@ -2309,12 +2420,17 @@ export declare interface NS extends Singularity { /** * Returns the player’s current hacking level. * - * @remarks RAM cost: 0.05 GB + * @remarks + * RAM cost: 0.05 GB * @returns Player’s current hacking level */ getHackingLevel(): number; /** + * Get hacking related multipliers. + * @remarks + * RAM cost: 4 GB + * * Returns an object containing the Player’s hacking related multipliers. * These multipliers are returned in fractional forms, not percentages * (e.g. 1.5 instead of 150%). @@ -2326,12 +2442,15 @@ export declare interface NS extends Singularity { * print(mults.chance); * print(mults.growth); * ``` - * @remarks RAM cost: 4 GB * @returns Object containing the Player’s hacking related multipliers. */ getHackingMultipliers(): HackingMultipliers; /** + * Get hacknet related multipliers. + * @remarks + * RAM cost: 4 GB + * * Returns an object containing the Player’s hacknet related multipliers. * These multipliers are returned in fractional forms, not percentages * (e.g. 1.5 instead of 150%). @@ -2343,7 +2462,6 @@ export declare interface NS extends Singularity { * print(mults.production); * print(mults.purchaseCost); * ``` - * @remarks RAM cost: 4 GB * @returns Object containing the Player’s hacknet related multipliers. */ getHacknetMultipliers(): HacknetMultipliers; @@ -2351,13 +2469,18 @@ export declare interface NS extends Singularity { /** * Returns a server object for the given server. Defaults to the running script's server if host is not specified. * - * @remarks RAM cost: 2 GB + * @remarks + * RAM cost: 2 GB * @param host - Optional. Hostname for the requested server object. * @returns The requested server object. */ getServer(host?: string): Server; /** + * Get money available on a server. + * @remarks + * RAM cost: 0.1 GB + * * Returns the amount of money available on a server. * Running this function on the home computer will return the player’s money. * @@ -2366,22 +2489,28 @@ export declare interface NS extends Singularity { * getServerMoneyAvailable("foodnstuff"); * getServerMoneyAvailable("home"); //Returns player's money * ``` - * @remarks RAM cost: 0.1 GB * @param host - Host of target server * @returns Amount of money available on the server. */ getServerMoneyAvailable(host: string): number; /** + * Get maximum money available on a server. + * @remarks + * RAM cost: 0.1 GB + * * Returns the maximum amount of money that can be available on a server. * - * @remarks RAM cost: 0.1 GB * @param host - Host of target server. * @returns Maximum amount of money available on the server. */ getServerMaxMoney(host: string): number; /** + * Get a server growth parameter. + * @remarks + * RAM cost: 0.1 GB + * * Returns the server’s instrinsic “growth parameter”. This growth * parameter is a number between 1 and 100 that represents how * quickly the server’s money grows. This parameter affects the @@ -2389,38 +2518,25 @@ export declare interface NS extends Singularity { * grow function. A higher growth parameter will result in a * higher percentage increase from grow. * - * @remarks RAM cost: 0.1 GB * @param host - Host of target server. * @returns Parameter that affects the percentage by which the server’s money is increased when using the grow function. */ getServerGrowth(host: string): number; /** + * Get server security level. + * @remarks + * RAM cost: 0.1 GB + * * Returns the security level of the target server. A server’s security * level is denoted by a number, typically between 1 and 100 * (but it can go above 100). * - * @remarks RAM cost: 0.1 GB * @param host - Host of target server. * @returns Security level of the target server. */ getServerSecurityLevel(host: string): number; - /** - * Returns the base security level of the target server. This is the security - * level that the server starts out with. This is different than - * getServerSecurityLevel because getServerSecurityLevel returns - * the current security level of a server, which can constantly change due to - * hack, grow, and weaken, calls on that server. - * The base security level will stay the same until you reset by - * installing an Augmentation(s). - * - * @remarks RAM cost: 0.1 GB - * @param host - Host of target server. - * @returns Base security level of the target server. - */ - getServerBaseSecurityLevel(host: string): number; - /** * Returns the minimum security level of the target server. * @@ -2448,24 +2564,6 @@ export declare interface NS extends Singularity { */ getServerNumPortsRequired(host: string): number; - /** - * Returns an array with two elements that gives information about a server’s memory (RAM). - * The first element in the array is the amount of RAM that the server has total (in GB). - * The second element in the array is the amount of RAM that is currently being used on - * the server (in GB). - * - * @example - * ```ts - * res = getServerRam("helios"); - * totalRam = res[0]; - * ramUsed = res[1]; - * ``` - * @remarks RAM cost: 0.1 GB - * @param host - Host of target server. - * @returns Array with total and used memory on the specified server. - */ - getServerRam(host: string): [number, number]; - /** * Returns a boolean denoting whether or not the specified server exists. * @@ -2476,6 +2574,10 @@ export declare interface NS extends Singularity { serverExists(host: string): boolean; /** + * Check if a file exists. + * @remarks + * RAM cost: 0.1 GB + * * Returns a boolean indicating whether the specified file exists on the target server. * The filename for scripts is case-sensitive, but for other types of files it is not. * For example, fileExists(“brutessh.exe”) will work fine, even though the actual program @@ -2494,7 +2596,6 @@ export declare interface NS extends Singularity { * //The function call will return true if the current server contains the FTPCrack.exe program, and false otherwise. * fileExists("ftpcrack.exe"); * ``` - * @remarks RAM cost: 0.1 GB * @param filename - Filename of file to check. * @param host - Host of target server. This is optional. If it is not specified then the function will use the current server as the target server. * @returns True if specified file exists, and false otherwise. @@ -2502,6 +2603,10 @@ export declare interface NS extends Singularity { fileExists(filename: string, host?: string): boolean; /** + * Check if a script is running. + * @remarks + * RAM cost: 0.1 GB + * * Returns a boolean indicating whether the specified script is running on the target server. * Remember that a script is uniquely identified by both its name and its arguments. * @@ -2520,7 +2625,6 @@ export declare interface NS extends Singularity { * //The function call will return true if there is a script named foo.script running with the arguments 1, 5, and “test” (in that order) on the joesguns server, and false otherwise: * isRunning("foo.script", "joesguns", 1, 5, "test"); * ``` - * @remarks RAM cost: 0.1 GB * @param script - Filename of script to check. This is case-sensitive. * @param host - Host of target server. * @param args - Arguments to specify/identify which scripts to search for. @@ -2529,6 +2633,10 @@ export declare interface NS extends Singularity { isRunning(script: string, host: string, ...args: string[]): boolean; /** + * Get cost of purchasing a server. + * @remarks + * RAM cost: 0.25 GB + * * Returns the cost to purchase a server with the specified amount of ram. * * @example @@ -2537,13 +2645,16 @@ export declare interface NS extends Singularity { * tprint(i + " -- " + getPurchasedServerCost(Math.pow(2, i))); * } * ``` - * @remarks RAM cost: 0.25 GB * @param ram - Amount of RAM of a potential purchased server. Must be a power of 2 (2, 4, 8, 16, etc.). Maximum value of 1048576 (2^20). * @returns The cost to purchase a server with the specified amount of ram. */ getPurchasedServerCost(ram: number): number; /** + * Purchase a server. + * @remarks + * 2.25 GB + * * Purchased a server with the specified hostname and amount of RAM. * * The hostname argument can be any data type, but it will be converted to a string @@ -2571,7 +2682,6 @@ export declare interface NS extends Singularity { * purchaseServer(hn + i, ram); * } * ``` - * @remarks 2.25 GB * @param hostname - Host of the purchased server. * @param ram - Amount of RAM of the purchased server. Must be a power of 2 (2, 4, 8, 16, etc.). Maximum value of 1048576 (2^20). * @returns The hostname of the newly purchased server. @@ -2579,13 +2689,16 @@ export declare interface NS extends Singularity { purchaseServer(hostname: string, ram: number): string; /** + * Delete a purchased server. + * @remarks + * 2.25 GB + * * Deletes one of your purchased servers, which is specified by its hostname. * * The hostname argument can be any data type, but it will be converted to a string. * Whitespace is automatically removed from the string. This function will not delete a * server that still has scripts running on it. * - * @remarks 2.25 GB * @param host - Host of the server to delete. * @returns True if successful, and false otherwise. */ @@ -2595,7 +2708,7 @@ export declare interface NS extends Singularity { * Returns an array with either the hostnames or IPs of all of the servers you have purchased. * * @remarks 2.25 GB - * @param hostnameMode -] Optional. Defaults to true. Returns hostnames if true, and IPs if false. + * @param hostnameMode - Optional. Defaults to true. Returns hostnames if true, and IPs if false. * @returns Returns an array with either the hostnames or IPs of all of the servers you have purchased. */ getPurchasedServers(hostnameMode?: boolean): string[]; @@ -2617,6 +2730,10 @@ export declare interface NS extends Singularity { getPurchasedServerMaxRam(): number; /** + * Write data to a file. + * @remarks + * RAM cost: 1 GB + * * This function can be used to either write data to a port or to a text file (.txt). * * If the first argument is a number between 1 and 20, then it specifies a port and this @@ -2631,7 +2748,6 @@ export declare interface NS extends Singularity { * then the data will be written in “append” mode which means that the data will be added at the * end of the text file. * - * @remarks RAM cost: 1 GB * @param handle - Port or text file that will be written to. * @param data - Data to write. * @param mode - Defines the write mode. Only valid when writing to text files. @@ -2639,11 +2755,14 @@ export declare interface NS extends Singularity { write(handle: string | number, data?: string[] | number, mode?: "w" | "a"): void; /** + * Attempt to write to a port. + * @remarks + * RAM cost: 1 GB + * * Attempts to write data to the specified Netscript Port. * If the port is full, the data will not be written. * Otherwise, the data will be written normally. * - * @remarks RAM cost: 1 GB * @param port - Port or text file that will be written to. * @param data - Data to write. * @returns True if the data is successfully written to the port, and false otherwise. @@ -2651,6 +2770,10 @@ export declare interface NS extends Singularity { tryWrite(port: number, data: string[] | number): boolean; /** + * Read content of a file. + * @remarks + * RAM cost: 1 GB + * * This function is used to read data from a port or from a text file (.txt). * * If the argument port/fn is a number between 1 and 20, then it specifies a @@ -2662,24 +2785,30 @@ export declare interface NS extends Singularity { * file (.txt) and this function will return the data in the specified text * file. If the text file does not exist, an empty string will be returned. * - * @remarks RAM cost: 1 GB * @param handle - Port or text file to read from. * @returns Data in the specified text file or port. */ read(handle: string | number): string | number | object; /** + * Get a copy of the data from a port without popping it. + * @remarks + * RAM cost: 1 GB + * * This function is used to peek at the data from a port. It returns the * first element in the specified port without removing that element. If * the port is empty, the string “NULL PORT DATA” will be returned. * - * @remarks RAM cost: 1 GB * @param port - Port to peek. Must be an integer between 1 and 20. * @returns Data in the specified port. */ peek(port: number): string | number | object; /** + * Clear data from a port. + * @remarks + * RAM cost: 0 GB + * * This function is used to clear data in a Netscript Ports or a text file. * * If the port/fn argument is a number between 1 and 20, then it specifies a @@ -2688,28 +2817,33 @@ export declare interface NS extends Singularity { * If the port/fn argument is a string, then it specifies the name of a * text file (.txt) and will delete all data from that text file. * - * @remarks RAM cost: 1 GB * @param handle - Port or text file to clear. */ clear(handle: string | number): void; /** + * Get all data on a port. + * @remarks + * RAM cost: 0 GB + * * Get a handle to a Netscript Port. * * WARNING: Port Handles only work in NetscriptJS (Netscript 2.0). They will not work in Netscript 1.0. * * @see https://bitburner.readthedocs.io/en/latest/netscript/netscriptmisc.html#netscript-ports - * @remarks RAM cost: 10 GB * @param port - Port number. Must be an integer between 1 and 20. * @returns Data in the specified port. */ getPortHandle(port: number): any[]; /** + * Delete a file. + * @remarks + * RAM cost: 1 GB + * * Removes the specified file from the current server. This function works for every file * type except message (.msg) files. * - * @remarks RAM cost: 1 GB * @param name - Filename of file to remove. Must include the extension. * @param host - Host Address of the server on which to delete the file. Optional. Defaults to current server. * @returns True if it successfully deletes the file, and false otherwise. @@ -2717,6 +2851,10 @@ export declare interface NS extends Singularity { rm(name: string, host?: string): boolean; /** + * Check if any script with a filename is running. + * @remarks + * RAM cost: 1 GB + * * Returns a boolean indicating whether any instance of the specified script is running * on the target server, regardless of its arguments. * @@ -2733,7 +2871,6 @@ export declare interface NS extends Singularity { * //The function call will return true if there is any script named “foo.script” running on the current server, and false otherwise: * scriptRunning("foo.script", getHostname()); * ``` - * @remarks RAM cost: 1 GB * @param script - Filename of script to check. This is case-sensitive. * @param host - Host of target server. * @returns True if the specified script is running, and false otherwise. @@ -2741,10 +2878,13 @@ export declare interface NS extends Singularity { scriptRunning(script: string, host: string): boolean; /** + * Kill all scripts with a filename. + * @remarks + * RAM cost: 1 GB + * * Kills all scripts with the specified filename on the target server specified by hostname, * regardless of arguments. * - * @remarks RAM cost: 1 GB * @param script - Filename of script to kill. This is case-sensitive. * @param host - Host of target server. * @returns true if one or more scripts were successfully killed, and false if none were. @@ -2760,10 +2900,13 @@ export declare interface NS extends Singularity { getScriptName(): string; /** + * Get the ram cost of a script. + * @remarks + * RAM cost: 0.1 GB + * * Returns the amount of RAM required to run the specified script on the target server. * Returns 0 if the script does not exist. * - * @remarks RAM cost: 0.1 GB * @param script - Filename of script. This is case-sensitive. * @param host - Host of target server the script is located on. This is optional, If it is not specified then the function will se the current server as the target server. * @returns Amount of RAM required to run the specified script on the target server, and 0 if the script does not exist. @@ -2771,42 +2914,55 @@ export declare interface NS extends Singularity { getScriptRam(script: string, host?: string): number; /** - * Returns the amount of time in seconds it takes to execute the hack Netscript function on the target server. + * Get the execution time of a hack() call. + * @remarks + * RAM cost: 0.05 GB + * + * Returns the amount of time in milliseconds it takes to execute the hack Netscript function on the target server. * The function takes in an optional hackLvl parameter that can be specified to see what the hack time would be at different hacking levels. * - * @remarks RAM cost: 0.05 GB * @param host - Host of target server. * @param hackLvl - Optional hacking level for the calculation. Defaults to player’s current hacking level. * @param intLvl - Optional intelligence level for the calculation. Defaults to player’s current intelligence level. (Intelligence is unlocked after obtaining Source-File 5). - * @returns Returns the amount of time in seconds it takes to execute the hack Netscript function. Returns Infinity if called on a Hacknet Server. + * @returns Returns the amount of time in milliseconds it takes to execute the hack Netscript function. Returns Infinity if called on a Hacknet Server. */ - getHackTime(host: string, hackLvl?: number, intLvl?: number): number; + getHackTime(host: string): number; /** + * Get the execution time of a grow() call. + * @remarks + * RAM cost: 0.05 GB + * * Returns the amount of time in seconds it takes to execute the grow Netscript function on the target server. * The function takes in an optional hackLvl parameter that can be specified to see what the grow time would be at different hacking levels. * - * @remarks RAM cost: 0.05 GB * @param host - Host of target server. * @param hackLvl - Optional hacking level for the calculation. Defaults to player’s current hacking level. * @param intLvl - Optional intelligence level for the calculation. Defaults to player’s current intelligence level. (Intelligence is unlocked after obtaining Source-File 5). * @returns Returns the amount of time in seconds it takes to execute the grow Netscript function. Returns Infinity if called on a Hacknet Server. */ - getGrowTime(host: string, hackLvl?: number, intLvl?: number): number; + getGrowTime(host: string): number; /** + * Get the execution time of a weaken() call. + * @remarks + * RAM cost: 0.05 GB + * * Returns the amount of time in seconds it takes to execute the weaken() Netscript function on the target server. * The function takes in an optional hackLvl parameter that can be specified to see what the weaken time would be at different hacking levels. * - * @remarks RAM cost: 0.05 GB * @param host - Host of target server. * @param hackLvl - Optional hacking level for the calculation. Defaults to player’s current hacking level. * @param intLvl - Optional intelligence level for the calculation. Defaults to player’s current intelligence level. (Intelligence is unlocked after obtaining Source-File 5). * @returns Returns the amount of time in seconds it takes to execute the grow Netscript function. Returns Infinity if called on a Hacknet Server. */ - getWeakenTime(host: string, hackLvl?: number, intLvl?: number): number; + getWeakenTime(host: string): number; /** + * Get the income of a script. + * @remarks + * RAM cost: 0.1 GB + * * Returns the amount of income the specified script generates while online * (when the game is open, does not apply for offline income). Remember that * a script is uniquely identified by both its name and its arguments. So for @@ -2821,7 +2977,6 @@ export declare interface NS extends Singularity { * The second value is the total income (dollar / second) that you’ve earned from scripts * since you last installed Augmentations. * - * @remarks RAM cost: 0.1 GB * @param script - Filename of script. * @param host - Server on which script is running. * @param args - Arguments that the script is running with. @@ -2830,6 +2985,10 @@ export declare interface NS extends Singularity { getScriptIncome(script: string, host: string, ...args: string[]): number | [number, number]; /** + * Get the exp gain of a script. + * @remarks + * RAM cost: 0.1 GB + * * Returns the amount of hacking experience the specified script generates while online * (when the game is open, does not apply for offline experience gains). Remember that a * script is uniquely identified by both its name and its arguments. @@ -2837,7 +2996,6 @@ export declare interface NS extends Singularity { * This function can also return the total experience gain rate of all of your active * scripts by running the function with no arguments. * - * @remarks RAM cost: 0.1 GB * @param script - Filename of script. * @param host - Server on which script is running. * @param args - Arguments that the script is running with. @@ -2854,10 +3012,12 @@ export declare interface NS extends Singularity { getTimeSinceLastAug(): number; /** - * Complete open source JavaScript sprintf implementation + * Format a string. * - * @see https://github.com/alexei/sprintf.js - * @remarks RAM cost: 0 GB + * @remarks + * RAM cost: 0 GB + * + * see: https://github.com/alexei/sprintf.js * @param format - String to format. * @param args - Formating arguments. * @returns Formated text. @@ -2865,10 +3025,11 @@ export declare interface NS extends Singularity { sprintf(format: string, ...args: string[]): string; /** - * Complete open source JavaScript sprintf implementation + * Format a string with an array of arguments. + * @remarks + * RAM cost: 0 GB * - * @see https://github.com/alexei/sprintf.js - * @remarks RAM cost: 0 GB + * see: https://github.com/alexei/sprintf.js * @param format - String to format. * @param args - Formating arguments. * @returns Formated text. @@ -2876,12 +3037,15 @@ export declare interface NS extends Singularity { vsprintf(format: string, args: string[]): string; /** + * Format a number + * @remarks + * RAM cost: 0 GB + * * Converts a number into a string with the specified formatter. * This uses the numeraljs library, so the formatters must be compatible with that. * This is the same function that the game itself uses to display numbers. * - * @see http://numeraljs.com/ - * @remarks RAM cost: 0 GB + * see: http://numeraljs.com/ * @param n - Number to format. * @param format - Formatter. * @returns Formated number. @@ -2889,18 +3053,25 @@ export declare interface NS extends Singularity { nFormat(n: number, format: string): number; /** + * Prompt the player with a Yes/No modal. + * @remarks + * RAM cost: 0 GB + * * Prompts the player with a dialog box with two options: “Yes” and “No”. * This function will return true if the player click “Yes” and false if * the player clicks “No”. The script’s execution is halted until the player * selects one of the options. * - * @remarks RAM cost: 0 GB * @param txt - Text to appear in the prompt dialog box. * @returns True if the player click “Yes” and false if the player clicks “No”. */ prompt(txt: string): Promise; /** + * Download a file from the internet. + * @remarks + * RAM cost: 0 GB + * * Retrieves data from a URL and downloads it to a file on the specified server. * The data can only be downloaded to a script (.script, .ns, .js) or a text file (.txt). * If the file already exists, it will be overwritten by this command. @@ -2922,7 +3093,6 @@ export declare interface NS extends Singularity { * ```ts * wget("https://raw.githubusercontent.com/danielyxie/bitburner/master/README.md", "game_readme.txt"); * ``` - * @remarks RAM cost: 0 GB * @param url - URL to pull data from. * @param target - Filename to write data to. Must be script or text file. * @param host - Optional hostname/ip of server for target file. @@ -2939,6 +3109,10 @@ export declare interface NS extends Singularity { getFavorToDonate(): number; /** + * Get the current Bitnode multipliers. + * @remarks + * RAM cost: 4 GB + * * Returns an object containing the current BitNode multipliers. * This function requires Source-File 5 in order to run. * The multipliers are returned in decimal forms (e.g. 1.5 instead of 150%). @@ -2955,7 +3129,6 @@ export declare interface NS extends Singularity { * print(mults.ServerMaxMoney); * print(mults.HackExpGain); * ``` - * @remarks RAM cost: 4 GB * @returns Object containing the current BitNode multipliers. */ getBitNodeMultipliers(): BitNodeMultipliers; diff --git a/electron/icon.icns b/electron/icon.icns new file mode 100644 index 0000000000000000000000000000000000000000..a4c4c3e411175bc4f3289de73930488ac63106e1 GIT binary patch literal 20887 zcmeH~O>3N06vxjqlY(1ULskRX+LdmEF7zu1qt9Z38=-GvQn1ivGjDlol9H8-iX^2K z5fLN46w`{}LU&!nFW?7|kdg}WJm&HLzwa|lo!MAHPr_uLx%YqWJ?D4MJ$G{Dt)+KG zUVHD#^_N~0d45gsQ~i&BJ5yu-KswbQ$?G>f58Uh58J>R;X?7}U_7iR2js5fw%ss$9 ze*H;%a_rz4YVNtXr};#t!)K_4KMmw%o;=2Vo8$*H`_S*rs_#j5;jB|-XRq{T+@UL3 z{ZX&Vj^?^ETgdXDlBHSo9myKUgDN|j@65PE2T`vf>RI(GjCzexugthZJ(v2Ul}e5P z7w`3>Imu_qh!iVTt;m;GxEVNKIK$_q9HUZ9&u7+xFe{(n&mJ7jWFJqzo3ZvZ>w#o> z(W`1F^RTQ*;}|(B^1;|y9byV$?II>l;DvNsSIslco*hE;aUitJK_{(rO0`TXpd9!`gopjZlJN}#+)MaDdy2-dy(gaYrsXfhTSH+T9}&U z9_HNQQ+bVD8_wBES!8Im1x#n_;w#oG*>_!GAI~N2Ot#@gxyS_24!Lu7%))jh4QJE9 za}#;yKJ{{ud8WSR2K}(OvFJmMLy@Ze()Qg$HR>MJ@Vm(4+N+5( z5hdnx#6mhFYp*402NK}T+Ln+cZm%a|hti0pWwp_XjYJvgZDN!jV8nsoh!4+fYVuBN z>ad5?-AZ(~0xTaW2C1r3y98HdJ0kN_l2J*6s|31_i-iIhTY|I5B_0Qw~x<(UlsWZ z9>5C4eVX{-GaJ>>2S)Vd)CFlB8JDAI5=Y?kMdNSu##fkMAGMcygTC=_Yye^V@(o5q z`OzlCXwRK4AmN_AaqQ=fJ28js*t<+E@R>y7J_v3d?(#bmGCq{ho_En?Vp`B*gNxGK zjctDzDv)hzV`wVXNzr$LN0@^*vD?2N?AVEIaGtVv%#O$I{$a3T7j`zbU;SCRwE8l7q18BGkq? zS7XRo>`0>uf1#j)T-Wok{3`JpiS@x=>DQ5*o!DI;=Xejhh1hs;2g9)gU+i|s?1?II zI%jS@Jg^zW&0_bk{{2~^50q_g8Qb`mK}wg+1%eduHZ(`Wt^QR|@oNLx5fg;9*h_Hx zI@LEp#p`^_cr9%=5FQfn1Azn0pKvi*a|3*X{Z$3-VtN+SON3Os8&f6ldK3D0F5>Nt4KnW-T zC7=Y9fD%vwNNt4KnW-T wC7=Y9fD%vwN|Ezv{pL5T}70yk5`PN?RzlQzo;hcNhrkU1k(2R^U zT1T6+XEeS1XW%?^uDRt;UiP8`C;poF~Y~#z$Uga*b0Id$4HGE==Gf z2hFL)<`|;aU9!&-_la%A)dlQj;%tE?W{UiU^1)RC-(KPZahf>2*mJcKLlb(Af#XHu zBoVWX6+bcTMsSYo-{As3KEQrNY$?tc7m1|;KVV-dm}x|y#orXLxi;5{BgDnx8gXU; z8y~T21=l#|b37){0JWYeL|y!7&_YuMn4*tV?W>hQ`yq`LL)?KglXBft&dQW!NeLY>wDEK^G zK61!){X}h^*-ynT;T*<9~=u`ae6*d7bJDgGz5`n`m|hF@1|JS6zu0NBx!b9ql} zCHQQ{K1xs%&BKE46o5^wMZ)isT7PtLt+2iSl{$`|(`4Tv_|9@?0bk5QZthP%zfU;M zkO%nP<~VxNFM53-`$NG#bdpEEVV<8FK0?*-S; z4;?<&W5+DSAYXIWhsIapd?yQE;|7icon%g<`Ag9gZLvvUqw-jn&A zg5RND?ODCCNkql@VH+qYDK;2vL6?hiO^%?BSu}hfr zE3vGAjnDTh=Jh&mH_~T3?zZ>G&oSrxi}<%-3)HoA<*-LBQ+nvaX+!tVuY z*7W$jCdV1h39`1W-ePH?U%l7Qy*Zvyz;si=a@O$kBVpdse=g0RysKq>&T64u7E!tZCM1AzzU-0|L zGBG0d6JL}y*PAK-vjyxN_uMTMzgN5?4iNOp`pFzqZ;^OiydjPh_&A@{W%c^R(0pFt z?*e%y&uy#kH78^5s{XGDelPI-@fo~6e$JJ@qr5LTXY#Vf&z*B1k840KJzYN;o4Wk& zd~~Xr=jT4=zF>x!InHHVK5R71l5=A|deDn__$Iry^~(N@)blaHeG~T#`x^HWF*IHC z=bDq9o&2^v$-Op__GR&k@MjhqA2Bq&=C57rLCz!Y$>r*~Rxq#EX`A2YL?7qn{+t_i z@zd*F!85}Q5u3t({5d!3;$I_H3Z9{O*G0VFl{&l!#>IJ} z_DrGicSy|ns{DMeMK5f8{q8@#&Jq3|h+4hYws#0MPY`nqj`1HTs5?X4F1``Ri|GaI z6@nNVwB(R`qS(ve7(aUhv4`04?&>;++B<~YHG=E;oWY)cFU}XtO5GjA3*u=pDt0RN zi&}RSXwZ`LgP`V1##^%KMbEZ(SJ(V;5BNKTTDAS(SN{9OXJWpfE_=j1`?$R|R zui890$B%1zYI6VN?+=kTOR@XKxY$kLXTQ0IfQ^qB8nom@zOVVSvNn(Fvt85gs$RA4 zZ=QRoG=7iO>crln^;~S8RpRdm|Nd61lXLyJruWaXH&mbJ6QAeBY^?Zeb+RV%yXx2K zL|$zTJ#%htGy47zRpy#|@T z*Pd*l-d77|ndtmKDd$UZt)Nbv13h`hh`lLzug?^`3s(!y18wYs_lA^jNpM7Hnv{5I{v2D$L*^3***J8dPFXm_8W(#ugT`pFN6U9sseX;Sa5NObn zLoPLZetOXBMnP|MQ3tzi?(o<22Ptp0*uUh{pPt^A{JG*I!M(Akh`!kPi0v(+SFH{` z=tWO-wRs}Hw$}7fvupmi?)2ufdWqoq25fx9YWJb#(egc$e}i0Gz{WSxI?Pm?CuXg!HT@uccT;cvUlr^w=ru^4+B~(n!-t;#uL9VE z_T@WsynnC;AX z{JB@ZGj{3t9hL7^@w+PXKVQHmH}7q~`=9INUR`rdCYG;hzQ@|;|Euqf$()1d=IdUY yKWjXHs_lH;nLoeBvSzAh?$tlvW4-jl__}xga4&{?@&C97^zk|T8ScPfJMafg{iuKd literal 0 HcmV?d00001 diff --git a/electron/main.js b/electron/main.js index 16561c54d..e71b9cdd9 100644 --- a/electron/main.js +++ b/electron/main.js @@ -5,7 +5,7 @@ function createWindow() { const win = new BrowserWindow({ show: false, webPreferences: { - devTools: true, + // devTools: true, }, }); @@ -13,7 +13,7 @@ function createWindow() { win.maximize(); win.loadFile("index.html"); win.show(); - win.webContents.openDevTools(); + // win.webContents.openDevTools(); globalShortcut.register("f5", function () { win.loadFile("index.html"); }); diff --git a/electron/package.json b/electron/package.json index 0ef9c13f9..1a5da80c5 100755 --- a/electron/package.json +++ b/electron/package.json @@ -3,5 +3,22 @@ "version": "1.0.0", "description": "A cyberpunk-themed programming incremental game", "main": "main.js", - "author": "Daniel Xie" + "author": "Daniel Xie & Olivier Gagnon", + "mac": { + "icon": "./public/icons/mac/icon.icns", + "category": "public.app-category.games" + }, + "win": { + "icon": "./public/icons/png/256x256.png" + }, + "files": [ + "./build/**/*", + "./dist/**/*", + "./node_modules/**/*", + "./public/**/*", + "*.js" + ], + "directories": { + "buildResources": "public" + } } diff --git a/input/bitburner.api.json b/input/bitburner.api.json index db2f4821a..de88c2b2f 100644 --- a/input/bitburner.api.json +++ b/input/bitburner.api.json @@ -176,7 +176,7 @@ "excerptTokens": [ { "kind": "Content", - "text": "interface AugmentationStats " + "text": "export interface AugmentationStats " } ], "releaseTag": "Public", @@ -972,7 +972,7 @@ "excerptTokens": [ { "kind": "Content", - "text": "interface AugmentPair " + "text": "export interface AugmentPair " } ], "releaseTag": "Public", @@ -1040,7 +1040,7 @@ "excerptTokens": [ { "kind": "Content", - "text": "interface BasicHGWOptions " + "text": "export interface BasicHGWOptions " } ], "releaseTag": "Public", @@ -1108,7 +1108,7 @@ "excerptTokens": [ { "kind": "Content", - "text": "interface BitNodeMultipliers " + "text": "export interface BitNodeMultipliers " } ], "releaseTag": "Public", @@ -3667,7 +3667,7 @@ "excerptTokens": [ { "kind": "Content", - "text": "interface BladeburnerCurAction " + "text": "export interface BladeburnerCurAction " } ], "releaseTag": "Public", @@ -3735,7 +3735,7 @@ "excerptTokens": [ { "kind": "Content", - "text": "interface CharacterInfo " + "text": "export interface CharacterInfo " } ], "releaseTag": "Public", @@ -4220,7 +4220,7 @@ "excerptTokens": [ { "kind": "Content", - "text": "interface CharacterMult " + "text": "export interface CharacterMult " } ], "releaseTag": "Public", @@ -4626,7 +4626,7 @@ "excerptTokens": [ { "kind": "Content", - "text": "interface CodingAttemptOptions " + "text": "export interface CodingAttemptOptions " } ], "releaseTag": "Public", @@ -4668,7 +4668,7 @@ "excerptTokens": [ { "kind": "Content", - "text": "interface CodingContract " + "text": "export interface CodingContract " } ], "releaseTag": "Public", @@ -5084,7 +5084,7 @@ "excerptTokens": [ { "kind": "Content", - "text": "interface CrimeStats " + "text": "export interface CrimeStats " } ], "releaseTag": "Public", @@ -5620,7 +5620,7 @@ "excerptTokens": [ { "kind": "Content", - "text": "interface EquipmentStats " + "text": "export interface EquipmentStats " } ], "releaseTag": "Public", @@ -5792,7 +5792,7 @@ "excerptTokens": [ { "kind": "Content", - "text": "interface Gang " + "text": "export interface Gang " } ], "releaseTag": "Public", @@ -5871,6 +5871,50 @@ "parameters": [], "name": "canRecruitMember" }, + { + "kind": "MethodSignature", + "canonicalReference": "bitburner!Gang#createGang:member(1)", + "docComment": "/**\n * Create a gang.\n *\n * @remarks\n *\n * RAM cost: 1GB\n *\n * Create a gang with the specified faction.\n *\n * @returns True if the gang was created, false otherwise.\n */\n", + "excerptTokens": [ + { + "kind": "Content", + "text": "createGang(faction: " + }, + { + "kind": "Content", + "text": "string" + }, + { + "kind": "Content", + "text": "): " + }, + { + "kind": "Content", + "text": "boolean" + }, + { + "kind": "Content", + "text": ";" + } + ], + "isOptional": false, + "returnTypeTokenRange": { + "startIndex": 3, + "endIndex": 4 + }, + "releaseTag": "Public", + "overloadIndex": 1, + "parameters": [ + { + "parameterName": "faction", + "parameterTypeTokenRange": { + "startIndex": 1, + "endIndex": 2 + } + } + ], + "name": "createGang" + }, { "kind": "MethodSignature", "canonicalReference": "bitburner!Gang#getBonusTime:member(1)", @@ -6308,6 +6352,34 @@ ], "name": "getTaskStats" }, + { + "kind": "MethodSignature", + "canonicalReference": "bitburner!Gang#inGang:member(1)", + "docComment": "/**\n * Check if you're in a gang.\n *\n * @remarks\n *\n * RAM cost: 1GB\n *\n * @returns True if you're in a gang, false otherwise.\n */\n", + "excerptTokens": [ + { + "kind": "Content", + "text": "inGang(): " + }, + { + "kind": "Content", + "text": "boolean" + }, + { + "kind": "Content", + "text": ";" + } + ], + "isOptional": false, + "returnTypeTokenRange": { + "startIndex": 1, + "endIndex": 2 + }, + "releaseTag": "Public", + "overloadIndex": 1, + "parameters": [], + "name": "inGang" + }, { "kind": "MethodSignature", "canonicalReference": "bitburner!Gang#purchaseEquipment:member(1)", @@ -6524,7 +6596,7 @@ "excerptTokens": [ { "kind": "Content", - "text": "interface GangGenInfo " + "text": "export interface GangGenInfo " } ], "releaseTag": "Public", @@ -6800,7 +6872,7 @@ "excerptTokens": [ { "kind": "Content", - "text": "interface GangMemberAscension " + "text": "export interface GangMemberAscension " } ], "releaseTag": "Public", @@ -6998,7 +7070,7 @@ "excerptTokens": [ { "kind": "Content", - "text": "interface GangMemberInfo " + "text": "export interface GangMemberInfo " } ], "releaseTag": "Public", @@ -7560,7 +7632,7 @@ "excerptTokens": [ { "kind": "Content", - "text": "interface GangOtherInfo " + "text": "export interface GangOtherInfo " } ], "releaseTag": "Public", @@ -7623,7 +7695,7 @@ "excerptTokens": [ { "kind": "Content", - "text": "interface GangOtherInfoObject " + "text": "export interface GangOtherInfoObject " } ], "releaseTag": "Public", @@ -7691,7 +7763,7 @@ "excerptTokens": [ { "kind": "Content", - "text": "interface GangTaskStats " + "text": "export interface GangTaskStats " } ], "releaseTag": "Public", @@ -8098,7 +8170,7 @@ "excerptTokens": [ { "kind": "Content", - "text": "interface GangTerritory " + "text": "export interface GangTerritory " } ], "releaseTag": "Public", @@ -8192,7 +8264,7 @@ "excerptTokens": [ { "kind": "Content", - "text": "interface HackingMultipliers " + "text": "export interface HackingMultipliers " } ], "releaseTag": "Public", @@ -8312,7 +8384,7 @@ "excerptTokens": [ { "kind": "Content", - "text": "interface Hacknet " + "text": "export interface Hacknet " } ], "releaseTag": "Public", @@ -9060,7 +9132,7 @@ "excerptTokens": [ { "kind": "Content", - "text": "interface HacknetMultipliers " + "text": "export interface HacknetMultipliers " } ], "releaseTag": "Public", @@ -9206,7 +9278,7 @@ "excerptTokens": [ { "kind": "Content", - "text": "interface NodeStats " + "text": "export interface NodeStats " } ], "releaseTag": "Public", @@ -9474,7 +9546,7 @@ { "kind": "PropertySignature", "canonicalReference": "bitburner!NS#args:member", - "docComment": "/**\n * Arguments passed into the script.\n *\n * @remarks\n *\n * RAM cost: 0 GB Arguments passed into a script can be accessed using a normal array using the [] operator (args[0], args[1], etc…).\n *\n * It is also possible to get the number of arguments that was passed into a script using: 'args.length' WARNING: Do not try to modify the args array. This will break the game.\n */\n", + "docComment": "/**\n * Arguments passed into the script.\n *\n * @remarks\n *\n * RAM cost: 0 GB\n *\n * Arguments passed into a script can be accessed using a normal array using the [] operator (args[0], args[1], etc…).\n *\n * It is also possible to get the number of arguments that was passed into a script using: 'args.length' WARNING: Do not try to modify the args array. This will break the game.\n */\n", "excerptTokens": [ { "kind": "Content", @@ -9527,7 +9599,7 @@ { "kind": "MethodSignature", "canonicalReference": "bitburner!NS#brutessh:member(1)", - "docComment": "/**\n * Runs the BruteSSH.exe program on the target server. BruteSSH.exe must exist on your home computer.\n *\n * @remarks\n *\n * RAM cost: 0.05 GB\n *\n * @param host - Hostname of the target server.\n *\n * @example\n * ```ts\n * brutessh(\"foodnstuff\");\n * ```\n *\n */\n", + "docComment": "/**\n * Runs BruteSSH.exe on a server.\n *\n * @remarks\n *\n * RAM cost: 0.05 GB\n *\n * Runs the BruteSSH.exe program on the target server. BruteSSH.exe must exist on your home computer.\n *\n * @param host - Hostname of the target server.\n *\n * @example\n * ```ts\n * brutessh(\"foodnstuff\");\n * ```\n *\n */\n", "excerptTokens": [ { "kind": "Content", @@ -9571,7 +9643,7 @@ { "kind": "MethodSignature", "canonicalReference": "bitburner!NS#clear:member(1)", - "docComment": "/**\n * This function is used to clear data in a Netscript Ports or a text file.\n *\n * If the port/fn argument is a number between 1 and 20, then it specifies a port and will clear it (deleting all data from the underlying queue).\n *\n * If the port/fn argument is a string, then it specifies the name of a text file (.txt) and will delete all data from that text file.\n *\n * @remarks\n *\n * RAM cost: 1 GB\n *\n * @param handle - Port or text file to clear.\n */\n", + "docComment": "/**\n * Clear data from a port.\n *\n * @remarks\n *\n * RAM cost: 0 GB\n *\n * This function is used to clear data in a Netscript Ports or a text file.\n *\n * If the port/fn argument is a number between 1 and 20, then it specifies a port and will clear it (deleting all data from the underlying queue).\n *\n * If the port/fn argument is a string, then it specifies the name of a text file (.txt) and will delete all data from that text file.\n *\n * @param handle - Port or text file to clear.\n */\n", "excerptTokens": [ { "kind": "Content", @@ -9670,7 +9742,7 @@ { "kind": "MethodSignature", "canonicalReference": "bitburner!NS#deleteServer:member(1)", - "docComment": "/**\n * Deletes one of your purchased servers, which is specified by its hostname.\n *\n * The hostname argument can be any data type, but it will be converted to a string. Whitespace is automatically removed from the string. This function will not delete a server that still has scripts running on it.\n *\n * @remarks\n *\n * 2.25 GB\n *\n * @param host - Host of the server to delete.\n *\n * @returns True if successful, and false otherwise.\n */\n", + "docComment": "/**\n * Delete a purchased server.\n *\n * @remarks\n *\n * 2.25 GB\n *\n * Deletes one of your purchased servers, which is specified by its hostname.\n *\n * The hostname argument can be any data type, but it will be converted to a string. Whitespace is automatically removed from the string. This function will not delete a server that still has scripts running on it.\n *\n * @param host - Host of the server to delete.\n *\n * @returns True if successful, and false otherwise.\n */\n", "excerptTokens": [ { "kind": "Content", @@ -9714,7 +9786,7 @@ { "kind": "MethodSignature", "canonicalReference": "bitburner!NS#disableLog:member(1)", - "docComment": "/**\n * Disables logging for the given function.\n *\n * @remarks\n *\n * RAM cost: 0 GB Logging can be disabled for all functions by passing `ALL` as the argument.\n *\n * Note that this does not completely remove all logging functionality. This only stops a function from logging when the function is successful. If the function fails, it will still log the reason for failure.\n *\n * Notable functions that cannot have their logs disabled: run, exec, exit.\n *\n * @param fn - Name of function for which to disable logging.\n */\n", + "docComment": "/**\n * Disables logging for the given function.\n *\n * @remarks\n *\n * RAM cost: 0 GB\n *\n * Logging can be disabled for all functions by passing `ALL` as the argument.\n *\n * Note that this does not completely remove all logging functionality. This only stops a function from logging when the function is successful. If the function fails, it will still log the reason for failure.\n *\n * Notable functions that cannot have their logs disabled: run, exec, exit.\n *\n * @param fn - Name of function for which to disable logging.\n */\n", "excerptTokens": [ { "kind": "Content", @@ -9758,7 +9830,7 @@ { "kind": "MethodSignature", "canonicalReference": "bitburner!NS#enableLog:member(1)", - "docComment": "/**\n * Re-enables logging for the given function. If `ALL` is passed into this function as an argument, then it will revert the effects of disableLog(`ALL`).\n *\n * @remarks\n *\n * RAM cost: 0 GB\n *\n * @param fn - Name of function for which to enable logging.\n */\n", + "docComment": "/**\n * Enable logging for a certain function.\n *\n * @remarks\n *\n * RAM cost: 0 GB\n *\n * Re-enables logging for the given function. If `ALL` is passed into this function as an argument, then it will revert the effects of disableLog(`ALL`).\n *\n * @param fn - Name of function for which to enable logging.\n */\n", "excerptTokens": [ { "kind": "Content", @@ -9802,7 +9874,7 @@ { "kind": "MethodSignature", "canonicalReference": "bitburner!NS#exec:member(1)", - "docComment": "/**\n * Run a script as a separate process on a specified server. This is similar to the run function except that it can be used to run a script on any server, instead of just the current server.\n *\n * If the script was successfully started, then this functions returns the PID of that script. Otherwise, it returns 0.\n *\n * PID stands for Process ID. The PID is a unique identifier for each script. The PID will always be a positive integer.\n *\n * Running this function with a numThreads argument of 0 will return 0 without running the script. However, running this function with a negative numThreads argument will cause a runtime error.\n *\n * @remarks\n *\n * RAM cost: 1.3 GB\n *\n * @param script - Filename of script to execute.\n *\n * @param host - Hostname of the `target server` on which to execute the script.\n *\n * @param numThreads - Optional thread count for new script. Set to 1 by default. Will be rounded to nearest integer.\n *\n * @param args - Additional arguments to pass into the new script that is being run. Note that if any arguments are being passed into the new script, then the third argument numThreads must be filled in with a value.\n *\n * @returns Returns the PID of a successfully started script, and 0 otherwise.\n *\n * @example\n * ```ts\n * //The simplest way to use the exec command is to call it with just the script name and the target server. The following example will try to run generic-hack.script on the foodnstuff server:\n * exec(\"generic-hack.script\", \"foodnstuff\");\n * ```\n *\n * @example\n * ```ts\n * //The following example will try to run the script generic-hack.script on the joesguns server with 10 threads:\n * exec(\"generic-hack.script\", \"joesguns\", 10);\n * ```\n *\n * @example\n * ```ts\n * //This last example will try to run the script foo.script on the foodnstuff server with 5 threads. It will also pass the number 1 and the string “test” in as arguments to the script:\n * exec(\"foo.script\", \"foodnstuff\", 5, 1, \"test\");\n * ```\n *\n */\n", + "docComment": "/**\n * Start another script on any server.\n *\n * @remarks\n *\n * RAM cost: 1.3 GB\n *\n * Run a script as a separate process on a specified server. This is similar to the run function except that it can be used to run a script on any server, instead of just the current server.\n *\n * If the script was successfully started, then this functions returns the PID of that script. Otherwise, it returns 0.\n *\n * PID stands for Process ID. The PID is a unique identifier for each script. The PID will always be a positive integer.\n *\n * Running this function with a numThreads argument of 0 will return 0 without running the script. However, running this function with a negative numThreads argument will cause a runtime error.\n *\n * @param script - Filename of script to execute.\n *\n * @param host - Hostname of the `target server` on which to execute the script.\n *\n * @param numThreads - Optional thread count for new script. Set to 1 by default. Will be rounded to nearest integer.\n *\n * @param args - Additional arguments to pass into the new script that is being run. Note that if any arguments are being passed into the new script, then the third argument numThreads must be filled in with a value.\n *\n * @returns Returns the PID of a successfully started script, and 0 otherwise.\n *\n * @example\n * ```ts\n * //The simplest way to use the exec command is to call it with just the script name and the target server. The following example will try to run generic-hack.script on the foodnstuff server:\n * exec(\"generic-hack.script\", \"foodnstuff\");\n * ```\n *\n * @example\n * ```ts\n * //The following example will try to run the script generic-hack.script on the joesguns server with 10 threads:\n * exec(\"generic-hack.script\", \"joesguns\", 10);\n * ```\n *\n * @example\n * ```ts\n * //This last example will try to run the script foo.script on the foodnstuff server with 5 threads. It will also pass the number 1 and the string “test” in as arguments to the script:\n * exec(\"foo.script\", \"foodnstuff\", 5, 1, \"test\");\n * ```\n *\n */\n", "excerptTokens": [ { "kind": "Content", @@ -9919,7 +9991,7 @@ { "kind": "MethodSignature", "canonicalReference": "bitburner!NS#fileExists:member(1)", - "docComment": "/**\n * Returns a boolean indicating whether the specified file exists on the target server. The filename for scripts is case-sensitive, but for other types of files it is not. For example, fileExists(“brutessh.exe”) will work fine, even though the actual program is named 'BruteSSH.exe'.\n *\n * If the hostname/ip argument is omitted, then the function will search through the current server (the server running the script that calls this function) for the file.\n *\n * @remarks\n *\n * RAM cost: 0.1 GB\n *\n * @param filename - Filename of file to check.\n *\n * @param host - Host of target server. This is optional. If it is not specified then the function will use the current server as the target server.\n *\n * @returns True if specified file exists, and false otherwise.\n *\n * @example\n * ```ts\n * //The function call will return true if the script named foo.script exists on the foodnstuff server, and false otherwise.\n * fileExists(\"foo.script\", \"foodnstuff\");\n * ```\n *\n * @example\n * ```ts\n * //The function call will return true if the current server contains the FTPCrack.exe program, and false otherwise.\n * fileExists(\"ftpcrack.exe\");\n * ```\n *\n */\n", + "docComment": "/**\n * Check if a file exists.\n *\n * @remarks\n *\n * RAM cost: 0.1 GB\n *\n * Returns a boolean indicating whether the specified file exists on the target server. The filename for scripts is case-sensitive, but for other types of files it is not. For example, fileExists(“brutessh.exe”) will work fine, even though the actual program is named 'BruteSSH.exe'.\n *\n * If the hostname/ip argument is omitted, then the function will search through the current server (the server running the script that calls this function) for the file.\n *\n * @param filename - Filename of file to check.\n *\n * @param host - Host of target server. This is optional. If it is not specified then the function will use the current server as the target server.\n *\n * @returns True if specified file exists, and false otherwise.\n *\n * @example\n * ```ts\n * //The function call will return true if the script named foo.script exists on the foodnstuff server, and false otherwise.\n * fileExists(\"foo.script\", \"foodnstuff\");\n * ```\n *\n * @example\n * ```ts\n * //The function call will return true if the current server contains the FTPCrack.exe program, and false otherwise.\n * fileExists(\"ftpcrack.exe\");\n * ```\n *\n */\n", "excerptTokens": [ { "kind": "Content", @@ -9978,7 +10050,7 @@ { "kind": "MethodSignature", "canonicalReference": "bitburner!NS#ftpcrack:member(1)", - "docComment": "/**\n * Runs the FTPCrack.exe program on the target server. FTPCrack.exe must exist on your home computer.\n *\n * @remarks\n *\n * RAM cost: 0.05 GB\n *\n * @param host - Hostname of the target server.\n *\n * @example\n * ```ts\n * ftpcrack(\"foodnstuff\");\n * ```\n *\n */\n", + "docComment": "/**\n * Runs FTPCrack.exe on a server.\n *\n * @remarks\n *\n * RAM cost: 0.05 GB\n *\n * Runs the FTPCrack.exe program on the target server. FTPCrack.exe must exist on your home computer.\n *\n * @param host - Hostname of the target server.\n *\n * @example\n * ```ts\n * ftpcrack(\"foodnstuff\");\n * ```\n *\n */\n", "excerptTokens": [ { "kind": "Content", @@ -10049,7 +10121,7 @@ { "kind": "MethodSignature", "canonicalReference": "bitburner!NS#getBitNodeMultipliers:member(1)", - "docComment": "/**\n * Returns an object containing the current BitNode multipliers. This function requires Source-File 5 in order to run. The multipliers are returned in decimal forms (e.g. 1.5 instead of 150%). The multipliers represent the difference between the current BitNode and the original BitNode (BitNode-1).\n *\n * For example, if the CrimeMoney multiplier has a value of 0.1, then that means that committing crimes in the current BitNode will only give 10% of the money you would have received in BitNode-1.\n *\n * @remarks\n *\n * RAM cost: 4 GB\n *\n * @returns Object containing the current BitNode multipliers.\n *\n * @example\n * ```ts\n * mults = getBitNodeMultipliers();\n * print(mults.ServerMaxMoney);\n * print(mults.HackExpGain);\n * ```\n *\n */\n", + "docComment": "/**\n * Get the current Bitnode multipliers.\n *\n * @remarks\n *\n * RAM cost: 4 GB\n *\n * Returns an object containing the current BitNode multipliers. This function requires Source-File 5 in order to run. The multipliers are returned in decimal forms (e.g. 1.5 instead of 150%). The multipliers represent the difference between the current BitNode and the original BitNode (BitNode-1).\n *\n * For example, if the CrimeMoney multiplier has a value of 0.1, then that means that committing crimes in the current BitNode will only give 10% of the money you would have received in BitNode-1.\n *\n * @returns Object containing the current BitNode multipliers.\n *\n * @example\n * ```ts\n * mults = getBitNodeMultipliers();\n * print(mults.ServerMaxMoney);\n * print(mults.HackExpGain);\n * ```\n *\n */\n", "excerptTokens": [ { "kind": "Content", @@ -10106,7 +10178,7 @@ { "kind": "MethodSignature", "canonicalReference": "bitburner!NS#getGrowTime:member(1)", - "docComment": "/**\n * Returns the amount of time in seconds it takes to execute the grow Netscript function on the target server. The function takes in an optional hackLvl parameter that can be specified to see what the grow time would be at different hacking levels.\n *\n * @remarks\n *\n * RAM cost: 0.05 GB\n *\n * @param host - Host of target server.\n *\n * @param hackLvl - Optional hacking level for the calculation. Defaults to player’s current hacking level.\n *\n * @param intLvl - Optional intelligence level for the calculation. Defaults to player’s current intelligence level. (Intelligence is unlocked after obtaining Source-File 5).\n *\n * @returns Returns the amount of time in seconds it takes to execute the grow Netscript function. Returns Infinity if called on a Hacknet Server.\n */\n", + "docComment": "/**\n * Get the execution time of a grow() call.\n *\n * @remarks\n *\n * RAM cost: 0.05 GB\n *\n * Returns the amount of time in seconds it takes to execute the grow Netscript function on the target server. The function takes in an optional hackLvl parameter that can be specified to see what the grow time would be at different hacking levels.\n *\n * @param host - Host of target server.\n *\n * @param hackLvl - Optional hacking level for the calculation. Defaults to player’s current hacking level.\n *\n * @param intLvl - Optional intelligence level for the calculation. Defaults to player’s current intelligence level. (Intelligence is unlocked after obtaining Source-File 5).\n *\n * @returns Returns the amount of time in seconds it takes to execute the grow Netscript function. Returns Infinity if called on a Hacknet Server.\n */\n", "excerptTokens": [ { "kind": "Content", @@ -10116,22 +10188,6 @@ "kind": "Content", "text": "string" }, - { - "kind": "Content", - "text": ", hackLvl?: " - }, - { - "kind": "Content", - "text": "number" - }, - { - "kind": "Content", - "text": ", intLvl?: " - }, - { - "kind": "Content", - "text": "number" - }, { "kind": "Content", "text": "): " @@ -10147,8 +10203,8 @@ ], "isOptional": false, "returnTypeTokenRange": { - "startIndex": 7, - "endIndex": 8 + "startIndex": 3, + "endIndex": 4 }, "releaseTag": "Public", "overloadIndex": 1, @@ -10159,20 +10215,6 @@ "startIndex": 1, "endIndex": 2 } - }, - { - "parameterName": "hackLvl", - "parameterTypeTokenRange": { - "startIndex": 3, - "endIndex": 4 - } - }, - { - "parameterName": "intLvl", - "parameterTypeTokenRange": { - "startIndex": 5, - "endIndex": 6 - } } ], "name": "getGrowTime" @@ -10208,7 +10250,7 @@ { "kind": "MethodSignature", "canonicalReference": "bitburner!NS#getHackingMultipliers:member(1)", - "docComment": "/**\n * Returns an object containing the Player’s hacking related multipliers. These multipliers are returned in fractional forms, not percentages (e.g. 1.5 instead of 150%).\n *\n * @remarks\n *\n * RAM cost: 4 GB\n *\n * @returns Object containing the Player’s hacking related multipliers.\n *\n * @example\n * ```ts\n * //Example of how this can be used:\n * mults = getHackingMultipliers();\n * print(mults.chance);\n * print(mults.growth);\n * ```\n *\n */\n", + "docComment": "/**\n * Get hacking related multipliers.\n *\n * @remarks\n *\n * RAM cost: 4 GB\n *\n * Returns an object containing the Player’s hacking related multipliers. These multipliers are returned in fractional forms, not percentages (e.g. 1.5 instead of 150%).\n *\n * @returns Object containing the Player’s hacking related multipliers.\n *\n * @example\n * ```ts\n * //Example of how this can be used:\n * mults = getHackingMultipliers();\n * print(mults.chance);\n * print(mults.growth);\n * ```\n *\n */\n", "excerptTokens": [ { "kind": "Content", @@ -10237,7 +10279,7 @@ { "kind": "MethodSignature", "canonicalReference": "bitburner!NS#getHacknetMultipliers:member(1)", - "docComment": "/**\n * Returns an object containing the Player’s hacknet related multipliers. These multipliers are returned in fractional forms, not percentages (e.g. 1.5 instead of 150%).\n *\n * @remarks\n *\n * RAM cost: 4 GB\n *\n * @returns Object containing the Player’s hacknet related multipliers.\n *\n * @example\n * ```ts\n * //Example of how this can be used:\n * mults = getHacknetMultipliers();\n * print(mults.production);\n * print(mults.purchaseCost);\n * ```\n *\n */\n", + "docComment": "/**\n * Get hacknet related multipliers.\n *\n * @remarks\n *\n * RAM cost: 4 GB\n *\n * Returns an object containing the Player’s hacknet related multipliers. These multipliers are returned in fractional forms, not percentages (e.g. 1.5 instead of 150%).\n *\n * @returns Object containing the Player’s hacknet related multipliers.\n *\n * @example\n * ```ts\n * //Example of how this can be used:\n * mults = getHacknetMultipliers();\n * print(mults.production);\n * print(mults.purchaseCost);\n * ```\n *\n */\n", "excerptTokens": [ { "kind": "Content", @@ -10266,7 +10308,7 @@ { "kind": "MethodSignature", "canonicalReference": "bitburner!NS#getHackTime:member(1)", - "docComment": "/**\n * Returns the amount of time in seconds it takes to execute the hack Netscript function on the target server. The function takes in an optional hackLvl parameter that can be specified to see what the hack time would be at different hacking levels.\n *\n * @remarks\n *\n * RAM cost: 0.05 GB\n *\n * @param host - Host of target server.\n *\n * @param hackLvl - Optional hacking level for the calculation. Defaults to player’s current hacking level.\n *\n * @param intLvl - Optional intelligence level for the calculation. Defaults to player’s current intelligence level. (Intelligence is unlocked after obtaining Source-File 5).\n *\n * @returns Returns the amount of time in seconds it takes to execute the hack Netscript function. Returns Infinity if called on a Hacknet Server.\n */\n", + "docComment": "/**\n * Get the execution time of a hack() call.\n *\n * @remarks\n *\n * RAM cost: 0.05 GB\n *\n * Returns the amount of time in milliseconds it takes to execute the hack Netscript function on the target server. The function takes in an optional hackLvl parameter that can be specified to see what the hack time would be at different hacking levels.\n *\n * @param host - Host of target server.\n *\n * @param hackLvl - Optional hacking level for the calculation. Defaults to player’s current hacking level.\n *\n * @param intLvl - Optional intelligence level for the calculation. Defaults to player’s current intelligence level. (Intelligence is unlocked after obtaining Source-File 5).\n *\n * @returns Returns the amount of time in milliseconds it takes to execute the hack Netscript function. Returns Infinity if called on a Hacknet Server.\n */\n", "excerptTokens": [ { "kind": "Content", @@ -10276,22 +10318,6 @@ "kind": "Content", "text": "string" }, - { - "kind": "Content", - "text": ", hackLvl?: " - }, - { - "kind": "Content", - "text": "number" - }, - { - "kind": "Content", - "text": ", intLvl?: " - }, - { - "kind": "Content", - "text": "number" - }, { "kind": "Content", "text": "): " @@ -10307,8 +10333,8 @@ ], "isOptional": false, "returnTypeTokenRange": { - "startIndex": 7, - "endIndex": 8 + "startIndex": 3, + "endIndex": 4 }, "releaseTag": "Public", "overloadIndex": 1, @@ -10319,20 +10345,6 @@ "startIndex": 1, "endIndex": 2 } - }, - { - "parameterName": "hackLvl", - "parameterTypeTokenRange": { - "startIndex": 3, - "endIndex": 4 - } - }, - { - "parameterName": "intLvl", - "parameterTypeTokenRange": { - "startIndex": 5, - "endIndex": 6 - } } ], "name": "getHackTime" @@ -10368,7 +10380,7 @@ { "kind": "MethodSignature", "canonicalReference": "bitburner!NS#getPortHandle:member(1)", - "docComment": "/**\n * Get a handle to a Netscript Port.\n *\n * WARNING: Port Handles only work in NetscriptJS (Netscript 2.0). They will not work in Netscript 1.0.\n *\n * @remarks\n *\n * RAM cost: 10 GB\n *\n * @param port - Port number. Must be an integer between 1 and 20.\n *\n * @returns Data in the specified port.\n *\n * @see\n *\n * https://bitburner.readthedocs.io/en/latest/netscript/netscriptmisc.html#netscript-ports\n */\n", + "docComment": "/**\n * Get all data on a port.\n *\n * @remarks\n *\n * RAM cost: 0 GB\n *\n * Get a handle to a Netscript Port.\n *\n * WARNING: Port Handles only work in NetscriptJS (Netscript 2.0). They will not work in Netscript 1.0.\n *\n * @param port - Port number. Must be an integer between 1 and 20.\n *\n * @returns Data in the specified port.\n *\n * @see\n *\n * https://bitburner.readthedocs.io/en/latest/netscript/netscriptmisc.html#netscript-ports\n */\n", "excerptTokens": [ { "kind": "Content", @@ -10412,7 +10424,7 @@ { "kind": "MethodSignature", "canonicalReference": "bitburner!NS#getPurchasedServerCost:member(1)", - "docComment": "/**\n * Returns the cost to purchase a server with the specified amount of ram.\n *\n * @remarks\n *\n * RAM cost: 0.25 GB\n *\n * @param ram - Amount of RAM of a potential purchased server. Must be a power of 2 (2, 4, 8, 16, etc.). Maximum value of 1048576 (2^20).\n *\n * @returns The cost to purchase a server with the specified amount of ram.\n *\n * @example\n * ```ts\n * for (i = 1; i <= 20; i++) {\n * tprint(i + \" -- \" + getPurchasedServerCost(Math.pow(2, i)));\n * }\n * ```\n *\n */\n", + "docComment": "/**\n * Get cost of purchasing a server.\n *\n * @remarks\n *\n * RAM cost: 0.25 GB\n *\n * Returns the cost to purchase a server with the specified amount of ram.\n *\n * @param ram - Amount of RAM of a potential purchased server. Must be a power of 2 (2, 4, 8, 16, etc.). Maximum value of 1048576 (2^20).\n *\n * @returns The cost to purchase a server with the specified amount of ram.\n *\n * @example\n * ```ts\n * for (i = 1; i <= 20; i++) {\n * tprint(i + \" -- \" + getPurchasedServerCost(Math.pow(2, i)));\n * }\n * ```\n *\n */\n", "excerptTokens": [ { "kind": "Content", @@ -10512,7 +10524,7 @@ { "kind": "MethodSignature", "canonicalReference": "bitburner!NS#getPurchasedServers:member(1)", - "docComment": "/**\n * Returns an array with either the hostnames or IPs of all of the servers you have purchased.\n *\n * @remarks\n *\n * 2.25 GB\n *\n * @param hostnameMode - ] Optional. Defaults to true. Returns hostnames if true, and IPs if false.\n *\n * @returns Returns an array with either the hostnames or IPs of all of the servers you have purchased.\n */\n", + "docComment": "/**\n * Returns an array with either the hostnames or IPs of all of the servers you have purchased.\n *\n * @remarks\n *\n * 2.25 GB\n *\n * @param hostnameMode - Optional. Defaults to true. Returns hostnames if true, and IPs if false.\n *\n * @returns Returns an array with either the hostnames or IPs of all of the servers you have purchased.\n */\n", "excerptTokens": [ { "kind": "Content", @@ -10556,7 +10568,7 @@ { "kind": "MethodSignature", "canonicalReference": "bitburner!NS#getScriptExpGain:member(1)", - "docComment": "/**\n * Returns the amount of hacking experience the specified script generates while online (when the game is open, does not apply for offline experience gains). Remember that a script is uniquely identified by both its name and its arguments.\n *\n * This function can also return the total experience gain rate of all of your active scripts by running the function with no arguments.\n *\n * @remarks\n *\n * RAM cost: 0.1 GB\n *\n * @param script - Filename of script.\n *\n * @param host - Server on which script is running.\n *\n * @param args - Arguments that the script is running with.\n *\n * @returns Amount of hacking experience the specified script generates while online.\n */\n", + "docComment": "/**\n * Get the exp gain of a script.\n *\n * @remarks\n *\n * RAM cost: 0.1 GB\n *\n * Returns the amount of hacking experience the specified script generates while online (when the game is open, does not apply for offline experience gains). Remember that a script is uniquely identified by both its name and its arguments.\n *\n * This function can also return the total experience gain rate of all of your active scripts by running the function with no arguments.\n *\n * @param script - Filename of script.\n *\n * @param host - Server on which script is running.\n *\n * @param args - Arguments that the script is running with.\n *\n * @returns Amount of hacking experience the specified script generates while online.\n */\n", "excerptTokens": [ { "kind": "Content", @@ -10630,7 +10642,7 @@ { "kind": "MethodSignature", "canonicalReference": "bitburner!NS#getScriptIncome:member(1)", - "docComment": "/**\n * Returns the amount of income the specified script generates while online (when the game is open, does not apply for offline income). Remember that a script is uniquely identified by both its name and its arguments. So for example if you ran a script with the arguments “foodnstuff” and “5” then in order to use this function to get that script’s income you must specify those same arguments in the same order in this function call.\n *\n * This function can also be called with no arguments. If called with no arguments, then this function will return an array of two values. The first value is the total income (dollar / second) of all of your active scripts (scripts that are currently running on any server). The second value is the total income (dollar / second) that you’ve earned from scripts since you last installed Augmentations.\n *\n * @remarks\n *\n * RAM cost: 0.1 GB\n *\n * @param script - Filename of script.\n *\n * @param host - Server on which script is running.\n *\n * @param args - Arguments that the script is running with.\n *\n * @returns Amount of income the specified script generates while online.\n */\n", + "docComment": "/**\n * Get the income of a script.\n *\n * @remarks\n *\n * RAM cost: 0.1 GB\n *\n * Returns the amount of income the specified script generates while online (when the game is open, does not apply for offline income). Remember that a script is uniquely identified by both its name and its arguments. So for example if you ran a script with the arguments “foodnstuff” and “5” then in order to use this function to get that script’s income you must specify those same arguments in the same order in this function call.\n *\n * This function can also be called with no arguments. If called with no arguments, then this function will return an array of two values. The first value is the total income (dollar / second) of all of your active scripts (scripts that are currently running on any server). The second value is the total income (dollar / second) that you’ve earned from scripts since you last installed Augmentations.\n *\n * @param script - Filename of script.\n *\n * @param host - Server on which script is running.\n *\n * @param args - Arguments that the script is running with.\n *\n * @returns Amount of income the specified script generates while online.\n */\n", "excerptTokens": [ { "kind": "Content", @@ -10704,7 +10716,7 @@ { "kind": "MethodSignature", "canonicalReference": "bitburner!NS#getScriptLogs:member(1)", - "docComment": "/**\n * Returns a script’s logs. The logs are returned as an array, where each line is an element in the array. The most recently logged line is at the end of the array. Note that there is a maximum number of lines that a script stores in its logs. This is configurable in the game’s options. If the function is called with no arguments, it will return the current script’s logs.\n *\n * Otherwise, the fn, hostname/ip, and args… arguments can be used to get the logs from another script. Remember that scripts are uniquely identified by both their names and arguments.\n *\n * @remarks\n *\n * RAM cost: 0 GB\n *\n * @param fn - Optional. Filename of script to get logs from.\n *\n * @param host - Optional. Hostname of the server that the script is on.\n *\n * @param args - Arguments to identify which scripts to get logs for.\n *\n * @returns Returns an string array, where each line is an element in the array. The most recently logged line is at the end of the array.\n *\n * @example\n * ```ts\n * //Get logs from foo.script on the current server that was run with no args\n * getScriptLogs(\"foo.script\");\n * ```\n *\n * @example\n * ```ts\n * //Open logs from foo.script on the foodnstuff server that was run with no args\n * getScriptLogs(\"foo.script\", \"foodnstuff\");\n * ```\n *\n * @example\n * ```ts\n * //Open logs from foo.script on the foodnstuff server that was run with the arguments [1, \"test\"]\n * getScriptLogs(\"foo.script\", \"foodnstuff\", 1, \"test\");\n * ```\n *\n */\n", + "docComment": "/**\n * Get all the logs of a script.\n *\n * @remarks\n *\n * RAM cost: 0 GB\n *\n * Returns a script’s logs. The logs are returned as an array, where each line is an element in the array. The most recently logged line is at the end of the array. Note that there is a maximum number of lines that a script stores in its logs. This is configurable in the game’s options. If the function is called with no arguments, it will return the current script’s logs.\n *\n * Otherwise, the fn, hostname/ip, and args… arguments can be used to get the logs from another script. Remember that scripts are uniquely identified by both their names and arguments.\n *\n * @param fn - Optional. Filename of script to get logs from.\n *\n * @param host - Optional. Hostname of the server that the script is on.\n *\n * @param args - Arguments to identify which scripts to get logs for.\n *\n * @returns Returns an string array, where each line is an element in the array. The most recently logged line is at the end of the array.\n *\n * @example\n * ```ts\n * //Get logs from foo.script on the current server that was run with no args\n * getScriptLogs(\"foo.script\");\n * ```\n *\n * @example\n * ```ts\n * //Open logs from foo.script on the foodnstuff server that was run with no args\n * getScriptLogs(\"foo.script\", \"foodnstuff\");\n * ```\n *\n * @example\n * ```ts\n * //Open logs from foo.script on the foodnstuff server that was run with the arguments [1, \"test\"]\n * getScriptLogs(\"foo.script\", \"foodnstuff\", 1, \"test\");\n * ```\n *\n */\n", "excerptTokens": [ { "kind": "Content", @@ -10806,7 +10818,7 @@ { "kind": "MethodSignature", "canonicalReference": "bitburner!NS#getScriptRam:member(1)", - "docComment": "/**\n * Returns the amount of RAM required to run the specified script on the target server. Returns 0 if the script does not exist.\n *\n * @remarks\n *\n * RAM cost: 0.1 GB\n *\n * @param script - Filename of script. This is case-sensitive.\n *\n * @param host - Host of target server the script is located on. This is optional, If it is not specified then the function will se the current server as the target server.\n *\n * @returns Amount of RAM required to run the specified script on the target server, and 0 if the script does not exist.\n */\n", + "docComment": "/**\n * Get the ram cost of a script.\n *\n * @remarks\n *\n * RAM cost: 0.1 GB\n *\n * Returns the amount of RAM required to run the specified script on the target server. Returns 0 if the script does not exist.\n *\n * @param script - Filename of script. This is case-sensitive.\n *\n * @param host - Host of target server the script is located on. This is optional, If it is not specified then the function will se the current server as the target server.\n *\n * @returns Amount of RAM required to run the specified script on the target server, and 0 if the script does not exist.\n */\n", "excerptTokens": [ { "kind": "Content", @@ -10907,54 +10919,10 @@ ], "name": "getServer" }, - { - "kind": "MethodSignature", - "canonicalReference": "bitburner!NS#getServerBaseSecurityLevel:member(1)", - "docComment": "/**\n * Returns the base security level of the target server. This is the security level that the server starts out with. This is different than getServerSecurityLevel because getServerSecurityLevel returns the current security level of a server, which can constantly change due to hack, grow, and weaken, calls on that server. The base security level will stay the same until you reset by installing an Augmentation(s).\n *\n * @remarks\n *\n * RAM cost: 0.1 GB\n *\n * @param host - Host of target server.\n *\n * @returns Base security level of the target server.\n */\n", - "excerptTokens": [ - { - "kind": "Content", - "text": "getServerBaseSecurityLevel(host: " - }, - { - "kind": "Content", - "text": "string" - }, - { - "kind": "Content", - "text": "): " - }, - { - "kind": "Content", - "text": "number" - }, - { - "kind": "Content", - "text": ";" - } - ], - "isOptional": false, - "returnTypeTokenRange": { - "startIndex": 3, - "endIndex": 4 - }, - "releaseTag": "Public", - "overloadIndex": 1, - "parameters": [ - { - "parameterName": "host", - "parameterTypeTokenRange": { - "startIndex": 1, - "endIndex": 2 - } - } - ], - "name": "getServerBaseSecurityLevel" - }, { "kind": "MethodSignature", "canonicalReference": "bitburner!NS#getServerGrowth:member(1)", - "docComment": "/**\n * Returns the server’s instrinsic “growth parameter”. This growth parameter is a number between 1 and 100 that represents how quickly the server’s money grows. This parameter affects the percentage by which the server’s money is increased when using the grow function. A higher growth parameter will result in a higher percentage increase from grow.\n *\n * @remarks\n *\n * RAM cost: 0.1 GB\n *\n * @param host - Host of target server.\n *\n * @returns Parameter that affects the percentage by which the server’s money is increased when using the grow function.\n */\n", + "docComment": "/**\n * Get a server growth parameter.\n *\n * @remarks\n *\n * RAM cost: 0.1 GB\n *\n * Returns the server’s instrinsic “growth parameter”. This growth parameter is a number between 1 and 100 that represents how quickly the server’s money grows. This parameter affects the percentage by which the server’s money is increased when using the grow function. A higher growth parameter will result in a higher percentage increase from grow.\n *\n * @param host - Host of target server.\n *\n * @returns Parameter that affects the percentage by which the server’s money is increased when using the grow function.\n */\n", "excerptTokens": [ { "kind": "Content", @@ -10998,7 +10966,7 @@ { "kind": "MethodSignature", "canonicalReference": "bitburner!NS#getServerMaxMoney:member(1)", - "docComment": "/**\n * Returns the maximum amount of money that can be available on a server.\n *\n * @remarks\n *\n * RAM cost: 0.1 GB\n *\n * @param host - Host of target server.\n *\n * @returns Maximum amount of money available on the server.\n */\n", + "docComment": "/**\n * Get maximum money available on a server.\n *\n * @remarks\n *\n * RAM cost: 0.1 GB\n *\n * Returns the maximum amount of money that can be available on a server.\n *\n * @param host - Host of target server.\n *\n * @returns Maximum amount of money available on the server.\n */\n", "excerptTokens": [ { "kind": "Content", @@ -11086,7 +11054,7 @@ { "kind": "MethodSignature", "canonicalReference": "bitburner!NS#getServerMoneyAvailable:member(1)", - "docComment": "/**\n * Returns the amount of money available on a server. Running this function on the home computer will return the player’s money.\n *\n * @remarks\n *\n * RAM cost: 0.1 GB\n *\n * @param host - Host of target server\n *\n * @returns Amount of money available on the server.\n *\n * @example\n * ```ts\n * getServerMoneyAvailable(\"foodnstuff\");\n * getServerMoneyAvailable(\"home\"); //Returns player's money\n * ```\n *\n */\n", + "docComment": "/**\n * Get money available on a server.\n *\n * @remarks\n *\n * RAM cost: 0.1 GB\n *\n * Returns the amount of money available on a server. Running this function on the home computer will return the player’s money.\n *\n * @param host - Host of target server\n *\n * @returns Amount of money available on the server.\n *\n * @example\n * ```ts\n * getServerMoneyAvailable(\"foodnstuff\");\n * getServerMoneyAvailable(\"home\"); //Returns player's money\n * ```\n *\n */\n", "excerptTokens": [ { "kind": "Content", @@ -11171,50 +11139,6 @@ ], "name": "getServerNumPortsRequired" }, - { - "kind": "MethodSignature", - "canonicalReference": "bitburner!NS#getServerRam:member(1)", - "docComment": "/**\n * Returns an array with two elements that gives information about a server’s memory (RAM). The first element in the array is the amount of RAM that the server has total (in GB). The second element in the array is the amount of RAM that is currently being used on the server (in GB).\n *\n * @remarks\n *\n * RAM cost: 0.1 GB\n *\n * @param host - Host of target server.\n *\n * @returns Array with total and used memory on the specified server.\n *\n * @example\n * ```ts\n * res = getServerRam(\"helios\");\n * totalRam = res[0];\n * ramUsed = res[1];\n * ```\n *\n */\n", - "excerptTokens": [ - { - "kind": "Content", - "text": "getServerRam(host: " - }, - { - "kind": "Content", - "text": "string" - }, - { - "kind": "Content", - "text": "): " - }, - { - "kind": "Content", - "text": "[number, number]" - }, - { - "kind": "Content", - "text": ";" - } - ], - "isOptional": false, - "returnTypeTokenRange": { - "startIndex": 3, - "endIndex": 4 - }, - "releaseTag": "Public", - "overloadIndex": 1, - "parameters": [ - { - "parameterName": "host", - "parameterTypeTokenRange": { - "startIndex": 1, - "endIndex": 2 - } - } - ], - "name": "getServerRam" - }, { "kind": "MethodSignature", "canonicalReference": "bitburner!NS#getServerRequiredHackingLevel:member(1)", @@ -11262,7 +11186,7 @@ { "kind": "MethodSignature", "canonicalReference": "bitburner!NS#getServerSecurityLevel:member(1)", - "docComment": "/**\n * Returns the security level of the target server. A server’s security level is denoted by a number, typically between 1 and 100 (but it can go above 100).\n *\n * @remarks\n *\n * RAM cost: 0.1 GB\n *\n * @param host - Host of target server.\n *\n * @returns Security level of the target server.\n */\n", + "docComment": "/**\n * Get server security level.\n *\n * @remarks\n *\n * RAM cost: 0.1 GB\n *\n * Returns the security level of the target server. A server’s security level is denoted by a number, typically between 1 and 100 (but it can go above 100).\n *\n * @param host - Host of target server.\n *\n * @returns Security level of the target server.\n */\n", "excerptTokens": [ { "kind": "Content", @@ -11334,7 +11258,7 @@ { "kind": "MethodSignature", "canonicalReference": "bitburner!NS#getWeakenTime:member(1)", - "docComment": "/**\n * Returns the amount of time in seconds it takes to execute the weaken() Netscript function on the target server. The function takes in an optional hackLvl parameter that can be specified to see what the weaken time would be at different hacking levels.\n *\n * @remarks\n *\n * RAM cost: 0.05 GB\n *\n * @param host - Host of target server.\n *\n * @param hackLvl - Optional hacking level for the calculation. Defaults to player’s current hacking level.\n *\n * @param intLvl - Optional intelligence level for the calculation. Defaults to player’s current intelligence level. (Intelligence is unlocked after obtaining Source-File 5).\n *\n * @returns Returns the amount of time in seconds it takes to execute the grow Netscript function. Returns Infinity if called on a Hacknet Server.\n */\n", + "docComment": "/**\n * Get the execution time of a weaken() call.\n *\n * @remarks\n *\n * RAM cost: 0.05 GB\n *\n * Returns the amount of time in seconds it takes to execute the weaken() Netscript function on the target server. The function takes in an optional hackLvl parameter that can be specified to see what the weaken time would be at different hacking levels.\n *\n * @param host - Host of target server.\n *\n * @param hackLvl - Optional hacking level for the calculation. Defaults to player’s current hacking level.\n *\n * @param intLvl - Optional intelligence level for the calculation. Defaults to player’s current intelligence level. (Intelligence is unlocked after obtaining Source-File 5).\n *\n * @returns Returns the amount of time in seconds it takes to execute the grow Netscript function. Returns Infinity if called on a Hacknet Server.\n */\n", "excerptTokens": [ { "kind": "Content", @@ -11344,22 +11268,6 @@ "kind": "Content", "text": "string" }, - { - "kind": "Content", - "text": ", hackLvl?: " - }, - { - "kind": "Content", - "text": "number" - }, - { - "kind": "Content", - "text": ", intLvl?: " - }, - { - "kind": "Content", - "text": "number" - }, { "kind": "Content", "text": "): " @@ -11375,8 +11283,8 @@ ], "isOptional": false, "returnTypeTokenRange": { - "startIndex": 7, - "endIndex": 8 + "startIndex": 3, + "endIndex": 4 }, "releaseTag": "Public", "overloadIndex": 1, @@ -11387,20 +11295,6 @@ "startIndex": 1, "endIndex": 2 } - }, - { - "parameterName": "hackLvl", - "parameterTypeTokenRange": { - "startIndex": 3, - "endIndex": 4 - } - }, - { - "parameterName": "intLvl", - "parameterTypeTokenRange": { - "startIndex": 5, - "endIndex": 6 - } } ], "name": "getWeakenTime" @@ -11408,7 +11302,7 @@ { "kind": "MethodSignature", "canonicalReference": "bitburner!NS#grow:member(1)", - "docComment": "/**\n * Spoof money in a servers bank account, increasing the amount available.\n *\n * @remarks\n *\n * RAM cost: 0.15 GB Use your hacking skills to increase the amount of money available on a server. The runtime for this command depends on your hacking level and the target server’s security level. When `grow` completes, the money available on a target server will be increased by a certain, fixed percentage. This percentage is determined by the target server’s growth rate (which varies between servers) and security level. Generally, higher-level servers have higher growth rates. The getServerGrowth() function can be used to obtain a server’s growth rate.\n *\n * Like hack, `grow` can be called on any server, regardless of where the script is running. The grow() command requires root access to the target server, but there is no required hacking level to run the command. It also raises the security level of the target server by 0.004.\n *\n * @param host - Hostname of the target server to grow.\n *\n * @param opts - Optional parameters for configuring function behavior.\n *\n * @returns The number by which the money on the server was multiplied for the growth.\n *\n * @example\n * ```ts\n * grow(\"foodnstuff\");\n * grow(\"foodnstuff\", { threads: 5 }); // Only use 5 threads to grow\n * ```\n *\n */\n", + "docComment": "/**\n * Spoof money in a servers bank account, increasing the amount available.\n *\n * @remarks\n *\n * RAM cost: 0.15 GB\n *\n * Use your hacking skills to increase the amount of money available on a server. The runtime for this command depends on your hacking level and the target server’s security level. When `grow` completes, the money available on a target server will be increased by a certain, fixed percentage. This percentage is determined by the target server’s growth rate (which varies between servers) and security level. Generally, higher-level servers have higher growth rates. The getServerGrowth() function can be used to obtain a server’s growth rate.\n *\n * Like hack, `grow` can be called on any server, regardless of where the script is running. The grow() command requires root access to the target server, but there is no required hacking level to run the command. It also raises the security level of the target server by 0.004.\n *\n * @param host - Hostname of the target server to grow.\n *\n * @param opts - Optional parameters for configuring function behavior.\n *\n * @returns The number by which the money on the server was multiplied for the growth.\n *\n * @example\n * ```ts\n * grow(\"foodnstuff\");\n * grow(\"foodnstuff\", { threads: 5 }); // Only use 5 threads to grow\n * ```\n *\n */\n", "excerptTokens": [ { "kind": "Content", @@ -11473,7 +11367,7 @@ { "kind": "MethodSignature", "canonicalReference": "bitburner!NS#growthAnalyze:member(1)", - "docComment": "/**\n * This function returns the number of “growths” needed in order to increase the amount of money available on the specified server by the specified amount. The specified amount is multiplicative and is in decimal form, not percentage.\n *\n * Warning: The value returned by this function isn’t necessarily a whole number.\n *\n * @remarks\n *\n * RAM cost: 1 GB\n *\n * @param host - Hostname of the target server.\n *\n * @param growthAmount - Multiplicative factor by which the server is grown. Decimal form..\n *\n * @returns The amount of grow calls needed to grow the specified server by the specified amount\n *\n * @example\n * ```ts\n * //For example, if you want to determine how many grow calls you need to double the amount of money on foodnstuff, you would use:\n * growthAnalyze(\"foodnstuff\", 2);\n * //If this returns 100, then this means you need to call grow 100 times in order to double the money (or once with 100 threads).\n * ```\n *\n */\n", + "docComment": "/**\n * Calculate the number of grow thread needed to grow a server by a certain multiplier.\n *\n * @remarks\n *\n * RAM cost: 1 GB\n *\n * This function returns the number of “growths” needed in order to increase the amount of money available on the specified server by the specified amount. The specified amount is multiplicative and is in decimal form, not percentage.\n *\n * Warning: The value returned by this function isn’t necessarily a whole number.\n *\n * @param host - Hostname of the target server.\n *\n * @param growthAmount - Multiplicative factor by which the server is grown. Decimal form..\n *\n * @returns The amount of grow calls needed to grow the specified server by the specified amount\n *\n * @example\n * ```ts\n * //For example, if you want to determine how many grow calls you need to double the amount of money on foodnstuff, you would use:\n * growthAnalyze(\"foodnstuff\", 2);\n * //If this returns 100, then this means you need to call grow 100 times in order to double the money (or once with 100 threads).\n * ```\n *\n */\n", "excerptTokens": [ { "kind": "Content", @@ -11532,7 +11426,7 @@ { "kind": "MethodSignature", "canonicalReference": "bitburner!NS#growthAnalyzeSecurity:member(1)", - "docComment": "/**\n * Returns the security increase that would occur if a grow with this many threads happened.\n *\n * @remarks\n *\n * RAM cost: 1 GB\n *\n * @param threads - Amount of threads that will be used.\n *\n * @returns The security increase.\n */\n", + "docComment": "/**\n * Calculate the security increase for a number of thread.\n *\n * @remarks\n *\n * RAM cost: 1 GB\n *\n * Returns the security increase that would occur if a grow with this many threads happened.\n *\n * @param threads - Amount of threads that will be used.\n *\n * @returns The security increase.\n */\n", "excerptTokens": [ { "kind": "Content", @@ -11576,7 +11470,7 @@ { "kind": "MethodSignature", "canonicalReference": "bitburner!NS#hack:member(1)", - "docComment": "/**\n * Steal a servers money.\n *\n * @remarks\n *\n * RAM cost: 0.1 GB Function that is used to try and hack servers to steal money and gain hacking experience. The runtime for this command depends on your hacking level and the target server’s security level. In order to hack a server you must first gain root access to that server and also have the required hacking level.\n *\n * A script can hack a server from anywhere. It does not need to be running on the same server to hack that server. For example, you can create a script that hacks the `foodnstuff` server and run that script on any server in the game.\n *\n * A successful `hack()` on a server will raise that server’s security level by 0.002.\n *\n * @param host - Hostname of the target server to hack.\n *\n * @param opts - Optional parameters for configuring function behavior.\n *\n * @returns The amount of money stolen if the hack is successful, and zero otherwise.\n *\n * @example\n * ```ts\n * hack(\"foodnstuff\");\n * hack(\"foodnstuff\", { threads: 5 }); // Only use 5 threads to hack\n * ```\n *\n */\n", + "docComment": "/**\n * Steal a servers money.\n *\n * @remarks\n *\n * RAM cost: 0.1 GB\n *\n * Function that is used to try and hack servers to steal money and gain hacking experience. The runtime for this command depends on your hacking level and the target server’s security level. In order to hack a server you must first gain root access to that server and also have the required hacking level.\n *\n * A script can hack a server from anywhere. It does not need to be running on the same server to hack that server. For example, you can create a script that hacks the `foodnstuff` server and run that script on any server in the game.\n *\n * A successful `hack()` on a server will raise that server’s security level by 0.002.\n *\n * @param host - Hostname of the target server to hack.\n *\n * @param opts - Optional parameters for configuring function behavior.\n *\n * @returns The amount of money stolen if the hack is successful, and zero otherwise.\n *\n * @example\n * ```ts\n * hack(\"foodnstuff\");\n * hack(\"foodnstuff\", { threads: 5 }); // Only use 5 threads to hack\n * ```\n *\n */\n", "excerptTokens": [ { "kind": "Content", @@ -11641,7 +11535,7 @@ { "kind": "MethodSignature", "canonicalReference": "bitburner!NS#hackAnalyzePercent:member(1)", - "docComment": "/**\n * Returns the percentage of the specified server’s money you will steal with a single hack. This value is returned in percentage form, not decimal (Netscript functions typically return in decimal form, but not this one).\n *\n * @remarks\n *\n * RAM cost: 1 GB\n *\n * @param host - Hostname of the target server.\n *\n * @returns The percentage of money you will steal from the target server with a single hack.\n *\n * @example\n * ```ts\n * //For example, assume the following returns 1:\n * hackAnalyzePercent(\"foodnstuff\");\n * //This means that if hack the foodnstuff server, then you will steal 1% of its total money. If you hack using N threads, then you will steal N% of its total money.\n * ```\n *\n */\n", + "docComment": "/**\n * Get the percent of money stolen with a single thread.\n *\n * @remarks\n *\n * RAM cost: 1 GB\n *\n * Returns the percentage of the specified server’s money you will steal with a single hack. This value is returned in percentage form, not decimal (Netscript functions typically return in decimal form, but not this one).\n *\n * @param host - Hostname of the target server.\n *\n * @returns The percentage of money you will steal from the target server with a single hack.\n *\n * @example\n * ```ts\n * //For example, assume the following returns 1:\n * hackAnalyzePercent(\"foodnstuff\");\n * //This means that if hack the foodnstuff server, then you will steal 1% of its total money. If you hack using N threads, then you will steal N% of its total money.\n * ```\n *\n */\n", "excerptTokens": [ { "kind": "Content", @@ -11685,7 +11579,7 @@ { "kind": "MethodSignature", "canonicalReference": "bitburner!NS#hackAnalyzeSecurity:member(1)", - "docComment": "/**\n * Returns the security increase that would occur if a hack with this many threads happened.\n *\n * @remarks\n *\n * RAM cost: 1 GB\n *\n * @param threads - Amount of threads that will be used.\n *\n * @returns The security increase.\n */\n", + "docComment": "/**\n * Get the security increase for a number of thread.\n *\n * @remarks\n *\n * RAM cost: 1 GB\n *\n * Returns the security increase that would occur if a hack with this many threads happened.\n *\n * @param threads - Amount of threads that will be used.\n *\n * @returns The security increase.\n */\n", "excerptTokens": [ { "kind": "Content", @@ -11729,7 +11623,7 @@ { "kind": "MethodSignature", "canonicalReference": "bitburner!NS#hackAnalyzeThreads:member(1)", - "docComment": "/**\n * Predict the effect of hack.\n *\n * @remarks\n *\n * RAM cost: 1 GB This function returns the number of script threads you need when running the hack command to steal the specified amount of money from the target server. If hackAmount is less than zero or greater than the amount of money available on the server, then this function returns -1.\n *\n * Warning: The value returned by this function isn’t necessarily a whole number.\n *\n * @param host - Hostname of the target server to analyze.\n *\n * @param hackAmount - Amount of money you want to hack from the server.\n *\n * @returns The number of threads needed to hack the server for hackAmount money.\n *\n * @example\n * ```ts\n * //For example, let’s say the foodnstuff server has $10m and you run:\n * hackAnalyzeThreads(\"foodnstuff\", 1e6);\n * //If this function returns 50, this means that if your next hack call is run on a script with 50 threads, it will steal $1m from the foodnstuff server.\n * ```\n *\n */\n", + "docComment": "/**\n * Predict the effect of hack.\n *\n * @remarks\n *\n * RAM cost: 1 GB\n *\n * This function returns the number of script threads you need when running the hack command to steal the specified amount of money from the target server. If hackAmount is less than zero or greater than the amount of money available on the server, then this function returns -1.\n *\n * Warning: The value returned by this function isn’t necessarily a whole number.\n *\n * @param host - Hostname of the target server to analyze.\n *\n * @param hackAmount - Amount of money you want to hack from the server.\n *\n * @returns The number of threads needed to hack the server for hackAmount money.\n *\n * @example\n * ```ts\n * //For example, let’s say the foodnstuff server has $10m and you run:\n * hackAnalyzeThreads(\"foodnstuff\", 1e6);\n * //If this function returns 50, this means that if your next hack call is run on a script with 50 threads, it will steal $1m from the foodnstuff server.\n * ```\n *\n */\n", "excerptTokens": [ { "kind": "Content", @@ -11788,7 +11682,7 @@ { "kind": "MethodSignature", "canonicalReference": "bitburner!NS#hackChance:member(1)", - "docComment": "/**\n * Returns the chance you have of successfully hacking the specified server.\n *\n * This returned value is in decimal form, not percentage.\n *\n * @remarks\n *\n * RAM cost: 1 GB\n *\n * @param host - Hostname of the target server.\n *\n * @returns The chance you have of successfully hacking the target server.\n */\n", + "docComment": "/**\n * Get the chance of successfully hacking a server.\n *\n * @remarks\n *\n * RAM cost: 1 GB\n *\n * Returns the chance you have of successfully hacking the specified server.\n *\n * This returned value is in decimal form, not percentage.\n *\n * @param host - Hostname of the target server.\n *\n * @returns The chance you have of successfully hacking the target server.\n */\n", "excerptTokens": [ { "kind": "Content", @@ -11859,7 +11753,7 @@ { "kind": "MethodSignature", "canonicalReference": "bitburner!NS#hasRootAccess:member(1)", - "docComment": "/**\n * Returns a boolean indicating whether or not the player has root access to the specified target server.\n *\n * @remarks\n *\n * RAM cost: 0.05 GB\n *\n * @param host - Host of the target server\n *\n * @returns True if player has root access to the specified target server, and false otherwise.\n *\n * @example\n * ```ts\n * if (hasRootAccess(\"foodnstuff\") == false) {\n * nuke(\"foodnstuff\");\n * }\n * ```\n *\n */\n", + "docComment": "/**\n * Check if your have root access on a server.\n *\n * @remarks\n *\n * RAM cost: 0.05 GB\n *\n * Returns a boolean indicating whether or not the player has root access to the specified target server.\n *\n * @param host - Host of the target server\n *\n * @returns True if player has root access to the specified target server, and false otherwise.\n *\n * @example\n * ```ts\n * if (hasRootAccess(\"foodnstuff\") == false) {\n * nuke(\"foodnstuff\");\n * }\n * ```\n *\n */\n", "excerptTokens": [ { "kind": "Content", @@ -11903,7 +11797,7 @@ { "kind": "MethodSignature", "canonicalReference": "bitburner!NS#httpworm:member(1)", - "docComment": "/**\n * Runs the HTTPWorm.exe program on the target server. HTTPWorm.exe must exist on your home computer.\n *\n * @remarks\n *\n * RAM cost: 0.05 GB\n *\n * @param host - Hostname of the target server.\n *\n * @example\n * ```ts\n * httpworm(\"foodnstuff\");\n * ```\n *\n */\n", + "docComment": "/**\n * Runs HTTPWorm.exe on a server.\n *\n * @remarks\n *\n * RAM cost: 0.05 GB\n *\n * Runs the HTTPWorm.exe program on the target server. HTTPWorm.exe must exist on your home computer.\n *\n * @param host - Hostname of the target server.\n *\n * @example\n * ```ts\n * httpworm(\"foodnstuff\");\n * ```\n *\n */\n", "excerptTokens": [ { "kind": "Content", @@ -11991,7 +11885,7 @@ { "kind": "MethodSignature", "canonicalReference": "bitburner!NS#isRunning:member(1)", - "docComment": "/**\n * Returns a boolean indicating whether the specified script is running on the target server. Remember that a script is uniquely identified by both its name and its arguments.\n *\n * @remarks\n *\n * RAM cost: 0.1 GB\n *\n * @param script - Filename of script to check. This is case-sensitive.\n *\n * @param host - Host of target server.\n *\n * @param args - Arguments to specify/identify which scripts to search for.\n *\n * @returns True if specified script is running on the target server, and false otherwise.\n *\n * @example\n * ```ts\n * //The function call will return true if there is a script named foo.script with no arguments running on the foodnstuff server, and false otherwise:\n * isRunning(\"foo.script\", \"foodnstuff\");\n * ```\n *\n * @example\n * ```ts\n * //The function call will return true if there is a script named foo.script with no arguments running on the current server, and false otherwise:\n * isRunning(\"foo.script\", getHostname());\n * ```\n *\n * @example\n * ```ts\n * //The function call will return true if there is a script named foo.script running with the arguments 1, 5, and “test” (in that order) on the joesguns server, and false otherwise:\n * isRunning(\"foo.script\", \"joesguns\", 1, 5, \"test\");\n * ```\n *\n */\n", + "docComment": "/**\n * Check if a script is running.\n *\n * @remarks\n *\n * RAM cost: 0.1 GB\n *\n * Returns a boolean indicating whether the specified script is running on the target server. Remember that a script is uniquely identified by both its name and its arguments.\n *\n * @param script - Filename of script to check. This is case-sensitive.\n *\n * @param host - Host of target server.\n *\n * @param args - Arguments to specify/identify which scripts to search for.\n *\n * @returns True if specified script is running on the target server, and false otherwise.\n *\n * @example\n * ```ts\n * //The function call will return true if there is a script named foo.script with no arguments running on the foodnstuff server, and false otherwise:\n * isRunning(\"foo.script\", \"foodnstuff\");\n * ```\n *\n * @example\n * ```ts\n * //The function call will return true if there is a script named foo.script with no arguments running on the current server, and false otherwise:\n * isRunning(\"foo.script\", getHostname());\n * ```\n *\n * @example\n * ```ts\n * //The function call will return true if there is a script named foo.script running with the arguments 1, 5, and “test” (in that order) on the joesguns server, and false otherwise:\n * isRunning(\"foo.script\", \"joesguns\", 1, 5, \"test\");\n * ```\n *\n */\n", "excerptTokens": [ { "kind": "Content", @@ -12065,7 +11959,7 @@ { "kind": "MethodSignature", "canonicalReference": "bitburner!NS#kill:member(1)", - "docComment": "/**\n * Kills the script on the target server specified by the script’s name and arguments. Remember that scripts are uniquely identified by both their name and arguments. For example, if `foo.script` is run with the argument 1, then this is not the same as `foo.script` run with the argument 2, even though they have the same code.\n *\n * @remarks\n *\n * RAM cost: 0.5 GB\n *\n * @param script - Filename of the script to kill\n *\n * @param host - Hostname of the server on which to kill the script.\n *\n * @param args - Arguments to identify which script to kill.\n *\n * @returns True if the script is successfully killed, and false otherwise.\n *\n * @example\n * ```ts\n * //The following example will try to kill a script named foo.script on the foodnstuff server that was ran with no arguments:\n * kill(\"foo.script\", \"foodnstuff\");\n * ```\n *\n * @example\n * ```ts\n * //The following will try to kill a script named foo.script on the current server that was ran with no arguments:\n * kill(\"foo.script\", getHostname());\n * ```\n *\n * @example\n * ```ts\n * //The following will try to kill a script named foo.script on the current server that was ran with the arguments 1 and “foodnstuff”:\n * kill(\"foo.script\", getHostname(), 1, \"foodnstuff\");\n * ```\n *\n */\n", + "docComment": "/**\n * Terminate another script.\n *\n * @remarks\n *\n * RAM cost: 0.5 GB\n *\n * Kills the script on the target server specified by the script’s name and arguments. Remember that scripts are uniquely identified by both their name and arguments. For example, if `foo.script` is run with the argument 1, then this is not the same as `foo.script` run with the argument 2, even though they have the same code.\n *\n * @param script - Filename of the script to kill\n *\n * @param host - Hostname of the server on which to kill the script.\n *\n * @param args - Arguments to identify which script to kill.\n *\n * @returns True if the script is successfully killed, and false otherwise.\n *\n * @example\n * ```ts\n * //The following example will try to kill a script named foo.script on the foodnstuff server that was ran with no arguments:\n * kill(\"foo.script\", \"foodnstuff\");\n * ```\n *\n * @example\n * ```ts\n * //The following will try to kill a script named foo.script on the current server that was ran with no arguments:\n * kill(\"foo.script\", getHostname());\n * ```\n *\n * @example\n * ```ts\n * //The following will try to kill a script named foo.script on the current server that was ran with the arguments 1 and “foodnstuff”:\n * kill(\"foo.script\", getHostname(), 1, \"foodnstuff\");\n * ```\n *\n */\n", "excerptTokens": [ { "kind": "Content", @@ -12139,7 +12033,7 @@ { "kind": "MethodSignature", "canonicalReference": "bitburner!NS#kill:member(2)", - "docComment": "/**\n * Kills the script with the specified PID. Killing a script by its PID will typically have better performance, especially if you have many scripts running. If this function successfully kills the specified script, then it will return true. Otherwise, it will return false.\n *\n * @remarks\n *\n * RAM cost: 0.5 GB\n *\n * @param scriptPid - PID of the script to kill\n *\n * @returns True if the script is successfully killed, and false otherwise.\n *\n * @example\n * ```ts\n * if (kill(10)) {\n * print(\"Killed script with PID 10!\");\n * }\n * ```\n *\n */\n", + "docComment": "/**\n * Terminate another script.\n *\n * @remarks\n *\n * RAM cost: 0.5 GB\n *\n * Kills the script with the specified PID. Killing a script by its PID will typically have better performance, especially if you have many scripts running. If this function successfully kills the specified script, then it will return true. Otherwise, it will return false.\n *\n * @param scriptPid - PID of the script to kill\n *\n * @returns True if the script is successfully killed, and false otherwise.\n *\n * @example\n * ```ts\n * if (kill(10)) {\n * print(\"Killed script with PID 10!\");\n * }\n * ```\n *\n */\n", "excerptTokens": [ { "kind": "Content", @@ -12183,7 +12077,7 @@ { "kind": "MethodSignature", "canonicalReference": "bitburner!NS#killall:member(1)", - "docComment": "/**\n * Kills all running scripts on the specified server. This function returns true if any scripts were killed, and false otherwise. In other words, it will return true if there are any scripts running on the target server.\n *\n * @remarks\n *\n * RAM cost: 0.5 GB\n *\n * @param host - IP or hostname of the server on which to kill all scripts.\n *\n * @returns True if any scripts were killed, and false otherwise.\n */\n", + "docComment": "/**\n * Terminate all scripts on a server.\n *\n * @remarks\n *\n * RAM cost: 0.5 GB\n *\n * Kills all running scripts on the specified server. This function returns true if any scripts were killed, and false otherwise. In other words, it will return true if there are any scripts running on the target server.\n *\n * @param host - IP or hostname of the server on which to kill all scripts.\n *\n * @returns True if any scripts were killed, and false otherwise.\n */\n", "excerptTokens": [ { "kind": "Content", @@ -12227,7 +12121,7 @@ { "kind": "MethodSignature", "canonicalReference": "bitburner!NS#ls:member(1)", - "docComment": "/**\n * Returns an array with the filenames of all files on the specified server (as strings). The returned array is sorted in alphabetic order.\n *\n * @remarks\n *\n * RAM cost: 0.2 GB\n *\n * @param host - Host of the target server.\n *\n * @param grep - A substring to search for in the filename.\n *\n * @returns Array with the filenames of all files on the specified server.\n */\n", + "docComment": "/**\n * List files on a server.\n *\n * @remarks\n *\n * RAM cost: 0.2 GB\n *\n * Returns an array with the filenames of all files on the specified server (as strings). The returned array is sorted in alphabetic order.\n *\n * @param host - Host of the target server.\n *\n * @param grep - A substring to search for in the filename.\n *\n * @returns Array with the filenames of all files on the specified server.\n */\n", "excerptTokens": [ { "kind": "Content", @@ -12286,7 +12180,7 @@ { "kind": "MethodSignature", "canonicalReference": "bitburner!NS#nFormat:member(1)", - "docComment": "/**\n * Converts a number into a string with the specified formatter. This uses the numeraljs library, so the formatters must be compatible with that. This is the same function that the game itself uses to display numbers.\n *\n * @remarks\n *\n * RAM cost: 0 GB\n *\n * @param n - Number to format.\n *\n * @param format - Formatter.\n *\n * @returns Formated number.\n *\n * @see\n *\n * http://numeraljs.com/\n */\n", + "docComment": "/**\n * Format a number\n *\n * @remarks\n *\n * RAM cost: 0 GB\n *\n * Converts a number into a string with the specified formatter. This uses the numeraljs library, so the formatters must be compatible with that. This is the same function that the game itself uses to display numbers.\n *\n * see: http://numeraljs.com/\n *\n * @param n - Number to format.\n *\n * @param format - Formatter.\n *\n * @returns Formated number.\n */\n", "excerptTokens": [ { "kind": "Content", @@ -12345,7 +12239,7 @@ { "kind": "MethodSignature", "canonicalReference": "bitburner!NS#nuke:member(1)", - "docComment": "/**\n * Runs the NUKE.exe program on the target server. NUKE.exe must exist on your home computer.\n *\n * @remarks\n *\n * RAM cost: 0.05 GB\n *\n * @param host - Hostname of the target server.\n *\n * @example\n * ```ts\n * nuke(\"foodnstuff\");\n * ```\n *\n */\n", + "docComment": "/**\n * Runs NUKE.exe on a server.\n *\n * @remarks\n *\n * RAM cost: 0.05 GB\n *\n * Runs the NUKE.exe program on the target server. NUKE.exe must exist on your home computer.\n *\n * @param host - Hostname of the target server.\n *\n * @example\n * ```ts\n * nuke(\"foodnstuff\");\n * ```\n *\n */\n", "excerptTokens": [ { "kind": "Content", @@ -12389,7 +12283,7 @@ { "kind": "MethodSignature", "canonicalReference": "bitburner!NS#peek:member(1)", - "docComment": "/**\n * This function is used to peek at the data from a port. It returns the first element in the specified port without removing that element. If the port is empty, the string “NULL PORT DATA” will be returned.\n *\n * @remarks\n *\n * RAM cost: 1 GB\n *\n * @param port - Port to peek. Must be an integer between 1 and 20.\n *\n * @returns Data in the specified port.\n */\n", + "docComment": "/**\n * Get a copy of the data from a port without popping it.\n *\n * @remarks\n *\n * RAM cost: 1 GB\n *\n * This function is used to peek at the data from a port. It returns the first element in the specified port without removing that element. If the port is empty, the string “NULL PORT DATA” will be returned.\n *\n * @param port - Port to peek. Must be an integer between 1 and 20.\n *\n * @returns Data in the specified port.\n */\n", "excerptTokens": [ { "kind": "Content", @@ -12477,7 +12371,7 @@ { "kind": "MethodSignature", "canonicalReference": "bitburner!NS#prompt:member(1)", - "docComment": "/**\n * Prompts the player with a dialog box with two options: “Yes” and “No”. This function will return true if the player click “Yes” and false if the player clicks “No”. The script’s execution is halted until the player selects one of the options.\n *\n * @remarks\n *\n * RAM cost: 0 GB\n *\n * @param txt - Text to appear in the prompt dialog box.\n *\n * @returns True if the player click “Yes” and false if the player clicks “No”.\n */\n", + "docComment": "/**\n * Prompt the player with a Yes/No modal.\n *\n * @remarks\n *\n * RAM cost: 0 GB\n *\n * Prompts the player with a dialog box with two options: “Yes” and “No”. This function will return true if the player click “Yes” and false if the player clicks “No”. The script’s execution is halted until the player selects one of the options.\n *\n * @param txt - Text to appear in the prompt dialog box.\n *\n * @returns True if the player click “Yes” and false if the player clicks “No”.\n */\n", "excerptTokens": [ { "kind": "Content", @@ -12526,7 +12420,7 @@ { "kind": "MethodSignature", "canonicalReference": "bitburner!NS#ps:member(1)", - "docComment": "/**\n * Returns an array with general information about all scripts running on the specified target server.\n *\n * @remarks\n *\n * RAM cost: 0.2 GB\n *\n * @param host - Host address of the target server. If not specified, it will be the current server’s IP by default.\n *\n * @returns Array with general information about all scripts running on the specified target server.\n *\n * @example\n * ```ts\n * //(using NetscriptJS (Netscript 2.0))\n * export async function main(ns) {\n * const ps = ns.ps(\"home\");\n * for (let i = 0; i < ps.length; ++i) {\n * ns.tprint(ps[i].filename + ' ' + ps[i].threads);\n * ns.tprint(ps[i].args);\n * }\n * }\n * ```\n *\n */\n", + "docComment": "/**\n * List running scripts on a server.\n *\n * @remarks\n *\n * RAM cost: 0.2 GB\n *\n * Returns an array with general information about all scripts running on the specified target server.\n *\n * @param host - Host address of the target server. If not specified, it will be the current server’s IP by default.\n *\n * @returns Array with general information about all scripts running on the specified target server.\n *\n * @example\n * ```ts\n * //(using NetscriptJS (Netscript 2.0))\n * export async function main(ns) {\n * const ps = ns.ps(\"home\");\n * for (let i = 0; i < ps.length; ++i) {\n * ns.tprint(ps[i].filename + ' ' + ps[i].threads);\n * ns.tprint(ps[i].args);\n * }\n * }\n * ```\n *\n */\n", "excerptTokens": [ { "kind": "Content", @@ -12575,7 +12469,7 @@ { "kind": "MethodSignature", "canonicalReference": "bitburner!NS#purchaseServer:member(1)", - "docComment": "/**\n * Purchased a server with the specified hostname and amount of RAM.\n *\n * The hostname argument can be any data type, but it will be converted to a string and have whitespace removed. Anything that resolves to an empty string will cause the function to fail. If there is already a server with the specified hostname, then the function will automatically append a number at the end of the hostname argument value until it finds a unique hostname. For example, if the script calls `purchaseServer(“foo”, 4)` but a server named “foo” already exists, the it will automatically change the hostname to `foo-0`. If there is already a server with the hostname `foo-0`, then it will change the hostname to `foo-1`, and so on.\n *\n * Note that there is a maximum limit to the amount of servers you can purchase.\n *\n * Returns the hostname of the newly purchased server as a string. If the function fails to purchase a server, then it will return an empty string. The function will fail if the arguments passed in are invalid, if the player does not have enough money to purchase the specified server, or if the player has exceeded the maximum amount of servers.\n *\n * @remarks\n *\n * 2.25 GB\n *\n * @param hostname - Host of the purchased server.\n *\n * @param ram - Amount of RAM of the purchased server. Must be a power of 2 (2, 4, 8, 16, etc.). Maximum value of 1048576 (2^20).\n *\n * @returns The hostname of the newly purchased server.\n *\n * @example\n * ```ts\n * ram = 64;\n * hn = \"pserv-\";\n * for (i = 0; i < 5; ++i) {\n * purchaseServer(hn + i, ram);\n * }\n * ```\n *\n */\n", + "docComment": "/**\n * Purchase a server.\n *\n * @remarks\n *\n * 2.25 GB\n *\n * Purchased a server with the specified hostname and amount of RAM.\n *\n * The hostname argument can be any data type, but it will be converted to a string and have whitespace removed. Anything that resolves to an empty string will cause the function to fail. If there is already a server with the specified hostname, then the function will automatically append a number at the end of the hostname argument value until it finds a unique hostname. For example, if the script calls `purchaseServer(“foo”, 4)` but a server named “foo” already exists, the it will automatically change the hostname to `foo-0`. If there is already a server with the hostname `foo-0`, then it will change the hostname to `foo-1`, and so on.\n *\n * Note that there is a maximum limit to the amount of servers you can purchase.\n *\n * Returns the hostname of the newly purchased server as a string. If the function fails to purchase a server, then it will return an empty string. The function will fail if the arguments passed in are invalid, if the player does not have enough money to purchase the specified server, or if the player has exceeded the maximum amount of servers.\n *\n * @param hostname - Host of the purchased server.\n *\n * @param ram - Amount of RAM of the purchased server. Must be a power of 2 (2, 4, 8, 16, etc.). Maximum value of 1048576 (2^20).\n *\n * @returns The hostname of the newly purchased server.\n *\n * @example\n * ```ts\n * ram = 64;\n * hn = \"pserv-\";\n * for (i = 0; i < 5; ++i) {\n * purchaseServer(hn + i, ram);\n * }\n * ```\n *\n */\n", "excerptTokens": [ { "kind": "Content", @@ -12634,7 +12528,7 @@ { "kind": "MethodSignature", "canonicalReference": "bitburner!NS#read:member(1)", - "docComment": "/**\n * This function is used to read data from a port or from a text file (.txt).\n *\n * If the argument port/fn is a number between 1 and 20, then it specifies a port and it will read data from that port. A port is a serialized queue. This function will remove the first element from that queue and return it. If the queue is empty, then the string “NULL PORT DATA” will be returned.\n *\n * If the argument port/fn is a string, then it specifies the name of a text file (.txt) and this function will return the data in the specified text file. If the text file does not exist, an empty string will be returned.\n *\n * @remarks\n *\n * RAM cost: 1 GB\n *\n * @param handle - Port or text file to read from.\n *\n * @returns Data in the specified text file or port.\n */\n", + "docComment": "/**\n * Read content of a file.\n *\n * @remarks\n *\n * RAM cost: 1 GB\n *\n * This function is used to read data from a port or from a text file (.txt).\n *\n * If the argument port/fn is a number between 1 and 20, then it specifies a port and it will read data from that port. A port is a serialized queue. This function will remove the first element from that queue and return it. If the queue is empty, then the string “NULL PORT DATA” will be returned.\n *\n * If the argument port/fn is a string, then it specifies the name of a text file (.txt) and this function will return the data in the specified text file. If the text file does not exist, an empty string will be returned.\n *\n * @param handle - Port or text file to read from.\n *\n * @returns Data in the specified text file or port.\n */\n", "excerptTokens": [ { "kind": "Content", @@ -12678,7 +12572,7 @@ { "kind": "MethodSignature", "canonicalReference": "bitburner!NS#relaysmtp:member(1)", - "docComment": "/**\n * Runs the relaySMTP.exe program on the target server. relaySMTP.exe must exist on your home computer.\n *\n * @remarks\n *\n * RAM cost: 0.05 GB\n *\n * @param host - Hostname of the target server.\n *\n * @example\n * ```ts\n * relaysmtp(\"foodnstuff\");\n * ```\n *\n */\n", + "docComment": "/**\n * Runs relaySMTP.exe on a server.\n *\n * @remarks\n *\n * RAM cost: 0.05 GB\n *\n * Runs the relaySMTP.exe program on the target server. relaySMTP.exe must exist on your home computer.\n *\n * @param host - Hostname of the target server.\n *\n * @example\n * ```ts\n * relaysmtp(\"foodnstuff\");\n * ```\n *\n */\n", "excerptTokens": [ { "kind": "Content", @@ -12722,7 +12616,7 @@ { "kind": "MethodSignature", "canonicalReference": "bitburner!NS#rm:member(1)", - "docComment": "/**\n * Removes the specified file from the current server. This function works for every file type except message (.msg) files.\n *\n * @remarks\n *\n * RAM cost: 1 GB\n *\n * @param name - Filename of file to remove. Must include the extension.\n *\n * @param host - Host Address of the server on which to delete the file. Optional. Defaults to current server.\n *\n * @returns True if it successfully deletes the file, and false otherwise.\n */\n", + "docComment": "/**\n * Delete a file.\n *\n * @remarks\n *\n * RAM cost: 1 GB\n *\n * Removes the specified file from the current server. This function works for every file type except message (.msg) files.\n *\n * @param name - Filename of file to remove. Must include the extension.\n *\n * @param host - Host Address of the server on which to delete the file. Optional. Defaults to current server.\n *\n * @returns True if it successfully deletes the file, and false otherwise.\n */\n", "excerptTokens": [ { "kind": "Content", @@ -12781,7 +12675,7 @@ { "kind": "MethodSignature", "canonicalReference": "bitburner!NS#run:member(1)", - "docComment": "/**\n * Run a script as a separate process. This function can only be used to run scripts located on the current server (the server running the script that calls this function). Requires a significant amount of RAM to run this command.\n *\n * If the script was successfully started, then this functions returns the PID of that script. Otherwise, it returns 0.\n *\n * PID stands for Process ID. The PID is a unique identifier for each script. The PID will always be a positive integer.\n *\n * Running this function with a numThreads argument of 0 will return 0 without running the script. However, running this function with a negative numThreads argument will cause a runtime error.\n *\n * @remarks\n *\n * RAM cost: 1 GB\n *\n * @param script - Filename of script to run.\n *\n * @param numThreads - Optional thread count for new script. Set to 1 by default. Will be rounded to nearest integer.\n *\n * @param args - Additional arguments to pass into the new script that is being run. Note that if any arguments are being passed into the new script, then the second argument numThreads must be filled in with a value.\n *\n * @returns Returns the PID of a successfully started script, and 0 otherwise.\n *\n * @example\n * ```ts\n * //The simplest way to use the run command is to call it with just the script name. The following example will run ‘foo.script’ single-threaded with no arguments:\n * run(\"foo.script\");\n * ```\n *\n * @example\n * ```ts\n * //The following example will run ‘foo.script’ but with 5 threads instead of single-threaded:\n * run(\"foo.script\", 5);\n * ```\n *\n * @example\n * ```ts\n * //This next example will run ‘foo.script’ single-threaded, and will pass the string ‘foodnstuff’ into the script as an argument:\n * run(\"foo.script\", 1, 'foodnstuff');\n * ```\n *\n */\n", + "docComment": "/**\n * Start another script on the current server.\n *\n * @remarks\n *\n * RAM cost: 1 GB\n *\n * Run a script as a separate process. This function can only be used to run scripts located on the current server (the server running the script that calls this function). Requires a significant amount of RAM to run this command.\n *\n * If the script was successfully started, then this functions returns the PID of that script. Otherwise, it returns 0.\n *\n * PID stands for Process ID. The PID is a unique identifier for each script. The PID will always be a positive integer.\n *\n * Running this function with a numThreads argument of 0 will return 0 without running the script. However, running this function with a negative numThreads argument will cause a runtime error.\n *\n * @param script - Filename of script to run.\n *\n * @param numThreads - Optional thread count for new script. Set to 1 by default. Will be rounded to nearest integer.\n *\n * @param args - Additional arguments to pass into the new script that is being run. Note that if any arguments are being passed into the new script, then the second argument numThreads must be filled in with a value.\n *\n * @returns Returns the PID of a successfully started script, and 0 otherwise.\n *\n * @example\n * ```ts\n * //The simplest way to use the run command is to call it with just the script name. The following example will run ‘foo.script’ single-threaded with no arguments:\n * run(\"foo.script\");\n * ```\n *\n * @example\n * ```ts\n * //The following example will run ‘foo.script’ but with 5 threads instead of single-threaded:\n * run(\"foo.script\", 5);\n * ```\n *\n * @example\n * ```ts\n * //This next example will run ‘foo.script’ single-threaded, and will pass the string ‘foodnstuff’ into the script as an argument:\n * run(\"foo.script\", 1, 'foodnstuff');\n * ```\n *\n */\n", "excerptTokens": [ { "kind": "Content", @@ -12855,7 +12749,7 @@ { "kind": "MethodSignature", "canonicalReference": "bitburner!NS#scan:member(1)", - "docComment": "/**\n * Returns an array containing the hostnames or IPs of all servers that are one node way from the specified target server. The hostnames/IPs in the returned array are strings.\n *\n * @remarks\n *\n * RAM cost: 0.2 GB\n *\n * @param host - Hostname of the server to scan.\n *\n * @param hostnames - Optional boolean specifying whether the function should output hostnames (if true) or IP addresses (if false).\n *\n * @returns Returns an string of hostnames or IP.\n */\n", + "docComment": "/**\n * Get the list servers connected to a server.\n *\n * @remarks\n *\n * RAM cost: 0.2 GB\n *\n * Returns an array containing the hostnames or IPs of all servers that are one node way from the specified target server. The hostnames/IPs in the returned array are strings.\n *\n * @param host - Hostname of the server to scan.\n *\n * @param hostnames - Optional boolean specifying whether the function should output hostnames (if true) or IP addresses (if false).\n *\n * @returns Returns an string of hostnames or IP.\n */\n", "excerptTokens": [ { "kind": "Content", @@ -12914,7 +12808,7 @@ { "kind": "MethodSignature", "canonicalReference": "bitburner!NS#scp:member(1)", - "docComment": "/**\n * Copies a script or literature (.lit) file(s) to another server. The files argument can be either a string specifying a single file to copy, or an array of strings specifying multiple files to copy.\n *\n * @remarks\n *\n * RAM cost: 0.6 GB\n *\n * @param files - Filename or an array of filenames of script/literature files to copy.\n *\n * @param destination - Host of the destination server, which is the server to which the file will be copied.\n *\n * @returns True if the script/literature file is successfully copied over and false otherwise. If the files argument is an array then this function will return true if at least one of the files in the array is successfully copied.\n *\n * @example\n * ```ts\n * //Copies hack-template.script from the current server to foodnstuff:\n * scp(\"hack-template.script\", \"foodnstuff\");\n * ```\n *\n */\n", + "docComment": "/**\n * Copy file between servers.\n *\n * @remarks\n *\n * RAM cost: 0.6 GB\n *\n * Copies a script or literature (.lit) file(s) to another server. The files argument can be either a string specifying a single file to copy, or an array of strings specifying multiple files to copy.\n *\n * @param files - Filename or an array of filenames of script/literature files to copy.\n *\n * @param destination - Host of the destination server, which is the server to which the file will be copied.\n *\n * @returns True if the script/literature file is successfully copied over and false otherwise. If the files argument is an array then this function will return true if at least one of the files in the array is successfully copied.\n *\n * @example\n * ```ts\n * //Copies hack-template.script from the current server to foodnstuff:\n * scp(\"hack-template.script\", \"foodnstuff\");\n * ```\n *\n */\n", "excerptTokens": [ { "kind": "Content", @@ -12973,7 +12867,7 @@ { "kind": "MethodSignature", "canonicalReference": "bitburner!NS#scp:member(2)", - "docComment": "/**\n * Copies a script or literature (.lit) file(s) to another server. The files argument can be either a string specifying a single file to copy, or an array of strings specifying multiple files to copy.\n *\n * @remarks\n *\n * RAM cost: 0.6 GB\n *\n * @param files - Filename or an array of filenames of script/literature files to copy.\n *\n * @param source - Host of the source server, which is the server from which the file will be copied. This argument is optional and if it’s omitted the source will be the current server.\n *\n * @param destination - Host of the destination server, which is the server to which the file will be copied.\n *\n * @returns True if the script/literature file is successfully copied over and false otherwise. If the files argument is an array then this function will return true if at least one of the files in the array is successfully copied.\n *\n * @example\n * ```ts\n * //Copies foo.lit from the helios server to the home computer:\n * scp(\"foo.lit\", \"helios\", \"home\");\n * ```\n *\n * @example\n * ```ts\n * //Tries to copy three files from rothman-uni to home computer:\n * files = [\"foo1.lit\", \"foo2.script\", \"foo3.script\"];\n * scp(files, \"rothman-uni\", \"home\");\n * ```\n *\n */\n", + "docComment": "/**\n * Copy file between servers.\n *\n * @remarks\n *\n * RAM cost: 0.6 GB\n *\n * Copies a script or literature (.lit) file(s) to another server. The files argument can be either a string specifying a single file to copy, or an array of strings specifying multiple files to copy.\n *\n * @param files - Filename or an array of filenames of script/literature files to copy.\n *\n * @param source - Host of the source server, which is the server from which the file will be copied. This argument is optional and if it’s omitted the source will be the current server.\n *\n * @param destination - Host of the destination server, which is the server to which the file will be copied.\n *\n * @returns True if the script/literature file is successfully copied over and false otherwise. If the files argument is an array then this function will return true if at least one of the files in the array is successfully copied.\n *\n * @example\n * ```ts\n * //Copies foo.lit from the helios server to the home computer:\n * scp(\"foo.lit\", \"helios\", \"home\");\n * ```\n *\n * @example\n * ```ts\n * //Tries to copy three files from rothman-uni to home computer:\n * files = [\"foo1.lit\", \"foo2.script\", \"foo3.script\"];\n * scp(files, \"rothman-uni\", \"home\");\n * ```\n *\n */\n", "excerptTokens": [ { "kind": "Content", @@ -13047,7 +12941,7 @@ { "kind": "MethodSignature", "canonicalReference": "bitburner!NS#scriptKill:member(1)", - "docComment": "/**\n * Kills all scripts with the specified filename on the target server specified by hostname, regardless of arguments.\n *\n * @remarks\n *\n * RAM cost: 1 GB\n *\n * @param script - Filename of script to kill. This is case-sensitive.\n *\n * @param host - Host of target server.\n *\n * @returns true if one or more scripts were successfully killed, and false if none were.\n */\n", + "docComment": "/**\n * Kill all scripts with a filename.\n *\n * @remarks\n *\n * RAM cost: 1 GB\n *\n * Kills all scripts with the specified filename on the target server specified by hostname, regardless of arguments.\n *\n * @param script - Filename of script to kill. This is case-sensitive.\n *\n * @param host - Host of target server.\n *\n * @returns true if one or more scripts were successfully killed, and false if none were.\n */\n", "excerptTokens": [ { "kind": "Content", @@ -13106,7 +13000,7 @@ { "kind": "MethodSignature", "canonicalReference": "bitburner!NS#scriptRunning:member(1)", - "docComment": "/**\n * Returns a boolean indicating whether any instance of the specified script is running on the target server, regardless of its arguments.\n *\n * This is different than the isRunning function because it does not try to identify a specific instance of a running script by its arguments.\n *\n * @remarks\n *\n * RAM cost: 1 GB\n *\n * @param script - Filename of script to check. This is case-sensitive.\n *\n * @param host - Host of target server.\n *\n * @returns True if the specified script is running, and false otherwise.\n *\n * @example\n * ```ts\n * //The function call will return true if there is any script named foo.script running on the foodnstuff server, and false otherwise:\n * scriptRunning(\"foo.script\", \"foodnstuff\");\n * ```\n *\n * @example\n * ```ts\n * //The function call will return true if there is any script named “foo.script” running on the current server, and false otherwise:\n * scriptRunning(\"foo.script\", getHostname());\n * ```\n *\n */\n", + "docComment": "/**\n * Check if any script with a filename is running.\n *\n * @remarks\n *\n * RAM cost: 1 GB\n *\n * Returns a boolean indicating whether any instance of the specified script is running on the target server, regardless of its arguments.\n *\n * This is different than the isRunning function because it does not try to identify a specific instance of a running script by its arguments.\n *\n * @param script - Filename of script to check. This is case-sensitive.\n *\n * @param host - Host of target server.\n *\n * @returns True if the specified script is running, and false otherwise.\n *\n * @example\n * ```ts\n * //The function call will return true if there is any script named foo.script running on the foodnstuff server, and false otherwise:\n * scriptRunning(\"foo.script\", \"foodnstuff\");\n * ```\n *\n * @example\n * ```ts\n * //The function call will return true if there is any script named “foo.script” running on the current server, and false otherwise:\n * scriptRunning(\"foo.script\", getHostname());\n * ```\n *\n */\n", "excerptTokens": [ { "kind": "Content", @@ -13285,7 +13179,7 @@ { "kind": "MethodSignature", "canonicalReference": "bitburner!NS#spawn:member(1)", - "docComment": "/**\n * Terminates the current script, and then after a delay of about 10 seconds it will execute the newly-specified script. The purpose of this function is to execute a new script without being constrained by the RAM usage of the current one. This function can only be used to run scripts on the local server.\n *\n * Because this function immediately terminates the script, it does not have a return value.\n *\n * @remarks\n *\n * RAM cost: 2 GB\n *\n * @param script - Filename of script to execute.\n *\n * @param numThreads - Number of threads to spawn new script with. Will be rounded to nearest integer.\n *\n * @param args - Additional arguments to pass into the new script that is being run.\n *\n * @example\n * ```ts\n * //The following example will execute the script ‘foo.script’ with 10 threads and the arguments ‘foodnstuff’ and 90:\n * spawn('foo.script', 10, 'foodnstuff', 90);\n * ```\n *\n */\n", + "docComment": "/**\n * Terminate current script and start another in 10s.\n *\n * @remarks\n *\n * RAM cost: 2 GB\n *\n * Terminates the current script, and then after a delay of about 10 seconds it will execute the newly-specified script. The purpose of this function is to execute a new script without being constrained by the RAM usage of the current one. This function can only be used to run scripts on the local server.\n *\n * Because this function immediately terminates the script, it does not have a return value.\n *\n * @param script - Filename of script to execute.\n *\n * @param numThreads - Number of threads to spawn new script with. Will be rounded to nearest integer.\n *\n * @param args - Additional arguments to pass into the new script that is being run.\n *\n * @example\n * ```ts\n * //The following example will execute the script ‘foo.script’ with 10 threads and the arguments ‘foodnstuff’ and 90:\n * spawn('foo.script', 10, 'foodnstuff', 90);\n * ```\n *\n */\n", "excerptTokens": [ { "kind": "Content", @@ -13359,7 +13253,7 @@ { "kind": "MethodSignature", "canonicalReference": "bitburner!NS#sprintf:member(1)", - "docComment": "/**\n * Complete open source JavaScript sprintf implementation\n *\n * @remarks\n *\n * RAM cost: 0 GB\n *\n * @param format - String to format.\n *\n * @param args - Formating arguments.\n *\n * @returns Formated text.\n *\n * @see\n *\n * https://github.com/alexei/sprintf.js\n */\n", + "docComment": "/**\n * Format a string.\n *\n * @remarks\n *\n * RAM cost: 0 GB\n *\n * see: https://github.com/alexei/sprintf.js\n *\n * @param format - String to format.\n *\n * @param args - Formating arguments.\n *\n * @returns Formated text.\n */\n", "excerptTokens": [ { "kind": "Content", @@ -13418,7 +13312,7 @@ { "kind": "MethodSignature", "canonicalReference": "bitburner!NS#sqlinject:member(1)", - "docComment": "/**\n * Runs the SQLInject.exe program on the target server. SQLInject.exe must exist on your home computer.\n *\n * @remarks\n *\n * RAM cost: 0.05 GB\n *\n * @param host - Hostname of the target server.\n *\n * @example\n * ```ts\n * sqlinject(\"foodnstuff\");\n * ```\n *\n */\n", + "docComment": "/**\n * Runs SQLInject.exe on a server.\n *\n * @remarks\n *\n * RAM cost: 0.05 GB\n *\n * @param host - Hostname of the target server.\n *\n * @example\n * ```ts\n * sqlinject(\"foodnstuff\");\n * ```\n *\n */\n", "excerptTokens": [ { "kind": "Content", @@ -13489,7 +13383,7 @@ { "kind": "MethodSignature", "canonicalReference": "bitburner!NS#tail:member(1)", - "docComment": "/**\n * Opens a script’s logs. This is functionally the same as the tail Terminal command.\n *\n * If the function is called with no arguments, it will open the current script’s logs.\n *\n * Otherwise, the fn, hostname/ip, and args… arguments can be used to get the logs from another script. Remember that scripts are uniquely identified by both their names and arguments.\n *\n * @remarks\n *\n * RAM cost: 0 GB\n *\n * @param fn - Optional. Filename of the script being tailed. If omitted, the current script is tailed.\n *\n * @param host - Optional. Hostname of the script being tailed. Defaults to the server this script is running on. If args are specified, this is not optional.\n *\n * @param args - Arguments for the script being tailed.\n *\n * @example\n * ```ts\n * //Open logs from foo.script on the current server that was run with no args\n * tail(\"foo.script\");\n * ```\n *\n * @example\n * ```ts\n * //Get logs from foo.script on the foodnstuff server that was run with no args\n * tail(\"foo.script\", \"foodnstuff\");\n * ```\n *\n * @example\n * ```ts\n * //Get logs from foo.script on the foodnstuff server that was run with the arguments [1, \"test\"]\n * tail(\"foo.script\", \"foodnstuff\", 1, \"test\");\n * ```\n *\n */\n", + "docComment": "/**\n * Open the tail window of a script.\n *\n * @remarks\n *\n * RAM cost: 0 GB\n *\n * Opens a script’s logs. This is functionally the same as the tail Terminal command.\n *\n * If the function is called with no arguments, it will open the current script’s logs.\n *\n * Otherwise, the fn, hostname/ip, and args… arguments can be used to get the logs from another script. Remember that scripts are uniquely identified by both their names and arguments.\n *\n * @param fn - Optional. Filename of the script being tailed. If omitted, the current script is tailed.\n *\n * @param host - Optional. Hostname of the script being tailed. Defaults to the server this script is running on. If args are specified, this is not optional.\n *\n * @param args - Arguments for the script being tailed.\n *\n * @example\n * ```ts\n * //Open logs from foo.script on the current server that was run with no args\n * tail(\"foo.script\");\n * ```\n *\n * @example\n * ```ts\n * //Get logs from foo.script on the foodnstuff server that was run with no args\n * tail(\"foo.script\", \"foodnstuff\");\n * ```\n *\n * @example\n * ```ts\n * //Get logs from foo.script on the foodnstuff server that was run with the arguments [1, \"test\"]\n * tail(\"foo.script\", \"foodnstuff\", 1, \"test\");\n * ```\n *\n */\n", "excerptTokens": [ { "kind": "Content", @@ -13607,7 +13501,7 @@ { "kind": "MethodSignature", "canonicalReference": "bitburner!NS#tryWrite:member(1)", - "docComment": "/**\n * Attempts to write data to the specified Netscript Port. If the port is full, the data will not be written. Otherwise, the data will be written normally.\n *\n * @remarks\n *\n * RAM cost: 1 GB\n *\n * @param port - Port or text file that will be written to.\n *\n * @param data - Data to write.\n *\n * @returns True if the data is successfully written to the port, and false otherwise.\n */\n", + "docComment": "/**\n * Attempt to write to a port.\n *\n * @remarks\n *\n * RAM cost: 1 GB\n *\n * Attempts to write data to the specified Netscript Port. If the port is full, the data will not be written. Otherwise, the data will be written normally.\n *\n * @param port - Port or text file that will be written to.\n *\n * @param data - Data to write.\n *\n * @returns True if the data is successfully written to the port, and false otherwise.\n */\n", "excerptTokens": [ { "kind": "Content", @@ -13666,7 +13560,7 @@ { "kind": "MethodSignature", "canonicalReference": "bitburner!NS#vsprintf:member(1)", - "docComment": "/**\n * Complete open source JavaScript sprintf implementation\n *\n * @remarks\n *\n * RAM cost: 0 GB\n *\n * @param format - String to format.\n *\n * @param args - Formating arguments.\n *\n * @returns Formated text.\n *\n * @see\n *\n * https://github.com/alexei/sprintf.js\n */\n", + "docComment": "/**\n * Format a string with an array of arguments.\n *\n * @remarks\n *\n * RAM cost: 0 GB\n *\n * see: https://github.com/alexei/sprintf.js\n *\n * @param format - String to format.\n *\n * @param args - Formating arguments.\n *\n * @returns Formated text.\n */\n", "excerptTokens": [ { "kind": "Content", @@ -13725,7 +13619,7 @@ { "kind": "MethodSignature", "canonicalReference": "bitburner!NS#weaken:member(1)", - "docComment": "/**\n * Reduce a server security level.\n *\n * @remarks\n *\n * RAM cost: 0.15 GB Use your hacking skills to attack a server’s security, lowering the server’s security level. The runtime for this command depends on your hacking level and the target server’s security level. This function lowers the security level of the target server by 0.05.\n *\n * Like hack and grow, `weaken` can be called on any server, regardless of where the script is running. This command requires root access to the target server, but there is no required hacking level to run the command.\n *\n * @param host - Hostname of the target server to weaken.\n *\n * @param opts - Optional parameters for configuring function behavior.\n *\n * @returns The amount by which the target server’s security level was decreased. This is equivalent to 0.05 multiplied by the number of script threads.\n *\n * @example\n * ```ts\n * weaken(\"foodnstuff\");\n * weaken(\"foodnstuff\", { threads: 5 }); // Only use 5 threads to weaken\n * ```\n *\n */\n", + "docComment": "/**\n * Reduce a server security level.\n *\n * @remarks\n *\n * RAM cost: 0.15 GB\n *\n * Use your hacking skills to attack a server’s security, lowering the server’s security level. The runtime for this command depends on your hacking level and the target server’s security level. This function lowers the security level of the target server by 0.05.\n *\n * Like hack and grow, `weaken` can be called on any server, regardless of where the script is running. This command requires root access to the target server, but there is no required hacking level to run the command.\n *\n * @param host - Hostname of the target server to weaken.\n *\n * @param opts - Optional parameters for configuring function behavior.\n *\n * @returns The amount by which the target server’s security level was decreased. This is equivalent to 0.05 multiplied by the number of script threads.\n *\n * @example\n * ```ts\n * weaken(\"foodnstuff\");\n * weaken(\"foodnstuff\", { threads: 5 }); // Only use 5 threads to weaken\n * ```\n *\n */\n", "excerptTokens": [ { "kind": "Content", @@ -13790,7 +13684,7 @@ { "kind": "MethodSignature", "canonicalReference": "bitburner!NS#weakenAnalyze:member(1)", - "docComment": "/**\n * Predict the effect of weaken.\n *\n * @remarks\n *\n * RAM cost: 1 GB Returns the security decrease that would occur if a weaken with this many threads happened.\n *\n * @param threads - Amount of threads that will be used.\n *\n * @param cores - Optional. The number of cores of the server that would run weaken.\n *\n * @returns The security decrease.\n */\n", + "docComment": "/**\n * Predict the effect of weaken.\n *\n * @remarks\n *\n * RAM cost: 1 GB\n *\n * Returns the security decrease that would occur if a weaken with this many threads happened.\n *\n * @param threads - Amount of threads that will be used.\n *\n * @param cores - Optional. The number of cores of the server that would run weaken.\n *\n * @returns The security decrease.\n */\n", "excerptTokens": [ { "kind": "Content", @@ -13849,7 +13743,7 @@ { "kind": "MethodSignature", "canonicalReference": "bitburner!NS#wget:member(1)", - "docComment": "/**\n * Retrieves data from a URL and downloads it to a file on the specified server. The data can only be downloaded to a script (.script, .ns, .js) or a text file (.txt). If the file already exists, it will be overwritten by this command. Note that it will not be possible to download data from many websites because they do not allow cross-origin resource sharing (CORS).\n *\n * IMPORTANT: This is an asynchronous function that returns a Promise. The Promise’s resolved value will be a boolean indicating whether or not the data was successfully retrieved from the URL. Because the function is async and returns a Promise, it is recommended you use wget in NetscriptJS (Netscript 2.0).\n *\n * In NetscriptJS, you must preface any call to wget with the await keyword (like you would hack or sleep). wget will still work in Netscript 1.0, but the functions execution will not be synchronous (i.e. it may not execute when you expect/want it to). Furthermore, since Promises are not supported in ES5, you will not be able to process the returned value of wget in Netscript 1.0.\n *\n * @remarks\n *\n * RAM cost: 0 GB\n *\n * @param url - URL to pull data from.\n *\n * @param target - Filename to write data to. Must be script or text file.\n *\n * @param host - Optional hostname/ip of server for target file.\n *\n * @returns True if the data was successfully retrieved from the URL, false otherwise.\n *\n * @example\n * ```ts\n * wget(\"https://raw.githubusercontent.com/danielyxie/bitburner/master/README.md\", \"game_readme.txt\");\n * ```\n *\n */\n", + "docComment": "/**\n * Download a file from the internet.\n *\n * @remarks\n *\n * RAM cost: 0 GB\n *\n * Retrieves data from a URL and downloads it to a file on the specified server. The data can only be downloaded to a script (.script, .ns, .js) or a text file (.txt). If the file already exists, it will be overwritten by this command. Note that it will not be possible to download data from many websites because they do not allow cross-origin resource sharing (CORS).\n *\n * IMPORTANT: This is an asynchronous function that returns a Promise. The Promise’s resolved value will be a boolean indicating whether or not the data was successfully retrieved from the URL. Because the function is async and returns a Promise, it is recommended you use wget in NetscriptJS (Netscript 2.0).\n *\n * In NetscriptJS, you must preface any call to wget with the await keyword (like you would hack or sleep). wget will still work in Netscript 1.0, but the functions execution will not be synchronous (i.e. it may not execute when you expect/want it to). Furthermore, since Promises are not supported in ES5, you will not be able to process the returned value of wget in Netscript 1.0.\n *\n * @param url - URL to pull data from.\n *\n * @param target - Filename to write data to. Must be script or text file.\n *\n * @param host - Optional hostname/ip of server for target file.\n *\n * @returns True if the data was successfully retrieved from the URL, false otherwise.\n *\n * @example\n * ```ts\n * wget(\"https://raw.githubusercontent.com/danielyxie/bitburner/master/README.md\", \"game_readme.txt\");\n * ```\n *\n */\n", "excerptTokens": [ { "kind": "Content", @@ -13928,7 +13822,7 @@ { "kind": "MethodSignature", "canonicalReference": "bitburner!NS#write:member(1)", - "docComment": "/**\n * This function can be used to either write data to a port or to a text file (.txt).\n *\n * If the first argument is a number between 1 and 20, then it specifies a port and this function will write data to that port. The third argument, mode, is not used when writing to a port.\n *\n * If the first argument is a string, then it specifies the name of a text file (.txt) and this function will write data to that text file. If the specified text file does not exist, then it will be created. The third argument mode, defines how the data will be written to the text file. If *mode is set to “w”, then the data is written in “write” mode which means that it will overwrite all existing data on the text file. If mode is set to any other value then the data will be written in “append” mode which means that the data will be added at the end of the text file.\n *\n * @remarks\n *\n * RAM cost: 1 GB\n *\n * @param handle - Port or text file that will be written to.\n *\n * @param data - Data to write.\n *\n * @param mode - Defines the write mode. Only valid when writing to text files.\n */\n", + "docComment": "/**\n * Write data to a file.\n *\n * @remarks\n *\n * RAM cost: 1 GB\n *\n * This function can be used to either write data to a port or to a text file (.txt).\n *\n * If the first argument is a number between 1 and 20, then it specifies a port and this function will write data to that port. The third argument, mode, is not used when writing to a port.\n *\n * If the first argument is a string, then it specifies the name of a text file (.txt) and this function will write data to that text file. If the specified text file does not exist, then it will be created. The third argument mode, defines how the data will be written to the text file. If *mode is set to “w”, then the data is written in “write” mode which means that it will overwrite all existing data on the text file. If mode is set to any other value then the data will be written in “append” mode which means that the data will be added at the end of the text file.\n *\n * @param handle - Port or text file that will be written to.\n *\n * @param data - Data to write.\n *\n * @param mode - Defines the write mode. Only valid when writing to text files.\n */\n", "excerptTokens": [ { "kind": "Content", @@ -14014,7 +13908,7 @@ "excerptTokens": [ { "kind": "Content", - "text": "interface PlayerSkills " + "text": "export interface PlayerSkills " } ], "releaseTag": "Public", @@ -14212,7 +14106,7 @@ "excerptTokens": [ { "kind": "Content", - "text": "interface ProcessInfo " + "text": "export interface ProcessInfo " } ], "releaseTag": "Public", @@ -14306,7 +14200,7 @@ "excerptTokens": [ { "kind": "Content", - "text": "interface Server " + "text": "export interface Server " } ], "releaseTag": "Public", @@ -14660,7 +14554,7 @@ "excerptTokens": [ { "kind": "Content", - "text": "interface Singularity " + "text": "export interface Singularity " } ], "releaseTag": "Public", @@ -16097,7 +15991,7 @@ "excerptTokens": [ { "kind": "Content", - "text": "interface Sleeve " + "text": "export interface Sleeve " } ], "releaseTag": "Public", @@ -16915,7 +16809,7 @@ "excerptTokens": [ { "kind": "Content", - "text": "interface SleeveInformation " + "text": "export interface SleeveInformation " } ], "releaseTag": "Public", @@ -17247,7 +17141,7 @@ "excerptTokens": [ { "kind": "Content", - "text": "interface SleeveSkills " + "text": "export interface SleeveSkills " } ], "releaseTag": "Public", @@ -17471,7 +17365,7 @@ "excerptTokens": [ { "kind": "Content", - "text": "interface SleeveTask " + "text": "export interface SleeveTask " } ], "releaseTag": "Public", @@ -17617,7 +17511,7 @@ "excerptTokens": [ { "kind": "Content", - "text": "interface SleeveWorkGains " + "text": "export interface SleeveWorkGains " } ], "releaseTag": "Public", @@ -17815,7 +17709,7 @@ "excerptTokens": [ { "kind": "Content", - "text": "interface SourceFileLvl " + "text": "export interface SourceFileLvl " } ], "releaseTag": "Public", @@ -17883,7 +17777,7 @@ "excerptTokens": [ { "kind": "Content", - "text": "interface StockOrder " + "text": "export interface StockOrder " } ], "releaseTag": "Public", @@ -17946,7 +17840,7 @@ "excerptTokens": [ { "kind": "Content", - "text": "interface StockOrderObject " + "text": "export interface StockOrderObject " } ], "releaseTag": "Public", diff --git a/markdown/bitburner.augmentationstats.md b/markdown/bitburner.augmentationstats.md index a317bd0cf..73960ae36 100644 --- a/markdown/bitburner.augmentationstats.md +++ b/markdown/bitburner.augmentationstats.md @@ -9,7 +9,7 @@ Data representing the internal values of an Augmentation. Signature: ```typescript -interface AugmentationStats +export interface AugmentationStats ``` ## Properties diff --git a/markdown/bitburner.augmentpair.md b/markdown/bitburner.augmentpair.md index c78d64415..473f5811b 100644 --- a/markdown/bitburner.augmentpair.md +++ b/markdown/bitburner.augmentpair.md @@ -9,7 +9,7 @@ Return value of [getSleevePurchasableAugs](./bitburner.sleeve.getsleevepurchasab Signature: ```typescript -interface AugmentPair +export interface AugmentPair ``` ## Properties diff --git a/markdown/bitburner.basichgwoptions.md b/markdown/bitburner.basichgwoptions.md index 11c8d9893..a2e9d0aaa 100644 --- a/markdown/bitburner.basichgwoptions.md +++ b/markdown/bitburner.basichgwoptions.md @@ -9,7 +9,7 @@ Options to affect the behavior of [hack](./bitburner.ns.hack.md), [grow] Signature: ```typescript -interface BasicHGWOptions +export interface BasicHGWOptions ``` ## Properties diff --git a/markdown/bitburner.bitnodemultipliers.md b/markdown/bitburner.bitnodemultipliers.md index f41a9c365..2a7c6910e 100644 --- a/markdown/bitburner.bitnodemultipliers.md +++ b/markdown/bitburner.bitnodemultipliers.md @@ -9,7 +9,7 @@ All multipliers affecting the difficulty of the current challenge. Signature: ```typescript -interface BitNodeMultipliers +export interface BitNodeMultipliers ``` ## Properties diff --git a/markdown/bitburner.bladeburnercuraction.md b/markdown/bitburner.bladeburnercuraction.md index 596804d5f..abf2ceabb 100644 --- a/markdown/bitburner.bladeburnercuraction.md +++ b/markdown/bitburner.bladeburnercuraction.md @@ -9,7 +9,7 @@ Bladeburner current action. Signature: ```typescript -interface BladeburnerCurAction +export interface BladeburnerCurAction ``` ## Properties diff --git a/markdown/bitburner.characterinfo.md b/markdown/bitburner.characterinfo.md index cdf6f5c9a..3c25a6250 100644 --- a/markdown/bitburner.characterinfo.md +++ b/markdown/bitburner.characterinfo.md @@ -8,7 +8,7 @@ Signature: ```typescript -interface CharacterInfo +export interface CharacterInfo ``` ## Properties diff --git a/markdown/bitburner.charactermult.md b/markdown/bitburner.charactermult.md index 05071b5ac..4e0e98562 100644 --- a/markdown/bitburner.charactermult.md +++ b/markdown/bitburner.charactermult.md @@ -8,7 +8,7 @@ Signature: ```typescript -interface CharacterMult +export interface CharacterMult ``` ## Properties diff --git a/markdown/bitburner.codingattemptoptions.md b/markdown/bitburner.codingattemptoptions.md index f8b5bca22..22dfd0301 100644 --- a/markdown/bitburner.codingattemptoptions.md +++ b/markdown/bitburner.codingattemptoptions.md @@ -9,7 +9,7 @@ Options to affect the behavior of [CodingContract](./bitburner.codingcontract.md Signature: ```typescript -interface CodingAttemptOptions +export interface CodingAttemptOptions ``` ## Properties diff --git a/markdown/bitburner.codingcontract.md b/markdown/bitburner.codingcontract.md index c65555bd8..1ff3a6d61 100644 --- a/markdown/bitburner.codingcontract.md +++ b/markdown/bitburner.codingcontract.md @@ -9,7 +9,7 @@ Coding Contact API Signature: ```typescript -interface CodingContract +export interface CodingContract ``` ## Methods diff --git a/markdown/bitburner.crimestats.md b/markdown/bitburner.crimestats.md index e9af8d954..e397c52f2 100644 --- a/markdown/bitburner.crimestats.md +++ b/markdown/bitburner.crimestats.md @@ -9,7 +9,7 @@ Data representing the internal values of a crime. Signature: ```typescript -interface CrimeStats +export interface CrimeStats ``` ## Properties diff --git a/markdown/bitburner.equipmentstats.md b/markdown/bitburner.equipmentstats.md index e4b351985..1490bdd6c 100644 --- a/markdown/bitburner.equipmentstats.md +++ b/markdown/bitburner.equipmentstats.md @@ -9,7 +9,7 @@ Object representing data representing a gang member equipment. Signature: ```typescript -interface EquipmentStats +export interface EquipmentStats ``` ## Properties diff --git a/markdown/bitburner.gang.creategang.md b/markdown/bitburner.gang.creategang.md new file mode 100644 index 000000000..cf57b8a8a --- /dev/null +++ b/markdown/bitburner.gang.creategang.md @@ -0,0 +1,32 @@ + + +[Home](./index.md) > [bitburner](./bitburner.md) > [Gang](./bitburner.gang.md) > [createGang](./bitburner.gang.creategang.md) + +## Gang.createGang() method + +Create a gang. + +Signature: + +```typescript +createGang(faction: string): boolean; +``` + +## Parameters + +| Parameter | Type | Description | +| --- | --- | --- | +| faction | string | | + +Returns: + +boolean + +True if the gang was created, false otherwise. + +## Remarks + +RAM cost: 1GB + +Create a gang with the specified faction. + diff --git a/markdown/bitburner.gang.ingang.md b/markdown/bitburner.gang.ingang.md new file mode 100644 index 000000000..4cd0021f9 --- /dev/null +++ b/markdown/bitburner.gang.ingang.md @@ -0,0 +1,23 @@ + + +[Home](./index.md) > [bitburner](./bitburner.md) > [Gang](./bitburner.gang.md) > [inGang](./bitburner.gang.ingang.md) + +## Gang.inGang() method + +Check if you're in a gang. + +Signature: + +```typescript +inGang(): boolean; +``` +Returns: + +boolean + +True if you're in a gang, false otherwise. + +## Remarks + +RAM cost: 1GB + diff --git a/markdown/bitburner.gang.md b/markdown/bitburner.gang.md index 978fb28c7..723620549 100644 --- a/markdown/bitburner.gang.md +++ b/markdown/bitburner.gang.md @@ -9,7 +9,7 @@ Gang API Signature: ```typescript -interface Gang +export interface Gang ``` ## Remarks @@ -22,6 +22,7 @@ If you are not in BitNode-2, then you must have Source-File 2 in order to use th | --- | --- | | [ascendMember(memberName)](./bitburner.gang.ascendmember.md) | Ascend a gang member. | | [canRecruitMember()](./bitburner.gang.canrecruitmember.md) | Check if you can recruit a new gang member. | +| [createGang(faction)](./bitburner.gang.creategang.md) | Create a gang. | | [getBonusTime()](./bitburner.gang.getbonustime.md) | Get bonus time. | | [getChanceToWinClash(gangName)](./bitburner.gang.getchancetowinclash.md) | Get chance to win clash with other gang. | | [getEquipmentCost(equipName)](./bitburner.gang.getequipmentcost.md) | Get cost of equipment. | @@ -34,6 +35,7 @@ If you are not in BitNode-2, then you must have Source-File 2 in order to use th | [getOtherGangInformation()](./bitburner.gang.getotherganginformation.md) | Get information about the other gangs. | | [getTaskNames()](./bitburner.gang.gettasknames.md) | List member task names. | | [getTaskStats(name)](./bitburner.gang.gettaskstats.md) | Get stats of a task. | +| [inGang()](./bitburner.gang.ingang.md) | Check if you're in a gang. | | [purchaseEquipment(memberName, equipName)](./bitburner.gang.purchaseequipment.md) | Purchase an equipment for a gang member. | | [recruitMember(name)](./bitburner.gang.recruitmember.md) | Recruit a new gang member. | | [setMemberTask(memberName, taskName)](./bitburner.gang.setmembertask.md) | Set gang member to task. | diff --git a/markdown/bitburner.ganggeninfo.md b/markdown/bitburner.ganggeninfo.md index 829cd37f2..7cafc9882 100644 --- a/markdown/bitburner.ganggeninfo.md +++ b/markdown/bitburner.ganggeninfo.md @@ -9,7 +9,7 @@ Gang general info. Signature: ```typescript -interface GangGenInfo +export interface GangGenInfo ``` ## Properties diff --git a/markdown/bitburner.gangmemberascension.md b/markdown/bitburner.gangmemberascension.md index bd05f7bad..97f78b1d6 100644 --- a/markdown/bitburner.gangmemberascension.md +++ b/markdown/bitburner.gangmemberascension.md @@ -8,7 +8,7 @@ Signature: ```typescript -interface GangMemberAscension +export interface GangMemberAscension ``` ## Properties diff --git a/markdown/bitburner.gangmemberinfo.md b/markdown/bitburner.gangmemberinfo.md index 9e4ec8cc1..2c4202f17 100644 --- a/markdown/bitburner.gangmemberinfo.md +++ b/markdown/bitburner.gangmemberinfo.md @@ -8,7 +8,7 @@ Signature: ```typescript -interface GangMemberInfo +export interface GangMemberInfo ``` ## Properties diff --git a/markdown/bitburner.gangotherinfo.md b/markdown/bitburner.gangotherinfo.md index 9279a709c..add42849b 100644 --- a/markdown/bitburner.gangotherinfo.md +++ b/markdown/bitburner.gangotherinfo.md @@ -8,5 +8,5 @@ Signature: ```typescript -interface GangOtherInfo +export interface GangOtherInfo ``` diff --git a/markdown/bitburner.gangotherinfoobject.md b/markdown/bitburner.gangotherinfoobject.md index 32c870ca1..a5a262017 100644 --- a/markdown/bitburner.gangotherinfoobject.md +++ b/markdown/bitburner.gangotherinfoobject.md @@ -8,7 +8,7 @@ Signature: ```typescript -interface GangOtherInfoObject +export interface GangOtherInfoObject ``` ## Properties diff --git a/markdown/bitburner.gangtaskstats.md b/markdown/bitburner.gangtaskstats.md index 6b3df024f..8a2fed1b8 100644 --- a/markdown/bitburner.gangtaskstats.md +++ b/markdown/bitburner.gangtaskstats.md @@ -9,7 +9,7 @@ Object representing data representing a gang member task. Signature: ```typescript -interface GangTaskStats +export interface GangTaskStats ``` ## Properties diff --git a/markdown/bitburner.gangterritory.md b/markdown/bitburner.gangterritory.md index bacbdc449..c42e62060 100644 --- a/markdown/bitburner.gangterritory.md +++ b/markdown/bitburner.gangterritory.md @@ -8,7 +8,7 @@ Signature: ```typescript -interface GangTerritory +export interface GangTerritory ``` ## Properties diff --git a/markdown/bitburner.hackingmultipliers.md b/markdown/bitburner.hackingmultipliers.md index f9a9fec2d..425caecc8 100644 --- a/markdown/bitburner.hackingmultipliers.md +++ b/markdown/bitburner.hackingmultipliers.md @@ -9,7 +9,7 @@ Hack related multipliers. Signature: ```typescript -interface HackingMultipliers +export interface HackingMultipliers ``` ## Properties diff --git a/markdown/bitburner.hacknet.md b/markdown/bitburner.hacknet.md index f42379c4a..85833f2aa 100644 --- a/markdown/bitburner.hacknet.md +++ b/markdown/bitburner.hacknet.md @@ -9,7 +9,7 @@ Hacknet API Signature: ```typescript -interface Hacknet +export interface Hacknet ``` ## Remarks diff --git a/markdown/bitburner.hacknetmultipliers.md b/markdown/bitburner.hacknetmultipliers.md index 6697e5eb6..c04b83fa4 100644 --- a/markdown/bitburner.hacknetmultipliers.md +++ b/markdown/bitburner.hacknetmultipliers.md @@ -9,7 +9,7 @@ Hacknet related multipliers. Signature: ```typescript -interface HacknetMultipliers +export interface HacknetMultipliers ``` ## Properties diff --git a/markdown/bitburner.nodestats.md b/markdown/bitburner.nodestats.md index a5b4929b7..0108b8e2c 100644 --- a/markdown/bitburner.nodestats.md +++ b/markdown/bitburner.nodestats.md @@ -9,7 +9,7 @@ Object representing all the values related to a hacknet node. Signature: ```typescript -interface NodeStats +export interface NodeStats ``` ## Properties diff --git a/markdown/bitburner.ns.args.md b/markdown/bitburner.ns.args.md index 6c232bbd8..10c22611b 100644 --- a/markdown/bitburner.ns.args.md +++ b/markdown/bitburner.ns.args.md @@ -14,7 +14,9 @@ readonly args: (string | number)[]; ## Remarks -RAM cost: 0 GB Arguments passed into a script can be accessed using a normal array using the \[\] operator (args\[0\], args\[1\], etc…). +RAM cost: 0 GB + +Arguments passed into a script can be accessed using a normal array using the \[\] operator (args\[0\], args\[1\], etc…). It is also possible to get the number of arguments that was passed into a script using: 'args.length' WARNING: Do not try to modify the args array. This will break the game. diff --git a/markdown/bitburner.ns.brutessh.md b/markdown/bitburner.ns.brutessh.md index bc05a12df..6df8fbc9f 100644 --- a/markdown/bitburner.ns.brutessh.md +++ b/markdown/bitburner.ns.brutessh.md @@ -4,7 +4,7 @@ ## NS.brutessh() method -Runs the BruteSSH.exe program on the target server. BruteSSH.exe must exist on your home computer. +Runs BruteSSH.exe on a server. Signature: @@ -26,6 +26,8 @@ void RAM cost: 0.05 GB +Runs the BruteSSH.exe program on the target server. BruteSSH.exe must exist on your home computer. + ## Example diff --git a/markdown/bitburner.ns.clear.md b/markdown/bitburner.ns.clear.md index c9768a3f4..63fa9ca3b 100644 --- a/markdown/bitburner.ns.clear.md +++ b/markdown/bitburner.ns.clear.md @@ -4,11 +4,7 @@ ## NS.clear() method -This function is used to clear data in a Netscript Ports or a text file. - -If the port/fn argument is a number between 1 and 20, then it specifies a port and will clear it (deleting all data from the underlying queue). - -If the port/fn argument is a string, then it specifies the name of a text file (.txt) and will delete all data from that text file. +Clear data from a port. Signature: @@ -28,5 +24,11 @@ void ## Remarks -RAM cost: 1 GB +RAM cost: 0 GB + +This function is used to clear data in a Netscript Ports or a text file. + +If the port/fn argument is a number between 1 and 20, then it specifies a port and will clear it (deleting all data from the underlying queue). + +If the port/fn argument is a string, then it specifies the name of a text file (.txt) and will delete all data from that text file. diff --git a/markdown/bitburner.ns.deleteserver.md b/markdown/bitburner.ns.deleteserver.md index 657a1fcf4..6e1255dcf 100644 --- a/markdown/bitburner.ns.deleteserver.md +++ b/markdown/bitburner.ns.deleteserver.md @@ -4,9 +4,7 @@ ## NS.deleteServer() method -Deletes one of your purchased servers, which is specified by its hostname. - -The hostname argument can be any data type, but it will be converted to a string. Whitespace is automatically removed from the string. This function will not delete a server that still has scripts running on it. +Delete a purchased server. Signature: @@ -30,3 +28,7 @@ True if successful, and false otherwise. 2.25 GB +Deletes one of your purchased servers, which is specified by its hostname. + +The hostname argument can be any data type, but it will be converted to a string. Whitespace is automatically removed from the string. This function will not delete a server that still has scripts running on it. + diff --git a/markdown/bitburner.ns.disablelog.md b/markdown/bitburner.ns.disablelog.md index a16a988e6..7b7420fd3 100644 --- a/markdown/bitburner.ns.disablelog.md +++ b/markdown/bitburner.ns.disablelog.md @@ -24,7 +24,9 @@ void ## Remarks -RAM cost: 0 GB Logging can be disabled for all functions by passing `ALL` as the argument. +RAM cost: 0 GB + +Logging can be disabled for all functions by passing `ALL` as the argument. Note that this does not completely remove all logging functionality. This only stops a function from logging when the function is successful. If the function fails, it will still log the reason for failure. diff --git a/markdown/bitburner.ns.enablelog.md b/markdown/bitburner.ns.enablelog.md index 4bc5bbeb8..415e3a145 100644 --- a/markdown/bitburner.ns.enablelog.md +++ b/markdown/bitburner.ns.enablelog.md @@ -4,7 +4,7 @@ ## NS.enableLog() method -Re-enables logging for the given function. If `ALL` is passed into this function as an argument, then it will revert the effects of disableLog(`ALL`). +Enable logging for a certain function. Signature: @@ -26,3 +26,5 @@ void RAM cost: 0 GB +Re-enables logging for the given function. If `ALL` is passed into this function as an argument, then it will revert the effects of disableLog(`ALL`). + diff --git a/markdown/bitburner.ns.exec.md b/markdown/bitburner.ns.exec.md index e625ef4ad..c32b07060 100644 --- a/markdown/bitburner.ns.exec.md +++ b/markdown/bitburner.ns.exec.md @@ -4,13 +4,7 @@ ## NS.exec() method -Run a script as a separate process on a specified server. This is similar to the run function except that it can be used to run a script on any server, instead of just the current server. - -If the script was successfully started, then this functions returns the PID of that script. Otherwise, it returns 0. - -PID stands for Process ID. The PID is a unique identifier for each script. The PID will always be a positive integer. - -Running this function with a numThreads argument of 0 will return 0 without running the script. However, running this function with a negative numThreads argument will cause a runtime error. +Start another script on any server. Signature: @@ -37,6 +31,14 @@ Returns the PID of a successfully started script, and 0 otherwise. RAM cost: 1.3 GB +Run a script as a separate process on a specified server. This is similar to the run function except that it can be used to run a script on any server, instead of just the current server. + +If the script was successfully started, then this functions returns the PID of that script. Otherwise, it returns 0. + +PID stands for Process ID. The PID is a unique identifier for each script. The PID will always be a positive integer. + +Running this function with a numThreads argument of 0 will return 0 without running the script. However, running this function with a negative numThreads argument will cause a runtime error. + ## Example 1 diff --git a/markdown/bitburner.ns.fileexists.md b/markdown/bitburner.ns.fileexists.md index b91973a28..808791ea5 100644 --- a/markdown/bitburner.ns.fileexists.md +++ b/markdown/bitburner.ns.fileexists.md @@ -4,9 +4,7 @@ ## NS.fileExists() method -Returns a boolean indicating whether the specified file exists on the target server. The filename for scripts is case-sensitive, but for other types of files it is not. For example, fileExists(“brutessh.exe”) will work fine, even though the actual program is named 'BruteSSH.exe'. - -If the hostname/ip argument is omitted, then the function will search through the current server (the server running the script that calls this function) for the file. +Check if a file exists. Signature: @@ -31,6 +29,10 @@ True if specified file exists, and false otherwise. RAM cost: 0.1 GB +Returns a boolean indicating whether the specified file exists on the target server. The filename for scripts is case-sensitive, but for other types of files it is not. For example, fileExists(“brutessh.exe”) will work fine, even though the actual program is named 'BruteSSH.exe'. + +If the hostname/ip argument is omitted, then the function will search through the current server (the server running the script that calls this function) for the file. + ## Example 1 diff --git a/markdown/bitburner.ns.ftpcrack.md b/markdown/bitburner.ns.ftpcrack.md index ca5742a49..29dffdc60 100644 --- a/markdown/bitburner.ns.ftpcrack.md +++ b/markdown/bitburner.ns.ftpcrack.md @@ -4,7 +4,7 @@ ## NS.ftpcrack() method -Runs the FTPCrack.exe program on the target server. FTPCrack.exe must exist on your home computer. +Runs FTPCrack.exe on a server. Signature: @@ -26,6 +26,8 @@ void RAM cost: 0.05 GB +Runs the FTPCrack.exe program on the target server. FTPCrack.exe must exist on your home computer. + ## Example diff --git a/markdown/bitburner.ns.getbitnodemultipliers.md b/markdown/bitburner.ns.getbitnodemultipliers.md index ed038bbc2..ba307ef96 100644 --- a/markdown/bitburner.ns.getbitnodemultipliers.md +++ b/markdown/bitburner.ns.getbitnodemultipliers.md @@ -4,9 +4,7 @@ ## NS.getBitNodeMultipliers() method -Returns an object containing the current BitNode multipliers. This function requires Source-File 5 in order to run. The multipliers are returned in decimal forms (e.g. 1.5 instead of 150%). The multipliers represent the difference between the current BitNode and the original BitNode (BitNode-1). - -For example, if the CrimeMoney multiplier has a value of 0.1, then that means that committing crimes in the current BitNode will only give 10% of the money you would have received in BitNode-1. +Get the current Bitnode multipliers. Signature: @@ -23,6 +21,10 @@ Object containing the current BitNode multipliers. RAM cost: 4 GB +Returns an object containing the current BitNode multipliers. This function requires Source-File 5 in order to run. The multipliers are returned in decimal forms (e.g. 1.5 instead of 150%). The multipliers represent the difference between the current BitNode and the original BitNode (BitNode-1). + +For example, if the CrimeMoney multiplier has a value of 0.1, then that means that committing crimes in the current BitNode will only give 10% of the money you would have received in BitNode-1. + ## Example diff --git a/markdown/bitburner.ns.getgrowtime.md b/markdown/bitburner.ns.getgrowtime.md index b2c2e2100..626e67e92 100644 --- a/markdown/bitburner.ns.getgrowtime.md +++ b/markdown/bitburner.ns.getgrowtime.md @@ -4,12 +4,12 @@ ## NS.getGrowTime() method -Returns the amount of time in seconds it takes to execute the grow Netscript function on the target server. The function takes in an optional hackLvl parameter that can be specified to see what the grow time would be at different hacking levels. +Get the execution time of a grow() call. Signature: ```typescript -getGrowTime(host: string, hackLvl?: number, intLvl?: number): number; +getGrowTime(host: string): number; ``` ## Parameters @@ -17,8 +17,6 @@ getGrowTime(host: string, hackLvl?: number, intLvl?: number): number; | Parameter | Type | Description | | --- | --- | --- | | host | string | Host of target server. | -| hackLvl | number | Optional hacking level for the calculation. Defaults to player’s current hacking level. | -| intLvl | number | Optional intelligence level for the calculation. Defaults to player’s current intelligence level. (Intelligence is unlocked after obtaining Source-File 5). | Returns: @@ -30,3 +28,5 @@ Returns the amount of time in seconds it takes to execute the grow Netscript fun RAM cost: 0.05 GB +Returns the amount of time in seconds it takes to execute the grow Netscript function on the target server. The function takes in an optional hackLvl parameter that can be specified to see what the grow time would be at different hacking levels. + diff --git a/markdown/bitburner.ns.gethackingmultipliers.md b/markdown/bitburner.ns.gethackingmultipliers.md index 9ceb44a69..5be050251 100644 --- a/markdown/bitburner.ns.gethackingmultipliers.md +++ b/markdown/bitburner.ns.gethackingmultipliers.md @@ -4,7 +4,7 @@ ## NS.getHackingMultipliers() method -Returns an object containing the Player’s hacking related multipliers. These multipliers are returned in fractional forms, not percentages (e.g. 1.5 instead of 150%). +Get hacking related multipliers. Signature: @@ -21,6 +21,8 @@ Object containing the Player’s hacking related multipliers. RAM cost: 4 GB +Returns an object containing the Player’s hacking related multipliers. These multipliers are returned in fractional forms, not percentages (e.g. 1.5 instead of 150%). + ## Example diff --git a/markdown/bitburner.ns.gethacknetmultipliers.md b/markdown/bitburner.ns.gethacknetmultipliers.md index c78783b67..99e7a2830 100644 --- a/markdown/bitburner.ns.gethacknetmultipliers.md +++ b/markdown/bitburner.ns.gethacknetmultipliers.md @@ -4,7 +4,7 @@ ## NS.getHacknetMultipliers() method -Returns an object containing the Player’s hacknet related multipliers. These multipliers are returned in fractional forms, not percentages (e.g. 1.5 instead of 150%). +Get hacknet related multipliers. Signature: @@ -21,6 +21,8 @@ Object containing the Player’s hacknet related multipliers. RAM cost: 4 GB +Returns an object containing the Player’s hacknet related multipliers. These multipliers are returned in fractional forms, not percentages (e.g. 1.5 instead of 150%). + ## Example diff --git a/markdown/bitburner.ns.gethacktime.md b/markdown/bitburner.ns.gethacktime.md index cfe1e832f..f0b518f7d 100644 --- a/markdown/bitburner.ns.gethacktime.md +++ b/markdown/bitburner.ns.gethacktime.md @@ -4,12 +4,12 @@ ## NS.getHackTime() method -Returns the amount of time in seconds it takes to execute the hack Netscript function on the target server. The function takes in an optional hackLvl parameter that can be specified to see what the hack time would be at different hacking levels. +Get the execution time of a hack() call. Signature: ```typescript -getHackTime(host: string, hackLvl?: number, intLvl?: number): number; +getHackTime(host: string): number; ``` ## Parameters @@ -17,16 +17,16 @@ getHackTime(host: string, hackLvl?: number, intLvl?: number): number; | Parameter | Type | Description | | --- | --- | --- | | host | string | Host of target server. | -| hackLvl | number | Optional hacking level for the calculation. Defaults to player’s current hacking level. | -| intLvl | number | Optional intelligence level for the calculation. Defaults to player’s current intelligence level. (Intelligence is unlocked after obtaining Source-File 5). | Returns: number -Returns the amount of time in seconds it takes to execute the hack Netscript function. Returns Infinity if called on a Hacknet Server. +Returns the amount of time in milliseconds it takes to execute the hack Netscript function. Returns Infinity if called on a Hacknet Server. ## Remarks RAM cost: 0.05 GB +Returns the amount of time in milliseconds it takes to execute the hack Netscript function on the target server. The function takes in an optional hackLvl parameter that can be specified to see what the hack time would be at different hacking levels. + diff --git a/markdown/bitburner.ns.getporthandle.md b/markdown/bitburner.ns.getporthandle.md index c1ff44292..5c6f610fe 100644 --- a/markdown/bitburner.ns.getporthandle.md +++ b/markdown/bitburner.ns.getporthandle.md @@ -4,9 +4,7 @@ ## NS.getPortHandle() method -Get a handle to a Netscript Port. - -WARNING: Port Handles only work in NetscriptJS (Netscript 2.0). They will not work in Netscript 1.0. +Get all data on a port. Signature: @@ -28,5 +26,9 @@ Data in the specified port. ## Remarks -RAM cost: 10 GB +RAM cost: 0 GB + +Get a handle to a Netscript Port. + +WARNING: Port Handles only work in NetscriptJS (Netscript 2.0). They will not work in Netscript 1.0. diff --git a/markdown/bitburner.ns.getpurchasedservercost.md b/markdown/bitburner.ns.getpurchasedservercost.md index 90d570069..76b760c94 100644 --- a/markdown/bitburner.ns.getpurchasedservercost.md +++ b/markdown/bitburner.ns.getpurchasedservercost.md @@ -4,7 +4,7 @@ ## NS.getPurchasedServerCost() method -Returns the cost to purchase a server with the specified amount of ram. +Get cost of purchasing a server. Signature: @@ -28,6 +28,8 @@ The cost to purchase a server with the specified amount of ram. RAM cost: 0.25 GB +Returns the cost to purchase a server with the specified amount of ram. + ## Example diff --git a/markdown/bitburner.ns.getpurchasedservers.md b/markdown/bitburner.ns.getpurchasedservers.md index e01553fd2..757cf6f9e 100644 --- a/markdown/bitburner.ns.getpurchasedservers.md +++ b/markdown/bitburner.ns.getpurchasedservers.md @@ -16,7 +16,7 @@ getPurchasedServers(hostnameMode?: boolean): string[]; | Parameter | Type | Description | | --- | --- | --- | -| hostnameMode | boolean | \] Optional. Defaults to true. Returns hostnames if true, and IPs if false. | +| hostnameMode | boolean | Optional. Defaults to true. Returns hostnames if true, and IPs if false. | Returns: diff --git a/markdown/bitburner.ns.getscriptexpgain.md b/markdown/bitburner.ns.getscriptexpgain.md index 1ba1d17c9..e7089b7b2 100644 --- a/markdown/bitburner.ns.getscriptexpgain.md +++ b/markdown/bitburner.ns.getscriptexpgain.md @@ -4,9 +4,7 @@ ## NS.getScriptExpGain() method -Returns the amount of hacking experience the specified script generates while online (when the game is open, does not apply for offline experience gains). Remember that a script is uniquely identified by both its name and its arguments. - -This function can also return the total experience gain rate of all of your active scripts by running the function with no arguments. +Get the exp gain of a script. Signature: @@ -32,3 +30,7 @@ Amount of hacking experience the specified script generates while online. RAM cost: 0.1 GB +Returns the amount of hacking experience the specified script generates while online (when the game is open, does not apply for offline experience gains). Remember that a script is uniquely identified by both its name and its arguments. + +This function can also return the total experience gain rate of all of your active scripts by running the function with no arguments. + diff --git a/markdown/bitburner.ns.getscriptincome.md b/markdown/bitburner.ns.getscriptincome.md index 1555c5eab..29a5bccd5 100644 --- a/markdown/bitburner.ns.getscriptincome.md +++ b/markdown/bitburner.ns.getscriptincome.md @@ -4,9 +4,7 @@ ## NS.getScriptIncome() method -Returns the amount of income the specified script generates while online (when the game is open, does not apply for offline income). Remember that a script is uniquely identified by both its name and its arguments. So for example if you ran a script with the arguments “foodnstuff” and “5” then in order to use this function to get that script’s income you must specify those same arguments in the same order in this function call. - -This function can also be called with no arguments. If called with no arguments, then this function will return an array of two values. The first value is the total income (dollar / second) of all of your active scripts (scripts that are currently running on any server). The second value is the total income (dollar / second) that you’ve earned from scripts since you last installed Augmentations. +Get the income of a script. Signature: @@ -32,3 +30,7 @@ Amount of income the specified script generates while online. RAM cost: 0.1 GB +Returns the amount of income the specified script generates while online (when the game is open, does not apply for offline income). Remember that a script is uniquely identified by both its name and its arguments. So for example if you ran a script with the arguments “foodnstuff” and “5” then in order to use this function to get that script’s income you must specify those same arguments in the same order in this function call. + +This function can also be called with no arguments. If called with no arguments, then this function will return an array of two values. The first value is the total income (dollar / second) of all of your active scripts (scripts that are currently running on any server). The second value is the total income (dollar / second) that you’ve earned from scripts since you last installed Augmentations. + diff --git a/markdown/bitburner.ns.getscriptlogs.md b/markdown/bitburner.ns.getscriptlogs.md index 756135353..464180dc7 100644 --- a/markdown/bitburner.ns.getscriptlogs.md +++ b/markdown/bitburner.ns.getscriptlogs.md @@ -4,9 +4,7 @@ ## NS.getScriptLogs() method -Returns a script’s logs. The logs are returned as an array, where each line is an element in the array. The most recently logged line is at the end of the array. Note that there is a maximum number of lines that a script stores in its logs. This is configurable in the game’s options. If the function is called with no arguments, it will return the current script’s logs. - -Otherwise, the fn, hostname/ip, and args… arguments can be used to get the logs from another script. Remember that scripts are uniquely identified by both their names and arguments. +Get all the logs of a script. Signature: @@ -32,6 +30,10 @@ Returns an string array, where each line is an element in the array. The most re RAM cost: 0 GB +Returns a script’s logs. The logs are returned as an array, where each line is an element in the array. The most recently logged line is at the end of the array. Note that there is a maximum number of lines that a script stores in its logs. This is configurable in the game’s options. If the function is called with no arguments, it will return the current script’s logs. + +Otherwise, the fn, hostname/ip, and args… arguments can be used to get the logs from another script. Remember that scripts are uniquely identified by both their names and arguments. + ## Example 1 diff --git a/markdown/bitburner.ns.getscriptram.md b/markdown/bitburner.ns.getscriptram.md index 8cf60a1a2..328fd2349 100644 --- a/markdown/bitburner.ns.getscriptram.md +++ b/markdown/bitburner.ns.getscriptram.md @@ -4,7 +4,7 @@ ## NS.getScriptRam() method -Returns the amount of RAM required to run the specified script on the target server. Returns 0 if the script does not exist. +Get the ram cost of a script. Signature: @@ -29,3 +29,5 @@ Amount of RAM required to run the specified script on the target server, and 0 i RAM cost: 0.1 GB +Returns the amount of RAM required to run the specified script on the target server. Returns 0 if the script does not exist. + diff --git a/markdown/bitburner.ns.getserverbasesecuritylevel.md b/markdown/bitburner.ns.getserverbasesecuritylevel.md deleted file mode 100644 index 9bfcb86a8..000000000 --- a/markdown/bitburner.ns.getserverbasesecuritylevel.md +++ /dev/null @@ -1,30 +0,0 @@ - - -[Home](./index.md) > [bitburner](./bitburner.md) > [NS](./bitburner.ns.md) > [getServerBaseSecurityLevel](./bitburner.ns.getserverbasesecuritylevel.md) - -## NS.getServerBaseSecurityLevel() method - -Returns the base security level of the target server. This is the security level that the server starts out with. This is different than getServerSecurityLevel because getServerSecurityLevel returns the current security level of a server, which can constantly change due to hack, grow, and weaken, calls on that server. The base security level will stay the same until you reset by installing an Augmentation(s). - -Signature: - -```typescript -getServerBaseSecurityLevel(host: string): number; -``` - -## Parameters - -| Parameter | Type | Description | -| --- | --- | --- | -| host | string | Host of target server. | - -Returns: - -number - -Base security level of the target server. - -## Remarks - -RAM cost: 0.1 GB - diff --git a/markdown/bitburner.ns.getservergrowth.md b/markdown/bitburner.ns.getservergrowth.md index cd56164f2..fa72c08ee 100644 --- a/markdown/bitburner.ns.getservergrowth.md +++ b/markdown/bitburner.ns.getservergrowth.md @@ -4,7 +4,7 @@ ## NS.getServerGrowth() method -Returns the server’s instrinsic “growth parameter”. This growth parameter is a number between 1 and 100 that represents how quickly the server’s money grows. This parameter affects the percentage by which the server’s money is increased when using the grow function. A higher growth parameter will result in a higher percentage increase from grow. +Get a server growth parameter. Signature: @@ -28,3 +28,5 @@ Parameter that affects the percentage by which the server’s money is increased RAM cost: 0.1 GB +Returns the server’s instrinsic “growth parameter”. This growth parameter is a number between 1 and 100 that represents how quickly the server’s money grows. This parameter affects the percentage by which the server’s money is increased when using the grow function. A higher growth parameter will result in a higher percentage increase from grow. + diff --git a/markdown/bitburner.ns.getservermaxmoney.md b/markdown/bitburner.ns.getservermaxmoney.md index 5365d6ef1..6302af323 100644 --- a/markdown/bitburner.ns.getservermaxmoney.md +++ b/markdown/bitburner.ns.getservermaxmoney.md @@ -4,7 +4,7 @@ ## NS.getServerMaxMoney() method -Returns the maximum amount of money that can be available on a server. +Get maximum money available on a server. Signature: @@ -28,3 +28,5 @@ Maximum amount of money available on the server. RAM cost: 0.1 GB +Returns the maximum amount of money that can be available on a server. + diff --git a/markdown/bitburner.ns.getservermoneyavailable.md b/markdown/bitburner.ns.getservermoneyavailable.md index 53d2b0aca..880977d3e 100644 --- a/markdown/bitburner.ns.getservermoneyavailable.md +++ b/markdown/bitburner.ns.getservermoneyavailable.md @@ -4,7 +4,7 @@ ## NS.getServerMoneyAvailable() method -Returns the amount of money available on a server. Running this function on the home computer will return the player’s money. +Get money available on a server. Signature: @@ -28,6 +28,8 @@ Amount of money available on the server. RAM cost: 0.1 GB +Returns the amount of money available on a server. Running this function on the home computer will return the player’s money. + ## Example diff --git a/markdown/bitburner.ns.getserverram.md b/markdown/bitburner.ns.getserverram.md deleted file mode 100644 index ce8b68768..000000000 --- a/markdown/bitburner.ns.getserverram.md +++ /dev/null @@ -1,39 +0,0 @@ - - -[Home](./index.md) > [bitburner](./bitburner.md) > [NS](./bitburner.ns.md) > [getServerRam](./bitburner.ns.getserverram.md) - -## NS.getServerRam() method - -Returns an array with two elements that gives information about a server’s memory (RAM). The first element in the array is the amount of RAM that the server has total (in GB). The second element in the array is the amount of RAM that is currently being used on the server (in GB). - -Signature: - -```typescript -getServerRam(host: string): [number, number]; -``` - -## Parameters - -| Parameter | Type | Description | -| --- | --- | --- | -| host | string | Host of target server. | - -Returns: - -\[number, number\] - -Array with total and used memory on the specified server. - -## Remarks - -RAM cost: 0.1 GB - -## Example - - -```ts -res = getServerRam("helios"); -totalRam = res[0]; -ramUsed = res[1]; -``` - diff --git a/markdown/bitburner.ns.getserversecuritylevel.md b/markdown/bitburner.ns.getserversecuritylevel.md index 26c2e3bf4..afcca10e3 100644 --- a/markdown/bitburner.ns.getserversecuritylevel.md +++ b/markdown/bitburner.ns.getserversecuritylevel.md @@ -4,7 +4,7 @@ ## NS.getServerSecurityLevel() method -Returns the security level of the target server. A server’s security level is denoted by a number, typically between 1 and 100 (but it can go above 100). +Get server security level. Signature: @@ -28,3 +28,5 @@ Security level of the target server. RAM cost: 0.1 GB +Returns the security level of the target server. A server’s security level is denoted by a number, typically between 1 and 100 (but it can go above 100). + diff --git a/markdown/bitburner.ns.getweakentime.md b/markdown/bitburner.ns.getweakentime.md index 704cf3156..4202ebf40 100644 --- a/markdown/bitburner.ns.getweakentime.md +++ b/markdown/bitburner.ns.getweakentime.md @@ -4,12 +4,12 @@ ## NS.getWeakenTime() method -Returns the amount of time in seconds it takes to execute the weaken() Netscript function on the target server. The function takes in an optional hackLvl parameter that can be specified to see what the weaken time would be at different hacking levels. +Get the execution time of a weaken() call. Signature: ```typescript -getWeakenTime(host: string, hackLvl?: number, intLvl?: number): number; +getWeakenTime(host: string): number; ``` ## Parameters @@ -17,8 +17,6 @@ getWeakenTime(host: string, hackLvl?: number, intLvl?: number): number; | Parameter | Type | Description | | --- | --- | --- | | host | string | Host of target server. | -| hackLvl | number | Optional hacking level for the calculation. Defaults to player’s current hacking level. | -| intLvl | number | Optional intelligence level for the calculation. Defaults to player’s current intelligence level. (Intelligence is unlocked after obtaining Source-File 5). | Returns: @@ -30,3 +28,5 @@ Returns the amount of time in seconds it takes to execute the grow Netscript fun RAM cost: 0.05 GB +Returns the amount of time in seconds it takes to execute the weaken() Netscript function on the target server. The function takes in an optional hackLvl parameter that can be specified to see what the weaken time would be at different hacking levels. + diff --git a/markdown/bitburner.ns.grow.md b/markdown/bitburner.ns.grow.md index dae3d6d51..ccf605382 100644 --- a/markdown/bitburner.ns.grow.md +++ b/markdown/bitburner.ns.grow.md @@ -27,7 +27,9 @@ The number by which the money on the server was multiplied for the growth. ## Remarks -RAM cost: 0.15 GB Use your hacking skills to increase the amount of money available on a server. The runtime for this command depends on your hacking level and the target server’s security level. When `grow` completes, the money available on a target server will be increased by a certain, fixed percentage. This percentage is determined by the target server’s growth rate (which varies between servers) and security level. Generally, higher-level servers have higher growth rates. The getServerGrowth() function can be used to obtain a server’s growth rate. +RAM cost: 0.15 GB + +Use your hacking skills to increase the amount of money available on a server. The runtime for this command depends on your hacking level and the target server’s security level. When `grow` completes, the money available on a target server will be increased by a certain, fixed percentage. This percentage is determined by the target server’s growth rate (which varies between servers) and security level. Generally, higher-level servers have higher growth rates. The getServerGrowth() function can be used to obtain a server’s growth rate. Like hack, `grow` can be called on any server, regardless of where the script is running. The grow() command requires root access to the target server, but there is no required hacking level to run the command. It also raises the security level of the target server by 0.004. diff --git a/markdown/bitburner.ns.growthanalyze.md b/markdown/bitburner.ns.growthanalyze.md index f745b04b0..31e11baa0 100644 --- a/markdown/bitburner.ns.growthanalyze.md +++ b/markdown/bitburner.ns.growthanalyze.md @@ -4,9 +4,7 @@ ## NS.growthAnalyze() method -This function returns the number of “growths” needed in order to increase the amount of money available on the specified server by the specified amount. The specified amount is multiplicative and is in decimal form, not percentage. - -Warning: The value returned by this function isn’t necessarily a whole number. +Calculate the number of grow thread needed to grow a server by a certain multiplier. Signature: @@ -31,6 +29,10 @@ The amount of grow calls needed to grow the specified server by the specified am RAM cost: 1 GB +This function returns the number of “growths” needed in order to increase the amount of money available on the specified server by the specified amount. The specified amount is multiplicative and is in decimal form, not percentage. + +Warning: The value returned by this function isn’t necessarily a whole number. + ## Example diff --git a/markdown/bitburner.ns.growthanalyzesecurity.md b/markdown/bitburner.ns.growthanalyzesecurity.md index 936459682..f15dd4d2c 100644 --- a/markdown/bitburner.ns.growthanalyzesecurity.md +++ b/markdown/bitburner.ns.growthanalyzesecurity.md @@ -4,7 +4,7 @@ ## NS.growthAnalyzeSecurity() method -Returns the security increase that would occur if a grow with this many threads happened. +Calculate the security increase for a number of thread. Signature: @@ -28,3 +28,5 @@ The security increase. RAM cost: 1 GB +Returns the security increase that would occur if a grow with this many threads happened. + diff --git a/markdown/bitburner.ns.hack.md b/markdown/bitburner.ns.hack.md index a90d5d872..55ef62aeb 100644 --- a/markdown/bitburner.ns.hack.md +++ b/markdown/bitburner.ns.hack.md @@ -27,7 +27,9 @@ The amount of money stolen if the hack is successful, and zero otherwise. ## Remarks -RAM cost: 0.1 GB Function that is used to try and hack servers to steal money and gain hacking experience. The runtime for this command depends on your hacking level and the target server’s security level. In order to hack a server you must first gain root access to that server and also have the required hacking level. +RAM cost: 0.1 GB + +Function that is used to try and hack servers to steal money and gain hacking experience. The runtime for this command depends on your hacking level and the target server’s security level. In order to hack a server you must first gain root access to that server and also have the required hacking level. A script can hack a server from anywhere. It does not need to be running on the same server to hack that server. For example, you can create a script that hacks the `foodnstuff` server and run that script on any server in the game. diff --git a/markdown/bitburner.ns.hackanalyzepercent.md b/markdown/bitburner.ns.hackanalyzepercent.md index e93fc4d5a..abb4ad14b 100644 --- a/markdown/bitburner.ns.hackanalyzepercent.md +++ b/markdown/bitburner.ns.hackanalyzepercent.md @@ -4,7 +4,7 @@ ## NS.hackAnalyzePercent() method -Returns the percentage of the specified server’s money you will steal with a single hack. This value is returned in percentage form, not decimal (Netscript functions typically return in decimal form, but not this one). +Get the percent of money stolen with a single thread. Signature: @@ -28,6 +28,8 @@ The percentage of money you will steal from the target server with a single hack RAM cost: 1 GB +Returns the percentage of the specified server’s money you will steal with a single hack. This value is returned in percentage form, not decimal (Netscript functions typically return in decimal form, but not this one). + ## Example diff --git a/markdown/bitburner.ns.hackanalyzesecurity.md b/markdown/bitburner.ns.hackanalyzesecurity.md index 2cd08b708..b74c28f0a 100644 --- a/markdown/bitburner.ns.hackanalyzesecurity.md +++ b/markdown/bitburner.ns.hackanalyzesecurity.md @@ -4,7 +4,7 @@ ## NS.hackAnalyzeSecurity() method -Returns the security increase that would occur if a hack with this many threads happened. +Get the security increase for a number of thread. Signature: @@ -28,3 +28,5 @@ The security increase. RAM cost: 1 GB +Returns the security increase that would occur if a hack with this many threads happened. + diff --git a/markdown/bitburner.ns.hackanalyzethreads.md b/markdown/bitburner.ns.hackanalyzethreads.md index e01ea74b3..ef07429c2 100644 --- a/markdown/bitburner.ns.hackanalyzethreads.md +++ b/markdown/bitburner.ns.hackanalyzethreads.md @@ -27,7 +27,9 @@ The number of threads needed to hack the server for hackAmount money. ## Remarks -RAM cost: 1 GB This function returns the number of script threads you need when running the hack command to steal the specified amount of money from the target server. If hackAmount is less than zero or greater than the amount of money available on the server, then this function returns -1. +RAM cost: 1 GB + +This function returns the number of script threads you need when running the hack command to steal the specified amount of money from the target server. If hackAmount is less than zero or greater than the amount of money available on the server, then this function returns -1. Warning: The value returned by this function isn’t necessarily a whole number. diff --git a/markdown/bitburner.ns.hackchance.md b/markdown/bitburner.ns.hackchance.md index d731727c7..aea9181a1 100644 --- a/markdown/bitburner.ns.hackchance.md +++ b/markdown/bitburner.ns.hackchance.md @@ -4,9 +4,7 @@ ## NS.hackChance() method -Returns the chance you have of successfully hacking the specified server. - -This returned value is in decimal form, not percentage. +Get the chance of successfully hacking a server. Signature: @@ -30,3 +28,7 @@ The chance you have of successfully hacking the target server. RAM cost: 1 GB +Returns the chance you have of successfully hacking the specified server. + +This returned value is in decimal form, not percentage. + diff --git a/markdown/bitburner.ns.hasrootaccess.md b/markdown/bitburner.ns.hasrootaccess.md index a82c57787..bf9a67180 100644 --- a/markdown/bitburner.ns.hasrootaccess.md +++ b/markdown/bitburner.ns.hasrootaccess.md @@ -4,7 +4,7 @@ ## NS.hasRootAccess() method -Returns a boolean indicating whether or not the player has root access to the specified target server. +Check if your have root access on a server. Signature: @@ -28,6 +28,8 @@ True if player has root access to the specified target server, and false otherwi RAM cost: 0.05 GB +Returns a boolean indicating whether or not the player has root access to the specified target server. + ## Example diff --git a/markdown/bitburner.ns.httpworm.md b/markdown/bitburner.ns.httpworm.md index 2a3a21b59..e5e83ca75 100644 --- a/markdown/bitburner.ns.httpworm.md +++ b/markdown/bitburner.ns.httpworm.md @@ -4,7 +4,7 @@ ## NS.httpworm() method -Runs the HTTPWorm.exe program on the target server. HTTPWorm.exe must exist on your home computer. +Runs HTTPWorm.exe on a server. Signature: @@ -26,6 +26,8 @@ void RAM cost: 0.05 GB +Runs the HTTPWorm.exe program on the target server. HTTPWorm.exe must exist on your home computer. + ## Example diff --git a/markdown/bitburner.ns.isrunning.md b/markdown/bitburner.ns.isrunning.md index 130d5d340..aaf1dc0ab 100644 --- a/markdown/bitburner.ns.isrunning.md +++ b/markdown/bitburner.ns.isrunning.md @@ -4,7 +4,7 @@ ## NS.isRunning() method -Returns a boolean indicating whether the specified script is running on the target server. Remember that a script is uniquely identified by both its name and its arguments. +Check if a script is running. Signature: @@ -30,6 +30,8 @@ True if specified script is running on the target server, and false otherwise. RAM cost: 0.1 GB +Returns a boolean indicating whether the specified script is running on the target server. Remember that a script is uniquely identified by both its name and its arguments. + ## Example 1 diff --git a/markdown/bitburner.ns.kill.md b/markdown/bitburner.ns.kill.md index 6e6969881..01da7719c 100644 --- a/markdown/bitburner.ns.kill.md +++ b/markdown/bitburner.ns.kill.md @@ -4,7 +4,7 @@ ## NS.kill() method -Kills the script on the target server specified by the script’s name and arguments. Remember that scripts are uniquely identified by both their name and arguments. For example, if `foo.script` is run with the argument 1, then this is not the same as `foo.script` run with the argument 2, even though they have the same code. +Terminate another script. Signature: @@ -30,6 +30,8 @@ True if the script is successfully killed, and false otherwise. RAM cost: 0.5 GB +Kills the script on the target server specified by the script’s name and arguments. Remember that scripts are uniquely identified by both their name and arguments. For example, if `foo.script` is run with the argument 1, then this is not the same as `foo.script` run with the argument 2, even though they have the same code. + ## Example 1 diff --git a/markdown/bitburner.ns.kill_1.md b/markdown/bitburner.ns.kill_1.md index f296ffe57..4d0847763 100644 --- a/markdown/bitburner.ns.kill_1.md +++ b/markdown/bitburner.ns.kill_1.md @@ -4,7 +4,7 @@ ## NS.kill() method -Kills the script with the specified PID. Killing a script by its PID will typically have better performance, especially if you have many scripts running. If this function successfully kills the specified script, then it will return true. Otherwise, it will return false. +Terminate another script. Signature: @@ -28,6 +28,8 @@ True if the script is successfully killed, and false otherwise. RAM cost: 0.5 GB +Kills the script with the specified PID. Killing a script by its PID will typically have better performance, especially if you have many scripts running. If this function successfully kills the specified script, then it will return true. Otherwise, it will return false. + ## Example diff --git a/markdown/bitburner.ns.killall.md b/markdown/bitburner.ns.killall.md index ebff99bb4..02b4b5403 100644 --- a/markdown/bitburner.ns.killall.md +++ b/markdown/bitburner.ns.killall.md @@ -4,7 +4,7 @@ ## NS.killall() method -Kills all running scripts on the specified server. This function returns true if any scripts were killed, and false otherwise. In other words, it will return true if there are any scripts running on the target server. +Terminate all scripts on a server. Signature: @@ -28,3 +28,5 @@ True if any scripts were killed, and false otherwise. RAM cost: 0.5 GB +Kills all running scripts on the specified server. This function returns true if any scripts were killed, and false otherwise. In other words, it will return true if there are any scripts running on the target server. + diff --git a/markdown/bitburner.ns.ls.md b/markdown/bitburner.ns.ls.md index 26c4f7f6f..a51eac7d4 100644 --- a/markdown/bitburner.ns.ls.md +++ b/markdown/bitburner.ns.ls.md @@ -4,7 +4,7 @@ ## NS.ls() method -Returns an array with the filenames of all files on the specified server (as strings). The returned array is sorted in alphabetic order. +List files on a server. Signature: @@ -29,3 +29,5 @@ Array with the filenames of all files on the specified server. RAM cost: 0.2 GB +Returns an array with the filenames of all files on the specified server (as strings). The returned array is sorted in alphabetic order. + diff --git a/markdown/bitburner.ns.md b/markdown/bitburner.ns.md index 5d341a9b5..4cc92cc36 100644 --- a/markdown/bitburner.ns.md +++ b/markdown/bitburner.ns.md @@ -29,89 +29,87 @@ export interface NS extends Singularity | Method | Description | | --- | --- | -| [brutessh(host)](./bitburner.ns.brutessh.md) | Runs the BruteSSH.exe program on the target server. BruteSSH.exe must exist on your home computer. | -| [clear(handle)](./bitburner.ns.clear.md) | This function is used to clear data in a Netscript Ports or a text file.If the port/fn argument is a number between 1 and 20, then it specifies a port and will clear it (deleting all data from the underlying queue).If the port/fn argument is a string, then it specifies the name of a text file (.txt) and will delete all data from that text file. | +| [brutessh(host)](./bitburner.ns.brutessh.md) | Runs BruteSSH.exe on a server. | +| [clear(handle)](./bitburner.ns.clear.md) | Clear data from a port. | | [clearLog()](./bitburner.ns.clearlog.md) | Clears the script’s logs. | -| [deleteServer(host)](./bitburner.ns.deleteserver.md) | Deletes one of your purchased servers, which is specified by its hostname.The hostname argument can be any data type, but it will be converted to a string. Whitespace is automatically removed from the string. This function will not delete a server that still has scripts running on it. | +| [deleteServer(host)](./bitburner.ns.deleteserver.md) | Delete a purchased server. | | [disableLog(fn)](./bitburner.ns.disablelog.md) | Disables logging for the given function. | -| [enableLog(fn)](./bitburner.ns.enablelog.md) | Re-enables logging for the given function. If ALL is passed into this function as an argument, then it will revert the effects of disableLog(ALL). | -| [exec(script, host, numThreads, args)](./bitburner.ns.exec.md) | Run a script as a separate process on a specified server. This is similar to the run function except that it can be used to run a script on any server, instead of just the current server.If the script was successfully started, then this functions returns the PID of that script. Otherwise, it returns 0.PID stands for Process ID. The PID is a unique identifier for each script. The PID will always be a positive integer.Running this function with a numThreads argument of 0 will return 0 without running the script. However, running this function with a negative numThreads argument will cause a runtime error. | +| [enableLog(fn)](./bitburner.ns.enablelog.md) | Enable logging for a certain function. | +| [exec(script, host, numThreads, args)](./bitburner.ns.exec.md) | Start another script on any server. | | [exit()](./bitburner.ns.exit.md) | Terminates the current script immediately. | -| [fileExists(filename, host)](./bitburner.ns.fileexists.md) | Returns a boolean indicating whether the specified file exists on the target server. The filename for scripts is case-sensitive, but for other types of files it is not. For example, fileExists(“brutessh.exe”) will work fine, even though the actual program is named 'BruteSSH.exe'.If the hostname/ip argument is omitted, then the function will search through the current server (the server running the script that calls this function) for the file. | -| [ftpcrack(host)](./bitburner.ns.ftpcrack.md) | Runs the FTPCrack.exe program on the target server. FTPCrack.exe must exist on your home computer. | -| [getBitNodeMultipliers()](./bitburner.ns.getbitnodemultipliers.md) | Returns an object containing the current BitNode multipliers. This function requires Source-File 5 in order to run. The multipliers are returned in decimal forms (e.g. 1.5 instead of 150%). The multipliers represent the difference between the current BitNode and the original BitNode (BitNode-1).For example, if the CrimeMoney multiplier has a value of 0.1, then that means that committing crimes in the current BitNode will only give 10% of the money you would have received in BitNode-1. | +| [fileExists(filename, host)](./bitburner.ns.fileexists.md) | Check if a file exists. | +| [ftpcrack(host)](./bitburner.ns.ftpcrack.md) | Runs FTPCrack.exe on a server. | +| [getBitNodeMultipliers()](./bitburner.ns.getbitnodemultipliers.md) | Get the current Bitnode multipliers. | | [getFavorToDonate()](./bitburner.ns.getfavortodonate.md) | Returns the amount of Faction favor required to be able to donate to a faction. | -| [getGrowTime(host, hackLvl, intLvl)](./bitburner.ns.getgrowtime.md) | Returns the amount of time in seconds it takes to execute the grow Netscript function on the target server. The function takes in an optional hackLvl parameter that can be specified to see what the grow time would be at different hacking levels. | +| [getGrowTime(host)](./bitburner.ns.getgrowtime.md) | Get the execution time of a grow() call. | | [getHackingLevel()](./bitburner.ns.gethackinglevel.md) | Returns the player’s current hacking level. | -| [getHackingMultipliers()](./bitburner.ns.gethackingmultipliers.md) | Returns an object containing the Player’s hacking related multipliers. These multipliers are returned in fractional forms, not percentages (e.g. 1.5 instead of 150%). | -| [getHacknetMultipliers()](./bitburner.ns.gethacknetmultipliers.md) | Returns an object containing the Player’s hacknet related multipliers. These multipliers are returned in fractional forms, not percentages (e.g. 1.5 instead of 150%). | -| [getHackTime(host, hackLvl, intLvl)](./bitburner.ns.gethacktime.md) | Returns the amount of time in seconds it takes to execute the hack Netscript function on the target server. The function takes in an optional hackLvl parameter that can be specified to see what the hack time would be at different hacking levels. | +| [getHackingMultipliers()](./bitburner.ns.gethackingmultipliers.md) | Get hacking related multipliers. | +| [getHacknetMultipliers()](./bitburner.ns.gethacknetmultipliers.md) | Get hacknet related multipliers. | +| [getHackTime(host)](./bitburner.ns.gethacktime.md) | Get the execution time of a hack() call. | | [getHostname()](./bitburner.ns.gethostname.md) | Returns a string with the hostname of the server that the script is running on. | -| [getPortHandle(port)](./bitburner.ns.getporthandle.md) | Get a handle to a Netscript Port.WARNING: Port Handles only work in NetscriptJS (Netscript 2.0). They will not work in Netscript 1.0. | -| [getPurchasedServerCost(ram)](./bitburner.ns.getpurchasedservercost.md) | Returns the cost to purchase a server with the specified amount of ram. | +| [getPortHandle(port)](./bitburner.ns.getporthandle.md) | Get all data on a port. | +| [getPurchasedServerCost(ram)](./bitburner.ns.getpurchasedservercost.md) | Get cost of purchasing a server. | | [getPurchasedServerLimit()](./bitburner.ns.getpurchasedserverlimit.md) | Returns the maximum number of servers you can purchase. | | [getPurchasedServerMaxRam()](./bitburner.ns.getpurchasedservermaxram.md) | Returns the maximum RAM that a purchased server can have. | | [getPurchasedServers(hostnameMode)](./bitburner.ns.getpurchasedservers.md) | Returns an array with either the hostnames or IPs of all of the servers you have purchased. | -| [getScriptExpGain(script, host, args)](./bitburner.ns.getscriptexpgain.md) | Returns the amount of hacking experience the specified script generates while online (when the game is open, does not apply for offline experience gains). Remember that a script is uniquely identified by both its name and its arguments.This function can also return the total experience gain rate of all of your active scripts by running the function with no arguments. | -| [getScriptIncome(script, host, args)](./bitburner.ns.getscriptincome.md) | Returns the amount of income the specified script generates while online (when the game is open, does not apply for offline income). Remember that a script is uniquely identified by both its name and its arguments. So for example if you ran a script with the arguments “foodnstuff” and “5” then in order to use this function to get that script’s income you must specify those same arguments in the same order in this function call.This function can also be called with no arguments. If called with no arguments, then this function will return an array of two values. The first value is the total income (dollar / second) of all of your active scripts (scripts that are currently running on any server). The second value is the total income (dollar / second) that you’ve earned from scripts since you last installed Augmentations. | -| [getScriptLogs(fn, host, args)](./bitburner.ns.getscriptlogs.md) | Returns a script’s logs. The logs are returned as an array, where each line is an element in the array. The most recently logged line is at the end of the array. Note that there is a maximum number of lines that a script stores in its logs. This is configurable in the game’s options. If the function is called with no arguments, it will return the current script’s logs.Otherwise, the fn, hostname/ip, and args… arguments can be used to get the logs from another script. Remember that scripts are uniquely identified by both their names and arguments. | +| [getScriptExpGain(script, host, args)](./bitburner.ns.getscriptexpgain.md) | Get the exp gain of a script. | +| [getScriptIncome(script, host, args)](./bitburner.ns.getscriptincome.md) | Get the income of a script. | +| [getScriptLogs(fn, host, args)](./bitburner.ns.getscriptlogs.md) | Get all the logs of a script. | | [getScriptName()](./bitburner.ns.getscriptname.md) | Returns the current script name. | -| [getScriptRam(script, host)](./bitburner.ns.getscriptram.md) | Returns the amount of RAM required to run the specified script on the target server. Returns 0 if the script does not exist. | +| [getScriptRam(script, host)](./bitburner.ns.getscriptram.md) | Get the ram cost of a script. | | [getServer(host)](./bitburner.ns.getserver.md) | Returns a server object for the given server. Defaults to the running script's server if host is not specified. | -| [getServerBaseSecurityLevel(host)](./bitburner.ns.getserverbasesecuritylevel.md) | Returns the base security level of the target server. This is the security level that the server starts out with. This is different than getServerSecurityLevel because getServerSecurityLevel returns the current security level of a server, which can constantly change due to hack, grow, and weaken, calls on that server. The base security level will stay the same until you reset by installing an Augmentation(s). | -| [getServerGrowth(host)](./bitburner.ns.getservergrowth.md) | Returns the server’s instrinsic “growth parameter”. This growth parameter is a number between 1 and 100 that represents how quickly the server’s money grows. This parameter affects the percentage by which the server’s money is increased when using the grow function. A higher growth parameter will result in a higher percentage increase from grow. | -| [getServerMaxMoney(host)](./bitburner.ns.getservermaxmoney.md) | Returns the maximum amount of money that can be available on a server. | +| [getServerGrowth(host)](./bitburner.ns.getservergrowth.md) | Get a server growth parameter. | +| [getServerMaxMoney(host)](./bitburner.ns.getservermaxmoney.md) | Get maximum money available on a server. | | [getServerMinSecurityLevel(host)](./bitburner.ns.getserverminsecuritylevel.md) | Returns the minimum security level of the target server. | -| [getServerMoneyAvailable(host)](./bitburner.ns.getservermoneyavailable.md) | Returns the amount of money available on a server. Running this function on the home computer will return the player’s money. | +| [getServerMoneyAvailable(host)](./bitburner.ns.getservermoneyavailable.md) | Get money available on a server. | | [getServerNumPortsRequired(host)](./bitburner.ns.getservernumportsrequired.md) | Returns the number of open ports required to successfully run NUKE.exe on the specified server. | -| [getServerRam(host)](./bitburner.ns.getserverram.md) | Returns an array with two elements that gives information about a server’s memory (RAM). The first element in the array is the amount of RAM that the server has total (in GB). The second element in the array is the amount of RAM that is currently being used on the server (in GB). | | [getServerRequiredHackingLevel(host)](./bitburner.ns.getserverrequiredhackinglevel.md) | Returns the required hacking level of the target server. | -| [getServerSecurityLevel(host)](./bitburner.ns.getserversecuritylevel.md) | Returns the security level of the target server. A server’s security level is denoted by a number, typically between 1 and 100 (but it can go above 100). | +| [getServerSecurityLevel(host)](./bitburner.ns.getserversecuritylevel.md) | Get server security level. | | [getTimeSinceLastAug()](./bitburner.ns.gettimesincelastaug.md) | Returns the amount of time in milliseconds that have passed since you last installed Augmentations. | -| [getWeakenTime(host, hackLvl, intLvl)](./bitburner.ns.getweakentime.md) | Returns the amount of time in seconds it takes to execute the weaken() Netscript function on the target server. The function takes in an optional hackLvl parameter that can be specified to see what the weaken time would be at different hacking levels. | +| [getWeakenTime(host)](./bitburner.ns.getweakentime.md) | Get the execution time of a weaken() call. | | [grow(host, opts)](./bitburner.ns.grow.md) | Spoof money in a servers bank account, increasing the amount available. | -| [growthAnalyze(host, growthAmount)](./bitburner.ns.growthanalyze.md) | This function returns the number of “growths” needed in order to increase the amount of money available on the specified server by the specified amount. The specified amount is multiplicative and is in decimal form, not percentage.Warning: The value returned by this function isn’t necessarily a whole number. | -| [growthAnalyzeSecurity(threads)](./bitburner.ns.growthanalyzesecurity.md) | Returns the security increase that would occur if a grow with this many threads happened. | +| [growthAnalyze(host, growthAmount)](./bitburner.ns.growthanalyze.md) | Calculate the number of grow thread needed to grow a server by a certain multiplier. | +| [growthAnalyzeSecurity(threads)](./bitburner.ns.growthanalyzesecurity.md) | Calculate the security increase for a number of thread. | | [hack(host, opts)](./bitburner.ns.hack.md) | Steal a servers money. | -| [hackAnalyzePercent(host)](./bitburner.ns.hackanalyzepercent.md) | Returns the percentage of the specified server’s money you will steal with a single hack. This value is returned in percentage form, not decimal (Netscript functions typically return in decimal form, but not this one). | -| [hackAnalyzeSecurity(threads)](./bitburner.ns.hackanalyzesecurity.md) | Returns the security increase that would occur if a hack with this many threads happened. | +| [hackAnalyzePercent(host)](./bitburner.ns.hackanalyzepercent.md) | Get the percent of money stolen with a single thread. | +| [hackAnalyzeSecurity(threads)](./bitburner.ns.hackanalyzesecurity.md) | Get the security increase for a number of thread. | | [hackAnalyzeThreads(host, hackAmount)](./bitburner.ns.hackanalyzethreads.md) | Predict the effect of hack. | -| [hackChance(host)](./bitburner.ns.hackchance.md) | Returns the chance you have of successfully hacking the specified server.This returned value is in decimal form, not percentage. | -| [hasRootAccess(host)](./bitburner.ns.hasrootaccess.md) | Returns a boolean indicating whether or not the player has root access to the specified target server. | -| [httpworm(host)](./bitburner.ns.httpworm.md) | Runs the HTTPWorm.exe program on the target server. HTTPWorm.exe must exist on your home computer. | +| [hackChance(host)](./bitburner.ns.hackchance.md) | Get the chance of successfully hacking a server. | +| [hasRootAccess(host)](./bitburner.ns.hasrootaccess.md) | Check if your have root access on a server. | +| [httpworm(host)](./bitburner.ns.httpworm.md) | Runs HTTPWorm.exe on a server. | | [isLogEnabled(fn)](./bitburner.ns.islogenabled.md) | Checks the status of the logging for the given function. | -| [isRunning(script, host, args)](./bitburner.ns.isrunning.md) | Returns a boolean indicating whether the specified script is running on the target server. Remember that a script is uniquely identified by both its name and its arguments. | -| [kill(script, host, args)](./bitburner.ns.kill.md) | Kills the script on the target server specified by the script’s name and arguments. Remember that scripts are uniquely identified by both their name and arguments. For example, if foo.script is run with the argument 1, then this is not the same as foo.script run with the argument 2, even though they have the same code. | -| [kill(scriptPid)](./bitburner.ns.kill_1.md) | Kills the script with the specified PID. Killing a script by its PID will typically have better performance, especially if you have many scripts running. If this function successfully kills the specified script, then it will return true. Otherwise, it will return false. | -| [killall(host)](./bitburner.ns.killall.md) | Kills all running scripts on the specified server. This function returns true if any scripts were killed, and false otherwise. In other words, it will return true if there are any scripts running on the target server. | -| [ls(host, grep)](./bitburner.ns.ls.md) | Returns an array with the filenames of all files on the specified server (as strings). The returned array is sorted in alphabetic order. | -| [nFormat(n, format)](./bitburner.ns.nformat.md) | Converts a number into a string with the specified formatter. This uses the numeraljs library, so the formatters must be compatible with that. This is the same function that the game itself uses to display numbers. | -| [nuke(host)](./bitburner.ns.nuke.md) | Runs the NUKE.exe program on the target server. NUKE.exe must exist on your home computer. | -| [peek(port)](./bitburner.ns.peek.md) | This function is used to peek at the data from a port. It returns the first element in the specified port without removing that element. If the port is empty, the string “NULL PORT DATA” will be returned. | +| [isRunning(script, host, args)](./bitburner.ns.isrunning.md) | Check if a script is running. | +| [kill(script, host, args)](./bitburner.ns.kill.md) | Terminate another script. | +| [kill(scriptPid)](./bitburner.ns.kill_1.md) | Terminate another script. | +| [killall(host)](./bitburner.ns.killall.md) | Terminate all scripts on a server. | +| [ls(host, grep)](./bitburner.ns.ls.md) | List files on a server. | +| [nFormat(n, format)](./bitburner.ns.nformat.md) | Format a number | +| [nuke(host)](./bitburner.ns.nuke.md) | Runs NUKE.exe on a server. | +| [peek(port)](./bitburner.ns.peek.md) | Get a copy of the data from a port without popping it. | | [print(msg)](./bitburner.ns.print.md) | Prints a value or a variable to the script’s logs. | -| [prompt(txt)](./bitburner.ns.prompt.md) | Prompts the player with a dialog box with two options: “Yes” and “No”. This function will return true if the player click “Yes” and false if the player clicks “No”. The script’s execution is halted until the player selects one of the options. | -| [ps(host)](./bitburner.ns.ps.md) | Returns an array with general information about all scripts running on the specified target server. | -| [purchaseServer(hostname, ram)](./bitburner.ns.purchaseserver.md) | Purchased a server with the specified hostname and amount of RAM.The hostname argument can be any data type, but it will be converted to a string and have whitespace removed. Anything that resolves to an empty string will cause the function to fail. If there is already a server with the specified hostname, then the function will automatically append a number at the end of the hostname argument value until it finds a unique hostname. For example, if the script calls purchaseServer(“foo”, 4) but a server named “foo” already exists, the it will automatically change the hostname to foo-0. If there is already a server with the hostname foo-0, then it will change the hostname to foo-1, and so on.Note that there is a maximum limit to the amount of servers you can purchase.Returns the hostname of the newly purchased server as a string. If the function fails to purchase a server, then it will return an empty string. The function will fail if the arguments passed in are invalid, if the player does not have enough money to purchase the specified server, or if the player has exceeded the maximum amount of servers. | -| [read(handle)](./bitburner.ns.read.md) | This function is used to read data from a port or from a text file (.txt).If the argument port/fn is a number between 1 and 20, then it specifies a port and it will read data from that port. A port is a serialized queue. This function will remove the first element from that queue and return it. If the queue is empty, then the string “NULL PORT DATA” will be returned.If the argument port/fn is a string, then it specifies the name of a text file (.txt) and this function will return the data in the specified text file. If the text file does not exist, an empty string will be returned. | -| [relaysmtp(host)](./bitburner.ns.relaysmtp.md) | Runs the relaySMTP.exe program on the target server. relaySMTP.exe must exist on your home computer. | -| [rm(name, host)](./bitburner.ns.rm.md) | Removes the specified file from the current server. This function works for every file type except message (.msg) files. | -| [run(script, numThreads, args)](./bitburner.ns.run.md) | Run a script as a separate process. This function can only be used to run scripts located on the current server (the server running the script that calls this function). Requires a significant amount of RAM to run this command.If the script was successfully started, then this functions returns the PID of that script. Otherwise, it returns 0.PID stands for Process ID. The PID is a unique identifier for each script. The PID will always be a positive integer.Running this function with a numThreads argument of 0 will return 0 without running the script. However, running this function with a negative numThreads argument will cause a runtime error. | -| [scan(host, hostnames)](./bitburner.ns.scan.md) | Returns an array containing the hostnames or IPs of all servers that are one node way from the specified target server. The hostnames/IPs in the returned array are strings. | -| [scp(files, destination)](./bitburner.ns.scp.md) | Copies a script or literature (.lit) file(s) to another server. The files argument can be either a string specifying a single file to copy, or an array of strings specifying multiple files to copy. | -| [scp(files, source, destination)](./bitburner.ns.scp_1.md) | Copies a script or literature (.lit) file(s) to another server. The files argument can be either a string specifying a single file to copy, or an array of strings specifying multiple files to copy. | -| [scriptKill(script, host)](./bitburner.ns.scriptkill.md) | Kills all scripts with the specified filename on the target server specified by hostname, regardless of arguments. | -| [scriptRunning(script, host)](./bitburner.ns.scriptrunning.md) | Returns a boolean indicating whether any instance of the specified script is running on the target server, regardless of its arguments.This is different than the isRunning function because it does not try to identify a specific instance of a running script by its arguments. | +| [prompt(txt)](./bitburner.ns.prompt.md) | Prompt the player with a Yes/No modal. | +| [ps(host)](./bitburner.ns.ps.md) | List running scripts on a server. | +| [purchaseServer(hostname, ram)](./bitburner.ns.purchaseserver.md) | Purchase a server. | +| [read(handle)](./bitburner.ns.read.md) | Read content of a file. | +| [relaysmtp(host)](./bitburner.ns.relaysmtp.md) | Runs relaySMTP.exe on a server. | +| [rm(name, host)](./bitburner.ns.rm.md) | Delete a file. | +| [run(script, numThreads, args)](./bitburner.ns.run.md) | Start another script on the current server. | +| [scan(host, hostnames)](./bitburner.ns.scan.md) | Get the list servers connected to a server. | +| [scp(files, destination)](./bitburner.ns.scp.md) | Copy file between servers. | +| [scp(files, source, destination)](./bitburner.ns.scp_1.md) | Copy file between servers. | +| [scriptKill(script, host)](./bitburner.ns.scriptkill.md) | Kill all scripts with a filename. | +| [scriptRunning(script, host)](./bitburner.ns.scriptrunning.md) | Check if any script with a filename is running. | | [serverExists(host)](./bitburner.ns.serverexists.md) | Returns a boolean denoting whether or not the specified server exists. | | [sleep(millis)](./bitburner.ns.sleep.md) | Suspends the script for n milliseconds. | -| [spawn(script, numThreads, args)](./bitburner.ns.spawn.md) | Terminates the current script, and then after a delay of about 10 seconds it will execute the newly-specified script. The purpose of this function is to execute a new script without being constrained by the RAM usage of the current one. This function can only be used to run scripts on the local server.Because this function immediately terminates the script, it does not have a return value. | -| [sprintf(format, args)](./bitburner.ns.sprintf.md) | Complete open source JavaScript sprintf implementation | -| [sqlinject(host)](./bitburner.ns.sqlinject.md) | Runs the SQLInject.exe program on the target server. SQLInject.exe must exist on your home computer. | -| [tail(fn, host, args)](./bitburner.ns.tail.md) | Opens a script’s logs. This is functionally the same as the tail Terminal command.If the function is called with no arguments, it will open the current script’s logs.Otherwise, the fn, hostname/ip, and args… arguments can be used to get the logs from another script. Remember that scripts are uniquely identified by both their names and arguments. | +| [spawn(script, numThreads, args)](./bitburner.ns.spawn.md) | Terminate current script and start another in 10s. | +| [sprintf(format, args)](./bitburner.ns.sprintf.md) | Format a string. | +| [sqlinject(host)](./bitburner.ns.sqlinject.md) | Runs SQLInject.exe on a server. | +| [tail(fn, host, args)](./bitburner.ns.tail.md) | Open the tail window of a script. | | [tprint(msg)](./bitburner.ns.tprint.md) | Prints a value or a variable to the Terminal. | -| [tryWrite(port, data)](./bitburner.ns.trywrite.md) | Attempts to write data to the specified Netscript Port. If the port is full, the data will not be written. Otherwise, the data will be written normally. | -| [vsprintf(format, args)](./bitburner.ns.vsprintf.md) | Complete open source JavaScript sprintf implementation | +| [tryWrite(port, data)](./bitburner.ns.trywrite.md) | Attempt to write to a port. | +| [vsprintf(format, args)](./bitburner.ns.vsprintf.md) | Format a string with an array of arguments. | | [weaken(host, opts)](./bitburner.ns.weaken.md) | Reduce a server security level. | | [weakenAnalyze(threads, cores)](./bitburner.ns.weakenanalyze.md) | Predict the effect of weaken. | -| [wget(url, target, host)](./bitburner.ns.wget.md) | Retrieves data from a URL and downloads it to a file on the specified server. The data can only be downloaded to a script (.script, .ns, .js) or a text file (.txt). If the file already exists, it will be overwritten by this command. Note that it will not be possible to download data from many websites because they do not allow cross-origin resource sharing (CORS).IMPORTANT: This is an asynchronous function that returns a Promise. The Promise’s resolved value will be a boolean indicating whether or not the data was successfully retrieved from the URL. Because the function is async and returns a Promise, it is recommended you use wget in NetscriptJS (Netscript 2.0).In NetscriptJS, you must preface any call to wget with the await keyword (like you would hack or sleep). wget will still work in Netscript 1.0, but the functions execution will not be synchronous (i.e. it may not execute when you expect/want it to). Furthermore, since Promises are not supported in ES5, you will not be able to process the returned value of wget in Netscript 1.0. | -| [write(handle, data, mode)](./bitburner.ns.write.md) | This function can be used to either write data to a port or to a text file (.txt).If the first argument is a number between 1 and 20, then it specifies a port and this function will write data to that port. The third argument, mode, is not used when writing to a port.If the first argument is a string, then it specifies the name of a text file (.txt) and this function will write data to that text file. If the specified text file does not exist, then it will be created. The third argument mode, defines how the data will be written to the text file. If \*mode is set to “w”, then the data is written in “write” mode which means that it will overwrite all existing data on the text file. If mode is set to any other value then the data will be written in “append” mode which means that the data will be added at the end of the text file. | +| [wget(url, target, host)](./bitburner.ns.wget.md) | Download a file from the internet. | +| [write(handle, data, mode)](./bitburner.ns.write.md) | Write data to a file. | diff --git a/markdown/bitburner.ns.nformat.md b/markdown/bitburner.ns.nformat.md index a624caec8..aa2b7e561 100644 --- a/markdown/bitburner.ns.nformat.md +++ b/markdown/bitburner.ns.nformat.md @@ -4,7 +4,7 @@ ## NS.nFormat() method -Converts a number into a string with the specified formatter. This uses the numeraljs library, so the formatters must be compatible with that. This is the same function that the game itself uses to display numbers. +Format a number Signature: @@ -29,3 +29,7 @@ Formated number. RAM cost: 0 GB +Converts a number into a string with the specified formatter. This uses the numeraljs library, so the formatters must be compatible with that. This is the same function that the game itself uses to display numbers. + +see: http://numeraljs.com/ + diff --git a/markdown/bitburner.ns.nuke.md b/markdown/bitburner.ns.nuke.md index 55bae0a74..ddbd8ddbc 100644 --- a/markdown/bitburner.ns.nuke.md +++ b/markdown/bitburner.ns.nuke.md @@ -4,7 +4,7 @@ ## NS.nuke() method -Runs the NUKE.exe program on the target server. NUKE.exe must exist on your home computer. +Runs NUKE.exe on a server. Signature: @@ -26,6 +26,8 @@ void RAM cost: 0.05 GB +Runs the NUKE.exe program on the target server. NUKE.exe must exist on your home computer. + ## Example diff --git a/markdown/bitburner.ns.peek.md b/markdown/bitburner.ns.peek.md index 9d3025370..36e1a32b9 100644 --- a/markdown/bitburner.ns.peek.md +++ b/markdown/bitburner.ns.peek.md @@ -4,7 +4,7 @@ ## NS.peek() method -This function is used to peek at the data from a port. It returns the first element in the specified port without removing that element. If the port is empty, the string “NULL PORT DATA” will be returned. +Get a copy of the data from a port without popping it. Signature: @@ -28,3 +28,5 @@ Data in the specified port. RAM cost: 1 GB +This function is used to peek at the data from a port. It returns the first element in the specified port without removing that element. If the port is empty, the string “NULL PORT DATA” will be returned. + diff --git a/markdown/bitburner.ns.prompt.md b/markdown/bitburner.ns.prompt.md index 4a92cebd7..491069ccd 100644 --- a/markdown/bitburner.ns.prompt.md +++ b/markdown/bitburner.ns.prompt.md @@ -4,7 +4,7 @@ ## NS.prompt() method -Prompts the player with a dialog box with two options: “Yes” and “No”. This function will return true if the player click “Yes” and false if the player clicks “No”. The script’s execution is halted until the player selects one of the options. +Prompt the player with a Yes/No modal. Signature: @@ -28,3 +28,5 @@ True if the player click “Yes” and false if the player clicks “No”. RAM cost: 0 GB +Prompts the player with a dialog box with two options: “Yes” and “No”. This function will return true if the player click “Yes” and false if the player clicks “No”. The script’s execution is halted until the player selects one of the options. + diff --git a/markdown/bitburner.ns.ps.md b/markdown/bitburner.ns.ps.md index 4ad335704..1467e6561 100644 --- a/markdown/bitburner.ns.ps.md +++ b/markdown/bitburner.ns.ps.md @@ -4,7 +4,7 @@ ## NS.ps() method -Returns an array with general information about all scripts running on the specified target server. +List running scripts on a server. Signature: @@ -28,6 +28,8 @@ Array with general information about all scripts running on the specified target RAM cost: 0.2 GB +Returns an array with general information about all scripts running on the specified target server. + ## Example diff --git a/markdown/bitburner.ns.purchaseserver.md b/markdown/bitburner.ns.purchaseserver.md index e1e881b37..2b9936b08 100644 --- a/markdown/bitburner.ns.purchaseserver.md +++ b/markdown/bitburner.ns.purchaseserver.md @@ -4,13 +4,7 @@ ## NS.purchaseServer() method -Purchased a server with the specified hostname and amount of RAM. - -The hostname argument can be any data type, but it will be converted to a string and have whitespace removed. Anything that resolves to an empty string will cause the function to fail. If there is already a server with the specified hostname, then the function will automatically append a number at the end of the hostname argument value until it finds a unique hostname. For example, if the script calls `purchaseServer(“foo”, 4)` but a server named “foo” already exists, the it will automatically change the hostname to `foo-0`. If there is already a server with the hostname `foo-0`, then it will change the hostname to `foo-1`, and so on. - -Note that there is a maximum limit to the amount of servers you can purchase. - -Returns the hostname of the newly purchased server as a string. If the function fails to purchase a server, then it will return an empty string. The function will fail if the arguments passed in are invalid, if the player does not have enough money to purchase the specified server, or if the player has exceeded the maximum amount of servers. +Purchase a server. Signature: @@ -35,6 +29,14 @@ The hostname of the newly purchased server. 2.25 GB +Purchased a server with the specified hostname and amount of RAM. + +The hostname argument can be any data type, but it will be converted to a string and have whitespace removed. Anything that resolves to an empty string will cause the function to fail. If there is already a server with the specified hostname, then the function will automatically append a number at the end of the hostname argument value until it finds a unique hostname. For example, if the script calls `purchaseServer(“foo”, 4)` but a server named “foo” already exists, the it will automatically change the hostname to `foo-0`. If there is already a server with the hostname `foo-0`, then it will change the hostname to `foo-1`, and so on. + +Note that there is a maximum limit to the amount of servers you can purchase. + +Returns the hostname of the newly purchased server as a string. If the function fails to purchase a server, then it will return an empty string. The function will fail if the arguments passed in are invalid, if the player does not have enough money to purchase the specified server, or if the player has exceeded the maximum amount of servers. + ## Example diff --git a/markdown/bitburner.ns.read.md b/markdown/bitburner.ns.read.md index cdd022bea..b7112a134 100644 --- a/markdown/bitburner.ns.read.md +++ b/markdown/bitburner.ns.read.md @@ -4,11 +4,7 @@ ## NS.read() method -This function is used to read data from a port or from a text file (.txt). - -If the argument port/fn is a number between 1 and 20, then it specifies a port and it will read data from that port. A port is a serialized queue. This function will remove the first element from that queue and return it. If the queue is empty, then the string “NULL PORT DATA” will be returned. - -If the argument port/fn is a string, then it specifies the name of a text file (.txt) and this function will return the data in the specified text file. If the text file does not exist, an empty string will be returned. +Read content of a file. Signature: @@ -32,3 +28,9 @@ Data in the specified text file or port. RAM cost: 1 GB +This function is used to read data from a port or from a text file (.txt). + +If the argument port/fn is a number between 1 and 20, then it specifies a port and it will read data from that port. A port is a serialized queue. This function will remove the first element from that queue and return it. If the queue is empty, then the string “NULL PORT DATA” will be returned. + +If the argument port/fn is a string, then it specifies the name of a text file (.txt) and this function will return the data in the specified text file. If the text file does not exist, an empty string will be returned. + diff --git a/markdown/bitburner.ns.relaysmtp.md b/markdown/bitburner.ns.relaysmtp.md index bbd8884ac..6a675bb64 100644 --- a/markdown/bitburner.ns.relaysmtp.md +++ b/markdown/bitburner.ns.relaysmtp.md @@ -4,7 +4,7 @@ ## NS.relaysmtp() method -Runs the relaySMTP.exe program on the target server. relaySMTP.exe must exist on your home computer. +Runs relaySMTP.exe on a server. Signature: @@ -26,6 +26,8 @@ void RAM cost: 0.05 GB +Runs the relaySMTP.exe program on the target server. relaySMTP.exe must exist on your home computer. + ## Example diff --git a/markdown/bitburner.ns.rm.md b/markdown/bitburner.ns.rm.md index d5adf5131..207fc919f 100644 --- a/markdown/bitburner.ns.rm.md +++ b/markdown/bitburner.ns.rm.md @@ -4,7 +4,7 @@ ## NS.rm() method -Removes the specified file from the current server. This function works for every file type except message (.msg) files. +Delete a file. Signature: @@ -29,3 +29,5 @@ True if it successfully deletes the file, and false otherwise. RAM cost: 1 GB +Removes the specified file from the current server. This function works for every file type except message (.msg) files. + diff --git a/markdown/bitburner.ns.run.md b/markdown/bitburner.ns.run.md index 06ed79a41..b809f4da8 100644 --- a/markdown/bitburner.ns.run.md +++ b/markdown/bitburner.ns.run.md @@ -4,13 +4,7 @@ ## NS.run() method -Run a script as a separate process. This function can only be used to run scripts located on the current server (the server running the script that calls this function). Requires a significant amount of RAM to run this command. - -If the script was successfully started, then this functions returns the PID of that script. Otherwise, it returns 0. - -PID stands for Process ID. The PID is a unique identifier for each script. The PID will always be a positive integer. - -Running this function with a numThreads argument of 0 will return 0 without running the script. However, running this function with a negative numThreads argument will cause a runtime error. +Start another script on the current server. Signature: @@ -36,6 +30,14 @@ Returns the PID of a successfully started script, and 0 otherwise. RAM cost: 1 GB +Run a script as a separate process. This function can only be used to run scripts located on the current server (the server running the script that calls this function). Requires a significant amount of RAM to run this command. + +If the script was successfully started, then this functions returns the PID of that script. Otherwise, it returns 0. + +PID stands for Process ID. The PID is a unique identifier for each script. The PID will always be a positive integer. + +Running this function with a numThreads argument of 0 will return 0 without running the script. However, running this function with a negative numThreads argument will cause a runtime error. + ## Example 1 diff --git a/markdown/bitburner.ns.scan.md b/markdown/bitburner.ns.scan.md index 4d8f81734..235271caa 100644 --- a/markdown/bitburner.ns.scan.md +++ b/markdown/bitburner.ns.scan.md @@ -4,7 +4,7 @@ ## NS.scan() method -Returns an array containing the hostnames or IPs of all servers that are one node way from the specified target server. The hostnames/IPs in the returned array are strings. +Get the list servers connected to a server. Signature: @@ -29,3 +29,5 @@ Returns an string of hostnames or IP. RAM cost: 0.2 GB +Returns an array containing the hostnames or IPs of all servers that are one node way from the specified target server. The hostnames/IPs in the returned array are strings. + diff --git a/markdown/bitburner.ns.scp.md b/markdown/bitburner.ns.scp.md index 1b430f434..e2b4eff2b 100644 --- a/markdown/bitburner.ns.scp.md +++ b/markdown/bitburner.ns.scp.md @@ -4,7 +4,7 @@ ## NS.scp() method -Copies a script or literature (.lit) file(s) to another server. The files argument can be either a string specifying a single file to copy, or an array of strings specifying multiple files to copy. +Copy file between servers. Signature: @@ -29,6 +29,8 @@ True if the script/literature file is successfully copied over and false otherwi RAM cost: 0.6 GB +Copies a script or literature (.lit) file(s) to another server. The files argument can be either a string specifying a single file to copy, or an array of strings specifying multiple files to copy. + ## Example diff --git a/markdown/bitburner.ns.scp_1.md b/markdown/bitburner.ns.scp_1.md index 3cd6a7677..edc42d03f 100644 --- a/markdown/bitburner.ns.scp_1.md +++ b/markdown/bitburner.ns.scp_1.md @@ -4,7 +4,7 @@ ## NS.scp() method -Copies a script or literature (.lit) file(s) to another server. The files argument can be either a string specifying a single file to copy, or an array of strings specifying multiple files to copy. +Copy file between servers. Signature: @@ -35,6 +35,8 @@ True if the script/literature file is successfully copied over and false otherwi RAM cost: 0.6 GB +Copies a script or literature (.lit) file(s) to another server. The files argument can be either a string specifying a single file to copy, or an array of strings specifying multiple files to copy. + ## Example 1 diff --git a/markdown/bitburner.ns.scriptkill.md b/markdown/bitburner.ns.scriptkill.md index f55f3005a..2d7615805 100644 --- a/markdown/bitburner.ns.scriptkill.md +++ b/markdown/bitburner.ns.scriptkill.md @@ -4,7 +4,7 @@ ## NS.scriptKill() method -Kills all scripts with the specified filename on the target server specified by hostname, regardless of arguments. +Kill all scripts with a filename. Signature: @@ -29,3 +29,5 @@ true if one or more scripts were successfully killed, and false if none were. RAM cost: 1 GB +Kills all scripts with the specified filename on the target server specified by hostname, regardless of arguments. + diff --git a/markdown/bitburner.ns.scriptrunning.md b/markdown/bitburner.ns.scriptrunning.md index 743899860..d8f19561f 100644 --- a/markdown/bitburner.ns.scriptrunning.md +++ b/markdown/bitburner.ns.scriptrunning.md @@ -4,9 +4,7 @@ ## NS.scriptRunning() method -Returns a boolean indicating whether any instance of the specified script is running on the target server, regardless of its arguments. - -This is different than the isRunning function because it does not try to identify a specific instance of a running script by its arguments. +Check if any script with a filename is running. Signature: @@ -31,6 +29,10 @@ True if the specified script is running, and false otherwise. RAM cost: 1 GB +Returns a boolean indicating whether any instance of the specified script is running on the target server, regardless of its arguments. + +This is different than the isRunning function because it does not try to identify a specific instance of a running script by its arguments. + ## Example 1 diff --git a/markdown/bitburner.ns.spawn.md b/markdown/bitburner.ns.spawn.md index 087ce69bf..b57aa91e1 100644 --- a/markdown/bitburner.ns.spawn.md +++ b/markdown/bitburner.ns.spawn.md @@ -4,9 +4,7 @@ ## NS.spawn() method -Terminates the current script, and then after a delay of about 10 seconds it will execute the newly-specified script. The purpose of this function is to execute a new script without being constrained by the RAM usage of the current one. This function can only be used to run scripts on the local server. - -Because this function immediately terminates the script, it does not have a return value. +Terminate current script and start another in 10s. Signature: @@ -30,6 +28,10 @@ void RAM cost: 2 GB +Terminates the current script, and then after a delay of about 10 seconds it will execute the newly-specified script. The purpose of this function is to execute a new script without being constrained by the RAM usage of the current one. This function can only be used to run scripts on the local server. + +Because this function immediately terminates the script, it does not have a return value. + ## Example diff --git a/markdown/bitburner.ns.sprintf.md b/markdown/bitburner.ns.sprintf.md index 5b1e24319..a4b690d68 100644 --- a/markdown/bitburner.ns.sprintf.md +++ b/markdown/bitburner.ns.sprintf.md @@ -4,7 +4,7 @@ ## NS.sprintf() method -Complete open source JavaScript sprintf implementation +Format a string. Signature: @@ -29,3 +29,5 @@ Formated text. RAM cost: 0 GB +see: https://github.com/alexei/sprintf.js + diff --git a/markdown/bitburner.ns.sqlinject.md b/markdown/bitburner.ns.sqlinject.md index 3da37aea9..f9697d189 100644 --- a/markdown/bitburner.ns.sqlinject.md +++ b/markdown/bitburner.ns.sqlinject.md @@ -4,7 +4,7 @@ ## NS.sqlinject() method -Runs the SQLInject.exe program on the target server. SQLInject.exe must exist on your home computer. +Runs SQLInject.exe on a server. Signature: diff --git a/markdown/bitburner.ns.tail.md b/markdown/bitburner.ns.tail.md index d834c883a..ce60fada4 100644 --- a/markdown/bitburner.ns.tail.md +++ b/markdown/bitburner.ns.tail.md @@ -4,11 +4,7 @@ ## NS.tail() method -Opens a script’s logs. This is functionally the same as the tail Terminal command. - -If the function is called with no arguments, it will open the current script’s logs. - -Otherwise, the fn, hostname/ip, and args… arguments can be used to get the logs from another script. Remember that scripts are uniquely identified by both their names and arguments. +Open the tail window of a script. Signature: @@ -32,6 +28,12 @@ void RAM cost: 0 GB +Opens a script’s logs. This is functionally the same as the tail Terminal command. + +If the function is called with no arguments, it will open the current script’s logs. + +Otherwise, the fn, hostname/ip, and args… arguments can be used to get the logs from another script. Remember that scripts are uniquely identified by both their names and arguments. + ## Example 1 diff --git a/markdown/bitburner.ns.trywrite.md b/markdown/bitburner.ns.trywrite.md index 2ce589d63..4f2338870 100644 --- a/markdown/bitburner.ns.trywrite.md +++ b/markdown/bitburner.ns.trywrite.md @@ -4,7 +4,7 @@ ## NS.tryWrite() method -Attempts to write data to the specified Netscript Port. If the port is full, the data will not be written. Otherwise, the data will be written normally. +Attempt to write to a port. Signature: @@ -29,3 +29,5 @@ True if the data is successfully written to the port, and false otherwise. RAM cost: 1 GB +Attempts to write data to the specified Netscript Port. If the port is full, the data will not be written. Otherwise, the data will be written normally. + diff --git a/markdown/bitburner.ns.vsprintf.md b/markdown/bitburner.ns.vsprintf.md index c7333cbe1..ea2abad41 100644 --- a/markdown/bitburner.ns.vsprintf.md +++ b/markdown/bitburner.ns.vsprintf.md @@ -4,7 +4,7 @@ ## NS.vsprintf() method -Complete open source JavaScript sprintf implementation +Format a string with an array of arguments. Signature: @@ -29,3 +29,5 @@ Formated text. RAM cost: 0 GB +see: https://github.com/alexei/sprintf.js + diff --git a/markdown/bitburner.ns.weaken.md b/markdown/bitburner.ns.weaken.md index 5571b2aad..e602a2bde 100644 --- a/markdown/bitburner.ns.weaken.md +++ b/markdown/bitburner.ns.weaken.md @@ -27,7 +27,9 @@ The amount by which the target server’s security level was decreased. This is ## Remarks -RAM cost: 0.15 GB Use your hacking skills to attack a server’s security, lowering the server’s security level. The runtime for this command depends on your hacking level and the target server’s security level. This function lowers the security level of the target server by 0.05. +RAM cost: 0.15 GB + +Use your hacking skills to attack a server’s security, lowering the server’s security level. The runtime for this command depends on your hacking level and the target server’s security level. This function lowers the security level of the target server by 0.05. Like hack and grow, `weaken` can be called on any server, regardless of where the script is running. This command requires root access to the target server, but there is no required hacking level to run the command. diff --git a/markdown/bitburner.ns.weakenanalyze.md b/markdown/bitburner.ns.weakenanalyze.md index c91cd87ff..4dabf061a 100644 --- a/markdown/bitburner.ns.weakenanalyze.md +++ b/markdown/bitburner.ns.weakenanalyze.md @@ -27,5 +27,7 @@ The security decrease. ## Remarks -RAM cost: 1 GB Returns the security decrease that would occur if a weaken with this many threads happened. +RAM cost: 1 GB + +Returns the security decrease that would occur if a weaken with this many threads happened. diff --git a/markdown/bitburner.ns.wget.md b/markdown/bitburner.ns.wget.md index 42f1f33f8..cc1ad92c7 100644 --- a/markdown/bitburner.ns.wget.md +++ b/markdown/bitburner.ns.wget.md @@ -4,11 +4,7 @@ ## NS.wget() method -Retrieves data from a URL and downloads it to a file on the specified server. The data can only be downloaded to a script (.script, .ns, .js) or a text file (.txt). If the file already exists, it will be overwritten by this command. Note that it will not be possible to download data from many websites because they do not allow cross-origin resource sharing (CORS). - -IMPORTANT: This is an asynchronous function that returns a Promise. The Promise’s resolved value will be a boolean indicating whether or not the data was successfully retrieved from the URL. Because the function is async and returns a Promise, it is recommended you use wget in NetscriptJS (Netscript 2.0). - -In NetscriptJS, you must preface any call to wget with the await keyword (like you would hack or sleep). wget will still work in Netscript 1.0, but the functions execution will not be synchronous (i.e. it may not execute when you expect/want it to). Furthermore, since Promises are not supported in ES5, you will not be able to process the returned value of wget in Netscript 1.0. +Download a file from the internet. Signature: @@ -34,6 +30,12 @@ True if the data was successfully retrieved from the URL, false otherwise. RAM cost: 0 GB +Retrieves data from a URL and downloads it to a file on the specified server. The data can only be downloaded to a script (.script, .ns, .js) or a text file (.txt). If the file already exists, it will be overwritten by this command. Note that it will not be possible to download data from many websites because they do not allow cross-origin resource sharing (CORS). + +IMPORTANT: This is an asynchronous function that returns a Promise. The Promise’s resolved value will be a boolean indicating whether or not the data was successfully retrieved from the URL. Because the function is async and returns a Promise, it is recommended you use wget in NetscriptJS (Netscript 2.0). + +In NetscriptJS, you must preface any call to wget with the await keyword (like you would hack or sleep). wget will still work in Netscript 1.0, but the functions execution will not be synchronous (i.e. it may not execute when you expect/want it to). Furthermore, since Promises are not supported in ES5, you will not be able to process the returned value of wget in Netscript 1.0. + ## Example diff --git a/markdown/bitburner.ns.write.md b/markdown/bitburner.ns.write.md index 989f271df..20cf7bbd2 100644 --- a/markdown/bitburner.ns.write.md +++ b/markdown/bitburner.ns.write.md @@ -4,11 +4,7 @@ ## NS.write() method -This function can be used to either write data to a port or to a text file (.txt). - -If the first argument is a number between 1 and 20, then it specifies a port and this function will write data to that port. The third argument, mode, is not used when writing to a port. - -If the first argument is a string, then it specifies the name of a text file (.txt) and this function will write data to that text file. If the specified text file does not exist, then it will be created. The third argument mode, defines how the data will be written to the text file. If \*mode is set to “w”, then the data is written in “write” mode which means that it will overwrite all existing data on the text file. If mode is set to any other value then the data will be written in “append” mode which means that the data will be added at the end of the text file. +Write data to a file. Signature: @@ -32,3 +28,9 @@ void RAM cost: 1 GB +This function can be used to either write data to a port or to a text file (.txt). + +If the first argument is a number between 1 and 20, then it specifies a port and this function will write data to that port. The third argument, mode, is not used when writing to a port. + +If the first argument is a string, then it specifies the name of a text file (.txt) and this function will write data to that text file. If the specified text file does not exist, then it will be created. The third argument mode, defines how the data will be written to the text file. If \*mode is set to “w”, then the data is written in “write” mode which means that it will overwrite all existing data on the text file. If mode is set to any other value then the data will be written in “append” mode which means that the data will be added at the end of the text file. + diff --git a/markdown/bitburner.playerskills.md b/markdown/bitburner.playerskills.md index 263dbb3fa..8f0c73215 100644 --- a/markdown/bitburner.playerskills.md +++ b/markdown/bitburner.playerskills.md @@ -9,7 +9,7 @@ Short summary of the players skills. Signature: ```typescript -interface PlayerSkills +export interface PlayerSkills ``` ## Properties diff --git a/markdown/bitburner.processinfo.md b/markdown/bitburner.processinfo.md index d2a8f3449..ea17419f6 100644 --- a/markdown/bitburner.processinfo.md +++ b/markdown/bitburner.processinfo.md @@ -9,7 +9,7 @@ A single process on a server. Signature: ```typescript -interface ProcessInfo +export interface ProcessInfo ``` ## Properties diff --git a/markdown/bitburner.server.md b/markdown/bitburner.server.md index 9d5e0d303..7309bf3f2 100644 --- a/markdown/bitburner.server.md +++ b/markdown/bitburner.server.md @@ -9,7 +9,7 @@ A single server. Signature: ```typescript -interface Server +export interface Server ``` ## Properties diff --git a/markdown/bitburner.singularity.md b/markdown/bitburner.singularity.md index 2a82ab897..893d5e88a 100644 --- a/markdown/bitburner.singularity.md +++ b/markdown/bitburner.singularity.md @@ -9,7 +9,7 @@ Singularity API Signature: ```typescript -interface Singularity +export interface Singularity ``` ## Remarks diff --git a/markdown/bitburner.sleeve.md b/markdown/bitburner.sleeve.md index cdb2ddeec..80bcd14be 100644 --- a/markdown/bitburner.sleeve.md +++ b/markdown/bitburner.sleeve.md @@ -9,7 +9,7 @@ Sleeve API Signature: ```typescript -interface Sleeve +export interface Sleeve ``` ## Remarks diff --git a/markdown/bitburner.sleeveinformation.md b/markdown/bitburner.sleeveinformation.md index 0317e5ee2..cc6f44828 100644 --- a/markdown/bitburner.sleeveinformation.md +++ b/markdown/bitburner.sleeveinformation.md @@ -9,7 +9,7 @@ Object representing sleeve information. Signature: ```typescript -interface SleeveInformation +export interface SleeveInformation ``` ## Properties diff --git a/markdown/bitburner.sleeveskills.md b/markdown/bitburner.sleeveskills.md index 750bc718b..bd24a7302 100644 --- a/markdown/bitburner.sleeveskills.md +++ b/markdown/bitburner.sleeveskills.md @@ -9,7 +9,7 @@ Object representing a sleeve stats. Signature: ```typescript -interface SleeveSkills +export interface SleeveSkills ``` ## Properties diff --git a/markdown/bitburner.sleevetask.md b/markdown/bitburner.sleevetask.md index b1e5d6662..08ca18928 100644 --- a/markdown/bitburner.sleevetask.md +++ b/markdown/bitburner.sleevetask.md @@ -9,7 +9,7 @@ Object representing a sleeve current task. Signature: ```typescript -interface SleeveTask +export interface SleeveTask ``` ## Properties diff --git a/markdown/bitburner.sleeveworkgains.md b/markdown/bitburner.sleeveworkgains.md index 80df4a1b9..2fb664e20 100644 --- a/markdown/bitburner.sleeveworkgains.md +++ b/markdown/bitburner.sleeveworkgains.md @@ -8,7 +8,7 @@ Signature: ```typescript -interface SleeveWorkGains +export interface SleeveWorkGains ``` ## Properties diff --git a/markdown/bitburner.sourcefilelvl.md b/markdown/bitburner.sourcefilelvl.md index ca986ed8b..2be5ba883 100644 --- a/markdown/bitburner.sourcefilelvl.md +++ b/markdown/bitburner.sourcefilelvl.md @@ -8,7 +8,7 @@ Signature: ```typescript -interface SourceFileLvl +export interface SourceFileLvl ``` ## Properties diff --git a/markdown/bitburner.stockorder.md b/markdown/bitburner.stockorder.md index be30c34cb..444a63653 100644 --- a/markdown/bitburner.stockorder.md +++ b/markdown/bitburner.stockorder.md @@ -9,5 +9,5 @@ Return value of [getOrders](./bitburner.tix.getorders.md) Signature: ```typescript -interface StockOrder +export interface StockOrder ``` diff --git a/markdown/bitburner.stockorderobject.md b/markdown/bitburner.stockorderobject.md index b99bb76b1..c07a84caf 100644 --- a/markdown/bitburner.stockorderobject.md +++ b/markdown/bitburner.stockorderobject.md @@ -9,7 +9,7 @@ Value in map of [StockOrder](./bitburner.stockorder.md) Signature: ```typescript -interface StockOrderObject +export interface StockOrderObject ``` ## Properties diff --git a/package.json b/package.json index 997f82388..7bb8236b7 100644 --- a/package.json +++ b/package.json @@ -109,6 +109,6 @@ "test:watch": "jest --watch", "watch": "webpack --watch --mode production", "watch:dev": "webpack --watch --mode development", - "package-electron": "electron-packager .package bitburner --all --out .build --overwrite --icon .package/icon.png" + "electron": "cp -r electron/* .package && cp index.html .package && cp main.bundle.js .package && cp dist/vendor.bundle.js .package && electron-packager .package bitburner --all --out .build --overwrite --icon .package/icon.png" } } diff --git a/src/Netscript/RamCostGenerator.ts b/src/Netscript/RamCostGenerator.ts index 87b78bf65..39469f6aa 100644 --- a/src/Netscript/RamCostGenerator.ts +++ b/src/Netscript/RamCostGenerator.ts @@ -187,6 +187,7 @@ export const RamCosts: IMap = { universityCourse: RamCostConstants.ScriptSingularityFn1RamCost, gymWorkout: RamCostConstants.ScriptSingularityFn1RamCost, travelToCity: RamCostConstants.ScriptSingularityFn1RamCost, + goToLocation: RamCostConstants.ScriptSingularityFn1RamCost, purchaseTor: RamCostConstants.ScriptSingularityFn1RamCost, purchaseProgram: RamCostConstants.ScriptSingularityFn1RamCost, getCurrentServer: RamCostConstants.ScriptSingularityFn1RamCost, @@ -200,7 +201,9 @@ export const RamCosts: IMap = { isBusy: RamCostConstants.ScriptSingularityFn1RamCost / 4, stopAction: RamCostConstants.ScriptSingularityFn1RamCost / 2, upgradeHomeRam: RamCostConstants.ScriptSingularityFn2RamCost, + upgradeHomeCores: RamCostConstants.ScriptSingularityFn2RamCost, getUpgradeHomeRamCost: RamCostConstants.ScriptSingularityFn2RamCost / 2, + getUpgradeHomeCoresCost: RamCostConstants.ScriptSingularityFn2RamCost / 2, workForCompany: RamCostConstants.ScriptSingularityFn2RamCost, applyToCompany: RamCostConstants.ScriptSingularityFn2RamCost, getCompanyRep: RamCostConstants.ScriptSingularityFn2RamCost / 3, diff --git a/src/NetscriptFunctions.ts b/src/NetscriptFunctions.ts index b07a75204..cb6011d39 100644 --- a/src/NetscriptFunctions.ts +++ b/src/NetscriptFunctions.ts @@ -4,13 +4,9 @@ import { getRamCost } from "./Netscript/RamCostGenerator"; import { WorkerScriptStartStopEventEmitter } from "./Netscript/WorkerScriptStartStopEventEmitter"; import { BitNodeMultipliers } from "./BitNode/BitNodeMultipliers"; -import { findCrime } from "./Crime/CrimeHelpers"; -import { Company } from "./Company/Company"; -import { Companies } from "./Company/Companies"; -import { CompanyPosition } from "./Company/CompanyPosition"; -import { CompanyPositions } from "./Company/CompanyPositions"; + import { CONSTANTS } from "./Constants"; -import { DarkWebItems } from "./DarkWeb/DarkWebItems"; + import { calculateHackingChance, calculateHackingExpGain, @@ -19,14 +15,11 @@ import { calculateGrowTime, calculateWeakenTime, } from "./Hacking"; -import { AllGangs } from "./Gang/AllGangs"; -import { Factions, factionExists } from "./Faction/Factions"; -import { joinFaction } from "./Faction/FactionHelpers"; + import { netscriptCanGrow, netscriptCanHack, netscriptCanWeaken } from "./Hacking/netscriptCanHack"; import { HacknetServer } from "./Hacknet/HacknetServer"; -import { CityName } from "./Locations/data/CityNames"; -import { LocationName } from "./Locations/data/LocationNames"; + import { Terminal } from "./Terminal"; import { Player } from "./Player"; @@ -57,48 +50,52 @@ import { killWorkerScript } from "./Netscript/killWorkerScript"; import { workerScripts } from "./Netscript/WorkerScripts"; import { WorkerScript } from "./Netscript/WorkerScript"; import { makeRuntimeRejectMsg, netscriptDelay, resolveNetscriptRequestedThreads } from "./NetscriptEvaluator"; -import { Router } from "./ui/GameRoot"; import { numeralWrapper } from "./ui/numeralFormat"; import { convertTimeMsToTimeElapsedString } from "./utils/StringHelperFunctions"; -import { SpecialServers } from "./Server/data/SpecialServers"; import { LogBoxEvents } from "./ui/React/LogBoxManager"; import { arrayToString } from "./utils/helpers/arrayToString"; import { isString } from "./utils/helpers/isString"; -import { Faction } from "./Faction/Faction"; -import { Page } from "./ui/Router"; - import { BaseServer } from "./Server/BaseServer"; -import { INetscriptGang, NetscriptGang } from "./NetscriptFunctions/Gang"; -import { INetscriptSleeve, NetscriptSleeve } from "./NetscriptFunctions/Sleeve"; +import { NetscriptGang } from "./NetscriptFunctions/Gang"; +import { NetscriptSleeve } from "./NetscriptFunctions/Sleeve"; import { INetscriptExtra, NetscriptExtra } from "./NetscriptFunctions/Extra"; -import { INetscriptHacknet, NetscriptHacknet } from "./NetscriptFunctions/Hacknet"; -import { Bladeburner as INetscriptBladeburner, TIX } from "./ScriptEditor/NetscriptDefinitions"; +import { NetscriptHacknet } from "./NetscriptFunctions/Hacknet"; +import { + Bladeburner as IBladeburner, + TIX, + CodingContract as ICodingContract, + Gang as IGang, + Hacknet as IHacknet, + Sleeve as ISleeve, + Singularity as ISingularity, + Formulas as IFormulas, +} from "./ScriptEditor/NetscriptDefinitions"; import { NetscriptBladeburner } from "./NetscriptFunctions/Bladeburner"; -import { INetscriptCodingContract, NetscriptCodingContract } from "./NetscriptFunctions/CodingContract"; +import { NetscriptCodingContract } from "./NetscriptFunctions/CodingContract"; import { INetscriptCorporation, NetscriptCorporation } from "./NetscriptFunctions/Corporation"; -import { INetscriptFormulas, NetscriptFormulas } from "./NetscriptFunctions/Formulas"; -import { INetscriptAugmentations, NetscriptAugmentations } from "./NetscriptFunctions/Augmentations"; +import { NetscriptFormulas } from "./NetscriptFunctions/Formulas"; +import { NetscriptSingularity } from "./NetscriptFunctions/Singularity"; import { NetscriptStockMarket } from "./NetscriptFunctions/StockMarket"; import { toNative } from "./NetscriptFunctions/toNative"; import { dialogBoxCreate } from "./ui/React/DialogBox"; import { SnackbarEvents } from "./ui/React/Snackbar"; -import { Locations } from "./Locations/Locations"; + import { Flags } from "./NetscriptFunctions/Flags"; -interface NS extends INetscriptExtra, INetscriptAugmentations { +interface NS extends INetscriptExtra, ISingularity { [key: string]: any; - hacknet: INetscriptHacknet; - gang: INetscriptGang; - sleeve: INetscriptSleeve; - bladeburner: INetscriptBladeburner; - codingcontract: INetscriptCodingContract; + hacknet: IHacknet; + gang: IGang; + sleeve: ISleeve; + bladeburner: IBladeburner; + codingcontract: ICodingContract; corporation: INetscriptCorporation; - formulas: INetscriptFormulas; + formulas: IFormulas; stock: TIX; } @@ -316,22 +313,6 @@ function NetscriptFunctions(workerScript: WorkerScript): NS { } }; - const getCompany = function (func: any, name: any): Company { - const company = Companies[name]; - if (company == null || !(company instanceof Company)) { - throw makeRuntimeErrorMsg(func, `Invalid company name: '${name}'`); - } - return company; - }; - - const getFaction = function (func: any, name: any): Faction { - if (!factionExists(name)) { - throw makeRuntimeErrorMsg(func, `Invalid faction name: '${name}`); - } - - return Factions[name]; - }; - const hack = function (hostname: any, manual: any, { threads: requestedThreads, stock }: any = {}): Promise { if (hostname === undefined) { throw makeRuntimeErrorMsg("hack", "Takes 1 argument."); @@ -456,7 +437,7 @@ function NetscriptFunctions(workerScript: WorkerScript): NS { }, getServer: safeGetServer, checkSingularityAccess: checkSingularityAccess, - getFaction: getFaction, + hack: hack, }; const gang = NetscriptGang(Player, workerScript, helper); @@ -467,7 +448,7 @@ function NetscriptFunctions(workerScript: WorkerScript): NS { const codingcontract = NetscriptCodingContract(Player, workerScript, helper); const corporation = NetscriptCorporation(Player, workerScript, helper); const formulas = NetscriptFormulas(Player, workerScript, helper); - const augmentations = NetscriptAugmentations(Player, workerScript, helper); + const augmentations = NetscriptSingularity(Player, workerScript, helper); const stockmarket = NetscriptStockMarket(Player, workerScript, helper); const functions = { @@ -2114,439 +2095,8 @@ function NetscriptFunctions(workerScript: WorkerScript): NS { return Math.floor(CONSTANTS.BaseFavorToDonate * BitNodeMultipliers.RepToDonateToFaction); }, - /* Singularity Functions */ - goToLocation: function (locationName: any): boolean { - const location = Object.values(Locations).find((l) => l.name === locationName); - if (!location) { - workerScript.log("goToLocation", `No location named ${locationName}`); - return false; - } - if (Player.city !== location.city) { - workerScript.log("goToLocation", `No location named ${locationName} in ${Player.city}`); - return false; - } - Router.toLocation(location); - return true; - }, - universityCourse: function (universityName: any, className: any): any { - updateDynamicRam("universityCourse", getRamCost("universityCourse")); - checkSingularityAccess("universityCourse", 1); - if (Player.isWorking) { - const txt = Player.singularityStopWork(); - workerScript.log("universityCourse", txt); - } - - let costMult, expMult; - switch (universityName.toLowerCase()) { - case LocationName.AevumSummitUniversity.toLowerCase(): - if (Player.city != CityName.Aevum) { - workerScript.log( - "universityCourse", - "You cannot study at 'Summit University' because you are not in 'Aevum'.", - ); - return false; - } - Player.gotoLocation(LocationName.AevumSummitUniversity); - costMult = 4; - expMult = 3; - break; - case LocationName.Sector12RothmanUniversity.toLowerCase(): - if (Player.city != CityName.Sector12) { - workerScript.log( - "universityCourse", - "You cannot study at 'Rothman University' because you are not in 'Sector-12'.", - ); - return false; - } - Player.location = LocationName.Sector12RothmanUniversity; - costMult = 3; - expMult = 2; - break; - case LocationName.VolhavenZBInstituteOfTechnology.toLowerCase(): - if (Player.city != CityName.Volhaven) { - workerScript.log( - "universityCourse", - "You cannot study at 'ZB Institute of Technology' because you are not in 'Volhaven'.", - ); - return false; - } - Player.location = LocationName.VolhavenZBInstituteOfTechnology; - costMult = 5; - expMult = 4; - break; - default: - workerScript.log("universityCourse", `Invalid university name: '${universityName}'.`); - return false; - } - - let task; - switch (className.toLowerCase()) { - case "Study Computer Science".toLowerCase(): - task = CONSTANTS.ClassStudyComputerScience; - break; - case "Data Structures".toLowerCase(): - task = CONSTANTS.ClassDataStructures; - break; - case "Networks".toLowerCase(): - task = CONSTANTS.ClassNetworks; - break; - case "Algorithms".toLowerCase(): - task = CONSTANTS.ClassAlgorithms; - break; - case "Management".toLowerCase(): - task = CONSTANTS.ClassManagement; - break; - case "Leadership".toLowerCase(): - task = CONSTANTS.ClassLeadership; - break; - default: - workerScript.log("universityCourse", `Invalid class name: ${className}.`); - return false; - } - Player.startClass(Router, costMult, expMult, task); - workerScript.log("universityCourse", `Started ${task} at ${universityName}`); - return true; - }, - - gymWorkout: function (gymName: any, stat: any): any { - updateDynamicRam("gymWorkout", getRamCost("gymWorkout")); - checkSingularityAccess("gymWorkout", 1); - if (Player.isWorking) { - const txt = Player.singularityStopWork(); - workerScript.log("gymWorkout", txt); - } - let costMult, expMult; - switch (gymName.toLowerCase()) { - case LocationName.AevumCrushFitnessGym.toLowerCase(): - if (Player.city != CityName.Aevum) { - workerScript.log("gymWorkout", "You cannot workout at 'Crush Fitness' because you are not in 'Aevum'."); - return false; - } - Player.location = LocationName.AevumCrushFitnessGym; - costMult = 3; - expMult = 2; - break; - case LocationName.AevumSnapFitnessGym.toLowerCase(): - if (Player.city != CityName.Aevum) { - workerScript.log("gymWorkout", "You cannot workout at 'Snap Fitness' because you are not in 'Aevum'."); - return false; - } - Player.location = LocationName.AevumSnapFitnessGym; - costMult = 10; - expMult = 5; - break; - case LocationName.Sector12IronGym.toLowerCase(): - if (Player.city != CityName.Sector12) { - workerScript.log("gymWorkout", "You cannot workout at 'Iron Gym' because you are not in 'Sector-12'."); - return false; - } - Player.location = LocationName.Sector12IronGym; - costMult = 1; - expMult = 1; - break; - case LocationName.Sector12PowerhouseGym.toLowerCase(): - if (Player.city != CityName.Sector12) { - workerScript.log( - "gymWorkout", - "You cannot workout at 'Powerhouse Gym' because you are not in 'Sector-12'.", - ); - return false; - } - Player.location = LocationName.Sector12PowerhouseGym; - costMult = 20; - expMult = 10; - break; - case LocationName.VolhavenMilleniumFitnessGym.toLowerCase(): - if (Player.city != CityName.Volhaven) { - workerScript.log( - "gymWorkout", - "You cannot workout at 'Millenium Fitness Gym' because you are not in 'Volhaven'.", - ); - return false; - } - Player.location = LocationName.VolhavenMilleniumFitnessGym; - costMult = 7; - expMult = 4; - break; - default: - workerScript.log("gymWorkout", `Invalid gym name: ${gymName}. gymWorkout() failed`); - return false; - } - - switch (stat.toLowerCase()) { - case "strength".toLowerCase(): - case "str".toLowerCase(): - Player.startClass(Router, costMult, expMult, CONSTANTS.ClassGymStrength); - break; - case "defense".toLowerCase(): - case "def".toLowerCase(): - Player.startClass(Router, costMult, expMult, CONSTANTS.ClassGymDefense); - break; - case "dexterity".toLowerCase(): - case "dex".toLowerCase(): - Player.startClass(Router, costMult, expMult, CONSTANTS.ClassGymDexterity); - break; - case "agility".toLowerCase(): - case "agi".toLowerCase(): - Player.startClass(Router, costMult, expMult, CONSTANTS.ClassGymAgility); - break; - default: - workerScript.log("gymWorkout", `Invalid stat: ${stat}.`); - return false; - } - workerScript.log("gymWorkout", `Started training ${stat} at ${gymName}`); - return true; - }, - - travelToCity: function (cityname: any): any { - updateDynamicRam("travelToCity", getRamCost("travelToCity")); - checkSingularityAccess("travelToCity", 1); - - switch (cityname) { - case CityName.Aevum: - case CityName.Chongqing: - case CityName.Sector12: - case CityName.NewTokyo: - case CityName.Ishima: - case CityName.Volhaven: - if (Player.money.lt(CONSTANTS.TravelCost)) { - throw makeRuntimeErrorMsg("travelToCity", "Not enough money to travel."); - } - Player.loseMoney(CONSTANTS.TravelCost, "other"); - Player.city = cityname; - workerScript.log("travelToCity", `Traveled to ${cityname}`); - return true; - default: - workerScript.log("travelToCity", `Invalid city name: '${cityname}'.`); - return false; - } - }, - - purchaseTor: function (): any { - updateDynamicRam("purchaseTor", getRamCost("purchaseTor")); - checkSingularityAccess("purchaseTor", 1); - - if (Player.hasTorRouter()) { - workerScript.log("purchaseTor", "You already have a TOR router!"); - return false; - } - - if (Player.money.lt(CONSTANTS.TorRouterCost)) { - workerScript.log("purchaseTor", "You cannot afford to purchase a Tor router."); - return false; - } - Player.loseMoney(CONSTANTS.TorRouterCost, "other"); - - const darkweb = safetlyCreateUniqueServer({ - ip: createUniqueRandomIp(), - hostname: "darkweb", - organizationName: "", - isConnectedTo: false, - adminRights: false, - purchasedByPlayer: false, - maxRam: 1, - }); - AddToAllServers(darkweb); - - Player.getHomeComputer().serversOnNetwork.push(darkweb.hostname); - darkweb.serversOnNetwork.push(Player.getHomeComputer().hostname); - Player.gainIntelligenceExp(CONSTANTS.IntelligenceSingFnBaseExpGain); - workerScript.log("purchaseTor", "You have purchased a Tor router!"); - return true; - }, - purchaseProgram: function (programName: any): any { - updateDynamicRam("purchaseProgram", getRamCost("purchaseProgram")); - checkSingularityAccess("purchaseProgram", 1); - - if (!Player.hasTorRouter()) { - workerScript.log("purchaseProgram", "You do not have the TOR router."); - return false; - } - - programName = programName.toLowerCase(); - - let item = null; - for (const key in DarkWebItems) { - const i = DarkWebItems[key]; - if (i.program.toLowerCase() == programName) { - item = i; - } - } - - if (item == null) { - workerScript.log("purchaseProgram", `Invalid program name: '${programName}.`); - return false; - } - - if (Player.money.lt(item.price)) { - workerScript.log( - "purchaseProgram", - `Not enough money to purchase '${item.program}'. Need ${numeralWrapper.formatMoney(item.price)}`, - ); - return false; - } - - if (Player.hasProgram(item.program)) { - workerScript.log("purchaseProgram", `You already have the '${item.program}' program`); - return true; - } - - Player.loseMoney(item.price, "other"); - Player.getHomeComputer().programs.push(item.program); - workerScript.log( - "purchaseProgram", - `You have purchased the '${item.program}' program. The new program can be found on your home computer.`, - ); - return true; - }, - getCurrentServer: function (): any { - updateDynamicRam("getCurrentServer", getRamCost("getCurrentServer")); - checkSingularityAccess("getCurrentServer", 1); - return Player.getCurrentServer().hostname; - }, - connect: function (hostname: any): any { - updateDynamicRam("connect", getRamCost("connect")); - checkSingularityAccess("connect", 1); - if (!hostname) { - throw makeRuntimeErrorMsg("connect", `Invalid hostname: '${hostname}'`); - } - - const target = GetServer(hostname); - if (target == null) { - throw makeRuntimeErrorMsg("connect", `Invalid hostname: '${hostname}'`); - return; - } - - if (hostname === "home") { - Player.getCurrentServer().isConnectedTo = false; - Player.currentServer = Player.getHomeComputer().hostname; - Player.getCurrentServer().isConnectedTo = true; - Terminal.setcwd("/"); - return true; - } - - const server = Player.getCurrentServer(); - for (let i = 0; i < server.serversOnNetwork.length; i++) { - const other = getServerOnNetwork(server, i); - if (other === null) continue; - if (other.hostname == hostname) { - Player.getCurrentServer().isConnectedTo = false; - Player.currentServer = target.hostname; - Player.getCurrentServer().isConnectedTo = true; - Terminal.setcwd("/"); - return true; - } - } - - return false; - }, - manualHack: function (): any { - updateDynamicRam("manualHack", getRamCost("manualHack")); - checkSingularityAccess("manualHack", 1); - const server = Player.getCurrentServer(); - return hack(server.hostname, true); - }, - installBackdoor: function (): any { - updateDynamicRam("installBackdoor", getRamCost("installBackdoor")); - checkSingularityAccess("installBackdoor", 1); - const baseserver = Player.getCurrentServer(); - if (!(baseserver instanceof Server)) { - workerScript.log("installBackdoor", "cannot backdoor this kind of server"); - return Promise.resolve(); - } - const server = baseserver as Server; - const installTime = (calculateHackingTime(server, Player) / 4) * 1000; - - // No root access or skill level too low - const canHack = netscriptCanHack(server, Player); - if (!canHack.res) { - throw makeRuntimeErrorMsg("installBackdoor", canHack.msg || ""); - } - - workerScript.log( - "installBackdoor", - `Installing backdoor on '${server.hostname}' in ${convertTimeMsToTimeElapsedString(installTime, true)}`, - ); - - return netscriptDelay(installTime, workerScript).then(function () { - if (workerScript.env.stopFlag) { - return Promise.reject(workerScript); - } - workerScript.log("installBackdoor", `Successfully installed backdoor on '${server.hostname}'`); - - server.backdoorInstalled = true; - - if (SpecialServers.WorldDaemon === server.hostname) { - Router.toBitVerse(false, false); - } - return Promise.resolve(); - }); - }, - getStats: function (): any { - updateDynamicRam("getStats", getRamCost("getStats")); - checkSingularityAccess("getStats", 1); - workerScript.log("getStats", `getStats is deprecated, please use getPlayer`); - - return { - hacking: Player.hacking_skill, - strength: Player.strength, - defense: Player.defense, - dexterity: Player.dexterity, - agility: Player.agility, - charisma: Player.charisma, - intelligence: Player.intelligence, - }; - }, - getCharacterInformation: function (): any { - updateDynamicRam("getCharacterInformation", getRamCost("getCharacterInformation")); - checkSingularityAccess("getCharacterInformation", 1); - workerScript.log("getCharacterInformation", `getCharacterInformation is deprecated, please use getPlayer`); - - return { - bitnode: Player.bitNodeN, - city: Player.city, - factions: Player.factions.slice(), - hp: Player.hp, - jobs: Object.keys(Player.jobs), - jobTitles: Object.values(Player.jobs), - maxHp: Player.max_hp, - mult: { - agility: Player.agility_mult, - agilityExp: Player.agility_exp_mult, - companyRep: Player.company_rep_mult, - crimeMoney: Player.crime_money_mult, - crimeSuccess: Player.crime_success_mult, - defense: Player.defense_mult, - defenseExp: Player.defense_exp_mult, - dexterity: Player.dexterity_mult, - dexterityExp: Player.dexterity_exp_mult, - factionRep: Player.faction_rep_mult, - hacking: Player.hacking_mult, - hackingExp: Player.hacking_exp_mult, - strength: Player.strength_mult, - strengthExp: Player.strength_exp_mult, - workMoney: Player.work_money_mult, - }, - timeWorked: Player.timeWorked, - tor: Player.hasTorRouter(), - workHackExpGain: Player.workHackExpGained, - workStrExpGain: Player.workStrExpGained, - workDefExpGain: Player.workDefExpGained, - workDexExpGain: Player.workDexExpGained, - workAgiExpGain: Player.workAgiExpGained, - workChaExpGain: Player.workChaExpGained, - workRepGain: Player.workRepGained, - workMoneyGain: Player.workMoneyGained, - hackingExp: Player.hacking_exp, - strengthExp: Player.strength_exp, - defenseExp: Player.defense_exp, - dexterityExp: Player.dexterity_exp, - agilityExp: Player.agility_exp, - charismaExp: Player.charisma_exp, - }; - }, - getPlayer: function (): any { - updateDynamicRam("getPlayer", getRamCost("getPlayer")); + getplayer: function (): any { + helper.updateDynamicRam("getplayer", getRamCost("getplayer")); const data = { hacking_skill: Player.hacking_skill, @@ -2639,537 +2189,6 @@ function NetscriptFunctions(workerScript: WorkerScript): NS { Object.assign(data.jobs, Player.jobs); return data; }, - hospitalize: function (): any { - updateDynamicRam("hospitalize", getRamCost("hospitalize")); - checkSingularityAccess("hospitalize", 1); - if (Player.isWorking || Router.page() === Page.Infiltration || Router.page() === Page.BitVerse) { - workerScript.log("hospitalize", "Cannot go to the hospital because the player is busy."); - return; - } - return Player.hospitalize(); - }, - isBusy: function (): any { - updateDynamicRam("isBusy", getRamCost("isBusy")); - checkSingularityAccess("isBusy", 1); - return Player.isWorking || Router.page() === Page.Infiltration || Router.page() === Page.BitVerse; - }, - stopAction: function (): any { - updateDynamicRam("stopAction", getRamCost("stopAction")); - checkSingularityAccess("stopAction", 1); - if (Player.isWorking) { - Router.toTerminal(); - const txt = Player.singularityStopWork(); - workerScript.log("stopAction", txt); - return true; - } - return false; - }, - upgradeHomeCores: function (): any { - updateDynamicRam("upgradeHomeCores", getRamCost("upgradeHomeCores")); - checkSingularityAccess("upgradeHomeCores", 2); - - // Check if we're at max cores - const homeComputer = Player.getHomeComputer(); - if (homeComputer.cpuCores >= 8) { - workerScript.log("upgradeHomeCores", `Your home computer is at max cores.`); - return false; - } - - const cost = Player.getUpgradeHomeCoresCost(); - if (Player.money.lt(cost)) { - workerScript.log("upgradeHomeCores", `You don't have enough money. Need ${numeralWrapper.formatMoney(cost)}`); - return false; - } - - homeComputer.cpuCores += 1; - Player.loseMoney(cost, "servers"); - - Player.gainIntelligenceExp(CONSTANTS.IntelligenceSingFnBaseExpGain); - workerScript.log( - "upgradeHomeCores", - `Purchased an additional core for home computer! It now has ${homeComputer.cpuCores} cores.`, - ); - return true; - }, - getUpgradeHomeCoresCost: function (): any { - updateDynamicRam("getUpgradeHomeCoresCost", getRamCost("getUpgradeHomeCoresCost")); - checkSingularityAccess("getUpgradeHomeCoresCost", 2); - - return Player.getUpgradeHomeCoresCost(); - }, - upgradeHomeRam: function (): any { - updateDynamicRam("upgradeHomeRam", getRamCost("upgradeHomeRam")); - checkSingularityAccess("upgradeHomeRam", 2); - - // Check if we're at max RAM - const homeComputer = Player.getHomeComputer(); - if (homeComputer.maxRam >= CONSTANTS.HomeComputerMaxRam) { - workerScript.log("upgradeHomeRam", `Your home computer is at max RAM.`); - return false; - } - - const cost = Player.getUpgradeHomeRamCost(); - if (Player.money.lt(cost)) { - workerScript.log("upgradeHomeRam", `You don't have enough money. Need ${numeralWrapper.formatMoney(cost)}`); - return false; - } - - homeComputer.maxRam *= 2; - Player.loseMoney(cost, "servers"); - - Player.gainIntelligenceExp(CONSTANTS.IntelligenceSingFnBaseExpGain); - workerScript.log( - "upgradeHomeRam", - `Purchased additional RAM for home computer! It now has ${numeralWrapper.formatRAM( - homeComputer.maxRam, - )} of RAM.`, - ); - return true; - }, - getUpgradeHomeRamCost: function (): any { - updateDynamicRam("getUpgradeHomeRamCost", getRamCost("getUpgradeHomeRamCost")); - checkSingularityAccess("getUpgradeHomeRamCost", 2); - - return Player.getUpgradeHomeRamCost(); - }, - workForCompany: function (companyName: any): any { - updateDynamicRam("workForCompany", getRamCost("workForCompany")); - checkSingularityAccess("workForCompany", 2); - - // Sanitize input - if (companyName == null) { - companyName = Player.companyName; - } - - // Make sure its a valid company - if (companyName == null || companyName === "" || !(Companies[companyName] instanceof Company)) { - workerScript.log("workForCompany", `Invalid company: '${companyName}'`); - return false; - } - - // Make sure player is actually employed at the comapny - if (!Object.keys(Player.jobs).includes(companyName)) { - workerScript.log("workForCompany", `You do not have a job at '${companyName}'`); - return false; - } - - // Check to make sure company position data is valid - const companyPositionName = Player.jobs[companyName]; - const companyPosition = CompanyPositions[companyPositionName]; - if (companyPositionName === "" || !(companyPosition instanceof CompanyPosition)) { - workerScript.log("workForCompany", "You do not have a job"); - return false; - } - - if (Player.isWorking) { - const txt = Player.singularityStopWork(); - workerScript.log("workForCompany", txt); - } - - if (companyPosition.isPartTimeJob()) { - Player.startWorkPartTime(Router, companyName); - } else { - Player.startWork(Router, companyName); - } - workerScript.log("workForCompany", `Began working at '${Player.companyName}' as a '${companyPositionName}'`); - return true; - }, - applyToCompany: function (companyName: any, field: any): any { - updateDynamicRam("applyToCompany", getRamCost("applyToCompany")); - checkSingularityAccess("applyToCompany", 2); - getCompany("applyToCompany", companyName); - - Player.location = companyName; - let res; - switch (field.toLowerCase()) { - case "software": - res = Player.applyForSoftwareJob(true); - break; - case "software consultant": - res = Player.applyForSoftwareConsultantJob(true); - break; - case "it": - res = Player.applyForItJob(true); - break; - case "security engineer": - res = Player.applyForSecurityEngineerJob(true); - break; - case "network engineer": - res = Player.applyForNetworkEngineerJob(true); - break; - case "business": - res = Player.applyForBusinessJob(true); - break; - case "business consultant": - res = Player.applyForBusinessConsultantJob(true); - break; - case "security": - res = Player.applyForSecurityJob(true); - break; - case "agent": - res = Player.applyForAgentJob(true); - break; - case "employee": - res = Player.applyForEmployeeJob(true); - break; - case "part-time employee": - res = Player.applyForPartTimeEmployeeJob(true); - break; - case "waiter": - res = Player.applyForWaiterJob(true); - break; - case "part-time waiter": - res = Player.applyForPartTimeWaiterJob(true); - break; - default: - workerScript.log("applyToCompany", `Invalid job: '${field}'.`); - return false; - } - // TODO https://github.com/danielyxie/bitburner/issues/1378 - // The Player object's applyForJob function can return string with special error messages - // if (isString(res)) { - // workerScript.log("applyToCompany", res); - // return false; - // } - if (res) { - workerScript.log( - "applyToCompany", - `You were offered a new job at '${companyName}' as a '${Player.jobs[companyName]}'`, - ); - } else { - workerScript.log( - "applyToCompany", - `You failed to get a new job/promotion at '${companyName}' in the '${field}' field.`, - ); - } - return res; - }, - getCompanyRep: function (companyName: any): any { - updateDynamicRam("getCompanyRep", getRamCost("getCompanyRep")); - checkSingularityAccess("getCompanyRep", 2); - const company = getCompany("getCompanyRep", companyName); - return company.playerReputation; - }, - getCompanyFavor: function (companyName: any): any { - updateDynamicRam("getCompanyFavor", getRamCost("getCompanyFavor")); - checkSingularityAccess("getCompanyFavor", 2); - const company = getCompany("getCompanyFavor", companyName); - return company.favor; - }, - getCompanyFavorGain: function (companyName: any): any { - updateDynamicRam("getCompanyFavorGain", getRamCost("getCompanyFavorGain")); - checkSingularityAccess("getCompanyFavorGain", 2); - const company = getCompany("getCompanyFavorGain", companyName); - return company.getFavorGain()[0]; - }, - checkFactionInvitations: function (): any { - updateDynamicRam("checkFactionInvitations", getRamCost("checkFactionInvitations")); - checkSingularityAccess("checkFactionInvitations", 2); - // Make a copy of Player.factionInvitations - return Player.factionInvitations.slice(); - }, - joinFaction: function (name: any): any { - updateDynamicRam("joinFaction", getRamCost("joinFaction")); - checkSingularityAccess("joinFaction", 2); - getFaction("joinFaction", name); - - if (!Player.factionInvitations.includes(name)) { - workerScript.log("joinFaction", `You have not been invited by faction '${name}'`); - return false; - } - const fac = Factions[name]; - joinFaction(fac); - - // Update Faction Invitation list to account for joined + banned factions - for (let i = 0; i < Player.factionInvitations.length; ++i) { - if (Player.factionInvitations[i] == name || Factions[Player.factionInvitations[i]].isBanned) { - Player.factionInvitations.splice(i, 1); - i--; - } - } - Player.gainIntelligenceExp(CONSTANTS.IntelligenceSingFnBaseExpGain); - workerScript.log("joinFaction", `Joined the '${name}' faction.`); - return true; - }, - workForFaction: function (name: any, type: any): any { - updateDynamicRam("workForFaction", getRamCost("workForFaction")); - checkSingularityAccess("workForFaction", 2); - getFaction("workForFaction", name); - - // if the player is in a gang and the target faction is any of the gang faction, fail - if (Player.inGang() && AllGangs[name] !== undefined) { - workerScript.log("workForFaction", `Faction '${name}' does not offer work at the moment.`); - return; - } - - if (!Player.factions.includes(name)) { - workerScript.log("workForFaction", `You are not a member of '${name}'`); - return false; - } - - if (Player.isWorking) { - const txt = Player.singularityStopWork(); - workerScript.log("workForFaction", txt); - } - - const fac = Factions[name]; - // Arrays listing factions that allow each time of work - const hackAvailable = [ - "Illuminati", - "Daedalus", - "The Covenant", - "ECorp", - "MegaCorp", - "Bachman & Associates", - "Blade Industries", - "NWO", - "Clarke Incorporated", - "OmniTek Incorporated", - "Four Sigma", - "KuaiGong International", - "Fulcrum Secret Technologies", - "BitRunners", - "The Black Hand", - "NiteSec", - "Chongqing", - "Sector-12", - "New Tokyo", - "Aevum", - "Ishima", - "Volhaven", - "Speakers for the Dead", - "The Dark Army", - "The Syndicate", - "Silhouette", - "Netburners", - "Tian Di Hui", - "CyberSec", - ]; - const fdWkAvailable = [ - "Illuminati", - "Daedalus", - "The Covenant", - "ECorp", - "MegaCorp", - "Bachman & Associates", - "Blade Industries", - "NWO", - "Clarke Incorporated", - "OmniTek Incorporated", - "Four Sigma", - "KuaiGong International", - "The Black Hand", - "Chongqing", - "Sector-12", - "New Tokyo", - "Aevum", - "Ishima", - "Volhaven", - "Speakers for the Dead", - "The Dark Army", - "The Syndicate", - "Silhouette", - "Tetrads", - "Slum Snakes", - ]; - const scWkAvailable = [ - "ECorp", - "MegaCorp", - "Bachman & Associates", - "Blade Industries", - "NWO", - "Clarke Incorporated", - "OmniTek Incorporated", - "Four Sigma", - "KuaiGong International", - "Fulcrum Secret Technologies", - "Chongqing", - "Sector-12", - "New Tokyo", - "Aevum", - "Ishima", - "Volhaven", - "Speakers for the Dead", - "The Syndicate", - "Tetrads", - "Slum Snakes", - "Tian Di Hui", - ]; - - switch (type.toLowerCase()) { - case "hacking": - case "hacking contracts": - case "hackingcontracts": - if (!hackAvailable.includes(fac.name)) { - workerScript.log("workForFaction", `Faction '${fac.name}' do not need help with hacking contracts.`); - return false; - } - Player.startFactionHackWork(Router, fac); - workerScript.log("workForFaction", `Started carrying out hacking contracts for '${fac.name}'`); - return true; - case "field": - case "fieldwork": - case "field work": - if (!fdWkAvailable.includes(fac.name)) { - workerScript.log("workForFaction", `Faction '${fac.name}' do not need help with field missions.`); - return false; - } - Player.startFactionFieldWork(Router, fac); - workerScript.log("workForFaction", `Started carrying out field missions for '${fac.name}'`); - return true; - case "security": - case "securitywork": - case "security work": - if (!scWkAvailable.includes(fac.name)) { - workerScript.log("workForFaction", `Faction '${fac.name}' do not need help with security work.`); - return false; - } - Player.startFactionSecurityWork(Router, fac); - workerScript.log("workForFaction", `Started carrying out security work for '${fac.name}'`); - return true; - default: - workerScript.log("workForFaction", `Invalid work type: '${type}`); - } - return true; - }, - getFactionRep: function (name: any): any { - updateDynamicRam("getFactionRep", getRamCost("getFactionRep")); - checkSingularityAccess("getFactionRep", 2); - const faction = getFaction("getFactionRep", name); - return faction.playerReputation; - }, - getFactionFavor: function (name: any): any { - updateDynamicRam("getFactionFavor", getRamCost("getFactionFavor")); - checkSingularityAccess("getFactionFavor", 2); - const faction = getFaction("getFactionFavor", name); - return faction.favor; - }, - getFactionFavorGain: function (name: any): any { - updateDynamicRam("getFactionFavorGain", getRamCost("getFactionFavorGain")); - checkSingularityAccess("getFactionFavorGain", 2); - const faction = getFaction("getFactionFavorGain", name); - return faction.getFavorGain()[0]; - }, - donateToFaction: function (name: any, amt: any): any { - updateDynamicRam("donateToFaction", getRamCost("donateToFaction")); - checkSingularityAccess("donateToFaction", 3); - const faction = getFaction("donateToFaction", name); - - if (typeof amt !== "number" || amt <= 0) { - workerScript.log("donateToFaction", `Invalid donation amount: '${amt}'.`); - return false; - } - if (Player.money.lt(amt)) { - workerScript.log( - "donateToFaction", - `You do not have enough money to donate ${numeralWrapper.formatMoney(amt)} to '${name}'`, - ); - return false; - } - const repNeededToDonate = Math.round(CONSTANTS.BaseFavorToDonate * BitNodeMultipliers.RepToDonateToFaction); - if (faction.favor < repNeededToDonate) { - workerScript.log( - "donateToFaction", - `You do not have enough favor to donate to this faction. Have ${faction.favor}, need ${repNeededToDonate}`, - ); - return false; - } - const repGain = (amt / CONSTANTS.DonateMoneyToRepDivisor) * Player.faction_rep_mult; - faction.playerReputation += repGain; - Player.loseMoney(amt, "other"); - workerScript.log( - "donateToFaction", - `${numeralWrapper.formatMoney(amt)} donated to '${name}' for ${numeralWrapper.formatReputation( - repGain, - )} reputation`, - ); - return true; - }, - createProgram: function (name: any): any { - updateDynamicRam("createProgram", getRamCost("createProgram")); - checkSingularityAccess("createProgram", 3); - - if (Player.isWorking) { - const txt = Player.singularityStopWork(); - workerScript.log("createProgram", txt); - } - - name = name.toLowerCase(); - - let p = null; - for (const key in Programs) { - if (Programs[key].name.toLowerCase() == name) { - p = Programs[key]; - } - } - - if (p == null) { - workerScript.log("createProgram", `The specified program does not exist: '${name}`); - return false; - } - - if (Player.hasProgram(p.name)) { - workerScript.log("createProgram", `You already have the '${p.name}' program`); - return false; - } - - const create = p.create; - if (create === null) { - workerScript.log("createProgram", `You cannot create the '${p.name}' program`); - return false; - } - - if (!create.req(Player)) { - workerScript.log("createProgram", `Hacking level is too low to create '${p.name}' (level ${create.level} req)`); - return false; - } - - Player.startCreateProgramWork(Router, p.name, create.time, create.level); - workerScript.log("createProgram", `Began creating program: '${name}'`); - return true; - }, - commitCrime: function (crimeRoughName: any): any { - updateDynamicRam("commitCrime", getRamCost("commitCrime")); - checkSingularityAccess("commitCrime", 3); - - if (Player.isWorking) { - const txt = Player.singularityStopWork(); - workerScript.log("commitCrime", txt); - } - - // Set Location to slums - Player.gotoLocation(LocationName.Slums); - - const crime = findCrime(crimeRoughName.toLowerCase()); - if (crime == null) { - // couldn't find crime - throw makeRuntimeErrorMsg("commitCrime", `Invalid crime: '${crimeRoughName}'`); - } - workerScript.log("commitCrime", `Attempting to commit ${crime.name}...`); - return crime.commit(Router, Player, 1, workerScript); - }, - getCrimeChance: function (crimeRoughName: any): any { - updateDynamicRam("getCrimeChance", getRamCost("getCrimeChance")); - checkSingularityAccess("getCrimeChance", 3); - - const crime = findCrime(crimeRoughName.toLowerCase()); - if (crime == null) { - throw makeRuntimeErrorMsg("getCrimeChance", `Invalid crime: ${crimeRoughName}`); - } - - return crime.successRate(Player); - }, - getCrimeStats: function (crimeRoughName: any): any { - updateDynamicRam("getCrimeStats", getRamCost("getCrimeStats")); - checkSingularityAccess("getCrimeStats", 3); - - const crime = findCrime(crimeRoughName.toLowerCase()); - if (crime == null) { - throw makeRuntimeErrorMsg("getCrimeStats", `Invalid crime: ${crimeRoughName}`); - } - - return Object.assign({}, crime); - }, ...augmentations, diff --git a/src/NetscriptFunctions/Augmentations.ts b/src/NetscriptFunctions/Augmentations.ts deleted file mode 100644 index 100ea6714..000000000 --- a/src/NetscriptFunctions/Augmentations.ts +++ /dev/null @@ -1,224 +0,0 @@ -import { INetscriptHelper } from "./INetscriptHelper"; -import { WorkerScript } from "../Netscript/WorkerScript"; -import { IPlayer } from "../PersonObjects/IPlayer"; -import { purchaseAugmentation } from "../Faction/FactionHelpers"; -import { startWorkerScript } from "../NetscriptWorker"; -import { Augmentation } from "../Augmentation/Augmentation"; -import { Augmentations } from "../Augmentation/Augmentations"; -import { augmentationExists, installAugmentations } from "../Augmentation/AugmentationHelpers"; -import { prestigeAugmentation } from "../Prestige"; -import { AugmentationNames } from "../Augmentation/data/AugmentationNames"; -import { killWorkerScript } from "../Netscript/killWorkerScript"; -import { CONSTANTS } from "../Constants"; -import { isString } from "../utils/helpers/isString"; -import { getRamCost } from "../Netscript/RamCostGenerator"; -import { RunningScript } from "../Script/RunningScript"; - -export interface INetscriptAugmentations { - getOwnedAugmentations(purchased?: any): any; - getOwnedSourceFiles(): any; - getAugmentationsFromFaction(facname: any): any; - getAugmentationCost(name: any): any; - getAugmentationPrereq(name: any): any; - getAugmentationPrice(name: any): any; - getAugmentationRepReq(name: any): any; - getAugmentationStats(name: any): any; - purchaseAugmentation(faction: any, name: any): any; - softReset(cbScript: any): any; - installAugmentations(cbScript: any): any; -} - -export function NetscriptAugmentations( - player: IPlayer, - workerScript: WorkerScript, - helper: INetscriptHelper, -): INetscriptAugmentations { - const getAugmentation = function (func: any, name: any): Augmentation { - if (!augmentationExists(name)) { - throw helper.makeRuntimeErrorMsg(func, `Invalid augmentation: '${name}'`); - } - - return Augmentations[name]; - }; - const runAfterReset = function (cbScript = null): void { - //Run a script after reset - if (cbScript && isString(cbScript)) { - const home = player.getHomeComputer(); - for (const script of home.scripts) { - if (script.filename === cbScript) { - const ramUsage = script.ramUsage; - const ramAvailable = home.maxRam - home.ramUsed; - if (ramUsage > ramAvailable) { - return; // Not enough RAM - } - const runningScriptObj = new RunningScript(script, []); // No args - runningScriptObj.threads = 1; // Only 1 thread - startWorkerScript(runningScriptObj, home); - } - } - } - }; - return { - getOwnedAugmentations: function (purchased: any = false): any { - helper.updateDynamicRam("getOwnedAugmentations", getRamCost("getOwnedAugmentations")); - helper.checkSingularityAccess("getOwnedAugmentations", 3); - const res = []; - for (let i = 0; i < player.augmentations.length; ++i) { - res.push(player.augmentations[i].name); - } - if (purchased) { - for (let i = 0; i < player.queuedAugmentations.length; ++i) { - res.push(player.queuedAugmentations[i].name); - } - } - return res; - }, - getOwnedSourceFiles: function (): any { - helper.updateDynamicRam("getOwnedSourceFiles", getRamCost("getOwnedSourceFiles")); - helper.checkSingularityAccess("getOwnedSourceFiles", 3); - const res = []; - for (let i = 0; i < player.sourceFiles.length; ++i) { - res.push({ - n: player.sourceFiles[i].n, - lvl: player.sourceFiles[i].lvl, - }); - } - return res; - }, - getAugmentationsFromFaction: function (facname: any): any { - helper.updateDynamicRam("getAugmentationsFromFaction", getRamCost("getAugmentationsFromFaction")); - helper.checkSingularityAccess("getAugmentationsFromFaction", 3); - const faction = helper.getFaction("getAugmentationsFromFaction", facname); - - // If player has a gang with this faction, return all augmentations. - if (player.hasGangWith(facname)) { - const res = []; - for (const augName in Augmentations) { - const aug = Augmentations[augName]; - if (!aug.isSpecial) { - res.push(augName); - } - } - - return res; - } - - return faction.augmentations.slice(); - }, - getAugmentationCost: function (name: any): any { - helper.updateDynamicRam("getAugmentationCost", getRamCost("getAugmentationCost")); - helper.checkSingularityAccess("getAugmentationCost", 3); - const aug = getAugmentation("getAugmentationCost", name); - return [aug.baseRepRequirement, aug.baseCost]; - }, - getAugmentationPrereq: function (name: any): any { - helper.updateDynamicRam("getAugmentationPrereq", getRamCost("getAugmentationPrereq")); - helper.checkSingularityAccess("getAugmentationPrereq", 3); - const aug = getAugmentation("getAugmentationPrereq", name); - return aug.prereqs.slice(); - }, - getAugmentationPrice: function (name: any): any { - helper.updateDynamicRam("getAugmentationPrice", getRamCost("getAugmentationPrice")); - helper.checkSingularityAccess("getAugmentationPrice", 3); - const aug = getAugmentation("getAugmentationPrice", name); - return aug.baseCost; - }, - getAugmentationRepReq: function (name: any): any { - helper.updateDynamicRam("getAugmentationRepReq", getRamCost("getAugmentationRepReq")); - helper.checkSingularityAccess("getAugmentationRepReq", 3); - const aug = getAugmentation("getAugmentationRepReq", name); - return aug.baseRepRequirement; - }, - getAugmentationStats: function (name: any): any { - helper.updateDynamicRam("getAugmentationStats", getRamCost("getAugmentationStats")); - helper.checkSingularityAccess("getAugmentationStats", 3); - const aug = getAugmentation("getAugmentationStats", name); - return Object.assign({}, aug.mults); - }, - purchaseAugmentation: function (faction: any, name: any): any { - helper.updateDynamicRam("purchaseAugmentation", getRamCost("purchaseAugmentation")); - helper.checkSingularityAccess("purchaseAugmentation", 3); - const fac = helper.getFaction("purchaseAugmentation", faction); - const aug = getAugmentation("purchaseAugmentation", name); - - let augs = []; - if (player.hasGangWith(faction)) { - for (const augName in Augmentations) { - const tempAug = Augmentations[augName]; - if (!tempAug.isSpecial) { - augs.push(augName); - } - } - } else { - augs = fac.augmentations; - } - - if (!augs.includes(name)) { - workerScript.log("purchaseAugmentation", `Faction '${faction}' does not have the '${name}' augmentation.`); - return false; - } - - const isNeuroflux = aug.name === AugmentationNames.NeuroFluxGovernor; - if (!isNeuroflux) { - for (let j = 0; j < player.queuedAugmentations.length; ++j) { - if (player.queuedAugmentations[j].name === aug.name) { - workerScript.log("purchaseAugmentation", `You already have the '${name}' augmentation.`); - return false; - } - } - for (let j = 0; j < player.augmentations.length; ++j) { - if (player.augmentations[j].name === aug.name) { - workerScript.log("purchaseAugmentation", `You already have the '${name}' augmentation.`); - return false; - } - } - } - - if (fac.playerReputation < aug.baseRepRequirement) { - workerScript.log("purchaseAugmentation", `You do not have enough reputation with '${fac.name}'.`); - return false; - } - - const res = purchaseAugmentation(aug, fac, true); - workerScript.log("purchaseAugmentation", res); - if (isString(res) && res.startsWith("You purchased")) { - player.gainIntelligenceExp(CONSTANTS.IntelligenceSingFnBaseExpGain); - return true; - } else { - return false; - } - }, - softReset: function (cbScript: any): any { - helper.updateDynamicRam("softReset", getRamCost("softReset")); - helper.checkSingularityAccess("softReset", 3); - - workerScript.log("softReset", "Soft resetting. This will cause this script to be killed"); - setTimeout(() => { - prestigeAugmentation(); - runAfterReset(cbScript); - }, 0); - - // Prevent workerScript from "finishing execution naturally" - workerScript.running = false; - killWorkerScript(workerScript); - }, - installAugmentations: function (cbScript: any): any { - helper.updateDynamicRam("installAugmentations", getRamCost("installAugmentations")); - helper.checkSingularityAccess("installAugmentations", 3); - - if (player.queuedAugmentations.length === 0) { - workerScript.log("installAugmentations", "You do not have any Augmentations to be installed."); - return false; - } - player.gainIntelligenceExp(CONSTANTS.IntelligenceSingFnBaseExpGain); - workerScript.log("installAugmentations", "Installing Augmentations. This will cause this script to be killed"); - setTimeout(() => { - installAugmentations(); - runAfterReset(cbScript); - }, 0); - - workerScript.running = false; // Prevent workerScript from "finishing execution naturally" - killWorkerScript(workerScript); - }, - }; -} diff --git a/src/NetscriptFunctions/CodingContract.ts b/src/NetscriptFunctions/CodingContract.ts index 2717e2132..fa183ff62 100644 --- a/src/NetscriptFunctions/CodingContract.ts +++ b/src/NetscriptFunctions/CodingContract.ts @@ -4,20 +4,13 @@ import { IPlayer } from "../PersonObjects/IPlayer"; import { getRamCost } from "../Netscript/RamCostGenerator"; import { is2DArray } from "../utils/helpers/is2DArray"; import { CodingContract } from "../CodingContracts"; - -export interface INetscriptCodingContract { - attempt(answer: any, fn: any, ip?: any, options?: { returnReward: any }): any; - getContractType(fn: any, ip?: any): any; - getData(fn: any, ip?: any): any; - getDescription(fn: any, ip?: any): any; - getNumTriesRemaining(fn: any, ip?: any): any; -} +import { CodingContract as ICodingContract } from "../ScriptEditor/NetscriptDefinitions"; export function NetscriptCodingContract( player: IPlayer, workerScript: WorkerScript, helper: INetscriptHelper, -): INetscriptCodingContract { +): ICodingContract { const getCodingContract = function (func: any, ip: any, fn: any): CodingContract { const server = helper.getServer(ip, func); const contract = server.getContract(fn); diff --git a/src/NetscriptFunctions/Formulas.ts b/src/NetscriptFunctions/Formulas.ts index 6a49ca0a4..6d8defd6a 100644 --- a/src/NetscriptFunctions/Formulas.ts +++ b/src/NetscriptFunctions/Formulas.ts @@ -28,6 +28,7 @@ import { calculateWeakenTime, } from "../Hacking"; import { Programs } from "../Programs/Programs"; +import { Formulas as IFormulas } from "../ScriptEditor/NetscriptDefinitions"; export interface INetscriptFormulas { skills: { @@ -63,11 +64,7 @@ export interface INetscriptFormulas { }; } -export function NetscriptFormulas( - player: IPlayer, - workerScript: WorkerScript, - helper: INetscriptHelper, -): INetscriptFormulas { +export function NetscriptFormulas(player: IPlayer, workerScript: WorkerScript, helper: INetscriptHelper): IFormulas { const checkFormulasAccess = function (func: string): void { if (!player.hasProgram(Programs.Formulas.name)) { throw helper.makeRuntimeErrorMsg(`formulas.${func}`, `Requires Formulas.exe to run.`); diff --git a/src/NetscriptFunctions/Gang.ts b/src/NetscriptFunctions/Gang.ts index 0c487308f..c6768cf69 100644 --- a/src/NetscriptFunctions/Gang.ts +++ b/src/NetscriptFunctions/Gang.ts @@ -9,30 +9,9 @@ import { WorkerScript } from "../Netscript/WorkerScript"; import { GangMember } from "../Gang/GangMember"; import { GangMemberTask } from "../Gang/GangMemberTask"; -export interface INetscriptGang { - createGang(faction: string): boolean; - inGang(): boolean; - getMemberNames(): string[]; - getGangInformation(): any; - getOtherGangInformation(): any; - getMemberInformation(name: string): any; - canRecruitMember(): boolean; - recruitMember(name: string): boolean; - getTaskNames(): string[]; - setMemberTask(memberName: string, taskName: string): boolean; - getTaskStats(taskName: string): any; - getEquipmentNames(): string[]; - getEquipmentCost(equipName: string): number; - getEquipmentType(equipName: string): string; - getEquipmentStats(equipName: string): any; - purchaseEquipment(memberName: string, equipName: string): any; - ascendMember(name: string): any; - setTerritoryWarfare(engage: boolean): void; - getChanceToWinClash(otherGang: string): number; - getBonusTime(): number; -} +import { Gang as IGang } from "../ScriptEditor/NetscriptDefinitions"; -export function NetscriptGang(player: IPlayer, workerScript: WorkerScript, helper: INetscriptHelper): INetscriptGang { +export function NetscriptGang(player: IPlayer, workerScript: WorkerScript, helper: INetscriptHelper): IGang { const checkGangApiAccess = function (func: string): void { const gang = player.gang; if (gang === null) throw new Error("Must have joined gang"); diff --git a/src/NetscriptFunctions/Hacknet.ts b/src/NetscriptFunctions/Hacknet.ts index 93c9b1d6b..dcac5617f 100644 --- a/src/NetscriptFunctions/Hacknet.ts +++ b/src/NetscriptFunctions/Hacknet.ts @@ -18,34 +18,9 @@ import { HacknetServer } from "../Hacknet/HacknetServer"; import { HacknetNode } from "../Hacknet/HacknetNode"; import { GetServer } from "../Server/AllServers"; -export interface INetscriptHacknet { - numNodes(): number; - maxNumNodes(): number; - purchaseNode(): any; - getPurchaseNodeCost(): number; - getNodeStats(i: number): any; - upgradeLevel(i: number, n: number): boolean; - upgradeRam(i: number, n: number): boolean; - upgradeCore(i: number, n: number): boolean; - upgradeCache(i: number, n: number): boolean; - getLevelUpgradeCost(i: number, n: number): number; - getRamUpgradeCost(i: number, n: number): number; - getCoreUpgradeCost(i: number, n: number): number; - getCacheUpgradeCost(i: number, n: number): number; - numHashes(): number; - hashCapacity(): number; - hashCost(upgName: string): number; - spendHashes(upgName: string, upgTarget: string): any; - getHashUpgradeLevel(upgName: string): number; - getStudyMult(): number; - getTrainingMult(): number; -} +import { Hacknet as IHacknet } from "../ScriptEditor/NetscriptDefinitions"; -export function NetscriptHacknet( - player: IPlayer, - workerScript: WorkerScript, - helper: INetscriptHelper, -): INetscriptHacknet { +export function NetscriptHacknet(player: IPlayer, workerScript: WorkerScript, helper: INetscriptHelper): IHacknet { // Utility function to get Hacknet Node object const getHacknetNode = function (i: any, callingFn = ""): HacknetNode | HacknetServer { if (isNaN(i)) { diff --git a/src/NetscriptFunctions/INetscriptHelper.ts b/src/NetscriptFunctions/INetscriptHelper.ts index bf17cfe03..78cfb9625 100644 --- a/src/NetscriptFunctions/INetscriptHelper.ts +++ b/src/NetscriptFunctions/INetscriptHelper.ts @@ -1,5 +1,4 @@ import { BaseServer } from "../Server/BaseServer"; -import { Faction } from "../Faction/Faction"; export interface INetscriptHelper { updateDynamicRam(functionName: string, ram: number): void; @@ -9,5 +8,5 @@ export interface INetscriptHelper { boolean(v: any): boolean; getServer(ip: any, fn: any): BaseServer; checkSingularityAccess(func: string, n: number): void; - getFaction(func: string, name: string): Faction; + hack(hostname: string, manual: boolean): Promise; } diff --git a/src/NetscriptFunctions/Singularity.ts b/src/NetscriptFunctions/Singularity.ts new file mode 100644 index 000000000..28ff295ba --- /dev/null +++ b/src/NetscriptFunctions/Singularity.ts @@ -0,0 +1,1219 @@ +import { INetscriptHelper } from "./INetscriptHelper"; +import { WorkerScript } from "../Netscript/WorkerScript"; +import { IPlayer } from "../PersonObjects/IPlayer"; +import { purchaseAugmentation, joinFaction } from "../Faction/FactionHelpers"; +import { startWorkerScript } from "../NetscriptWorker"; +import { Augmentation } from "../Augmentation/Augmentation"; +import { Augmentations } from "../Augmentation/Augmentations"; +import { augmentationExists, installAugmentations } from "../Augmentation/AugmentationHelpers"; +import { prestigeAugmentation } from "../Prestige"; +import { AugmentationNames } from "../Augmentation/data/AugmentationNames"; +import { killWorkerScript } from "../Netscript/killWorkerScript"; +import { CONSTANTS } from "../Constants"; +import { isString } from "../utils/helpers/isString"; +import { getRamCost } from "../Netscript/RamCostGenerator"; +import { RunningScript } from "../Script/RunningScript"; + +import { Singularity as ISingularity } from "../ScriptEditor/NetscriptDefinitions"; + +import { findCrime } from "../Crime/CrimeHelpers"; +import { CompanyPosition } from "../Company/CompanyPosition"; +import { CompanyPositions } from "../Company/CompanyPositions"; +import { DarkWebItems } from "../DarkWeb/DarkWebItems"; +import { AllGangs } from "../Gang/AllGangs"; +import { CityName } from "../Locations/data/CityNames"; +import { LocationName } from "../Locations/data/LocationNames"; +import { Router } from "../ui/GameRoot"; +import { SpecialServers } from "../Server/data/SpecialServers"; +import { Page } from "../ui/Router"; +import { Locations } from "../Locations/Locations"; +import { GetServer, AddToAllServers, createUniqueRandomIp } from "../Server/AllServers"; +import { Programs } from "../Programs/Programs"; +import { numeralWrapper } from "../ui/numeralFormat"; +import { BitNodeMultipliers } from "../BitNode/BitNodeMultipliers"; +import { Company } from "../Company/Company"; +import { Companies } from "../Company/Companies"; +import { Factions, factionExists } from "../Faction/Factions"; +import { Faction } from "../Faction/Faction"; +import { netscriptDelay } from "../NetscriptEvaluator"; +import { convertTimeMsToTimeElapsedString } from "../utils/StringHelperFunctions"; +import { getServerOnNetwork, safetlyCreateUniqueServer } from "../Server/ServerHelpers"; +import { Terminal } from "../Terminal"; +import { calculateHackingTime } from "../Hacking"; +import { Server } from "../Server/Server"; +import { netscriptCanHack } from "../Hacking/netscriptCanHack"; + +export function NetscriptSingularity( + player: IPlayer, + workerScript: WorkerScript, + helper: INetscriptHelper, +): ISingularity { + const getAugmentation = function (func: any, name: any): Augmentation { + if (!augmentationExists(name)) { + throw helper.makeRuntimeErrorMsg(func, `Invalid augmentation: '${name}'`); + } + + return Augmentations[name]; + }; + + const getFaction = function (func: any, name: any): Faction { + if (!factionExists(name)) { + throw helper.makeRuntimeErrorMsg(func, `Invalid faction name: '${name}`); + } + + return Factions[name]; + }; + + const getCompany = function (func: any, name: any): Company { + const company = Companies[name]; + if (company == null || !(company instanceof Company)) { + throw helper.makeRuntimeErrorMsg(func, `Invalid company name: '${name}'`); + } + return company; + }; + + const runAfterReset = function (cbScript = null): void { + //Run a script after reset + if (cbScript && isString(cbScript)) { + const home = player.getHomeComputer(); + for (const script of home.scripts) { + if (script.filename === cbScript) { + const ramUsage = script.ramUsage; + const ramAvailable = home.maxRam - home.ramUsed; + if (ramUsage > ramAvailable) { + return; // Not enough RAM + } + const runningScriptObj = new RunningScript(script, []); // No args + runningScriptObj.threads = 1; // Only 1 thread + startWorkerScript(runningScriptObj, home); + } + } + } + }; + return { + getOwnedAugmentations: function (purchased: any = false): any { + helper.updateDynamicRam("getOwnedAugmentations", getRamCost("getOwnedAugmentations")); + helper.checkSingularityAccess("getOwnedAugmentations", 3); + const res = []; + for (let i = 0; i < player.augmentations.length; ++i) { + res.push(player.augmentations[i].name); + } + if (purchased) { + for (let i = 0; i < player.queuedAugmentations.length; ++i) { + res.push(player.queuedAugmentations[i].name); + } + } + return res; + }, + getOwnedSourceFiles: function (): any { + helper.updateDynamicRam("getOwnedSourceFiles", getRamCost("getOwnedSourceFiles")); + helper.checkSingularityAccess("getOwnedSourceFiles", 3); + const res = []; + for (let i = 0; i < player.sourceFiles.length; ++i) { + res.push({ + n: player.sourceFiles[i].n, + lvl: player.sourceFiles[i].lvl, + }); + } + return res; + }, + getAugmentationsFromFaction: function (facname: any): any { + helper.updateDynamicRam("getAugmentationsFromFaction", getRamCost("getAugmentationsFromFaction")); + helper.checkSingularityAccess("getAugmentationsFromFaction", 3); + const faction = getFaction("getAugmentationsFromFaction", facname); + + // If player has a gang with this faction, return all augmentations. + if (player.hasGangWith(facname)) { + const res = []; + for (const augName in Augmentations) { + const aug = Augmentations[augName]; + if (!aug.isSpecial) { + res.push(augName); + } + } + + return res; + } + + return faction.augmentations.slice(); + }, + getAugmentationCost: function (name: any): any { + helper.updateDynamicRam("getAugmentationCost", getRamCost("getAugmentationCost")); + helper.checkSingularityAccess("getAugmentationCost", 3); + const aug = getAugmentation("getAugmentationCost", name); + return [aug.baseRepRequirement, aug.baseCost]; + }, + getAugmentationPrereq: function (name: any): any { + helper.updateDynamicRam("getAugmentationPrereq", getRamCost("getAugmentationPrereq")); + helper.checkSingularityAccess("getAugmentationPrereq", 3); + const aug = getAugmentation("getAugmentationPrereq", name); + return aug.prereqs.slice(); + }, + getAugmentationPrice: function (name: any): any { + helper.updateDynamicRam("getAugmentationPrice", getRamCost("getAugmentationPrice")); + helper.checkSingularityAccess("getAugmentationPrice", 3); + const aug = getAugmentation("getAugmentationPrice", name); + return aug.baseCost; + }, + getAugmentationRepReq: function (name: any): any { + helper.updateDynamicRam("getAugmentationRepReq", getRamCost("getAugmentationRepReq")); + helper.checkSingularityAccess("getAugmentationRepReq", 3); + const aug = getAugmentation("getAugmentationRepReq", name); + return aug.baseRepRequirement; + }, + getAugmentationStats: function (name: any): any { + helper.updateDynamicRam("getAugmentationStats", getRamCost("getAugmentationStats")); + helper.checkSingularityAccess("getAugmentationStats", 3); + const aug = getAugmentation("getAugmentationStats", name); + return Object.assign({}, aug.mults); + }, + purchaseAugmentation: function (faction: any, name: any): any { + helper.updateDynamicRam("purchaseAugmentation", getRamCost("purchaseAugmentation")); + helper.checkSingularityAccess("purchaseAugmentation", 3); + const fac = getFaction("purchaseAugmentation", faction); + const aug = getAugmentation("purchaseAugmentation", name); + + let augs = []; + if (player.hasGangWith(faction)) { + for (const augName in Augmentations) { + const tempAug = Augmentations[augName]; + if (!tempAug.isSpecial) { + augs.push(augName); + } + } + } else { + augs = fac.augmentations; + } + + if (!augs.includes(name)) { + workerScript.log("purchaseAugmentation", `Faction '${faction}' does not have the '${name}' augmentation.`); + return false; + } + + const isNeuroflux = aug.name === AugmentationNames.NeuroFluxGovernor; + if (!isNeuroflux) { + for (let j = 0; j < player.queuedAugmentations.length; ++j) { + if (player.queuedAugmentations[j].name === aug.name) { + workerScript.log("purchaseAugmentation", `You already have the '${name}' augmentation.`); + return false; + } + } + for (let j = 0; j < player.augmentations.length; ++j) { + if (player.augmentations[j].name === aug.name) { + workerScript.log("purchaseAugmentation", `You already have the '${name}' augmentation.`); + return false; + } + } + } + + if (fac.playerReputation < aug.baseRepRequirement) { + workerScript.log("purchaseAugmentation", `You do not have enough reputation with '${fac.name}'.`); + return false; + } + + const res = purchaseAugmentation(aug, fac, true); + workerScript.log("purchaseAugmentation", res); + if (isString(res) && res.startsWith("You purchased")) { + player.gainIntelligenceExp(CONSTANTS.IntelligenceSingFnBaseExpGain); + return true; + } else { + return false; + } + }, + softReset: function (cbScript: any): any { + helper.updateDynamicRam("softReset", getRamCost("softReset")); + helper.checkSingularityAccess("softReset", 3); + + workerScript.log("softReset", "Soft resetting. This will cause this script to be killed"); + setTimeout(() => { + prestigeAugmentation(); + runAfterReset(cbScript); + }, 0); + + // Prevent workerScript from "finishing execution naturally" + workerScript.running = false; + killWorkerScript(workerScript); + }, + installAugmentations: function (cbScript: any): any { + helper.updateDynamicRam("installAugmentations", getRamCost("installAugmentations")); + helper.checkSingularityAccess("installAugmentations", 3); + + if (player.queuedAugmentations.length === 0) { + workerScript.log("installAugmentations", "You do not have any Augmentations to be installed."); + return false; + } + player.gainIntelligenceExp(CONSTANTS.IntelligenceSingFnBaseExpGain); + workerScript.log("installAugmentations", "Installing Augmentations. This will cause this script to be killed"); + setTimeout(() => { + installAugmentations(); + runAfterReset(cbScript); + }, 0); + + workerScript.running = false; // Prevent workerScript from "finishing execution naturally" + killWorkerScript(workerScript); + }, + + goToLocation: function (locationName: any): boolean { + helper.updateDynamicRam("goToLocation", getRamCost("goToLocation")); + helper.checkSingularityAccess("goToLocation", 1); + const location = Object.values(Locations).find((l) => l.name === locationName); + if (!location) { + workerScript.log("goToLocation", `No location named ${locationName}`); + return false; + } + if (player.city !== location.city) { + workerScript.log("goToLocation", `No location named ${locationName} in ${player.city}`); + return false; + } + Router.toLocation(location); + return true; + }, + universityCourse: function (universityName: any, className: any): any { + helper.updateDynamicRam("universityCourse", getRamCost("universityCourse")); + helper.checkSingularityAccess("universityCourse", 1); + if (player.isWorking) { + const txt = player.singularityStopWork(); + workerScript.log("universityCourse", txt); + } + + let costMult, expMult; + switch (universityName.toLowerCase()) { + case LocationName.AevumSummitUniversity.toLowerCase(): + if (player.city != CityName.Aevum) { + workerScript.log( + "universityCourse", + "You cannot study at 'Summit University' because you are not in 'Aevum'.", + ); + return false; + } + player.gotoLocation(LocationName.AevumSummitUniversity); + costMult = 4; + expMult = 3; + break; + case LocationName.Sector12RothmanUniversity.toLowerCase(): + if (player.city != CityName.Sector12) { + workerScript.log( + "universityCourse", + "You cannot study at 'Rothman University' because you are not in 'Sector-12'.", + ); + return false; + } + player.location = LocationName.Sector12RothmanUniversity; + costMult = 3; + expMult = 2; + break; + case LocationName.VolhavenZBInstituteOfTechnology.toLowerCase(): + if (player.city != CityName.Volhaven) { + workerScript.log( + "universityCourse", + "You cannot study at 'ZB Institute of Technology' because you are not in 'Volhaven'.", + ); + return false; + } + player.location = LocationName.VolhavenZBInstituteOfTechnology; + costMult = 5; + expMult = 4; + break; + default: + workerScript.log("universityCourse", `Invalid university name: '${universityName}'.`); + return false; + } + + let task; + switch (className.toLowerCase()) { + case "Study Computer Science".toLowerCase(): + task = CONSTANTS.ClassStudyComputerScience; + break; + case "Data Structures".toLowerCase(): + task = CONSTANTS.ClassDataStructures; + break; + case "Networks".toLowerCase(): + task = CONSTANTS.ClassNetworks; + break; + case "Algorithms".toLowerCase(): + task = CONSTANTS.ClassAlgorithms; + break; + case "Management".toLowerCase(): + task = CONSTANTS.ClassManagement; + break; + case "Leadership".toLowerCase(): + task = CONSTANTS.ClassLeadership; + break; + default: + workerScript.log("universityCourse", `Invalid class name: ${className}.`); + return false; + } + player.startClass(Router, costMult, expMult, task); + workerScript.log("universityCourse", `Started ${task} at ${universityName}`); + return true; + }, + + gymWorkout: function (gymName: any, stat: any): any { + helper.updateDynamicRam("gymWorkout", getRamCost("gymWorkout")); + helper.checkSingularityAccess("gymWorkout", 1); + if (player.isWorking) { + const txt = player.singularityStopWork(); + workerScript.log("gymWorkout", txt); + } + let costMult, expMult; + switch (gymName.toLowerCase()) { + case LocationName.AevumCrushFitnessGym.toLowerCase(): + if (player.city != CityName.Aevum) { + workerScript.log("gymWorkout", "You cannot workout at 'Crush Fitness' because you are not in 'Aevum'."); + return false; + } + player.location = LocationName.AevumCrushFitnessGym; + costMult = 3; + expMult = 2; + break; + case LocationName.AevumSnapFitnessGym.toLowerCase(): + if (player.city != CityName.Aevum) { + workerScript.log("gymWorkout", "You cannot workout at 'Snap Fitness' because you are not in 'Aevum'."); + return false; + } + player.location = LocationName.AevumSnapFitnessGym; + costMult = 10; + expMult = 5; + break; + case LocationName.Sector12IronGym.toLowerCase(): + if (player.city != CityName.Sector12) { + workerScript.log("gymWorkout", "You cannot workout at 'Iron Gym' because you are not in 'Sector-12'."); + return false; + } + player.location = LocationName.Sector12IronGym; + costMult = 1; + expMult = 1; + break; + case LocationName.Sector12PowerhouseGym.toLowerCase(): + if (player.city != CityName.Sector12) { + workerScript.log( + "gymWorkout", + "You cannot workout at 'Powerhouse Gym' because you are not in 'Sector-12'.", + ); + return false; + } + player.location = LocationName.Sector12PowerhouseGym; + costMult = 20; + expMult = 10; + break; + case LocationName.VolhavenMilleniumFitnessGym.toLowerCase(): + if (player.city != CityName.Volhaven) { + workerScript.log( + "gymWorkout", + "You cannot workout at 'Millenium Fitness Gym' because you are not in 'Volhaven'.", + ); + return false; + } + player.location = LocationName.VolhavenMilleniumFitnessGym; + costMult = 7; + expMult = 4; + break; + default: + workerScript.log("gymWorkout", `Invalid gym name: ${gymName}. gymWorkout() failed`); + return false; + } + + switch (stat.toLowerCase()) { + case "strength".toLowerCase(): + case "str".toLowerCase(): + player.startClass(Router, costMult, expMult, CONSTANTS.ClassGymStrength); + break; + case "defense".toLowerCase(): + case "def".toLowerCase(): + player.startClass(Router, costMult, expMult, CONSTANTS.ClassGymDefense); + break; + case "dexterity".toLowerCase(): + case "dex".toLowerCase(): + player.startClass(Router, costMult, expMult, CONSTANTS.ClassGymDexterity); + break; + case "agility".toLowerCase(): + case "agi".toLowerCase(): + player.startClass(Router, costMult, expMult, CONSTANTS.ClassGymAgility); + break; + default: + workerScript.log("gymWorkout", `Invalid stat: ${stat}.`); + return false; + } + workerScript.log("gymWorkout", `Started training ${stat} at ${gymName}`); + return true; + }, + + travelToCity: function (cityname: any): any { + helper.updateDynamicRam("travelToCity", getRamCost("travelToCity")); + helper.checkSingularityAccess("travelToCity", 1); + + switch (cityname) { + case CityName.Aevum: + case CityName.Chongqing: + case CityName.Sector12: + case CityName.NewTokyo: + case CityName.Ishima: + case CityName.Volhaven: + if (player.money.lt(CONSTANTS.TravelCost)) { + throw helper.makeRuntimeErrorMsg("travelToCity", "Not enough money to travel."); + } + player.loseMoney(CONSTANTS.TravelCost, "other"); + player.city = cityname; + workerScript.log("travelToCity", `Traveled to ${cityname}`); + return true; + default: + workerScript.log("travelToCity", `Invalid city name: '${cityname}'.`); + return false; + } + }, + + purchaseTor: function (): any { + helper.updateDynamicRam("purchaseTor", getRamCost("purchaseTor")); + helper.checkSingularityAccess("purchaseTor", 1); + + if (player.hasTorRouter()) { + workerScript.log("purchaseTor", "You already have a TOR router!"); + return false; + } + + if (player.money.lt(CONSTANTS.TorRouterCost)) { + workerScript.log("purchaseTor", "You cannot afford to purchase a Tor router."); + return false; + } + player.loseMoney(CONSTANTS.TorRouterCost, "other"); + + const darkweb = safetlyCreateUniqueServer({ + ip: createUniqueRandomIp(), + hostname: "darkweb", + organizationName: "", + isConnectedTo: false, + adminRights: false, + purchasedByPlayer: false, + maxRam: 1, + }); + AddToAllServers(darkweb); + + player.getHomeComputer().serversOnNetwork.push(darkweb.hostname); + darkweb.serversOnNetwork.push(player.getHomeComputer().hostname); + player.gainIntelligenceExp(CONSTANTS.IntelligenceSingFnBaseExpGain); + workerScript.log("purchaseTor", "You have purchased a Tor router!"); + return true; + }, + purchaseProgram: function (programName: any): any { + helper.updateDynamicRam("purchaseProgram", getRamCost("purchaseProgram")); + helper.checkSingularityAccess("purchaseProgram", 1); + + if (!player.hasTorRouter()) { + workerScript.log("purchaseProgram", "You do not have the TOR router."); + return false; + } + + programName = programName.toLowerCase(); + + let item = null; + for (const key in DarkWebItems) { + const i = DarkWebItems[key]; + if (i.program.toLowerCase() == programName) { + item = i; + } + } + + if (item == null) { + workerScript.log("purchaseProgram", `Invalid program name: '${programName}.`); + return false; + } + + if (player.money.lt(item.price)) { + workerScript.log( + "purchaseProgram", + `Not enough money to purchase '${item.program}'. Need ${numeralWrapper.formatMoney(item.price)}`, + ); + return false; + } + + if (player.hasProgram(item.program)) { + workerScript.log("purchaseProgram", `You already have the '${item.program}' program`); + return true; + } + + player.loseMoney(item.price, "other"); + player.getHomeComputer().programs.push(item.program); + workerScript.log( + "purchaseProgram", + `You have purchased the '${item.program}' program. The new program can be found on your home computer.`, + ); + return true; + }, + getCurrentServer: function (): any { + helper.updateDynamicRam("getCurrentServer", getRamCost("getCurrentServer")); + helper.checkSingularityAccess("getCurrentServer", 1); + return player.getCurrentServer().hostname; + }, + connect: function (hostname: any): any { + helper.updateDynamicRam("connect", getRamCost("connect")); + helper.checkSingularityAccess("connect", 1); + if (!hostname) { + throw helper.makeRuntimeErrorMsg("connect", `Invalid hostname: '${hostname}'`); + } + + const target = GetServer(hostname); + if (target == null) { + throw helper.makeRuntimeErrorMsg("connect", `Invalid hostname: '${hostname}'`); + } + + if (hostname === "home") { + player.getCurrentServer().isConnectedTo = false; + player.currentServer = player.getHomeComputer().hostname; + player.getCurrentServer().isConnectedTo = true; + Terminal.setcwd("/"); + return true; + } + + const server = player.getCurrentServer(); + for (let i = 0; i < server.serversOnNetwork.length; i++) { + const other = getServerOnNetwork(server, i); + if (other === null) continue; + if (other.hostname == hostname) { + player.getCurrentServer().isConnectedTo = false; + player.currentServer = target.hostname; + player.getCurrentServer().isConnectedTo = true; + Terminal.setcwd("/"); + return true; + } + } + + return false; + }, + manualHack: function (): any { + helper.updateDynamicRam("manualHack", getRamCost("manualHack")); + helper.checkSingularityAccess("manualHack", 1); + const server = player.getCurrentServer(); + return helper.hack(server.hostname, true); + }, + installBackdoor: function (): any { + helper.updateDynamicRam("installBackdoor", getRamCost("installBackdoor")); + helper.checkSingularityAccess("installBackdoor", 1); + const baseserver = player.getCurrentServer(); + if (!(baseserver instanceof Server)) { + workerScript.log("installBackdoor", "cannot backdoor this kind of server"); + return Promise.resolve(); + } + const server = baseserver as Server; + const installTime = (calculateHackingTime(server, player) / 4) * 1000; + + // No root access or skill level too low + const canHack = netscriptCanHack(server, player); + if (!canHack.res) { + throw helper.makeRuntimeErrorMsg("installBackdoor", canHack.msg || ""); + } + + workerScript.log( + "installBackdoor", + `Installing backdoor on '${server.hostname}' in ${convertTimeMsToTimeElapsedString(installTime, true)}`, + ); + + return netscriptDelay(installTime, workerScript).then(function () { + if (workerScript.env.stopFlag) { + return Promise.reject(workerScript); + } + workerScript.log("installBackdoor", `Successfully installed backdoor on '${server.hostname}'`); + + server.backdoorInstalled = true; + + if (SpecialServers.WorldDaemon === server.hostname) { + Router.toBitVerse(false, false); + } + return Promise.resolve(); + }); + }, + getStats: function (): any { + helper.updateDynamicRam("getStats", getRamCost("getStats")); + helper.checkSingularityAccess("getStats", 1); + workerScript.log("getStats", `getStats is deprecated, please use getplayer`); + + return { + hacking: player.hacking_skill, + strength: player.strength, + defense: player.defense, + dexterity: player.dexterity, + agility: player.agility, + charisma: player.charisma, + intelligence: player.intelligence, + }; + }, + getCharacterInformation: function (): any { + helper.updateDynamicRam("getCharacterInformation", getRamCost("getCharacterInformation")); + helper.checkSingularityAccess("getCharacterInformation", 1); + workerScript.log("getCharacterInformation", `getCharacterInformation is deprecated, please use getplayer`); + + return { + bitnode: player.bitNodeN, + city: player.city, + factions: player.factions.slice(), + hp: player.hp, + jobs: Object.keys(player.jobs), + jobTitles: Object.values(player.jobs), + maxHp: player.max_hp, + mult: { + agility: player.agility_mult, + agilityExp: player.agility_exp_mult, + companyRep: player.company_rep_mult, + crimeMoney: player.crime_money_mult, + crimeSuccess: player.crime_success_mult, + defense: player.defense_mult, + defenseExp: player.defense_exp_mult, + dexterity: player.dexterity_mult, + dexterityExp: player.dexterity_exp_mult, + factionRep: player.faction_rep_mult, + hacking: player.hacking_mult, + hackingExp: player.hacking_exp_mult, + strength: player.strength_mult, + strengthExp: player.strength_exp_mult, + workMoney: player.work_money_mult, + }, + timeWorked: player.timeWorked, + tor: player.hasTorRouter(), + workHackExpGain: player.workHackExpGained, + workStrExpGain: player.workStrExpGained, + workDefExpGain: player.workDefExpGained, + workDexExpGain: player.workDexExpGained, + workAgiExpGain: player.workAgiExpGained, + workChaExpGain: player.workChaExpGained, + workRepGain: player.workRepGained, + workMoneyGain: player.workMoneyGained, + hackingExp: player.hacking_exp, + strengthExp: player.strength_exp, + defenseExp: player.defense_exp, + dexterityExp: player.dexterity_exp, + agilityExp: player.agility_exp, + charismaExp: player.charisma_exp, + }; + }, + hospitalize: function (): any { + helper.updateDynamicRam("hospitalize", getRamCost("hospitalize")); + helper.checkSingularityAccess("hospitalize", 1); + if (player.isWorking || Router.page() === Page.Infiltration || Router.page() === Page.BitVerse) { + workerScript.log("hospitalize", "Cannot go to the hospital because the player is busy."); + return; + } + return player.hospitalize(); + }, + isBusy: function (): any { + helper.updateDynamicRam("isBusy", getRamCost("isBusy")); + helper.checkSingularityAccess("isBusy", 1); + return player.isWorking || Router.page() === Page.Infiltration || Router.page() === Page.BitVerse; + }, + stopAction: function (): any { + helper.updateDynamicRam("stopAction", getRamCost("stopAction")); + helper.checkSingularityAccess("stopAction", 1); + if (player.isWorking) { + Router.toTerminal(); + const txt = player.singularityStopWork(); + workerScript.log("stopAction", txt); + return true; + } + return false; + }, + upgradeHomeCores: function (): any { + helper.updateDynamicRam("upgradeHomeCores", getRamCost("upgradeHomeCores")); + helper.checkSingularityAccess("upgradeHomeCores", 2); + + // Check if we're at max cores + const homeComputer = player.getHomeComputer(); + if (homeComputer.cpuCores >= 8) { + workerScript.log("upgradeHomeCores", `Your home computer is at max cores.`); + return false; + } + + const cost = player.getUpgradeHomeCoresCost(); + if (player.money.lt(cost)) { + workerScript.log("upgradeHomeCores", `You don't have enough money. Need ${numeralWrapper.formatMoney(cost)}`); + return false; + } + + homeComputer.cpuCores += 1; + player.loseMoney(cost, "servers"); + + player.gainIntelligenceExp(CONSTANTS.IntelligenceSingFnBaseExpGain); + workerScript.log( + "upgradeHomeCores", + `Purchased an additional core for home computer! It now has ${homeComputer.cpuCores} cores.`, + ); + return true; + }, + getUpgradeHomeCoresCost: function (): any { + helper.updateDynamicRam("getUpgradeHomeCoresCost", getRamCost("getUpgradeHomeCoresCost")); + helper.checkSingularityAccess("getUpgradeHomeCoresCost", 2); + + return player.getUpgradeHomeCoresCost(); + }, + upgradeHomeRam: function (): any { + helper.updateDynamicRam("upgradeHomeRam", getRamCost("upgradeHomeRam")); + helper.checkSingularityAccess("upgradeHomeRam", 2); + + // Check if we're at max RAM + const homeComputer = player.getHomeComputer(); + if (homeComputer.maxRam >= CONSTANTS.HomeComputerMaxRam) { + workerScript.log("upgradeHomeRam", `Your home computer is at max RAM.`); + return false; + } + + const cost = player.getUpgradeHomeRamCost(); + if (player.money.lt(cost)) { + workerScript.log("upgradeHomeRam", `You don't have enough money. Need ${numeralWrapper.formatMoney(cost)}`); + return false; + } + + homeComputer.maxRam *= 2; + player.loseMoney(cost, "servers"); + + player.gainIntelligenceExp(CONSTANTS.IntelligenceSingFnBaseExpGain); + workerScript.log( + "upgradeHomeRam", + `Purchased additional RAM for home computer! It now has ${numeralWrapper.formatRAM( + homeComputer.maxRam, + )} of RAM.`, + ); + return true; + }, + getUpgradeHomeRamCost: function (): any { + helper.updateDynamicRam("getUpgradeHomeRamCost", getRamCost("getUpgradeHomeRamCost")); + helper.checkSingularityAccess("getUpgradeHomeRamCost", 2); + + return player.getUpgradeHomeRamCost(); + }, + workForCompany: function (companyName: any): any { + helper.updateDynamicRam("workForCompany", getRamCost("workForCompany")); + helper.checkSingularityAccess("workForCompany", 2); + + // Sanitize input + if (companyName == null) { + companyName = player.companyName; + } + + // Make sure its a valid company + if (companyName == null || companyName === "" || !(Companies[companyName] instanceof Company)) { + workerScript.log("workForCompany", `Invalid company: '${companyName}'`); + return false; + } + + // Make sure player is actually employed at the comapny + if (!Object.keys(player.jobs).includes(companyName)) { + workerScript.log("workForCompany", `You do not have a job at '${companyName}'`); + return false; + } + + // Check to make sure company position data is valid + const companyPositionName = player.jobs[companyName]; + const companyPosition = CompanyPositions[companyPositionName]; + if (companyPositionName === "" || !(companyPosition instanceof CompanyPosition)) { + workerScript.log("workForCompany", "You do not have a job"); + return false; + } + + if (player.isWorking) { + const txt = player.singularityStopWork(); + workerScript.log("workForCompany", txt); + } + + if (companyPosition.isPartTimeJob()) { + player.startWorkPartTime(Router, companyName); + } else { + player.startWork(Router, companyName); + } + workerScript.log("workForCompany", `Began working at '${player.companyName}' as a '${companyPositionName}'`); + return true; + }, + applyToCompany: function (companyName: any, field: any): any { + helper.updateDynamicRam("applyToCompany", getRamCost("applyToCompany")); + helper.checkSingularityAccess("applyToCompany", 2); + getCompany("applyToCompany", companyName); + + player.location = companyName; + let res; + switch (field.toLowerCase()) { + case "software": + res = player.applyForSoftwareJob(true); + break; + case "software consultant": + res = player.applyForSoftwareConsultantJob(true); + break; + case "it": + res = player.applyForItJob(true); + break; + case "security engineer": + res = player.applyForSecurityEngineerJob(true); + break; + case "network engineer": + res = player.applyForNetworkEngineerJob(true); + break; + case "business": + res = player.applyForBusinessJob(true); + break; + case "business consultant": + res = player.applyForBusinessConsultantJob(true); + break; + case "security": + res = player.applyForSecurityJob(true); + break; + case "agent": + res = player.applyForAgentJob(true); + break; + case "employee": + res = player.applyForEmployeeJob(true); + break; + case "part-time employee": + res = player.applyForPartTimeEmployeeJob(true); + break; + case "waiter": + res = player.applyForWaiterJob(true); + break; + case "part-time waiter": + res = player.applyForPartTimeWaiterJob(true); + break; + default: + workerScript.log("applyToCompany", `Invalid job: '${field}'.`); + return false; + } + // TODO https://github.com/danielyxie/bitburner/issues/1378 + // The player object's applyForJob function can return string with special error messages + // if (isString(res)) { + // workerScript.log("applyToCompany", res); + // return false; + // } + if (res) { + workerScript.log( + "applyToCompany", + `You were offered a new job at '${companyName}' as a '${player.jobs[companyName]}'`, + ); + } else { + workerScript.log( + "applyToCompany", + `You failed to get a new job/promotion at '${companyName}' in the '${field}' field.`, + ); + } + return res; + }, + getCompanyRep: function (companyName: any): any { + helper.updateDynamicRam("getCompanyRep", getRamCost("getCompanyRep")); + helper.checkSingularityAccess("getCompanyRep", 2); + const company = getCompany("getCompanyRep", companyName); + return company.playerReputation; + }, + getCompanyFavor: function (companyName: any): any { + helper.updateDynamicRam("getCompanyFavor", getRamCost("getCompanyFavor")); + helper.checkSingularityAccess("getCompanyFavor", 2); + const company = getCompany("getCompanyFavor", companyName); + return company.favor; + }, + getCompanyFavorGain: function (companyName: any): any { + helper.updateDynamicRam("getCompanyFavorGain", getRamCost("getCompanyFavorGain")); + helper.checkSingularityAccess("getCompanyFavorGain", 2); + const company = getCompany("getCompanyFavorGain", companyName); + return company.getFavorGain()[0]; + }, + checkFactionInvitations: function (): any { + helper.updateDynamicRam("checkFactionInvitations", getRamCost("checkFactionInvitations")); + helper.checkSingularityAccess("checkFactionInvitations", 2); + // Make a copy of player.factionInvitations + return player.factionInvitations.slice(); + }, + joinFaction: function (name: any): any { + helper.updateDynamicRam("joinFaction", getRamCost("joinFaction")); + helper.checkSingularityAccess("joinFaction", 2); + getFaction("joinFaction", name); + + if (!player.factionInvitations.includes(name)) { + workerScript.log("joinFaction", `You have not been invited by faction '${name}'`); + return false; + } + const fac = Factions[name]; + joinFaction(fac); + + // Update Faction Invitation list to account for joined + banned factions + for (let i = 0; i < player.factionInvitations.length; ++i) { + if (player.factionInvitations[i] == name || Factions[player.factionInvitations[i]].isBanned) { + player.factionInvitations.splice(i, 1); + i--; + } + } + player.gainIntelligenceExp(CONSTANTS.IntelligenceSingFnBaseExpGain); + workerScript.log("joinFaction", `Joined the '${name}' faction.`); + return true; + }, + workForFaction: function (name: any, type: any): any { + helper.updateDynamicRam("workForFaction", getRamCost("workForFaction")); + helper.checkSingularityAccess("workForFaction", 2); + getFaction("workForFaction", name); + + // if the player is in a gang and the target faction is any of the gang faction, fail + if (player.inGang() && AllGangs[name] !== undefined) { + workerScript.log("workForFaction", `Faction '${name}' does not offer work at the moment.`); + return; + } + + if (!player.factions.includes(name)) { + workerScript.log("workForFaction", `You are not a member of '${name}'`); + return false; + } + + if (player.isWorking) { + const txt = player.singularityStopWork(); + workerScript.log("workForFaction", txt); + } + + const fac = Factions[name]; + // Arrays listing factions that allow each time of work + const hackAvailable = [ + "Illuminati", + "Daedalus", + "The Covenant", + "ECorp", + "MegaCorp", + "Bachman & Associates", + "Blade Industries", + "NWO", + "Clarke Incorporated", + "OmniTek Incorporated", + "Four Sigma", + "KuaiGong International", + "Fulcrum Secret Technologies", + "BitRunners", + "The Black Hand", + "NiteSec", + "Chongqing", + "Sector-12", + "New Tokyo", + "Aevum", + "Ishima", + "Volhaven", + "Speakers for the Dead", + "The Dark Army", + "The Syndicate", + "Silhouette", + "Netburners", + "Tian Di Hui", + "CyberSec", + ]; + const fdWkAvailable = [ + "Illuminati", + "Daedalus", + "The Covenant", + "ECorp", + "MegaCorp", + "Bachman & Associates", + "Blade Industries", + "NWO", + "Clarke Incorporated", + "OmniTek Incorporated", + "Four Sigma", + "KuaiGong International", + "The Black Hand", + "Chongqing", + "Sector-12", + "New Tokyo", + "Aevum", + "Ishima", + "Volhaven", + "Speakers for the Dead", + "The Dark Army", + "The Syndicate", + "Silhouette", + "Tetrads", + "Slum Snakes", + ]; + const scWkAvailable = [ + "ECorp", + "MegaCorp", + "Bachman & Associates", + "Blade Industries", + "NWO", + "Clarke Incorporated", + "OmniTek Incorporated", + "Four Sigma", + "KuaiGong International", + "Fulcrum Secret Technologies", + "Chongqing", + "Sector-12", + "New Tokyo", + "Aevum", + "Ishima", + "Volhaven", + "Speakers for the Dead", + "The Syndicate", + "Tetrads", + "Slum Snakes", + "Tian Di Hui", + ]; + + switch (type.toLowerCase()) { + case "hacking": + case "hacking contracts": + case "hackingcontracts": + if (!hackAvailable.includes(fac.name)) { + workerScript.log("workForFaction", `Faction '${fac.name}' do not need help with hacking contracts.`); + return false; + } + player.startFactionHackWork(Router, fac); + workerScript.log("workForFaction", `Started carrying out hacking contracts for '${fac.name}'`); + return true; + case "field": + case "fieldwork": + case "field work": + if (!fdWkAvailable.includes(fac.name)) { + workerScript.log("workForFaction", `Faction '${fac.name}' do not need help with field missions.`); + return false; + } + player.startFactionFieldWork(Router, fac); + workerScript.log("workForFaction", `Started carrying out field missions for '${fac.name}'`); + return true; + case "security": + case "securitywork": + case "security work": + if (!scWkAvailable.includes(fac.name)) { + workerScript.log("workForFaction", `Faction '${fac.name}' do not need help with security work.`); + return false; + } + player.startFactionSecurityWork(Router, fac); + workerScript.log("workForFaction", `Started carrying out security work for '${fac.name}'`); + return true; + default: + workerScript.log("workForFaction", `Invalid work type: '${type}`); + } + return true; + }, + getFactionRep: function (name: any): any { + helper.updateDynamicRam("getFactionRep", getRamCost("getFactionRep")); + helper.checkSingularityAccess("getFactionRep", 2); + const faction = getFaction("getFactionRep", name); + return faction.playerReputation; + }, + getFactionFavor: function (name: any): any { + helper.updateDynamicRam("getFactionFavor", getRamCost("getFactionFavor")); + helper.checkSingularityAccess("getFactionFavor", 2); + const faction = getFaction("getFactionFavor", name); + return faction.favor; + }, + getFactionFavorGain: function (name: any): any { + helper.updateDynamicRam("getFactionFavorGain", getRamCost("getFactionFavorGain")); + helper.checkSingularityAccess("getFactionFavorGain", 2); + const faction = getFaction("getFactionFavorGain", name); + return faction.getFavorGain()[0]; + }, + donateToFaction: function (name: any, amt: any): any { + helper.updateDynamicRam("donateToFaction", getRamCost("donateToFaction")); + helper.checkSingularityAccess("donateToFaction", 3); + const faction = getFaction("donateToFaction", name); + + if (typeof amt !== "number" || amt <= 0) { + workerScript.log("donateToFaction", `Invalid donation amount: '${amt}'.`); + return false; + } + if (player.money.lt(amt)) { + workerScript.log( + "donateToFaction", + `You do not have enough money to donate ${numeralWrapper.formatMoney(amt)} to '${name}'`, + ); + return false; + } + const repNeededToDonate = Math.round(CONSTANTS.BaseFavorToDonate * BitNodeMultipliers.RepToDonateToFaction); + if (faction.favor < repNeededToDonate) { + workerScript.log( + "donateToFaction", + `You do not have enough favor to donate to this faction. Have ${faction.favor}, need ${repNeededToDonate}`, + ); + return false; + } + const repGain = (amt / CONSTANTS.DonateMoneyToRepDivisor) * player.faction_rep_mult; + faction.playerReputation += repGain; + player.loseMoney(amt, "other"); + workerScript.log( + "donateToFaction", + `${numeralWrapper.formatMoney(amt)} donated to '${name}' for ${numeralWrapper.formatReputation( + repGain, + )} reputation`, + ); + return true; + }, + createProgram: function (name: any): any { + helper.updateDynamicRam("createProgram", getRamCost("createProgram")); + helper.checkSingularityAccess("createProgram", 3); + + if (player.isWorking) { + const txt = player.singularityStopWork(); + workerScript.log("createProgram", txt); + } + + name = name.toLowerCase(); + + let p = null; + for (const key in Programs) { + if (Programs[key].name.toLowerCase() == name) { + p = Programs[key]; + } + } + + if (p == null) { + workerScript.log("createProgram", `The specified program does not exist: '${name}`); + return false; + } + + if (player.hasProgram(p.name)) { + workerScript.log("createProgram", `You already have the '${p.name}' program`); + return false; + } + + const create = p.create; + if (create === null) { + workerScript.log("createProgram", `You cannot create the '${p.name}' program`); + return false; + } + + if (!create.req(player)) { + workerScript.log("createProgram", `Hacking level is too low to create '${p.name}' (level ${create.level} req)`); + return false; + } + + player.startCreateProgramWork(Router, p.name, create.time, create.level); + workerScript.log("createProgram", `Began creating program: '${name}'`); + return true; + }, + commitCrime: function (crimeRoughName: any): any { + helper.updateDynamicRam("commitCrime", getRamCost("commitCrime")); + helper.checkSingularityAccess("commitCrime", 3); + + if (player.isWorking) { + const txt = player.singularityStopWork(); + workerScript.log("commitCrime", txt); + } + + // Set Location to slums + player.gotoLocation(LocationName.Slums); + + const crime = findCrime(crimeRoughName.toLowerCase()); + if (crime == null) { + // couldn't find crime + throw helper.makeRuntimeErrorMsg("commitCrime", `Invalid crime: '${crimeRoughName}'`); + } + workerScript.log("commitCrime", `Attempting to commit ${crime.name}...`); + return crime.commit(Router, player, 1, workerScript); + }, + getCrimeChance: function (crimeRoughName: any): any { + helper.updateDynamicRam("getCrimeChance", getRamCost("getCrimeChance")); + helper.checkSingularityAccess("getCrimeChance", 3); + + const crime = findCrime(crimeRoughName.toLowerCase()); + if (crime == null) { + throw helper.makeRuntimeErrorMsg("getCrimeChance", `Invalid crime: ${crimeRoughName}`); + } + + return crime.successRate(player); + }, + getCrimeStats: function (crimeRoughName: any): any { + helper.updateDynamicRam("getCrimeStats", getRamCost("getCrimeStats")); + helper.checkSingularityAccess("getCrimeStats", 3); + + const crime = findCrime(crimeRoughName.toLowerCase()); + if (crime == null) { + throw helper.makeRuntimeErrorMsg("getCrimeStats", `Invalid crime: ${crimeRoughName}`); + } + + return Object.assign({}, crime); + }, + }; +} diff --git a/src/NetscriptFunctions/Sleeve.ts b/src/NetscriptFunctions/Sleeve.ts index 3340cdbc5..ff173eefe 100644 --- a/src/NetscriptFunctions/Sleeve.ts +++ b/src/NetscriptFunctions/Sleeve.ts @@ -10,47 +10,9 @@ import { Augmentations } from "../Augmentation/Augmentations"; import { CityName } from "../Locations/data/CityNames"; import { findCrime } from "../Crime/CrimeHelpers"; -export interface INetscriptSleeve { - getNumSleeves(): number; - setToShockRecovery(sleeveNumber?: number): boolean; - setToSynchronize(sleeveNumber?: number): boolean; - setToCommitCrime(sleeveNumber?: number, crimeName?: string): boolean; - setToUniversityCourse(sleeveNumber?: number, universityName?: string, className?: string): boolean; - travel(sleeveNumber?: number, cityName?: string): boolean; - setToCompanyWork(sleeveNumber?: number, companyName?: string): boolean; - setToFactionWork(sleeveNumber?: number, factionName?: string, workType?: string): boolean; - setToGymWorkout(sleeveNumber?: number, gymName?: string, stat?: string): boolean; - getSleeveStats(sleeveNumber?: number): { - shock: number; - sync: number; - hacking_skill: number; - strength: number; - defense: number; - dexterity: number; - agility: number; - charisma: number; - }; - getTask(sleeveNumber?: number): { - task: string; - crime: string; - location: string; - gymStatType: string; - factionWorkType: string; - }; - getInformation(sleeveNumber?: number): any; - getSleeveAugmentations(sleeveNumber?: number): string[]; - getSleevePurchasableAugs(sleeveNumber?: number): { - name: string; - cost: number; - }[]; - purchaseSleeveAug(sleeveNumber?: number, augName?: string): boolean; -} +import { Sleeve as ISleeve } from "../ScriptEditor/NetscriptDefinitions"; -export function NetscriptSleeve( - player: IPlayer, - workerScript: WorkerScript, - helper: INetscriptHelper, -): INetscriptSleeve { +export function NetscriptSleeve(player: IPlayer, workerScript: WorkerScript, helper: INetscriptHelper): ISleeve { const checkSleeveAPIAccess = function (func: any): void { if (player.bitNodeN !== 10 && !SourceFileFlags[10]) { throw helper.makeRuntimeErrorMsg( diff --git a/src/ScriptEditor/NetscriptDefinitions.d.ts b/src/ScriptEditor/NetscriptDefinitions.d.ts index a98a91c34..11972ee2f 100644 --- a/src/ScriptEditor/NetscriptDefinitions.d.ts +++ b/src/ScriptEditor/NetscriptDefinitions.d.ts @@ -2,7 +2,7 @@ * Data representing the internal values of a crime. * @public */ -interface CrimeStats { +export interface CrimeStats { /** Number representing the difficulty of the crime. Used for success chance calculations */ difficulty: number; /** Amount of karma lost for successfully committing this crime */ @@ -49,7 +49,7 @@ interface CrimeStats { * Data representing the internal values of an Augmentation. * @public */ -interface AugmentationStats { +export interface AugmentationStats { /** Multipler to hacking skill */ hacking_mult?: number; /** Multipler to strength skill */ @@ -116,7 +116,7 @@ interface AugmentationStats { * Options to affect the behavior of {@link NS.hack | hack}, {@link NS.grow | grow}, and {@link NS.weaken | weaken}. * @public */ -interface BasicHGWOptions { +export interface BasicHGWOptions { /** Number of threads to use for this function. Must be less than or equal to the number of threads the script is running with. */ threads: number; /** Set to true this action will affect the stock market. */ @@ -127,7 +127,7 @@ interface BasicHGWOptions { * Options to affect the behavior of {@link CodingContract} attempt. * @public */ -interface CodingAttemptOptions { +export interface CodingAttemptOptions { /** If truthy, then the function will return a string that states the contract’s reward when it is successfully solved. */ returnReward: boolean; } @@ -136,7 +136,7 @@ interface CodingAttemptOptions { * Return value of {@link Sleeve.getSleevePurchasableAugs | getSleevePurchasableAugs} * @public */ -interface AugmentPair { +export interface AugmentPair { /** augmentation name */ name: string; /** augmentation cost */ @@ -147,7 +147,7 @@ interface AugmentPair { * Value in map of {@link StockOrder} * @public */ -interface StockOrderObject { +export interface StockOrderObject { /** Number of shares */ shares: number; /** Price per share */ @@ -162,7 +162,7 @@ interface StockOrderObject { * Return value of {@link TIX.getOrders | getOrders} * @public */ -interface StockOrder { +export interface StockOrder { /** Stock Symbol */ [key: string]: StockOrderObject[]; } @@ -171,7 +171,7 @@ interface StockOrder { * A single process on a server. * @public */ -interface ProcessInfo { +export interface ProcessInfo { /** Script name. */ filename: string; /** Number of threads script is running with */ @@ -184,7 +184,7 @@ interface ProcessInfo { * Hack related multipliers. * @public */ -interface HackingMultipliers { +export interface HackingMultipliers { /** Player's hacking chance multiplier. */ chance: number; /** Player's hacking speed multiplier. */ @@ -199,7 +199,7 @@ interface HackingMultipliers { * Hacknet related multipliers. * @public */ -interface HacknetMultipliers { +export interface HacknetMultipliers { /** Player's hacknet production multiplier */ production: number; /** Player's hacknet purchase cost multiplier */ @@ -216,7 +216,7 @@ interface HacknetMultipliers { * A single server. * @public */ -interface Server { +export interface Server { /** * How many CPU cores this server has. Maximum of 8. * Affects magnitude of grow and weaken. @@ -267,7 +267,7 @@ interface Server { * All multipliers affecting the difficulty of the current challenge. * @public */ -interface BitNodeMultipliers { +export interface BitNodeMultipliers { /** Influences how quickly the player's agility level (not exp) scales */ AgilityLevelMultiplier: number; /** Influences the base cost to purchase an augmentation. */ @@ -352,7 +352,7 @@ interface BitNodeMultipliers { * Object representing all the values related to a hacknet node. * @public */ -interface NodeStats { +export interface NodeStats { /** Node's name */ name: string; /** Node's level */ @@ -377,7 +377,7 @@ interface NodeStats { * Short summary of the players skills. * @public */ -interface PlayerSkills { +export interface PlayerSkills { /** Hacking level */ hacking: number; /** Strength level */ @@ -397,7 +397,7 @@ interface PlayerSkills { /** * @public */ -interface CharacterMult { +export interface CharacterMult { /** Agility stat */ agility: number; /** Agility exp */ @@ -433,7 +433,7 @@ interface CharacterMult { /** * @public */ -interface CharacterInfo { +export interface CharacterInfo { /** Current BitNode number */ bitnode: number; /** Name of city you are currently in */ @@ -475,7 +475,7 @@ interface CharacterInfo { /** * @public */ -interface SleeveWorkGains { +export interface SleeveWorkGains { /** hacking exp gained from work */ workHackExpGain: number; /** strength exp gained from work */ @@ -495,7 +495,7 @@ interface SleeveWorkGains { /** * @public */ -interface SourceFileLvl { +export interface SourceFileLvl { /** The number of the source file */ n: number; /** The level of the source file */ @@ -506,7 +506,7 @@ interface SourceFileLvl { * Bladeburner current action. * @public */ -interface BladeburnerCurAction { +export interface BladeburnerCurAction { /** Type of Action */ type: string; /** Name of Action */ @@ -517,7 +517,7 @@ interface BladeburnerCurAction { * Gang general info. * @public */ -interface GangGenInfo { +export interface GangGenInfo { /** Name of faction that the gang belongs to ("Slum Snakes", etc.) */ faction: string; /** Boolean indicating whether or not its a hacking gang */ @@ -543,7 +543,7 @@ interface GangGenInfo { /** * @public */ -interface GangOtherInfoObject { +export interface GangOtherInfoObject { /** Gang power */ power: number; /** Gang territory, in decimal form */ @@ -553,7 +553,7 @@ interface GangOtherInfoObject { /** * @public */ -interface GangOtherInfo { +export interface GangOtherInfo { /** Stock Symbol */ [key: string]: GangOtherInfoObject[]; } @@ -562,7 +562,7 @@ interface GangOtherInfo { * Object representing data representing a gang member task. * @public */ -interface GangTaskStats { +export interface GangTaskStats { /** Task name */ name: string; /** Task Description */ @@ -599,7 +599,7 @@ interface GangTaskStats { * Object representing data representing a gang member equipment. * @public */ -interface EquipmentStats { +export interface EquipmentStats { /** Strength multiplier */ str: number; /** Defense multiplier */ @@ -617,7 +617,7 @@ interface EquipmentStats { /** * @public */ -interface GangTerritory { +export interface GangTerritory { /** Money gain impact on task scaling */ money: number; /** Respect gain impact on task scaling */ @@ -629,7 +629,7 @@ interface GangTerritory { /** * @public */ -interface GangMemberInfo { +export interface GangMemberInfo { /** Agility stat */ agility: number; /** Agility multiplier from equipment.*/ @@ -677,7 +677,7 @@ interface GangMemberInfo { /** * @public */ -interface GangMemberAscension { +export interface GangMemberAscension { /** Amount of respect lost from ascending */ respect: number; /** Hacking multiplier gained from ascending.*/ @@ -698,7 +698,7 @@ interface GangMemberAscension { * Object representing a sleeve stats. * @public */ -interface SleeveSkills { +export interface SleeveSkills { /** current shock of the sleeve [0-100] */ shock: number; /** current sync of the sleeve [0-100] */ @@ -721,7 +721,7 @@ interface SleeveSkills { * Object representing sleeve information. * @public */ -interface SleeveInformation { +export interface SleeveInformation { /** location of the sleeve */ city: string; /** current hp of the sleeve */ @@ -752,7 +752,7 @@ interface SleeveInformation { * Object representing a sleeve current task. * @public */ -interface SleeveTask { +export interface SleeveTask { /** task type */ task: string; /** crime currently attempting, if any */ @@ -1120,7 +1120,7 @@ export interface TIX { * This API requires Source-File 4 level 1 / 2 / 3 to use. * @public */ -interface Singularity { +export interface Singularity { /** * Take university class. * @@ -1271,6 +1271,22 @@ interface Singularity { */ upgradeHomeRam(): boolean; + /** + * Upgrade home computer cores. + * @remarks + * RAM cost: 3 GB + * + * Singularity - Level 2 + * + * This function will upgrade amount of cores on the player’s home computer. The cost is + * the same as if you were to do it manually. + * + * This function will return true if the player’s home computer cores is successfully upgraded, and false otherwise. + * + * @returns True if the player’s home computer cores is successfully upgraded, and false otherwise. + */ + upgradeHomeCores(): boolean; + /** * Get the price of upgrading home RAM. * @remarks @@ -1284,6 +1300,19 @@ interface Singularity { */ getUpgradeHomeRamCost(): number; + /** + * Get the price of upgrading home cores. + * @remarks + * RAM cost: 1.5 GB + * + * Singularity - Level 2 + * + * Returns the cost of upgrading the player’s home computer cores. + * + * @returns Cost of upgrading the player’s home computer cores. + */ + getUpgradeHomeCoresCost(): number; + /** * Work for a company. * @remarks @@ -1648,6 +1677,51 @@ interface Singularity { */ getAugmentationPrereq(augName: string): string[]; + /** + * @deprecated + * Get the price and reputation of an augmentation. + * @remarks + * RAM cost: 5 GB + * + * Singularity - Level 3 + * + * This function returns an array with two elements that gives the cost for + * the specified Augmentation. The first element in the returned array is the + * reputation requirement of the Augmentation, and the second element is the + * money cost. + * + * If an invalid Augmentation name is passed in for the augName argument, this + * function will return the array [-1, -1]. + * + * @param augName - Name of Augmentation. + * @returns Array with first element as a reputation requirement and second element as the money cost. + */ + getAugmentationCost(augName: string): [number, number]; + + /** + * Get price of an augmentation. + * @remarks + * RAM cost: 2.5 GB + * + * Singularity - Level 3 + * + * @param augName - Name of Augmentation. + * @returns Price of the augmentation. + */ + getAugmentationPrice(augName: string): number; + + /** + * Get reputation requirement of an augmentation. + * @remarks + * RAM cost: 2.5 GB + * + * Singularity - Level 3 + * + * @param augName - Name of Augmentation. + * @returns Reputation requirement of the augmentation. + */ + getAugmentationRepReq(augName: string): number; + /** * Purchase an augmentation * @remarks @@ -1692,6 +1766,48 @@ interface Singularity { */ installAugmentations(cbScript?: string): void; + /** + * @deprecated + * Returns an object with the Player’s stats. + * + * @remarks + * RAM cost: 0.5 GB + * + * Singularity - Level 1 + * + * @example + * ```ts + * res = getStats(); + * print('My charisma level is: ' + res.charisma); + * ``` + * @returns Object with the Player’s stats. + */ + getStats(): PlayerSkills; + + /** + * @deprecated + * Returns an object with various information about your character. + * + * @remarks + * RAM cost: 0.5 GB + * + * Singularity - Level 1 + * + * @returns Object with various information about your character. + */ + getCharacterInformation(): CharacterInfo; + + /** + * Hospitalize the player. + * @remarks + * RAM cost: 0.25 GB + * + * Singularity - Level 1 + * + * @returns The cost of the hospitalization. + */ + hospitalize(): number; + /** * Soft reset the game. * @remarks @@ -1701,8 +1817,69 @@ interface Singularity { * * This function will perform a reset even if you don’t have any augmentation installed. * + * @param cbScript - This is a script that will automatically be run after Augmentations are installed (after the reset). This script will be run with no arguments and 1 thread. It must be located on your home computer. */ - softReset(): void; + softReset(cbScript: string): void; + + /** + * Go to a location. + * @remarks + * RAM cost: 5 GB + * + * Singularity - Level 3 + * + * Move the player to a specific location. + * + * @param locationName - Name of the location. + * @returns True if the player was moved there, false otherwise. + */ + goToLocation(locationName: string): boolean; + + /** + * Get the current server. + * @remarks + * RAM cost: 2 GB + * + * Singularity - Level 1 + * + * @returns Name of the current server. + */ + getCurrentServer(): string; + + /** + * Connect to a server. + * @remarks + * RAM cost: 2 GB + * + * Singularity - Level 1 + * + * Run the connect HOSTNAME command in the terminal. Can only connect to neighbors. + * + * @returns True if the connect command was successful, false otherwise. + */ + connect(hostname: string): boolean; + + /** + * Run the hack command in the terminal. + * @remarks + * RAM cost: 2 GB + * + * Singularity - Level 1 + * + * @returns Amount of money stolen by manual hacking. + */ + manualHack(): Promise; + + /** + * Run the backdoor command in the terminal. + * @remarks + * RAM cost: 2 GB + * + * Singularity - Level 1 + * + * @returns True if the installation was successful. + */ + installBackdoor(): Promise; } /** @@ -1711,7 +1888,7 @@ interface Singularity { * Not all these functions are immediately available. * @public */ -interface Hacknet { +export interface Hacknet { /** * Get the number of hacknet nodes you own. * @remarks @@ -1723,6 +1900,15 @@ interface Hacknet { */ numNodes(): number; + /** + * Get the maximum number of hacknet nodes. + * @remarks + * RAM cost: 0 GB + * + * @returns maximum number of hacknet nodes. + */ + maxNumNodes(): number; + /** * Purchase a new hacknet node. * @remarks @@ -1921,6 +2107,19 @@ interface Hacknet { */ numHashes(): number; + /** + * Get the maximum number of hashes you can store. + * @remarks + * RAM cost: 0 GB + * + * This function is only applicable for Hacknet Servers (the upgraded version of a Hacknet Node). + * + * Returns the number of hashes you can store. + * + * @returns Number of hashes you can store. + */ + hashCapacity(): number; + /** * Get the cost of a hash upgrade. * @remarks @@ -1966,6 +2165,39 @@ interface Hacknet { * @returns True if the upgrade is successfully purchased, and false otherwise.. */ spendHashes(upgName: string, upgTarget?: string): boolean; + + /** + * Get the level of a hash upgrade. + * @remarks + * RAM cost: 0 GB + * + * This function is only applicable for Hacknet Servers (the upgraded version of a Hacknet Node). + * + * @returns Level of the upgrade. + */ + getHashUpgradeLevel(upgName: string): number; + + /** + * Get the multipler to study. + * @remarks + * RAM cost: 0 GB + * + * This function is only applicable for Hacknet Servers (the upgraded version of a Hacknet Node). + * + * @returns Multiplier. + */ + getStudyMult(): number; + + /** + * Get the multipler to training. + * @remarks + * RAM cost: 0 GB + * + * This function is only applicable for Hacknet Servers (the upgraded version of a Hacknet Node). + * + * @returns Multiplier. + */ + getTrainingMult(): number; } /** @@ -2440,7 +2672,7 @@ export interface Bladeburner { * Coding Contact API * @public */ -interface CodingContract { +export interface CodingContract { /** * Attemps a coding contract. * @remarks @@ -2532,7 +2764,25 @@ interface CodingContract { * If you are not in BitNode-2, then you must have Source-File 2 in order to use this API. * @public */ -interface Gang { +export interface Gang { + /** + * Create a gang. + * @remarks + * RAM cost: 1GB + * + * Create a gang with the specified faction. + * @returns True if the gang was created, false otherwise. + */ + createGang(faction: string): boolean; + + /** + * Check if you're in a gang. + * @remarks + * RAM cost: 1GB + * @returns True if you're in a gang, false otherwise. + */ + inGang(): boolean; + /** * List all gang members. * @remarks @@ -2761,7 +3011,7 @@ interface Gang { * If you are not in BitNode-10, then you must have Source-File 10 in order to use this API. * @public */ -interface Sleeve { +export interface Sleeve { /** * Get the number of sleeves you own. * @remarks @@ -2954,51 +3204,104 @@ interface Sleeve { purchaseSleeveAug(sleeveNumber: number, augName: string): boolean; } +interface SkillsFormulas { + calculateSkill(exp: number, mult?: number): number; + calculateExp(skill: number, mult?: number): number; +} + +interface HackingFormulas { + hackChance(server: number, player: number): number; + hackExp(server: number, player: number): number; + hackPercent(server: number, player: number): number; + growPercent(server: number, threads: number, player: number, cores?: number): number; + hackTime(server: number, player: number): number; + growTime(server: number, player: number): number; + weakenTime(server: number, player: number): number; +} + +interface HacknetNodesFormulas { + moneyGainRate(level: number, ram: number, cores: number, mult?: number): number; + levelUpgradeCost(startingLevel: number, extraLevels?: number, costMult?: number): number; + ramUpgradeCost(startingRam: number, extraLevels?: number, costMult?: number): number; + coreUpgradeCost(startingCore: number, extraCores?: number, costMult?: number): number; + hacknetNodeCost(n: number, mult: number): number; + constants(): number; +} + +interface HacknetServersFormulas { + hashGainRate(level: number, ramUsed: number, maxRam: number, cores: number, mult?: number): number; + levelUpgradeCost(startingLevel: number, extraLevels?: number, costMult?: number): number; + ramUpgradeCost(startingRam: number, extraLevels?: number, costMult?: number): number; + coreUpgradeCost(startingCore: number, extraCores?: number, costMult?: number): number; + cacheUpgradeCost(startingCache: number, extraCache?: number): number; + hashUpgradeCost(upgName: number, level: number): number; + hacknetServerCost(n: number, mult: number): number; + constants(): any; +} + +export interface Formulas { + skills: SkillsFormulas; + hacking: HackingFormulas; + hacknetNodes: HacknetNodesFormulas; + hacknetServers: HacknetServersFormulas; +} + /** * Collection of all functions passed to scripts * @public */ export interface NS extends Singularity { /** - * Namespace for hacknet related functions. + * Namespace for hacknet functions. * @remarks RAM cost: 4 GB */ readonly hacknet: Hacknet; /** * - * Namespace for bladeburner related functions. + * Namespace for bladeburner functions. * @remarks RAM cost: 0 GB */ readonly bladeburner: Bladeburner; /** * - * Namespace for codingcontract related functions. + * Namespace for codingcontract functions. * @remarks RAM cost: 0 GB */ readonly codingcontract: CodingContract; /** * - * Namespace for gang related functions. + * Namespace for gang functions. * @remarks RAM cost: 0 GB */ readonly gang: Gang; /** * - * Namespace for sleeve related functions. + * Namespace for sleeve functions. * @remarks RAM cost: 0 GB */ readonly sleeve: Sleeve; /** * - * Namespace for stock related functions. - * @remarks RAM cost: 0 GB + * Namespace for stock functions. + * @remarks + * RAM cost: 0 GB */ readonly stock: TIX; + /** + * + * Namespace for formulas functions. + * @remarks + * RAM cost: 0 GB + */ + readonly formulas: Formulas; + /** * Arguments passed into the script. * - * @remarks RAM cost: 0 GB + * @remarks + * RAM cost: 0 GB + * * Arguments passed into a script can be accessed using a normal * array using the [] operator (args[0], args[1], etc…). * @@ -3011,6 +3314,7 @@ export interface NS extends Singularity { * Steal a servers money. * @remarks * RAM cost: 0.1 GB + * * Function that is used to try and hack servers to steal money and gain hacking experience. * The runtime for this command depends on your hacking level and the target server’s * security level. In order to hack a server you must first gain root access to that server @@ -3037,6 +3341,7 @@ export interface NS extends Singularity { * Spoof money in a servers bank account, increasing the amount available. * @remarks * RAM cost: 0.15 GB + * * Use your hacking skills to increase the amount of money available on a server. * The runtime for this command depends on your hacking level and the target server’s * security level. When `grow` completes, the money available on a target server will @@ -3064,6 +3369,7 @@ export interface NS extends Singularity { * Reduce a server security level. * @remarks * RAM cost: 0.15 GB + * * Use your hacking skills to attack a server’s security, lowering the server’s security level. * The runtime for this command depends on your hacking level and the target server’s security * level. This function lowers the security level of the target server by 0.05. @@ -3087,6 +3393,7 @@ export interface NS extends Singularity { * Predict the effect of weaken. * @remarks * RAM cost: 1 GB + * * Returns the security decrease that would occur if a weaken with this many threads happened. * * @param threads - Amount of threads that will be used. @@ -3099,6 +3406,7 @@ export interface NS extends Singularity { * Predict the effect of hack. * @remarks * RAM cost: 1 GB + * * This function returns the number of script threads you need when running the hack command * to steal the specified amount of money from the target server. * If hackAmount is less than zero or greater than the amount of money available on the server, @@ -3119,6 +3427,10 @@ export interface NS extends Singularity { hackAnalyzeThreads(host: string, hackAmount: number): number; /** + * Get the percent of money stolen with a single thread. + * @remarks + * RAM cost: 1 GB + * * Returns the percentage of the specified server’s money you will steal with a single hack. * This value is returned in percentage form, not decimal * (Netscript functions typically return in decimal form, but not this one). @@ -3129,33 +3441,42 @@ export interface NS extends Singularity { * hackAnalyzePercent("foodnstuff"); * //This means that if hack the foodnstuff server, then you will steal 1% of its total money. If you hack using N threads, then you will steal N% of its total money. * ``` - * @remarks RAM cost: 1 GB * @param host - Hostname of the target server. * @returns The percentage of money you will steal from the target server with a single hack. */ hackAnalyzePercent(host: string): number; /** + * Get the security increase for a number of thread. + * @remarks + * RAM cost: 1 GB + * * Returns the security increase that would occur if a hack with this many threads happened. * - * @remarks RAM cost: 1 GB * @param threads - Amount of threads that will be used. * @returns The security increase. */ hackAnalyzeSecurity(threads: number): number; /** + * Get the chance of successfully hacking a server. + * @remarks + * RAM cost: 1 GB + * * Returns the chance you have of successfully hacking the specified server. * * This returned value is in decimal form, not percentage. * - * @remarks RAM cost: 1 GB * @param host - Hostname of the target server. * @returns The chance you have of successfully hacking the target server. */ hackChance(host: string): number; /** + * Calculate the number of grow thread needed to grow a server by a certain multiplier. + * @remarks + * RAM cost: 1 GB + * * This function returns the number of “growths” needed in order to increase * the amount of money available on the specified server by the specified amount. * The specified amount is multiplicative and is in decimal form, not percentage. @@ -3168,7 +3489,6 @@ export interface NS extends Singularity { * growthAnalyze("foodnstuff", 2); * //If this returns 100, then this means you need to call grow 100 times in order to double the money (or once with 100 threads). * ``` - * @remarks RAM cost: 1 GB * @param host - Hostname of the target server. * @param growthAmount - Multiplicative factor by which the server is grown. Decimal form.. * @returns The amount of grow calls needed to grow the specified server by the specified amount @@ -3176,9 +3496,12 @@ export interface NS extends Singularity { growthAnalyze(host: string, growthAmount: number): number; /** + * Calculate the security increase for a number of thread. + * @remarks + * RAM cost: 1 GB + * * Returns the security increase that would occur if a grow with this many threads happened. * - * @remarks RAM cost: 1 GB * @param threads - Amount of threads that will be used. * @returns The security increase. */ @@ -3186,8 +3509,9 @@ export interface NS extends Singularity { /** * Suspends the script for n milliseconds. + * @remarks + * RAM cost: 0 GB * - * @remarks RAM cost: 0 GB * @param millis - Number of milliseconds to sleep. * @returns */ @@ -3195,24 +3519,26 @@ export interface NS extends Singularity { /** * Prints a value or a variable to the script’s logs. + * @remarks + * RAM cost: 0 GB * - * @remarks RAM cost: 0 GB * @param msg - Value to be printed. */ print(msg: any): void; /** * Prints a value or a variable to the Terminal. + * @remarks + * RAM cost: 0 GB * - * @remarks RAM cost: 0 GB * @param msg - Value to be printed. */ tprint(msg: any): void; /** * Clears the script’s logs. - * - * @remarks RAM cost: 0 GB + * @remarks + * RAM cost: 0 GB */ clearLog(): void; @@ -3220,6 +3546,7 @@ export interface NS extends Singularity { * Disables logging for the given function. * @remarks * RAM cost: 0 GB + * * Logging can be disabled for all functions by passing `ALL` as the argument. * * Note that this does not completely remove all logging functionality. @@ -3234,24 +3561,32 @@ export interface NS extends Singularity { disableLog(fn: string): void; /** + * Enable logging for a certain function. + * @remarks + * RAM cost: 0 GB + * * Re-enables logging for the given function. If `ALL` is passed into this * function as an argument, then it will revert the effects of disableLog(`ALL`). * - * @remarks RAM cost: 0 GB * @param fn - Name of function for which to enable logging. */ enableLog(fn: string): void; /** * Checks the status of the logging for the given function. + * @remarks + * RAM cost: 0 GB * - * @remarks RAM cost: 0 GB * @param fn - Name of function to check. * @returns Returns a boolean indicating whether or not logging is enabled for that function (or `ALL`) */ isLogEnabled(fn: string): boolean; /** + * Get all the logs of a script. + * @remarks + * RAM cost: 0 GB + * * Returns a script’s logs. The logs are returned as an array, where each line is an element in the array. * The most recently logged line is at the end of the array. * Note that there is a maximum number of lines that a script stores in its logs. This is configurable in the game’s options. @@ -3275,7 +3610,6 @@ export interface NS extends Singularity { * //Open logs from foo.script on the foodnstuff server that was run with the arguments [1, "test"] * getScriptLogs("foo.script", "foodnstuff", 1, "test"); * ``` - * @remarks RAM cost: 0 GB * @param fn - Optional. Filename of script to get logs from. * @param host - Optional. Hostname of the server that the script is on. * @param args - Arguments to identify which scripts to get logs for. @@ -3284,6 +3618,10 @@ export interface NS extends Singularity { getScriptLogs(fn?: string, host?: string, ...args: any[]): string[]; /** + * Open the tail window of a script. + * @remarks + * RAM cost: 0 GB + * * Opens a script’s logs. This is functionally the same as the tail Terminal command. * * If the function is called with no arguments, it will open the current script’s logs. @@ -3306,7 +3644,6 @@ export interface NS extends Singularity { * //Get logs from foo.script on the foodnstuff server that was run with the arguments [1, "test"] * tail("foo.script", "foodnstuff", 1, "test"); * ``` - * @remarks RAM cost: 0 GB * @param fn - Optional. Filename of the script being tailed. If omitted, the current script is tailed. * @param host - Optional. Hostname of the script being tailed. Defaults to the server this script is running on. If args are specified, this is not optional. * @param args - Arguments for the script being tailed. @@ -3314,11 +3651,14 @@ export interface NS extends Singularity { tail(fn?: string, host?: string, ...args: any[]): void; /** + * Get the list servers connected to a server. + * @remarks + * RAM cost: 0.2 GB + * * Returns an array containing the hostnames or IPs of all servers that are one * node way from the specified target server. The hostnames/IPs in the returned * array are strings. * - * @remarks RAM cost: 0.2 GB * @param host - Hostname of the server to scan. * @param hostnames - Optional boolean specifying whether the function should output hostnames (if true) or IP addresses (if false). * @returns Returns an string of hostnames or IP. @@ -3326,66 +3666,85 @@ export interface NS extends Singularity { scan(host: string, hostnames?: boolean): string[]; /** + * Runs NUKE.exe on a server. + * @remarks + * RAM cost: 0.05 GB + * * Runs the NUKE.exe program on the target server. NUKE.exe must exist on your home computer. * * @example * ```ts * nuke("foodnstuff"); * ``` - * @remarks RAM cost: 0.05 GB * @param host - Hostname of the target server. */ nuke(host: string): void; /** + * Runs BruteSSH.exe on a server. + * @remarks + * RAM cost: 0.05 GB + * * Runs the BruteSSH.exe program on the target server. BruteSSH.exe must exist on your home computer. * * @example * ```ts * brutessh("foodnstuff"); * ``` - * @remarks RAM cost: 0.05 GB * @param host - Hostname of the target server. */ brutessh(host: string): void; /** + * Runs FTPCrack.exe on a server. + * @remarks + * RAM cost: 0.05 GB + * * Runs the FTPCrack.exe program on the target server. FTPCrack.exe must exist on your home computer. * * @example * ```ts * ftpcrack("foodnstuff"); * ``` - * @remarks RAM cost: 0.05 GB * @param host - Hostname of the target server. */ ftpcrack(host: string): void; /** + * Runs relaySMTP.exe on a server. + * @remarks + * RAM cost: 0.05 GB + * * Runs the relaySMTP.exe program on the target server. relaySMTP.exe must exist on your home computer. * * @example * ```ts * relaysmtp("foodnstuff"); * ``` - * @remarks RAM cost: 0.05 GB * @param host - Hostname of the target server. */ relaysmtp(host: string): void; /** + * Runs HTTPWorm.exe on a server. + * @remarks + * RAM cost: 0.05 GB + * * Runs the HTTPWorm.exe program on the target server. HTTPWorm.exe must exist on your home computer. * * @example * ```ts * httpworm("foodnstuff"); * ``` - * @remarks RAM cost: 0.05 GB * @param host - Hostname of the target server. */ httpworm(host: string): void; /** + * Runs SQLInject.exe on a server. + * @remarks + * RAM cost: 0.05 GB + * * Runs the SQLInject.exe program on the target server. SQLInject.exe must exist on your home computer. * * @example @@ -3398,6 +3757,10 @@ export interface NS extends Singularity { sqlinject(host: string): void; /** + * Start another script on the current server. + * @remarks + * RAM cost: 1 GB + * * Run a script as a separate process. This function can only be used to run scripts located on the * current server (the server running the script that calls this function). Requires a significant * amount of RAM to run this command. @@ -3426,7 +3789,6 @@ export interface NS extends Singularity { * //This next example will run ‘foo.script’ single-threaded, and will pass the string ‘foodnstuff’ into the script as an argument: * run("foo.script", 1, 'foodnstuff'); * ``` - * @remarks RAM cost: 1 GB * @param script - Filename of script to run. * @param numThreads - Optional thread count for new script. Set to 1 by default. Will be rounded to nearest integer. * @param args - Additional arguments to pass into the new script that is being run. Note that if any arguments are being passed into the new script, then the second argument numThreads must be filled in with a value. @@ -3435,6 +3797,10 @@ export interface NS extends Singularity { run(script: string, numThreads?: number, ...args: string[]): number; /** + * Start another script on any server. + * @remarks + * RAM cost: 1.3 GB + * * Run a script as a separate process on a specified server. This is similar to the run function * except that it can be used to run a script on any server, instead of just the current server. * @@ -3462,7 +3828,6 @@ export interface NS extends Singularity { * //This last example will try to run the script foo.script on the foodnstuff server with 5 threads. It will also pass the number 1 and the string “test” in as arguments to the script: * exec("foo.script", "foodnstuff", 5, 1, "test"); * ``` - * @remarks RAM cost: 1.3 GB * @param script - Filename of script to execute. * @param host - Hostname of the `target server` on which to execute the script. * @param numThreads - Optional thread count for new script. Set to 1 by default. Will be rounded to nearest integer. @@ -3472,6 +3837,10 @@ export interface NS extends Singularity { exec(script: string, host: string, numThreads?: number, ...args: string[]): number; /** + * Terminate current script and start another in 10s. + * @remarks + * RAM cost: 2 GB + * * Terminates the current script, and then after a delay of about 10 seconds it will execute the * newly-specified script. The purpose of this function is to execute a new script without being * constrained by the RAM usage of the current one. This function can only be used to run scripts @@ -3484,7 +3853,6 @@ export interface NS extends Singularity { * //The following example will execute the script ‘foo.script’ with 10 threads and the arguments ‘foodnstuff’ and 90: * spawn('foo.script', 10, 'foodnstuff', 90); * ``` - * @remarks RAM cost: 2 GB * @param script - Filename of script to execute. * @param numThreads - Number of threads to spawn new script with. Will be rounded to nearest integer. * @param args - Additional arguments to pass into the new script that is being run. @@ -3492,6 +3860,10 @@ export interface NS extends Singularity { spawn(script: string, numThreads?: number, ...args: string[]): void; /** + * Terminate another script. + * @remarks + * RAM cost: 0.5 GB + * * Kills the script on the target server specified by the script’s name and arguments. * Remember that scripts are uniquely identified by both their name and arguments. * For example, if `foo.script` is run with the argument 1, then this is not the same as @@ -3512,7 +3884,6 @@ export interface NS extends Singularity { * //The following will try to kill a script named foo.script on the current server that was ran with the arguments 1 and “foodnstuff”: * kill("foo.script", getHostname(), 1, "foodnstuff"); * ``` - * @remarks RAM cost: 0.5 GB * @param script - Filename of the script to kill * @param host - Hostname of the server on which to kill the script. * @param args - Arguments to identify which script to kill. @@ -3521,6 +3892,10 @@ export interface NS extends Singularity { kill(script: string, host: string, ...args: string[]): boolean; /** + * Terminate another script. + * @remarks + * RAM cost: 0.5 GB + * * Kills the script with the specified PID. * Killing a script by its PID will typically have better performance, * especially if you have many scripts running. @@ -3533,18 +3908,20 @@ export interface NS extends Singularity { * print("Killed script with PID 10!"); * } * ``` - * @remarks RAM cost: 0.5 GB * @param scriptPid - PID of the script to kill * @returns True if the script is successfully killed, and false otherwise. */ kill(scriptPid: number): boolean; /** + * Terminate all scripts on a server. + * @remarks + * RAM cost: 0.5 GB + * * Kills all running scripts on the specified server. This function returns true * if any scripts were killed, and false otherwise. In other words, it will return * true if there are any scripts running on the target server. * - * @remarks RAM cost: 0.5 GB * @param host - IP or hostname of the server on which to kill all scripts. * @returns True if any scripts were killed, and false otherwise. */ @@ -3552,12 +3929,16 @@ export interface NS extends Singularity { /** * Terminates the current script immediately. - * - * @remarks RAM cost: 0 GB + * @remarks + * RAM cost: 0 GB */ exit(): void; /** + * Copy file between servers. + * @remarks + * RAM cost: 0.6 GB + * * Copies a script or literature (.lit) file(s) to another server. The files argument can be either a string * specifying a single file to copy, or an array of strings specifying multiple files to copy. * @@ -3566,7 +3947,6 @@ export interface NS extends Singularity { * //Copies hack-template.script from the current server to foodnstuff: * scp("hack-template.script", "foodnstuff"); * ``` - * @remarks RAM cost: 0.6 GB * @param files - Filename or an array of filenames of script/literature files to copy. * @param destination - Host of the destination server, which is the server to which the file will be copied. * @returns True if the script/literature file is successfully copied over and false otherwise. If the files argument is an array then this function will return true if at least one of the files in the array is successfully copied. @@ -3574,6 +3954,10 @@ export interface NS extends Singularity { scp(files: string[], destination: string): boolean; /** + * Copy file between servers. + * @remarks + * RAM cost: 0.6 GB + * * Copies a script or literature (.lit) file(s) to another server. The files argument can be either a string * specifying a single file to copy, or an array of strings specifying multiple files to copy. * @@ -3588,7 +3972,6 @@ export interface NS extends Singularity { * files = ["foo1.lit", "foo2.script", "foo3.script"]; * scp(files, "rothman-uni", "home"); * ``` - * @remarks RAM cost: 0.6 GB * @param files - Filename or an array of filenames of script/literature files to copy. * @param source - Host of the source server, which is the server from which the file will be copied. This argument is optional and if it’s omitted the source will be the current server. * @param destination - Host of the destination server, which is the server to which the file will be copied. @@ -3602,10 +3985,13 @@ export interface NS extends Singularity { ): boolean; /** + * List files on a server. + * @remarks + * RAM cost: 0.2 GB + * * Returns an array with the filenames of all files on the specified server * (as strings). The returned array is sorted in alphabetic order. * - * @remarks RAM cost: 0.2 GB * @param host - Host of the target server. * @param grep - A substring to search for in the filename. * @returns Array with the filenames of all files on the specified server. @@ -3613,6 +3999,10 @@ export interface NS extends Singularity { ls(host: string, grep?: string): string[]; /** + * List running scripts on a server. + * @remarks + * RAM cost: 0.2 GB + * * Returns an array with general information about all scripts running on the specified target server. * * @example @@ -3626,13 +4016,16 @@ export interface NS extends Singularity { * } * } * ``` - * @remarks RAM cost: 0.2 GB * @param host - Host address of the target server. If not specified, it will be the current server’s IP by default. * @returns Array with general information about all scripts running on the specified target server. */ ps(host?: string): ProcessInfo[]; /** + * Check if your have root access on a server. + * @remarks + * RAM cost: 0.05 GB + * * Returns a boolean indicating whether or not the player has root access to the specified target server. * * @example @@ -3641,7 +4034,6 @@ export interface NS extends Singularity { * nuke("foodnstuff"); * } * ``` - * @remarks RAM cost: 0.05 GB * @param host - Host of the target server * @returns True if player has root access to the specified target server, and false otherwise. */ @@ -3650,7 +4042,8 @@ export interface NS extends Singularity { /** * Returns a string with the hostname of the server that the script is running on. * - * @remarks RAM cost: 0.05 GB + * @remarks + * RAM cost: 0.05 GB * @returns Hostname of the server that the script is on. */ getHostname(): string; @@ -3658,12 +4051,17 @@ export interface NS extends Singularity { /** * Returns the player’s current hacking level. * - * @remarks RAM cost: 0.05 GB + * @remarks + * RAM cost: 0.05 GB * @returns Player’s current hacking level */ getHackingLevel(): number; /** + * Get hacking related multipliers. + * @remarks + * RAM cost: 4 GB + * * Returns an object containing the Player’s hacking related multipliers. * These multipliers are returned in fractional forms, not percentages * (e.g. 1.5 instead of 150%). @@ -3675,12 +4073,15 @@ export interface NS extends Singularity { * print(mults.chance); * print(mults.growth); * ``` - * @remarks RAM cost: 4 GB * @returns Object containing the Player’s hacking related multipliers. */ getHackingMultipliers(): HackingMultipliers; /** + * Get hacknet related multipliers. + * @remarks + * RAM cost: 4 GB + * * Returns an object containing the Player’s hacknet related multipliers. * These multipliers are returned in fractional forms, not percentages * (e.g. 1.5 instead of 150%). @@ -3692,7 +4093,6 @@ export interface NS extends Singularity { * print(mults.production); * print(mults.purchaseCost); * ``` - * @remarks RAM cost: 4 GB * @returns Object containing the Player’s hacknet related multipliers. */ getHacknetMultipliers(): HacknetMultipliers; @@ -3700,13 +4100,18 @@ export interface NS extends Singularity { /** * Returns a server object for the given server. Defaults to the running script's server if host is not specified. * - * @remarks RAM cost: 2 GB + * @remarks + * RAM cost: 2 GB * @param host - Optional. Hostname for the requested server object. * @returns The requested server object. */ getServer(host?: string): Server; /** + * Get money available on a server. + * @remarks + * RAM cost: 0.1 GB + * * Returns the amount of money available on a server. * Running this function on the home computer will return the player’s money. * @@ -3715,22 +4120,28 @@ export interface NS extends Singularity { * getServerMoneyAvailable("foodnstuff"); * getServerMoneyAvailable("home"); //Returns player's money * ``` - * @remarks RAM cost: 0.1 GB * @param host - Host of target server * @returns Amount of money available on the server. */ getServerMoneyAvailable(host: string): number; /** + * Get maximum money available on a server. + * @remarks + * RAM cost: 0.1 GB + * * Returns the maximum amount of money that can be available on a server. * - * @remarks RAM cost: 0.1 GB * @param host - Host of target server. * @returns Maximum amount of money available on the server. */ getServerMaxMoney(host: string): number; /** + * Get a server growth parameter. + * @remarks + * RAM cost: 0.1 GB + * * Returns the server’s instrinsic “growth parameter”. This growth * parameter is a number between 1 and 100 that represents how * quickly the server’s money grows. This parameter affects the @@ -3738,38 +4149,25 @@ export interface NS extends Singularity { * grow function. A higher growth parameter will result in a * higher percentage increase from grow. * - * @remarks RAM cost: 0.1 GB * @param host - Host of target server. * @returns Parameter that affects the percentage by which the server’s money is increased when using the grow function. */ getServerGrowth(host: string): number; /** + * Get server security level. + * @remarks + * RAM cost: 0.1 GB + * * Returns the security level of the target server. A server’s security * level is denoted by a number, typically between 1 and 100 * (but it can go above 100). * - * @remarks RAM cost: 0.1 GB * @param host - Host of target server. * @returns Security level of the target server. */ getServerSecurityLevel(host: string): number; - /** - * Returns the base security level of the target server. This is the security - * level that the server starts out with. This is different than - * getServerSecurityLevel because getServerSecurityLevel returns - * the current security level of a server, which can constantly change due to - * hack, grow, and weaken, calls on that server. - * The base security level will stay the same until you reset by - * installing an Augmentation(s). - * - * @remarks RAM cost: 0.1 GB - * @param host - Host of target server. - * @returns Base security level of the target server. - */ - getServerBaseSecurityLevel(host: string): number; - /** * Returns the minimum security level of the target server. * @@ -3797,24 +4195,6 @@ export interface NS extends Singularity { */ getServerNumPortsRequired(host: string): number; - /** - * Returns an array with two elements that gives information about a server’s memory (RAM). - * The first element in the array is the amount of RAM that the server has total (in GB). - * The second element in the array is the amount of RAM that is currently being used on - * the server (in GB). - * - * @example - * ```ts - * res = getServerRam("helios"); - * totalRam = res[0]; - * ramUsed = res[1]; - * ``` - * @remarks RAM cost: 0.1 GB - * @param host - Host of target server. - * @returns Array with total and used memory on the specified server. - */ - getServerRam(host: string): [number, number]; - /** * Returns a boolean denoting whether or not the specified server exists. * @@ -3825,6 +4205,10 @@ export interface NS extends Singularity { serverExists(host: string): boolean; /** + * Check if a file exists. + * @remarks + * RAM cost: 0.1 GB + * * Returns a boolean indicating whether the specified file exists on the target server. * The filename for scripts is case-sensitive, but for other types of files it is not. * For example, fileExists(“brutessh.exe”) will work fine, even though the actual program @@ -3843,7 +4227,6 @@ export interface NS extends Singularity { * //The function call will return true if the current server contains the FTPCrack.exe program, and false otherwise. * fileExists("ftpcrack.exe"); * ``` - * @remarks RAM cost: 0.1 GB * @param filename - Filename of file to check. * @param host - Host of target server. This is optional. If it is not specified then the function will use the current server as the target server. * @returns True if specified file exists, and false otherwise. @@ -3851,6 +4234,10 @@ export interface NS extends Singularity { fileExists(filename: string, host?: string): boolean; /** + * Check if a script is running. + * @remarks + * RAM cost: 0.1 GB + * * Returns a boolean indicating whether the specified script is running on the target server. * Remember that a script is uniquely identified by both its name and its arguments. * @@ -3869,7 +4256,6 @@ export interface NS extends Singularity { * //The function call will return true if there is a script named foo.script running with the arguments 1, 5, and “test” (in that order) on the joesguns server, and false otherwise: * isRunning("foo.script", "joesguns", 1, 5, "test"); * ``` - * @remarks RAM cost: 0.1 GB * @param script - Filename of script to check. This is case-sensitive. * @param host - Host of target server. * @param args - Arguments to specify/identify which scripts to search for. @@ -3878,6 +4264,10 @@ export interface NS extends Singularity { isRunning(script: string, host: string, ...args: string[]): boolean; /** + * Get cost of purchasing a server. + * @remarks + * RAM cost: 0.25 GB + * * Returns the cost to purchase a server with the specified amount of ram. * * @example @@ -3886,13 +4276,16 @@ export interface NS extends Singularity { * tprint(i + " -- " + getPurchasedServerCost(Math.pow(2, i))); * } * ``` - * @remarks RAM cost: 0.25 GB * @param ram - Amount of RAM of a potential purchased server. Must be a power of 2 (2, 4, 8, 16, etc.). Maximum value of 1048576 (2^20). * @returns The cost to purchase a server with the specified amount of ram. */ getPurchasedServerCost(ram: number): number; /** + * Purchase a server. + * @remarks + * 2.25 GB + * * Purchased a server with the specified hostname and amount of RAM. * * The hostname argument can be any data type, but it will be converted to a string @@ -3920,7 +4313,6 @@ export interface NS extends Singularity { * purchaseServer(hn + i, ram); * } * ``` - * @remarks 2.25 GB * @param hostname - Host of the purchased server. * @param ram - Amount of RAM of the purchased server. Must be a power of 2 (2, 4, 8, 16, etc.). Maximum value of 1048576 (2^20). * @returns The hostname of the newly purchased server. @@ -3928,13 +4320,16 @@ export interface NS extends Singularity { purchaseServer(hostname: string, ram: number): string; /** + * Delete a purchased server. + * @remarks + * 2.25 GB + * * Deletes one of your purchased servers, which is specified by its hostname. * * The hostname argument can be any data type, but it will be converted to a string. * Whitespace is automatically removed from the string. This function will not delete a * server that still has scripts running on it. * - * @remarks 2.25 GB * @param host - Host of the server to delete. * @returns True if successful, and false otherwise. */ @@ -3944,7 +4339,7 @@ export interface NS extends Singularity { * Returns an array with either the hostnames or IPs of all of the servers you have purchased. * * @remarks 2.25 GB - * @param hostnameMode -] Optional. Defaults to true. Returns hostnames if true, and IPs if false. + * @param hostnameMode - Optional. Defaults to true. Returns hostnames if true, and IPs if false. * @returns Returns an array with either the hostnames or IPs of all of the servers you have purchased. */ getPurchasedServers(hostnameMode?: boolean): string[]; @@ -3966,6 +4361,10 @@ export interface NS extends Singularity { getPurchasedServerMaxRam(): number; /** + * Write data to a file. + * @remarks + * RAM cost: 1 GB + * * This function can be used to either write data to a port or to a text file (.txt). * * If the first argument is a number between 1 and 20, then it specifies a port and this @@ -3980,7 +4379,6 @@ export interface NS extends Singularity { * then the data will be written in “append” mode which means that the data will be added at the * end of the text file. * - * @remarks RAM cost: 1 GB * @param handle - Port or text file that will be written to. * @param data - Data to write. * @param mode - Defines the write mode. Only valid when writing to text files. @@ -3988,11 +4386,14 @@ export interface NS extends Singularity { write(handle: string | number, data?: string[] | number, mode?: "w" | "a"): void; /** + * Attempt to write to a port. + * @remarks + * RAM cost: 1 GB + * * Attempts to write data to the specified Netscript Port. * If the port is full, the data will not be written. * Otherwise, the data will be written normally. * - * @remarks RAM cost: 1 GB * @param port - Port or text file that will be written to. * @param data - Data to write. * @returns True if the data is successfully written to the port, and false otherwise. @@ -4000,6 +4401,10 @@ export interface NS extends Singularity { tryWrite(port: number, data: string[] | number): boolean; /** + * Read content of a file. + * @remarks + * RAM cost: 1 GB + * * This function is used to read data from a port or from a text file (.txt). * * If the argument port/fn is a number between 1 and 20, then it specifies a @@ -4011,24 +4416,30 @@ export interface NS extends Singularity { * file (.txt) and this function will return the data in the specified text * file. If the text file does not exist, an empty string will be returned. * - * @remarks RAM cost: 1 GB * @param handle - Port or text file to read from. * @returns Data in the specified text file or port. */ read(handle: string | number): string | number | object; /** + * Get a copy of the data from a port without popping it. + * @remarks + * RAM cost: 1 GB + * * This function is used to peek at the data from a port. It returns the * first element in the specified port without removing that element. If * the port is empty, the string “NULL PORT DATA” will be returned. * - * @remarks RAM cost: 1 GB * @param port - Port to peek. Must be an integer between 1 and 20. * @returns Data in the specified port. */ peek(port: number): string | number | object; /** + * Clear data from a port. + * @remarks + * RAM cost: 0 GB + * * This function is used to clear data in a Netscript Ports or a text file. * * If the port/fn argument is a number between 1 and 20, then it specifies a @@ -4037,28 +4448,33 @@ export interface NS extends Singularity { * If the port/fn argument is a string, then it specifies the name of a * text file (.txt) and will delete all data from that text file. * - * @remarks RAM cost: 1 GB * @param handle - Port or text file to clear. */ clear(handle: string | number): void; /** + * Get all data on a port. + * @remarks + * RAM cost: 0 GB + * * Get a handle to a Netscript Port. * * WARNING: Port Handles only work in NetscriptJS (Netscript 2.0). They will not work in Netscript 1.0. * * @see https://bitburner.readthedocs.io/en/latest/netscript/netscriptmisc.html#netscript-ports - * @remarks RAM cost: 10 GB * @param port - Port number. Must be an integer between 1 and 20. * @returns Data in the specified port. */ getPortHandle(port: number): any[]; /** + * Delete a file. + * @remarks + * RAM cost: 1 GB + * * Removes the specified file from the current server. This function works for every file * type except message (.msg) files. * - * @remarks RAM cost: 1 GB * @param name - Filename of file to remove. Must include the extension. * @param host - Host Address of the server on which to delete the file. Optional. Defaults to current server. * @returns True if it successfully deletes the file, and false otherwise. @@ -4066,6 +4482,10 @@ export interface NS extends Singularity { rm(name: string, host?: string): boolean; /** + * Check if any script with a filename is running. + * @remarks + * RAM cost: 1 GB + * * Returns a boolean indicating whether any instance of the specified script is running * on the target server, regardless of its arguments. * @@ -4082,7 +4502,6 @@ export interface NS extends Singularity { * //The function call will return true if there is any script named “foo.script” running on the current server, and false otherwise: * scriptRunning("foo.script", getHostname()); * ``` - * @remarks RAM cost: 1 GB * @param script - Filename of script to check. This is case-sensitive. * @param host - Host of target server. * @returns True if the specified script is running, and false otherwise. @@ -4090,10 +4509,13 @@ export interface NS extends Singularity { scriptRunning(script: string, host: string): boolean; /** + * Kill all scripts with a filename. + * @remarks + * RAM cost: 1 GB + * * Kills all scripts with the specified filename on the target server specified by hostname, * regardless of arguments. * - * @remarks RAM cost: 1 GB * @param script - Filename of script to kill. This is case-sensitive. * @param host - Host of target server. * @returns true if one or more scripts were successfully killed, and false if none were. @@ -4109,10 +4531,13 @@ export interface NS extends Singularity { getScriptName(): string; /** + * Get the ram cost of a script. + * @remarks + * RAM cost: 0.1 GB + * * Returns the amount of RAM required to run the specified script on the target server. * Returns 0 if the script does not exist. * - * @remarks RAM cost: 0.1 GB * @param script - Filename of script. This is case-sensitive. * @param host - Host of target server the script is located on. This is optional, If it is not specified then the function will se the current server as the target server. * @returns Amount of RAM required to run the specified script on the target server, and 0 if the script does not exist. @@ -4120,42 +4545,55 @@ export interface NS extends Singularity { getScriptRam(script: string, host?: string): number; /** - * Returns the amount of time in seconds it takes to execute the hack Netscript function on the target server. + * Get the execution time of a hack() call. + * @remarks + * RAM cost: 0.05 GB + * + * Returns the amount of time in milliseconds it takes to execute the hack Netscript function on the target server. * The function takes in an optional hackLvl parameter that can be specified to see what the hack time would be at different hacking levels. * - * @remarks RAM cost: 0.05 GB * @param host - Host of target server. * @param hackLvl - Optional hacking level for the calculation. Defaults to player’s current hacking level. * @param intLvl - Optional intelligence level for the calculation. Defaults to player’s current intelligence level. (Intelligence is unlocked after obtaining Source-File 5). - * @returns Returns the amount of time in seconds it takes to execute the hack Netscript function. Returns Infinity if called on a Hacknet Server. + * @returns Returns the amount of time in milliseconds it takes to execute the hack Netscript function. Returns Infinity if called on a Hacknet Server. */ - getHackTime(host: string, hackLvl?: number, intLvl?: number): number; + getHackTime(host: string): number; /** + * Get the execution time of a grow() call. + * @remarks + * RAM cost: 0.05 GB + * * Returns the amount of time in seconds it takes to execute the grow Netscript function on the target server. * The function takes in an optional hackLvl parameter that can be specified to see what the grow time would be at different hacking levels. * - * @remarks RAM cost: 0.05 GB * @param host - Host of target server. * @param hackLvl - Optional hacking level for the calculation. Defaults to player’s current hacking level. * @param intLvl - Optional intelligence level for the calculation. Defaults to player’s current intelligence level. (Intelligence is unlocked after obtaining Source-File 5). * @returns Returns the amount of time in seconds it takes to execute the grow Netscript function. Returns Infinity if called on a Hacknet Server. */ - getGrowTime(host: string, hackLvl?: number, intLvl?: number): number; + getGrowTime(host: string): number; /** + * Get the execution time of a weaken() call. + * @remarks + * RAM cost: 0.05 GB + * * Returns the amount of time in seconds it takes to execute the weaken() Netscript function on the target server. * The function takes in an optional hackLvl parameter that can be specified to see what the weaken time would be at different hacking levels. * - * @remarks RAM cost: 0.05 GB * @param host - Host of target server. * @param hackLvl - Optional hacking level for the calculation. Defaults to player’s current hacking level. * @param intLvl - Optional intelligence level for the calculation. Defaults to player’s current intelligence level. (Intelligence is unlocked after obtaining Source-File 5). * @returns Returns the amount of time in seconds it takes to execute the grow Netscript function. Returns Infinity if called on a Hacknet Server. */ - getWeakenTime(host: string, hackLvl?: number, intLvl?: number): number; + getWeakenTime(host: string): number; /** + * Get the income of a script. + * @remarks + * RAM cost: 0.1 GB + * * Returns the amount of income the specified script generates while online * (when the game is open, does not apply for offline income). Remember that * a script is uniquely identified by both its name and its arguments. So for @@ -4170,7 +4608,6 @@ export interface NS extends Singularity { * The second value is the total income (dollar / second) that you’ve earned from scripts * since you last installed Augmentations. * - * @remarks RAM cost: 0.1 GB * @param script - Filename of script. * @param host - Server on which script is running. * @param args - Arguments that the script is running with. @@ -4179,6 +4616,10 @@ export interface NS extends Singularity { getScriptIncome(script: string, host: string, ...args: string[]): number | [number, number]; /** + * Get the exp gain of a script. + * @remarks + * RAM cost: 0.1 GB + * * Returns the amount of hacking experience the specified script generates while online * (when the game is open, does not apply for offline experience gains). Remember that a * script is uniquely identified by both its name and its arguments. @@ -4186,7 +4627,6 @@ export interface NS extends Singularity { * This function can also return the total experience gain rate of all of your active * scripts by running the function with no arguments. * - * @remarks RAM cost: 0.1 GB * @param script - Filename of script. * @param host - Server on which script is running. * @param args - Arguments that the script is running with. @@ -4203,10 +4643,12 @@ export interface NS extends Singularity { getTimeSinceLastAug(): number; /** - * Complete open source JavaScript sprintf implementation + * Format a string. * - * @see https://github.com/alexei/sprintf.js - * @remarks RAM cost: 0 GB + * @remarks + * RAM cost: 0 GB + * + * see: https://github.com/alexei/sprintf.js * @param format - String to format. * @param args - Formating arguments. * @returns Formated text. @@ -4214,10 +4656,11 @@ export interface NS extends Singularity { sprintf(format: string, ...args: string[]): string; /** - * Complete open source JavaScript sprintf implementation + * Format a string with an array of arguments. + * @remarks + * RAM cost: 0 GB * - * @see https://github.com/alexei/sprintf.js - * @remarks RAM cost: 0 GB + * see: https://github.com/alexei/sprintf.js * @param format - String to format. * @param args - Formating arguments. * @returns Formated text. @@ -4225,12 +4668,15 @@ export interface NS extends Singularity { vsprintf(format: string, args: string[]): string; /** + * Format a number + * @remarks + * RAM cost: 0 GB + * * Converts a number into a string with the specified formatter. * This uses the numeraljs library, so the formatters must be compatible with that. * This is the same function that the game itself uses to display numbers. * - * @see http://numeraljs.com/ - * @remarks RAM cost: 0 GB + * see: http://numeraljs.com/ * @param n - Number to format. * @param format - Formatter. * @returns Formated number. @@ -4238,18 +4684,25 @@ export interface NS extends Singularity { nFormat(n: number, format: string): number; /** + * Prompt the player with a Yes/No modal. + * @remarks + * RAM cost: 0 GB + * * Prompts the player with a dialog box with two options: “Yes” and “No”. * This function will return true if the player click “Yes” and false if * the player clicks “No”. The script’s execution is halted until the player * selects one of the options. * - * @remarks RAM cost: 0 GB * @param txt - Text to appear in the prompt dialog box. * @returns True if the player click “Yes” and false if the player clicks “No”. */ prompt(txt: string): Promise; /** + * Download a file from the internet. + * @remarks + * RAM cost: 0 GB + * * Retrieves data from a URL and downloads it to a file on the specified server. * The data can only be downloaded to a script (.script, .ns, .js) or a text file (.txt). * If the file already exists, it will be overwritten by this command. @@ -4271,7 +4724,6 @@ export interface NS extends Singularity { * ```ts * wget("https://raw.githubusercontent.com/danielyxie/bitburner/master/README.md", "game_readme.txt"); * ``` - * @remarks RAM cost: 0 GB * @param url - URL to pull data from. * @param target - Filename to write data to. Must be script or text file. * @param host - Optional hostname/ip of server for target file. @@ -4288,6 +4740,10 @@ export interface NS extends Singularity { getFavorToDonate(): number; /** + * Get the current Bitnode multipliers. + * @remarks + * RAM cost: 4 GB + * * Returns an object containing the current BitNode multipliers. * This function requires Source-File 5 in order to run. * The multipliers are returned in decimal forms (e.g. 1.5 instead of 150%). @@ -4304,7 +4760,6 @@ export interface NS extends Singularity { * print(mults.ServerMaxMoney); * print(mults.HackExpGain); * ``` - * @remarks RAM cost: 4 GB * @returns Object containing the current BitNode multipliers. */ getBitNodeMultipliers(): BitNodeMultipliers;