From 75481aa195fc8b7e539f0695f1f367a9af257b2d Mon Sep 17 00:00:00 2001 From: omuretsu <84951833+Snarling@users.noreply.github.com> Date: Tue, 28 Feb 2023 09:57:02 -0500 Subject: [PATCH] Fix growthAnalyzeSecurity doc Also a format fix from a previous sloppy commit --- markdown/bitburner.ns.growthanalyzesecurity.md | 4 ++-- markdown/bitburner.ns.md | 2 +- src/NetscriptFunctions.ts | 2 +- src/ScriptEditor/NetscriptDefinitions.d.ts | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/markdown/bitburner.ns.growthanalyzesecurity.md b/markdown/bitburner.ns.growthanalyzesecurity.md index 8ca794a5a..5b7f8afe6 100644 --- a/markdown/bitburner.ns.growthanalyzesecurity.md +++ b/markdown/bitburner.ns.growthanalyzesecurity.md @@ -4,7 +4,7 @@ ## NS.growthAnalyzeSecurity() method -Calculate the security increase for a number of threads. +Calculate the security increase for a number of grow threads. **Signature:** @@ -17,7 +17,7 @@ growthAnalyzeSecurity(threads: number, hostname?: string, cores?: number): numbe | Parameter | Type | Description | | --- | --- | --- | | threads | number | Amount of threads that will be used. | -| hostname | string | _(Optional)_ Optional. Hostname of the target server. The number of threads is limited to the number needed to hack the server's maximum amount of money. | +| hostname | string | _(Optional)_ Optional. Hostname of the target server. If provided, security increase is limited by the number of threads needed to reach maximum money. | | cores | number | _(Optional)_ Optional. The number of cores of the server that would run grow. | **Returns:** diff --git a/markdown/bitburner.ns.md b/markdown/bitburner.ns.md index 735ec3f28..2da1b8ad3 100644 --- a/markdown/bitburner.ns.md +++ b/markdown/bitburner.ns.md @@ -121,7 +121,7 @@ export async function main(ns) { | [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, 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. | +| [growthAnalyzeSecurity(threads, hostname, cores)](./bitburner.ns.growthanalyzesecurity.md) | Calculate the security increase for a number of grow 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. | diff --git a/src/NetscriptFunctions.ts b/src/NetscriptFunctions.ts index 77cfafc5e..68dafd904 100644 --- a/src/NetscriptFunctions.ts +++ b/src/NetscriptFunctions.ts @@ -176,7 +176,7 @@ export const ns: InternalAPI = { return 0; // To prevent returning infinity below } - return hackAmount / server.moneyAvailable * percentHacked; + return (hackAmount / server.moneyAvailable) * percentHacked; }, hackAnalyze: (ctx) => (_hostname) => { const hostname = helpers.string(ctx, "hostname", _hostname); diff --git a/src/ScriptEditor/NetscriptDefinitions.d.ts b/src/ScriptEditor/NetscriptDefinitions.d.ts index 342cf4ca8..100e89ef0 100644 --- a/src/ScriptEditor/NetscriptDefinitions.d.ts +++ b/src/ScriptEditor/NetscriptDefinitions.d.ts @@ -4828,14 +4828,14 @@ export interface NS { growthAnalyze(host: string, multiplier: number, cores?: number): number; /** - * Calculate the security increase for a number of threads. + * Calculate the security increase for a number of grow threads. * @remarks * RAM cost: 1 GB * * Returns the security increase that would occur if a grow with this many threads happened. * * @param threads - Amount of threads that will be used. - * @param hostname - Optional. Hostname of the target server. The number of threads is limited to the number needed to hack the server's maximum amount of money. + * @param hostname - Optional. Hostname of the target server. If provided, security increase is limited by the number of threads needed to reach maximum money. * @param cores - Optional. The number of cores of the server that would run grow. * @returns The security increase. */