2021-10-30 18:34:14 +02:00
|
|
|
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
|
|
|
2021-10-30 21:46:34 +02:00
|
|
|
[Home](./index.md) > [bitburner](./bitburner.md) > [Hacknet](./bitburner.hacknet.md) > [hashCost](./bitburner.hacknet.hashcost.md)
|
2021-10-30 18:34:14 +02:00
|
|
|
|
2021-10-30 21:46:34 +02:00
|
|
|
## Hacknet.hashCost() method
|
2021-10-30 18:34:14 +02:00
|
|
|
|
|
|
|
This function is only applicable for Hacknet Servers (the upgraded version of a Hacknet Node).
|
|
|
|
|
|
|
|
Returns the number of hashes required for the specified upgrade. The name of the upgrade must be an exact match.
|
|
|
|
|
|
|
|
<b>Signature:</b>
|
|
|
|
|
|
|
|
```typescript
|
|
|
|
hashCost(upgName: HashUpgrades): number;
|
|
|
|
```
|
|
|
|
|
|
|
|
## Parameters
|
|
|
|
|
|
|
|
| Parameter | Type | Description |
|
|
|
|
| --- | --- | --- |
|
|
|
|
| upgName | [HashUpgrades](./bitburner.hashupgrades.md) | Name of the upgrade of Hacknet Node. |
|
|
|
|
|
|
|
|
<b>Returns:</b>
|
|
|
|
|
|
|
|
number
|
|
|
|
|
|
|
|
Number of hashes required for the specified upgrade.
|
|
|
|
|
|
|
|
## Remarks
|
|
|
|
|
2021-10-30 21:46:34 +02:00
|
|
|
RAM cost: 0 GB
|
2021-10-30 18:34:14 +02:00
|
|
|
|
|
|
|
## Example
|
|
|
|
|
|
|
|
|
2021-10-30 21:46:34 +02:00
|
|
|
```ts
|
2021-10-30 18:34:14 +02:00
|
|
|
var upgradeName = "Sell for Corporation Funds";
|
|
|
|
if (hacknet.numHashes() > hacknet.hashCost(upgradeName)) {
|
|
|
|
hacknet.spendHashes(upgName);
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|