mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-04-23 01:32:55 +02:00
Remove markdown from git tracking (#139)
* Will attempt to add as build artifacts using workflow.
This commit is contained in:
@@ -1,57 +0,0 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [bitburner](./bitburner.md) > [Hacknet](./bitburner.hacknet.md) > [hashCost](./bitburner.hacknet.hashcost.md)
|
||||
|
||||
## Hacknet.hashCost() method
|
||||
|
||||
Get the cost of a hash upgrade.
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
hashCost(upgName: string, count?: number): number;
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
| Parameter | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| upgName | string | Name of the upgrade of Hacknet Node. |
|
||||
| count | number | Number of upgrades to buy at once. Defaults to 1 if not specified. |
|
||||
|
||||
<b>Returns:</b>
|
||||
|
||||
number
|
||||
|
||||
Number of hashes required for the specified upgrade.
|
||||
|
||||
## 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 required for the specified upgrade. The name of the upgrade must be an exact match.
|
||||
|
||||
## Example 1
|
||||
|
||||
|
||||
```ts
|
||||
// NS1:
|
||||
var upgradeName = "Sell for Corporation Funds";
|
||||
if (hacknet.numHashes() > hacknet.hashCost(upgradeName)) {
|
||||
hacknet.spendHashes(upgradeName);
|
||||
}
|
||||
```
|
||||
|
||||
## Example 2
|
||||
|
||||
|
||||
```ts
|
||||
// NS2:
|
||||
const upgradeName = "Sell for Corporation Funds";
|
||||
if (ns.hacknet.numHashes() > ns.hacknet.hashCost(upgradeName)) {
|
||||
ns.hacknet.spendHashes(upgradeName);
|
||||
}
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user