Interface Corporation

Corporation API

interface Corporation {
    acceptInvestmentOffer(): boolean;
    bribe(factionName, amountCash): boolean;
    bulkPurchase(divisionName, city, materialName, amt): void;
    buyBackShares(amount): void;
    buyMaterial(divisionName, city, materialName, amt): void;
    buyTea(divisionName, city): boolean;
    cancelExportMaterial(sourceDivision, sourceCity, targetDivision, targetCity, materialName): void;
    createCorporation(corporationName, selfFund): boolean;
    discontinueProduct(divisionName, productName): void;
    expandCity(divisionName, city): void;
    expandIndustry(industryType, divisionName): void;
    exportMaterial(sourceDivision, sourceCity, targetDivision, targetCity, materialName, amt): void;
    getBonusTime(): number;
    getConstants(): CorpConstants;
    getCorporation(): CorporationInfo;
    getDivision(divisionName): Division;
    getHireAdVertCost(divisionName): number;
    getHireAdVertCount(divisionName): number;
    getIndustryData(industryName): CorpIndustryData;
    getInvestmentOffer(): InvestmentOffer;
    getMaterial(divisionName, city, materialName): Material;
    getMaterialData(materialName): CorpMaterialConstantData;
    getOffice(divisionName, city): Office;
    getOfficeSizeUpgradeCost(divisionName, city, size): number;
    getProduct(divisionName, cityName, productName): Product;
    getResearchCost(divisionName, researchName): number;
    getUnlockCost(upgradeName): number;
    getUpgradeLevel(upgradeName): number;
    getUpgradeLevelCost(upgradeName): number;
    getUpgradeWarehouseCost(divisionName, city, amt?): number;
    getWarehouse(divisionName, city): Warehouse;
    goPublic(numShares): boolean;
    hasCorporation(): boolean;
    hasResearched(divisionName, researchName): boolean;
    hasUnlock(upgradeName): boolean;
    hasWarehouse(divisionName, city): boolean;
    hireAdVert(divisionName): void;
    hireEmployee(divisionName, city, employeePosition?): boolean;
    issueDividends(rate): void;
    issueNewShares(amount?): number;
    levelUpgrade(upgradeName): void;
    limitMaterialProduction(divisionName, city, materialName, qty): void;
    limitProductProduction(divisionName, city, productName, qty): void;
    makeProduct(divisionName, city, productName, designInvest, marketingInvest): void;
    nextUpdate(): Promise<CorpStateName>;
    purchaseUnlock(upgradeName): void;
    purchaseWarehouse(divisionName, city): void;
    research(divisionName, researchName): void;
    sellDivision(divisionName): void;
    sellMaterial(divisionName, city, materialName, amt, price): void;
    sellProduct(divisionName, city, productName, amt, price, all): void;
    sellShares(amount): void;
    setAutoJobAssignment(divisionName, city, job, amount): boolean;
    setMaterialMarketTA1(divisionName, city, materialName, on): void;
    setMaterialMarketTA2(divisionName, city, materialName, on): void;
    setProductMarketTA1(divisionName, productName, on): void;
    setProductMarketTA2(divisionName, productName, on): void;
    setSmartSupply(divisionName, city, enabled): void;
    setSmartSupplyOption(divisionName, city, materialName, option): void;
    throwParty(divisionName, city, costPerEmployee): number;
    upgradeOfficeSize(divisionName, city, size): void;
    upgradeWarehouse(divisionName, city, amt?): void;
}

Hierarchy (view full)

