Merge branch 'master' of https://github.com/havocmayhem/bitburner-1 into havocmayhem-master

This commit is contained in:
danielyxie 2018-12-30 16:31:28 -08:00
commit 669477626b
3 changed files with 37 additions and 1 deletions

@ -556,6 +556,20 @@ getAugmentationsFromFaction
Returns an array containing the names (as strings) of all Augmentations that are available from the specified faction. Returns an array containing the names (as strings) of all Augmentations that are available from the specified faction.
getAugmentationPrereq
-------------------
.. js:function:: getAugmentationPrereq(augName)
:param string augName: Name of Augmentation. CASE-SENSITIVE
If you are not in BitNode-4, then you must have Level 3 of Source-File 4 in order to use this function.
This function returns an array with the names of the prerequisite Augmentation(s) for the specified Augmentation.
If there are no prerequisites, a blank array is returned.
If an invalid Augmentation name is passed in for the *augName* argument, this function will return a blank array.
getAugmentationCost getAugmentationCost
------------------- -------------------

@ -89,7 +89,7 @@ let NetscriptFunctions =
"donateToFaction|" + "donateToFaction|" +
"createProgram|commitCrime|getCrimeChance|getOwnedAugmentations|" + "createProgram|commitCrime|getCrimeChance|getOwnedAugmentations|" +
"getOwnedSourceFiles|getAugmentationsFromFaction|" + "getOwnedSourceFiles|getAugmentationsFromFaction|" +
"getAugmentationCost|purchaseAugmentation|" + "getAugmentationPrereq|getAugmentationCost|purchaseAugmentation|" +
"installAugmentations|" + "installAugmentations|" +
// TIX API // TIX API

@ -3606,6 +3606,28 @@ function NetscriptFunctions(workerScript) {
} }
return res; return res;
}, },
getAugmentationPrereq : function(name) {
var ramCost = CONSTANTS.ScriptSingularityFn3RamCost;
if (Player.bitNodeN !== 4) {ramCost *= CONSTANTS.ScriptSingularityFnRamMult;}
if (workerScript.checkingRam) {
return updateStaticRam("getAugmentationPrereq", ramCost);
}
updateDynamicRam("getAugmentationPrereq", ramCost);
if (Player.bitNodeN != 4) {
if (!(hasSingularitySF && singularitySFLvl >= 3)) {
throw makeRuntimeRejectMsg(workerScript, "Cannot run getAugmentationPrereq(). It is a Singularity Function and requires SourceFile-4 (level 3) to run.");
return false;
}
}
if (!augmentationExists(name)) {
workerScript.scriptRef.log("ERROR: getAugmentationPrereq() failed. Invalid Augmentation name passed in (note: this is case-sensitive): " + name);
return [];
}
var aug = Augmentations[name];
return aug.prereqs;
},
getAugmentationCost : function(name) { getAugmentationCost : function(name) {
var ramCost = CONSTANTS.ScriptSingularityFn3RamCost; var ramCost = CONSTANTS.ScriptSingularityFn3RamCost;
if (Player.bitNodeN !== 4) {ramCost *= CONSTANTS.ScriptSingularityFnRamMult;} if (Player.bitNodeN !== 4) {ramCost *= CONSTANTS.ScriptSingularityFnRamMult;}