diff --git a/markdown/bitburner.basichgwoptions.additionalmsec.md b/markdown/bitburner.basichgwoptions.additionalmsec.md new file mode 100644 index 000000000..9e299188c --- /dev/null +++ b/markdown/bitburner.basichgwoptions.additionalmsec.md @@ -0,0 +1,13 @@ + + +[Home](./index.md) > [bitburner](./bitburner.md) > [BasicHGWOptions](./bitburner.basichgwoptions.md) > [additionalMsec](./bitburner.basichgwoptions.additionalmsec.md) + +## BasicHGWOptions.additionalMsec property + +Number of additional milliseconds that will be spent waiting between the start of the function and when it completes. There will only be one, contiguous wait, which is relevant because stats such as server security level are computed at the \*start\* of the function. Must be non-negative. + +**Signature:** + +```typescript +additionalMsec?: number; +``` diff --git a/markdown/bitburner.basichgwoptions.md b/markdown/bitburner.basichgwoptions.md index a64aede96..e25984a48 100644 --- a/markdown/bitburner.basichgwoptions.md +++ b/markdown/bitburner.basichgwoptions.md @@ -16,6 +16,7 @@ interface BasicHGWOptions | Property | Modifiers | Type | Description | | --- | --- | --- | --- | +| [additionalMsec?](./bitburner.basichgwoptions.additionalmsec.md) | | number | _(Optional)_ Number of additional milliseconds that will be spent waiting between the start of the function and when it completes. There will only be one, contiguous wait, which is relevant because stats such as server security level are computed at the \*start\* of the function. Must be non-negative. | | [stock?](./bitburner.basichgwoptions.stock.md) | | boolean | _(Optional)_ Set to true this action will affect the stock market. | | [threads?](./bitburner.basichgwoptions.threads.md) | | number | _(Optional)_ Number of threads to use for this function. Must be less than or equal to the number of threads the script is running with. | diff --git a/markdown/bitburner.hackingformulas.growpercent.md b/markdown/bitburner.hackingformulas.growpercent.md index b25e3279e..161506839 100644 --- a/markdown/bitburner.hackingformulas.growpercent.md +++ b/markdown/bitburner.hackingformulas.growpercent.md @@ -16,9 +16,9 @@ growPercent(server: Server, threads: number, player: Person, cores?: number): nu | Parameter | Type | Description | | --- | --- | --- | -| server | [Server](./bitburner.server.md) | Server info from [getServer](./bitburner.ns.getserver.md) | +| server | [Server](./bitburner.server.md) | Server info, typically from [getServer](./bitburner.ns.getserver.md) | | threads | number | Amount of thread. | -| player | [Person](./bitburner.person.md) | Player info from [getPlayer](./bitburner.ns.getplayer.md) | +| player | [Person](./bitburner.person.md) | Player info, typically from [getPlayer](./bitburner.ns.getplayer.md) | | cores | number | _(Optional)_ Number of cores on the computer that will execute grow. | **Returns:** diff --git a/markdown/bitburner.hackingformulas.growthreads.md b/markdown/bitburner.hackingformulas.growthreads.md new file mode 100644 index 000000000..be57c00eb --- /dev/null +++ b/markdown/bitburner.hackingformulas.growthreads.md @@ -0,0 +1,29 @@ + + +[Home](./index.md) > [bitburner](./bitburner.md) > [HackingFormulas](./bitburner.hackingformulas.md) > [growThreads](./bitburner.hackingformulas.growthreads.md) + +## HackingFormulas.growThreads() method + +Calculate how many threads it will take to grow server to targetMoney. Starting money is server.moneyAvailable. + +**Signature:** + +```typescript +growThreads(server: Server, player: Person, targetMoney: number, cores?: number): number; +``` + +## Parameters + +| Parameter | Type | Description | +| --- | --- | --- | +| server | [Server](./bitburner.server.md) | Server info, typically from [getServer](./bitburner.ns.getserver.md) | +| player | [Person](./bitburner.person.md) | Player info, typically from [getPlayer](./bitburner.ns.getplayer.md) | +| targetMoney | number | Desired final money, capped to server's moneyMax | +| cores | number | _(Optional)_ Number of cores on the computer that will execute grow. | + +**Returns:** + +number + +The calculated grow threads as an integer, rounded up. + diff --git a/markdown/bitburner.hackingformulas.growtime.md b/markdown/bitburner.hackingformulas.growtime.md index 317dbc123..d076491fb 100644 --- a/markdown/bitburner.hackingformulas.growtime.md +++ b/markdown/bitburner.hackingformulas.growtime.md @@ -16,8 +16,8 @@ growTime(server: Server, player: Person): number; | Parameter | Type | Description | | --- | --- | --- | -| server | [Server](./bitburner.server.md) | Server info from [getServer](./bitburner.ns.getserver.md) | -| player | [Person](./bitburner.person.md) | Player info from [getPlayer](./bitburner.ns.getplayer.md) | +| server | [Server](./bitburner.server.md) | Server info, typically from [getServer](./bitburner.ns.getserver.md) | +| player | [Person](./bitburner.person.md) | Player info, typically from [getPlayer](./bitburner.ns.getplayer.md) | **Returns:** diff --git a/markdown/bitburner.hackingformulas.hackchance.md b/markdown/bitburner.hackingformulas.hackchance.md index 0ef6007ad..1233c7951 100644 --- a/markdown/bitburner.hackingformulas.hackchance.md +++ b/markdown/bitburner.hackingformulas.hackchance.md @@ -16,8 +16,8 @@ hackChance(server: Server, player: Person): number; | Parameter | Type | Description | | --- | --- | --- | -| server | [Server](./bitburner.server.md) | Server info from [getServer](./bitburner.ns.getserver.md) | -| player | [Person](./bitburner.person.md) | Player info from [getPlayer](./bitburner.ns.getplayer.md) | +| server | [Server](./bitburner.server.md) | Server info, typically from [getServer](./bitburner.ns.getserver.md) | +| player | [Person](./bitburner.person.md) | Player info, typically from [getPlayer](./bitburner.ns.getplayer.md) | **Returns:** diff --git a/markdown/bitburner.hackingformulas.hackexp.md b/markdown/bitburner.hackingformulas.hackexp.md index 27af1cc07..4250eeb34 100644 --- a/markdown/bitburner.hackingformulas.hackexp.md +++ b/markdown/bitburner.hackingformulas.hackexp.md @@ -16,8 +16,8 @@ hackExp(server: Server, player: Person): number; | Parameter | Type | Description | | --- | --- | --- | -| server | [Server](./bitburner.server.md) | Server info from [getServer](./bitburner.ns.getserver.md) | -| player | [Person](./bitburner.person.md) | Player info from [getPlayer](./bitburner.ns.getplayer.md) | +| server | [Server](./bitburner.server.md) | Server info, typically from [getServer](./bitburner.ns.getserver.md) | +| player | [Person](./bitburner.person.md) | Player info, typically from [getPlayer](./bitburner.ns.getplayer.md) | **Returns:** diff --git a/markdown/bitburner.hackingformulas.hackpercent.md b/markdown/bitburner.hackingformulas.hackpercent.md index 9f4f11dae..76dbf7c1b 100644 --- a/markdown/bitburner.hackingformulas.hackpercent.md +++ b/markdown/bitburner.hackingformulas.hackpercent.md @@ -16,8 +16,8 @@ hackPercent(server: Server, player: Person): number; | Parameter | Type | Description | | --- | --- | --- | -| server | [Server](./bitburner.server.md) | Server info from [getServer](./bitburner.ns.getserver.md) | -| player | [Person](./bitburner.person.md) | Player info from [getPlayer](./bitburner.ns.getplayer.md) | +| server | [Server](./bitburner.server.md) | Server info, typically from [getServer](./bitburner.ns.getserver.md) | +| player | [Person](./bitburner.person.md) | Player info, typically from [getPlayer](./bitburner.ns.getplayer.md) | **Returns:** diff --git a/markdown/bitburner.hackingformulas.hacktime.md b/markdown/bitburner.hackingformulas.hacktime.md index a9c27b3ec..e6dd3ac10 100644 --- a/markdown/bitburner.hackingformulas.hacktime.md +++ b/markdown/bitburner.hackingformulas.hacktime.md @@ -16,8 +16,8 @@ hackTime(server: Server, player: Person): number; | Parameter | Type | Description | | --- | --- | --- | -| server | [Server](./bitburner.server.md) | Server info from [getServer](./bitburner.ns.getserver.md) | -| player | [Person](./bitburner.person.md) | Player info from [getPlayer](./bitburner.ns.getplayer.md) | +| server | [Server](./bitburner.server.md) | Server info, typically from [getServer](./bitburner.ns.getserver.md) | +| player | [Person](./bitburner.person.md) | Player info, typically from [getPlayer](./bitburner.ns.getplayer.md) | **Returns:** diff --git a/markdown/bitburner.hackingformulas.md b/markdown/bitburner.hackingformulas.md index 4bcf892de..69e8661a5 100644 --- a/markdown/bitburner.hackingformulas.md +++ b/markdown/bitburner.hackingformulas.md @@ -17,6 +17,7 @@ interface HackingFormulas | Method | Description | | --- | --- | | [growPercent(server, threads, player, cores)](./bitburner.hackingformulas.growpercent.md) | Calculate the percent a server would grow to. Not exact due to limitations of mathematics. (Ex: 3.0 would would grow the server to 300% of its current value.) | +| [growThreads(server, player, targetMoney, cores)](./bitburner.hackingformulas.growthreads.md) | Calculate how many threads it will take to grow server to targetMoney. Starting money is server.moneyAvailable. | | [growTime(server, player)](./bitburner.hackingformulas.growtime.md) | Calculate grow time. | | [hackChance(server, player)](./bitburner.hackingformulas.hackchance.md) | Calculate hack chance. (Ex: 0.25 would indicate a 25% chance of success.) | | [hackExp(server, player)](./bitburner.hackingformulas.hackexp.md) | Calculate hack exp for one thread. | diff --git a/markdown/bitburner.hackingformulas.weakentime.md b/markdown/bitburner.hackingformulas.weakentime.md index dfc0656d7..12f5718aa 100644 --- a/markdown/bitburner.hackingformulas.weakentime.md +++ b/markdown/bitburner.hackingformulas.weakentime.md @@ -16,8 +16,8 @@ weakenTime(server: Server, player: Person): number; | Parameter | Type | Description | | --- | --- | --- | -| server | [Server](./bitburner.server.md) | Server info from [getServer](./bitburner.ns.getserver.md) | -| player | [Person](./bitburner.person.md) | Player info from [getPlayer](./bitburner.ns.getplayer.md) | +| server | [Server](./bitburner.server.md) | Server info, typically from [getServer](./bitburner.ns.getserver.md) | +| player | [Person](./bitburner.person.md) | Player info, typically from [getPlayer](./bitburner.ns.getplayer.md) | **Returns:** diff --git a/markdown/bitburner.ns.grow.md b/markdown/bitburner.ns.grow.md index 5cb3182a9..02ba93ddf 100644 --- a/markdown/bitburner.ns.grow.md +++ b/markdown/bitburner.ns.grow.md @@ -23,31 +23,35 @@ grow(host: string, opts?: BasicHGWOptions): Promise; Promise<number> -The number by which the money on the server was multiplied for the growth. +The total effective multiplier that was applied to the server's money (after both additive and multiplicative 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 amount equal to the number of threads used and a certain, fixed percentage of current money on the server. 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](./bitburner.ns.getservergrowth.md) function can be used to obtain a server’s growth rate. +Use your hacking skills to increase the amount of money available on a server. -Like [hack](./bitburner.ns.hack.md), `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. +Once the grow is complete, $1 is added to the server's available money for every script thread. This additive growth allows for rescuing a server even after it is emptied. -## Example 1 +After this addition, the thread count is also used to determine a multiplier, which the server's money is then multiplied by. + +The multiplier scales exponentially with thread count, and its base depends on the server's security level and in inherent "growth" statistic that varies between different servers. + +[getServerGrowth](./bitburner.ns.getservergrowth.md) can be used to check the inherent growth statistic of a server. + +[growthAnalyze](./bitburner.ns.growthanalyze.md) can be used to determine the number of threads needed for a specified multiplicative portion of server growth. + +To determine the effect of a single grow, obtain access to the Formulas API and use [formulas.hacking.growPercent](./bitburner.hackingformulas.growpercent.md), or invert [growthAnalyze](./bitburner.ns.growthanalyze.md). + +Like [hack](./bitburner.ns.hack.md), `grow` can be called on any hackable server, regardless of where the script is running. Hackable servers are any servers not owned by the player. + +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 based on the number of threads. The security increase can be determined using [growthAnalyzeSecurity](./bitburner.ns.growthanalyzesecurity.md). + +## Example -```ts -// NS1: -var currentMoney = getServerMoneyAvailable("foodnstuff"); -currentMoney = currentMoney * grow("foodnstuff"); -``` - -## Example 2 - - -```ts -// NS2: -let currentMoney = ns.getServerMoneyAvailable("foodnstuff"); +```js +let currentMoney = ns.getServerMoneyAvailable("n00dles"); currentMoney *= await ns.grow("foodnstuff"); ``` diff --git a/markdown/bitburner.ns.growthanalyze.md b/markdown/bitburner.ns.growthanalyze.md index 6cc5d4c14..037e66716 100644 --- a/markdown/bitburner.ns.growthanalyze.md +++ b/markdown/bitburner.ns.growthanalyze.md @@ -4,12 +4,12 @@ ## NS.growthAnalyze() method -Calculate the number of grow threads needed to grow a server by a certain multiplier. +Calculate the number of grow threads needed for a given multiplicative growth factor. **Signature:** ```typescript -growthAnalyze(host: string, growthAmount: number, cores?: number): number; +growthAnalyze(host: string, multiplier: number, cores?: number): number; ``` ## Parameters @@ -17,42 +17,33 @@ growthAnalyze(host: string, growthAmount: number, cores?: number): number; | Parameter | Type | Description | | --- | --- | --- | | host | string | Hostname of the target server. | -| growthAmount | number | Multiplicative factor by which the server is grown. Decimal form. | -| cores | number | _(Optional)_ | +| multiplier | number | Multiplier that will be applied to a server's money after applying additive growth. Decimal form. | +| cores | number | _(Optional)_ Number of cores on the host running the grow function. Optional, defaults to 1. | **Returns:** number -The amount of grow calls needed to grow the specified server by the specified amount. +Decimal number of grow threads needed for the specified multiplicative growth factor (does not include additive growth). ## 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. +This function returns the total decimal number of [grow](./bitburner.ns.grow.md) threads needed in order to multiply the money available on the specified server by a given multiplier, if all threads are executed at the server's current security level, regardless of how many threads are assigned to each call. -Due to limitations of mathematics, this function won't be the true value, but an approximation. +Note that there is also an additive factor that is applied before the multiplier. Each [grow](./bitburner.ns.grow.md) call will add $1 to the host's money for each thread before applying the multiplier for its thread count. This means that at extremely low starting money, fewer threads would be needed to apply the same effective multiplier than what is calculated by growthAnalyze. -Warning: The value returned by this function isn’t necessarily a whole number. +Like other basic hacking analysis functions, this calculation uses the current status of the player and server. To calculate using hypothetical server or player status, obtain access to the Formulas API and use [formulas.hacking.growThreads](./bitburner.hackingformulas.growthreads.md). -## Example 1 +## Example -```ts -// NS1: -//For example, if you want to determine how many grow calls you need to double the amount of money on foodnstuff, you would use: -var growTimes = 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). -``` - -## Example 2 - - -```ts -// NS2: -//For example, if you want to determine how many grow calls you need to double the amount of money on foodnstuff, you would use: -const growTimes = ns.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). +```js +// calculate number of grow threads to apply 2x growth multiplier on n00dles (does not include the additive growth). +const growThreads = ns.growthAnalyze("n00dles", 2); + +// When using the thread count to launch a script, it needs to be converted to an integer. +ns.run("noodleGrow.js", Math.ceil(growThreads)); ``` diff --git a/markdown/bitburner.ns.hackanalyze.md b/markdown/bitburner.ns.hackanalyze.md index ea0d098fc..13d810edf 100644 --- a/markdown/bitburner.ns.hackanalyze.md +++ b/markdown/bitburner.ns.hackanalyze.md @@ -30,21 +30,12 @@ RAM cost: 1 GB Returns the part of the specified server’s money you will steal with a single thread hack. -## Example 1 +Like other basic hacking analysis functions, this calculation uses the current status of the player and server. To calculate using hypothetical server or player status, obtain access to the Formulas API and use [formulas.hacking.hackPercent](./bitburner.hackingformulas.hackpercent.md). + +## Example -```ts -// NS1: -//For example, assume the following returns 0.01: -var hackAmount = hackAnalyze("foodnstuff"); -//This means that if hack the foodnstuff server using a single thread, then you will steal 1%, or 0.01 of its total money. If you hack using N threads, then you will steal N*0.01 times its total money. -``` - -## Example 2 - - -```ts -// NS2: +```js //For example, assume the following returns 0.01: const hackAmount = ns.hackAnalyze("foodnstuff"); //This means that if hack the foodnstuff server using a single thread, then you will steal 1%, or 0.01 of its total money. If you hack using N threads, then you will steal N*0.01 times its total money. diff --git a/markdown/bitburner.ns.hackanalyzechance.md b/markdown/bitburner.ns.hackanalyzechance.md index 3fd969053..2ef08b586 100644 --- a/markdown/bitburner.ns.hackanalyzechance.md +++ b/markdown/bitburner.ns.hackanalyzechance.md @@ -32,3 +32,5 @@ Returns the chance you have of successfully hacking the specified server. This returned value is in decimal form, not percentage. +Like other basic hacking analysis functions, this calculation uses the current status of the player and server. To calculate using hypothetical server or player status, obtain access to the Formulas API and use [formulas.hacking.hackChance](./bitburner.hackingformulas.hackchance.md). + diff --git a/markdown/bitburner.ns.hackanalyzethreads.md b/markdown/bitburner.ns.hackanalyzethreads.md index 3a1cf7c25..b2aed6a78 100644 --- a/markdown/bitburner.ns.hackanalyzethreads.md +++ b/markdown/bitburner.ns.hackanalyzethreads.md @@ -4,7 +4,7 @@ ## NS.hackAnalyzeThreads() method -Predict the effect of hack. +Calculate the decimal number of threads needed to hack a specified amount of money from a target host. **Signature:** @@ -29,16 +29,17 @@ The number of threads needed to hack the server for hackAmount money. 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. +This function returns the decimal 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. ## Example ```ts -//For example, let’s say the foodnstuff server has $10m and you run: -hackAnalyzeThreads("foodnstuff", 1e6); -//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. +// Calculate threadcount of a single hack that would take $100k from n00dles +const hackThreads = hackAnalyzeThreads("n00dles", 1e5); + +// Launching a script requires an integer thread count. The below would take less than the targeted $100k. +ns.run("noodleHack.js", Math.floor(hackThreads)) + ``` diff --git a/markdown/bitburner.ns.md b/markdown/bitburner.ns.md index 9143138a7..a058f67c5 100644 --- a/markdown/bitburner.ns.md +++ b/markdown/bitburner.ns.md @@ -120,13 +120,13 @@ export async function main(ns) { | [getTotalScriptIncome()](./bitburner.ns.gettotalscriptincome.md) | Get the income of all scripts. | | [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 server's bank account, increasing the amount available. | -| [growthAnalyze(host, growthAmount, cores)](./bitburner.ns.growthanalyze.md) | Calculate the number of grow threads needed to grow a server by a certain multiplier. | +| [growthAnalyze(host, multiplier, cores)](./bitburner.ns.growthanalyze.md) | Calculate the number of grow threads needed for a given multiplicative growth factor. | | [growthAnalyzeSecurity(threads, hostname, cores)](./bitburner.ns.growthanalyzesecurity.md) | Calculate the security increase for a number of threads. | | [hack(host, opts)](./bitburner.ns.hack.md) | Steal a server's money. | | [hackAnalyze(host)](./bitburner.ns.hackanalyze.md) | Get the part of money stolen with a single thread. | | [hackAnalyzeChance(host)](./bitburner.ns.hackanalyzechance.md) | Get the chance of successfully hacking a server. | | [hackAnalyzeSecurity(threads, hostname)](./bitburner.ns.hackanalyzesecurity.md) | Get the security increase for a number of threads. | -| [hackAnalyzeThreads(host, hackAmount)](./bitburner.ns.hackanalyzethreads.md) | Predict the effect of hack. | +| [hackAnalyzeThreads(host, hackAmount)](./bitburner.ns.hackanalyzethreads.md) | Calculate the decimal number of threads needed to hack a specified amount of money from a target host. | | [hasRootAccess(host)](./bitburner.ns.hasrootaccess.md) | Check if you have root access on a server. | | [hasTorRouter()](./bitburner.ns.hastorrouter.md) | Returns whether the player has access to the darkweb. | | [httpworm(host)](./bitburner.ns.httpworm.md) | Runs HTTPWorm.exe on a server. | diff --git a/markdown/bitburner.office.md b/markdown/bitburner.office.md index 82553ffcb..57c0fcbf2 100644 --- a/markdown/bitburner.office.md +++ b/markdown/bitburner.office.md @@ -27,4 +27,5 @@ export interface Office | [maxHap](./bitburner.office.maxhap.md) | | number | Maximum happiness of the employees | | [maxMor](./bitburner.office.maxmor.md) | | number | Maximum morale of the employees | | [size](./bitburner.office.size.md) | | number | Maximum number of employee | +| [totalExperience](./bitburner.office.totalexperience.md) | | number | Total experience of all employees | diff --git a/markdown/bitburner.office.totalexperience.md b/markdown/bitburner.office.totalexperience.md new file mode 100644 index 000000000..e7ab709e6 --- /dev/null +++ b/markdown/bitburner.office.totalexperience.md @@ -0,0 +1,13 @@ + + +[Home](./index.md) > [bitburner](./bitburner.md) > [Office](./bitburner.office.md) > [totalExperience](./bitburner.office.totalexperience.md) + +## Office.totalExperience property + +Total experience of all employees + +**Signature:** + +```typescript +totalExperience: number; +``` diff --git a/markdown/bitburner.reputationformulas.repfromdonation.md b/markdown/bitburner.reputationformulas.repfromdonation.md index 1fe5b1245..2b003c106 100644 --- a/markdown/bitburner.reputationformulas.repfromdonation.md +++ b/markdown/bitburner.reputationformulas.repfromdonation.md @@ -17,7 +17,7 @@ repFromDonation(amount: number, player: Person): number; | Parameter | Type | Description | | --- | --- | --- | | amount | number | Amount of money donated | -| player | [Person](./bitburner.person.md) | Player info from [getPlayer](./bitburner.ns.getplayer.md) | +| player | [Person](./bitburner.person.md) | Player info, typically from [getPlayer](./bitburner.ns.getplayer.md) | **Returns:**