Update netscript documentation.

Unfortunately, I haven't used most of the specialty APIs yet, so I'm not intimately familiar with where their documentation might be wrong. I figured some fixes were better than no fixes, and I can always make more fixes later.

Fixes #1023.
This commit is contained in:
MageKing17
2021-07-02 14:27:59 -07:00
committed by danielyxie
parent 55d1ebd0e4
commit ae15914efa
73 changed files with 322 additions and 267 deletions

View File

@@ -6,21 +6,28 @@ constants() Netscript Function
:RAM cost: 0 GB
:returns: A structure with various constants related to hacknet nodes.
If you are not in BitNode-5, then you must have Source-File 5-1 in order to
use this function.
Returns an object with the following properties::
{
MoneyGainPerLevel: Multiplied by the node's level to get the node's base income
BaseCost: A multiplier used when buying new nodes or upgrading levels
LevelBaseCost: A multiplier used when upgrading levels
RamBaseCost: A multiplier used when upgrading RAM
CoreBaseCost: A multiplier used when buying additional cores
PurchaseNextMult: The root of an exponent used when buying new nodes
UpgradeLevelMult: The root of an exponent used when upgrading levels
UpgradeRamMult: The root of an exponent used when upgrading RAM
UpgradeCoreMult: The root of an exponent used when buying additional cores
MaxLevel: Maximum level a node can have
MaxRam: Maximum RAM a node can have
MaxCores: Maximum number of cores a node can have
}
Examples:
.. code-block:: javascript
{
MoneyGainPerLevel
BaseCost
LevelBaseCost
RamBaseCost
CoreBaseCost
PurchaseNextMult
UpgradeLevelMult
UpgradeRamMult
UpgradeCoreMult
MaxLevel
MaxRam
MaxCores
}
tprint("Maximum RAM a hacknet node can have: "+formulas.hacknetNodes.constants().MaxRam+" GB.");

View File

@@ -9,7 +9,8 @@ coreUpgradeCost() Netscript Function
:param number costMult: Aug multiplier that reduces cost. Defaults to ``1``.
:returns: Money required to go from ``startingCores`` to ``startingCores+extraCores``.
You must have Source-File 5-1 in order to use this function.
If you are not in BitNode-5, then you must have Source-File 5-1 in order to
use this function.
This function calculates the cost of upgrading cores from any level to any level.

View File

@@ -8,7 +8,8 @@ hacknetNodeCost() Netscript Function
:param number costMult: Aug multiplier that reduces cost. Defaults to ``1``.
:returns: Money required to buy your ``nodeN`` th node.
You must have Source-File 5-1 in order to use this function.
If you are not in BitNode-5, then you must have Source-File 5-1 in order to
use this function.
This function calculates the cost purchasing a hacknet node.

View File

@@ -9,7 +9,8 @@ levelUpgradeCost() Netscript Function
:param number costMult: Aug multiplier that reduces cost. Defaults to ``1``.
:returns: Money required to go from ``startingLevel`` to ``startingLevel+extraLevels``.
You must have Source-File 5-1 in order to use this function.
If you are not in BitNode-5, then you must have Source-File 5-1 in order to
use this function.
This function calculates the cost of upgrading levels from any level to any level.
@@ -17,4 +18,4 @@ levelUpgradeCost() Netscript Function
.. code-block:: javascript
formulas.hacknetNodes.levelUpgradeCost(1, 5); // returns: 2816
formulas.hacknetNodes.levelUpgradeCost(1, 5); // returns: 2816

View File

@@ -9,7 +9,8 @@ moneyGainRate() Netscript Function
:param number core: cores of the node.
:returns: Money per second that a node with those stats would gain per second.
You must have Source-File 5-1 in order to use this function.
If you are not in BitNode-5, then you must have Source-File 5-1 in order to
use this function.
This function calculates the money rate of a node with the given stats.
@@ -21,4 +22,4 @@ moneyGainRate() Netscript Function
currentRate = formulas.hacknetNodes.moneyGainRate(node.level, node.ram, node.cores);
levelRate = formulas.hacknetNodes.moneyGainRate(node.level+1, node.ram, node.cores);
ramRate = formulas.hacknetNodes.moneyGainRate(node.level, node.ram*2, node.cores);
coresRate = formulas.hacknetNodes.moneyGainRate(node.level, node.ram, node.cores+1);
coresRate = formulas.hacknetNodes.moneyGainRate(node.level, node.ram, node.cores+1);

View File

@@ -11,7 +11,8 @@ ramUpgradeCost() Netscript Function
..note:: ``startingRam`` is the actual amount of ram, not the amount of levels of ram.
You must have Source-File 5-1 in order to use this function.
If you are not in BitNode-5, then you must have Source-File 5-1 in order to
use this function.
This function calculates the cost of upgrading levels from any level to any level.
@@ -19,4 +20,4 @@ ramUpgradeCost() Netscript Function
.. code-block:: javascript
formulas.hacknetNodes.ramUpgradeCost(1, 5); // returns: 2095000
formulas.hacknetNodes.ramUpgradeCost(1, 5); // returns: 2095000