<spanid="id1"></span><h2>Bladeburner Action Types<aclass="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>
<dlclass="docutils">
<dt><strong>Contracts</strong></dt>
<dd><ulclass="first last simple">
<li>contract</li>
<li>contracts</li>
<li>contr</li>
</ul>
</dd>
<dt><strong>Operations</strong></dt>
<dd><ulclass="first last simple">
<li>operation</li>
<li>operations</li>
<li>op</li>
<li>ops</li>
</ul>
</dd>
<dt><strong>Black Ops</strong></dt>
<dd><ulclass="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><ulclass="first last simple">
<li>general</li>
<li>general action</li>
<li>gen</li>
</ul>
</dd>
</dl>
</div>
<divclass="section"id="getcontractnames">
<h2>getContractNames<aclass="headerlink"href="#getcontractnames"title="Permalink to this headline">¶</a></h2>
<dlclass="function">
<dtid="getContractNames">
<codeclass="descname">getContractNames</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="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>
<divclass="section"id="getoperationnames">
<h2>getOperationNames<aclass="headerlink"href="#getoperationnames"title="Permalink to this headline">¶</a></h2>
<dlclass="function">
<dtid="getOperationNames">
<codeclass="descname">getOperationNames</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="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>
<divclass="section"id="getblackopnames">
<h2>getBlackOpNames<aclass="headerlink"href="#getblackopnames"title="Permalink to this headline">¶</a></h2>
<dlclass="function">
<dtid="getBlackOpNames">
<codeclass="descname">getBlackOpNames</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="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>
<divclass="section"id="getgeneralactionnames">
<h2>getGeneralActionNames<aclass="headerlink"href="#getgeneralactionnames"title="Permalink to this headline">¶</a></h2>
<dlclass="function">
<dtid="getGeneralActionNames">
<codeclass="descname">getGeneralActionNames</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="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>
<divclass="section"id="getskillnames">
<h2>getSkillNames<aclass="headerlink"href="#getskillnames"title="Permalink to this headline">¶</a></h2>
<dlclass="function">
<dtid="getSkillNames">
<codeclass="descname">getSkillNames</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="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>
<divclass="section"id="startaction">
<h2>startAction<aclass="headerlink"href="#startaction"title="Permalink to this headline">¶</a></h2>
<dlclass="function">
<dtid="startAction">
<codeclass="descname">startAction</code><spanclass="sig-paren">(</span><em>type</em>, <em>name</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#startAction"title="Permalink to this definition">¶</a></dt>
<trclass="field-odd field"><thclass="field-name">Arguments:</th><tdclass="field-body"><ulclass="first last simple">
<li><strong>type</strong> (<em>string</em>) -- Type of action. See <aclass="reference internal"href="#bladeburner-action-types"><spanclass="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>
<divclass="section"id="stopbladeburneraction">
<h2>stopBladeburnerAction<aclass="headerlink"href="#stopbladeburneraction"title="Permalink to this headline">¶</a></h2>
<dlclass="function">
<dtid="stopBladeburnerAction">
<codeclass="descname">stopBladeburnerAction</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="headerlink"href="#stopBladeburnerAction"title="Permalink to this definition">¶</a></dt>
<dd><p>Stops the current Bladeburner action</p>
</dd></dl>
</div>
<divclass="section"id="getactiontime">
<h2>getActionTime<aclass="headerlink"href="#getactiontime"title="Permalink to this headline">¶</a></h2>
<dlclass="function">
<dtid="getActionTime">
<codeclass="descname">getActionTime</code><spanclass="sig-paren">(</span><em>type</em>, <em>name</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#getActionTime"title="Permalink to this definition">¶</a></dt>
<trclass="field-odd field"><thclass="field-name">Arguments:</th><tdclass="field-body"><ulclass="first last simple">
<li><strong>type</strong> (<em>string</em>) -- Type of action. See <aclass="reference internal"href="#bladeburner-action-types"><spanclass="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>
<h2>getActionEstimatedSuccessChance<aclass="headerlink"href="#getactionestimatedsuccesschance"title="Permalink to this headline">¶</a></h2>
<dlclass="function">
<dtid="getActionEstimatedSuccessChance">
<codeclass="descname">getActionEstimatedSuccessChance</code><spanclass="sig-paren">(</span><em>type</em>, <em>name</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#getActionEstimatedSuccessChance"title="Permalink to this definition">¶</a></dt>
<trclass="field-odd field"><thclass="field-name">Arguments:</th><tdclass="field-body"><ulclass="first last simple">
<li><strong>type</strong> (<em>string</em>) -- Type of action. See <aclass="reference internal"href="#bladeburner-action-types"><spanclass="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>
<divclass="section"id="getactioncountremaining">
<h2>getActionCountRemaining<aclass="headerlink"href="#getactioncountremaining"title="Permalink to this headline">¶</a></h2>
<dlclass="function">
<dtid="getActionCountRemaining">
<codeclass="descname">getActionCountRemaining</code><spanclass="sig-paren">(</span><em>type</em>, <em>name</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#getActionCountRemaining"title="Permalink to this definition">¶</a></dt>
<trclass="field-odd field"><thclass="field-name">Arguments:</th><tdclass="field-body"><ulclass="first last simple">
<li><strong>type</strong> (<em>string</em>) -- Type of action. See <aclass="reference internal"href="#bladeburner-action-types"><spanclass="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>
<divclass="section"id="getrank">
<h2>getRank<aclass="headerlink"href="#getrank"title="Permalink to this headline">¶</a></h2>
<dlclass="function">
<dtid="getRank">
<codeclass="descname">getRank</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="headerlink"href="#getRank"title="Permalink to this definition">¶</a></dt>
<dd><p>Returns the player's Bladeburner Rank</p>
</dd></dl>
</div>
<divclass="section"id="getskillpoints">
<h2>getSkillPoints<aclass="headerlink"href="#getskillpoints"title="Permalink to this headline">¶</a></h2>
<dlclass="function">
<dtid="getSkillPoints">
<codeclass="descname">getSkillPoints</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="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>
<divclass="section"id="getskilllevel">
<h2>getSkillLevel<aclass="headerlink"href="#getskilllevel"title="Permalink to this headline">¶</a></h2>
<dlclass="function">
<dtid="getSkillLevel">
<codeclass="descname">getSkillLevel</code><spanclass="sig-paren">(</span><em>skillName=""</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#getSkillLevel"title="Permalink to this definition">¶</a></dt>
<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>
<divclass="section"id="upgradeskill">
<h2>upgradeSkill<aclass="headerlink"href="#upgradeskill"title="Permalink to this headline">¶</a></h2>
<dlclass="function">
<dtid="upgradeSkill">
<codeclass="descname">upgradeSkill</code><spanclass="sig-paren">(</span><em>skillName</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#upgradeSkill"title="Permalink to this definition">¶</a></dt>
<trclass="field-odd field"><thclass="field-name">Arguments:</th><tdclass="field-body"><ulclass="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>
<divclass="section"id="getteamsize">
<h2>getTeamSize<aclass="headerlink"href="#getteamsize"title="Permalink to this headline">¶</a></h2>
<dlclass="function">
<dtid="getTeamSize">
<codeclass="descname">getTeamSize</code><spanclass="sig-paren">(</span><em>type</em>, <em>name</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#getTeamSize"title="Permalink to this definition">¶</a></dt>
<trclass="field-odd field"><thclass="field-name">Arguments:</th><tdclass="field-body"><ulclass="first last simple">
<li><strong>type</strong> (<em>string</em>) -- Type of action. See <aclass="reference internal"href="#bladeburner-action-types"><spanclass="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>
<divclass="section"id="setteamsize">
<h2>setTeamSize<aclass="headerlink"href="#setteamsize"title="Permalink to this headline">¶</a></h2>
<dlclass="function">
<dtid="setTeamSize">
<codeclass="descname">setTeamSize</code><spanclass="sig-paren">(</span><em>type</em>, <em>name</em>, <em>size</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#setTeamSize"title="Permalink to this definition">¶</a></dt>
<trclass="field-odd field"><thclass="field-name">Arguments:</th><tdclass="field-body"><ulclass="first last simple">
<li><strong>type</strong> (<em>string</em>) -- Type of action. See <aclass="reference internal"href="#bladeburner-action-types"><spanclass="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>
<h2>getCityEstimatedPopulation<aclass="headerlink"href="#getcityestimatedpopulation"title="Permalink to this headline">¶</a></h2>
<dlclass="function">
<dtid="getCityEstimatedPopulation">
<codeclass="descname">getCityEstimatedPopulation</code><spanclass="sig-paren">(</span><em>cityName</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#getCityEstimatedPopulation"title="Permalink to this definition">¶</a></dt>
<h2>getCityEstimatedCommunities<aclass="headerlink"href="#getcityestimatedcommunities"title="Permalink to this headline">¶</a></h2>
<dlclass="function">
<dtid="getCityEstimatedCommunities">
<codeclass="descname">getCityEstimatedCommunities</code><spanclass="sig-paren">(</span><em>cityName</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#getCityEstimatedCommunities"title="Permalink to this definition">¶</a></dt>
<trclass="field-odd field"><thclass="field-name">Arguments:</th><tdclass="field-body"><ulclass="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>
<divclass="section"id="getcitychaos">
<h2>getCityChaos<aclass="headerlink"href="#getcitychaos"title="Permalink to this headline">¶</a></h2>
<dlclass="function">
<dtid="getCityChaos">
<codeclass="descname">getCityChaos</code><spanclass="sig-paren">(</span><em>cityName</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#getCityChaos"title="Permalink to this definition">¶</a></dt>
<trclass="field-odd field"><thclass="field-name">Arguments:</th><tdclass="field-body"><ulclass="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>
<divclass="section"id="switchcity">
<h2>switchCity<aclass="headerlink"href="#switchcity"title="Permalink to this headline">¶</a></h2>
<dlclass="function">
<dtid="switchCity">
<codeclass="descname">switchCity</code><spanclass="sig-paren">(</span><em>cityName</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#switchCity"title="Permalink to this definition">¶</a></dt>
<trclass="field-odd field"><thclass="field-name">Arguments:</th><tdclass="field-body"><ulclass="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>
<divclass="section"id="getstamina">
<h2>getStamina<aclass="headerlink"href="#getstamina"title="Permalink to this headline">¶</a></h2>
<dlclass="function">
<dtid="getStamina">
<codeclass="descname">getStamina</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="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>
<h2>joinBladeburnerFaction<aclass="headerlink"href="#joinbladeburnerfaction"title="Permalink to this headline">¶</a></h2>
<dlclass="function">
<dtid="joinBladeburnerFaction">
<codeclass="descname">joinBladeburnerFaction</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="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
<h2>joinBladeburnerDivision<aclass="headerlink"href="#joinbladeburnerdivision"title="Permalink to this headline">¶</a></h2>
<dlclass="function">
<dtid="joinBladeburnerDivision">
<codeclass="descname">joinBladeburnerDivision</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="headerlink"href="#joinBladeburnerDivision"title="Permalink to this definition">¶</a></dt>
<dd><p>Attempts to join the Bladeburner division.</p>
<p>Returns true if you successfully join the Bladeburner division, or if you
<spanclass="n">tprint</span><spanclass="p">(</span><spanclass="s2">"Trying to upgradeSkill: "</span><spanclass="o">+</span><spanclass="n">bladeburner</span><spanclass="o">.</span><spanclass="n">upgradeSkill</span><spanclass="p">(</span><spanclass="s2">"Cloak"</span><spanclass="p">));</span>
<spanclass="n">tprint</span><spanclass="p">(</span><spanclass="s2">"Trying to switch to a nonexistent city: "</span><spanclass="o">+</span><spanclass="n">bladeburner</span><spanclass="o">.</span><spanclass="n">switchCity</span><spanclass="p">(</span><spanclass="s2">"lskgns"</span><spanclass="p">));</span>
<spanclass="n">tprint</span><spanclass="p">(</span><spanclass="s2">"Trying to switch to Chongqing: "</span><spanclass="o">+</span><spanclass="n">bladeburner</span><spanclass="o">.</span><spanclass="n">switchCity</span><spanclass="p">(</span><spanclass="n">chongqing</span><spanclass="p">));</span>
<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>
<divclass="highlight-default"><divclass="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