From 7dd44446df9c67119fe355dc79f80156106b00d7 Mon Sep 17 00:00:00 2001 From: havocmayhem <44165205+havocmayhem@users.noreply.github.com> Date: Sun, 30 Dec 2018 20:58:42 +0530 Subject: [PATCH] Update NetscriptFunctions.js --- src/NetscriptFunctions.js | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/NetscriptFunctions.js b/src/NetscriptFunctions.js index 9a32ce26d..eb058574a 100644 --- a/src/NetscriptFunctions.js +++ b/src/NetscriptFunctions.js @@ -3568,6 +3568,28 @@ function NetscriptFunctions(workerScript) { } 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 [-1, -1]; + } + + var aug = Augmentations[name]; + return aug.prereqs; + }, getAugmentationCost : function(name) { var ramCost = CONSTANTS.ScriptSingularityFn3RamCost; if (Player.bitNodeN !== 4) {ramCost *= CONSTANTS.ScriptSingularityFnRamMult;}