mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-12-20 05:05:47 +01:00
Merge pull request #228 from hydroflame/ns-hacknet-multiplier
NS function to get player's hacknet multipliers
This commit is contained in:
commit
2c4c5ce6a3
@ -422,7 +422,7 @@ getHackingMultipliers
|
|||||||
.. js:function:: getHackingMultipliers()
|
.. js:function:: getHackingMultipliers()
|
||||||
|
|
||||||
Returns an object containing the Player's hacking related multipliers. These multipliers are
|
Returns an object containing the Player's hacking related multipliers. These multipliers are
|
||||||
returned in integer forms, not percentages (e.g. 1.5 instead of 150%). The object has the following structure::
|
returned in fractional forms, not percentages (e.g. 1.5 instead of 150%). The object has the following structure::
|
||||||
|
|
||||||
{
|
{
|
||||||
chance: Player's hacking chance multiplier,
|
chance: Player's hacking chance multiplier,
|
||||||
@ -437,6 +437,30 @@ getHackingMultipliers
|
|||||||
print(mults.chance);
|
print(mults.chance);
|
||||||
print(mults.growth);
|
print(mults.growth);
|
||||||
|
|
||||||
|
getHacknetMultipliers
|
||||||
|
^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
.. js:function:: getHacknetMultipliers()
|
||||||
|
|
||||||
|
Returns an object containing the Player's hacknet related multipliers. These multipliers are
|
||||||
|
returned in fractional forms, not percentages (e.g. 1.5 instead of 150%). The object has the following structure::
|
||||||
|
|
||||||
|
{
|
||||||
|
production: Player's hacknet production multiplier,
|
||||||
|
purchaseCost: Player's hacknet purchase cost multiplier,
|
||||||
|
ramCost: Player's hacknet ram cost multiplier,
|
||||||
|
coreCost: Player's hacknet core cost multiplier,
|
||||||
|
levelCost: Player's hacknet level cost multiplier
|
||||||
|
}
|
||||||
|
|
||||||
|
Example of how this can be used::
|
||||||
|
|
||||||
|
mults = getHacknetMultipliers();
|
||||||
|
print(mults.production);
|
||||||
|
print(mults.purchaseCost);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
getServerMoneyAvailable
|
getServerMoneyAvailable
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
@ -111,6 +111,29 @@ array itself.
|
|||||||
Returns the cost of upgrading the number of cores of the specified Hacknet Node. Upgrading a Node's
|
Returns the cost of upgrading the number of cores of the specified Hacknet Node. Upgrading a Node's
|
||||||
number of cores adds one additional core.
|
number of cores adds one additional core.
|
||||||
|
|
||||||
|
Utils
|
||||||
|
^^^^^
|
||||||
|
|
||||||
|
.. js:function:: getHacknetMultipliers()
|
||||||
|
|
||||||
|
Returns an object containing the Player's hacknet related multipliers. These multipliers are
|
||||||
|
returned in integer forms, not percentages (e.g. 1.5 instead of 150%). The object has the following structure::
|
||||||
|
|
||||||
|
{
|
||||||
|
production: Player's hacknet production multiplier,
|
||||||
|
purchaseCost: Player's hacknet purchase cost multiplier,
|
||||||
|
ramCost: Player's hacknet ram cost multiplier,
|
||||||
|
coreCost: Player's hacknet core cost multiplier,
|
||||||
|
levelCost: Player's hacknet level cost multiplier
|
||||||
|
}
|
||||||
|
|
||||||
|
Example of how this can be used::
|
||||||
|
|
||||||
|
mults = getHacknetMultipliers();
|
||||||
|
print(mults.production);
|
||||||
|
print(mults.purchaseCost);
|
||||||
|
|
||||||
|
|
||||||
Example(s)
|
Example(s)
|
||||||
^^^^^^^^^^
|
^^^^^^^^^^
|
||||||
|
|
||||||
|
@ -1036,6 +1036,23 @@ function NetscriptFunctions(workerScript) {
|
|||||||
growth: Player.hacking_grow_mult,
|
growth: Player.hacking_grow_mult,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
getHacknetMultipliers : function() {
|
||||||
|
if (workerScript.checkingRam) {
|
||||||
|
if (workerScript.loadedFns.getHacknetMultipliers) {
|
||||||
|
return 0;
|
||||||
|
} else {
|
||||||
|
workerScript.loadedFns.getHacknetMultipliers = true;
|
||||||
|
return CONSTANTS.ScriptGetMultipliersRamCost;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
production: Player.hacknet_node_money_mult,
|
||||||
|
purchaseCost: Player.hacknet_node_purchase_cost_mult,
|
||||||
|
ramCost: Player.hacknet_node_ram_cost_mult,
|
||||||
|
coreCost: Player.hacknet_node_core_cost_mult,
|
||||||
|
levelCost: Player.hacknet_node_level_cost_mult,
|
||||||
|
};
|
||||||
|
},
|
||||||
getBitNodeMultipliers: function() {
|
getBitNodeMultipliers: function() {
|
||||||
if (workerScript.checkingRam) {
|
if (workerScript.checkingRam) {
|
||||||
if (workerScript.loadedFns.getBitNodeMultipliers) {
|
if (workerScript.loadedFns.getBitNodeMultipliers) {
|
||||||
|
Loading…
Reference in New Issue
Block a user