mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-17 21:23:54 +01:00
upgradeHomeCores
This commit is contained in:
parent
3f1d4875e7
commit
737d9e027f
@ -43,6 +43,7 @@ The player has access to all of these functions while in BitNode-4. Completing B
|
||||
getFactionRep() <singularityfunctions/getFactionRep>
|
||||
getFactionFavor() <singularityfunctions/getFactionFavor>
|
||||
getFactionFavorGain() <singularityfunctions/getFactionFavorGain>
|
||||
upgradeHomeCores() <singularityfunctions/upgradeHomeCores>
|
||||
|
||||
.. toctree::
|
||||
:caption: Level 3 Functions
|
||||
|
@ -0,0 +1,12 @@
|
||||
upgradeHomeRam() Netscript Function
|
||||
===================================
|
||||
|
||||
.. js:function:: upgradeHomeCores()
|
||||
|
||||
:RAM cost: 3 GB
|
||||
|
||||
If you are not in BitNode-4, then you must have Level 2 of Source-File 4 in order to use this function.
|
||||
|
||||
This function will upgrade amount of CORES on the player's home computer. The cost is the same as if you were to do it manually.
|
||||
|
||||
This function will return true if the player's home computer RAM is successfully upgraded, and false otherwise.
|
@ -3276,6 +3276,41 @@ function NetscriptFunctions(workerScript: WorkerScript): NS {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
},
|
||||
upgradeHomeCores: function (): any {
|
||||
updateDynamicRam("upgradeHomeCores", getRamCost("upgradeHomeCores"));
|
||||
checkSingularityAccess("upgradeHomeCores", 2);
|
||||
|
||||
// Check if we're at max CORES
|
||||
const homeComputer = Player.getHomeComputer();
|
||||
if (homeComputer.cpuCores >=8) {
|
||||
workerScript.log("upgradeHomeCores", `Your home computer is at max CORES.`);
|
||||
return false;
|
||||
}
|
||||
|
||||
const cost = Player.getUpgradeHomeCoresCost();
|
||||
if (Player.money.lt(cost)) {
|
||||
workerScript.log("upgradeHomeCores", `You don't have enough money. Need ${numeralWrapper.formatMoney(cost)}`);
|
||||
return false;
|
||||
}
|
||||
|
||||
homeComputer.cpuCores *= 2;
|
||||
Player.loseMoney(cost);
|
||||
|
||||
Player.gainIntelligenceExp(CONSTANTS.IntelligenceSingFnBaseExpGain);
|
||||
workerScript.log(
|
||||
"upgradeHomeCores",
|
||||
`Purchased additional CORES for home computer! It now has $(
|
||||
homeComputer.cpuCores
|
||||
)} of CORES.`,
|
||||
);
|
||||
return true;
|
||||
},
|
||||
getUpgradeHomeCoresCost: function (): any {
|
||||
updateDynamicRam("getUpgradeHomeCoresCost", getRamCost("getUpgradeHomeCoresCost"));
|
||||
checkSingularityAccess("getUpgradeHomeCoresCost", 2);
|
||||
|
||||
return Player.getUpgradeHomeCoresCost();
|
||||
},
|
||||
upgradeHomeRam: function (): any {
|
||||
updateDynamicRam("upgradeHomeRam", getRamCost("upgradeHomeRam"));
|
||||
@ -3299,9 +3334,9 @@ function NetscriptFunctions(workerScript: WorkerScript): NS {
|
||||
|
||||
Player.gainIntelligenceExp(CONSTANTS.IntelligenceSingFnBaseExpGain);
|
||||
workerScript.log(
|
||||
"upgradeHomeRam",
|
||||
`Purchased additional RAM for home computer! It now has ${numeralWrapper.formatRAM(
|
||||
homeComputer.maxRam,
|
||||
"upgradeHomeCores",
|
||||
`Purchased additional RAM for home computer! It now has ${(
|
||||
homeComputer.cpuCores
|
||||
)} of RAM.`,
|
||||
);
|
||||
return true;
|
||||
|
Loading…
Reference in New Issue
Block a user