Methods

  • Accept investment based on you companies current valuation

    Returns boolean

    An offer of investment

    Remarks

    Is based on current valuation and will not honer a specific Offer

  • Bribe a faction

    Parameters

    • factionName: string

      Faction name

    • amountCash: number

      Amount of money to bribe

    Returns boolean

    True if successful, false if not

  • Set material to bulk buy

    Parameters

    • divisionName: string

      Name of the division

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

      Name of the city

    • materialName: string

      Name of the material

    • amt: number

      Amount of material to buy

    Returns void

  • Buyback Shares. Spend money from the player's wallet to transfer shares from public traders to the CEO.

    Parameters

    • amount: number

      Amount of shares to buy back, must be integer and larger than 0

    Returns void

  • Set material buy data

    Parameters

    • divisionName: string

      Name of the division

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

      Name of the city

    • materialName: string

      Name of the material

    • amt: number

      Amount of material to buy

    Returns void

  • Buy tea for your employees

    Parameters

    • divisionName: string

      Name of the division

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

      Name of the city

    Returns boolean

    true if buying tea was successful, false otherwise

  • Cancel material export

    Parameters

    • sourceDivision: string

      Source division

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

      Source city

    • targetDivision: string

      Target division

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

      Target city

    • materialName: string

      Name of the material

    Returns void

  • Create a Corporation

    Parameters

    • corporationName: string

      Name of the corporation

    • selfFund: boolean

      If you should self fund, defaults to true, false will only work on Bitnode 3

    Returns boolean

    true if created and false if not

  • Expand to a new city

    Parameters

    • divisionName: string

      Name of the division

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

      Name of the city

    Returns void

  • Set material export data

    Parameters

    • sourceDivision: string

      Source division

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

      Source city

    • targetDivision: string

      Target division

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

      Target city

    • materialName: string

      Name of the material

    • amt: string | number

      Amount of material to export.

    Returns void

  • Get bonus time. “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.

    Returns number

    Bonus time for the Corporation mechanic in milliseconds.

  • Cost to Upgrade office size.

    Parameters

    • divisionName: string

      Name of the division

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

      Name of the city

    • size: number

      Amount of positions to open

    Returns number

    Cost of upgrading the office

  • Get product data

    Parameters

    • divisionName: string

      Name of the division

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

      Name of the city

    • productName: string

      Name of the product

    Returns Product

    product data

  • Get the cost to unlock research

    Parameters

    • divisionName: string

      Name of the division

    • researchName: string

      Name of the research

    Returns number

    cost

  • Gets the cost to unlock a one time unlockable upgrade

    Parameters

    • upgradeName: string

      Name of the upgrade

    Returns number

    cost of the upgrade

  • Get the level of a levelable upgrade

    Parameters

    • upgradeName: string

      Name of the upgrade

    Returns number

    the level of the upgrade

  • Gets the cost to unlock the next level of a levelable upgrade

    Parameters

    • upgradeName: string

      Name of the upgrade

    Returns number

    cost of the upgrade

  • Gets the cost to upgrade a warehouse to the next level

    Parameters

    • divisionName: string

      Name of the division

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

      Name of the city

    • Optional amt: number

      amount of upgrades. Optional, defaults to 1

    Returns number

    cost to upgrade

  • Go public

    Parameters

    • numShares: number

      number of shares you would like to issue for your IPO

    Returns boolean

    true if you successfully go public, false if not

  • Returns whether the player has a corporation. Does not require API access.

    Returns boolean

    whether the player has a corporation

  • Gets if you have unlocked a research

    Parameters

    • divisionName: string

      Name of the division

    • researchName: string

      Name of the research

    Returns boolean

    true is unlocked, false if not

  • Check if you have a one time unlockable upgrade

    Parameters

    • upgradeName: string

      Name of the upgrade

    Returns boolean

    true if unlocked and false if not

  • Check if you have a warehouse in city

    Parameters

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

    Returns boolean

    true if warehouse is present, false if not

  • Hire an employee.

    Parameters

    • divisionName: string

      Name of the division

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

      Name of the city

    • Optional employeePosition: CorpEmployeePosition

      Position to place into. Defaults to "Unassigned".

    Returns boolean

    True if an employee was hired, false otherwise

  • Issue dividends

    Parameters

    • rate: number

      Fraction of profit to issue as dividends.

    Returns void

  • Issue new shares

    Parameters

    • Optional amount: number

      Number of new shares to issue, will be rounded to nearest 10m. Defaults to max amount.

    Returns number

    Amount of funds generated for the corporation.

  • Level an upgrade.

    Parameters

    • upgradeName: string

      Name of the upgrade

    Returns void

  • Limit Material Production.

    Parameters

    • divisionName: string

      Name of the division.

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

      Name of the city.

    • materialName: string

      Name of the material.

    • qty: number

      Amount to limit to. Pass a negative value to remove the limit instead.

    Returns void

  • Limit Product Production.

    Parameters

    • divisionName: string

      Name of the division.

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

      Name of the city.

    • productName: string

      Name of the product.

    • qty: number

      Amount to limit to. Pass a negative value to remove the limit instead.

    Returns void

  • Create a new product

    Parameters

    • divisionName: string

      Name of the division

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

      Name of the city

    • productName: string

      Name of the product

    • designInvest: number

      Amount to invest for the design of the product.

    • marketingInvest: number

      Amount to invest for the marketing of the product.

    Returns void

  • Sleep until the next Corporation update has happened.

    Returns Promise<CorpStateName>

    Promise that resolves to the name of the state that was just processed.

    I.e. when the state is PURCHASE, it means purchasing has just happened. Note that this is the state just before getCorporation().state.

    Possible states are START, PURCHASE, PRODUCTION, EXPORT, SALE.

    Remarks

    RAM cost: 1 GB

    The amount of real time spent asleep between updates can vary due to "bonus time" (usually 200 milliseconds - 2 seconds).

    Example

    while (true) {
    const prevState = await ns.corporation.nextUpdate();
    const nextState = ns.corporation.getCorporation().state;
    ns.print(`Corporation finished with ${prevState}, next will be ${nextState}.`);
    // Manage the Corporation
    }
  • Unlock an upgrade

    Parameters

    • upgradeName: string

      Name of the upgrade

    Returns void

  • Purchase a research

    Parameters

    • divisionName: string

      Name of the division

    • researchName: string

      Name of the research

    Returns void

  • Sell a division

    Parameters

    • divisionName: string

      Name of the division

    Returns void

    Remarks

    RAM cost: 20 GB

  • Set material sell data.

    Parameters

    • divisionName: string

      Name of the division

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

      Name of the city

    • materialName: string

      Name of the material

    • amt: string

      Amount to sell, can be "MAX"

    • price: string

      Price to sell, can be "MP"

    Returns void

  • Set product sell data.

    Parameters

    • divisionName: string

      Name of the division

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

      Name of the city

    • productName: string

      Name of the product

    • amt: string

      Amount to sell, can be "MAX"

    • price: string

      Price to sell, can be "MP"

    • all: boolean

      Set sell amount and price in all cities

    Returns void

  • Sell Shares. Transfer shares from the CEO to public traders to receive money in the player's wallet.

    Parameters

    • amount: number

      Amount of shares to sell, must be integer between 1 and 100t

    Returns void

  • Set the auto job assignment for a job

    Parameters

    • divisionName: string

      Name of the division

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

      Name of the city

    • job: string

      Name of the job

    • amount: number

      Number of employees to assign to that job

    Returns boolean

    true if the employee count reached the target amount, false if not

  • Set market TA 1 for a material.

    Parameters

    • divisionName: string

      Name of the division

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

      Name of the city

    • materialName: string

      Name of the material

    • on: boolean

      market ta enabled

    Returns void

  • Set market TA 2 for a material.

    Parameters

    • divisionName: string

      Name of the division

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

      Name of the city

    • materialName: string

      Name of the material

    • on: boolean

      market ta enabled

    Returns void

  • Set market TA 1 for a product.

    Parameters

    • divisionName: string

      Name of the division

    • productName: string

      Name of the product

    • on: boolean

      market ta enabled

    Returns void

  • Set market TA 2 for a product.

    Parameters

    • divisionName: string

      Name of the division

    • productName: string

      Name of the product

    • on: boolean

      market ta enabled

    Returns void

  • Set smart supply

    Parameters

    • divisionName: string

      Name of the division

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

      Name of the city

    • enabled: boolean

      smart supply enabled

    Returns void

  • Set whether smart supply uses leftovers before buying

    Parameters

    • divisionName: string

      Name of the division

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

      Name of the city

    • materialName: string

      Name of the material

    • option: CorpSmartSupplyOption

      smart supply option, "leftovers" to use leftovers, "imports" to use only imported materials, "none" to not use materials from store

    Returns void

  • Throw a party for your employees

    Parameters

    • divisionName: string

      Name of the division

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

      Name of the city

    • costPerEmployee: number

      Amount to spend per employee.

    Returns number

    Multiplier for morale, or zero on failure

  • Upgrade office size.

    Parameters

    • divisionName: string

      Name of the division

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

      Name of the city

    • size: number

      Amount of positions to open

    Returns void

  • Upgrade warehouse

    Parameters

    • divisionName: string

      Name of the division

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

      Name of the city

    • Optional amt: number

      amount of upgrades defaults to 1

    Returns void