Added documentation for Bladeburner API. Fixed typo in BN-7 description.

This commit is contained in:
danielyxie 2018-06-25 14:07:03 -05:00
parent 0b16a9f605
commit 75ff10b5c2
21 changed files with 1801 additions and 44 deletions

37
dist/engine.bundle.js vendored

@ -12181,7 +12181,7 @@ function initBitNodes() {
"Corporations have 80% lower valuations and are therefore less profitable<br>" +
"Working for companies is 50% less profitable<br>" +
"Crimes and Infiltration are 50% less profitable<br><br>" +
"Destroying this BitNode will give you Source-File 6, or if you already have this Source-File it will upgrade " +
"Destroying this BitNode will give you Source-File 7, or if you already have this Source-File it will upgrade " +
"its level up to a maximum of 3. This Source-File allows you to access the Bladeburner Netscript API in other " +
"BitNodes. In addition, this Source-File will increase all of your Bladeburner multipliers by:<br><br>" +
"Level 1: 8%<br>" +
@ -29173,6 +29173,7 @@ Bladeburner.prototype.getActionIdFromTypeAndName = function(type="", name="") {
switch (convertedType) {
case "contract":
case "contracts":
case "contr":
action.type = ActionTypes["Contract"];
if (this.contracts.hasOwnProperty(name)) {
action.name = name;
@ -29233,23 +29234,23 @@ Bladeburner.prototype.getActionIdFromTypeAndName = function(type="", name="") {
}
}
Bladeburner.prototype.getContractNamesNetscriptFn = function(name) {
Bladeburner.prototype.getContractNamesNetscriptFn = function() {
return Object.keys(this.contracts);
}
Bladeburner.prototype.getOperationNamesNetscriptFn = function(name) {
Bladeburner.prototype.getOperationNamesNetscriptFn = function() {
return Object.keys(this.operations);
}
Bladeburner.prototype.getBlackOpNamesNetscriptFn = function(name) {
Bladeburner.prototype.getBlackOpNamesNetscriptFn = function() {
return Object.keys(BlackOperations);
}
Bladeburner.prototype.getGeneralActionNamesNetscriptFn = function(name) {
Bladeburner.prototype.getGeneralActionNamesNetscriptFn = function() {
return Object.keys(GeneralActions);
}
Bladeburner.prototype.getSkillNamesNetscriptFn = function(name) {
Bladeburner.prototype.getSkillNamesNetscriptFn = function() {
return Object.keys(Skills);
}
@ -29474,8 +29475,8 @@ Bladeburner.prototype.setTeamSizeNetscriptFn = function(type, name, size, worker
return -1;
}
if (actionId.type !== ActionTypes["Operation"] ||
actionId.type !== ActionTypes["BlackOp"] ||
if (actionId.type !== ActionTypes["Operation"] &&
actionId.type !== ActionTypes["BlackOp"] &&
actionId.type !== ActionTypes["BlackOperation"]) {
workerScript.log("ERROR: Bladeburner.setTeamSize() failed. This function " +
"only works for Operations and BlackOps");
@ -33907,57 +33908,57 @@ function NetscriptFunctions(workerScript) {
//Bladeburner API
bladeburner : {
getContractNames : function(name) {
getContractNames : function() {
if (workerScript.checkingRam) {
return updateStaticRam("getContractNames", _Constants_js__WEBPACK_IMPORTED_MODULE_6__["CONSTANTS"].ScriptBladeburnerApiBaseRamCost / 10);
}
updateDynamicRam("getContractNames", _Constants_js__WEBPACK_IMPORTED_MODULE_6__["CONSTANTS"].ScriptBladeburnerApiBaseRamCost / 10);
if (_Player_js__WEBPACK_IMPORTED_MODULE_16__["Player"].bladeburner instanceof _Bladeburner_js__WEBPACK_IMPORTED_MODULE_4__["Bladeburner"] && (_Player_js__WEBPACK_IMPORTED_MODULE_16__["Player"].bitNodeN === 7 || hasBladeburner2079SF)) {
return _Player_js__WEBPACK_IMPORTED_MODULE_16__["Player"].bladeburner.getContractNamesNetscriptFn(name);
return _Player_js__WEBPACK_IMPORTED_MODULE_16__["Player"].bladeburner.getContractNamesNetscriptFn();
}
throw Object(_NetscriptEvaluator_js__WEBPACK_IMPORTED_MODULE_25__["makeRuntimeRejectMsg"])(workerScript, "getContractNames() 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");
},
getOperationNames : function(name) {
getOperationNames : function() {
if (workerScript.checkingRam) {
return updateStaticRam("getOperationNames", _Constants_js__WEBPACK_IMPORTED_MODULE_6__["CONSTANTS"].ScriptBladeburnerApiBaseRamCost / 10);
}
updateDynamicRam("getOperationNames", _Constants_js__WEBPACK_IMPORTED_MODULE_6__["CONSTANTS"].ScriptBladeburnerApiBaseRamCost / 10);
if (_Player_js__WEBPACK_IMPORTED_MODULE_16__["Player"].bladeburner instanceof _Bladeburner_js__WEBPACK_IMPORTED_MODULE_4__["Bladeburner"] && (_Player_js__WEBPACK_IMPORTED_MODULE_16__["Player"].bitNodeN === 7 || hasBladeburner2079SF)) {
return _Player_js__WEBPACK_IMPORTED_MODULE_16__["Player"].bladeburner.getOperationNamesNetscriptFn(name);
return _Player_js__WEBPACK_IMPORTED_MODULE_16__["Player"].bladeburner.getOperationNamesNetscriptFn();
}
throw Object(_NetscriptEvaluator_js__WEBPACK_IMPORTED_MODULE_25__["makeRuntimeRejectMsg"])(workerScript, "getOperationNames() 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");
},
getBlackOpNames : function(name) {
getBlackOpNames : function() {
if (workerScript.checkingRam) {
return updateStaticRam("getBlackOpNames", _Constants_js__WEBPACK_IMPORTED_MODULE_6__["CONSTANTS"].ScriptBladeburnerApiBaseRamCost / 10);
}
updateDynamicRam("getBlackOpNames", _Constants_js__WEBPACK_IMPORTED_MODULE_6__["CONSTANTS"].ScriptBladeburnerApiBaseRamCost / 10);
if (_Player_js__WEBPACK_IMPORTED_MODULE_16__["Player"].bladeburner instanceof _Bladeburner_js__WEBPACK_IMPORTED_MODULE_4__["Bladeburner"] && (_Player_js__WEBPACK_IMPORTED_MODULE_16__["Player"].bitNodeN === 7 || hasBladeburner2079SF)) {
return _Player_js__WEBPACK_IMPORTED_MODULE_16__["Player"].bladeburner.getBlackOpNamesNetscriptFn(name);
return _Player_js__WEBPACK_IMPORTED_MODULE_16__["Player"].bladeburner.getBlackOpNamesNetscriptFn();
}
throw Object(_NetscriptEvaluator_js__WEBPACK_IMPORTED_MODULE_25__["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");
},
getGeneralActionNames : function(name) {
getGeneralActionNames : function() {
if (workerScript.checkingRam) {
return updateStaticRam("getGeneralActionNames", _Constants_js__WEBPACK_IMPORTED_MODULE_6__["CONSTANTS"].ScriptBladeburnerApiBaseRamCost / 10);
}
updateDynamicRam("getGeneralActionNames", _Constants_js__WEBPACK_IMPORTED_MODULE_6__["CONSTANTS"].ScriptBladeburnerApiBaseRamCost / 10);
if (_Player_js__WEBPACK_IMPORTED_MODULE_16__["Player"].bladeburner instanceof _Bladeburner_js__WEBPACK_IMPORTED_MODULE_4__["Bladeburner"] && (_Player_js__WEBPACK_IMPORTED_MODULE_16__["Player"].bitNodeN === 7 || hasBladeburner2079SF)) {
return _Player_js__WEBPACK_IMPORTED_MODULE_16__["Player"].bladeburner.getGeneralActionNamesNetscriptFn(name);
return _Player_js__WEBPACK_IMPORTED_MODULE_16__["Player"].bladeburner.getGeneralActionNamesNetscriptFn();
}
throw Object(_NetscriptEvaluator_js__WEBPACK_IMPORTED_MODULE_25__["makeRuntimeRejectMsg"])(workerScript, "getGeneralActionNames() 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");
},
getSkillNames : function(name) {
getSkillNames : function() {
if (workerScript.checkingRam) {
return updateStaticRam("getSkillNames", _Constants_js__WEBPACK_IMPORTED_MODULE_6__["CONSTANTS"].ScriptBladeburnerApiBaseRamCost / 10);
}
updateDynamicRam("getSkillNames", _Constants_js__WEBPACK_IMPORTED_MODULE_6__["CONSTANTS"].ScriptBladeburnerApiBaseRamCost / 10);
if (_Player_js__WEBPACK_IMPORTED_MODULE_16__["Player"].bladeburner instanceof _Bladeburner_js__WEBPACK_IMPORTED_MODULE_4__["Bladeburner"] && (_Player_js__WEBPACK_IMPORTED_MODULE_16__["Player"].bitNodeN === 7 || hasBladeburner2079SF)) {
return _Player_js__WEBPACK_IMPORTED_MODULE_16__["Player"].bladeburner.getSkillNamesNetscriptFn(name);
return _Player_js__WEBPACK_IMPORTED_MODULE_16__["Player"].bladeburner.getSkillNamesNetscriptFn();
}
throw Object(_NetscriptEvaluator_js__WEBPACK_IMPORTED_MODULE_25__["makeRuntimeRejectMsg"])(workerScript, "getSkillNames() 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");

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

@ -24,4 +24,5 @@ to reach out to the developer!
Hacknet Node API <netscripthacknetnodeapi>
Trade Information eXchange (TIX) API <netscriptixapi>
Singularity Functions <netscriptsingularityfunctions>
Bladeburner API <netscriptbladeburnerapi>
Miscellaneous <netscriptmisc>

@ -0,0 +1,446 @@
Netscript Bladeburner API
=========================
Netscript provides the following API for interacting with the game's Bladeburner mechanic.
The Bladeburner API is **not** immediately available to the palyer and must be unlocked
later in the game
**WARNING: This page contains spoilers for the game**
The Bladeburner API is unlocked in BitNode-7. If you are in BitNode-7, you will
automatically gain access to this API. Otherwise, you must have Source-File 7 in
order to use this API in other BitNodes
**Bladeburner API functions must be accessed through the bladeburner namespace**
In Netscript 1.0::
bladeburner.getContractNames();
bladeburner.startAction("general", "Training");
In :ref:`netscriptjs`::
ns.bladeburner.getContractNames();
ns.bladeburner.startAction("general", "Training");
.. _bladeburner_action_types:
Bladeburner Action Types
------------------------
Several functions in the Bladeburner API require you to specify an action using
its type and name. The following are valid values when specifying the action's type:
**Contracts**
* contract
* contracts
* contr
**Operations**
* operation
* operations
* op
* ops
**Black Ops**
* blackoperation
* black operation
* black operations
* black op
* black ops
* blackop
* blackops
**General Actions (Training, Field Analysis, Recruitment)**
* general
* general action
* gen
getContractNames
----------------
.. js:function:: getContractNames()
Returns an array of strings containing the names of all Bladeburner contracts
getOperationNames
-----------------
.. js:function:: getOperationNames()
Returns an array of strings containing the names of all Bladeburner operations
getBlackOpNames
---------------
.. js:function:: getBlackOpNames()
Returns an array of strings containing the names of all Bladeburner Black Ops
getGeneralActionNames
---------------------
.. js:function:: getGeneralActionNames()
Returns an array of strings containing the names of all general Bladeburner actions
getSkillNames
-------------
.. js:function:: getSkillNames()
Returns an array of strings containing the names of all Bladeburner skills
startAction
-----------
.. js:function:: startAction(type, name)
:param string type: Type of action. See :ref:`bladeburner_action_types`
:param string name: Name of action. Must be an exact match
Attempts to start the specified Bladeburner action. Returns true if the action
was started successfully, and false otherwise.
stopBladeburnerAction
---------------------
.. js:function:: stopBladeburnerAction()
Stops the current Bladeburner action
getActionTime
-------------
.. js:function:: getActionTime(type, name)
:param string type: Type of action. See :ref:`bladeburner_action_types`
:param string name: Name of action. Must be an exact match
Returns the number of seconds it takes to complete the specified action
getActionEstimatedSuccessChance
-------------------------------
.. js:function:: getActionEstimatedSuccessChance(type, name)
:param string type: Type of action. See :ref:`bladeburner_action_types`
:param string name: Name of action. Must be an exact match
Returns the estimated success chance for the specified action
getActionCountRemaining
-----------------------
.. js:function:: getActionCountRemaining(type, name)
:param string type: Type of action. See :ref:`bladeburner_action_types`
:param string name: Name of action. Must be an exact match
Returns the remaining count of the specified action.
Note that this is meant to be used for Contracts and Operations.
This function will return 'Infinity' for actions such as Training and Field Analysis.
getRank
-------
.. js:function:: getRank()
Returns the player's Bladeburner Rank
getSkillPoints
--------------
.. js:function:: getSkillPoints()
Returns the number of Bladeburner skill points you have
getSkillLevel
-------------
.. js:function:: getSkillLevel(skillName="")
:param string skillName: Optional name of Skill. Empty string by default
If no argument or an empty string is passed in, this function returns
an object with your level for all Bladeburner Skills (only for skills that
have at least one level). In the object, the name of the Bladeburner Skills
are the keys and your skill levels are the values. For example::
{
"Blade's Intuition": 10,
"Cloak": 5,
"Evasive System": 6
}
If the name of a skill is passed in as an argument, then this function
returns your level in the specified skill.
The function returns -1 if an invalid skill name is passed in
upgradeSkill
------------
.. js:function:: upgradeSkill(skillName)
:param string skillName: Name of Skill to be upgraded. Must be an exact match
Attempts to upgrade the specified Bladeburner skill. Returns true if the
skill is successfully upgraded, and false otherwise
getTeamSize
-----------
.. js:function:: getTeamSize(type, name)
:param string type: Type of action. See :ref:`bladeburner_action_types`
:param string name: Name of action. Must be an exact match
Returns the number of Bladeburner team members you have assigned to the
specified action.
Setting a team is only applicable for Operations and BlackOps. This function
will return 0 for other action types.
setTeamSize
-----------
.. js:function:: setTeamSize(type, name, size)
:param string type: Type of action. See :ref:`bladeburner_action_types`
:param string name: Name of action. Must be an exact match
:param int size: Number of team members to set. Will be converted using Math.round()
Set the team size for the specified Bladeburner action.
Returns the team size that was set, or -1 if the function failed.
getCityEstimatedPopulation
--------------------------
.. js:function:: getCityEstimatedPopulation(cityName)
:param string cityName: Name of city. Case-sensitive
Returns the estimated number of Synthoids in the specified city, or -1
if an invalid city was specified.
getCityEstimatedCommunities
---------------------------
.. js:function:: getCityEstimatedCommunities(cityName)
:param string cityName: Name of city. Case-sensitive
Returns the estimated number of Synthoid communities in the specified city,
or -1 if an invalid city was specified.
getCityChaos
------------
.. js:function:: getCityChaos(cityName)
:param string cityName: Name of city. Case-sensitive
Returns the chaos in the specified city, or -1 if an invalid city was specified
switchCity
----------
.. js:function:: switchCity(cityName)
:param string cityName: Name of city
Attempts to switch to the specified city (for Bladeburner only).
Returns true if successful, and false otherwise
getStamina
----------
.. js:function:: getStamina()
Returns an array with two elements:
[Current stamina, Max stamina]
Example usage::
function getStaminaPercentage() {
let res = bladeburner.getStamina();
return res[0] / res[1];
}
joinBladeburnerFaction
----------------------
.. js:function:: joinBladeburnerFaction()
Attempts to join the Bladeburner faction.
Returns true if you successfully join the Bladeburner faction, or if
you are already a member.
Returns false otherwise.
Examples
--------
**Basic example usage**::
tprint(bladeburner.getContractNames());
tprint(bladeburner.getOperationNames());
tprint(bladeburner.getBlackOpNames());
tprint(bladeburner.getGeneralActionNames());
tprint(bladeburner.getSkillNames());
tprint(bladeburner.getActionTime("contract", "Tracking"));
tprint("Rank: " + bladeburner.getRank());
tprint("Skill Points: " + bladeburner.getSkillPoints());
tprint("Cloak Skill Level: " + bladeburner.getSkillLevel("Cloak"));
tprint("Trying to upgradeSkill: " + bladeburner.upgradeSkill("Cloak"));
tprint("Skill Points remaining: " + bladeburner.getSkillPoints());
tprint("Trying to switch to a nonexistent city: " + bladeburner.switchCity("lskgns"));
var chongqing = "Chongqing";
tprint("Trying to switch to Chongqing: " + bladeburner.switchCity(chongqing));
tprint("Chongqing chaos: " + bladeburner.getCityChaos(chongqing));
tprint("Chongqing estimated pop: " + bladeburner.getCityEstimatedPopulation(chongqing));
tprint("Chonqging estimated communities: " + bladeburner.getCityEstimatedCommunities(chongqing));
**Bladeburner handler example**. Note that this avoids the need of using the *bladeburner* namespace
identifier by attaching the Bladeburner API functions to an object::
const FIELD_ANALYSIS_INTERVAL = 10; //Number of minutes between field analysis states
const FIELD_ANALYSIS_DURATION = 5; //Duration in minutes
function BladeburnerHandler(ns, params) {
//Netscript environment becomes part of the instance
this.ns = ns;
//Netscript bladeburner API becomes part of this instance
for (var bladeburnerFn in ns.bladeburner) {
this[bladeburnerFn] = ns.bladeburner[bladeburnerFn];
}
this.fieldAnalysis = {
inProgress: params.startFieldAnalysis ? true : false,
cyclesRemaining: FIELD_ANALYSIS_DURATION,
cyclesSince: FIELD_ANALYSIS_INTERVAL
}
}
BladeburnerHandler.prototype.getStaminaPercentage = function() {
var res = this.getStamina();
return 100 * (res[0] / res[1]);
}
BladeburnerHandler.prototype.hasSimulacrum = function() {
var augs = this.ns.getOwnedAugmentations();
return augs.includes("The Blade's Simulacrum");
}
BladeburnerHandler.prototype.handle = function() {
//If we're doing something else manually (without Simlacrum),
//it overrides Bladeburner stuff
if (!this.hasSimulacrum() && this.ns.isBusy()) {
this.ns.print("Idling bc player is busy with some other action");
return;
}
if (this.fieldAnalysis.inProgress) {
--(this.fieldAnalysis.cyclesRemaining);
if (this.fieldAnalysis.cyclesRemaining < 0) {
this.fieldAnalysis.inProgress = false;
this.fieldAnalysis.cyclesSince = 0;
return this.handle();
} else {
this.startAction("general", "Field Analysis");
this.ns.print("handler is doing field analyis for " +
(this.fieldAnalysis.cyclesRemaining+1) + " more mins");
return;
}
} else {
++(this.fieldAnalysis.cyclesSince);
if (this.fieldAnalysis.cyclesSince > FIELD_ANALYSIS_INTERVAL) {
this.fieldAnalysis.inProgress = true;
this.fieldAnalysis.cyclesRemaining = FIELD_ANALYSIS_DURATION;
return this.handle();
}
}
this.stopBladeburnerAction();
var staminaPerc = this.getStaminaPercentage();
if (staminaPerc < 55) {
this.ns.print("handler is starting training due to low stamina percentage");
this.startAction("general", "Training");
} else {
var action = this.chooseAction();
this.ns.print("handler chose " + action.name + " " + action.type + " through chooseAction()");
this.startAction(action.type, action.name);
}
}
BladeburnerHandler.prototype.chooseAction = function() {
//Array of all Operations
var ops = this.getOperationNames();
//Sort Operations in order of increasing success chance
ops.sort((a, b)=>{
return this.getActionEstimatedSuccessChance("operation", a) -
this.getActionEstimatedSuccessChance("operation", b);
});
//Loop through until you find one with 99+% success chance
for (let i = 0; i < ops.length; ++i) {
let successChance = this.getActionEstimatedSuccessChance("operation", ops[i]);
let count = this.getActionCountRemaining("operation", ops[i]);
if (successChance >= 0.99 && count > 10) {
return {type: "operation", name: ops[i]};
}
}
//Repeat for Contracts
var contracts = this.getContractNames();
contracts.sort((a, b)=>{
return this.getActionEstimatedSuccessChance("contract", a) -
this.getActionEstimatedSuccessChance("contract", b);
});
for (let i = 0; i < contracts.length; ++i) {
let successChance = this.getActionEstimatedSuccessChance("contract", contracts[i]);
let count = this.getActionCountRemaining("contract", contracts[i]);
if (successChance >= 0.80 && count > 10) {
return {type: "contract", name: contracts[i]};
}
}
return {type:"general", name:"Training"};
}
BladeburnerHandler.prototype.process = async function() {
this.handle();
await this.ns.sleep(60000);
}
export async function main(ns) {
ns.disableLog("sleep");
//Check if Bladeburner is available. This'll throw a runtime error if it's not
ns.bladeburner.getContractNames();
var startFieldAnalysis = true;
if (ns.args.length >= 1 && ns.args[0] == "false") {
startFieldAnalysis = false;
}
var handler = new BladeburnerHandler(ns, {
startFieldAnalysis: startFieldAnalysis
});
while(true) {
await handler.process();
}
}

@ -942,7 +942,11 @@ prompt
Defining your own Functions
---------------------------
You can define your own functions in Netscript using the following syntax::
Note that the following information is only applicable for Netscript 1.0.
:doc:`netscriptjs` allows you to define your functions using native Javascript
techniques.
You can define your own functions in Netscript 1.0 using the following syntax::
function name(args...) {
function code here...

@ -153,21 +153,39 @@
<h2 id="G">G</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="netscriptbladeburnerapi.html#getActionCountRemaining">getActionCountRemaining() (built-in function)</a>
</li>
<li><a href="netscriptbladeburnerapi.html#getActionEstimatedSuccessChance">getActionEstimatedSuccessChance() (built-in function)</a>
</li>
<li><a href="netscriptbladeburnerapi.html#getActionTime">getActionTime() (built-in function)</a>
</li>
<li><a href="netscriptsingularityfunctions.html#getAugmentationCost">getAugmentationCost() (built-in function)</a>
</li>
<li><a href="netscriptsingularityfunctions.html#getAugmentationsFromFaction">getAugmentationsFromFaction() (built-in function)</a>
</li>
<li><a href="netscriptadvancedfunctions.html#getBitNodeMultipliers">getBitNodeMultipliers() (built-in function)</a>
</li>
<li><a href="netscriptbladeburnerapi.html#getBlackOpNames">getBlackOpNames() (built-in function)</a>
</li>
<li><a href="netscriptbladeburnerapi.html#getCityChaos">getCityChaos() (built-in function)</a>
</li>
<li><a href="netscriptbladeburnerapi.html#getCityEstimatedCommunities">getCityEstimatedCommunities() (built-in function)</a>
</li>
<li><a href="netscriptbladeburnerapi.html#getCityEstimatedPopulation">getCityEstimatedPopulation() (built-in function)</a>
</li>
<li><a href="netscriptsingularityfunctions.html#getCompanyFavor">getCompanyFavor() (built-in function)</a>
</li>
<li><a href="netscriptsingularityfunctions.html#getCompanyRep">getCompanyRep() (built-in function)</a>
</li>
<li><a href="netscriptbladeburnerapi.html#getContractNames">getContractNames() (built-in function)</a>
</li>
<li><a href="netscriptsingularityfunctions.html#getCrimeChance">getCrimeChance() (built-in function)</a>
</li>
<li><a href="netscriptsingularityfunctions.html#getFactionFavor">getFactionFavor() (built-in function)</a>
</li>
<li><a href="netscriptsingularityfunctions.html#getFactionRep">getFactionRep() (built-in function)</a>
</li>
<li><a href="netscriptbladeburnerapi.html#getGeneralActionNames">getGeneralActionNames() (built-in function)</a>
</li>
<li><a href="netscriptfunctions.html#getGrowTime">getGrowTime() (built-in function)</a>
</li>
@ -182,17 +200,21 @@
<li><a href="netscriptfunctions.html#getHostname">getHostname() (built-in function)</a>
</li>
<li><a href="netscriptfunctions.html#getNextHacknetNodeCost">getNextHacknetNodeCost() (built-in function)</a>, <a href="netscripthacknetnodeapi.html#getNextHacknetNodeCost">[1]</a>
</li>
<li><a href="netscriptbladeburnerapi.html#getOperationNames">getOperationNames() (built-in function)</a>
</li>
<li><a href="netscriptsingularityfunctions.html#getOwnedAugmentations">getOwnedAugmentations() (built-in function)</a>
</li>
<li><a href="netscriptfunctions.html#getPurchasedServers">getPurchasedServers() (built-in function)</a>
</li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="netscriptbladeburnerapi.html#getRank">getRank() (built-in function)</a>
</li>
<li><a href="netscriptfunctions.html#getScriptExpGain">getScriptExpGain() (built-in function)</a>
</li>
<li><a href="netscriptfunctions.html#getScriptIncome">getScriptIncome() (built-in function)</a>
</li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="netscriptfunctions.html#getScriptName">getScriptName() (built-in function)</a>
</li>
<li><a href="netscriptfunctions.html#getScriptRam">getScriptRam() (built-in function)</a>
@ -214,12 +236,22 @@
<li><a href="netscriptfunctions.html#getServerRequiredHackingLevel">getServerRequiredHackingLevel() (built-in function)</a>
</li>
<li><a href="netscriptfunctions.html#getServerSecurityLevel">getServerSecurityLevel() (built-in function)</a>
</li>
<li><a href="netscriptbladeburnerapi.html#getSkillLevel">getSkillLevel() (built-in function)</a>
</li>
<li><a href="netscriptbladeburnerapi.html#getSkillNames">getSkillNames() (built-in function)</a>
</li>
<li><a href="netscriptbladeburnerapi.html#getSkillPoints">getSkillPoints() (built-in function)</a>
</li>
<li><a href="netscriptbladeburnerapi.html#getStamina">getStamina() (built-in function)</a>
</li>
<li><a href="netscriptsingularityfunctions.html#getStats">getStats() (built-in function)</a>
</li>
<li><a href="netscriptixapi.html#getStockPosition">getStockPosition() (built-in function)</a>
</li>
<li><a href="netscriptixapi.html#getStockPrice">getStockPrice() (built-in function)</a>
</li>
<li><a href="netscriptbladeburnerapi.html#getTeamSize">getTeamSize() (built-in function)</a>
</li>
<li><a href="netscriptfunctions.html#getTimeSinceLastAug">getTimeSinceLastAug() (built-in function)</a>
</li>
@ -278,6 +310,10 @@
<h2 id="J">J</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="netscriptbladeburnerapi.html#joinBladeburnerFaction">joinBladeburnerFaction() (built-in function)</a>
</li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="netscriptsingularityfunctions.html#joinFaction">joinFaction() (built-in function)</a>
</li>
@ -375,10 +411,12 @@
</li>
<li><a href="netscriptixapi.html#sellStock">sellStock() (built-in function)</a>
</li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="netscriptfunctions.html#serverExists">serverExists() (built-in function)</a>
</li>
<li><a href="netscriptbladeburnerapi.html#setTeamSize">setTeamSize() (built-in function)</a>
</li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="netscriptixapi.html#shortStock">shortStock() (built-in function)</a>
</li>
<li><a href="netscriptfunctions.html#sleep">sleep() (built-in function)</a>
@ -388,8 +426,14 @@
<li><a href="netscriptfunctions.html#sprintf">sprintf() (built-in function)</a>
</li>
<li><a href="netscriptfunctions.html#sqlinject">sqlinject() (built-in function)</a>
</li>
<li><a href="netscriptbladeburnerapi.html#startAction">startAction() (built-in function)</a>
</li>
<li><a href="netscriptsingularityfunctions.html#stopAction">stopAction() (built-in function)</a>
</li>
<li><a href="netscriptbladeburnerapi.html#stopBladeburnerAction">stopBladeburnerAction() (built-in function)</a>
</li>
<li><a href="netscriptbladeburnerapi.html#switchCity">switchCity() (built-in function)</a>
</li>
</ul></td>
</tr></table>
@ -414,6 +458,8 @@
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="netscriptsingularityfunctions.html#upgradeHomeRam">upgradeHomeRam() (built-in function)</a>
</li>
<li><a href="netscriptbladeburnerapi.html#upgradeSkill">upgradeSkill() (built-in function)</a>
</li>
</ul></td>
</tr></table>

@ -211,6 +211,33 @@ secrets that you've been searching for.</p>
<li class="toctree-l3"><a class="reference internal" href="netscriptsingularityfunctions.html#installaugmentations">installAugmentations</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="netscriptbladeburnerapi.html"> Bladeburner API</a><ul>
<li class="toctree-l3"><a class="reference internal" href="netscriptbladeburnerapi.html#bladeburner-action-types">Bladeburner Action Types</a></li>
<li class="toctree-l3"><a class="reference internal" href="netscriptbladeburnerapi.html#getcontractnames">getContractNames</a></li>
<li class="toctree-l3"><a class="reference internal" href="netscriptbladeburnerapi.html#getoperationnames">getOperationNames</a></li>
<li class="toctree-l3"><a class="reference internal" href="netscriptbladeburnerapi.html#getblackopnames">getBlackOpNames</a></li>
<li class="toctree-l3"><a class="reference internal" href="netscriptbladeburnerapi.html#getgeneralactionnames">getGeneralActionNames</a></li>
<li class="toctree-l3"><a class="reference internal" href="netscriptbladeburnerapi.html#getskillnames">getSkillNames</a></li>
<li class="toctree-l3"><a class="reference internal" href="netscriptbladeburnerapi.html#startaction">startAction</a></li>
<li class="toctree-l3"><a class="reference internal" href="netscriptbladeburnerapi.html#stopbladeburneraction">stopBladeburnerAction</a></li>
<li class="toctree-l3"><a class="reference internal" href="netscriptbladeburnerapi.html#getactiontime">getActionTime</a></li>
<li class="toctree-l3"><a class="reference internal" href="netscriptbladeburnerapi.html#getactionestimatedsuccesschance">getActionEstimatedSuccessChance</a></li>
<li class="toctree-l3"><a class="reference internal" href="netscriptbladeburnerapi.html#getactioncountremaining">getActionCountRemaining</a></li>
<li class="toctree-l3"><a class="reference internal" href="netscriptbladeburnerapi.html#getrank">getRank</a></li>
<li class="toctree-l3"><a class="reference internal" href="netscriptbladeburnerapi.html#getskillpoints">getSkillPoints</a></li>
<li class="toctree-l3"><a class="reference internal" href="netscriptbladeburnerapi.html#getskilllevel">getSkillLevel</a></li>
<li class="toctree-l3"><a class="reference internal" href="netscriptbladeburnerapi.html#upgradeskill">upgradeSkill</a></li>
<li class="toctree-l3"><a class="reference internal" href="netscriptbladeburnerapi.html#getteamsize">getTeamSize</a></li>
<li class="toctree-l3"><a class="reference internal" href="netscriptbladeburnerapi.html#setteamsize">setTeamSize</a></li>
<li class="toctree-l3"><a class="reference internal" href="netscriptbladeburnerapi.html#getcityestimatedpopulation">getCityEstimatedPopulation</a></li>
<li class="toctree-l3"><a class="reference internal" href="netscriptbladeburnerapi.html#getcityestimatedcommunities">getCityEstimatedCommunities</a></li>
<li class="toctree-l3"><a class="reference internal" href="netscriptbladeburnerapi.html#getcitychaos">getCityChaos</a></li>
<li class="toctree-l3"><a class="reference internal" href="netscriptbladeburnerapi.html#switchcity">switchCity</a></li>
<li class="toctree-l3"><a class="reference internal" href="netscriptbladeburnerapi.html#getstamina">getStamina</a></li>
<li class="toctree-l3"><a class="reference internal" href="netscriptbladeburnerapi.html#joinbladeburnerfaction">joinBladeburnerFaction</a></li>
<li class="toctree-l3"><a class="reference internal" href="netscriptbladeburnerapi.html#examples">Examples</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="netscriptmisc.html"> Miscellaneous</a><ul>
<li class="toctree-l3"><a class="reference internal" href="netscriptmisc.html#netscript-ports">Netscript Ports</a></li>
<li class="toctree-l3"><a class="reference internal" href="netscriptmisc.html#comments">Comments</a></li>

@ -212,6 +212,33 @@ to reach out to the developer!</p>
<li class="toctree-l2"><a class="reference internal" href="netscriptsingularityfunctions.html#installaugmentations">installAugmentations</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="netscriptbladeburnerapi.html"> Bladeburner API</a><ul>
<li class="toctree-l2"><a class="reference internal" href="netscriptbladeburnerapi.html#bladeburner-action-types">Bladeburner Action Types</a></li>
<li class="toctree-l2"><a class="reference internal" href="netscriptbladeburnerapi.html#getcontractnames">getContractNames</a></li>
<li class="toctree-l2"><a class="reference internal" href="netscriptbladeburnerapi.html#getoperationnames">getOperationNames</a></li>
<li class="toctree-l2"><a class="reference internal" href="netscriptbladeburnerapi.html#getblackopnames">getBlackOpNames</a></li>
<li class="toctree-l2"><a class="reference internal" href="netscriptbladeburnerapi.html#getgeneralactionnames">getGeneralActionNames</a></li>
<li class="toctree-l2"><a class="reference internal" href="netscriptbladeburnerapi.html#getskillnames">getSkillNames</a></li>
<li class="toctree-l2"><a class="reference internal" href="netscriptbladeburnerapi.html#startaction">startAction</a></li>
<li class="toctree-l2"><a class="reference internal" href="netscriptbladeburnerapi.html#stopbladeburneraction">stopBladeburnerAction</a></li>
<li class="toctree-l2"><a class="reference internal" href="netscriptbladeburnerapi.html#getactiontime">getActionTime</a></li>
<li class="toctree-l2"><a class="reference internal" href="netscriptbladeburnerapi.html#getactionestimatedsuccesschance">getActionEstimatedSuccessChance</a></li>
<li class="toctree-l2"><a class="reference internal" href="netscriptbladeburnerapi.html#getactioncountremaining">getActionCountRemaining</a></li>
<li class="toctree-l2"><a class="reference internal" href="netscriptbladeburnerapi.html#getrank">getRank</a></li>
<li class="toctree-l2"><a class="reference internal" href="netscriptbladeburnerapi.html#getskillpoints">getSkillPoints</a></li>
<li class="toctree-l2"><a class="reference internal" href="netscriptbladeburnerapi.html#getskilllevel">getSkillLevel</a></li>
<li class="toctree-l2"><a class="reference internal" href="netscriptbladeburnerapi.html#upgradeskill">upgradeSkill</a></li>
<li class="toctree-l2"><a class="reference internal" href="netscriptbladeburnerapi.html#getteamsize">getTeamSize</a></li>
<li class="toctree-l2"><a class="reference internal" href="netscriptbladeburnerapi.html#setteamsize">setTeamSize</a></li>
<li class="toctree-l2"><a class="reference internal" href="netscriptbladeburnerapi.html#getcityestimatedpopulation">getCityEstimatedPopulation</a></li>
<li class="toctree-l2"><a class="reference internal" href="netscriptbladeburnerapi.html#getcityestimatedcommunities">getCityEstimatedCommunities</a></li>
<li class="toctree-l2"><a class="reference internal" href="netscriptbladeburnerapi.html#getcitychaos">getCityChaos</a></li>
<li class="toctree-l2"><a class="reference internal" href="netscriptbladeburnerapi.html#switchcity">switchCity</a></li>
<li class="toctree-l2"><a class="reference internal" href="netscriptbladeburnerapi.html#getstamina">getStamina</a></li>
<li class="toctree-l2"><a class="reference internal" href="netscriptbladeburnerapi.html#joinbladeburnerfaction">joinBladeburnerFaction</a></li>
<li class="toctree-l2"><a class="reference internal" href="netscriptbladeburnerapi.html#examples">Examples</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="netscriptmisc.html"> Miscellaneous</a><ul>
<li class="toctree-l2"><a class="reference internal" href="netscriptmisc.html#netscript-ports">Netscript Ports</a></li>
<li class="toctree-l2"><a class="reference internal" href="netscriptmisc.html#comments">Comments</a></li>
@ -245,6 +272,7 @@ to reach out to the developer!</p>
<li class="toctree-l2"><a class="reference internal" href="netscripthacknetnodeapi.html"> Hacknet Node API</a></li>
<li class="toctree-l2"><a class="reference internal" href="netscriptixapi.html"> Trade Information eXchange (TIX) API</a></li>
<li class="toctree-l2"><a class="reference internal" href="netscriptsingularityfunctions.html"> Singularity Functions</a></li>
<li class="toctree-l2"><a class="reference internal" href="netscriptbladeburnerapi.html"> Bladeburner API</a></li>
<li class="toctree-l2"><a class="reference internal" href="netscriptmisc.html"> Miscellaneous</a></li>
</ul>
</li>

@ -0,0 +1,748 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="English">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Netscript Bladeburner API &#8212; Bitburner 1.0 documentation</title>
<link rel="stylesheet" href="_static/agogo.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: './',
VERSION: '1.0',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true,
SOURCELINK_SUFFIX: '.txt'
};
</script>
<script type="text/javascript" src="_static/jquery.js"></script>
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
<link rel="next" title="Netscript Miscellaneous" href="netscriptmisc.html" />
<link rel="prev" title="Netscript Singularity Functions" href="netscriptsingularityfunctions.html" />
</head>
<body>
<div class="header-wrapper" role="banner">
<div class="header">
<div class="headertitle"><a
href="index.html">Bitburner 1.0 documentation</a></div>
<div class="rel" role="navigation" aria-label="related navigation">
<a href="netscriptsingularityfunctions.html" title="Netscript Singularity Functions"
accesskey="P">previous</a> |
<a href="netscriptmisc.html" title="Netscript Miscellaneous"
accesskey="N">next</a> |
<a href="genindex.html" title="General Index"
accesskey="I">index</a>
</div>
</div>
</div>
<div class="content-wrapper">
<div class="content">
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body" role="main">
<div class="section" id="netscript-bladeburner-api">
<h1>Netscript Bladeburner API<a class="headerlink" href="#netscript-bladeburner-api" title="Permalink to this headline"></a></h1>
<p>Netscript provides the following API for interacting with the game's Bladeburner mechanic.</p>
<p>The Bladeburner API is <strong>not</strong> immediately available to the palyer and must be unlocked
later in the game</p>
<p><strong>WARNING: This page contains spoilers for the game</strong></p>
<p>The Bladeburner API is unlocked in BitNode-7. If you are in BitNode-7, you will
automatically gain access to this API. Otherwise, you must have Source-File 7 in
order to use this API in other BitNodes</p>
<p><strong>Bladeburner API functions must be accessed through the bladeburner namespace</strong></p>
<p>In Netscript 1.0:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">bladeburner</span><span class="o">.</span><span class="n">getContractNames</span><span class="p">();</span>
<span class="n">bladeburner</span><span class="o">.</span><span class="n">startAction</span><span class="p">(</span><span class="s2">&quot;general&quot;</span><span class="p">,</span> <span class="s2">&quot;Training&quot;</span><span class="p">);</span>
</pre></div>
</div>
<p>In <a class="reference internal" href="netscriptjs.html#netscriptjs"><span class="std std-ref">NetscriptJS (Netscript 2.0)</span></a>:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">ns</span><span class="o">.</span><span class="n">bladeburner</span><span class="o">.</span><span class="n">getContractNames</span><span class="p">();</span>
<span class="n">ns</span><span class="o">.</span><span class="n">bladeburner</span><span class="o">.</span><span class="n">startAction</span><span class="p">(</span><span class="s2">&quot;general&quot;</span><span class="p">,</span> <span class="s2">&quot;Training&quot;</span><span class="p">);</span>
</pre></div>
</div>
<div class="section" id="bladeburner-action-types">
<span id="id1"></span><h2>Bladeburner Action Types<a class="headerlink" href="#bladeburner-action-types" title="Permalink to this headline"></a></h2>
<p>Several functions in the Bladeburner API require you to specify an action using
its type and name. The following are valid values when specifying the action's type:</p>
<dl class="docutils">
<dt><strong>Contracts</strong></dt>
<dd><ul class="first last simple">
<li>contract</li>
<li>contracts</li>
<li>contr</li>
</ul>
</dd>
<dt><strong>Operations</strong></dt>
<dd><ul class="first last simple">
<li>operation</li>
<li>operations</li>
<li>op</li>
<li>ops</li>
</ul>
</dd>
<dt><strong>Black Ops</strong></dt>
<dd><ul class="first last simple">
<li>blackoperation</li>
<li>black operation</li>
<li>black operations</li>
<li>black op</li>
<li>black ops</li>
<li>blackop</li>
<li>blackops</li>
</ul>
</dd>
<dt><strong>General Actions (Training, Field Analysis, Recruitment)</strong></dt>
<dd><ul class="first last simple">
<li>general</li>
<li>general action</li>
<li>gen</li>
</ul>
</dd>
</dl>
</div>
<div class="section" id="getcontractnames">
<h2>getContractNames<a class="headerlink" href="#getcontractnames" title="Permalink to this headline"></a></h2>
<dl class="function">
<dt id="getContractNames">
<code class="descname">getContractNames</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#getContractNames" title="Permalink to this definition"></a></dt>
<dd><p>Returns an array of strings containing the names of all Bladeburner contracts</p>
</dd></dl>
</div>
<div class="section" id="getoperationnames">
<h2>getOperationNames<a class="headerlink" href="#getoperationnames" title="Permalink to this headline"></a></h2>
<dl class="function">
<dt id="getOperationNames">
<code class="descname">getOperationNames</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#getOperationNames" title="Permalink to this definition"></a></dt>
<dd><p>Returns an array of strings containing the names of all Bladeburner operations</p>
</dd></dl>
</div>
<div class="section" id="getblackopnames">
<h2>getBlackOpNames<a class="headerlink" href="#getblackopnames" title="Permalink to this headline"></a></h2>
<dl class="function">
<dt id="getBlackOpNames">
<code class="descname">getBlackOpNames</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#getBlackOpNames" title="Permalink to this definition"></a></dt>
<dd><p>Returns an array of strings containing the names of all Bladeburner Black Ops</p>
</dd></dl>
</div>
<div class="section" id="getgeneralactionnames">
<h2>getGeneralActionNames<a class="headerlink" href="#getgeneralactionnames" title="Permalink to this headline"></a></h2>
<dl class="function">
<dt id="getGeneralActionNames">
<code class="descname">getGeneralActionNames</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#getGeneralActionNames" title="Permalink to this definition"></a></dt>
<dd><p>Returns an array of strings containing the names of all general Bladeburner actions</p>
</dd></dl>
</div>
<div class="section" id="getskillnames">
<h2>getSkillNames<a class="headerlink" href="#getskillnames" title="Permalink to this headline"></a></h2>
<dl class="function">
<dt id="getSkillNames">
<code class="descname">getSkillNames</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#getSkillNames" title="Permalink to this definition"></a></dt>
<dd><p>Returns an array of strings containing the names of all Bladeburner skills</p>
</dd></dl>
</div>
<div class="section" id="startaction">
<h2>startAction<a class="headerlink" href="#startaction" title="Permalink to this headline"></a></h2>
<dl class="function">
<dt id="startAction">
<code class="descname">startAction</code><span class="sig-paren">(</span><em>type</em>, <em>name</em><span class="sig-paren">)</span><a class="headerlink" href="#startAction" title="Permalink to this definition"></a></dt>
<dd><table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first last simple">
<li><strong>type</strong> (<em>string</em>) -- Type of action. See <a class="reference internal" href="#bladeburner-action-types"><span class="std std-ref">Bladeburner Action Types</span></a></li>
<li><strong>name</strong> (<em>string</em>) -- Name of action. Must be an exact match</li>
</ul>
</td>
</tr>
</tbody>
</table>
<p>Attempts to start the specified Bladeburner action. Returns true if the action
was started successfully, and false otherwise.</p>
</dd></dl>
</div>
<div class="section" id="stopbladeburneraction">
<h2>stopBladeburnerAction<a class="headerlink" href="#stopbladeburneraction" title="Permalink to this headline"></a></h2>
<dl class="function">
<dt id="stopBladeburnerAction">
<code class="descname">stopBladeburnerAction</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#stopBladeburnerAction" title="Permalink to this definition"></a></dt>
<dd><p>Stops the current Bladeburner action</p>
</dd></dl>
</div>
<div class="section" id="getactiontime">
<h2>getActionTime<a class="headerlink" href="#getactiontime" title="Permalink to this headline"></a></h2>
<dl class="function">
<dt id="getActionTime">
<code class="descname">getActionTime</code><span class="sig-paren">(</span><em>type</em>, <em>name</em><span class="sig-paren">)</span><a class="headerlink" href="#getActionTime" title="Permalink to this definition"></a></dt>
<dd><table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first last simple">
<li><strong>type</strong> (<em>string</em>) -- Type of action. See <a class="reference internal" href="#bladeburner-action-types"><span class="std std-ref">Bladeburner Action Types</span></a></li>
<li><strong>name</strong> (<em>string</em>) -- Name of action. Must be an exact match</li>
</ul>
</td>
</tr>
</tbody>
</table>
<p>Returns the number of seconds it takes to complete the specified action</p>
</dd></dl>
</div>
<div class="section" id="getactionestimatedsuccesschance">
<h2>getActionEstimatedSuccessChance<a class="headerlink" href="#getactionestimatedsuccesschance" title="Permalink to this headline"></a></h2>
<dl class="function">
<dt id="getActionEstimatedSuccessChance">
<code class="descname">getActionEstimatedSuccessChance</code><span class="sig-paren">(</span><em>type</em>, <em>name</em><span class="sig-paren">)</span><a class="headerlink" href="#getActionEstimatedSuccessChance" title="Permalink to this definition"></a></dt>
<dd><table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first last simple">
<li><strong>type</strong> (<em>string</em>) -- Type of action. See <a class="reference internal" href="#bladeburner-action-types"><span class="std std-ref">Bladeburner Action Types</span></a></li>
<li><strong>name</strong> (<em>string</em>) -- Name of action. Must be an exact match</li>
</ul>
</td>
</tr>
</tbody>
</table>
<p>Returns the estimated success chance for the specified action</p>
</dd></dl>
</div>
<div class="section" id="getactioncountremaining">
<h2>getActionCountRemaining<a class="headerlink" href="#getactioncountremaining" title="Permalink to this headline"></a></h2>
<dl class="function">
<dt id="getActionCountRemaining">
<code class="descname">getActionCountRemaining</code><span class="sig-paren">(</span><em>type</em>, <em>name</em><span class="sig-paren">)</span><a class="headerlink" href="#getActionCountRemaining" title="Permalink to this definition"></a></dt>
<dd><table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first last simple">
<li><strong>type</strong> (<em>string</em>) -- Type of action. See <a class="reference internal" href="#bladeburner-action-types"><span class="std std-ref">Bladeburner Action Types</span></a></li>
<li><strong>name</strong> (<em>string</em>) -- Name of action. Must be an exact match</li>
</ul>
</td>
</tr>
</tbody>
</table>
<p>Returns the remaining count of the specified action.</p>
<p>Note that this is meant to be used for Contracts and Operations.
This function will return 'Infinity' for actions such as Training and Field Analysis.</p>
</dd></dl>
</div>
<div class="section" id="getrank">
<h2>getRank<a class="headerlink" href="#getrank" title="Permalink to this headline"></a></h2>
<dl class="function">
<dt id="getRank">
<code class="descname">getRank</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#getRank" title="Permalink to this definition"></a></dt>
<dd><p>Returns the player's Bladeburner Rank</p>
</dd></dl>
</div>
<div class="section" id="getskillpoints">
<h2>getSkillPoints<a class="headerlink" href="#getskillpoints" title="Permalink to this headline"></a></h2>
<dl class="function">
<dt id="getSkillPoints">
<code class="descname">getSkillPoints</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#getSkillPoints" title="Permalink to this definition"></a></dt>
<dd><p>Returns the number of Bladeburner skill points you have</p>
</dd></dl>
</div>
<div class="section" id="getskilllevel">
<h2>getSkillLevel<a class="headerlink" href="#getskilllevel" title="Permalink to this headline"></a></h2>
<dl class="function">
<dt id="getSkillLevel">
<code class="descname">getSkillLevel</code><span class="sig-paren">(</span><em>skillName=&quot;&quot;</em><span class="sig-paren">)</span><a class="headerlink" href="#getSkillLevel" title="Permalink to this definition"></a></dt>
<dd><table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first last simple">
<li><strong>skillName</strong> (<em>string</em>) -- Optional name of Skill. Empty string by default</li>
</ul>
</td>
</tr>
</tbody>
</table>
<p>If no argument or an empty string is passed in, this function returns
an object with your level for all Bladeburner Skills (only for skills that
have at least one level). In the object, the name of the Bladeburner Skills
are the keys and your skill levels are the values. For example:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="p">{</span>
<span class="s2">&quot;Blade&#39;s Intuition&quot;</span><span class="p">:</span> <span class="mi">10</span><span class="p">,</span>
<span class="s2">&quot;Cloak&quot;</span><span class="p">:</span> <span class="mi">5</span><span class="p">,</span>
<span class="s2">&quot;Evasive System&quot;</span><span class="p">:</span> <span class="mi">6</span>
<span class="p">}</span>
</pre></div>
</div>
<p>If the name of a skill is passed in as an argument, then this function
returns your level in the specified skill.</p>
<p>The function returns -1 if an invalid skill name is passed in</p>
</dd></dl>
</div>
<div class="section" id="upgradeskill">
<h2>upgradeSkill<a class="headerlink" href="#upgradeskill" title="Permalink to this headline"></a></h2>
<dl class="function">
<dt id="upgradeSkill">
<code class="descname">upgradeSkill</code><span class="sig-paren">(</span><em>skillName</em><span class="sig-paren">)</span><a class="headerlink" href="#upgradeSkill" title="Permalink to this definition"></a></dt>
<dd><table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first last simple">
<li><strong>skillName</strong> (<em>string</em>) -- Name of Skill to be upgraded. Must be an exact match</li>
</ul>
</td>
</tr>
</tbody>
</table>
<p>Attempts to upgrade the specified Bladeburner skill. Returns true if the
skill is successfully upgraded, and false otherwise</p>
</dd></dl>
</div>
<div class="section" id="getteamsize">
<h2>getTeamSize<a class="headerlink" href="#getteamsize" title="Permalink to this headline"></a></h2>
<dl class="function">
<dt id="getTeamSize">
<code class="descname">getTeamSize</code><span class="sig-paren">(</span><em>type</em>, <em>name</em><span class="sig-paren">)</span><a class="headerlink" href="#getTeamSize" title="Permalink to this definition"></a></dt>
<dd><table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first last simple">
<li><strong>type</strong> (<em>string</em>) -- Type of action. See <a class="reference internal" href="#bladeburner-action-types"><span class="std std-ref">Bladeburner Action Types</span></a></li>
<li><strong>name</strong> (<em>string</em>) -- Name of action. Must be an exact match</li>
</ul>
</td>
</tr>
</tbody>
</table>
<p>Returns the number of Bladeburner team members you have assigned to the
specified action.</p>
<p>Setting a team is only applicable for Operations and BlackOps. This function
will return 0 for other action types.</p>
</dd></dl>
</div>
<div class="section" id="setteamsize">
<h2>setTeamSize<a class="headerlink" href="#setteamsize" title="Permalink to this headline"></a></h2>
<dl class="function">
<dt id="setTeamSize">
<code class="descname">setTeamSize</code><span class="sig-paren">(</span><em>type</em>, <em>name</em>, <em>size</em><span class="sig-paren">)</span><a class="headerlink" href="#setTeamSize" title="Permalink to this definition"></a></dt>
<dd><table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first last simple">
<li><strong>type</strong> (<em>string</em>) -- Type of action. See <a class="reference internal" href="#bladeburner-action-types"><span class="std std-ref">Bladeburner Action Types</span></a></li>
<li><strong>name</strong> (<em>string</em>) -- Name of action. Must be an exact match</li>
<li><strong>size</strong> (<em>int</em>) -- Number of team members to set. Will be converted using Math.round()</li>
</ul>
</td>
</tr>
</tbody>
</table>
<p>Set the team size for the specified Bladeburner action.</p>
<p>Returns the team size that was set, or -1 if the function failed.</p>
</dd></dl>
</div>
<div class="section" id="getcityestimatedpopulation">
<h2>getCityEstimatedPopulation<a class="headerlink" href="#getcityestimatedpopulation" title="Permalink to this headline"></a></h2>
<dl class="function">
<dt id="getCityEstimatedPopulation">
<code class="descname">getCityEstimatedPopulation</code><span class="sig-paren">(</span><em>cityName</em><span class="sig-paren">)</span><a class="headerlink" href="#getCityEstimatedPopulation" title="Permalink to this definition"></a></dt>
<dd><table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first last simple">
<li><strong>cityName</strong> (<em>string</em>) -- Name of city. Case-sensitive</li>
</ul>
</td>
</tr>
</tbody>
</table>
<p>Returns the estimated number of Synthoids in the specified city, or -1
if an invalid city was specified.</p>
</dd></dl>
</div>
<div class="section" id="getcityestimatedcommunities">
<h2>getCityEstimatedCommunities<a class="headerlink" href="#getcityestimatedcommunities" title="Permalink to this headline"></a></h2>
<dl class="function">
<dt id="getCityEstimatedCommunities">
<code class="descname">getCityEstimatedCommunities</code><span class="sig-paren">(</span><em>cityName</em><span class="sig-paren">)</span><a class="headerlink" href="#getCityEstimatedCommunities" title="Permalink to this definition"></a></dt>
<dd><table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first last simple">
<li><strong>cityName</strong> (<em>string</em>) -- Name of city. Case-sensitive</li>
</ul>
</td>
</tr>
</tbody>
</table>
<p>Returns the estimated number of Synthoid communities in the specified city,
or -1 if an invalid city was specified.</p>
</dd></dl>
</div>
<div class="section" id="getcitychaos">
<h2>getCityChaos<a class="headerlink" href="#getcitychaos" title="Permalink to this headline"></a></h2>
<dl class="function">
<dt id="getCityChaos">
<code class="descname">getCityChaos</code><span class="sig-paren">(</span><em>cityName</em><span class="sig-paren">)</span><a class="headerlink" href="#getCityChaos" title="Permalink to this definition"></a></dt>
<dd><table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first last simple">
<li><strong>cityName</strong> (<em>string</em>) -- Name of city. Case-sensitive</li>
</ul>
</td>
</tr>
</tbody>
</table>
<p>Returns the chaos in the specified city, or -1 if an invalid city was specified</p>
</dd></dl>
</div>
<div class="section" id="switchcity">
<h2>switchCity<a class="headerlink" href="#switchcity" title="Permalink to this headline"></a></h2>
<dl class="function">
<dt id="switchCity">
<code class="descname">switchCity</code><span class="sig-paren">(</span><em>cityName</em><span class="sig-paren">)</span><a class="headerlink" href="#switchCity" title="Permalink to this definition"></a></dt>
<dd><table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first last simple">
<li><strong>cityName</strong> (<em>string</em>) -- Name of city</li>
</ul>
</td>
</tr>
</tbody>
</table>
<p>Attempts to switch to the specified city (for Bladeburner only).</p>
<p>Returns true if successful, and false otherwise</p>
</dd></dl>
</div>
<div class="section" id="getstamina">
<h2>getStamina<a class="headerlink" href="#getstamina" title="Permalink to this headline"></a></h2>
<dl class="function">
<dt id="getStamina">
<code class="descname">getStamina</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#getStamina" title="Permalink to this definition"></a></dt>
<dd><p>Returns an array with two elements:</p>
<blockquote>
<div>[Current stamina, Max stamina]</div></blockquote>
<p>Example usage:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">function</span> <span class="n">getStaminaPercentage</span><span class="p">()</span> <span class="p">{</span>
<span class="n">let</span> <span class="n">res</span> <span class="o">=</span> <span class="n">bladeburner</span><span class="o">.</span><span class="n">getStamina</span><span class="p">();</span>
<span class="k">return</span> <span class="n">res</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">/</span> <span class="n">res</span><span class="p">[</span><span class="mi">1</span><span class="p">];</span>
<span class="p">}</span>
</pre></div>
</div>
</dd></dl>
</div>
<div class="section" id="joinbladeburnerfaction">
<h2>joinBladeburnerFaction<a class="headerlink" href="#joinbladeburnerfaction" title="Permalink to this headline"></a></h2>
<dl class="function">
<dt id="joinBladeburnerFaction">
<code class="descname">joinBladeburnerFaction</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#joinBladeburnerFaction" title="Permalink to this definition"></a></dt>
<dd><p>Attempts to join the Bladeburner faction.</p>
<p>Returns true if you successfully join the Bladeburner faction, or if
you are already a member.</p>
<p>Returns false otherwise.</p>
</dd></dl>
</div>
<div class="section" id="examples">
<h2>Examples<a class="headerlink" href="#examples" title="Permalink to this headline"></a></h2>
<p><strong>Basic example usage</strong>:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">tprint</span><span class="p">(</span><span class="n">bladeburner</span><span class="o">.</span><span class="n">getContractNames</span><span class="p">());</span>
<span class="n">tprint</span><span class="p">(</span><span class="n">bladeburner</span><span class="o">.</span><span class="n">getOperationNames</span><span class="p">());</span>
<span class="n">tprint</span><span class="p">(</span><span class="n">bladeburner</span><span class="o">.</span><span class="n">getBlackOpNames</span><span class="p">());</span>
<span class="n">tprint</span><span class="p">(</span><span class="n">bladeburner</span><span class="o">.</span><span class="n">getGeneralActionNames</span><span class="p">());</span>
<span class="n">tprint</span><span class="p">(</span><span class="n">bladeburner</span><span class="o">.</span><span class="n">getSkillNames</span><span class="p">());</span>
<span class="n">tprint</span><span class="p">(</span><span class="n">bladeburner</span><span class="o">.</span><span class="n">getActionTime</span><span class="p">(</span><span class="s2">&quot;contract&quot;</span><span class="p">,</span> <span class="s2">&quot;Tracking&quot;</span><span class="p">));</span>
<span class="n">tprint</span><span class="p">(</span><span class="s2">&quot;Rank: &quot;</span> <span class="o">+</span> <span class="n">bladeburner</span><span class="o">.</span><span class="n">getRank</span><span class="p">());</span>
<span class="n">tprint</span><span class="p">(</span><span class="s2">&quot;Skill Points: &quot;</span> <span class="o">+</span> <span class="n">bladeburner</span><span class="o">.</span><span class="n">getSkillPoints</span><span class="p">());</span>
<span class="n">tprint</span><span class="p">(</span><span class="s2">&quot;Cloak Skill Level: &quot;</span> <span class="o">+</span> <span class="n">bladeburner</span><span class="o">.</span><span class="n">getSkillLevel</span><span class="p">(</span><span class="s2">&quot;Cloak&quot;</span><span class="p">));</span>
<span class="n">tprint</span><span class="p">(</span><span class="s2">&quot;Trying to upgradeSkill: &quot;</span> <span class="o">+</span> <span class="n">bladeburner</span><span class="o">.</span><span class="n">upgradeSkill</span><span class="p">(</span><span class="s2">&quot;Cloak&quot;</span><span class="p">));</span>
<span class="n">tprint</span><span class="p">(</span><span class="s2">&quot;Skill Points remaining: &quot;</span> <span class="o">+</span> <span class="n">bladeburner</span><span class="o">.</span><span class="n">getSkillPoints</span><span class="p">());</span>
<span class="n">tprint</span><span class="p">(</span><span class="s2">&quot;Trying to switch to a nonexistent city: &quot;</span> <span class="o">+</span> <span class="n">bladeburner</span><span class="o">.</span><span class="n">switchCity</span><span class="p">(</span><span class="s2">&quot;lskgns&quot;</span><span class="p">));</span>
<span class="n">var</span> <span class="n">chongqing</span> <span class="o">=</span> <span class="s2">&quot;Chongqing&quot;</span><span class="p">;</span>
<span class="n">tprint</span><span class="p">(</span><span class="s2">&quot;Trying to switch to Chongqing: &quot;</span> <span class="o">+</span> <span class="n">bladeburner</span><span class="o">.</span><span class="n">switchCity</span><span class="p">(</span><span class="n">chongqing</span><span class="p">));</span>
<span class="n">tprint</span><span class="p">(</span><span class="s2">&quot;Chongqing chaos: &quot;</span> <span class="o">+</span> <span class="n">bladeburner</span><span class="o">.</span><span class="n">getCityChaos</span><span class="p">(</span><span class="n">chongqing</span><span class="p">));</span>
<span class="n">tprint</span><span class="p">(</span><span class="s2">&quot;Chongqing estimated pop: &quot;</span> <span class="o">+</span> <span class="n">bladeburner</span><span class="o">.</span><span class="n">getCityEstimatedPopulation</span><span class="p">(</span><span class="n">chongqing</span><span class="p">));</span>
<span class="n">tprint</span><span class="p">(</span><span class="s2">&quot;Chonqging estimated communities: &quot;</span> <span class="o">+</span> <span class="n">bladeburner</span><span class="o">.</span><span class="n">getCityEstimatedCommunities</span><span class="p">(</span><span class="n">chongqing</span><span class="p">));</span>
</pre></div>
</div>
<p><strong>Bladeburner handler example</strong>. Note that this avoids the need of using the <em>bladeburner</em> namespace
identifier by attaching the Bladeburner API functions to an object:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span>const FIELD_ANALYSIS_INTERVAL = 10; //Number of minutes between field analysis states
const FIELD_ANALYSIS_DURATION = 5; //Duration in minutes
function BladeburnerHandler(ns, params) {
//Netscript environment becomes part of the instance
this.ns = ns;
//Netscript bladeburner API becomes part of this instance
for (var bladeburnerFn in ns.bladeburner) {
this[bladeburnerFn] = ns.bladeburner[bladeburnerFn];
}
this.fieldAnalysis = {
inProgress: params.startFieldAnalysis ? true : false,
cyclesRemaining: FIELD_ANALYSIS_DURATION,
cyclesSince: FIELD_ANALYSIS_INTERVAL
}
}
BladeburnerHandler.prototype.getStaminaPercentage = function() {
var res = this.getStamina();
return 100 * (res[0] / res[1]);
}
BladeburnerHandler.prototype.hasSimulacrum = function() {
var augs = this.ns.getOwnedAugmentations();
return augs.includes(&quot;The Blade&#39;s Simulacrum&quot;);
}
BladeburnerHandler.prototype.handle = function() {
//If we&#39;re doing something else manually (without Simlacrum),
//it overrides Bladeburner stuff
if (!this.hasSimulacrum() &amp;&amp; this.ns.isBusy()) {
this.ns.print(&quot;Idling bc player is busy with some other action&quot;);
return;
}
if (this.fieldAnalysis.inProgress) {
--(this.fieldAnalysis.cyclesRemaining);
if (this.fieldAnalysis.cyclesRemaining &lt; 0) {
this.fieldAnalysis.inProgress = false;
this.fieldAnalysis.cyclesSince = 0;
return this.handle();
} else {
this.startAction(&quot;general&quot;, &quot;Field Analysis&quot;);
this.ns.print(&quot;handler is doing field analyis for &quot; +
(this.fieldAnalysis.cyclesRemaining+1) + &quot; more mins&quot;);
return;
}
} else {
++(this.fieldAnalysis.cyclesSince);
if (this.fieldAnalysis.cyclesSince &gt; FIELD_ANALYSIS_INTERVAL) {
this.fieldAnalysis.inProgress = true;
this.fieldAnalysis.cyclesRemaining = FIELD_ANALYSIS_DURATION;
return this.handle();
}
}
this.stopBladeburnerAction();
var staminaPerc = this.getStaminaPercentage();
if (staminaPerc &lt; 55) {
this.ns.print(&quot;handler is starting training due to low stamina percentage&quot;);
this.startAction(&quot;general&quot;, &quot;Training&quot;);
} else {
var action = this.chooseAction();
this.ns.print(&quot;handler chose &quot; + action.name + &quot; &quot; + action.type + &quot; through chooseAction()&quot;);
this.startAction(action.type, action.name);
}
}
BladeburnerHandler.prototype.chooseAction = function() {
//Array of all Operations
var ops = this.getOperationNames();
//Sort Operations in order of increasing success chance
ops.sort((a, b)=&gt;{
return this.getActionEstimatedSuccessChance(&quot;operation&quot;, a) -
this.getActionEstimatedSuccessChance(&quot;operation&quot;, b);
});
//Loop through until you find one with 99+% success chance
for (let i = 0; i &lt; ops.length; ++i) {
let successChance = this.getActionEstimatedSuccessChance(&quot;operation&quot;, ops[i]);
let count = this.getActionCountRemaining(&quot;operation&quot;, ops[i]);
if (successChance &gt;= 0.99 &amp;&amp; count &gt; 10) {
return {type: &quot;operation&quot;, name: ops[i]};
}
}
//Repeat for Contracts
var contracts = this.getContractNames();
contracts.sort((a, b)=&gt;{
return this.getActionEstimatedSuccessChance(&quot;contract&quot;, a) -
this.getActionEstimatedSuccessChance(&quot;contract&quot;, b);
});
for (let i = 0; i &lt; contracts.length; ++i) {
let successChance = this.getActionEstimatedSuccessChance(&quot;contract&quot;, contracts[i]);
let count = this.getActionCountRemaining(&quot;contract&quot;, contracts[i]);
if (successChance &gt;= 0.80 &amp;&amp; count &gt; 10) {
return {type: &quot;contract&quot;, name: contracts[i]};
}
}
return {type:&quot;general&quot;, name:&quot;Training&quot;};
}
BladeburnerHandler.prototype.process = async function() {
this.handle();
await this.ns.sleep(60000);
}
export async function main(ns) {
ns.disableLog(&quot;sleep&quot;);
//Check if Bladeburner is available. This&#39;ll throw a runtime error if it&#39;s not
ns.bladeburner.getContractNames();
var startFieldAnalysis = true;
if (ns.args.length &gt;= 1 &amp;&amp; ns.args[0] == &quot;false&quot;) {
startFieldAnalysis = false;
}
var handler = new BladeburnerHandler(ns, {
startFieldAnalysis: startFieldAnalysis
});
while(true) {
await handler.process();
}
}
</pre></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="sidebar">
<h3>Table Of Contents</h3>
<p class="caption"><span class="caption-text">Contents:</span></p>
<ul class="current">
<li class="toctree-l1 current"><a class="reference internal" href="netscript.html"> Netscript</a><ul class="current">
<li class="toctree-l2"><a class="reference internal" href="netscriptjs.html"> NetscriptJS (Netscript 2.0)</a></li>
<li class="toctree-l2"><a class="reference internal" href="netscriptdatatypes.html"> Data Types and Variables</a></li>
<li class="toctree-l2"><a class="reference internal" href="netscriptoperators.html"> Operators</a></li>
<li class="toctree-l2"><a class="reference internal" href="netscriptloopsandconditionals.html"> Loops and Conditionals</a></li>
<li class="toctree-l2"><a class="reference internal" href="netscriptscriptarguments.html"> Script Arguments</a></li>
<li class="toctree-l2"><a class="reference internal" href="netscriptfunctions.html"> Basic Functions</a></li>
<li class="toctree-l2"><a class="reference internal" href="netscriptadvancedfunctions.html"> Advanced Functions</a></li>
<li class="toctree-l2"><a class="reference internal" href="netscripthacknetnodeapi.html"> Hacknet Node API</a></li>
<li class="toctree-l2"><a class="reference internal" href="netscriptixapi.html"> Trade Information eXchange (TIX) API</a></li>
<li class="toctree-l2"><a class="reference internal" href="netscriptsingularityfunctions.html"> Singularity Functions</a></li>
<li class="toctree-l2 current"><a class="current reference internal" href="#"> Bladeburner API</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#bladeburner-action-types">Bladeburner Action Types</a></li>
<li class="toctree-l3"><a class="reference internal" href="#getcontractnames">getContractNames</a></li>
<li class="toctree-l3"><a class="reference internal" href="#getoperationnames">getOperationNames</a></li>
<li class="toctree-l3"><a class="reference internal" href="#getblackopnames">getBlackOpNames</a></li>
<li class="toctree-l3"><a class="reference internal" href="#getgeneralactionnames">getGeneralActionNames</a></li>
<li class="toctree-l3"><a class="reference internal" href="#getskillnames">getSkillNames</a></li>
<li class="toctree-l3"><a class="reference internal" href="#startaction">startAction</a></li>
<li class="toctree-l3"><a class="reference internal" href="#stopbladeburneraction">stopBladeburnerAction</a></li>
<li class="toctree-l3"><a class="reference internal" href="#getactiontime">getActionTime</a></li>
<li class="toctree-l3"><a class="reference internal" href="#getactionestimatedsuccesschance">getActionEstimatedSuccessChance</a></li>
<li class="toctree-l3"><a class="reference internal" href="#getactioncountremaining">getActionCountRemaining</a></li>
<li class="toctree-l3"><a class="reference internal" href="#getrank">getRank</a></li>
<li class="toctree-l3"><a class="reference internal" href="#getskillpoints">getSkillPoints</a></li>
<li class="toctree-l3"><a class="reference internal" href="#getskilllevel">getSkillLevel</a></li>
<li class="toctree-l3"><a class="reference internal" href="#upgradeskill">upgradeSkill</a></li>
<li class="toctree-l3"><a class="reference internal" href="#getteamsize">getTeamSize</a></li>
<li class="toctree-l3"><a class="reference internal" href="#setteamsize">setTeamSize</a></li>
<li class="toctree-l3"><a class="reference internal" href="#getcityestimatedpopulation">getCityEstimatedPopulation</a></li>
<li class="toctree-l3"><a class="reference internal" href="#getcityestimatedcommunities">getCityEstimatedCommunities</a></li>
<li class="toctree-l3"><a class="reference internal" href="#getcitychaos">getCityChaos</a></li>
<li class="toctree-l3"><a class="reference internal" href="#switchcity">switchCity</a></li>
<li class="toctree-l3"><a class="reference internal" href="#getstamina">getStamina</a></li>
<li class="toctree-l3"><a class="reference internal" href="#joinbladeburnerfaction">joinBladeburnerFaction</a></li>
<li class="toctree-l3"><a class="reference internal" href="#examples">Examples</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="netscriptmisc.html"> Miscellaneous</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="terminal.html"> Terminal</a></li>
<li class="toctree-l1"><a class="reference internal" href="shortcuts.html"> Keyboard Shortcuts</a></li>
<li class="toctree-l1"><a class="reference internal" href="changelog.html"> Changelog</a></li>
</ul>
<div role="search">
<h3 style="margin-top: 1.5em;">Search</h3>
<form class="search" action="search.html" method="get">
<input type="text" name="q" />
<input type="submit" value="Go" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div>
<div class="clearer"></div>
</div>
</div>
<div class="footer-wrapper">
<div class="footer">
<div class="left">
<div role="navigation" aria-label="related navigaton">
<a href="netscriptsingularityfunctions.html" title="Netscript Singularity Functions"
>previous</a> |
<a href="netscriptmisc.html" title="Netscript Miscellaneous"
>next</a> |
<a href="genindex.html" title="General Index"
>index</a>
</div>
<div role="note" aria-label="source link">
<br/>
<a href="_sources/netscriptbladeburnerapi.rst.txt"
rel="nofollow">Show Source</a>
</div>
</div>
<div class="right">
<div class="footer" role="contentinfo">
&#169; Copyright 2017, Bitburner.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.6.4.
</div>
</div>
<div class="clearer"></div>
</div>
</div>
</body>
</html>

@ -1567,7 +1567,10 @@ false if the player clicks &quot;No&quot;. The script's execution is halted unti
<div class="section" id="defining-your-own-functions">
<h3>Defining your own Functions<a class="headerlink" href="#defining-your-own-functions" title="Permalink to this headline"></a></h3>
<p>You can define your own functions in Netscript using the following syntax:</p>
<p>Note that the following information is only applicable for Netscript 1.0.
<a class="reference internal" href="netscriptjs.html"><span class="doc">NetscriptJS (Netscript 2.0)</span></a> allows you to define your functions using native Javascript
techniques.</p>
<p>You can define your own functions in Netscript 1.0 using the following syntax:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">function</span> <span class="n">name</span><span class="p">(</span><span class="n">args</span><span class="o">...</span><span class="p">)</span> <span class="p">{</span>
<span class="n">function</span> <span class="n">code</span> <span class="n">here</span><span class="o">...</span>
<span class="k">return</span> <span class="n">some_value</span>
@ -1738,6 +1741,7 @@ you create in functions such as <a class="reference external" href="https://deve
<li class="toctree-l2"><a class="reference internal" href="netscripthacknetnodeapi.html"> Hacknet Node API</a></li>
<li class="toctree-l2"><a class="reference internal" href="netscriptixapi.html"> Trade Information eXchange (TIX) API</a></li>
<li class="toctree-l2"><a class="reference internal" href="netscriptsingularityfunctions.html"> Singularity Functions</a></li>
<li class="toctree-l2"><a class="reference internal" href="netscriptbladeburnerapi.html"> Bladeburner API</a></li>
<li class="toctree-l2"><a class="reference internal" href="netscriptmisc.html"> Miscellaneous</a></li>
</ul>
</li>

Binary file not shown.

File diff suppressed because one or more lines are too long

@ -24,4 +24,5 @@ to reach out to the developer!
Hacknet Node API <netscripthacknetnodeapi>
Trade Information eXchange (TIX) API <netscriptixapi>
Singularity Functions <netscriptsingularityfunctions>
Bladeburner API <netscriptbladeburnerapi>
Miscellaneous <netscriptmisc>

@ -0,0 +1,446 @@
Netscript Bladeburner API
=========================
Netscript provides the following API for interacting with the game's Bladeburner mechanic.
The Bladeburner API is **not** immediately available to the palyer and must be unlocked
later in the game
**WARNING: This page contains spoilers for the game**
The Bladeburner API is unlocked in BitNode-7. If you are in BitNode-7, you will
automatically gain access to this API. Otherwise, you must have Source-File 7 in
order to use this API in other BitNodes
**Bladeburner API functions must be accessed through the bladeburner namespace**
In Netscript 1.0::
bladeburner.getContractNames();
bladeburner.startAction("general", "Training");
In :ref:`netscriptjs`::
ns.bladeburner.getContractNames();
ns.bladeburner.startAction("general", "Training");
.. _bladeburner_action_types:
Bladeburner Action Types
------------------------
Several functions in the Bladeburner API require you to specify an action using
its type and name. The following are valid values when specifying the action's type:
**Contracts**
* contract
* contracts
* contr
**Operations**
* operation
* operations
* op
* ops
**Black Ops**
* blackoperation
* black operation
* black operations
* black op
* black ops
* blackop
* blackops
**General Actions (Training, Field Analysis, Recruitment)**
* general
* general action
* gen
getContractNames
----------------
.. js:function:: getContractNames()
Returns an array of strings containing the names of all Bladeburner contracts
getOperationNames
-----------------
.. js:function:: getOperationNames()
Returns an array of strings containing the names of all Bladeburner operations
getBlackOpNames
---------------
.. js:function:: getBlackOpNames()
Returns an array of strings containing the names of all Bladeburner Black Ops
getGeneralActionNames
---------------------
.. js:function:: getGeneralActionNames()
Returns an array of strings containing the names of all general Bladeburner actions
getSkillNames
-------------
.. js:function:: getSkillNames()
Returns an array of strings containing the names of all Bladeburner skills
startAction
-----------
.. js:function:: startAction(type, name)
:param string type: Type of action. See :ref:`bladeburner_action_types`
:param string name: Name of action. Must be an exact match
Attempts to start the specified Bladeburner action. Returns true if the action
was started successfully, and false otherwise.
stopBladeburnerAction
---------------------
.. js:function:: stopBladeburnerAction()
Stops the current Bladeburner action
getActionTime
-------------
.. js:function:: getActionTime(type, name)
:param string type: Type of action. See :ref:`bladeburner_action_types`
:param string name: Name of action. Must be an exact match
Returns the number of seconds it takes to complete the specified action
getActionEstimatedSuccessChance
-------------------------------
.. js:function:: getActionEstimatedSuccessChance(type, name)
:param string type: Type of action. See :ref:`bladeburner_action_types`
:param string name: Name of action. Must be an exact match
Returns the estimated success chance for the specified action
getActionCountRemaining
-----------------------
.. js:function:: getActionCountRemaining(type, name)
:param string type: Type of action. See :ref:`bladeburner_action_types`
:param string name: Name of action. Must be an exact match
Returns the remaining count of the specified action.
Note that this is meant to be used for Contracts and Operations.
This function will return 'Infinity' for actions such as Training and Field Analysis.
getRank
-------
.. js:function:: getRank()
Returns the player's Bladeburner Rank
getSkillPoints
--------------
.. js:function:: getSkillPoints()
Returns the number of Bladeburner skill points you have
getSkillLevel
-------------
.. js:function:: getSkillLevel(skillName="")
:param string skillName: Optional name of Skill. Empty string by default
If no argument or an empty string is passed in, this function returns
an object with your level for all Bladeburner Skills (only for skills that
have at least one level). In the object, the name of the Bladeburner Skills
are the keys and your skill levels are the values. For example::
{
"Blade's Intuition": 10,
"Cloak": 5,
"Evasive System": 6
}
If the name of a skill is passed in as an argument, then this function
returns your level in the specified skill.
The function returns -1 if an invalid skill name is passed in
upgradeSkill
------------
.. js:function:: upgradeSkill(skillName)
:param string skillName: Name of Skill to be upgraded. Must be an exact match
Attempts to upgrade the specified Bladeburner skill. Returns true if the
skill is successfully upgraded, and false otherwise
getTeamSize
-----------
.. js:function:: getTeamSize(type, name)
:param string type: Type of action. See :ref:`bladeburner_action_types`
:param string name: Name of action. Must be an exact match
Returns the number of Bladeburner team members you have assigned to the
specified action.
Setting a team is only applicable for Operations and BlackOps. This function
will return 0 for other action types.
setTeamSize
-----------
.. js:function:: setTeamSize(type, name, size)
:param string type: Type of action. See :ref:`bladeburner_action_types`
:param string name: Name of action. Must be an exact match
:param int size: Number of team members to set. Will be converted using Math.round()
Set the team size for the specified Bladeburner action.
Returns the team size that was set, or -1 if the function failed.
getCityEstimatedPopulation
--------------------------
.. js:function:: getCityEstimatedPopulation(cityName)
:param string cityName: Name of city. Case-sensitive
Returns the estimated number of Synthoids in the specified city, or -1
if an invalid city was specified.
getCityEstimatedCommunities
---------------------------
.. js:function:: getCityEstimatedCommunities(cityName)
:param string cityName: Name of city. Case-sensitive
Returns the estimated number of Synthoid communities in the specified city,
or -1 if an invalid city was specified.
getCityChaos
------------
.. js:function:: getCityChaos(cityName)
:param string cityName: Name of city. Case-sensitive
Returns the chaos in the specified city, or -1 if an invalid city was specified
switchCity
----------
.. js:function:: switchCity(cityName)
:param string cityName: Name of city
Attempts to switch to the specified city (for Bladeburner only).
Returns true if successful, and false otherwise
getStamina
----------
.. js:function:: getStamina()
Returns an array with two elements:
[Current stamina, Max stamina]
Example usage::
function getStaminaPercentage() {
let res = bladeburner.getStamina();
return res[0] / res[1];
}
joinBladeburnerFaction
----------------------
.. js:function:: joinBladeburnerFaction()
Attempts to join the Bladeburner faction.
Returns true if you successfully join the Bladeburner faction, or if
you are already a member.
Returns false otherwise.
Examples
--------
**Basic example usage**::
tprint(bladeburner.getContractNames());
tprint(bladeburner.getOperationNames());
tprint(bladeburner.getBlackOpNames());
tprint(bladeburner.getGeneralActionNames());
tprint(bladeburner.getSkillNames());
tprint(bladeburner.getActionTime("contract", "Tracking"));
tprint("Rank: " + bladeburner.getRank());
tprint("Skill Points: " + bladeburner.getSkillPoints());
tprint("Cloak Skill Level: " + bladeburner.getSkillLevel("Cloak"));
tprint("Trying to upgradeSkill: " + bladeburner.upgradeSkill("Cloak"));
tprint("Skill Points remaining: " + bladeburner.getSkillPoints());
tprint("Trying to switch to a nonexistent city: " + bladeburner.switchCity("lskgns"));
var chongqing = "Chongqing";
tprint("Trying to switch to Chongqing: " + bladeburner.switchCity(chongqing));
tprint("Chongqing chaos: " + bladeburner.getCityChaos(chongqing));
tprint("Chongqing estimated pop: " + bladeburner.getCityEstimatedPopulation(chongqing));
tprint("Chonqging estimated communities: " + bladeburner.getCityEstimatedCommunities(chongqing));
**Bladeburner handler example**. Note that this avoids the need of using the *bladeburner* namespace
identifier by attaching the Bladeburner API functions to an object::
const FIELD_ANALYSIS_INTERVAL = 10; //Number of minutes between field analysis states
const FIELD_ANALYSIS_DURATION = 5; //Duration in minutes
function BladeburnerHandler(ns, params) {
//Netscript environment becomes part of the instance
this.ns = ns;
//Netscript bladeburner API becomes part of this instance
for (var bladeburnerFn in ns.bladeburner) {
this[bladeburnerFn] = ns.bladeburner[bladeburnerFn];
}
this.fieldAnalysis = {
inProgress: params.startFieldAnalysis ? true : false,
cyclesRemaining: FIELD_ANALYSIS_DURATION,
cyclesSince: FIELD_ANALYSIS_INTERVAL
}
}
BladeburnerHandler.prototype.getStaminaPercentage = function() {
var res = this.getStamina();
return 100 * (res[0] / res[1]);
}
BladeburnerHandler.prototype.hasSimulacrum = function() {
var augs = this.ns.getOwnedAugmentations();
return augs.includes("The Blade's Simulacrum");
}
BladeburnerHandler.prototype.handle = function() {
//If we're doing something else manually (without Simlacrum),
//it overrides Bladeburner stuff
if (!this.hasSimulacrum() && this.ns.isBusy()) {
this.ns.print("Idling bc player is busy with some other action");
return;
}
if (this.fieldAnalysis.inProgress) {
--(this.fieldAnalysis.cyclesRemaining);
if (this.fieldAnalysis.cyclesRemaining < 0) {
this.fieldAnalysis.inProgress = false;
this.fieldAnalysis.cyclesSince = 0;
return this.handle();
} else {
this.startAction("general", "Field Analysis");
this.ns.print("handler is doing field analyis for " +
(this.fieldAnalysis.cyclesRemaining+1) + " more mins");
return;
}
} else {
++(this.fieldAnalysis.cyclesSince);
if (this.fieldAnalysis.cyclesSince > FIELD_ANALYSIS_INTERVAL) {
this.fieldAnalysis.inProgress = true;
this.fieldAnalysis.cyclesRemaining = FIELD_ANALYSIS_DURATION;
return this.handle();
}
}
this.stopBladeburnerAction();
var staminaPerc = this.getStaminaPercentage();
if (staminaPerc < 55) {
this.ns.print("handler is starting training due to low stamina percentage");
this.startAction("general", "Training");
} else {
var action = this.chooseAction();
this.ns.print("handler chose " + action.name + " " + action.type + " through chooseAction()");
this.startAction(action.type, action.name);
}
}
BladeburnerHandler.prototype.chooseAction = function() {
//Array of all Operations
var ops = this.getOperationNames();
//Sort Operations in order of increasing success chance
ops.sort((a, b)=>{
return this.getActionEstimatedSuccessChance("operation", a) -
this.getActionEstimatedSuccessChance("operation", b);
});
//Loop through until you find one with 99+% success chance
for (let i = 0; i < ops.length; ++i) {
let successChance = this.getActionEstimatedSuccessChance("operation", ops[i]);
let count = this.getActionCountRemaining("operation", ops[i]);
if (successChance >= 0.99 && count > 10) {
return {type: "operation", name: ops[i]};
}
}
//Repeat for Contracts
var contracts = this.getContractNames();
contracts.sort((a, b)=>{
return this.getActionEstimatedSuccessChance("contract", a) -
this.getActionEstimatedSuccessChance("contract", b);
});
for (let i = 0; i < contracts.length; ++i) {
let successChance = this.getActionEstimatedSuccessChance("contract", contracts[i]);
let count = this.getActionCountRemaining("contract", contracts[i]);
if (successChance >= 0.80 && count > 10) {
return {type: "contract", name: contracts[i]};
}
}
return {type:"general", name:"Training"};
}
BladeburnerHandler.prototype.process = async function() {
this.handle();
await this.ns.sleep(60000);
}
export async function main(ns) {
ns.disableLog("sleep");
//Check if Bladeburner is available. This'll throw a runtime error if it's not
ns.bladeburner.getContractNames();
var startFieldAnalysis = true;
if (ns.args.length >= 1 && ns.args[0] == "false") {
startFieldAnalysis = false;
}
var handler = new BladeburnerHandler(ns, {
startFieldAnalysis: startFieldAnalysis
});
while(true) {
await handler.process();
}
}

@ -942,7 +942,11 @@ prompt
Defining your own Functions
---------------------------
You can define your own functions in Netscript using the following syntax::
Note that the following information is only applicable for Netscript 1.0.
:doc:`netscriptjs` allows you to define your functions using native Javascript
techniques.
You can define your own functions in Netscript 1.0 using the following syntax::
function name(args...) {
function code here...

@ -132,7 +132,7 @@ function initBitNodes() {
"Corporations have 80% lower valuations and are therefore less profitable<br>" +
"Working for companies is 50% less profitable<br>" +
"Crimes and Infiltration are 50% less profitable<br><br>" +
"Destroying this BitNode will give you Source-File 6, or if you already have this Source-File it will upgrade " +
"Destroying this BitNode will give you Source-File 7, or if you already have this Source-File it will upgrade " +
"its level up to a maximum of 3. This Source-File allows you to access the Bladeburner Netscript API in other " +
"BitNodes. In addition, this Source-File will increase all of your Bladeburner multipliers by:<br><br>" +
"Level 1: 8%<br>" +

@ -3208,6 +3208,7 @@ Bladeburner.prototype.getActionIdFromTypeAndName = function(type="", name="") {
switch (convertedType) {
case "contract":
case "contracts":
case "contr":
action.type = ActionTypes["Contract"];
if (this.contracts.hasOwnProperty(name)) {
action.name = name;
@ -3268,23 +3269,23 @@ Bladeburner.prototype.getActionIdFromTypeAndName = function(type="", name="") {
}
}
Bladeburner.prototype.getContractNamesNetscriptFn = function(name) {
Bladeburner.prototype.getContractNamesNetscriptFn = function() {
return Object.keys(this.contracts);
}
Bladeburner.prototype.getOperationNamesNetscriptFn = function(name) {
Bladeburner.prototype.getOperationNamesNetscriptFn = function() {
return Object.keys(this.operations);
}
Bladeburner.prototype.getBlackOpNamesNetscriptFn = function(name) {
Bladeburner.prototype.getBlackOpNamesNetscriptFn = function() {
return Object.keys(BlackOperations);
}
Bladeburner.prototype.getGeneralActionNamesNetscriptFn = function(name) {
Bladeburner.prototype.getGeneralActionNamesNetscriptFn = function() {
return Object.keys(GeneralActions);
}
Bladeburner.prototype.getSkillNamesNetscriptFn = function(name) {
Bladeburner.prototype.getSkillNamesNetscriptFn = function() {
return Object.keys(Skills);
}
@ -3509,8 +3510,8 @@ Bladeburner.prototype.setTeamSizeNetscriptFn = function(type, name, size, worker
return -1;
}
if (actionId.type !== ActionTypes["Operation"] ||
actionId.type !== ActionTypes["BlackOp"] ||
if (actionId.type !== ActionTypes["Operation"] &&
actionId.type !== ActionTypes["BlackOp"] &&
actionId.type !== ActionTypes["BlackOperation"]) {
workerScript.log("ERROR: Bladeburner.setTeamSize() failed. This function " +
"only works for Operations and BlackOps");

@ -3215,57 +3215,57 @@ function NetscriptFunctions(workerScript) {
//Bladeburner API
bladeburner : {
getContractNames : function(name) {
getContractNames : function() {
if (workerScript.checkingRam) {
return updateStaticRam("getContractNames", CONSTANTS.ScriptBladeburnerApiBaseRamCost / 10);
}
updateDynamicRam("getContractNames", CONSTANTS.ScriptBladeburnerApiBaseRamCost / 10);
if (Player.bladeburner instanceof Bladeburner && (Player.bitNodeN === 7 || hasBladeburner2079SF)) {
return Player.bladeburner.getContractNamesNetscriptFn(name);
return Player.bladeburner.getContractNamesNetscriptFn();
}
throw makeRuntimeRejectMsg(workerScript, "getContractNames() 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");
},
getOperationNames : function(name) {
getOperationNames : function() {
if (workerScript.checkingRam) {
return updateStaticRam("getOperationNames", CONSTANTS.ScriptBladeburnerApiBaseRamCost / 10);
}
updateDynamicRam("getOperationNames", CONSTANTS.ScriptBladeburnerApiBaseRamCost / 10);
if (Player.bladeburner instanceof Bladeburner && (Player.bitNodeN === 7 || hasBladeburner2079SF)) {
return Player.bladeburner.getOperationNamesNetscriptFn(name);
return Player.bladeburner.getOperationNamesNetscriptFn();
}
throw makeRuntimeRejectMsg(workerScript, "getOperationNames() 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");
},
getBlackOpNames : function(name) {
getBlackOpNames : function() {
if (workerScript.checkingRam) {
return updateStaticRam("getBlackOpNames", CONSTANTS.ScriptBladeburnerApiBaseRamCost / 10);
}
updateDynamicRam("getBlackOpNames", CONSTANTS.ScriptBladeburnerApiBaseRamCost / 10);
if (Player.bladeburner instanceof Bladeburner && (Player.bitNodeN === 7 || hasBladeburner2079SF)) {
return Player.bladeburner.getBlackOpNamesNetscriptFn(name);
return Player.bladeburner.getBlackOpNamesNetscriptFn();
}
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");
},
getGeneralActionNames : function(name) {
getGeneralActionNames : function() {
if (workerScript.checkingRam) {
return updateStaticRam("getGeneralActionNames", CONSTANTS.ScriptBladeburnerApiBaseRamCost / 10);
}
updateDynamicRam("getGeneralActionNames", CONSTANTS.ScriptBladeburnerApiBaseRamCost / 10);
if (Player.bladeburner instanceof Bladeburner && (Player.bitNodeN === 7 || hasBladeburner2079SF)) {
return Player.bladeburner.getGeneralActionNamesNetscriptFn(name);
return Player.bladeburner.getGeneralActionNamesNetscriptFn();
}
throw makeRuntimeRejectMsg(workerScript, "getGeneralActionNames() 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");
},
getSkillNames : function(name) {
getSkillNames : function() {
if (workerScript.checkingRam) {
return updateStaticRam("getSkillNames", CONSTANTS.ScriptBladeburnerApiBaseRamCost / 10);
}
updateDynamicRam("getSkillNames", CONSTANTS.ScriptBladeburnerApiBaseRamCost / 10);
if (Player.bladeburner instanceof Bladeburner && (Player.bitNodeN === 7 || hasBladeburner2079SF)) {
return Player.bladeburner.getSkillNamesNetscriptFn(name);
return Player.bladeburner.getSkillNamesNetscriptFn();
}
throw makeRuntimeRejectMsg(workerScript, "getSkillNames() 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");