Interface Bladeburner

Bladeburner API

Remarks

You have to be employed in the Bladeburner division and be in BitNode-7 or have Source-File 7 in order to use this API.

interface Bladeburner {
    getActionAutolevel(type, name): boolean;
    getActionCountRemaining(type, name): number;
    getActionCurrentLevel(type, name): number;
    getActionCurrentTime(): number;
    getActionEstimatedSuccessChance(type, name): [number, number];
    getActionMaxLevel(type, name): number;
    getActionRepGain(type, name, level): number;
    getActionSuccesses(type, name): number;
    getActionTime(type, name): number;
    getBlackOpNames(): string[];
    getBlackOpRank(name): number;
    getBonusTime(): number;
    getCity(): CityName;
    getCityChaos(city): number;
    getCityCommunities(city): number;
    getCityEstimatedPopulation(city): number;
    getContractNames(): string[];
    getCurrentAction(): null | BladeburnerCurAction;
    getGeneralActionNames(): string[];
    getNextBlackOp(): null | {
        name: string;
        rank: number;
    };
    getOperationNames(): string[];
    getRank(): number;
    getSkillLevel(skillName): number;
    getSkillNames(): string[];
    getSkillPoints(): number;
    getSkillUpgradeCost(skillName, count?): number;
    getStamina(): [number, number];
    getTeamSize(type, name): number;
    inBladeburner(): boolean;
    joinBladeburnerDivision(): boolean;
    joinBladeburnerFaction(): boolean;
    nextUpdate(): Promise<number>;
    setActionAutolevel(type, name, autoLevel): void;
    setActionLevel(type, name, level): void;
    setTeamSize(type, name, size): number;
    startAction(type, name): boolean;
    stopBladeburnerAction(): void;
    switchCity(city): boolean;
    upgradeSkill(skillName, count?): boolean;
}

