mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-04-18 07:18:38 +02:00
work to make documentation unified.
This commit is contained in:
@@ -6,14 +6,12 @@ getCacheUpgradeCost() Netscript Function
|
||||
.. js:function:: getCacheUpgradeCost(i, n)
|
||||
|
||||
:RAM cost: 0 GB
|
||||
|
||||
:param number i: Index/Identifier of Hacknet Node. :ref:`See here for details <netscript_hacknetnodeapi_referencingahacknetnode>`
|
||||
:param number i: Index of Hacknet Node. :ref:`See here for details <netscript_hacknetnodeapi_referencingahacknetnode>`
|
||||
:param number n: Number of times to upgrade cache. Must be positive. Rounded to nearest integer
|
||||
|
||||
:return: Cost of upgrading the cache level of the specified Hacknet Server by ``n``.
|
||||
|
||||
.. note:: This function is only applicable for Hacknet Servers (the upgraded version of
|
||||
a Hacknet Node).
|
||||
|
||||
Returns the cost of upgrading the cache level of the specified Hacknet Server by *n*.
|
||||
|
||||
If an invalid value for *n* is provided, then this function returns 0. If the
|
||||
specified Hacknet Server is already at the max cache level, then Infinity is returned.
|
||||
If an invalid value for ``n`` is provided, then this function returns ``0``. If the
|
||||
specified Hacknet Server is already at the max cache level, then ``Infinity`` is returned.
|
||||
|
||||
@@ -4,11 +4,9 @@ getCoreUpgradeCost() Netscript Function
|
||||
.. js:function:: getCoreUpgradeCost(i, n)
|
||||
|
||||
:RAM cost: 0 GB
|
||||
|
||||
:param number i: Index/Identifier of Hacknet Node. :ref:`See here for details <netscript_hacknetnodeapi_referencingahacknetnode>`
|
||||
:param number i: Index of Hacknet Node. :ref:`See here for details <netscript_hacknetnodeapi_referencingahacknetnode>`
|
||||
:param number n: Number of times to upgrade cores. Must be positive. Rounded to nearest integer
|
||||
:returns: Cost of upgrading the number of cores of the specified Hacknet Node by ``n``.
|
||||
|
||||
Returns the cost of upgrading the number of cores of the specified Hacknet Node by *n*.
|
||||
|
||||
If an invalid value for *n* is provided, then this function returns 0. If the
|
||||
specified Hacknet Node is already at the max number of cores, then Infinity is returned.
|
||||
If an invalid value for ``n`` is provided, then this function returns ``0``. If the
|
||||
specified Hacknet Node is already at the max number of cores, then ``Infinity`` is returned.
|
||||
|
||||
@@ -4,11 +4,9 @@ getLevelUpgradeCost() Netscript Function
|
||||
.. js:function:: getLevelUpgradeCost(i, n)
|
||||
|
||||
:RAM cost: 0 GB
|
||||
|
||||
:param number i: Index/Identifier of Hacknet Node. :ref:`See here for details <netscript_hacknetnodeapi_referencingahacknetnode>`
|
||||
:param number i: Index of Hacknet Node. :ref:`See here for details <netscript_hacknetnodeapi_referencingahacknetnode>`
|
||||
:param number n: Number of levels to upgrade. Must be positive. Rounded to nearest integer
|
||||
:returns: Cost of upgrading the specified Hacknet Node by ``n`` levels.
|
||||
|
||||
Returns the cost of upgrading the specified Hacknet Node by *n* levels.
|
||||
|
||||
If an invalid value for *n* is provided, then this function returns 0. If the
|
||||
specified Hacknet Node is already at max level, then Infinity is returned.
|
||||
If an invalid value for ``n`` is provided, then this function returns ``0``. If the
|
||||
specified Hacknet Node is already at max level, then ``Infinity`` is returned.
|
||||
|
||||
@@ -6,10 +6,10 @@ getNodeStats() Netscript Function
|
||||
.. js:function:: getNodeStats(i)
|
||||
|
||||
:RAM cost: 0 GB
|
||||
:param number i: Index of Hacknet Node. :ref:`See here for details <netscript_hacknetnodeapi_referencingahacknetnode>`
|
||||
:returns: Object containing a variety of stats about the specified Hacknet Node
|
||||
|
||||
:param number i: Index/Identifier of Hacknet Node. :ref:`See here for details <netscript_hacknetnodeapi_referencingahacknetnode>`
|
||||
|
||||
Returns an object containing a variety of stats about the specified Hacknet Node::
|
||||
::
|
||||
|
||||
{
|
||||
name: Node's name ("hacknet-node-5"),
|
||||
@@ -24,5 +24,5 @@ getNodeStats() Netscript Function
|
||||
}
|
||||
|
||||
.. note:: Note that for Hacknet Nodes, production refers to the amount of money the node generates.
|
||||
For Hacknet Servers (the upgraded version of Hacknet Nodes), production refers to the amount
|
||||
of hashes the node generates.
|
||||
For Hacknet Servers (the upgraded version of Hacknet Nodes), production refers to the amount
|
||||
of hashes the node generates.
|
||||
|
||||
@@ -4,5 +4,4 @@ getPurchaseNodeCost() Netscript Function
|
||||
.. js:function:: getPurchaseNodeCost()
|
||||
|
||||
:RAM cost: 0 GB
|
||||
|
||||
Returns the cost of purchasing a new Hacknet Node
|
||||
:returns: Cost of purchasing a new Hacknet Node.
|
||||
|
||||
@@ -4,11 +4,9 @@ getRamUpgradeCost() Netscript Function
|
||||
.. js:function:: getRamUpgradeCost(i, n)
|
||||
|
||||
:RAM cost: 0 GB
|
||||
:param number i: Index of Hacknet Node. :ref:`See here for details <netscript_hacknetnodeapi_referencingahacknetnode>`
|
||||
:param number n: Number of times to upgrade RAM. Must be positive. Rounded to nearest integer.
|
||||
:returns: Cost of upgrading the RAM of the specified Hacknet Node ``n`` times.
|
||||
|
||||
:param number i: Index/Identifier of Hacknet Node. :ref:`See here for details <netscript_hacknetnodeapi_referencingahacknetnode>`
|
||||
:param number n: Number of times to upgrade RAM. Must be positive. Rounded to nearest integer
|
||||
|
||||
Returns the cost of upgrading the RAM of the specified Hacknet Node *n* times.
|
||||
|
||||
If an invalid value for *n* is provided, then this function returns 0. If the
|
||||
specified Hacknet Node is already at max RAM, then Infinity is returned.
|
||||
If an invalid value for ``n`` is provided, then this function returns ``0``. If the
|
||||
specified Hacknet Node is already at max RAM, then ``Infinity`` is returned.
|
||||
|
||||
@@ -6,20 +6,18 @@ hashCost() Netscript Function
|
||||
.. js:function:: hashCost(upgName)
|
||||
|
||||
:RAM cost: 0 GB
|
||||
|
||||
:param string upgName: Name of upgrade to get the cost of. Must be an exact match
|
||||
:returns: Number of hashes required for the specified upgrade. The name of
|
||||
the upgrade must be an exact match.
|
||||
|
||||
.. note:: 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:
|
||||
|
||||
.. code:: javascript
|
||||
|
||||
var upgradeName = "Sell for Corporation Funds";
|
||||
upgradeName = "Sell for Corporation Funds";
|
||||
if (hacknet.numHashes() > hacknet.hashCost(upgradeName)) {
|
||||
hacknet.spendHashes(upgName);
|
||||
}
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
maxNumNodes() Netscript Function
|
||||
=============================
|
||||
================================
|
||||
|
||||
.. js:function:: maxNumNodes()
|
||||
|
||||
:RAM cost: 0 GB
|
||||
|
||||
Returns the maximum number of Hacknet Nodes you can own.
|
||||
:returns: Maximum number of Hacknet Nodes you can own.
|
||||
|
||||
@@ -6,8 +6,8 @@ numHashes() Netscript Function
|
||||
.. js:function:: numHashes()
|
||||
|
||||
:RAM cost: 0 GB
|
||||
:returns: Number of hashes you have.
|
||||
|
||||
.. note:: This function is only applicable for Hacknet Servers (the upgraded version
|
||||
of a Hacknet Node).
|
||||
|
||||
Returns the number of hashes you have
|
||||
|
||||
@@ -4,5 +4,4 @@ numNodes() Netscript Function
|
||||
.. js:function:: numNodes()
|
||||
|
||||
:RAM cost: 0 GB
|
||||
|
||||
Returns the number of Hacknet Nodes you own.
|
||||
:returns: Number of Hacknet Nodes you own.
|
||||
|
||||
@@ -4,10 +4,8 @@ purchaseNode() Netscript Function
|
||||
.. js:function:: purchaseNode()
|
||||
|
||||
:RAM cost: 0 GB
|
||||
:returns: Index of the newly purchased node. -1 on failure.
|
||||
|
||||
Purchases a new Hacknet Node. Returns a number with the index of the Hacknet Node.
|
||||
Purchases a new Hacknet Node.
|
||||
This index is equivalent to the number at the end of the Hacknet Node's name
|
||||
(e.g The Hacknet Node named 'hacknet-node-4' will have an index of 4).
|
||||
|
||||
If the player cannot afford to purchase a new Hacknet Node then the function
|
||||
will return -1.
|
||||
|
||||
@@ -6,19 +6,19 @@ spendHashes() Netscript Function
|
||||
.. js:function:: spendHashes(upgName, upgTarget)
|
||||
|
||||
:RAM cost: 0 GB
|
||||
|
||||
:param string upgName: Name of upgrade to spend hashes on. Must be an exact match
|
||||
:param string upgTarget: Object to which upgrade applies. Required for certain upgrades
|
||||
:returns: ``true`` if the purchase was successful.
|
||||
|
||||
.. note:: This function is only applicable for Hacknet Servers (the upgraded version
|
||||
of a Hacknet Node).
|
||||
|
||||
Spend the hashes generated by your Hacknet Servers on an upgrade. Returns a boolean value -
|
||||
true if the upgrade is successfully purchased, and false otherwise.
|
||||
Spend the hashes generated by your Hacknet Servers on an upgrade.
|
||||
|
||||
The name of the upgrade must be an exact match. The :code:`upgTarget` argument is used
|
||||
for upgrades such as :code:`Reduce Minimum Security`, which applies to a specific server.
|
||||
In this case, the :code:`upgTarget` argument must be the hostname of the server.
|
||||
The name of the upgrade must be an exact match. The ``upgTarget`` argument
|
||||
is used for upgrades such as ``Reduce Minimum Security``, which applies to a
|
||||
specific server. In this case, the ``upgTarget`` argument must be the
|
||||
hostname of the server.
|
||||
|
||||
Example:
|
||||
|
||||
|
||||
@@ -6,16 +6,11 @@ upgradeCache() Netscript Function
|
||||
.. js:function:: upgradeCache(i, n)
|
||||
|
||||
:RAM cost: 0 GB
|
||||
|
||||
:param number i: Index/Identifier of Hacknet Node. :ref:`See here for details <netscript_hacknetnodeapi_referencingahacknetnode>`
|
||||
:param number i: Index of Hacknet Node. :ref:`See here for details <netscript_hacknetnodeapi_referencingahacknetnode>`
|
||||
:param number n: Number of cache levels to purchase. Must be positive. Rounded to nearest integer
|
||||
:returns: ``true`` if the upgrade was successful.
|
||||
|
||||
.. note:: This function is only applicable for Hacknet Servers (the upgraded version of
|
||||
a Hacknet Node).
|
||||
|
||||
Tries to upgrade the specified Hacknet Server's cache *n* times.
|
||||
|
||||
Returns true if it successfully upgrades the Server's cache *n* times, or if
|
||||
it purchases some positive amount and the Server reaches its max cache level.
|
||||
|
||||
Returns false otherwise.
|
||||
Tries to upgrade the specified Hacknet Server's cache ``n`` times.
|
||||
|
||||
@@ -4,13 +4,8 @@ upgradeCore() Netscript Function
|
||||
.. js:function:: upgradeCore(i, n)
|
||||
|
||||
:RAM cost: 0 GB
|
||||
|
||||
:param number i: Index/Identifier of Hacknet Node. :ref:`See here for details <netscript_hacknetnodeapi_referencingahacknetnode>`
|
||||
:param number i: Index of Hacknet Node. :ref:`See here for details <netscript_hacknetnodeapi_referencingahacknetnode>`
|
||||
:param number n: Number of cores to purchase. Must be positive. Rounded to nearest integer
|
||||
:returns: ``true`` if the upgrade was successful.
|
||||
|
||||
Tries to purchase *n* cores for the specified Hacknet Node.
|
||||
|
||||
Returns true if it successfully purchases *n* cores for the Hacknet Node or if
|
||||
it purchases some positive amount and the Node reaches its max number of cores.
|
||||
|
||||
Returns false otherwise.
|
||||
Tries to purchase ``n`` cores for the specified Hacknet Node.
|
||||
|
||||
@@ -4,13 +4,8 @@ upgradeLevel() Netscript Function
|
||||
.. js:function:: upgradeLevel(i, n)
|
||||
|
||||
:RAM cost: 0 GB
|
||||
|
||||
:param number i: Index/Identifier of Hacknet Node. :ref:`See here for details <netscript_hacknetnodeapi_referencingahacknetnode>`
|
||||
:param number i: Index of Hacknet Node. :ref:`See here for details <netscript_hacknetnodeapi_referencingahacknetnode>`
|
||||
:param number n: Number of levels to purchase. Must be positive. Rounded to nearest integer
|
||||
:returns: ``true`` if the upgrade was successful.
|
||||
|
||||
Tries to upgrade the level of the specified Hacknet Node by *n*.
|
||||
|
||||
Returns true if the Hacknet Node's level is successfully upgraded by *n* or
|
||||
if it is upgraded by some positive amount and the Node reaches its max level.
|
||||
|
||||
Returns false otherwise.
|
||||
|
||||
@@ -4,15 +4,10 @@ upgradeRam() Netscript Function
|
||||
.. js:function:: upgradeRam(i, n)
|
||||
|
||||
:RAM cost: 0 GB
|
||||
:param number i: Index of Hacknet Node. :ref:`See here for details <netscript_hacknetnodeapi_referencingahacknetnode>`
|
||||
:param number n: Number of times to upgrade RAM. Must be positive. Rounded to nearest integer.
|
||||
:returns: ``true`` if the upgrade was successful.
|
||||
|
||||
:param number i: Index/Identifier of Hacknet Node. :ref:`See here for details <netscript_hacknetnodeapi_referencingahacknetnode>`
|
||||
:param number n: Number of times to upgrade RAM. Must be positive. Rounded to nearest integer
|
||||
|
||||
Tries to upgrade the specified Hacknet Node's RAM *n* times. Note that each upgrade
|
||||
doubles the Node's RAM. So this is equivalent to multiplying the Node's RAM by
|
||||
2 :sup:`n`.
|
||||
|
||||
Returns true if the Hacknet Node's RAM is successfully upgraded *n* times or if
|
||||
it is upgraded some positive number of times and the Node reaches it max RAM.
|
||||
|
||||
Returns false otherwise.
|
||||
Tries to upgrade the specified Hacknet Node's RAM ``n`` times. Note that
|
||||
each upgrade doubles the Node's RAM. So this is equivalent to multiplying
|
||||
the Node's RAM by 2 :sup:`n`.
|
||||
|
||||
Reference in New Issue
Block a user