mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-23 08:03:48 +01:00
45 lines
1.3 KiB
Markdown
45 lines
1.3 KiB
Markdown
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||
|
||
[Home](./index.md) > [bitburner](./bitburner.md) > [NS](./bitburner.ns.md) > [hackAnalyzeThreads](./bitburner.ns.hackanalyzethreads.md)
|
||
|
||
## NS.hackAnalyzeThreads() method
|
||
|
||
Predict the effect of hack.
|
||
|
||
<b>Signature:</b>
|
||
|
||
```typescript
|
||
hackAnalyzeThreads(host: string, hackAmount: number): number;
|
||
```
|
||
|
||
## Parameters
|
||
|
||
| Parameter | Type | Description |
|
||
| --- | --- | --- |
|
||
| host | string | Hostname of the target server to analyze. |
|
||
| hackAmount | number | Amount of money you want to hack from the server. |
|
||
|
||
<b>Returns:</b>
|
||
|
||
number
|
||
|
||
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.
|
||
|
||
Warning: The value returned by this function isn’t necessarily a whole number.
|
||
|
||
## 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.
|
||
```
|
||
|