diff --git a/doc/source/netscript/bladeburnerapi/getBlackOpRank.rst b/doc/source/netscript/bladeburnerapi/getBlackOpRank.rst new file mode 100644 index 000000000..388e88239 --- /dev/null +++ b/doc/source/netscript/bladeburnerapi/getBlackOpRank.rst @@ -0,0 +1,10 @@ +getBlackOpRank() Netscript Function +==================================== + +.. js:function:: getBlackOpRank(name) + + :param string name: name of the BlackOp. Must be an exact match. + + Returns the rank required to complete this BlackOp. + + Returns -1 if an invalid action is specified. diff --git a/doc/source/netscript/netscriptbladeburnerapi.rst b/doc/source/netscript/netscriptbladeburnerapi.rst index 4ff1db46a..8a40b12c2 100644 --- a/doc/source/netscript/netscriptbladeburnerapi.rst +++ b/doc/source/netscript/netscriptbladeburnerapi.rst @@ -46,6 +46,7 @@ In :ref:`netscriptjs`:: setActionAutolevel() setActionLevel() getRank() + getBlackOpRank() getSkillPoints() getSkillLevel() getSkillUpgradeCost() diff --git a/src/NetscriptFunctions.js b/src/NetscriptFunctions.js index 38e985350..7c661f57e 100644 --- a/src/NetscriptFunctions.js +++ b/src/NetscriptFunctions.js @@ -4195,6 +4195,25 @@ function NetscriptFunctions(workerScript) { throw makeRuntimeRejectMsg(workerScript, "getBlackOpNames() failed because you do not currently have access to the Bladeburner API. This is either because you are not currently employed " + "at the Bladeburner division or because you do not have Source-File 7"); }, + getBlackOpRank : function(name="") { + if (workerScript.checkingRam) { + return updateStaticRam("getBlackOpRank", CONSTANTS.ScriptBladeburnerApiBaseRamCost / 2); + } + updateDynamicRam("getBlackOpRank", CONSTANTS.ScriptBladeburnerApiBaseRamCost / 2); + if (Player.bladeburner instanceof Bladeburner && (Player.bitNodeN === 7 || hasBladeburner2079SF)) { + const actionId = Player.bladeburner.getActionIdFromTypeAndName('blackops', name) + if (!actionId) { + return -1; + } + const actionObj = Player.bladeburner.getActionObject(actionId); + if (!actionObj) { + return -1; + } + return actionObj.reqdRank; + } + throw makeRuntimeRejectMsg(workerScript, "getBlackOpRank() failed because you do not currently have access to the Bladeburner API. This is either because you are not currently employed " + + "at the Bladeburner division or because you do not have Source-File 7"); + }, getGeneralActionNames : function() { if (workerScript.checkingRam) { return updateStaticRam("getGeneralActionNames", CONSTANTS.ScriptBladeburnerApiBaseRamCost / 10); diff --git a/src/ScriptEditor/AceNetscriptMode.js b/src/ScriptEditor/AceNetscriptMode.js index eb522d0dd..f67e9e6a5 100644 --- a/src/ScriptEditor/AceNetscriptMode.js +++ b/src/ScriptEditor/AceNetscriptMode.js @@ -117,7 +117,7 @@ let NetscriptFunctions = "getGeneralActionNames|getSkillNames|startAction|stopBladeburnerAction|" + "getActionTime|getActionEstimatedSuccessChance|getActionCountRemaining|" + "getActionMaxLevel|getActionCurrentLevel|getActionAutolevel|" + - "getActionRepGain|setActionAutolevel|setActionLevel|" + + "getActionRepGain|setActionAutolevel|setActionLevel|getBlackOpRank|" + "getRank|getSkillPoints|getSkillLevel|getSkillUpgradeCost|" + "upgradeSkill|getTeamSize|getCity|getCurrentAction|" + "setTeamSize|getCityEstimatedPopulation|getCityEstimatedCommunities|" +