hashGainRate updated to use the correct usedRam and maxRam

This commit is contained in:
Olivier Gagnon 2021-05-05 19:18:47 -04:00
parent a9cee6f907
commit 764c2533b4
2 changed files with 9 additions and 8 deletions

@ -1,11 +1,12 @@
hashGainRate() Netscript Function
==========================================
.. js:function:: hashGainRate(level, ram, core[, mult])
.. js:function:: hashGainRate(level, ramUsed, maxRam, core[, mult])
:RAM cost: 0 GB
:param number level: level of the server.
:param number ram: ram of the server.
:param number ramUsed: ram used on the server.
:param number maxRam: max ram of the server.
:param number core: cores of the server.
:returns: Money per second that a server with those stats would gain per second.
@ -18,7 +19,7 @@ hashGainRate() Netscript Function
.. code-block:: javascript
server = hacknet.getNodeStats(1);
currentRate = formulas.hacknetNodes.hashGainRate(server.level, server.ram, server.cores);
levelRate = formulas.hacknetNodes.hashGainRate(server.level+1, server.ram, server.cores);
ramRate = formulas.hacknetNodes.hashGainRate(server.level, server.ram*2, server.cores);
coresRate = formulas.hacknetNodes.hashGainRate(server.level, server.ram, server.cores+1);
currentRate = formulas.hacknetNodes.hashGainRate(server.level, 0, server.ram, server.cores);
levelRate = formulas.hacknetNodes.hashGainRate(server.level+1, 0, server.ram, server.cores);
ramRate = formulas.hacknetNodes.hashGainRate(server.level, 0, server.ram*2, server.cores);
coresRate = formulas.hacknetNodes.hashGainRate(server.level, 0, server.ram, server.cores+1);

@ -4447,9 +4447,9 @@ function NetscriptFunctions(workerScript) {
},
},
hacknetServers: {
hashGainRate: function(level, ram, cores, mult=1) {
hashGainRate: function(level, ramUsed, maxRam, cores, mult=1) {
checkFormulasAccess("hacknetServers.hashGainRate", 9);
return HScalculateHashGainRate(level, ram, cores, mult);
return HScalculateHashGainRate(level, ramUsed, maxRam, cores, mult=1);
},
levelUpgradeCost: function(startingLevel, extraLevels=1, costMult=1) {
checkFormulasAccess("hacknetServers.levelUpgradeCost", 9);