Methods

  • Get whether an action is set to autolevel.

    Parameters

    • type: string

      Type of action.

    • name: string

      Name of action. Must be an exact match.

    Returns boolean

    True if the action is set to autolevel, and false otherwise.

    Remarks

    RAM cost: 4 GB

    Return a boolean indicating whether or not this action is currently set to autolevel.

    Returns false if an invalid action is specified.

  • Get action count remaining.

    Parameters

    • type: string

      Type of action.

    • name: string

      Name of action. Must be an exact match.

    Returns number

    Remaining count of the specified action.

    Remarks

    RAM cost: 4 GB

    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. This function will return 1 for BlackOps not yet completed regardless of whether the player has the required rank to attempt the mission or not.

  • Get the current level of an action.

    Parameters

    • type: string

      Type of action.

    • name: string

      Name of action. Must be an exact match.

    Returns number

    Current level of the specified action.

    Remarks

    RAM cost: 4 GB

    Returns the current level of this action.

    Returns -1 if an invalid action is specified.

  • Get the time elapsed on current action.

    Returns number

    Number of milliseconds already spent on the current action.

    Remarks

    RAM cost: 4 GB

    Returns the number of milliseconds already spent on the current action.

  • Get estimate success chance of an action.

    Parameters

    • type: string

      Type of action.

    • name: string

      Name of action. Must be an exact match.

    Returns [number, number]

    Estimated success chance for the specified action.

    Remarks

    RAM cost: 4 GB

    Returns the estimated success chance for the specified action. This chance is returned as a decimal value, NOT a percentage (e.g. if you have an estimated success chance of 80%, then this function will return 0.80, NOT 80). Returns 2 values, value[0] - MIN Chance, value[1] - MAX Chance

  • Get the maximum level of an action.

    Parameters

    • type: string

      Type of action.

    • name: string

      Name of action. Must be an exact match.

    Returns number

    Maximum level of the specified action.

    Remarks

    RAM cost: 4 GB

    Returns the maximum level for this action.

    Returns -1 if an invalid action is specified.

  • Get the reputation gain of an action.

    Parameters

    • type: string

      Type of action.

    • name: string

      Name of action. Must be an exact match.

    • level: number

      Optional number. Action level at which to calculate the gain. Will be the action's current level if not given.

    Returns number

    Average Bladeburner reputation gain for successfully completing the specified action.

    Remarks

    RAM cost: 4 GB

    Returns the average Bladeburner reputation gain for successfully completing the specified action. Note that this value is an ‘average’ and the real reputation gain may vary slightly from this value.

  • Get action successes.

    Parameters

    • type: string

      Type of action.

    • name: string

      Name of action. Must be an exact match.

    Returns number

    a number with how many successes you have with action.

    Remarks

    RAM cost: 4 GB

    Return a number with how many successes you have with action.

  • Get the time to complete an action.

    Parameters

    • type: string

      Type of action.

    • name: string

      Name of action. Must be an exact match.

    Returns number

    Number of milliseconds it takes to complete the specified action.

    Remarks

    RAM cost: 4 GB

    Returns the number of milliseconds it takes to complete the specified action

  • List all black ops.

    Returns string[]

    Array of strings containing the names of all Bladeburner Black Ops.

    Remarks

    RAM cost: 0.4 GB

    Returns an array of strings containing the names of all Bladeburner Black Ops.

  • Get black op required rank.

    Parameters

    • name: string

      Name of BlackOp. Must be an exact match.

    Returns number

    Rank required to complete this BlackOp.

    Remarks

    RAM cost: 2 GB

    Returns the rank required to complete this BlackOp.

    Returns -1 if an invalid action is specified.

  • Get Bladeburner bonus time.

    Returns number

    Amount of accumulated “bonus time” (milliseconds) for the Bladeburner mechanic.

    Remarks

    RAM cost: 0 GB

    Returns the amount of accumulated “bonus time” (milliseconds) for the Bladeburner mechanic.

    “Bonus time” is accumulated when the game is offline or if the game is inactive in the browser.

    “Bonus time” makes the game progress faster, up to 5x the normal speed. For example, if an action takes 30 seconds to complete, but you’ve accumulated over 30 seconds in bonus time, then the action will only take 6 seconds in real life to complete.

  • Get current city.

    Returns CityName

    City that the player is currently in (for Bladeburner).

    Remarks

    RAM cost: 4 GB

    Returns the city that the player is currently in (for Bladeburner).

  • Get chaos of a city.

    Parameters

    • city: CityName | "Aevum" | "Chongqing" | "Sector-12" | "New Tokyo" | "Ishima" | "Volhaven"

      Name of city. Case-sensitive

    Returns number

    Chaos in the specified city.

    Remarks

    RAM cost: 4 GB

    Returns the chaos in the specified city, or -1 if an invalid city was specified.

  • Get number of communities in a city.

    Parameters

    • city: CityName | "Aevum" | "Chongqing" | "Sector-12" | "New Tokyo" | "Ishima" | "Volhaven"

      Name of city. Case-sensitive

    Returns number

    Number of Synthoids communities in the specified city.

    Remarks

    RAM cost: 4 GB

    Returns the estimated number of Synthoid communities in the specified city, or -1 if an invalid city was specified.

  • Get estimated population in city.

    Parameters

    • city: CityName | "Aevum" | "Chongqing" | "Sector-12" | "New Tokyo" | "Ishima" | "Volhaven"

      Name of city. Case-sensitive

    Returns number

    Estimated number of Synthoids in the specified city.

    Remarks

    RAM cost: 4 GB

    Returns the estimated number of Synthoids in the specified city, or -1 if an invalid city was specified.

  • List all contracts.

    Returns string[]

    Array of strings containing the names of all Bladeburner contracts.

    Remarks

    RAM cost: 0.4 GB

    Returns an array of strings containing the names of all Bladeburner contracts.

  • List all general actions.

    Returns string[]

    Array of strings containing the names of all general Bladeburner actions.

    Remarks

    RAM cost: 0.4 GB

    Returns an array of strings containing the names of all general Bladeburner actions.

  • Get an object with the name and rank requirement of the next BlackOp that can be completed.

    Returns null | {
        name: string;
        rank: number;
    }

    An object with the .name and .rank properties of the available BlackOp, or null.

    Remarks

    RAM cost: 2 GB

    Returns the name and rank requirement for the available BlackOp. Returns null if no BlackOps remain in the BitNode.

  • List all operations.

    Returns string[]

    Array of strings containing the names of all Bladeburner operations.

    Remarks

    RAM cost: 0.4 GB

    Returns an array of strings containing the names of all Bladeburner operations.

  • Get player bladeburner rank.

    Returns number

    Player’s Bladeburner Rank.

    Remarks

    RAM cost: 4 GB

    Returns the player’s Bladeburner Rank.

  • Get skill level.

    Parameters

    • skillName: string

      Name of skill. Case-sensitive and must be an exact match.

    Returns number

    Level in the specified skill.

    Remarks

    RAM cost: 4 GB

    This function returns your level in the specified skill.

    The function returns -1 if an invalid skill name is passed in.

  • List all skills.

    Returns string[]

    Array of strings containing the names of all general Bladeburner skills.

    Remarks

    RAM cost: 0.4 GB

    Returns an array of strings containing the names of all general Bladeburner skills.

  • Get bladeburner skill points.

    Returns number

    Number of Bladeburner skill points you have.

    Remarks

    RAM cost: 4 GB

    Returns the number of Bladeburner skill points you have.

  • Get cost to upgrade skill.

    Parameters

    • skillName: string

      Name of skill. Case-sensitive and must be an exact match.

    • Optional count: number

      Number of times to upgrade the skill. Defaults to 1 if not specified.

    Returns number

    Number of skill points needed to upgrade the specified skill.

    Remarks

    RAM cost: 4 GB

    This function returns the number of skill points needed to upgrade the specified skill the specified number of times.

    The function returns -1 if an invalid skill name is passed in, and Infinity if the count overflows the maximum level.

  • Get Bladeburner stamina.

    Returns [number, number]

    Array containing current stamina and max stamina.

    Remarks

    RAM cost: 4 GB Returns an array with two elements:

    • [Current stamina, Max stamina]

    Example

    function getStaminaPercentage() {
    const [current, max] = ns.bladeburner.getStamina();
    return current / max;
    }
  • Get team size.

    Parameters

    • type: string

      Type of action.

    • name: string

      Name of action. Must be an exact match.

    Returns number

    Number of Bladeburner team members that were assigned to the specified action.

    Remarks

    RAM cost: 4 GB

    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.

  • Returns whether player is a member of Bladeburner division. Does not require API access.

    Returns boolean

    whether player is a member of Bladeburner division.

    Remarks

    RAM cost: 1 GB

  • Join the Bladeburner division.

    Returns boolean

    True if you successfully join the Bladeburner division, or if you are already a member, false otherwise.

    Remarks

    RAM cost: 4 GB

    Attempts to join the Bladeburner division.

    Returns true if you successfully join the Bladeburner division, or if you are already a member.

    Returns false otherwise.

  • Join the Bladeburner faction.

    Returns boolean

    True if you successfully join the Bladeburner faction, or if you are already a member, false otherwise.

    Remarks

    RAM cost: 4 GB 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.

  • Sleep until the next Bladeburner update has happened.

    Returns Promise<number>

    Promise that resolves to the number of milliseconds of Bladeburner time that were processed in the previous update (1000 - 5000 ms).

    Remarks

    RAM cost: 1 GB

    The amount of real time spent asleep between updates can vary due to "bonus time" (usually 1 second).

    Example

    while (true) {
    const duration = await ns.bladeburner.nextUpdate();
    ns.print(`Bladeburner Division completed ${ns.tFormat(duration)} of actions.`);
    ns.print(`Bonus time remaining: ${ns.tFormat(ns.bladeburner.getBonusTime())}`);
    // Manage the Bladeburner division
    }
  • Set an action autolevel.

    Parameters

    • type: string

      Type of action.

    • name: string

      Name of action. Must be an exact match.

    • autoLevel: boolean

      Whether or not to autolevel this action

    Returns void

    Remarks

    RAM cost: 4 GB

    Enable/disable autoleveling for the specified action.

  • Set the level of an action.

    Parameters

    • type: string

      Type of action.

    • name: string

      Name of action. Must be an exact match.

    • level: number

      Level to set this action to.

    Returns void

    Remarks

    RAM cost: 4 GB

    Set the level for the specified action.

  • Set team size.

    Parameters

    • type: string

      Type of action.

    • name: string

      Name of action. Must be an exact match.

    • size: number

      Number of team members to set. Will be converted using Math.round().

    Returns number

    Number of Bladeburner team members you assigned to the specified action.

    Remarks

    RAM cost: 4 GB

    Set the team size for the specified Bladeburner action.

    Returns the team size that was set, or -1 if the function failed.

  • Start an action.

    Parameters

    • type: string

      Type of action.

    • name: string

      Name of action. Must be an exact match

    Returns boolean

    True if the action was started successfully, and false otherwise.

    Remarks

    RAM cost: 4 GB

    Attempts to start the specified Bladeburner action. Returns true if the action was started successfully, and false otherwise.

    Example

    ns.bladeburner.startAction("Contracts", "Tracking")

    // This will start the Bladeburner Contracts action of Tracking
  • Stop current action.

    Returns void

    Remarks

    RAM cost: 2 GB

    Stops the current Bladeburner action.

  • Travel to another city in Bladeburner.

    Parameters

    • city: CityName | "Aevum" | "Chongqing" | "Sector-12" | "New Tokyo" | "Ishima" | "Volhaven"

      Name of city. Case-sensitive

    Returns boolean

    true if successful, and false otherwise

    Remarks

    RAM cost: 4 GB Attempts to switch to the specified city (for Bladeburner only).

    Returns true if successful, and false otherwise

  • Upgrade skill.

    Parameters

    • skillName: string

      Name of skill to be upgraded. Case-sensitive and must be an exact match.

    • Optional count: number

      Number of times to upgrade the skill. Defaults to 1 if not specified.

    Returns boolean

    true if the skill is successfully upgraded, and false otherwise.

    Remarks

    RAM cost: 4 GB

    Attempts to upgrade the specified Bladeburner skill the specified number of times.

    Returns true if the skill is successfully upgraded, and false otherwise.