bitburner-src/dist/bitburner.d.ts

7437 lines
245 KiB
TypeScript
Raw Normal View History

2021-12-03 22:14:13 +01:00
/**
* @public
*/
export declare interface ActiveFragment {
id: number;
2022-04-13 07:35:35 +02:00
highestCharge: number;
2021-12-03 22:14:13 +01:00
numCharge: number;
rotation: number;
x: number;
y: number;
}
2021-10-30 18:34:14 +02:00
/**
2021-10-30 21:46:34 +02:00
* Data representing the internal values of an Augmentation.
2021-10-30 18:34:14 +02:00
* @public
*/
export declare interface AugmentationStats {
2022-03-17 21:50:46 +01:00
/** Multiplier to hacking skill */
2022-08-17 14:50:05 +02:00
hacking?: number;
2022-03-17 21:50:46 +01:00
/** Multiplier to strength skill */
2022-08-17 14:50:05 +02:00
strength?: number;
2022-03-17 21:50:46 +01:00
/** Multiplier to defense skill */
2022-08-17 14:50:05 +02:00
defense?: number;
2022-03-17 21:50:46 +01:00
/** Multiplier to dexterity skill */
2022-08-17 14:50:05 +02:00
dexterity?: number;
2022-03-17 21:50:46 +01:00
/** Multiplier to agility skill */
2022-08-17 14:50:05 +02:00
agility?: number;
2022-03-17 21:50:46 +01:00
/** Multiplier to charisma skill */
2022-08-17 14:50:05 +02:00
charisma?: number;
2022-03-17 21:50:46 +01:00
/** Multiplier to hacking experience gain rate */
2022-08-17 14:50:05 +02:00
hacking_exp?: number;
2022-03-17 21:50:46 +01:00
/** Multiplier to strength experience gain rate */
2022-08-17 14:50:05 +02:00
strength_exp?: number;
2022-03-17 21:50:46 +01:00
/** Multiplier to defense experience gain rate */
2022-08-17 14:50:05 +02:00
defense_exp?: number;
2022-03-17 21:50:46 +01:00
/** Multiplier to dexterity experience gain rate */
2022-08-17 14:50:05 +02:00
dexterity_exp?: number;
2022-03-17 21:50:46 +01:00
/** Multiplier to agility experience gain rate */
2022-08-17 14:50:05 +02:00
agility_exp?: number;
2022-03-17 21:50:46 +01:00
/** Multiplier to charisma experience gain rate */
2022-08-17 14:50:05 +02:00
charisma_exp?: number;
2022-03-17 21:50:46 +01:00
/** Multiplier to chance of successfully performing a hack */
2022-08-17 14:50:05 +02:00
hacking_chance?: number;
2022-03-17 21:50:46 +01:00
/** Multiplier to hacking speed */
2022-08-17 14:50:05 +02:00
hacking_speed?: number;
2022-03-17 21:50:46 +01:00
/** Multiplier to amount of money the player gains from hacking */
2022-08-17 14:50:05 +02:00
hacking_money?: number;
2022-03-17 21:50:46 +01:00
/** Multiplier to amount of money injected into servers using grow */
2022-08-17 14:50:05 +02:00
hacking_grow?: number;
2022-03-17 21:50:46 +01:00
/** Multiplier to amount of reputation gained when working */
2022-08-17 14:50:05 +02:00
company_rep?: number;
2022-03-17 21:50:46 +01:00
/** Multiplier to amount of reputation gained when working */
2022-08-17 14:50:05 +02:00
faction_rep?: number;
2022-03-17 21:50:46 +01:00
/** Multiplier to amount of money gained from crimes */
2022-08-17 14:50:05 +02:00
crime_money?: number;
2022-03-17 21:50:46 +01:00
/** Multiplier to crime success rate */
2022-08-17 14:50:05 +02:00
crime_success?: number;
2022-03-17 21:50:46 +01:00
/** Multiplier to amount of money gained from working */
2022-08-17 14:50:05 +02:00
work_money?: number;
2022-03-17 21:50:46 +01:00
/** Multiplier to amount of money produced by Hacknet Nodes */
2022-08-17 14:50:05 +02:00
hacknet_node_money?: number;
2022-03-17 21:50:46 +01:00
/** Multiplier to cost of purchasing a Hacknet Node */
2022-08-17 14:50:05 +02:00
hacknet_node_purchase_cost?: number;
2022-03-17 21:50:46 +01:00
/** Multiplier to cost of ram for a Hacknet Node */
2022-08-17 14:50:05 +02:00
hacknet_node_ram_cost?: number;
2022-03-17 21:50:46 +01:00
/** Multiplier to cost of core for a Hacknet Node */
2022-08-17 14:50:05 +02:00
hacknet_node_core_cost?: number;
2022-03-17 21:50:46 +01:00
/** Multiplier to cost of leveling up a Hacknet Node */
2022-08-17 14:50:05 +02:00
hacknet_node_level_cost?: number;
2022-03-17 21:50:46 +01:00
/** Multiplier to Bladeburner max stamina */
2022-08-17 14:50:05 +02:00
bladeburner_max_stamina?: number;
2022-03-17 21:50:46 +01:00
/** Multiplier to Bladeburner stamina gain rate */
2022-08-17 14:50:05 +02:00
bladeburner_stamina_gain?: number;
2022-03-17 21:50:46 +01:00
/** Multiplier to effectiveness in Bladeburner Field Analysis */
2022-08-17 14:50:05 +02:00
bladeburner_analysis?: number;
2022-03-17 21:50:46 +01:00
/** Multiplier to success chance in Bladeburner contracts/operations */
2022-08-17 14:50:05 +02:00
bladeburner_success_chance?: number;
2021-10-30 18:34:14 +02:00
}
/**
2021-10-30 21:46:34 +02:00
* Return value of {@link Sleeve.getSleevePurchasableAugs | getSleevePurchasableAugs}
2021-10-30 18:34:14 +02:00
* @public
*/
export declare interface AugmentPair {
/** augmentation name */
2021-11-03 05:27:21 +01:00
name: string;
2021-10-30 18:34:14 +02:00
/** augmentation cost */
cost: number;
}
2022-03-17 21:50:46 +01:00
/**
* Used for autocompletion
* @public
*/
export declare interface AutocompleteData {
servers: string[];
scripts: string[];
txts: string[];
2022-09-23 21:03:38 +02:00
flags(schema: [string, string | number | boolean | string[]][]): { [key: string]: ScriptArg | string[] };
2022-03-17 21:50:46 +01:00
}
2021-10-30 18:34:14 +02:00
/**
2021-10-30 21:46:34 +02:00
* Options to affect the behavior of {@link NS.hack | hack}, {@link NS.grow | grow}, and {@link NS.weaken | weaken}.
2021-10-30 18:34:14 +02:00
* @public
*/
export declare interface BasicHGWOptions {
/** Number of threads to use for this function. Must be less than or equal to the number of threads the script is running with. */
2022-01-08 19:25:06 +01:00
threads?: number;
2021-10-30 21:46:34 +02:00
/** Set to true this action will affect the stock market. */
stock?: boolean;
2021-10-30 18:34:14 +02:00
}
/**
2021-10-30 21:46:34 +02:00
* All multipliers affecting the difficulty of the current challenge.
2021-10-30 18:34:14 +02:00
* @public
*/
export declare interface BitNodeMultipliers {
/** Influences how quickly the player's agility level (not exp) scales */
AgilityLevelMultiplier: number;
/** Influences the base cost to purchase an augmentation. */
AugmentationMoneyCost: number;
/** Influences the base rep the player must have with a faction to purchase an augmentation. */
AugmentationRepCost: number;
/** Influences how quickly the player can gain rank within Bladeburner. */
BladeburnerRank: number;
/** Influences the cost of skill levels from Bladeburner. */
BladeburnerSkillCost: number;
/** Influences how quickly the player's charisma level (not exp) scales */
CharismaLevelMultiplier: number;
/** Influences the experience gained for each ability when a player completes a class. */
ClassGymExpGain: number;
/** Influences the amount of money gained from completing Coding Contracts */
CodingContractMoney: number;
/** Influences the experience gained for each ability when the player completes working their job. */
CompanyWorkExpGain: number;
/** Influences how much money the player earns when completing working their job. */
CompanyWorkMoney: number;
2022-03-17 21:50:46 +01:00
/** Influences the money gain from dividends of corporations created by the player. */
2022-05-24 14:12:49 +02:00
CorporationSoftcap: number;
2021-10-30 18:34:14 +02:00
/** Influences the valuation of corporations created by the player. */
CorporationValuation: number;
/** Influences the base experience gained for each ability when the player commits a crime. */
CrimeExpGain: number;
/** Influences the base money gained when the player commits a crime. */
CrimeMoney: number;
/** Influences how many Augmentations you need in order to get invited to the Daedalus faction */
DaedalusAugsRequirement: number;
/** Influences how quickly the player's defense level (not exp) scales */
DefenseLevelMultiplier: number;
/** Influences how quickly the player's dexterity level (not exp) scales */
DexterityLevelMultiplier: number;
/** Influences how much rep the player gains in each faction simply by being a member. */
FactionPassiveRepGain: number;
/** Influences the experience gained for each ability when the player completes work for a Faction. */
FactionWorkExpGain: number;
/** Influences how much rep the player gains when performing work for a faction. */
FactionWorkRepGain: number;
/** Influences how much it costs to unlock the stock market's 4S Market Data API */
FourSigmaMarketDataApiCost: number;
/** Influences how much it costs to unlock the stock market's 4S Market Data (NOT API) */
FourSigmaMarketDataCost: number;
2022-01-16 00:39:37 +01:00
/** Influences the respect gain and money gain of your gang. */
GangSoftcap: number;
2021-10-30 18:34:14 +02:00
/** Influences the experienced gained when hacking a server. */
HackExpGain: number;
/** Influences how quickly the player's hacking level (not experience) scales */
HackingLevelMultiplier: number;
/** Influences how much money is produced by Hacknet Nodes and the hash rate of Hacknet Servers (unlocked in BitNode-9) */
HacknetNodeMoney: number;
/** Influences how much money it costs to upgrade your home computer's RAM */
HomeComputerRamCost: number;
/** Influences how much money is gained when the player infiltrates a company. */
InfiltrationMoney: number;
/** Influences how much rep the player can gain from factions when selling stolen documents and secrets */
InfiltrationRep: number;
/** Influences how much money can be stolen from a server when the player performs a hack against it through the Terminal. */
ManualHackMoney: number;
/** Influence how much it costs to purchase a server */
PurchasedServerCost: number;
/** Influences the maximum number of purchased servers you can have */
PurchasedServerLimit: number;
/** Influences the maximum allowed RAM for a purchased server */
PurchasedServerMaxRam: number;
2022-01-16 00:39:37 +01:00
/** Influences cost of any purchased server at or above 128GB */
2022-04-13 07:35:35 +02:00
PurchasedServerSoftcap: number;
2021-10-30 18:34:14 +02:00
/** Influences the minimum favor the player must have with a faction before they can donate to gain rep. */
RepToDonateToFaction: number;
2022-01-16 00:39:37 +01:00
/** Influences how much the money on a server can be reduced when a script performs a hack against it. */
2021-10-30 18:34:14 +02:00
ScriptHackMoney: number;
2022-01-16 00:39:37 +01:00
/** Influences how much of the money stolen by a scripted hack will be added to the player's money. */
ScriptHackMoneyGain: number;
2021-10-30 18:34:14 +02:00
/** Influences the growth percentage per cycle against a server. */
ServerGrowthRate: number;
2022-03-17 21:50:46 +01:00
/** Influences the maximum money that a server can grow to. */
2021-10-30 18:34:14 +02:00
ServerMaxMoney: number;
/** Influences the initial money that a server starts with. */
ServerStartingMoney: number;
/** Influences the initial security level (hackDifficulty) of a server. */
ServerStartingSecurity: number;
/** Influences the weaken amount per invocation against a server. */
ServerWeakenRate: number;
/** Influences how quickly the player's strength level (not exp) scales */
StrengthLevelMultiplier: number;
2022-01-16 00:39:37 +01:00
/** Influences the power of the gift */
StaneksGiftPowerMultiplier: number;
/** Influences the size of the gift */
StaneksGiftExtraSize: number;
/** Influences the hacking skill required to backdoor the world daemon. */
WorldDaemonDifficulty: number;
2021-10-30 18:34:14 +02:00
}
/**
2021-11-03 05:27:21 +01:00
* 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.
2021-10-30 18:34:14 +02:00
* @public
*/
export declare interface Bladeburner {
/**
2021-11-03 05:27:21 +01:00
* List all contracts.
* @remarks
* RAM cost: 0.4 GB
2021-10-30 18:34:14 +02:00
*
* Returns an array of strings containing the names of all Bladeburner contracts.
*
* @returns Array of strings containing the names of all Bladeburner contracts.
*/
2021-11-03 05:27:21 +01:00
getContractNames(): string[];
2021-10-30 18:34:14 +02:00
/**
2021-11-03 05:27:21 +01:00
* List all operations.
* @remarks
* RAM cost: 0.4 GB
2021-10-30 18:34:14 +02:00
*
* Returns an array of strings containing the names of all Bladeburner operations.
*
* @returns Array of strings containing the names of all Bladeburner operations.
*/
2021-11-03 05:27:21 +01:00
getOperationNames(): string[];
2021-10-30 18:34:14 +02:00
/**
2021-11-03 05:27:21 +01:00
* List all black ops.
* @remarks
* RAM cost: 0.4 GB
2021-10-30 18:34:14 +02:00
*
* Returns an array of strings containing the names of all Bladeburner Black Ops.
*
* @returns Array of strings containing the names of all Bladeburner Black Ops.
*/
2021-11-03 05:27:21 +01:00
getBlackOpNames(): string[];
2021-10-30 18:34:14 +02:00
/**
2021-11-03 05:27:21 +01:00
* List all general actions.
* @remarks
* RAM cost: 0.4 GB
2021-10-30 18:34:14 +02:00
*
* Returns an array of strings containing the names of all general Bladeburner actions.
*
* @returns Array of strings containing the names of all general Bladeburner actions.
*/
2021-11-03 05:27:21 +01:00
getGeneralActionNames(): string[];
2021-10-30 18:34:14 +02:00
/**
2021-11-03 05:27:21 +01:00
* List all skills.
* @remarks
* RAM cost: 0.4 GB
2021-10-30 18:34:14 +02:00
*
* Returns an array of strings containing the names of all general Bladeburner skills.
*
* @returns Array of strings containing the names of all general Bladeburner skills.
*/
2021-11-03 05:27:21 +01:00
getSkillNames(): string[];
2021-10-30 18:34:14 +02:00
/**
2021-11-03 05:27:21 +01:00
* Start an action.
* @remarks
* RAM cost: 4 GB
2021-10-30 18:34:14 +02:00
*
* Attempts to start the specified Bladeburner action.
* Returns true if the action was started successfully, and false otherwise.
*
* @param type - Type of action.
* @param name - Name of action. Must be an exact match
* @returns True if the action was started successfully, and false otherwise.
*/
2021-11-03 05:27:21 +01:00
startAction(type: string, name: string): boolean;
2021-10-30 18:34:14 +02:00
/**
2021-11-03 05:27:21 +01:00
* Stop current action.
* @remarks
* RAM cost: 2 GB
2021-10-30 18:34:14 +02:00
*
* Stops the current Bladeburner action.
*
*/
stopBladeburnerAction(): void;
/**
2021-11-03 05:27:21 +01:00
* Get current action.
* @remarks
* RAM cost: 1 GB
2021-10-30 18:34:14 +02:00
*
* Returns an object that represents the players current Bladeburner action.
* If the player is not performing an action, the function will return an object with the type property set to Idle.
*
* @returns Object that represents the players current Bladeburner action.
*/
getCurrentAction(): BladeburnerCurAction;
/**
2021-11-03 05:27:21 +01:00
* Get the time to complete an action.
* @remarks
* RAM cost: 4 GB
2021-10-30 18:34:14 +02:00
*
2022-07-16 05:47:19 +02:00
* Returns the number of milliseconds it takes to complete the specified action
2021-10-30 18:34:14 +02:00
*
* @param type - Type of action.
* @param name - Name of action. Must be an exact match.
2021-11-03 05:27:21 +01:00
* @returns Number of milliseconds it takes to complete the specified action.
2021-10-30 18:34:14 +02:00
*/
2021-11-03 05:27:21 +01:00
getActionTime(type: string, name: string): number;
2021-10-30 18:34:14 +02:00
2022-07-16 05:47:19 +02:00
/**
* Get the time elapsed on current action.
* @remarks
* RAM cost: 4 GB
*
* Returns the number of milliseconds already spent on the current action.
*
* @returns Number of milliseconds already spent on the current action.
*/
getActionCurrentTime(): number;
2021-10-30 18:34:14 +02:00
/**
2021-11-03 05:27:21 +01:00
* Get estimate success chance of an action.
* @remarks
* RAM cost: 4 GB
2021-10-30 18:34:14 +02:00
*
* 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).
*
* @param type - Type of action.
* @param name - Name of action. Must be an exact match.
* @returns Estimated success chance for the specified action.
*/
getActionEstimatedSuccessChance(type: string, name: string): [number, number];
2021-10-30 18:34:14 +02:00
/**
2021-11-03 05:27:21 +01:00
* Get the reputation gain of an action.
* @remarks
* RAM cost: 4 GB
2021-10-30 18:34:14 +02:00
*
* 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.
*
* @param type - Type of action.
* @param name - Name of action. Must be an exact match.
* @param level - Optional action level at which to calculate the gain
* @returns Average Bladeburner reputation gain for successfully completing the specified action.
*/
2021-11-03 05:27:21 +01:00
getActionRepGain(type: string, name: string, level: number): number;
2021-10-30 18:34:14 +02:00
/**
2021-11-03 05:27:21 +01:00
* Get action count remaining.
* @remarks
* RAM cost: 4 GB
2021-10-30 18:34:14 +02:00
*
* 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.
2022-03-17 21:50:46 +01:00
* This function will return 1 for BlackOps not yet completed regardless of whether
2021-10-30 18:34:14 +02:00
* the player has the required rank to attempt the mission or not.
*
* @param type - Type of action.
* @param name - Name of action. Must be an exact match.
* @returns Remaining count of the specified action.
*/
2021-11-03 05:27:21 +01:00
getActionCountRemaining(type: string, name: string): number;
2021-10-30 18:34:14 +02:00
/**
2021-11-03 05:27:21 +01:00
* Get the maximum level of an action.
* @remarks
* RAM cost: 4 GB
2021-10-30 18:34:14 +02:00
*
* Returns the maximum level for this action.
*
* Returns -1 if an invalid action is specified.
*
* @param type - Type of action.
* @param name - Name of action. Must be an exact match.
* @returns Maximum level of the specified action.
*/
2021-11-03 05:27:21 +01:00
getActionMaxLevel(type: string, name: string): number;
2021-10-30 18:34:14 +02:00
/**
2021-11-03 05:27:21 +01:00
* Get the current level of an action.
* @remarks
* RAM cost: 4 GB
2021-10-30 18:34:14 +02:00
*
* Returns the current level of this action.
*
* Returns -1 if an invalid action is specified.
*
* @param type - Type of action.
* @param name - Name of action. Must be an exact match.
* @returns Current level of the specified action.
*/
2021-11-03 05:27:21 +01:00
getActionCurrentLevel(type: string, name: string): number;
2021-10-30 18:34:14 +02:00
/**
2022-03-17 21:50:46 +01:00
* Get whether an action is set to autolevel.
2021-11-03 05:27:21 +01:00
* @remarks
* RAM cost: 4 GB
2021-10-30 18:34:14 +02:00
*
* Return a boolean indicating whether or not this action is currently set to autolevel.
*
* Returns false if an invalid action is specified.
*
* @param type - Type of action.
* @param name - Name of action. Must be an exact match.
* @returns True if the action is set to autolevel, and false otherwise.
*/
2021-11-03 05:27:21 +01:00
getActionAutolevel(type: string, name: string): boolean;
2021-10-30 18:34:14 +02:00
/**
2021-11-03 05:27:21 +01:00
* Set an action autolevel.
* @remarks
* RAM cost: 4 GB
2021-10-30 18:34:14 +02:00
*
* Enable/disable autoleveling for the specified action.
*
* @param type - Type of action.
* @param name - Name of action. Must be an exact match.
* @param autoLevel - Whether or not to autolevel this action
*/
2021-11-03 05:27:21 +01:00
setActionAutolevel(type: string, name: string, autoLevel: boolean): void;
2021-10-30 18:34:14 +02:00
/**
2021-11-03 05:27:21 +01:00
* Set the level of an action.
* @remarks
* RAM cost: 4 GB
2021-10-30 18:34:14 +02:00
*
* Set the level for the specified action.
*
* @param type - Type of action.
* @param name - Name of action. Must be an exact match.
* @param level - Level to set this action to.
*/
2021-11-03 05:27:21 +01:00
setActionLevel(type: string, name: string, level: number): void;
2021-10-30 18:34:14 +02:00
/**
2021-11-03 05:27:21 +01:00
* Get player bladeburner rank.
* @remarks
* RAM cost: 4 GB
2021-10-30 18:34:14 +02:00
*
* Returns the players Bladeburner Rank.
*
* @returns Players Bladeburner Rank.
*/
getRank(): number;
/**
2021-11-03 05:27:21 +01:00
* Get black op required rank.
* @remarks
* RAM cost: 2 GB
2021-10-30 18:34:14 +02:00
*
* Returns the rank required to complete this BlackOp.
*
* Returns -1 if an invalid action is specified.
*
* @param name - Name of BlackOp. Must be an exact match.
* @returns Rank required to complete this BlackOp.
*/
2021-11-03 05:27:21 +01:00
getBlackOpRank(name: string): number;
2021-10-30 18:34:14 +02:00
/**
2021-11-03 05:27:21 +01:00
* Get bladeburner skill points.
* @remarks
* RAM cost: 4 GB
2021-10-30 18:34:14 +02:00
*
* Returns the number of Bladeburner skill points you have.
*
* @returns Number of Bladeburner skill points you have.
*/
getSkillPoints(): number;
/**
2021-11-03 05:27:21 +01:00
* Get skill level.
* @remarks
* RAM cost: 4 GB
2021-10-30 18:34:14 +02:00
*
* This function returns your level in the specified skill.
*
* The function returns -1 if an invalid skill name is passed in.
*
* @param skillName - Name of skill. Case-sensitive and must be an exact match
* @returns Level in the specified skill.
*/
2021-11-03 05:27:21 +01:00
getSkillLevel(name: string): number;
2021-10-30 18:34:14 +02:00
/**
2021-11-03 05:27:21 +01:00
* Get cost to upgrade skill.
* @remarks
* RAM cost: 4 GB
2021-10-30 18:34:14 +02:00
*
2022-07-16 05:47:19 +02:00
* This function returns the number of skill points needed to upgrade the specified skill the specified number of times.
2021-10-30 18:34:14 +02:00
*
* The function returns -1 if an invalid skill name is passed in.
*
* @param skillName - Name of skill. Case-sensitive and must be an exact match
2022-07-16 05:47:19 +02:00
* @param count - Number of times to upgrade the skill. Defaults to 1 if not specified.
2021-10-30 18:34:14 +02:00
* @returns Number of skill points needed to upgrade the specified skill.
*/
2022-07-16 05:47:19 +02:00
getSkillUpgradeCost(name: string, count?: number): number;
2021-10-30 18:34:14 +02:00
/**
2021-11-03 05:27:21 +01:00
* Upgrade skill.
* @remarks
* RAM cost: 4 GB
2021-10-30 18:34:14 +02:00
*
2022-07-16 05:47:19 +02:00
* Attempts to upgrade the specified Bladeburner skill the specified number of times.
2021-10-30 18:34:14 +02:00
*
* Returns true if the skill is successfully upgraded, and false otherwise.
*
* @param skillName - Name of skill to be upgraded. Case-sensitive and must be an exact match
2022-07-16 05:47:19 +02:00
* @param count - Number of times to upgrade the skill. Defaults to 1 if not specified.
2021-10-30 18:34:14 +02:00
* @returns true if the skill is successfully upgraded, and false otherwise.
*/
2022-07-16 05:47:19 +02:00
upgradeSkill(name: string, count?: number): boolean;
2021-10-30 18:34:14 +02:00
/**
2021-11-03 05:27:21 +01:00
* Get team size.
* @remarks
* RAM cost: 4 GB
2021-10-30 18:34:14 +02:00
*
* 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.
*
* @param type - Type of action.
* @param name - Name of action. Must be an exact match.
* @returns Number of Bladeburner team members that were assigned to the specified action.
*/
2021-11-03 05:27:21 +01:00
getTeamSize(type: string, name: string): number;
2021-10-30 18:34:14 +02:00
/**
2021-11-03 05:27:21 +01:00
* Set team size.
* @remarks
* RAM cost: 4 GB
2021-10-30 18:34:14 +02:00
*
* Set the team size for the specified Bladeburner action.
*
* Returns the team size that was set, or -1 if the function failed.
*
* @param type - Type of action.
* @param name - Name of action. Must be an exact match.
* @param size - Number of team members to set. Will be converted using Math.round().
* @returns Number of Bladeburner team members you assigned to the specified action.
*/
2021-11-03 05:27:21 +01:00
setTeamSize(type: string, name: string, size: number): number;
2021-10-30 18:34:14 +02:00
/**
2021-11-03 05:27:21 +01:00
* Get estimated population in city.
* @remarks
* RAM cost: 4 GB
2021-10-30 18:34:14 +02:00
*
* Returns the estimated number of Synthoids in the specified city,
* or -1 if an invalid city was specified.
*
* @param cityName - Name of city. Case-sensitive
* @returns Estimated number of Synthoids in the specified city.
*/
2021-11-03 05:27:21 +01:00
getCityEstimatedPopulation(name: string): number;
2021-10-30 18:34:14 +02:00
/**
2021-11-03 05:27:21 +01:00
* Get number of communities in a city.
* @remarks
* RAM cost: 4 GB
2021-10-30 18:34:14 +02:00
*
* Returns the estimated number of Synthoid communities in the specified city,
* or -1 if an invalid city was specified.
*
* @param cityName - Name of city. Case-sensitive
* @returns Number of Synthoids communities in the specified city.
*/
2021-11-03 05:27:21 +01:00
getCityCommunities(name: string): number;
2021-10-30 18:34:14 +02:00
/**
2021-11-03 05:27:21 +01:00
* Get chaos of a city.
* @remarks
* RAM cost: 4 GB
2021-10-30 18:34:14 +02:00
*
* Returns the chaos in the specified city,
* or -1 if an invalid city was specified.
*
* @param cityName - Name of city. Case-sensitive
* @returns Chaos in the specified city.
*/
2021-11-03 05:27:21 +01:00
getCityChaos(name: string): number;
2021-10-30 18:34:14 +02:00
/**
2021-11-03 05:27:21 +01:00
* Get current city.
* @remarks
* RAM cost: 4 GB
2021-10-30 18:34:14 +02:00
*
* Returns the city that the player is currently in (for Bladeburner).
*
* @returns City that the player is currently in (for Bladeburner).
*/
2021-11-03 05:27:21 +01:00
getCity(): string;
2021-10-30 18:34:14 +02:00
/**
2021-11-03 05:27:21 +01:00
* Travel to another city in bladeburner.
* @remarks
* RAM cost: 4 GB
2021-10-30 18:34:14 +02:00
* Attempts to switch to the specified city (for Bladeburner only).
*
* Returns true if successful, and false otherwise
*
* @param cityName - Name of city. Case-sensitive
* @returns true if successful, and false otherwise
*/
2021-11-03 05:27:21 +01:00
switchCity(name: string): boolean;
2021-10-30 18:34:14 +02:00
/**
2021-11-03 05:27:21 +01:00
* Get bladeburner stamina.
* @remarks
* RAM cost: 4 GB
2021-10-30 18:34:14 +02:00
* Returns an array with two elements:
* * [Current stamina, Max stamina]
* @example
2021-10-30 21:46:34 +02:00
* ```ts
2022-01-08 19:25:06 +01:00
* // NS1:
2021-10-30 18:34:14 +02:00
* function getStaminaPercentage() {
2022-01-08 19:25:06 +01:00
* var res = bladeburner.getStamina();
2021-10-30 18:34:14 +02:00
* return res[0] / res[1];
* }
* ```
2022-01-08 19:25:06 +01:00
* @example
* ```ts
* // NS2:
* function getStaminaPercentage() {
* const [current, max] = ns.bladeburner.getStamina();
* return current / max;
* }
* ```
2021-10-30 18:34:14 +02:00
* @returns Array containing current stamina and max stamina.
*/
getStamina(): [number, number];
/**
2021-11-03 05:27:21 +01:00
* Join the bladeburner faction.
* @remarks
* RAM cost: 4 GB
2021-10-30 18:34:14 +02:00
* 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.
*
* @returns True if you successfully join the Bladeburner faction, or if you are already a member, false otherwise.
*/
joinBladeburnerFaction(): boolean;
/**
2021-11-03 05:27:21 +01:00
* Join the bladeburner division.
* @remarks
* RAM cost: 4 GB
2021-10-30 18:34:14 +02:00
*
* 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.
*
* @returns True if you successfully join the Bladeburner division, or if you are already a member, false otherwise.
*/
joinBladeburnerDivision(): boolean;
/**
2021-11-03 05:27:21 +01:00
* Get bladeburner bonus time.
* @remarks
* RAM cost: 0 GB
2021-10-30 18:34:14 +02:00
*
2022-07-16 05:47:19 +02:00
* Returns the amount of accumulated bonus time (milliseconds) for the Bladeburner mechanic.
2021-10-30 18:34:14 +02:00
*
* 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 youve accumulated over
* 30 seconds in bonus time, then the action will only take 6 seconds in real life to complete.
*
2021-11-03 05:27:21 +01:00
* @returns Amount of accumulated bonus time (milliseconds) for the Bladeburner mechanic.
2021-10-30 18:34:14 +02:00
*/
getBonusTime(): number;
}
/**
2021-10-30 21:46:34 +02:00
* Bladeburner current action.
2021-10-30 18:34:14 +02:00
* @public
*/
export declare interface BladeburnerCurAction {
/** Type of Action */
2021-11-03 05:27:21 +01:00
type: string;
2021-10-30 18:34:14 +02:00
/** Name of Action */
2021-11-03 05:27:21 +01:00
name: string;
2021-10-30 18:34:14 +02:00
}
/**
* @public
*/
export declare interface CharacterMult {
/** Agility stat */
agility: number;
/** Agility exp */
agilityExp: number;
2022-04-13 07:35:35 +02:00
/** Charisma stat */
charisma: number;
/** Charisma exp */
charismaExp: number;
2021-10-30 18:34:14 +02:00
/** Company reputation */
companyRep: number;
/** Money earned from crimes */
crimeMoney: number;
/** Crime success chance */
crimeSuccess: number;
/** Defense stat */
defense: number;
/** Defense exp */
defenseExp: number;
/** Dexterity stat */
dexterity: number;
/** Dexterity exp */
dexterityExp: number;
/** Faction reputation */
factionRep: number;
/** Hacking stat */
hacking: number;
/** Hacking exp */
hackingExp: number;
/** Strength stat */
strength: number;
/** Strength exp */
strengthExp: number;
/** Money earned from jobs */
workMoney: number;
}
/**
2021-10-30 21:46:34 +02:00
* Options to affect the behavior of {@link CodingContract} attempt.
2021-10-30 18:34:14 +02:00
* @public
*/
export declare interface CodingAttemptOptions {
/** If truthy, then the function will return a string that states the contracts reward when it is successfully solved. */
returnReward: boolean;
}
/**
2022-01-08 19:25:06 +01:00
* Coding Contract API
2021-10-30 18:34:14 +02:00
* @public
*/
export declare interface CodingContract {
/**
2022-03-17 21:50:46 +01:00
* Attempts a coding contract.
2021-11-03 05:27:21 +01:00
* @remarks
* RAM cost: 10 GB
*
2021-10-30 18:34:14 +02:00
* Attempts to solve the Coding Contract with the provided solution.
*
* @param answer - Solution for the contract.
2022-05-24 14:12:49 +02:00
* @param filename - Filename of the contract.
2022-09-23 21:03:38 +02:00
* @param host - Hostname of the server containing the contract. Optional. Defaults to current server if not provided.
2021-10-30 18:34:14 +02:00
* @param opts - Optional parameters for configuring function behavior.
* @returns True if the solution was correct, false otherwise. If the returnReward option is configured, then the function will instead return a string. If the contract is successfully solved, the string will contain a description of the contracts reward. Otherwise, it will be an empty string.
*/
2022-08-23 18:46:38 +02:00
attempt(
answer: string | number | any[],
filename: string,
host?: string,
opts?: CodingAttemptOptions,
): boolean | string;
2021-10-30 18:34:14 +02:00
/**
2021-11-03 05:27:21 +01:00
* Get the type of a coding contract.
* @remarks
* RAM cost: 5 GB
*
2021-10-30 18:34:14 +02:00
* Returns a name describing the type of problem posed by the Coding Contract.
* (e.g. Find Largest Prime Factor, Total Ways to Sum, etc.)
*
2022-05-24 14:12:49 +02:00
* @param filename - Filename of the contract.
2022-09-23 21:03:38 +02:00
* @param host - Hostname of the server containing the contract. Optional. Defaults to current server if not provided.
2021-10-30 18:34:14 +02:00
* @returns Name describing the type of problem posed by the Coding Contract.
*/
2021-11-22 17:36:13 +01:00
getContractType(filename: string, host?: string): string;
2021-10-30 18:34:14 +02:00
/**
2021-11-03 05:27:21 +01:00
* Get the description.
* @remarks
* RAM cost: 5 GB
*
2021-10-30 18:34:14 +02:00
* Get the full text description for the problem posed by the Coding Contract.
*
2022-05-24 14:12:49 +02:00
* @param filename - Filename of the contract.
2022-09-23 21:03:38 +02:00
* @param host - Hostname of the server containing the contract. Optional. Defaults to current server if not provided.
2021-10-30 18:34:14 +02:00
* @returns Contracts text description.
*/
2021-11-22 17:36:13 +01:00
getDescription(filename: string, host?: string): string;
2021-10-30 18:34:14 +02:00
/**
2021-11-03 05:27:21 +01:00
* Get the input data.
* @remarks
* RAM cost: 5 GB
*
2021-10-30 18:34:14 +02:00
* Get the data associated with the specific Coding Contract.
* Note that this is not the same as the contracts description.
2022-09-23 21:03:38 +02:00
* This is just the data that the contract wants you to act on in order to solve the contract.
2021-10-30 18:34:14 +02:00
*
2021-11-22 17:36:13 +01:00
* @param filename - Filename of the contract.
2021-11-03 05:27:21 +01:00
* @param host - Host of the server containing the contract. Optional. Defaults to current server if not provided.
2022-09-23 21:03:38 +02:00
* @returns The specified contracts data, data type depends on contract type.
2021-10-30 18:34:14 +02:00
*/
2022-08-17 14:50:05 +02:00
getData(filename: string, host?: string): CodingContractData;
2021-10-30 18:34:14 +02:00
/**
2022-09-23 21:03:38 +02:00
* Get the number of attempts remaining.
2021-11-03 05:27:21 +01:00
* @remarks
* RAM cost: 2 GB
*
2021-10-30 18:34:14 +02:00
* Get the number of tries remaining on the contract before it self-destructs.
*
2022-05-24 14:12:49 +02:00
* @param filename - Filename of the contract.
2022-09-23 21:03:38 +02:00
* @param host - Hostname of the server containing the contract. Optional. Defaults to current server if not provided.
* @returns How many attempts are remaining for the contract.
2021-10-30 18:34:14 +02:00
*/
2021-11-22 17:36:13 +01:00
getNumTriesRemaining(filename: string, host?: string): number;
2021-10-30 18:34:14 +02:00
}
2022-08-17 14:50:05 +02:00
/**
* Coding contract data will differ depending on coding contract.
* @public
*/
export declare type CodingContractData = any;
2021-12-09 00:19:30 +01:00
/**
2021-12-09 02:03:22 +01:00
* Corporation API
2021-12-09 00:19:30 +01:00
* @public
*/
2021-12-04 05:08:11 +01:00
export declare interface Corporation extends WarehouseAPI, OfficeAPI {
2022-01-16 17:13:45 +01:00
/**
* Create a Corporation
* @param divisionName - Name of the division
* @param selfFund - If you should self fund, defaults to true, false will only work on Bitnode 3
2022-01-17 11:24:42 +01:00
* @returns true if created and false if not
2022-01-16 17:13:45 +01:00
*/
createCorporation(corporationName: string, selfFund: boolean): boolean;
/**
* Check if you have a one time unlockable upgrade
* @param upgradeName - Name of the upgrade
2022-01-17 11:24:42 +01:00
* @returns true if unlocked and false if not
2022-01-16 17:13:45 +01:00
*/
hasUnlockUpgrade(upgradeName: string): boolean;
/**
* Gets the cost to unlock a one time unlockable upgrade
* @param upgradeName - Name of the upgrade
* @returns cost of the upgrade
*/
getUnlockUpgradeCost(upgradeName: string): number;
/**
* Get the level of a levelable upgrade
* @param upgradeName - Name of the upgrade
* @returns the level of the upgrade
*/
getUpgradeLevel(upgradeName: string): number;
/**
* Gets the cost to unlock the next level of a levelable upgrade
* @param upgradeName - Name of the upgrade
* @returns cost of the upgrade
*/
getUpgradeLevelCost(upgradeName: string): number;
/**
* Gets the cost to expand into a new industry
* @param industryName - Name of the industry
* @returns cost
*/
getExpandIndustryCost(industryName: string): number;
/**
* Gets the cost to expand into a new city
* @returns cost
*/
getExpandCityCost(): number;
/**
* Get an offer for investment based on you companies current valuation
* @returns An offer of investment
*/
getInvestmentOffer(): InvestmentOffer;
2022-08-17 14:50:05 +02:00
/**
* Get list of materials
* @returns material names
*/
getMaterialNames(): string[];
/**
* Get list of industry types
* @returns industry names
*/
getIndustryTypes(): string[];
/**
* Get list of one-time unlockable upgrades
* @returns unlockable upgrades names
*/
getUnlockables(): string[];
/**
* Get list of upgrade names
* @returns upgrade names
*/
getUpgradeNames(): string[];
/**
* Get list of research names
* @returns research names
*/
getResearchNames(): string[];
2022-01-16 17:13:45 +01:00
/**
* Accept investment based on you companies current valuation
* @remarks
* Is based on current valuation and will not honer a specific Offer
* @returns An offer of investment
*/
acceptInvestmentOffer(): boolean;
/**
* Go public
* @param numShares - number of shares you would like to issue for your IPO
* @returns true if you successfully go public, false if not
*/
goPublic(numShares: number): boolean;
/**
* Bribe a faction
* @param factionName - Faction name
* @param amountCash - Amount of money to bribe
* @returns True if successful, false if not
*/
2022-08-17 14:50:05 +02:00
bribe(factionName: string, amountCash: number): boolean;
2021-12-09 02:03:22 +01:00
/**
* Get corporation data
* @returns Corporation data
*/
2021-12-04 05:08:11 +01:00
getCorporation(): CorporationInfo;
2021-12-09 02:03:22 +01:00
/**
* Get division data
* @param divisionName - Name of the division
* @returns Division data
*/
2021-12-04 05:08:11 +01:00
getDivision(divisionName: string): Division;
2021-12-09 02:03:22 +01:00
/**
* Expand to a new industry
* @param industryType - Name of the industry
* @param divisionName - Name of the division
*/
expandIndustry(industryType: string, divisionName: string): void;
/**
* Expand to a new city
* @param divisionName - Name of the division
* @param cityName - Name of the city
*/
2021-12-04 05:08:11 +01:00
expandCity(divisionName: string, cityName: string): void;
2021-12-09 02:03:22 +01:00
/**
2022-01-16 17:13:45 +01:00
* Unlock an upgrade
2021-12-09 02:03:22 +01:00
* @param upgradeName - Name of the upgrade
*/
2021-12-04 05:08:11 +01:00
unlockUpgrade(upgradeName: string): void;
2021-12-09 02:03:22 +01:00
/**
* Level an upgrade.
* @param upgradeName - Name of the upgrade
*/
2021-12-04 05:08:11 +01:00
levelUpgrade(upgradeName: string): void;
2021-12-09 02:03:22 +01:00
/**
* Issue dividends
2022-08-17 14:50:05 +02:00
* @param rate - Fraction of profit to issue as dividends.
2021-12-09 02:03:22 +01:00
*/
2022-08-17 14:50:05 +02:00
issueDividends(rate: number): void;
2022-01-17 11:24:42 +01:00
/**
* Buyback Shares
2022-03-17 21:50:46 +01:00
* @param amount - Amount of shares to buy back.
*
2022-01-17 11:24:42 +01:00
*/
2022-03-17 21:50:46 +01:00
buyBackShares(amount: number): void;
2022-01-17 11:24:42 +01:00
/**
* Sell Shares
2022-03-17 21:50:46 +01:00
* @param amount - Amount of shares to sell.
*
2022-01-17 11:24:42 +01:00
*/
2022-03-17 21:50:46 +01:00
sellShares(amount: number): void;
2022-03-29 21:49:31 +02:00
/**
* 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 Bonus time for the Corporation mechanic in milliseconds.
*/
getBonusTime(): number;
2021-12-04 05:08:11 +01:00
}
2021-12-09 00:19:30 +01:00
/**
2021-12-09 02:03:22 +01:00
* General info about a corporation
2021-12-09 00:19:30 +01:00
* @public
*/
2021-12-04 05:08:11 +01:00
export declare interface CorporationInfo {
2021-12-09 02:03:22 +01:00
/** Name of the corporation */
2021-12-04 05:08:11 +01:00
name: string;
2021-12-09 02:03:22 +01:00
/** Funds available */
2021-12-04 05:08:11 +01:00
funds: number;
2021-12-09 02:03:22 +01:00
/** Revenue per second this cycle */
2021-12-04 05:08:11 +01:00
revenue: number;
2021-12-09 02:03:22 +01:00
/** Expenses per second this cycle */
2021-12-04 05:08:11 +01:00
expenses: number;
2022-01-08 19:25:06 +01:00
/** Indicating if the company is public */
2021-12-04 05:08:11 +01:00
public: boolean;
2021-12-09 02:03:22 +01:00
/** Total number of shares issues by this corporation */
2021-12-04 05:08:11 +01:00
totalShares: number;
2021-12-09 02:03:22 +01:00
/** Amount of share owned */
2021-12-04 05:08:11 +01:00
numShares: number;
2021-12-09 02:03:22 +01:00
/** Cooldown until shares can be sold again */
2021-12-04 05:08:11 +01:00
shareSaleCooldown: number;
2022-09-23 21:03:38 +02:00
/** Amount of aqcuirable shares. */
2021-12-04 05:08:11 +01:00
issuedShares: number;
2021-12-09 02:03:22 +01:00
/** Price of the shares */
2021-12-04 05:08:11 +01:00
sharePrice: number;
2022-08-17 14:50:05 +02:00
/** Fraction of profits issued as dividends */
dividendRate: number;
/** Tax applied on your earnings as a shareholder */
dividendTax: number;
/** Your earnings as a shareholder per second this cycle */
dividendEarnings: number;
2022-01-08 19:25:06 +01:00
/** State of the corporation. Possible states are START, PURCHASE, PRODUCTION, SALE, EXPORT. */
2021-12-04 05:08:11 +01:00
state: string;
2022-01-16 17:13:45 +01:00
/** Array of all divisions */
divisions: Division[];
2021-12-04 05:08:11 +01:00
}
2021-10-30 18:34:14 +02:00
/**
2021-10-30 21:46:34 +02:00
* Data representing the internal values of a crime.
2021-10-30 18:34:14 +02:00
* @public
*/
export declare interface CrimeStats {
/** Number representing the difficulty of the crime. Used for success chance calculations */
difficulty: number;
2021-10-30 21:46:34 +02:00
/** Amount of karma lost for successfully committing this crime */
2021-10-30 18:34:14 +02:00
karma: number;
/** How many people die as a result of this crime */
kills: number;
/** How much money is given */
money: number;
/** Name of crime */
2022-03-17 21:50:46 +01:00
name: string;
2021-10-30 18:34:14 +02:00
/** Milliseconds it takes to attempt the crime */
time: number;
/** Description of the crime activity */
type: string;
/** hacking level impact on success change of the crime */
hacking_success_weight: number;
/** strength level impact on success change of the crime */
strength_success_weight: number;
/** defense level impact on success change of the crime */
defense_success_weight: number;
/** dexterity level impact on success change of the crime */
dexterity_success_weight: number;
/** agility level impact on success change of the crime */
agility_success_weight: number;
/** charisma level impact on success change of the crime */
charisma_success_weight: number;
/** hacking exp gained from crime */
hacking_exp: number;
/** strength exp gained from crime */
strength_exp: number;
/** defense exp gained from crime */
defense_exp: number;
/** dexterity exp gained from crime */
dexterity_exp: number;
/** agility exp gained from crime */
agility_exp: number;
/** charisma exp gained from crime */
charisma_exp: number;
/** intelligence exp gained from crime */
intelligence_exp: number;
}
2021-12-09 00:19:30 +01:00
/**
2021-12-09 02:03:22 +01:00
* Corporation division
2021-12-09 00:19:30 +01:00
* @public
*/
2021-12-04 05:08:11 +01:00
export declare interface Division {
2021-12-09 02:03:22 +01:00
/** Name of the division */
2021-12-04 05:08:11 +01:00
name: string;
2022-03-17 21:50:46 +01:00
/** Type of division, like Agriculture */
2021-12-04 05:08:11 +01:00
type: string;
2021-12-09 02:03:22 +01:00
/** Awareness of the division */
2021-12-04 05:08:11 +01:00
awareness: number;
2021-12-09 02:03:22 +01:00
/** Popularity of the division */
2021-12-04 05:08:11 +01:00
popularity: number;
2021-12-09 02:03:22 +01:00
/** Production multiplier */
2021-12-04 05:08:11 +01:00
prodMult: number;
2021-12-09 02:03:22 +01:00
/** Amount of research in that division */
2021-12-04 05:08:11 +01:00
research: number;
2021-12-09 02:03:22 +01:00
/** Revenue last cycle */
2021-12-04 05:08:11 +01:00
lastCycleRevenue: number;
2021-12-09 02:03:22 +01:00
/** Expenses last cycle */
2021-12-04 05:08:11 +01:00
lastCycleExpenses: number;
2021-12-09 02:03:22 +01:00
/** Revenue this cycle */
2021-12-04 05:08:11 +01:00
thisCycleRevenue: number;
2021-12-09 02:03:22 +01:00
/** Expenses this cycle */
2021-12-04 05:08:11 +01:00
thisCycleExpenses: number;
2021-12-09 02:03:22 +01:00
/** All research bought */
2021-12-04 05:08:11 +01:00
upgrades: number[];
2021-12-09 02:03:22 +01:00
/** Cities in which this division has expanded */
2021-12-04 05:08:11 +01:00
cities: string[];
2022-01-16 17:13:45 +01:00
/** Products developed by this division */
products: string[];
2022-05-24 14:12:49 +02:00
/** Whether the industry this division is in is capable of making products */
makesProducts: boolean;
2021-12-04 05:08:11 +01:00
}
2021-12-09 00:19:30 +01:00
/**
2021-12-09 02:03:22 +01:00
* Employee in an office
2021-12-09 00:19:30 +01:00
* @public
*/
2021-12-04 05:08:11 +01:00
export declare interface Employee {
2021-12-09 02:03:22 +01:00
/** Name of the employee */
2021-12-04 05:08:11 +01:00
name: string;
2022-05-24 14:12:49 +02:00
/** Morale of the employee */
2021-12-04 05:08:11 +01:00
mor: number;
2022-05-24 14:12:49 +02:00
/** Happiness of the employee */
2021-12-04 05:08:11 +01:00
hap: number;
2022-05-24 14:12:49 +02:00
/** Energy of the employee */
2021-12-04 05:08:11 +01:00
ene: number;
2022-05-24 14:12:49 +02:00
/** Intelligence of the employee */
2021-12-04 05:08:11 +01:00
int: number;
2022-05-24 14:12:49 +02:00
/** Charisma of the employee */
2021-12-04 05:08:11 +01:00
cha: number;
2022-05-24 14:12:49 +02:00
/** Experience of the employee */
2021-12-04 05:08:11 +01:00
exp: number;
2022-05-24 14:12:49 +02:00
/** Creativity of the employee */
2021-12-04 05:08:11 +01:00
cre: number;
2022-05-24 14:12:49 +02:00
/** Efficiency of the employee */
2021-12-04 05:08:11 +01:00
eff: number;
2022-05-24 14:12:49 +02:00
/** Salary of the employee */
2021-12-04 05:08:11 +01:00
sal: number;
2022-05-24 14:12:49 +02:00
/** Current Location (city) */
2021-12-04 05:08:11 +01:00
loc: string;
2022-05-24 14:12:49 +02:00
/** Current job position */
2021-12-04 05:08:11 +01:00
pos: string;
}
2021-12-09 00:19:30 +01:00
/**
2021-12-09 02:03:22 +01:00
* Object representing the number of employee in each job.
2021-12-09 00:19:30 +01:00
* @public
*/
2021-12-04 05:08:11 +01:00
export declare interface EmployeeJobs {
Operations: number;
Engineer: number;
Business: number;
Management: number;
"Research & Development": number;
Training: number;
Unassigned: number;
}
2021-11-03 05:33:14 +01:00
/**
* Object representing data representing a gang member equipment.
* @public
*/
export declare interface EquipmentStats {
/** Strength multiplier */
str?: number;
2021-11-03 05:33:14 +01:00
/** Defense multiplier */
def?: number;
2021-11-03 05:33:14 +01:00
/** Dexterity multiplier */
dex?: number;
2021-11-03 05:33:14 +01:00
/** Agility multiplier */
agi?: number;
2021-11-03 05:33:14 +01:00
/** Charisma multiplier */
cha?: number;
2021-11-03 05:33:14 +01:00
/** Hacking multiplier */
hack?: number;
}
2022-09-23 21:03:38 +02:00
/**
* Export order for a material
* @public
*/
export declare interface Export {
/** Division the material is being exported to */
div: string;
/** City the material is being exported to */
loc: string;
/** Amount of material exported */
amt: string;
}
2022-01-16 00:39:37 +01:00
/**
* @public
*/
export declare type FilenameOrPID = number | string;
/**
* Formulas API
* @remarks
* You need Formulas.exe on your home computer to use this API.
* @public
*/
export declare interface Formulas {
2022-09-23 21:03:38 +02:00
mockServer(): Server;
mockPlayer(): Player;
2022-04-13 07:35:35 +02:00
/** Reputation formulas */
reputation: ReputationFormulas;
/** Skills formulas */
skills: SkillsFormulas;
/** Hacking formulas */
hacking: HackingFormulas;
/** Hacknet Nodes formulas */
hacknetNodes: HacknetNodesFormulas;
/** Hacknet Servers formulas */
hacknetServers: HacknetServersFormulas;
/** Gang formulas */
2021-12-09 00:19:30 +01:00
gang: GangFormulas;
/** Work formulas */
work: WorkFormulas;
2021-11-03 05:33:14 +01:00
}
2021-12-03 22:14:13 +01:00
/**
* @public
*/
export declare interface Fragment {
id: number;
shape: boolean[][];
type: number;
power: number;
limit: number;
}
2022-01-18 20:02:12 +01:00
/**
* Game Information
* @internal
*/
export declare interface GameInfo {
version: string;
commit: string;
platform: string;
}
2021-10-30 18:34:14 +02:00
/**
2021-10-30 21:46:34 +02:00
* Gang API
2021-11-03 05:27:21 +01:00
* @remarks
* If you are not in BitNode-2, then you must have Source-File 2 in order to use this API.
2021-10-30 18:34:14 +02:00
* @public
*/
export declare interface Gang {
/**
* Create a gang.
* @remarks
* RAM cost: 1GB
*
* Create a gang with the specified faction.
* @returns True if the gang was created, false otherwise.
*/
createGang(faction: string): boolean;
/**
* Check if you're in a gang.
* @remarks
* RAM cost: 1GB
* @returns True if you're in a gang, false otherwise.
*/
inGang(): boolean;
2021-10-30 18:34:14 +02:00
/**
2021-11-03 05:27:21 +01:00
* List all gang members.
* @remarks
* RAM cost: 1 GB
2021-10-30 18:34:14 +02:00
*
* Get the names of all Gang members
*
* @returns Names of all Gang members.
*/
getMemberNames(): string[];
/**
2021-11-03 05:27:21 +01:00
* Get information about your gang.
* @remarks
* RAM cost: 2 GB
2021-10-30 18:34:14 +02:00
*
* Get general information about the gang.
*
* @returns Object containing general information about the gang.
*/
getGangInformation(): GangGenInfo;
/**
2021-11-03 05:27:21 +01:00
* Get information about the other gangs.
* @remarks
* RAM cost: 2 GB
2021-10-30 18:34:14 +02:00
*
* Get territory and power information about all gangs.
*
* @returns Object containing territory and power information about all gangs.
*/
getOtherGangInformation(): GangOtherInfo;
/**
2021-11-03 05:27:21 +01:00
* Get information about a specific gang member.
* @remarks
* RAM cost: 2 GB
2021-10-30 18:34:14 +02:00
*
* Get stat and equipment-related information about a Gang Member
*
* @param name - Name of member.
* @returns Object containing stat and equipment-related information about a Gang Member.
*/
getMemberInformation(name: string): GangMemberInfo;
/**
2021-11-03 05:27:21 +01:00
* Check if you can recruit a new gang member.
* @remarks
* RAM cost: 1 GB
2021-10-30 18:34:14 +02:00
*
* Returns boolean indicating whether a member can currently be recruited
*
* @returns True if a member can currently be recruited, false otherwise.
*/
canRecruitMember(): boolean;
/**
2021-11-03 05:27:21 +01:00
* Recruit a new gang member.
* @remarks
* RAM cost: 2 GB
2021-10-30 18:34:14 +02:00
*
* Attempt to recruit a new gang member.
*
* Possible reasons for failure:
* * Cannot currently recruit a new member
* * There already exists a member with the specified name
*
* @param name - Name of member to recruit.
* @returns True if the member was successfully recruited, false otherwise.
*/
recruitMember(name: string): boolean;
/**
2021-11-03 05:27:21 +01:00
* List member task names.
* @remarks
* RAM cost: 1 GB
2021-10-30 18:34:14 +02:00
*
* Get the name of all valid tasks that Gang members can be assigned to.
*
* @returns All valid tasks that Gang members can be assigned to.
*/
2021-11-03 05:27:21 +01:00
getTaskNames(): string[];
2021-10-30 18:34:14 +02:00
/**
2021-11-03 05:27:21 +01:00
* Set gang member to task.
* @remarks
* RAM cost: 2 GB
2021-10-30 18:34:14 +02:00
*
* Attempts to assign the specified Gang Member to the specified task.
* If an invalid task is specified, the Gang member will be set to idle (Unassigned).
*
* @param memberName - Name of Gang member to assign.
* @param taskName - Task to assign.
* @returns True if the Gang Member was successfully assigned to the task, false otherwise.
*/
2021-11-03 05:27:21 +01:00
setMemberTask(memberName: string, taskName: string): boolean;
2021-10-30 18:34:14 +02:00
/**
2021-11-03 05:27:21 +01:00
* Get stats of a task.
* @remarks
* RAM cost: 1 GB
2021-10-30 18:34:14 +02:00
*
* Get the stats of a gang task stats. This is typically used to evaluate which action should be executed next.
*
* @param name - Name of the task.
* @returns Detailed stats of a task.
*/
2021-11-03 05:33:14 +01:00
getTaskStats(name: string): GangTaskStats;
2021-10-30 18:34:14 +02:00
/**
2021-11-03 05:27:21 +01:00
* List equipment names.
* @remarks
* RAM cost: 1 GB
2021-10-30 18:34:14 +02:00
*
* Get the name of all possible equipment/upgrades you can purchase for your Gang Members.
* This includes Augmentations.
*
2021-12-03 00:42:30 +01:00
* @returns Names of all Equipments/Augmentations.
2021-10-30 18:34:14 +02:00
*/
2021-11-03 05:27:21 +01:00
getEquipmentNames(): string[];
2021-10-30 18:34:14 +02:00
/**
2021-11-03 05:27:21 +01:00
* Get cost of equipment.
* @remarks
* RAM cost: 2 GB
2021-10-30 18:34:14 +02:00
*
* Get the amount of money it takes to purchase a piece of Equipment or an Augmentation.
* If an invalid Equipment/Augmentation is specified, this function will return Infinity.
*
* @param equipName - Name of equipment.
* @returns Cost to purchase the specified Equipment/Augmentation (number). Infinity for invalid arguments
*/
2021-11-03 05:27:21 +01:00
getEquipmentCost(equipName: string): number;
2021-10-30 18:34:14 +02:00
/**
2021-11-03 05:27:21 +01:00
* Get type of an equipment.
* @remarks
* RAM cost: 2 GB
2021-10-30 18:34:14 +02:00
*
* Get the specified equipment type.
*
* @param equipName - Name of equipment.
* @returns Type of the equipment.
*/
2021-11-03 05:27:21 +01:00
getEquipmentType(equipName: string): string;
2021-10-30 18:34:14 +02:00
/**
2021-11-03 05:27:21 +01:00
* Get stats of an equipment.
* @remarks
* RAM cost: 2 GB
2021-10-30 18:34:14 +02:00
*
* Get the specified equipment stats.
*
* @param equipName - Name of equipment.
* @returns A dictionary containing the stats of the equipment.
*/
2021-11-03 05:33:14 +01:00
getEquipmentStats(equipName: string): EquipmentStats;
2021-10-30 18:34:14 +02:00
/**
2021-11-03 05:27:21 +01:00
* Purchase an equipment for a gang member.
* @remarks
* RAM cost: 4 GB
2021-10-30 18:34:14 +02:00
*
* Attempt to purchase the specified Equipment/Augmentation for the specified Gang member.
*
* @param memberName - Name of Gang member to purchase the equipment for.
* @param equipName - Name of Equipment/Augmentation to purchase.
* @returns True if the equipment was successfully purchased. False otherwise
*/
2021-11-03 05:27:21 +01:00
purchaseEquipment(memberName: string, equipName: string): boolean;
2021-10-30 18:34:14 +02:00
/**
2021-11-03 05:27:21 +01:00
* Ascend a gang member.
* @remarks
* RAM cost: 4 GB
2021-10-30 18:34:14 +02:00
*
* Ascend the specified Gang Member.
*
* @param memberName - Name of member to ascend.
2022-09-23 21:03:38 +02:00
* @returns Object with info about the ascension results. Undefined if ascension did not occur.
2021-10-30 18:34:14 +02:00
*/
ascendMember(memberName: string): GangMemberAscension | undefined;
2021-10-30 18:34:14 +02:00
2021-12-09 00:19:30 +01:00
/**
* Get the result of an ascension without ascending.
* @remarks
* RAM cost: 2 GB
*
* Get the result of an ascension without ascending.
*
* @param memberName - Name of member.
2022-09-23 21:03:38 +02:00
* @returns Object with info about the ascension results. Undefined if ascension is impossible.
2021-12-09 00:19:30 +01:00
*/
getAscensionResult(memberName: string): GangMemberAscension | undefined;
2021-10-30 18:34:14 +02:00
/**
2021-11-03 05:27:21 +01:00
* Enable/Disable territory warfare.
* @remarks
* RAM cost: 2 GB
2021-10-30 18:34:14 +02:00
*
* Set whether or not the gang should engage in territory warfare
*
* @param engage - Whether or not to engage in territory warfare.
*/
setTerritoryWarfare(engage: boolean): void;
/**
2021-11-03 05:27:21 +01:00
* Get chance to win clash with other gang.
* @remarks
* RAM cost: 4 GB
2021-10-30 18:34:14 +02:00
*
* Returns the chance you have to win a clash with the specified gang. The chance is returned in decimal form, not percentage
*
* @param gangName - Target gang
* @returns Chance you have to win a clash with the specified gang.
*/
2021-11-03 05:27:21 +01:00
getChanceToWinClash(gangName: string): number;
2021-10-30 18:34:14 +02:00
/**
2021-11-03 05:27:21 +01:00
* Get bonus time.
* @remarks
* RAM cost: 0 GB
2021-10-30 18:34:14 +02:00
*
2022-07-16 05:47:19 +02:00
* Returns the amount of accumulated bonus time (milliseconds) for the Gang mechanic.
2021-10-30 18:34:14 +02:00
*
* 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 10x the normal speed.
*
2021-11-03 05:27:21 +01:00
* @returns Bonus time for the Gang mechanic in milliseconds.
2021-10-30 18:34:14 +02:00
*/
getBonusTime(): number;
}
2021-12-09 00:19:30 +01:00
/**
* Gang formulas
2021-12-09 00:19:30 +01:00
* @public
*/
export declare interface GangFormulas {
/**
* Calculate the wanted penalty.
* @param gang - Gang info from {@link Gang.getGangInformation | getGangInformation}
* @returns The calculated wanted penalty.
*/
2021-12-09 01:19:07 +01:00
wantedPenalty(gang: GangGenInfo): number;
/**
* Calculate respect gain per tick.
* @param gang - Gang info from {@link Gang.getGangInformation | getGangInformation}
* @param member - Gang info from {@link Gang.getMemberInformation | getMemberInformation}
* @param task - Gang info from {@link Gang.getTaskStats | getTaskStats}
* @returns The calculated respect gain.
*/
2021-12-09 01:19:07 +01:00
respectGain(gang: GangGenInfo, member: GangMemberInfo, task: GangTaskStats): number;
/**
* Calculate wanted gain per tick.
* @param gang - Gang info from {@link Gang.getGangInformation | getGangInformation}
* @param member - Member info from {@link Gang.getMemberInformation | getMemberInformation}
* @param task - Task info from {@link Gang.getTaskStats | getTaskStats}
* @returns The calculated wanted gain.
*/
2021-12-09 01:19:07 +01:00
wantedLevelGain(gang: GangGenInfo, member: GangMemberInfo, task: GangTaskStats): number;
/**
* Calculate money gain per tick.
* @param gang - Gang info from {@link Gang.getGangInformation | getGangInformation}
* @param member - Member info from {@link Gang.getMemberInformation | getMemberInformation}
* @param task - Task info from {@link Gang.getTaskStats | getTaskStats}
* @returns The calculated money gain.
*/
2021-12-09 01:19:07 +01:00
moneyGain(gang: GangGenInfo, member: GangMemberInfo, task: GangTaskStats): number;
2021-12-09 18:59:46 +01:00
/**
* Calculate ascension point gain.
* @param exp - Experience point before ascension.
* @returns The calculated ascension point gain.
*/
ascensionPointsGain(exp: number): number;
/**
* Calculate ascension mult.
* @param points - Amount of ascension points.
* @returns The calculated ascension mult.
*/
ascensionMultiplier(points: number): number;
2021-12-09 00:19:30 +01:00
}
2021-10-30 18:34:14 +02:00
/**
2021-10-30 21:46:34 +02:00
* Gang general info.
2021-10-30 18:34:14 +02:00
* @public
*/
export declare interface GangGenInfo {
/** Name of faction that the gang belongs to ("Slum Snakes", etc.) */
2021-11-03 05:27:21 +01:00
faction: string;
2022-01-08 19:25:06 +01:00
/** Indicating whether or not it's a hacking gang */
2021-10-30 18:34:14 +02:00
isHacking: boolean;
2021-12-09 00:19:30 +01:00
/** Money earned per game cycle */
2021-10-30 18:34:14 +02:00
moneyGainRate: number;
/** Gang's power for territory warfare */
power: number;
/** Gang's respect */
respect: number;
2021-12-09 00:19:30 +01:00
/** Respect earned per game cycle */
2021-10-30 18:34:14 +02:00
respectGainRate: number;
2022-01-08 19:25:06 +01:00
/** Amount of territory held */
2021-10-30 18:34:14 +02:00
territory: number;
2022-01-08 19:25:06 +01:00
/** Clash chance */
2021-10-30 18:34:14 +02:00
territoryClashChance: number;
/** Gang's wanted level */
wantedLevel: number;
2021-12-09 00:19:30 +01:00
/** Wanted level gained/lost per game cycle (negative for losses) */
2021-10-30 18:34:14 +02:00
wantedLevelGainRate: number;
2022-01-08 19:25:06 +01:00
/** Indicating if territory warfare is enabled */
territoryWarfareEngaged: boolean;
2022-01-08 19:25:06 +01:00
/** Number indicating the current wanted penalty */
2021-12-09 00:19:30 +01:00
wantedPenalty: number;
2021-10-30 18:34:14 +02:00
}
/**
* @public
*/
export declare interface GangMemberAscension {
/** Amount of respect lost from ascending */
respect: number;
2022-01-08 19:25:06 +01:00
/** Hacking multiplier gained from ascending */
2021-10-30 18:34:14 +02:00
hack: number;
2022-01-08 19:25:06 +01:00
/** Strength multiplier gained from ascending */
2021-10-30 18:34:14 +02:00
str: number;
2022-01-08 19:25:06 +01:00
/** Defense multiplier gained from ascending */
2021-10-30 18:34:14 +02:00
def: number;
2022-01-08 19:25:06 +01:00
/** Dexterity multiplier gained from ascending */
2021-10-30 18:34:14 +02:00
dex: number;
2022-01-08 19:25:06 +01:00
/** Agility multiplier gained from ascending */
2021-10-30 18:34:14 +02:00
agi: number;
2022-01-08 19:25:06 +01:00
/** Charisma multiplier gained from ascending */
2021-10-30 18:34:14 +02:00
cha: number;
}
/**
* @public
*/
export declare interface GangMemberInfo {
2022-03-17 21:50:46 +01:00
/** Name of the gang member */
name: string;
2022-03-17 21:50:46 +01:00
/** Currently assigned task */
2021-11-03 05:27:21 +01:00
task: string;
earnedRespect: number;
2022-03-17 21:50:46 +01:00
/** Hack skill level */
hack: number;
2022-03-17 21:50:46 +01:00
/** Strength skill level */
str: number;
2022-03-17 21:50:46 +01:00
/** Defense skill level */
def: number;
2022-03-17 21:50:46 +01:00
/** Dexterity skill level */
dex: number;
2022-03-17 21:50:46 +01:00
/** Agility skill level */
agi: number;
2022-03-17 21:50:46 +01:00
/** Charisma skill level */
cha: number;
2022-03-17 21:50:46 +01:00
/** Current hack experience */
hack_exp: number;
2022-03-17 21:50:46 +01:00
/** Current strength experience */
str_exp: number;
2022-03-17 21:50:46 +01:00
/** Current defense experience */
def_exp: number;
2022-03-17 21:50:46 +01:00
/** Current dexterity experience */
dex_exp: number;
2022-03-17 21:50:46 +01:00
/** Current agility experience */
agi_exp: number;
2022-03-17 21:50:46 +01:00
/** Current charisma experience */
cha_exp: number;
2022-03-17 21:50:46 +01:00
/** Hack multiplier from equipment */
hack_mult: number;
2022-03-17 21:50:46 +01:00
/** Strength multiplier from equipment */
str_mult: number;
2022-03-17 21:50:46 +01:00
/** Defense multiplier from equipment */
def_mult: number;
2022-03-17 21:50:46 +01:00
/** Dexterity multiplier from equipment */
dex_mult: number;
2022-03-17 21:50:46 +01:00
/** Agility multiplier from equipment */
agi_mult: number;
2022-03-17 21:50:46 +01:00
/** Charisma multiplier from equipment */
cha_mult: number;
2022-03-17 21:50:46 +01:00
/** Hack multiplier from ascensions */
hack_asc_mult: number;
2022-03-17 21:50:46 +01:00
/** Strength multiplier from ascensions */
str_asc_mult: number;
2022-03-17 21:50:46 +01:00
/** Defense multiplier from ascensions */
def_asc_mult: number;
2022-03-17 21:50:46 +01:00
/** Dexterity multiplier from ascensions */
dex_asc_mult: number;
2022-03-17 21:50:46 +01:00
/** Agility multiplier from ascensions */
agi_asc_mult: number;
2022-03-17 21:50:46 +01:00
/** Charisma multiplier from ascensions */
cha_asc_mult: number;
2022-03-17 21:50:46 +01:00
/** Total earned hack experience */
hack_asc_points: number;
2022-03-17 21:50:46 +01:00
/** Total earned strength experience */
str_asc_points: number;
2022-03-17 21:50:46 +01:00
/** Total earned defense experience */
def_asc_points: number;
2022-03-17 21:50:46 +01:00
/** Total earned dexterity experience */
dex_asc_points: number;
2022-03-17 21:50:46 +01:00
/** Total earned agility experience */
agi_asc_points: number;
2022-03-17 21:50:46 +01:00
/** Total earned charisma experience */
cha_asc_points: number;
upgrades: string[];
augmentations: string[];
2021-12-09 00:19:30 +01:00
respectGain: number;
wantedLevelGain: number;
moneyGain: number;
2021-10-30 18:34:14 +02:00
}
/**
* @public
*/
2021-11-03 05:33:14 +01:00
export declare interface GangOtherInfo {
2022-08-17 14:50:05 +02:00
[key: string]: GangOtherInfoObject;
2021-11-03 05:33:14 +01:00
}
2021-10-30 18:34:14 +02:00
/**
* @public
*/
export declare interface GangOtherInfoObject {
/** Gang power */
power: number;
/** Gang territory, in decimal form */
territory: number;
}
2021-11-03 05:33:14 +01:00
/**
* Object representing data representing a gang member task.
* @public
*/
export declare interface GangTaskStats {
/** Task name */
name: string;
/** Task Description */
desc: string;
/** Is a task of a hacking gang */
isHacking: boolean;
/** Is a task of a combat gang */
isCombat: boolean;
/** Base respect earned */
baseRespect: number;
/** Base wanted earned */
baseWanted: number;
/** Base money earned */
baseMoney: number;
/** Hacking skill impact on task scaling */
hackWeight: number;
2022-03-17 21:50:46 +01:00
/** Strength skill impact on task scaling */
2021-11-03 05:33:14 +01:00
strWeight: number;
/** Defense skill impact on task scaling */
defWeight: number;
/** Dexterity skill impact on task scaling */
dexWeight: number;
/** Agility skill impact on task scaling */
agiWeight: number;
/** Charisma skill impact on task scaling */
chaWeight: number;
/** Number representing the difficulty of the task */
difficulty: number;
/** Territory impact on task scaling */
territory: GangTerritory;
}
/**
* @public
*/
export declare interface GangTerritory {
/** Money gain impact on task scaling */
money: number;
/** Respect gain impact on task scaling */
respect: number;
/** Wanted gain impact on task scaling */
wanted: number;
}
2022-03-29 21:49:31 +02:00
/**
* Grafting API
* @remarks
* This API requires Source-File 10 to use.
* @public
*/
export declare interface Grafting {
/**
* Retrieve the grafting cost of an aug.
* @remarks
* RAM cost: 3.75 GB
*
* @param augName - Name of the aug to check the price of. Must be an exact match.
* @returns The cost required to graft the named augmentation.
* @throws Will error if an invalid Augmentation name is provided.
*/
getAugmentationGraftPrice(augName: string): number;
/**
* Retrieves the time required to graft an aug.
* @remarks
* RAM cost: 3.75 GB
*
* @param augName - Name of the aug to check the grafting time of. Must be an exact match.
* @returns The time required, in millis, to graft the named augmentation.
* @throws Will error if an invalid Augmentation name is provided.
*/
getAugmentationGraftTime(augName: string): number;
2022-04-13 18:32:26 +02:00
/**
* Retrieves a list of Augmentations that can be grafted.
* @remarks
* RAM cost: 5 GB
*
* Note that this function returns a list of currently graftable Augmentations,
* based off of the Augmentations that you already own.
*
* @returns An array of graftable Augmentations.
*/
getGraftableAugmentations(): string[];
2022-03-29 21:49:31 +02:00
/**
* Begins grafting the named aug. You must be in New Tokyo to use this.
* @remarks
* RAM cost: 7.5 GB
*
* @param augName - The name of the aug to begin grafting. Must be an exact match.
* @param focus - Acquire player focus on this Augmentation grafting. Optional. Defaults to true.
* @returns True if the aug successfully began grafting, false otherwise (e.g. not enough money, or
* invalid Augmentation name provided).
* @throws Will error if called while you are not in New Tokyo.
*/
graftAugmentation(augName: string, focus?: boolean): boolean;
}
/**
2021-12-09 01:19:07 +01:00
* Hacking formulas
* @public
*/
export declare interface HackingFormulas {
2021-12-09 01:19:07 +01:00
/**
* Calculate hack chance.
2022-03-17 21:50:46 +01:00
* (Ex: 0.25 would indicate a 25% chance of success.)
2021-12-09 01:19:07 +01:00
* @param server - Server info from {@link NS.getServer | getServer}
* @param player - Player info from {@link NS.getPlayer | getPlayer}
* @returns The calculated hack chance.
*/
hackChance(server: Server, player: Player): number;
/**
* Calculate hack exp for one thread.
* @remarks
* Multiply by thread to get total exp
* @param server - Server info from {@link NS.getServer | getServer}
* @param player - Player info from {@link NS.getPlayer | getPlayer}
* @returns The calculated hack exp.
*/
hackExp(server: Server, player: Player): number;
/**
* Calculate hack percent for one thread.
2022-03-17 21:50:46 +01:00
* (Ex: 0.25 would steal 25% of the server's current value.)
2021-12-09 01:19:07 +01:00
* @remarks
* Multiply by thread to get total percent hacked.
* @param server - Server info from {@link NS.getServer | getServer}
* @param player - Player info from {@link NS.getPlayer | getPlayer}
* @returns The calculated hack percent.
*/
hackPercent(server: Server, player: Player): number;
/**
2022-03-17 21:50:46 +01:00
* Calculate the percent a server would grow to.
* (Ex: 3.0 would would grow the server to 300% of its current value.)
2021-12-09 01:19:07 +01:00
* @param server - Server info from {@link NS.getServer | getServer}
* @param threads - Amount of thread.
* @param player - Player info from {@link NS.getPlayer | getPlayer}
* @param cores - Number of cores on the computer that will execute grow.
* @returns The calculated grow percent.
*/
growPercent(server: Server, threads: number, player: Player, cores?: number): number;
/**
* Calculate hack time.
* @param server - Server info from {@link NS.getServer | getServer}
* @param player - Player info from {@link NS.getPlayer | getPlayer}
* @returns The calculated hack time.
*/
hackTime(server: Server, player: Player): number;
/**
* Calculate grow time.
* @param server - Server info from {@link NS.getServer | getServer}
* @param player - Player info from {@link NS.getPlayer | getPlayer}
* @returns The calculated grow time.
*/
growTime(server: Server, player: Player): number;
/**
* Calculate weaken time.
* @param server - Server info from {@link NS.getServer | getServer}
* @param player - Player info from {@link NS.getPlayer | getPlayer}
* @returns The calculated weaken time.
*/
weakenTime(server: Server, player: Player): number;
}
2021-10-30 18:34:14 +02:00
/**
2021-10-30 21:46:34 +02:00
* Hack related multipliers.
2021-10-30 18:34:14 +02:00
* @public
*/
export declare interface HackingMultipliers {
/** Player's hacking chance multiplier. */
chance: number;
/** Player's hacking speed multiplier. */
speed: number;
/** Player's hacking money stolen multiplier. */
money: number;
/** Player's hacking growth multiplier */
growth: number;
}
/**
2021-10-30 21:46:34 +02:00
* Hacknet API
2021-11-03 05:27:21 +01:00
* @remarks
* Not all these functions are immediately available.
2021-10-30 18:34:14 +02:00
* @public
*/
2021-10-30 21:46:34 +02:00
export declare interface Hacknet {
2021-10-30 18:34:14 +02:00
/**
2021-11-03 05:27:21 +01:00
* Get the number of hacknet nodes you own.
* @remarks
* RAM cost: 0 GB
*
2021-10-30 18:34:14 +02:00
* Returns the number of Hacknet Nodes you own.
*
2022-09-23 21:03:38 +02:00
* @returns Number of hacknet nodes.
2021-10-30 18:34:14 +02:00
*/
numNodes(): number;
/**
* Get the maximum number of hacknet nodes.
* @remarks
* RAM cost: 0 GB
*
2022-09-23 21:03:38 +02:00
* @returns Maximum number of hacknet nodes.
*/
maxNumNodes(): number;
2021-10-30 18:34:14 +02:00
/**
2021-11-03 05:27:21 +01:00
* Purchase a new hacknet node.
* @remarks
* RAM cost: 0 GB
*
2021-10-30 18:34:14 +02:00
* Purchases a new Hacknet Node. Returns a number with the index of the
* Hacknet Node. This index is equivalent to the number at the end of
2021-10-30 21:46:34 +02:00
* the Hacknet Nodes name (e.g The Hacknet Node named `hacknet-node-4`
2021-10-30 18:34:14 +02:00
* will have an index of 4).
*
* If the player cannot afford to purchase a new Hacknet Node then the function will return -1.
*
* @returns The index of the Hacknet Node or if the player cannot afford to purchase a new Hacknet Node the function will return -1.
*/
purchaseNode(): number;
/**
2021-11-03 05:27:21 +01:00
* Get the price of the next hacknet node.
* @remarks
* RAM cost: 0 GB
*
2021-10-30 18:34:14 +02:00
* Returns the cost of purchasing a new Hacknet Node.
*
* @returns Cost of purchasing a new Hacknet Node.
*/
getPurchaseNodeCost(): number;
/**
2021-11-03 05:27:21 +01:00
* Get the stats of a hacknet node.
* @remarks
* RAM cost: 0 GB
*
2021-10-30 18:34:14 +02:00
* Returns an object containing a variety of stats about the specified Hacknet Node.
*
* Note that for Hacknet Nodes, production refers to the amount of money the node generates.
* For Hacknet Servers (the upgraded version of Hacknet Nodes), production refers to the
* amount of hashes the node generates.
*
* @param index - Index/Identifier of Hacknet Node
* @returns Object containing a variety of stats about the specified Hacknet Node.
*/
getNodeStats(index: number): NodeStats;
/**
2021-11-03 05:27:21 +01:00
* Upgrade the level of a hacknet node.
* @remarks
* RAM cost: 0 GB
*
2021-10-30 18:34:14 +02:00
* Tries to upgrade the level of the specified Hacknet Node by n.
*
* Returns true if the Hacknet Nodes level is successfully upgraded by n
* or if it is upgraded by some positive amount and the Node reaches its max level.
*
* Returns false otherwise.
*
* @param index - Index/Identifier of Hacknet Node.
* @param n - Number of levels to purchase. Must be positive. Rounded to nearest integer.
* @returns True if the Hacknet Nodes level is successfully upgraded, false otherwise.
*/
upgradeLevel(index: number, n: number): boolean;
/**
2021-11-03 05:27:21 +01:00
* Upgrade the RAM of a hacknet node.
* @remarks
* RAM cost: 0 GB
*
2021-10-30 18:34:14 +02:00
* Tries to upgrade the specified Hacknet Nodes RAM n times.
* Note that each upgrade doubles the Nodes RAM.
* So this is equivalent to multiplying the Nodes RAM by 2 n.
*
* Returns true if the Hacknet Nodes RAM is successfully upgraded n times
2022-09-23 21:03:38 +02:00
* or if it is upgraded some positive number of times and the Node reaches its max RAM.
2021-10-30 18:34:14 +02:00
*
* Returns false otherwise.
*
* @param index - Index/Identifier of Hacknet Node.
* @param n - Number of times to upgrade RAM. Must be positive. Rounded to nearest integer.
2022-09-23 21:03:38 +02:00
* @returns True if the Hacknet Nodes RAM is successfully upgraded, false otherwise.
2021-10-30 18:34:14 +02:00
*/
upgradeRam(index: number, n: number): boolean;
/**
2021-11-03 05:27:21 +01:00
* Upgrade the core of a hacknet node.
* @remarks
* RAM cost: 0 GB
*
2021-10-30 18:34:14 +02:00
* Tries to purchase n cores for the specified Hacknet Node.
*
* Returns true if it successfully purchases n cores for the Hacknet Node
* or if it purchases some positive amount and the Node reaches its max number of cores.
*
* Returns false otherwise.
*
* @param index - Index/Identifier of Hacknet Node.
* @param n - Number of cores to purchase. Must be positive. Rounded to nearest integer.
* @returns True if the Hacknet Nodes cores are successfully purchased, false otherwise.
*/
upgradeCore(index: number, n: number): boolean;
/**
2021-11-03 05:27:21 +01:00
* Upgrade the cache of a hacknet node.
* @remarks
* RAM cost: 0 GB
*
2021-10-30 18:34:14 +02:00
* This function is only applicable for Hacknet Servers (the upgraded version of a Hacknet Node).
*
* Tries to upgrade the specified Hacknet Servers cache n times.
*
* Returns true if it successfully upgrades the Servers cache n times,
* or if it purchases some positive amount and the Server reaches its max cache level.
*
* Returns false otherwise.
*
* @param index - Index/Identifier of Hacknet Node.
* @param n - Number of cache levels to purchase. Must be positive. Rounded to nearest integer.
2022-09-23 21:03:38 +02:00
* @returns True if the Hacknet Nodes cache level is successfully upgraded, false otherwise.
2021-10-30 18:34:14 +02:00
*/
upgradeCache(index: number, n: number): boolean;
/**
2021-11-03 05:27:21 +01:00
* Calculate the cost of upgrading hacknet node levels.
* @remarks
* RAM cost: 0 GB
*
2021-10-30 18:34:14 +02:00
* Returns the cost of upgrading the specified Hacknet Node by n levels.
*
* If an invalid value for n is provided, then this function returns 0.
* If the specified Hacknet Node is already at max level, then Infinity is returned.
*
* @param index - Index/Identifier of Hacknet Node.
* @param n - Number of levels to upgrade. Must be positive. Rounded to nearest integer.
* @returns Cost of upgrading the specified Hacknet Node.
*/
getLevelUpgradeCost(index: number, n: number): number;
/**
2021-11-03 05:27:21 +01:00
* Calculate the cost of upgrading hacknet node RAM.
* @remarks
* RAM cost: 0 GB
*
2021-10-30 18:34:14 +02:00
* Returns the cost of upgrading the RAM of the specified Hacknet Node n times.
*
* If an invalid value for n is provided, then this function returns 0.
2022-09-23 21:03:38 +02:00
* If the specified Hacknet Node already has max RAM, then Infinity is returned.
2021-10-30 18:34:14 +02:00
*
* @param index - Index/Identifier of Hacknet Node.
* @param n - Number of times to upgrade RAM. Must be positive. Rounded to nearest integer.
2022-09-23 21:03:38 +02:00
* @returns Cost of upgrading the specified Hacknet Node's RAM.
2021-10-30 18:34:14 +02:00
*/
getRamUpgradeCost(index: number, n: number): number;
/**
2021-11-03 05:27:21 +01:00
* Calculate the cost of upgrading hacknet node cores.
* @remarks
* RAM cost: 0 GB
*
2021-10-30 18:34:14 +02:00
* Returns the cost of upgrading the number of cores of the specified Hacknet Node by n.
*
* If an invalid value for n is provided, then this function returns 0.
* If the specified Hacknet Node is already at max level, then Infinity is returned.
*
* @param index - Index/Identifier of Hacknet Node.
* @param n - Number of times to upgrade cores. Must be positive. Rounded to nearest integer.
* @returns Cost of upgrading the specified Hacknet Node's number of cores.
*/
getCoreUpgradeCost(index: number, n: number): number;
/**
2021-11-03 05:27:21 +01:00
* Calculate the cost of upgrading hacknet node cache.
* @remarks
* RAM cost: 0 GB
*
2021-10-30 18:34:14 +02:00
* This function is only applicable for Hacknet Servers (the upgraded version of a Hacknet Node).
*
* Returns the cost of upgrading the cache level of the specified Hacknet Server by n.
*
* If an invalid value for n is provided, then this function returns 0.
* If the specified Hacknet Node is already at max level, then Infinity is returned.
*
* @param index - Index/Identifier of Hacknet Node.
* @param n - Number of times to upgrade cache. Must be positive. Rounded to nearest integer.
* @returns Cost of upgrading the specified Hacknet Node's cache.
*/
getCacheUpgradeCost(index: number, n: number): number;
/**
2021-11-03 05:27:21 +01:00
* Get the total number of hashes stored.
* @remarks
* RAM cost: 0 GB
*
2021-10-30 18:34:14 +02:00
* This function is only applicable for Hacknet Servers (the upgraded version of a Hacknet Node).
*
* Returns the number of hashes you have.
*
* @returns Number of hashes you have.
*/
numHashes(): number;
/**
* Get the maximum number of hashes you can store.
* @remarks
* RAM cost: 0 GB
*
* This function is only applicable for Hacknet Servers (the upgraded version of a Hacknet Node).
*
* Returns the number of hashes you can store.
*
* @returns Number of hashes you can store.
*/
hashCapacity(): number;
2021-10-30 18:34:14 +02:00
/**
2021-11-03 05:27:21 +01:00
* Get the cost of a hash upgrade.
* @remarks
* RAM cost: 0 GB
*
2021-10-30 18:34:14 +02:00
* This function is only applicable for Hacknet Servers (the upgraded version of a Hacknet Node).
*
* Returns the number of hashes required for the specified upgrade. The name of the upgrade must be an exact match.
*
* @example
2021-10-30 21:46:34 +02:00
* ```ts
2022-01-08 19:25:06 +01:00
* // NS1:
2021-10-30 18:34:14 +02:00
* var upgradeName = "Sell for Corporation Funds";
* if (hacknet.numHashes() > hacknet.hashCost(upgradeName)) {
2022-04-12 16:23:05 +02:00
* hacknet.spendHashes(upgradeName);
2021-10-30 18:34:14 +02:00
* }
* ```
2022-01-08 19:25:06 +01:00
* @example
* ```ts
* // NS2:
* const upgradeName = "Sell for Corporation Funds";
* if (ns.hacknet.numHashes() > ns.hacknet.hashCost(upgradeName)) {
2022-04-12 16:23:05 +02:00
* ns.hacknet.spendHashes(upgradeName);
2022-01-08 19:25:06 +01:00
* }
* ```
2021-10-30 18:34:14 +02:00
* @param upgName - Name of the upgrade of Hacknet Node.
2022-08-17 14:50:05 +02:00
* @param count - Number of upgrades to buy at once. Defaults to 1 if not specified.
2021-10-30 18:34:14 +02:00
* @returns Number of hashes required for the specified upgrade.
*/
2022-08-17 14:50:05 +02:00
hashCost(upgName: string, count?: number): number;
2021-10-30 18:34:14 +02:00
/**
2021-11-03 05:27:21 +01:00
* Purchase a hash upgrade.
* @remarks
* RAM cost: 0 GB
*
2021-10-30 18:34:14 +02:00
* This function is only applicable for Hacknet Servers (the upgraded version of a Hacknet Node).
*
* Spend the hashes generated by your Hacknet Servers on an upgrade.
* Returns a boolean value - true if the upgrade is successfully purchased, and false otherwise.
*
* The name of the upgrade must be an exact match.
2021-10-30 21:46:34 +02:00
* The `upgTarget` argument is used for upgrades such as `Reduce Minimum Security`, which applies to a specific server.
* In this case, the `upgTarget` argument must be the hostname of the server.
2021-10-30 18:34:14 +02:00
*
* @example
2021-10-30 21:46:34 +02:00
* ```ts
2022-01-08 19:25:06 +01:00
* // NS1:
2021-10-30 18:34:14 +02:00
* hacknet.spendHashes("Sell for Corporation Funds");
* hacknet.spendHashes("Increase Maximum Money", "foodnstuff");
* ```
2022-01-08 19:25:06 +01:00
* @example
* ```ts
* NS2:
* ns.hacknet.spendHashes("Sell for Corporation Funds");
* ns.hacknet.spendHashes("Increase Maximum Money", "foodnstuff");
* ```
2021-10-30 18:34:14 +02:00
* @param upgName - Name of the upgrade of Hacknet Node.
* @param upgTarget - Object to which upgrade applies. Required for certain upgrades.
2022-08-17 14:50:05 +02:00
* @param count - Number of upgrades to buy at once. Defaults to 1 if not specified.
* For compatability reasons, upgTarget must be specified, even if it is not used, in order to specify count.
2022-09-23 21:03:38 +02:00
* @returns True if the upgrade is successfully purchased, and false otherwise.
2021-10-30 18:34:14 +02:00
*/
2022-08-17 14:50:05 +02:00
spendHashes(upgName: string, upgTarget?: string, count?: number): boolean;
2022-01-08 19:25:06 +01:00
/**
* Get the list of hash upgrades
* @remarks
* RAM cost: 0 GB
*
* This function is only applicable for Hacknet Servers (the upgraded version of a Hacknet Node).
*
* Returns the list of all available hash upgrades that can be used in the spendHashes function.
* @example
* ```ts
* // NS1:
* var upgrades = hacknet.getHashUpgrades(); // ["Sell for Money","Sell for Corporation Funds",...]
* ```
* @example
* ```ts
* // NS2:
* const upgrades = ns.hacknet.getHashUpgrades(); // ["Sell for Money","Sell for Corporation Funds",...]
* ```
* @returns An array containing the available upgrades
*/
getHashUpgrades(): string[];
/**
* Get the level of a hash upgrade.
* @remarks
* RAM cost: 0 GB
*
* This function is only applicable for Hacknet Servers (the upgraded version of a Hacknet Node).
*
* @returns Level of the upgrade.
*/
getHashUpgradeLevel(upgName: string): number;
/**
2022-03-17 21:50:46 +01:00
* Get the multiplier to study.
* @remarks
* RAM cost: 0 GB
*
* This function is only applicable for Hacknet Servers (the upgraded version of a Hacknet Node).
*
* @returns Multiplier.
*/
getStudyMult(): number;
/**
2022-03-17 21:50:46 +01:00
* Get the multiplier to training.
* @remarks
* RAM cost: 0 GB
*
* This function is only applicable for Hacknet Servers (the upgraded version of a Hacknet Node).
*
* @returns Multiplier.
*/
getTrainingMult(): number;
2021-10-30 18:34:14 +02:00
}
/**
2021-10-30 21:46:34 +02:00
* Hacknet related multipliers.
2021-10-30 18:34:14 +02:00
* @public
*/
export declare interface HacknetMultipliers {
/** Player's hacknet production multiplier */
production: number;
/** Player's hacknet purchase cost multiplier */
purchaseCost: number;
/** Player's hacknet ram cost multiplier */
ramCost: number;
/** Player's hacknet core cost multiplier */
coreCost: number;
/** Player's hacknet level cost multiplier */
levelCost: number;
}
2022-01-16 00:39:37 +01:00
/**
* Hacknet node related constants
* @public
*/
export declare interface HacknetNodeConstants {
/** Amount of money gained per level */
MoneyGainPerLevel: number;
/** Base cost for a new node */
BaseCost: number;
/** Base cost per level */
LevelBaseCost: number;
/** Base cost to incrase RAM */
RamBaseCost: number;
/** Base cost to increase cores */
CoreBaseCost: number;
/** Multiplier to purchase new node */
PurchaseNextMult: number;
/** Multiplier to increase node level */
UpgradeLevelMult: number;
/** Multiplier to increase RAM */
UpgradeRamMult: number;
/** Multiplier to increase cores */
UpgradeCoreMult: number;
/** Max node level */
MaxLevel: number;
/** Max amount of RAM in GB */
MaxRam: number;
/** Max number of cores */
MaxCores: number;
}
/**
2021-12-09 01:19:07 +01:00
* Hacknet Node formulas
* @public
*/
export declare interface HacknetNodesFormulas {
2021-12-09 01:19:07 +01:00
/**
* Calculate money gain rate.
* @param level - level of the node.
* @param ram - ram of the node.
* @param cores - cores of the node.
* @param mult - player production mult (default to 1)
* @returns The calculated money gain rate.
*/
moneyGainRate(level: number, ram: number, cores: number, mult?: number): number;
2021-12-09 01:19:07 +01:00
/**
* Calculate cost of upgrading hacknet node level.
* @param startingLevel - starting level
* @param extraLevels - amount of level to purchase (defaults to 1)
* @param costMult - player cost reduction (default to 1)
* @returns The calculated cost.
*/
levelUpgradeCost(startingLevel: number, extraLevels?: number, costMult?: number): number;
2021-12-09 01:19:07 +01:00
/**
* Calculate cost of upgrading hacknet node ram.
* @param startingRam - starting ram
* @param extraLevels - amount of level of ram to purchase (defaults to 1)
* @param costMult - player cost reduction (default to 1)
* @returns The calculated cost.
*/
ramUpgradeCost(startingRam: number, extraLevels?: number, costMult?: number): number;
2021-12-09 01:19:07 +01:00
/**
* Calculate cost of upgrading hacknet node cores.
* @param startingCore - starting cores
* @param extraCores - amount of cores to purchase (defaults to 1)
* @param costMult - player cost reduction (default to 1)
* @returns The calculated cost.
*/
coreUpgradeCost(startingCore: number, extraCores?: number, costMult?: number): number;
2021-12-09 01:19:07 +01:00
/**
* Calculate the cost of a hacknet node.
* @param n - number of the hacknet node
* @param mult - player cost reduction (defaults to 1)
* @returns The calculated cost.
*/
hacknetNodeCost(n: number, mult: number): number;
2021-12-09 01:19:07 +01:00
/**
* All constants used by the game.
* @returns An object with all hacknet node constants used by the game.
*/
2022-01-16 00:39:37 +01:00
constants(): HacknetNodeConstants;
}
/**
* Hacknet server related constants
* @public
*/
export declare interface HacknetServerConstants {
/** Number of hashes calculated per level */
HashesPerLevel: number;
/** Base cost for a new server */
BaseCost: number;
/** Base cost to increase RAM */
RamBaseCost: number;
/** Base cost to increase cores */
CoreBaseCost: number;
/** Base cost to upgrade cache */
CacheBaseCost: number;
/** Multiplier to purchase a new server */
PurchaseMult: number;
/** Multiplier to increase server level */
UpgradeLevelMult: number;
/** Multiplier to increase RAM */
UpgradeRamMult: number;
/** Multiplier to increase cores */
UpgradeCoreMult: number;
/** Multiplier to upgrade cache */
UpgradeCacheMult: number;
/** Max number of servers */
MaxServers: number;
/** Max level for a server */
MaxLevel: number;
/** Max amount of RAM in GB */
MaxRam: number;
/** Max number of cores */
MaxCores: number;
/** Max cache size */
MaxCache: number;
}
/**
2021-12-09 01:19:07 +01:00
* Hacknet Server formulas
* @public
*/
export declare interface HacknetServersFormulas {
2021-12-09 01:19:07 +01:00
/**
* Calculate hash gain rate.
* @param level - level of the server.
* @param ramUsed - ramUsed of the server.
* @param maxRam - maxRam of the server.
* @param cores - cores of the server.
* @param mult - player production mult (default to 1)
* @returns The calculated hash gain rate.
*/
hashGainRate(level: number, ramUsed: number, maxRam: number, cores: number, mult?: number): number;
2021-12-09 01:19:07 +01:00
/**
* Calculate cost of upgrading hacknet server level.
* @param startingLevel - starting level
* @param extraLevels - amount of level to purchase (defaults to 1)
* @param costMult - player cost reduction (default to 1)
* @returns The calculated cost.
*/
levelUpgradeCost(startingLevel: number, extraLevels?: number, costMult?: number): number;
2021-12-09 01:19:07 +01:00
/**
* Calculate cost of upgrading hacknet server ram.
* @param startingRam - starting ram
* @param extraLevels - amount of level of ram to purchase (defaults to 1)
* @param costMult - player cost reduction (default to 1)
* @returns The calculated cost.
*/
ramUpgradeCost(startingRam: number, extraLevels?: number, costMult?: number): number;
2021-12-09 01:19:07 +01:00
/**
* Calculate cost of upgrading hacknet server cores.
* @param startingCore - starting cores
* @param extraCores - amount of cores to purchase (defaults to 1)
* @param costMult - player cost reduction (default to 1)
* @returns The calculated cost.
*/
coreUpgradeCost(startingCore: number, extraCores?: number, costMult?: number): number;
2021-12-09 01:19:07 +01:00
/**
* Calculate cost of upgrading hacknet server cache.
* @param startingCache - starting cache level
* @param extraCache - amount of levels of cache to purchase (defaults to 1)
* @returns The calculated cost.
*/
cacheUpgradeCost(startingCache: number, extraCache?: number): number;
2021-12-09 01:19:07 +01:00
/**
* Calculate hash cost of an upgrade.
* @param upgName - name of the upgrade
* @param level - level of the upgrade
* @returns The calculated hash cost.
*/
hashUpgradeCost(upgName: number, level: number): number;
2021-12-09 01:19:07 +01:00
/**
* Calculate the cost of a hacknet server.
* @param n - number of the hacknet server
* @param mult - player cost reduction (defaults to 1)
* @returns The calculated cost.
*/
hacknetServerCost(n: number, mult?: number): number;
/**
* All constants used by the game.
* @returns An object with all hacknet server constants used by the game.
*/
2022-01-16 00:39:37 +01:00
constants(): HacknetServerConstants;
}
2022-08-17 14:50:05 +02:00
/**
* @public
*/
export declare interface HP {
current: number;
max: number;
}
/**
* @public
*/
export declare interface ILocation {
city: string;
name: string;
}
2022-05-24 14:12:49 +02:00
/**
* Infiltration API.
* @public
*/
export declare interface Infiltration {
/**
* Get all locations that can be infiltrated.
* @remarks
* RAM cost: 5 GB
*
* @returns all locations that can be infiltrated.
*/
2022-08-17 14:50:05 +02:00
getPossibleLocations(): PossibleInfiltrationLocation[];
2022-05-24 14:12:49 +02:00
/**
* Get all infiltrations with difficulty, location and rewards.
* @remarks
* RAM cost: 15 GB
*
* @returns Infiltration data for given location.
*/
getInfiltration(location: string): InfiltrationLocation;
}
/**
* @public
*/
export declare interface InfiltrationLocation {
2022-08-17 14:50:05 +02:00
location: ILocation;
2022-05-24 14:12:49 +02:00
reward: InfiltrationReward;
difficulty: number;
}
/**
* @public
*/
export declare interface InfiltrationReward {
tradeRep: number;
sellCash: number;
SoARep: number;
}
2022-01-16 17:13:45 +01:00
/**
* Corporation investment offer
* @public
*/
export declare interface InvestmentOffer {
/** Amount of funds you will get from this investment */
funds: number;
/** Amount of share you will give in exchange for this investment */
shares: number;
/** Current round of funding (max 4) */
round: number;
}
2022-01-16 00:39:37 +01:00
/**
* Interface Styles
* @internal
*/
export declare interface IStyleSettings {
fontFamily: string;
lineHeight: number;
}
2021-12-09 00:19:30 +01:00
/**
2021-12-09 02:03:22 +01:00
* Material in a warehouse
2021-12-09 00:19:30 +01:00
* @public
*/
2021-12-04 05:08:11 +01:00
export declare interface Material {
2021-12-09 02:03:22 +01:00
/** Name of the material */
2021-12-04 05:08:11 +01:00
name: string;
2021-12-09 02:03:22 +01:00
/** Amount of material */
2021-12-04 05:08:11 +01:00
qty: number;
2021-12-09 02:03:22 +01:00
/** Quality of the material */
2021-12-04 05:08:11 +01:00
qlt: number;
2022-04-13 07:35:35 +02:00
/** Demand for the material, only present if "Market Research - Demand" unlocked */
dmd: number | undefined;
/** Competition for the material, only present if "Market Research - Competition" unlocked */
cmp: number | undefined;
2022-01-16 17:13:45 +01:00
/** Amount of material produced */
prod: number;
2022-05-24 14:12:49 +02:00
/** Amount of material sold */
2022-01-16 17:13:45 +01:00
sell: number;
2022-09-23 21:03:38 +02:00
/** Cost to buy material */
2022-05-24 14:12:49 +02:00
cost: number;
/** Sell cost, can be "MP+5" */
sCost: string | number;
2022-09-23 21:03:38 +02:00
/** Export orders */
exp: Export[];
2021-12-04 05:08:11 +01:00
}
2022-08-17 14:50:05 +02:00
/**
* @public
*/
export declare interface Multipliers {
hacking_chance: number;
hacking_speed: number;
hacking_money: number;
hacking_grow: number;
hacking: number;
hacking_exp: number;
strength: number;
strength_exp: number;
defense: number;
defense_exp: number;
dexterity: number;
dexterity_exp: number;
agility: number;
agility_exp: number;
charisma: number;
charisma_exp: number;
hacknet_node_money: number;
hacknet_node_purchase_cost: number;
hacknet_node_ram_cost: number;
hacknet_node_core_cost: number;
hacknet_node_level_cost: number;
company_rep: number;
faction_rep: number;
work_money: number;
crime_success: number;
crime_money: number;
bladeburner_max_stamina: number;
bladeburner_stamina_gain: number;
bladeburner_analysis: number;
bladeburner_success_chance: number;
}
2022-01-16 00:39:37 +01:00
/**
* Object representing a port. A port is a serialized queue.
* @public
*/
export declare interface NetscriptPort {
/**
* Write data to a port.
* @remarks
* RAM cost: 0 GB
*
* @returns The data popped off the queue if it was full.
*/
write(value: string | number): null | string | number;
/**
* Attempt to write data to the port.
* @remarks
* RAM cost: 0 GB
*
* @returns True if the data was added to the port, false if the port was full
*/
tryWrite(value: string | number): boolean;
/**
* Shift an element out of the port.
* @remarks
* RAM cost: 0 GB
*
* This function will remove the first element from the port and return it.
* If the port is empty, then the string NULL PORT DATA will be returned.
* @returns the data read.
*/
read(): string | number;
/**
* Retrieve the first element from the port without removing it.
* @remarks
* RAM cost: 0 GB
*
* This function is used to peek at the data from a port. It returns the
* first element in the specified port without removing that element. If
* the port is empty, the string NULL PORT DATA will be returned.
* @returns the data read
*/
peek(): string | number;
/**
* Check if the port is full.
* @remarks
* RAM cost: 0 GB
*
* @returns true if the port is full, otherwise false
*/
full(): boolean;
/**
* Check if the port is empty.
* @remarks
* RAM cost: 0 GB
*
* @returns true if the port is empty, otherwise false
*/
empty(): boolean;
/**
* Empties all data from the port.
* @remarks
* RAM cost: 0 GB
*/
clear(): void;
}
2021-10-30 18:34:14 +02:00
/**
2021-10-30 21:46:34 +02:00
* Object representing all the values related to a hacknet node.
2021-10-30 18:34:14 +02:00
* @public
*/
export declare interface NodeStats {
2021-10-30 21:46:34 +02:00
/** Node's name */
2021-10-30 18:34:14 +02:00
name: string;
/** Node's level */
level: number;
2022-01-16 00:39:37 +01:00
/** Node's RAM (GB) */
2021-10-30 18:34:14 +02:00
ram: number;
2022-01-16 00:39:37 +01:00
/** Node's used RAM (GB) */
2022-08-17 14:50:05 +02:00
ramUsed?: number;
2021-10-30 18:34:14 +02:00
/** Node's number of cores */
cores: number;
/** Cache level. Only applicable for Hacknet Servers */
2022-08-17 14:50:05 +02:00
cache?: number;
2021-10-30 18:34:14 +02:00
/** Hash Capacity provided by this Node. Only applicable for Hacknet Servers */
2022-08-17 14:50:05 +02:00
hashCapacity?: number;
2021-10-30 18:34:14 +02:00
/** Node's production per second */
production: number;
/** Number of seconds since Node has been purchased */
timeOnline: number;
/** Total number of money Node has produced */
totalProduction: number;
}
/**
2021-10-30 21:46:34 +02:00
* Collection of all functions passed to scripts
2021-10-30 18:34:14 +02:00
* @public
2021-12-15 18:10:32 +01:00
* @remarks
* <b>Basic ns1 usage example:</b>
* ```ts
* // Basic ns functions can be used directly
2021-12-16 18:59:11 +01:00
* getHostname();
* // Some related functions are gathered within a common namespace
2021-12-16 18:59:11 +01:00
* stock.getPrice();
2021-12-15 18:10:32 +01:00
* ```
* {@link https://bitburner.readthedocs.io/en/latest/netscript/netscript1.html| ns1 in-game docs}
* <hr>
* <b>Basic ns2 usage example:</b>
* ```ts
* export async function main(ns) {
* // Basic ns functions can be accessed on the ns object
2021-12-16 21:28:53 +01:00
* ns.getHostname();
* // Some related functions are gathered under a sub-property of the ns object
2021-12-16 21:28:53 +01:00
* ns.stock.getPrice();
2022-03-17 21:50:46 +01:00
* // Some functions need to be awaited
2021-12-16 21:28:53 +01:00
* await ns.hack('n00dles');
* }
2021-12-15 18:10:32 +01:00
* ```
* {@link https://bitburner.readthedocs.io/en/latest/netscript/netscriptjs.html| ns2 in-game docs}
* <hr>
2021-10-30 18:34:14 +02:00
*/
2022-04-13 07:35:35 +02:00
export declare interface NS {
2021-10-30 18:34:14 +02:00
/**
* Namespace for hacknet functions.
2021-11-03 05:27:21 +01:00
* @remarks RAM cost: 4 GB
2021-10-30 18:34:14 +02:00
*/
2021-10-30 21:46:34 +02:00
readonly hacknet: Hacknet;
2021-10-30 18:34:14 +02:00
/**
2021-10-30 21:46:34 +02:00
*
* Namespace for bladeburner functions.
2021-10-30 21:46:34 +02:00
* @remarks RAM cost: 0 GB
2021-10-30 18:34:14 +02:00
*/
readonly bladeburner: Bladeburner;
/**
2021-10-30 21:46:34 +02:00
*
* Namespace for codingcontract functions.
2021-10-30 21:46:34 +02:00
* @remarks RAM cost: 0 GB
2021-10-30 18:34:14 +02:00
*/
readonly codingcontract: CodingContract;
/**
2021-10-30 21:46:34 +02:00
*
* Namespace for gang functions.
2021-10-30 21:46:34 +02:00
* @remarks RAM cost: 0 GB
2021-10-30 18:34:14 +02:00
*/
readonly gang: Gang;
/**
2021-10-30 21:46:34 +02:00
*
* Namespace for sleeve functions.
2021-10-30 21:46:34 +02:00
* @remarks RAM cost: 0 GB
2021-10-30 18:34:14 +02:00
*/
readonly sleeve: Sleeve;
/**
2021-10-30 21:46:34 +02:00
*
* Namespace for stock functions.
* @remarks
* RAM cost: 0 GB
2021-10-30 18:34:14 +02:00
*/
readonly stock: TIX;
/**
*
* Namespace for formulas functions.
* @remarks
* RAM cost: 0 GB
*/
readonly formulas: Formulas;
2021-12-03 22:14:13 +01:00
/**
* Namespace for stanek functions.
* RAM cost: 0 GB
*/
readonly stanek: Stanek;
2022-05-24 14:12:49 +02:00
/**
* Namespace for infiltration functions.
* RAM cost: 0 GB
*/
readonly infiltration: Infiltration;
2021-12-04 05:08:11 +01:00
/**
* Namespace for corporation functions.
2022-08-17 14:50:05 +02:00
* RAM cost: 1022.4 GB
2021-12-04 05:08:11 +01:00
*/
readonly corporation: Corporation;
2022-01-08 19:25:06 +01:00
/**
* Namespace for user interface functions.
* RAM cost: 0 GB
*/
readonly ui: UserInterface;
2022-04-13 07:35:35 +02:00
/**
* Namespace for singularity functions.
* RAM cost: 0 GB
*/
readonly singularity: Singularity;
2022-03-29 21:49:31 +02:00
/**
* Namespace for grafting functions.
* @remarks
* RAM cost: 0 GB
*/
readonly grafting: Grafting;
2021-10-30 18:34:14 +02:00
/**
2021-10-30 21:46:34 +02:00
* Arguments passed into the script.
*
* @remarks
* RAM cost: 0 GB
*
2021-10-30 18:34:14 +02:00
* Arguments passed into a script can be accessed using a normal
* array using the [] operator (args[0], args[1], etc).
*
2021-10-30 21:46:34 +02:00
* It is also possible to get the number of arguments that was passed into a script using: 'args.length'
2021-10-30 18:34:14 +02:00
* WARNING: Do not try to modify the args array. This will break the game.
*/
readonly args: (string | number | boolean)[];
2021-10-30 18:34:14 +02:00
/**
2021-11-03 05:27:21 +01:00
* Steal a servers money.
* @remarks
* RAM cost: 0.1 GB
*
2021-10-30 18:34:14 +02:00
* Function that is used to try and hack servers to steal money and gain hacking experience.
* The runtime for this command depends on your hacking level and the target servers
2022-01-08 19:25:06 +01:00
* security level when this function is called. In order to hack a server you must first gain root access to that server
2021-10-30 18:34:14 +02:00
* and also have the required hacking level.
*
* A script can hack a server from anywhere. It does not need to be running on the same
2021-10-30 21:46:34 +02:00
* server to hack that server. For example, you can create a script that hacks the `foodnstuff`
2021-10-30 18:34:14 +02:00
* server and run that script on any server in the game.
*
2021-10-30 21:46:34 +02:00
* A successful `hack()` on a server will raise that servers security level by 0.002.
2021-10-30 18:34:14 +02:00
*
* @example
2021-10-30 21:46:34 +02:00
* ```ts
2022-01-08 19:25:06 +01:00
* // NS1:
* var earnedMoney = hack("foodnstuff");
* ```
* @example
* ```ts
* // NS2:
* let earnedMoney = await ns.hack("foodnstuff");
2021-10-30 18:34:14 +02:00
* ```
2021-10-30 21:46:34 +02:00
* @param host - Hostname of the target server to hack.
2021-10-30 18:34:14 +02:00
* @param opts - Optional parameters for configuring function behavior.
* @returns The amount of money stolen if the hack is successful, and zero otherwise.
*/
2021-10-30 21:46:34 +02:00
hack(host: string, opts?: BasicHGWOptions): Promise<number>;
2021-10-30 18:34:14 +02:00
/**
2021-11-03 05:27:21 +01:00
* Spoof money in a servers bank account, increasing the amount available.
* @remarks
* RAM cost: 0.15 GB
*
2021-10-30 18:34:14 +02:00
* Use your hacking skills to increase the amount of money available on a server.
* The runtime for this command depends on your hacking level and the target servers
2021-10-30 21:46:34 +02:00
* security level. When `grow` completes, the money available on a target server will
2021-10-30 18:34:14 +02:00
* be increased by a certain, fixed percentage. This percentage is determined by the
* target servers growth rate (which varies between servers) and security level. Generally,
* higher-level servers have higher growth rates. The getServerGrowth() function can be used
* to obtain a servers growth rate.
*
2021-10-30 21:46:34 +02:00
* Like hack, `grow` can be called on any server, regardless of where the script is running.
2021-10-30 18:34:14 +02:00
* The grow() command requires root access to the target server, but there is no required hacking
* level to run the command. It also raises the security level of the target server by 0.004.
*
* @example
2021-10-30 21:46:34 +02:00
* ```ts
2022-01-08 19:25:06 +01:00
* // NS1:
2022-03-17 21:50:46 +01:00
* var currentMoney = getServerMoneyAvailable("foodnstuff");
2022-01-08 19:25:06 +01:00
* currentMoney = currentMoney * (1 + grow("foodnstuff"));
* ```
* @example
* ```ts
* // NS2:
2022-03-17 21:50:46 +01:00
* let currentMoney = ns.getServerMoneyAvailable("foodnstuff");
2022-01-08 19:25:06 +01:00
* currentMoney *= (1 + await ns.grow("foodnstuff"));
2021-10-30 18:34:14 +02:00
* ```
2021-10-30 21:46:34 +02:00
* @param host - Hostname of the target server to grow.
2021-10-30 18:34:14 +02:00
* @param opts - Optional parameters for configuring function behavior.
* @returns The number by which the money on the server was multiplied for the growth.
*/
2021-10-30 21:46:34 +02:00
grow(host: string, opts?: BasicHGWOptions): Promise<number>;
2021-10-30 18:34:14 +02:00
/**
2021-11-03 05:27:21 +01:00
* Reduce a server security level.
* @remarks
* RAM cost: 0.15 GB
*
2021-10-30 18:34:14 +02:00
* Use your hacking skills to attack a servers security, lowering the servers security level.
* The runtime for this command depends on your hacking level and the target servers security
2022-01-08 19:25:06 +01:00
* level when this function is called. This function lowers the security level of the target server by 0.05.
2021-10-30 18:34:14 +02:00
*
2021-10-30 21:46:34 +02:00
* Like hack and grow, `weaken` can be called on any server, regardless of
2021-10-30 18:34:14 +02:00
* where the script is running. This command requires root access to the target server, but
* there is no required hacking level to run the command.
*
* @example
2021-10-30 21:46:34 +02:00
* ```ts
2022-01-08 19:25:06 +01:00
* // NS1:
* var currentSecurity = getServerSecurityLevel("foodnstuff");
* currentSecurity = currentSecurity - weaken("foodnstuff");
* ```
* @example
* ```ts
* // NS2:
* let currentSecurity = ns.getServerSecurityLevel("foodnstuff");
* currentSecurity -= await ns.weaken("foodnstuff");
2021-10-30 18:34:14 +02:00
* ```
2021-10-30 21:46:34 +02:00
* @param host - Hostname of the target server to weaken.
2021-10-30 18:34:14 +02:00
* @param opts - Optional parameters for configuring function behavior.
* @returns The amount by which the target servers security level was decreased. This is equivalent to 0.05 multiplied by the number of script threads.
*/
2021-10-30 21:46:34 +02:00
weaken(host: string, opts?: BasicHGWOptions): Promise<number>;
2021-10-30 18:34:14 +02:00
/**
2021-11-03 05:27:21 +01:00
* Predict the effect of weaken.
* @remarks
* RAM cost: 1 GB
*
2021-10-30 18:34:14 +02:00
* Returns the security decrease that would occur if a weaken with this many threads happened.
*
* @param threads - Amount of threads that will be used.
* @param cores - Optional. The number of cores of the server that would run weaken.
* @returns The security decrease.
*/
weakenAnalyze(threads: number, cores?: number): number;
/**
2021-11-03 05:27:21 +01:00
* Predict the effect of hack.
* @remarks
* RAM cost: 1 GB
*
2021-10-30 18:34:14 +02:00
* This function returns the number of script threads you need when running the hack command
* to steal the specified amount of money from the target server.
* If hackAmount is less than zero or greater than the amount of money available on the server,
* then this function returns -1.
*
* Warning: The value returned by this function isnt necessarily a whole number.
*
* @example
2021-10-30 21:46:34 +02:00
* ```ts
2021-10-30 18:34:14 +02:00
* //For example, lets say the foodnstuff server has $10m and you run:
* hackAnalyzeThreads("foodnstuff", 1e6);
* //If this function returns 50, this means that if your next hack call is run on a script with 50 threads, it will steal $1m from the foodnstuff server.
* ```
2021-10-30 21:46:34 +02:00
* @param host - Hostname of the target server to analyze.
2021-10-30 18:34:14 +02:00
* @param hackAmount - Amount of money you want to hack from the server.
* @returns The number of threads needed to hack the server for hackAmount money.
*/
2021-10-30 21:46:34 +02:00
hackAnalyzeThreads(host: string, hackAmount: number): number;
2021-10-30 18:34:14 +02:00
/**
2022-01-08 19:25:06 +01:00
* Get the part of money stolen with a single thread.
* @remarks
* RAM cost: 1 GB
*
2022-01-08 19:25:06 +01:00
* Returns the part of the specified servers money you will steal with a single thread hack.
2021-10-30 18:34:14 +02:00
*
* @example
2021-10-30 21:46:34 +02:00
* ```ts
2022-01-08 19:25:06 +01:00
* // NS1:
2021-12-15 18:10:32 +01:00
* //For example, assume the following returns 0.01:
2022-01-08 19:25:06 +01:00
* var hackAmount = hackAnalyze("foodnstuff");
* //This means that if hack the foodnstuff server using a single thread, then you will steal 1%, or 0.01 of its total money. If you hack using N threads, then you will steal N*0.01 times its total money.
* ```
* @example
* ```ts
* // NS2:
* //For example, assume the following returns 0.01:
* const hackAmount = ns.hackAnalyze("foodnstuff");
* //This means that if hack the foodnstuff server using a single thread, then you will steal 1%, or 0.01 of its total money. If you hack using N threads, then you will steal N*0.01 times its total money.
2021-10-30 18:34:14 +02:00
* ```
2021-10-30 21:46:34 +02:00
* @param host - Hostname of the target server.
2022-01-08 19:25:06 +01:00
* @returns The part of money you will steal from the target server with a single thread hack.
2021-10-30 18:34:14 +02:00
*/
hackAnalyze(host: string): number;
2021-10-30 18:34:14 +02:00
/**
* Get the security increase for a number of thread.
* @remarks
* RAM cost: 1 GB
*
2021-10-30 18:34:14 +02:00
* Returns the security increase that would occur if a hack with this many threads happened.
*
* @param threads - Amount of threads that will be used.
2022-04-12 17:42:49 +02:00
* @param hostname - Hostname of the target server. The number of threads is limited to the number needed to hack the servers maximum amount of money.
2021-10-30 18:34:14 +02:00
* @returns The security increase.
*/
2022-04-12 17:42:49 +02:00
hackAnalyzeSecurity(threads: number, hostname?: string): number;
2021-10-30 18:34:14 +02:00
/**
* Get the chance of successfully hacking a server.
* @remarks
* RAM cost: 1 GB
*
2021-10-30 18:34:14 +02:00
* Returns the chance you have of successfully hacking the specified server.
*
* This returned value is in decimal form, not percentage.
*
2021-10-30 21:46:34 +02:00
* @param host - Hostname of the target server.
2021-10-30 18:34:14 +02:00
* @returns The chance you have of successfully hacking the target server.
*/
hackAnalyzeChance(host: string): number;
2021-10-30 18:34:14 +02:00
/**
* Calculate the number of grow thread needed to grow a server by a certain multiplier.
* @remarks
* RAM cost: 1 GB
*
2021-10-30 18:34:14 +02:00
* This function returns the number of growths needed in order to increase
* the amount of money available on the specified server by the specified amount.
* The specified amount is multiplicative and is in decimal form, not percentage.
*
* Warning: The value returned by this function isnt necessarily a whole number.
*
* @example
2021-10-30 21:46:34 +02:00
* ```ts
2022-01-08 19:25:06 +01:00
* // NS1:
* //For example, if you want to determine how many grow calls you need to double the amount of money on foodnstuff, you would use:
* var growTimes = growthAnalyze("foodnstuff", 2);
* //If this returns 100, then this means you need to call grow 100 times in order to double the money (or once with 100 threads).
* ```
* @example
* ```ts
* // NS2:
2021-10-30 18:34:14 +02:00
* //For example, if you want to determine how many grow calls you need to double the amount of money on foodnstuff, you would use:
2022-01-08 19:25:06 +01:00
* const growTimes = ns.growthAnalyze("foodnstuff", 2);
2021-10-30 18:34:14 +02:00
* //If this returns 100, then this means you need to call grow 100 times in order to double the money (or once with 100 threads).
* ```
2021-10-30 21:46:34 +02:00
* @param host - Hostname of the target server.
2021-10-30 18:34:14 +02:00
* @param growthAmount - Multiplicative factor by which the server is grown. Decimal form..
* @returns The amount of grow calls needed to grow the specified server by the specified amount
*/
2021-11-22 17:36:13 +01:00
growthAnalyze(host: string, growthAmount: number, cores?: number): number;
2021-10-30 18:34:14 +02:00
/**
* Calculate the security increase for a number of thread.
* @remarks
* RAM cost: 1 GB
*
2021-10-30 18:34:14 +02:00
* Returns the security increase that would occur if a grow with this many threads happened.
*
* @param threads - Amount of threads that will be used.
2022-04-13 18:32:26 +02:00
* @param hostname - Optional. Hostname of the target server. The number of threads is limited to the number needed to hack the servers maximum amount of money.
* @param cores - Optional. The number of cores of the server that would run grow.
2021-10-30 18:34:14 +02:00
* @returns The security increase.
*/
2022-04-13 18:32:26 +02:00
growthAnalyzeSecurity(threads: number, hostname?: string, cores?: number): number;
2021-10-30 18:34:14 +02:00
/**
* Suspends the script for n milliseconds.
* @remarks
* RAM cost: 0 GB
2021-10-30 18:34:14 +02:00
*
* @param millis - Number of milliseconds to sleep.
2022-01-08 19:25:06 +01:00
* @example
* ```ts
* // NS1:
* // This will count from 1 to 10 in your terminal, with one number every 5 seconds
* for (var i=0; i<10; i++) {
* tprint(i + 1);
* sleep(5000);
* }
* ```
* @example
* ```ts
* // NS2:
* // This will count from 1 to 10 in your terminal, with one number every 5 seconds
* for (var i=0; i<10; i++) {
* ns.tprint(i + 1);
* await ns.sleep(5000);
* }
* ```
2021-10-30 18:34:14 +02:00
* @returns
*/
2022-04-13 07:35:35 +02:00
sleep(millis: number): Promise<true>;
2021-10-30 18:34:14 +02:00
/**
* Suspends the script for n milliseconds. Doesn't block with concurrent calls.
2022-05-24 14:12:49 +02:00
* You should prefer 'sleep' over 'asleep' except when doing very complex UI work.
* @remarks
* RAM cost: 0 GB
*
* @param millis - Number of milliseconds to sleep.
* @returns
*/
2022-04-13 07:35:35 +02:00
asleep(millis: number): Promise<true>;
2021-10-30 18:34:14 +02:00
/**
2022-01-08 19:25:06 +01:00
* Prints one or move values or variables to the scripts logs.
* @remarks
* RAM cost: 0 GB
2021-10-30 18:34:14 +02:00
*
2022-01-08 19:25:06 +01:00
* @param args - Value(s) to be printed.
2021-10-30 18:34:14 +02:00
*/
2022-01-08 19:25:06 +01:00
print(...args: any[]): void;
2021-10-30 18:34:14 +02:00
2022-03-17 21:50:46 +01:00
/**
* Prints a formatted string to the scripts logs.
* @remarks
* RAM cost: 0 GB
*
* see: https://github.com/alexei/sprintf.js
* @param format - format of the message
* @param args - Value(s) to be printed.
*/
printf(format: string, ...args: any[]): void;
2021-10-30 18:34:14 +02:00
/**
2022-01-08 19:25:06 +01:00
* Prints one or more values or variables to the Terminal.
* @remarks
* RAM cost: 0 GB
2021-10-30 18:34:14 +02:00
*
2022-01-08 19:25:06 +01:00
* @param args - Value(s) to be printed.
2021-10-30 18:34:14 +02:00
*/
2022-01-08 19:25:06 +01:00
tprint(...args: any[]): void;
2021-10-30 18:34:14 +02:00
/**
* Prints a raw value or a variable to the Terminal.
* @remarks
* RAM cost: 0 GB
*
2022-07-16 05:47:19 +02:00
* see: https://github.com/alexei/sprintf.js
2021-11-22 17:36:13 +01:00
* @param format - format of the message
* @param msg - Value to be printed.
*/
2021-11-22 17:36:13 +01:00
tprintf(format: string, ...values: any[]): void;
2021-10-30 18:34:14 +02:00
/**
* Clears the scripts logs.
* @remarks
* RAM cost: 0 GB
2021-10-30 18:34:14 +02:00
*/
clearLog(): void;
/**
2021-10-30 21:46:34 +02:00
* Disables logging for the given function.
* @remarks
* RAM cost: 0 GB
*
2021-10-30 21:46:34 +02:00
* Logging can be disabled for all functions by passing `ALL` as the argument.
2021-10-30 18:34:14 +02:00
*
* Note that this does not completely remove all logging functionality.
* This only stops a function from logging when the function is successful.
* If the function fails, it will still log the reason for failure.
*
* @param fn - Name of function for which to disable logging.
*/
disableLog(fn: string): void;
/**
* Enable logging for a certain function.
* @remarks
* RAM cost: 0 GB
*
2021-10-30 21:46:34 +02:00
* Re-enables logging for the given function. If `ALL` is passed into this
* function as an argument, then it will revert the effects of disableLog(`ALL`).
2021-10-30 18:34:14 +02:00
*
* @param fn - Name of function for which to enable logging.
*/
enableLog(fn: string): void;
/**
* Checks the status of the logging for the given function.
* @remarks
* RAM cost: 0 GB
2021-10-30 18:34:14 +02:00
*
* @param fn - Name of function to check.
2021-10-30 21:46:34 +02:00
* @returns Returns a boolean indicating whether or not logging is enabled for that function (or `ALL`)
2021-10-30 18:34:14 +02:00
*/
isLogEnabled(fn: string): boolean;
/**
* Get all the logs of a script.
* @remarks
* RAM cost: 0 GB
*
2021-10-30 18:34:14 +02:00
* Returns a scripts logs. The logs are returned as an array, where each line is an element in the array.
* The most recently logged line is at the end of the array.
* Note that there is a maximum number of lines that a script stores in its logs. This is configurable in the games options.
* If the function is called with no arguments, it will return the current scripts logs.
*
* Otherwise, the fn, hostname/ip, and args arguments can be used to get the logs from another script.
* Remember that scripts are uniquely identified by both their names and arguments.
*
* @example
2021-10-30 21:46:34 +02:00
* ```ts
2022-01-08 19:25:06 +01:00
* // NS1:
2021-10-30 18:34:14 +02:00
* //Get logs from foo.script on the current server that was run with no args
* getScriptLogs("foo.script");
2022-01-08 19:25:06 +01:00
*
2021-10-30 18:34:14 +02:00
* //Open logs from foo.script on the foodnstuff server that was run with no args
* getScriptLogs("foo.script", "foodnstuff");
2022-01-08 19:25:06 +01:00
*
* //Open logs from foo.script on the foodnstuff server that was run with the arguments [1, "test"]
* getScriptLogs("foo.script", "foodnstuff", 1, "test");
2021-10-30 18:34:14 +02:00
* ```
* @example
2021-10-30 21:46:34 +02:00
* ```ts
2022-01-08 19:25:06 +01:00
* // NS2:
* //Get logs from foo.script on the current server that was run with no args
* ns.getScriptLogs("foo.script");
*
* //Open logs from foo.script on the foodnstuff server that was run with no args
* ns.getScriptLogs("foo.script", "foodnstuff");
*
2021-10-30 18:34:14 +02:00
* //Open logs from foo.script on the foodnstuff server that was run with the arguments [1, "test"]
2022-01-08 19:25:06 +01:00
* ns.getScriptLogs("foo.script", "foodnstuff", 1, "test");
2021-10-30 18:34:14 +02:00
* ```
* @param fn - Optional. Filename of script to get logs from.
2021-10-30 21:46:34 +02:00
* @param host - Optional. Hostname of the server that the script is on.
2021-10-30 18:34:14 +02:00
* @param args - Arguments to identify which scripts to get logs for.
* @returns Returns an string array, where each line is an element in the array. The most recently logged line is at the end of the array.
*/
2022-07-16 05:47:19 +02:00
getScriptLogs(fn?: string, host?: string, ...args: (string | number | boolean)[]): string[];
2021-10-30 18:34:14 +02:00
2022-04-13 07:35:35 +02:00
/**
* Get an array of recently killed scripts across all servers.
* @remarks
* RAM cost: 0.2 GB
*
* The most recently killed script is the first element in the array.
* Note that there is a maximum number of recently killed scripts which are tracked.
* This is configurable in the game's options as `Recently killed scripts size`.
*
* @example
* ```ts
* let recentScripts = ns.getRecentScripts();
* let mostRecent = recentScripts.shift()
* if (mostRecent)
* ns.tprint(mostRecent.logs.join('\n'))
* ```
*
* @returns Array with information about previously killed scripts.
*/
getRecentScripts(): RecentScript[];
2021-10-30 18:34:14 +02:00
/**
* Open the tail window of a script.
* @remarks
* RAM cost: 0 GB
*
2021-10-30 18:34:14 +02:00
* Opens a scripts logs. This is functionally the same as the tail Terminal command.
*
* If the function is called with no arguments, it will open the current scripts logs.
*
* Otherwise, the fn, hostname/ip, and args arguments can be used to get the logs from another script.
* Remember that scripts are uniquely identified by both their names and arguments.
*
* @example
2021-10-30 21:46:34 +02:00
* ```ts
2022-01-08 19:25:06 +01:00
* // NS1:
2021-10-30 18:34:14 +02:00
* //Open logs from foo.script on the current server that was run with no args
* tail("foo.script");
2022-01-08 19:25:06 +01:00
*
2021-10-30 18:34:14 +02:00
* //Get logs from foo.script on the foodnstuff server that was run with no args
* tail("foo.script", "foodnstuff");
2022-01-08 19:25:06 +01:00
*
* //Get logs from foo.script on the foodnstuff server that was run with the arguments [1, "test"]
* tail("foo.script", "foodnstuff", 1, "test");
2021-10-30 18:34:14 +02:00
* ```
* @example
2021-10-30 21:46:34 +02:00
* ```ts
2022-01-08 19:25:06 +01:00
* // NS2:
* //Open logs from foo.script on the current server that was run with no args
* ns.tail("foo.script");
*
* //Get logs from foo.script on the foodnstuff server that was run with no args
* ns.tail("foo.script", "foodnstuff");
*
2021-10-30 18:34:14 +02:00
* //Get logs from foo.script on the foodnstuff server that was run with the arguments [1, "test"]
2022-01-08 19:25:06 +01:00
* ns.tail("foo.script", "foodnstuff", 1, "test");
2021-10-30 18:34:14 +02:00
* ```
2022-01-16 00:39:37 +01:00
* @param fn - Optional. Filename or PID of the script being tailed. If omitted, the current script is tailed.
2021-10-30 21:46:34 +02:00
* @param host - Optional. Hostname of the script being tailed. Defaults to the server this script is running on. If args are specified, this is not optional.
2021-10-30 18:34:14 +02:00
* @param args - Arguments for the script being tailed.
*/
2022-07-16 05:47:19 +02:00
tail(fn?: FilenameOrPID, host?: string, ...args: (string | number | boolean)[]): void;
2021-10-30 18:34:14 +02:00
2022-09-23 21:03:38 +02:00
/**
* Move a tail window
* @remarks
* RAM cost: 0 GB
*
* Moves a tail window. Coordinates are in screenspace pixels (top left is 0,0)
*
* @param x - x coordinate.
* @param y - y coordinate.
* @param pid - Optional. PID of the script having its tail moved. If omitted, the current script is used.
*/
moveTail(x: number, y: number, pid?: number): void;
/**
* Resize a tail window
* @remarks
* RAM cost: 0 GB
*
* Resize a tail window. Size are in pixel
*
* @param width - width of the window.
* @param height - height of the window.
* @param pid - Optional. PID of the script having its tail resized. If omitted, the current script is used.
*/
resizeTail(width: number, height: number, pid?: number): void;
2022-05-24 14:12:49 +02:00
/**
* Close the tail window of a script.
* @remarks
* RAM cost: 0 GB
*
* Closes a scripts logs. This is functionally the same pressing the "Close" button on the tail window.
*
* If the function is called with no arguments, it will close the current scripts logs.
*
* Otherwise, the pid argument can be used to close the logs from another script.
*
* @param pid - Optional. PID of the script having its tail closed. If omitted, the current script is used.
*/
closeTail(pid?: number): void;
2021-10-30 18:34:14 +02:00
/**
2022-01-08 19:25:06 +01:00
* Get the list of servers connected to a server.
* @remarks
* RAM cost: 0.2 GB
*
2021-12-16 21:21:00 +01:00
* Returns an array containing the hostnames of all servers that are one
* node way from the specified target server. The hostnames in the returned
2021-10-30 18:34:14 +02:00
* array are strings.
*
2022-01-08 19:25:06 +01:00
* @param host - Optional, Hostname of the server to scan, default to current server.
2021-12-16 21:21:00 +01:00
* @returns Returns an string of hostnames.
2021-10-30 18:34:14 +02:00
*/
2021-12-16 21:21:00 +01:00
scan(host?: string): string[];
2021-10-30 18:34:14 +02:00
/**
* Runs NUKE.exe on a server.
* @remarks
* RAM cost: 0.05 GB
*
2022-01-08 19:25:06 +01:00
* Running NUKE.exe on a target server gives you root access which means you can executes scripts on said server. NUKE.exe must exist on your home computer.
2021-10-30 18:34:14 +02:00
*
* @example
2021-10-30 21:46:34 +02:00
* ```ts
2022-01-08 19:25:06 +01:00
* // NS1:
2021-10-30 18:34:14 +02:00
* nuke("foodnstuff");
* ```
2022-01-08 19:25:06 +01:00
* @example
* ```ts
* // NS2:
* ns.nuke("foodnstuff");
* ```
2021-10-30 21:46:34 +02:00
* @param host - Hostname of the target server.
2021-10-30 18:34:14 +02:00
*/
2021-10-30 21:46:34 +02:00
nuke(host: string): void;
2021-10-30 18:34:14 +02:00
/**
* Runs BruteSSH.exe on a server.
* @remarks
* RAM cost: 0.05 GB
*
2021-10-30 18:34:14 +02:00
* Runs the BruteSSH.exe program on the target server. BruteSSH.exe must exist on your home computer.
*
* @example
2021-10-30 21:46:34 +02:00
* ```ts
2022-01-08 19:25:06 +01:00
* // NS1:
2021-10-30 18:34:14 +02:00
* brutessh("foodnstuff");
* ```
2022-01-08 19:25:06 +01:00
* @example
* ```ts
* // NS2:
* ns.brutessh("foodnstuff");
* ```
2021-10-30 21:46:34 +02:00
* @param host - Hostname of the target server.
2021-10-30 18:34:14 +02:00
*/
2021-10-30 21:46:34 +02:00
brutessh(host: string): void;
2021-10-30 18:34:14 +02:00
/**
* Runs FTPCrack.exe on a server.
* @remarks
* RAM cost: 0.05 GB
*
2021-10-30 18:34:14 +02:00
* Runs the FTPCrack.exe program on the target server. FTPCrack.exe must exist on your home computer.
*
* @example
2021-10-30 21:46:34 +02:00
* ```ts
2022-01-08 19:25:06 +01:00
* // NS1:
2021-10-30 18:34:14 +02:00
* ftpcrack("foodnstuff");
* ```
2022-01-08 19:25:06 +01:00
* @example
* ```ts
* // NS2:
* ns.ftpcrack("foodnstuff");
* ```
2021-10-30 21:46:34 +02:00
* @param host - Hostname of the target server.
2021-10-30 18:34:14 +02:00
*/
2021-10-30 21:46:34 +02:00
ftpcrack(host: string): void;
2021-10-30 18:34:14 +02:00
/**
* Runs relaySMTP.exe on a server.
* @remarks
* RAM cost: 0.05 GB
*
2021-10-30 18:34:14 +02:00
* Runs the relaySMTP.exe program on the target server. relaySMTP.exe must exist on your home computer.
*
* @example
2021-10-30 21:46:34 +02:00
* ```ts
2022-01-08 19:25:06 +01:00
* // NS1:
2021-10-30 18:34:14 +02:00
* relaysmtp("foodnstuff");
* ```
2022-01-08 19:25:06 +01:00
* @example
* ```ts
* // NS2:
* ns.relaysmtp("foodnstuff");
* ```
2021-10-30 21:46:34 +02:00
* @param host - Hostname of the target server.
2021-10-30 18:34:14 +02:00
*/
2021-10-30 21:46:34 +02:00
relaysmtp(host: string): void;
2021-10-30 18:34:14 +02:00
/**
* Runs HTTPWorm.exe on a server.
* @remarks
* RAM cost: 0.05 GB
*
2021-10-30 18:34:14 +02:00
* Runs the HTTPWorm.exe program on the target server. HTTPWorm.exe must exist on your home computer.
*
* @example
2021-10-30 21:46:34 +02:00
* ```ts
2022-01-08 19:25:06 +01:00
* // NS1:
2021-10-30 18:34:14 +02:00
* httpworm("foodnstuff");
* ```
2022-01-08 19:25:06 +01:00
* @example
* ```ts
* // NS2:
* ns.httpworm("foodnstuff");
* ```
2021-10-30 21:46:34 +02:00
* @param host - Hostname of the target server.
2021-10-30 18:34:14 +02:00
*/
2021-10-30 21:46:34 +02:00
httpworm(host: string): void;
2021-10-30 18:34:14 +02:00
/**
* Runs SQLInject.exe on a server.
* @remarks
* RAM cost: 0.05 GB
*
2021-10-30 18:34:14 +02:00
* Runs the SQLInject.exe program on the target server. SQLInject.exe must exist on your home computer.
*
* @example
2021-10-30 21:46:34 +02:00
* ```ts
2022-01-08 19:25:06 +01:00
* // NS1:
2021-10-30 18:34:14 +02:00
* sqlinject("foodnstuff");
* ```
2022-01-08 19:25:06 +01:00
* @example
* ```ts
* // NS2:
* ns.sqlinject("foodnstuff");
* ```
2021-10-30 21:46:34 +02:00
* @remarks RAM cost: 0.05 GB
* @param host - Hostname of the target server.
2021-10-30 18:34:14 +02:00
*/
2021-10-30 21:46:34 +02:00
sqlinject(host: string): void;
2021-10-30 18:34:14 +02:00
/**
* Start another script on the current server.
* @remarks
* RAM cost: 1 GB
*
2021-10-30 18:34:14 +02:00
* Run a script as a separate process. This function can only be used to run scripts located on the
* current server (the server running the script that calls this function). Requires a significant
* amount of RAM to run this command.
*
* If the script was successfully started, then this functions returns the PID of that script.
* Otherwise, it returns 0.
*
* PID stands for Process ID. The PID is a unique identifier for each script.
* The PID will always be a positive integer.
*
2022-08-23 17:33:29 +02:00
* Running this function with a numThreads argument of 0 or less will cause a runtime error.
2021-10-30 18:34:14 +02:00
*
* @example
2021-10-30 21:46:34 +02:00
* ```ts
2022-01-08 19:25:06 +01:00
* // NS1:
2021-10-30 18:34:14 +02:00
* //The simplest way to use the run command is to call it with just the script name. The following example will run foo.script single-threaded with no arguments:
* run("foo.script");
2022-01-08 19:25:06 +01:00
*
2021-10-30 18:34:14 +02:00
* //The following example will run foo.script but with 5 threads instead of single-threaded:
* run("foo.script", 5);
2022-01-08 19:25:06 +01:00
*
* //This next example will run foo.script single-threaded, and will pass the string foodnstuff into the script as an argument:
* run("foo.script", 1, 'foodnstuff');
2021-10-30 18:34:14 +02:00
* ```
* @example
2021-10-30 21:46:34 +02:00
* ```ts
2022-01-08 19:25:06 +01:00
* // NS2:
* //The simplest way to use the run command is to call it with just the script name. The following example will run foo.script single-threaded with no arguments:
* ns.run("foo.script");
*
* //The following example will run foo.script but with 5 threads instead of single-threaded:
* ns.run("foo.script", 5);
*
2021-10-30 18:34:14 +02:00
* //This next example will run foo.script single-threaded, and will pass the string foodnstuff into the script as an argument:
2022-01-08 19:25:06 +01:00
* ns.run("foo.script", 1, 'foodnstuff');
2021-10-30 18:34:14 +02:00
* ```
* @param script - Filename of script to run.
* @param numThreads - Optional thread count for new script. Set to 1 by default. Will be rounded to nearest integer.
* @param args - Additional arguments to pass into the new script that is being run. Note that if any arguments are being passed into the new script, then the second argument numThreads must be filled in with a value.
* @returns Returns the PID of a successfully started script, and 0 otherwise.
*/
2022-07-16 05:47:19 +02:00
run(script: string, numThreads?: number, ...args: (string | number | boolean)[]): number;
2021-10-30 18:34:14 +02:00
/**
* Start another script on any server.
* @remarks
* RAM cost: 1.3 GB
*
2021-10-30 18:34:14 +02:00
* Run a script as a separate process on a specified server. This is similar to the run function
* except that it can be used to run a script on any server, instead of just the current server.
*
* If the script was successfully started, then this functions returns the PID of that script.
* Otherwise, it returns 0.
*
* PID stands for Process ID. The PID is a unique identifier for each script.
* The PID will always be a positive integer.
*
2022-08-23 17:33:29 +02:00
* Running this function with a numThreads argument of 0 or less will cause a runtime error.
2021-10-30 18:34:14 +02:00
*
* @example
2021-10-30 21:46:34 +02:00
* ```ts
2022-01-08 19:25:06 +01:00
* // NS1:
2021-10-30 18:34:14 +02:00
* //The simplest way to use the exec command is to call it with just the script name and the target server. The following example will try to run generic-hack.script on the foodnstuff server:
* exec("generic-hack.script", "foodnstuff");
2022-01-08 19:25:06 +01:00
*
2021-10-30 18:34:14 +02:00
* //The following example will try to run the script generic-hack.script on the joesguns server with 10 threads:
* exec("generic-hack.script", "joesguns", 10);
2022-01-08 19:25:06 +01:00
*
* //This last example will try to run the script foo.script on the foodnstuff server with 5 threads. It will also pass the number 1 and the string “test” in as arguments to the script:
* exec("foo.script", "foodnstuff", 5, 1, "test");
2021-10-30 18:34:14 +02:00
* ```
2022-01-08 19:25:06 +01:00
* * @example
2021-10-30 21:46:34 +02:00
* ```ts
2022-01-08 19:25:06 +01:00
* // NS2:
* //The simplest way to use the exec command is to call it with just the script name and the target server. The following example will try to run generic-hack.script on the foodnstuff server:
* ns.exec("generic-hack.script", "foodnstuff");
*
* //The following example will try to run the script generic-hack.script on the joesguns server with 10 threads:
* ns.exec("generic-hack.script", "joesguns", 10);
*
2021-10-30 18:34:14 +02:00
* //This last example will try to run the script foo.script on the foodnstuff server with 5 threads. It will also pass the number 1 and the string “test” in as arguments to the script:
2022-01-08 19:25:06 +01:00
* ns.exec("foo.script", "foodnstuff", 5, 1, "test");
2021-10-30 18:34:14 +02:00
* ```
* @param script - Filename of script to execute.
2021-10-30 21:46:34 +02:00
* @param host - Hostname of the `target server` on which to execute the script.
2021-10-30 18:34:14 +02:00
* @param numThreads - Optional thread count for new script. Set to 1 by default. Will be rounded to nearest integer.
* @param args - Additional arguments to pass into the new script that is being run. Note that if any arguments are being passed into the new script, then the third argument numThreads must be filled in with a value.
* @returns Returns the PID of a successfully started script, and 0 otherwise.
*/
2022-07-16 05:47:19 +02:00
exec(script: string, host: string, numThreads?: number, ...args: (string | number | boolean)[]): number;
2021-10-30 18:34:14 +02:00
/**
* Terminate current script and start another in 10s.
* @remarks
* RAM cost: 2 GB
*
2021-10-30 18:34:14 +02:00
* Terminates the current script, and then after a delay of about 10 seconds it will execute the
* newly-specified script. The purpose of this function is to execute a new script without being
* constrained by the RAM usage of the current one. This function can only be used to run scripts
* on the local server.
*
* Because this function immediately terminates the script, it does not have a return value.
*
2022-08-23 17:33:29 +02:00
* Running this function with a numThreads argument of 0 or less will cause a runtime error.
*
2021-10-30 18:34:14 +02:00
* @example
2021-10-30 21:46:34 +02:00
* ```ts
2022-01-08 19:25:06 +01:00
* // NS1:
2021-10-30 18:34:14 +02:00
* //The following example will execute the script foo.script with 10 threads and the arguments foodnstuff and 90:
* spawn('foo.script', 10, 'foodnstuff', 90);
* ```
2022-01-08 19:25:06 +01:00
* @example
* ```ts
* // NS2:
* //The following example will execute the script foo.script with 10 threads and the arguments foodnstuff and 90:
* ns.spawn('foo.script', 10, 'foodnstuff', 90);
* ```
2021-10-30 18:34:14 +02:00
* @param script - Filename of script to execute.
* @param numThreads - Number of threads to spawn new script with. Will be rounded to nearest integer.
* @param args - Additional arguments to pass into the new script that is being run.
*/
2022-07-16 05:47:19 +02:00
spawn(script: string, numThreads?: number, ...args: (string | number | boolean)[]): void;
2021-10-30 18:34:14 +02:00
/**
* Terminate another script.
* @remarks
* RAM cost: 0.5 GB
*
2021-10-30 18:34:14 +02:00
* Kills the script on the target server specified by the scripts name and arguments.
* Remember that scripts are uniquely identified by both their name and arguments.
2021-10-30 21:46:34 +02:00
* For example, if `foo.script` is run with the argument 1, then this is not the same as
* `foo.script` run with the argument 2, even though they have the same code.
2021-10-30 18:34:14 +02:00
*
* @example
2021-10-30 21:46:34 +02:00
* ```ts
2022-01-08 19:25:06 +01:00
* // NS1:
2021-10-30 18:34:14 +02:00
* //The following example will try to kill a script named foo.script on the foodnstuff server that was ran with no arguments:
* kill("foo.script", "foodnstuff");
2022-01-08 19:25:06 +01:00
*
2021-10-30 18:34:14 +02:00
* //The following will try to kill a script named foo.script on the current server that was ran with no arguments:
* kill("foo.script", getHostname());
2022-01-08 19:25:06 +01:00
*
* //The following will try to kill a script named foo.script on the current server that was ran with the arguments 1 and “foodnstuff”:
* kill("foo.script", getHostname(), 1, "foodnstuff");
2021-10-30 18:34:14 +02:00
* ```
* @example
2021-10-30 21:46:34 +02:00
* ```ts
2022-01-08 19:25:06 +01:00
* // NS2:
* //The following example will try to kill a script named foo.script on the foodnstuff server that was ran with no arguments:
* ns.kill("foo.script", "foodnstuff");
*
* //The following will try to kill a script named foo.script on the current server that was ran with no arguments:
* ns.kill("foo.script", getHostname());
*
2021-10-30 18:34:14 +02:00
* //The following will try to kill a script named foo.script on the current server that was ran with the arguments 1 and “foodnstuff”:
2022-01-08 19:25:06 +01:00
* ns.kill("foo.script", getHostname(), 1, "foodnstuff");
2021-10-30 18:34:14 +02:00
* ```
* @param script - Filename or pid of the script to kill
2021-10-30 21:46:34 +02:00
* @param host - Hostname of the server on which to kill the script.
2021-10-30 18:34:14 +02:00
* @param args - Arguments to identify which script to kill.
* @returns True if the script is successfully killed, and false otherwise.
*/
2022-01-08 19:25:06 +01:00
kill(script: number): boolean;
2022-03-17 21:50:46 +01:00
/**
* {@inheritDoc NS.(kill:1)}
* @example
* ```ts
* // NS1:
* //The following example will try to kill a script named foo.script on the foodnstuff server that was ran with no arguments:
* kill("foo.script", "foodnstuff");
*
* //The following will try to kill a script named foo.script on the current server that was ran with no arguments:
* kill("foo.script", getHostname());
*
* //The following will try to kill a script named foo.script on the current server that was ran with the arguments 1 and “foodnstuff”:
* kill("foo.script", getHostname(), 1, "foodnstuff");
* ```
* @example
* ```ts
* // NS2:
* //The following example will try to kill a script named foo.script on the foodnstuff server that was ran with no arguments:
* ns.kill("foo.script", "foodnstuff");
*
* //The following will try to kill a script named foo.script on the current server that was ran with no arguments:
* ns.kill("foo.script", getHostname());
*
* //The following will try to kill a script named foo.script on the current server that was ran with the arguments 1 and “foodnstuff”:
* ns.kill("foo.script", getHostname(), 1, "foodnstuff");
* ```
*/
2022-07-16 05:47:19 +02:00
kill(script: string, host: string, ...args: (string | number | boolean)[]): boolean;
2021-10-30 18:34:14 +02:00
/**
* Terminate all scripts on a server.
* @remarks
* RAM cost: 0.5 GB
*
2021-10-30 18:34:14 +02:00
* Kills all running scripts on the specified server. This function returns true
* if any scripts were killed, and false otherwise. In other words, it will return
* true if there are any scripts running on the target server.
2022-01-08 19:25:06 +01:00
* If no host is defined, it will kill all scripts, where the script is running.
2021-10-30 18:34:14 +02:00
*
* @param host - IP or hostname of the server on which to kill all scripts.
2022-05-24 14:12:49 +02:00
* @param safetyguard - Skips the script that calls this function
2021-10-30 18:34:14 +02:00
* @returns True if any scripts were killed, and false otherwise.
*/
2022-05-24 14:12:49 +02:00
killall(host?: string, safetyguard?: boolean): boolean;
2021-10-30 18:34:14 +02:00
/**
* Terminates the current script immediately.
* @remarks
* RAM cost: 0 GB
2021-10-30 18:34:14 +02:00
*/
2022-09-23 21:03:38 +02:00
exit(): never;
2021-10-30 18:34:14 +02:00
/**
* Copy file between servers.
* @remarks
* RAM cost: 0.6 GB
*
2021-10-30 18:34:14 +02:00
* Copies a script or literature (.lit) file(s) to another server. The files argument can be either a string
* specifying a single file to copy, or an array of strings specifying multiple files to copy.
*
* @example
2021-10-30 21:46:34 +02:00
* ```ts
2022-01-08 19:25:06 +01:00
* // NS1:
2021-10-30 18:34:14 +02:00
* //Copies foo.lit from the helios server to the home computer:
2022-08-17 14:50:05 +02:00
* scp("foo.lit", "home", "helios");
2022-01-08 19:25:06 +01:00
*
* //Tries to copy three files from rothman-uni to home computer:
* files = ["foo1.lit", "foo2.script", "foo3.script"];
2022-08-17 14:50:05 +02:00
* scp(files, "home", "rothman-uni");
2021-10-30 18:34:14 +02:00
* ```
* @example
2021-10-30 21:46:34 +02:00
* ```ts
2022-01-08 19:25:06 +01:00
* // NS2:
* //Copies foo.lit from the helios server to the home computer:
2022-09-23 21:03:38 +02:00
* ns.scp("foo.lit", "home", "helios" );
2022-01-08 19:25:06 +01:00
*
2021-10-30 18:34:14 +02:00
* //Tries to copy three files from rothman-uni to home computer:
* files = ["foo1.lit", "foo2.script", "foo3.script"];
2022-09-23 21:03:38 +02:00
* ns.scp(files, "home", "rothman-uni");
2022-01-08 19:25:06 +01:00
* ```
* @example
* ```ts
* //ns2, copies files from home to a target server
* const server = ns.args[0];
* const files = ["hack.js","weaken.js","grow.js"];
2022-09-23 21:03:38 +02:00
* ns.scp(files, server, "home");
2021-10-30 18:34:14 +02:00
* ```
* @param files - Filename or an array of filenames of script/literature files to copy.
2021-11-03 05:27:21 +01:00
* @param destination - Host of the destination server, which is the server to which the file will be copied.
2022-09-23 21:03:38 +02:00
* @param source - Host of the source server, which is the server from which the file will be copied. This argument is optional and if its omitted the source will be the current server.
* @returns True if the file is successfully copied over and false otherwise. If the files argument is an array then this function will return false if any of the operations failed.
2021-10-30 18:34:14 +02:00
*/
2022-09-23 21:03:38 +02:00
scp(files: string | string[], destination: string, source?: string): boolean;
2021-10-30 18:34:14 +02:00
/**
* List files on a server.
* @remarks
* RAM cost: 0.2 GB
*
2021-10-30 18:34:14 +02:00
* Returns an array with the filenames of all files on the specified server
* (as strings). The returned array is sorted in alphabetic order.
*
2021-11-03 05:27:21 +01:00
* @param host - Host of the target server.
2021-10-30 18:34:14 +02:00
* @param grep - A substring to search for in the filename.
* @returns Array with the filenames of all files on the specified server.
*/
2021-10-30 21:46:34 +02:00
ls(host: string, grep?: string): string[];
2021-10-30 18:34:14 +02:00
/**
* List running scripts on a server.
* @remarks
* RAM cost: 0.2 GB
*
2021-10-30 18:34:14 +02:00
* Returns an array with general information about all scripts running on the specified target server.
*
* @example
2021-10-30 21:46:34 +02:00
* ```ts
2022-01-08 19:25:06 +01:00
* // NS1:
2022-03-17 21:50:46 +01:00
* var scripts = ps("home");
* for (var i = 0; i < scripts.length; ++i) {
2022-01-08 19:25:06 +01:00
* tprint(scripts[i].filename + ' ' + scripts[i].threads);
* tprint(scripts[i].args);
* }
* ```
* @example
* ```ts
* // NS2:
* const ps = ns.ps("home");
2022-03-17 21:50:46 +01:00
* for (let script of ps) {
* ns.tprint(`${script.filename} ${script.threads}`);
2022-01-08 19:25:06 +01:00
* ns.tprint(script.args);
2021-10-30 18:34:14 +02:00
* }
* ```
2021-11-03 05:27:21 +01:00
* @param host - Host address of the target server. If not specified, it will be the current servers IP by default.
2021-10-30 18:34:14 +02:00
* @returns Array with general information about all scripts running on the specified target server.
*/
2021-10-30 21:46:34 +02:00
ps(host?: string): ProcessInfo[];
2021-10-30 18:34:14 +02:00
/**
* Check if your have root access on a server.
* @remarks
* RAM cost: 0.05 GB
*
2021-10-30 18:34:14 +02:00
* Returns a boolean indicating whether or not the player has root access to the specified target server.
*
* @example
2021-10-30 21:46:34 +02:00
* ```ts
2022-01-08 19:25:06 +01:00
* // NS1:
2021-10-30 18:34:14 +02:00
* if (hasRootAccess("foodnstuff") == false) {
* nuke("foodnstuff");
* }
* ```
2022-01-08 19:25:06 +01:00
* @example
* ```ts
* // NS2:
* if (ns.hasRootAccess("foodnstuff") == false) {
* ns.nuke("foodnstuff");
* }
* ```
2021-11-03 05:27:21 +01:00
* @param host - Host of the target server
2021-10-30 18:34:14 +02:00
* @returns True if player has root access to the specified target server, and false otherwise.
*/
2021-10-30 21:46:34 +02:00
hasRootAccess(host: string): boolean;
2021-10-30 18:34:14 +02:00
/**
* Returns a string with the hostname of the server that the script is running on.
*
* @remarks
* RAM cost: 0.05 GB
2021-10-30 18:34:14 +02:00
* @returns Hostname of the server that the script is on.
*/
2021-10-30 21:46:34 +02:00
getHostname(): string;
2021-10-30 18:34:14 +02:00
/**
* Returns the players current hacking level.
*
* @remarks
* RAM cost: 0.05 GB
2021-10-30 18:34:14 +02:00
* @returns Players current hacking level
*/
getHackingLevel(): number;
/**
* Get hacking related multipliers.
* @remarks
* RAM cost: 4 GB
*
2021-10-30 18:34:14 +02:00
* Returns an object containing the Players hacking related multipliers.
* These multipliers are returned in fractional forms, not percentages
* (e.g. 1.5 instead of 150%).
*
* @example
2021-10-30 21:46:34 +02:00
* ```ts
2022-01-08 19:25:06 +01:00
* // NS1:
* // Example of how this can be used:
* var mults = getHackingMultipliers();
2021-10-30 18:34:14 +02:00
* print(mults.chance);
* print(mults.growth);
* ```
2022-01-08 19:25:06 +01:00
* @example
* ```ts
* // NS2:
* // Example of how this can be used:
* const {chance, growth} = ns.getHackingMultipliers();
* print(chance);
* print(growth);
* ```
2021-10-30 18:34:14 +02:00
* @returns Object containing the Players hacking related multipliers.
*/
getHackingMultipliers(): HackingMultipliers;
/**
* Get hacknet related multipliers.
* @remarks
* RAM cost: 4 GB
*
2021-10-30 18:34:14 +02:00
* Returns an object containing the Players hacknet related multipliers.
* These multipliers are returned in fractional forms, not percentages
* (e.g. 1.5 instead of 150%).
*
* @example
2021-10-30 21:46:34 +02:00
* ```ts
2022-01-08 19:25:06 +01:00
* // NS1:
* // Example of how this can be used:
* var mults = getHacknetMultipliers();
2021-10-30 18:34:14 +02:00
* print(mults.production);
* print(mults.purchaseCost);
* ```
2022-01-08 19:25:06 +01:00
* @example
* ```ts
* // NS2:
* // Example of how this can be used:
* const {production, purchaseCost} = ns.getHacknetMultipliers();
* print(production);
* print(purchaseCost);
* ```
2021-10-30 18:34:14 +02:00
* @returns Object containing the Players hacknet related multipliers.
*/
getHacknetMultipliers(): HacknetMultipliers;
/**
* Returns a server object for the given server. Defaults to the running script's server if host is not specified.
*
* @remarks
* RAM cost: 2 GB
2021-10-30 21:46:34 +02:00
* @param host - Optional. Hostname for the requested server object.
2021-10-30 18:34:14 +02:00
* @returns The requested server object.
*/
2021-10-30 21:46:34 +02:00
getServer(host?: string): Server;
2021-10-30 18:34:14 +02:00
/**
* Get money available on a server.
* @remarks
* RAM cost: 0.1 GB
*
2021-10-30 18:34:14 +02:00
* Returns the amount of money available on a server.
* Running this function on the home computer will return the players money.
*
* @example
2021-10-30 21:46:34 +02:00
* ```ts
2022-01-08 19:25:06 +01:00
* // NS1:
2021-10-30 18:34:14 +02:00
* getServerMoneyAvailable("foodnstuff");
* getServerMoneyAvailable("home"); //Returns player's money
* ```
2022-01-08 19:25:06 +01:00
* @example
* ```ts
* // NS2:
* ns.getServerMoneyAvailable("foodnstuff");
* ns.getServerMoneyAvailable("home"); // Returns player's money
* ```
2021-11-03 05:27:21 +01:00
* @param host - Host of target server
2021-10-30 18:34:14 +02:00
* @returns Amount of money available on the server.
*/
2021-10-30 21:46:34 +02:00
getServerMoneyAvailable(host: string): number;
2021-10-30 18:34:14 +02:00
/**
* Get maximum money available on a server.
* @remarks
* RAM cost: 0.1 GB
*
2021-10-30 18:34:14 +02:00
* Returns the maximum amount of money that can be available on a server.
*
2021-11-03 05:27:21 +01:00
* @param host - Host of target server.
2021-10-30 18:34:14 +02:00
* @returns Maximum amount of money available on the server.
*/
2021-10-30 21:46:34 +02:00
getServerMaxMoney(host: string): number;
2021-10-30 18:34:14 +02:00
/**
* Get a server growth parameter.
* @remarks
* RAM cost: 0.1 GB
*
2022-01-18 20:02:12 +01:00
* Returns the servers intrinsic growth parameter. This growth
* parameter is a number typically between 0 and 100 that represents
* how quickly the servers money grows. This parameter affects the
2021-10-30 18:34:14 +02:00
* percentage by which the servers money is increased when using the
* grow function. A higher growth parameter will result in a
* higher percentage increase from grow.
*
2021-11-03 05:27:21 +01:00
* @param host - Host of target server.
2021-10-30 18:34:14 +02:00
* @returns Parameter that affects the percentage by which the servers money is increased when using the grow function.
*/
2021-10-30 21:46:34 +02:00
getServerGrowth(host: string): number;
2021-10-30 18:34:14 +02:00
/**
* Get server security level.
* @remarks
* RAM cost: 0.1 GB
*
2021-10-30 18:34:14 +02:00
* Returns the security level of the target server. A servers security
* level is denoted by a number, typically between 1 and 100
* (but it can go above 100).
*
2021-11-03 05:27:21 +01:00
* @param host - Host of target server.
2021-10-30 18:34:14 +02:00
* @returns Security level of the target server.
*/
2021-10-30 21:46:34 +02:00
getServerSecurityLevel(host: string): number;
2021-10-30 18:34:14 +02:00
/**
* Returns the minimum security level of the target server.
*
2021-10-30 21:46:34 +02:00
* @remarks RAM cost: 0.1 GB
2021-11-03 05:27:21 +01:00
* @param host - Host of target server.
2021-10-30 18:34:14 +02:00
* @returns Minimum security level of the target server.
*/
2021-10-30 21:46:34 +02:00
getServerMinSecurityLevel(host: string): number;
2021-10-30 18:34:14 +02:00
/**
2021-12-03 20:12:32 +01:00
* @deprecated useless
* @remarks
* RAM cost: 0.1 GB
* Returns the base security level of the target server. This is the security
* level that the server starts out with. This is different than
* getServerSecurityLevel because getServerSecurityLevel returns
* the current security level of a server, which can constantly change due to
* hack, grow, and weaken, calls on that server.
* The base security level will stay the same until you reset by
* installing an Augmentation(s).
*
* @param host - Host of target server.
* @returns Base security level of the target server.
*/
getServerBaseSecurityLevel(host: string): number;
/**
2021-12-03 20:12:32 +01:00
* @deprecated use getServerMaxRam / getServerUsedRam
* @remarks
* RAM cost: 0.1 GB
*
* Returns an array with two elements that gives information about a servers memory (RAM).
* The first element in the array is the amount of RAM that the server has total (in GB).
* The second element in the array is the amount of RAM that is currently being used on
* the server (in GB).
*
* @example
* ```ts
2022-01-08 19:25:06 +01:00
* // NS1:
* var serverRam = getServerRam("helios");
* var totalRam = serverRam[0];
* var ramUsed = serverRam[1];
* ```
* @example
* ```ts
* // NS2:
* const [totalRam, ramUsed] = ns.getServerRam("helios");
* ```
* @param host - Host of target server.
2022-01-16 00:39:37 +01:00
* @returns Array with total and used memory on the specified server, in GB.
*/
getServerRam(host: string): [number, number];
/**
* Get the max RAM on a server.
* @remarks
* RAM cost: 0.05 GB
*
* @param host - Hostname of the target server.
2022-01-16 00:39:37 +01:00
* @returns max ram (GB)
*/
getServerMaxRam(host: string): number;
/**
* Get the used RAM on a server.
* @remarks
* RAM cost: 0.05 GB
*
* @param host - Hostname of the target server.
2022-01-16 00:39:37 +01:00
* @returns used ram (GB)
*/
getServerUsedRam(host: string): number;
2021-10-30 18:34:14 +02:00
/**
* Returns the required hacking level of the target server.
*
2021-10-30 21:46:34 +02:00
* @remarks RAM cost: 0.1 GB
2021-11-03 05:27:21 +01:00
* @param host - Host of target server.
2021-10-30 18:34:14 +02:00
* @returns The required hacking level of the target server.
*/
2021-10-30 21:46:34 +02:00
getServerRequiredHackingLevel(host: string): number;
2021-10-30 18:34:14 +02:00
/**
* Returns the number of open ports required to successfully run NUKE.exe on the specified server.
*
2021-10-30 21:46:34 +02:00
* @remarks RAM cost: 0.1 GB
2021-11-03 05:27:21 +01:00
* @param host - Host of target server.
2021-10-30 18:34:14 +02:00
* @returns The number of open ports required to successfully run NUKE.exe on the specified server.
*/
2021-10-30 21:46:34 +02:00
getServerNumPortsRequired(host: string): number;
2021-10-30 18:34:14 +02:00
/**
* Returns a boolean denoting whether or not the specified server exists.
*
2021-10-30 21:46:34 +02:00
* @remarks RAM cost: 0.1 GB
2021-11-03 05:27:21 +01:00
* @param host - Host of target server.
2021-10-30 18:34:14 +02:00
* @returns True if specified server exists, and false otherwise.
*/
2021-10-30 21:46:34 +02:00
serverExists(host: string): boolean;
2021-10-30 18:34:14 +02:00
/**
* Check if a file exists.
* @remarks
* RAM cost: 0.1 GB
*
2021-10-30 18:34:14 +02:00
* Returns a boolean indicating whether the specified file exists on the target server.
* The filename for scripts is case-sensitive, but for other types of files it is not.
* For example, fileExists(brutessh.exe) will work fine, even though the actual program
* is named 'BruteSSH.exe'.
*
* If the hostname/ip argument is omitted, then the function will search through the current
* server (the server running the script that calls this function) for the file.
*
* @example
2021-10-30 21:46:34 +02:00
* ```ts
2022-01-08 19:25:06 +01:00
* // NS1:
2021-10-30 18:34:14 +02:00
* //The function call will return true if the script named foo.script exists on the foodnstuff server, and false otherwise.
* fileExists("foo.script", "foodnstuff");
2022-01-08 19:25:06 +01:00
*
2021-10-30 18:34:14 +02:00
* //The function call will return true if the current server contains the FTPCrack.exe program, and false otherwise.
* fileExists("ftpcrack.exe");
* ```
2022-01-08 19:25:06 +01:00
* * @example
* ```ts
* // NS2:
* // The function call will return true if the script named foo.script exists on the foodnstuff server, and false otherwise.
* ns.fileExists("foo.script", "foodnstuff");
*
* // The function call will return true if the current server contains the FTPCrack.exe program, and false otherwise.
* ns.fileExists("ftpcrack.exe");
* ```
2021-10-30 18:34:14 +02:00
* @param filename - Filename of file to check.
2021-11-03 05:27:21 +01:00
* @param host - Host of target server. This is optional. If it is not specified then the function will use the current server as the target server.
2021-10-30 18:34:14 +02:00
* @returns True if specified file exists, and false otherwise.
*/
2021-10-30 21:46:34 +02:00
fileExists(filename: string, host?: string): boolean;
2021-10-30 18:34:14 +02:00
/**
* Check if a script is running.
* @remarks
* RAM cost: 0.1 GB
*
2021-10-30 18:34:14 +02:00
* Returns a boolean indicating whether the specified script is running on the target server.
2022-01-16 00:39:37 +01:00
* If you use a PID instead of a filename, the hostname and args parameters are unnecessary.
2021-10-30 18:34:14 +02:00
* Remember that a script is uniquely identified by both its name and its arguments.
*
* @example
2021-10-30 21:46:34 +02:00
* ```ts
2022-01-08 19:25:06 +01:00
* // NS1:
2021-10-30 18:34:14 +02:00
* //The function call will return true if there is a script named foo.script with no arguments running on the foodnstuff server, and false otherwise:
* isRunning("foo.script", "foodnstuff");
2022-01-08 19:25:06 +01:00
*
2021-10-30 18:34:14 +02:00
* //The function call will return true if there is a script named foo.script with no arguments running on the current server, and false otherwise:
* isRunning("foo.script", getHostname());
2022-01-08 19:25:06 +01:00
*
* //The function call will return true if there is a script named foo.script running with the arguments 1, 5, and “test” (in that order) on the joesguns server, and false otherwise:
* isRunning("foo.script", "joesguns", 1, 5, "test");
2021-10-30 18:34:14 +02:00
* ```
* @example
2021-10-30 21:46:34 +02:00
* ```ts
2022-01-08 19:25:06 +01:00
* // NS2:
* //The function call will return true if there is a script named foo.script with no arguments running on the foodnstuff server, and false otherwise:
* ns.isRunning("foo.script", "foodnstuff");
*
* //The function call will return true if there is a script named foo.script with no arguments running on the current server, and false otherwise:
* ns.isRunning("foo.script", ns.getHostname());
*
2021-10-30 18:34:14 +02:00
* //The function call will return true if there is a script named foo.script running with the arguments 1, 5, and “test” (in that order) on the joesguns server, and false otherwise:
2022-01-08 19:25:06 +01:00
* ns.isRunning("foo.script", "joesguns", 1, 5, "test");
2021-10-30 18:34:14 +02:00
* ```
2022-01-16 00:39:37 +01:00
* @param script - Filename or PID of script to check. This is case-sensitive.
2021-11-03 05:27:21 +01:00
* @param host - Host of target server.
2021-10-30 18:34:14 +02:00
* @param args - Arguments to specify/identify which scripts to search for.
* @returns True if specified script is running on the target server, and false otherwise.
*/
2022-07-16 05:47:19 +02:00
isRunning(script: FilenameOrPID, host?: string, ...args: (string | number | boolean)[]): boolean;
2021-10-30 18:34:14 +02:00
/**
* Get general info about a running script.
* @remarks
* RAM cost: 0.3 GB
2022-01-08 19:25:06 +01:00
*
2022-02-15 18:22:49 +01:00
* Running with no args returns current script.
2022-01-16 00:39:37 +01:00
* If you use a PID as the first parameter, the hostname and args parameters are unnecessary.
2022-01-08 19:25:06 +01:00
*
2022-01-16 00:39:37 +01:00
* @param filename - Optional. Filename or PID of the script.
* @param hostname - Optional. Name of host server the script is running on.
* @param args - Arguments to identify the script
2022-03-17 21:50:46 +01:00
* @returns The info about the running script if found, and null otherwise.
*/
2022-07-16 05:47:19 +02:00
getRunningScript(
filename?: FilenameOrPID,
hostname?: string,
...args: (string | number | boolean)[]
): RunningScript | null;
2021-10-30 18:34:14 +02:00
/**
* Get cost of purchasing a server.
* @remarks
* RAM cost: 0.25 GB
*
2021-10-30 18:34:14 +02:00
* Returns the cost to purchase a server with the specified amount of ram.
*
* @example
2021-10-30 21:46:34 +02:00
* ```ts
2022-01-08 19:25:06 +01:00
* // NS1:
2021-10-30 18:34:14 +02:00
* for (i = 1; i <= 20; i++) {
* tprint(i + " -- " + getPurchasedServerCost(Math.pow(2, i)));
* }
* ```
2022-01-08 19:25:06 +01:00
* @example
* ```ts
* // NS2:
* for (i = 1; i <= 20; i++) {
* ns.tprint(i + " -- " + ns.getPurchasedServerCost(Math.pow(2, i)));
* }
* ```
2022-01-16 00:39:37 +01:00
* @param ram - Amount of RAM of a potential purchased server, in GB. Must be a power of 2 (2, 4, 8, 16, etc.). Maximum value of 1048576 (2^20).
2021-10-30 18:34:14 +02:00
* @returns The cost to purchase a server with the specified amount of ram.
*/
getPurchasedServerCost(ram: number): number;
/**
* Purchase a server.
* @remarks
* 2.25 GB
*
2021-10-30 18:34:14 +02:00
* Purchased a server with the specified hostname and amount of RAM.
*
* The hostname argument can be any data type, but it will be converted to a string
* and have whitespace removed. Anything that resolves to an empty string will cause
* the function to fail. If there is already a server with the specified hostname,
* then the function will automatically append a number at the end of the hostname
* argument value until it finds a unique hostname. For example, if the script calls
2021-10-30 21:46:34 +02:00
* `purchaseServer(“foo”, 4)` but a server named foo already exists, the it will
* automatically change the hostname to `foo-0`. If there is already a server with the
* hostname `foo-0`, then it will change the hostname to `foo-1`, and so on.
2021-10-30 18:34:14 +02:00
*
* Note that there is a maximum limit to the amount of servers you can purchase.
*
* Returns the hostname of the newly purchased server as a string. If the function
* fails to purchase a server, then it will return an empty string. The function will
* fail if the arguments passed in are invalid, if the player does not have enough
* money to purchase the specified server, or if the player has exceeded the maximum
* amount of servers.
*
* @example
2021-10-30 21:46:34 +02:00
* ```ts
2022-01-08 19:25:06 +01:00
* // NS1:
* var ram = 64;
* var prefix = "pserv-";
* for (i = 0; i < 5; ++i) {
* purchaseServer(prefix + i, ram);
* }
* ```
* @example
* ```ts
* // NS2:
* const ram = 64;
* const prefix = "pserv-";
2021-10-30 18:34:14 +02:00
* for (i = 0; i < 5; ++i) {
2022-01-08 19:25:06 +01:00
* ns.purchaseServer(prefix + i, ram);
2021-10-30 18:34:14 +02:00
* }
* ```
* @param hostname - Host of the purchased server.
2022-01-16 00:39:37 +01:00
* @param ram - Amount of RAM of the purchased server, in GB. Must be a power of 2 (2, 4, 8, 16, etc.). Maximum value of 1048576 (2^20).
2021-10-30 18:34:14 +02:00
* @returns The hostname of the newly purchased server.
*/
2021-11-03 05:27:21 +01:00
purchaseServer(hostname: string, ram: number): string;
2021-10-30 18:34:14 +02:00
/**
* Delete a purchased server.
* @remarks
* 2.25 GB
*
2021-10-30 18:34:14 +02:00
* Deletes one of your purchased servers, which is specified by its hostname.
*
* The hostname argument can be any data type, but it will be converted to a string.
* Whitespace is automatically removed from the string. This function will not delete a
* server that still has scripts running on it.
*
* @param host - Host of the server to delete.
* @returns True if successful, and false otherwise.
*/
2021-10-30 21:46:34 +02:00
deleteServer(host: string): boolean;
2021-10-30 18:34:14 +02:00
/**
2021-12-15 18:10:32 +01:00
* Returns an array with the hostnames of all of the servers you have purchased.
2021-10-30 18:34:14 +02:00
*
* @remarks 2.25 GB
2021-12-15 18:10:32 +01:00
* @returns Returns an array with the hostnames of all of the servers you have purchased.
2021-10-30 18:34:14 +02:00
*/
2021-12-15 18:10:32 +01:00
getPurchasedServers(): string[];
2021-10-30 18:34:14 +02:00
/**
* Returns the maximum number of servers you can purchase.
*
2021-10-30 21:46:34 +02:00
* @remarks RAM cost: 0.05 GB
2021-10-30 18:34:14 +02:00
* @returns Returns the maximum number of servers you can purchase.
*/
getPurchasedServerLimit(): number;
/**
* Returns the maximum RAM that a purchased server can have.
*
2021-10-30 21:46:34 +02:00
* @remarks RAM cost: 0.05 GB
2022-01-16 00:39:37 +01:00
* @returns Returns the maximum RAM (in GB) that a purchased server can have.
2021-10-30 18:34:14 +02:00
*/
getPurchasedServerMaxRam(): number;
/**
* Write data to a file.
* @remarks
* RAM cost: 0 GB
*
2022-09-23 21:03:38 +02:00
* This function can be used to write data to a text file (.txt) or a script (.js or .script).
2021-10-30 18:34:14 +02:00
*
2022-09-23 21:03:38 +02:00
* This function will write data to that file. If the specified file does not exist,
2021-10-30 18:34:14 +02:00
* then it will be created. The third argument mode, defines how the data will be written to
2022-09-23 21:03:38 +02:00
* the file. If *mode is set to w, then the data is written in write mode which means
* that it will overwrite all existing data on the file. If mode is set to any other value
2021-10-30 18:34:14 +02:00
* then the data will be written in append mode which means that the data will be added at the
2022-09-23 21:03:38 +02:00
* end of the file.
2021-10-30 18:34:14 +02:00
*
2022-09-23 21:03:38 +02:00
* @param filename - Name of the file to be written to.
2021-10-30 18:34:14 +02:00
* @param data - Data to write.
2022-09-23 21:03:38 +02:00
* @param mode - Defines the write mode.
2021-10-30 18:34:14 +02:00
*/
2022-09-23 21:03:38 +02:00
write(filename: string, data?: string[] | number | string, mode?: "w" | "a"): void;
2021-10-30 18:34:14 +02:00
/**
* Attempt to write to a port.
* @remarks
* RAM cost: 0 GB
*
2021-10-30 18:34:14 +02:00
* Attempts to write data to the specified Netscript Port.
* If the port is full, the data will not be written.
* Otherwise, the data will be written normally.
*
* @param port - Port or text file that will be written to.
* @param data - Data to write.
* @returns True if the data is successfully written to the port, and false otherwise.
*/
2022-02-07 15:14:48 +01:00
tryWritePort(port: number, data: string | number): Promise<boolean>;
2021-10-30 18:34:14 +02:00
/**
* Read content of a file.
* @remarks
* RAM cost: 0 GB
*
2022-09-23 21:03:38 +02:00
* This function is used to read data from a text file (.txt) or script (.script, .js).
2021-10-30 18:34:14 +02:00
*
2022-09-23 21:03:38 +02:00
* This function will return the data in the specified file.
* If the file does not exist, an empty string will be returned.
2021-10-30 18:34:14 +02:00
*
2022-09-23 21:03:38 +02:00
* @param filename - Name of the file to be read.
2022-01-16 00:39:37 +01:00
* @returns Data in the specified text file.
2021-10-30 18:34:14 +02:00
*/
2022-09-23 21:03:38 +02:00
read(filename: string): string;
2021-10-30 18:34:14 +02:00
/**
* Get a copy of the data from a port without popping it.
* @remarks
* RAM cost: 0 GB
*
2021-10-30 18:34:14 +02:00
* This function is used to peek at the data from a port. It returns the
* first element in the specified port without removing that element. If
* the port is empty, the string NULL PORT DATA will be returned.
*
* @param port - Port to peek. Must be an integer between 1 and 20.
* @returns Data in the specified port.
*/
2022-08-17 14:50:05 +02:00
peek(port: number): PortData;
/**
* Clear data from a file.
* @remarks
* RAM cost: 0 GB
*
* Delete all data from that text file.
*
* @param handle - Text file to clear.
*/
clear(handle: string): void;
2021-10-30 18:34:14 +02:00
/**
* Clear data from a port.
* @remarks
* RAM cost: 0 GB
*
* Deleta all data from the underlying queue.
2021-10-30 18:34:14 +02:00
*
* @param handle - Port to clear.
*/
clearPort(handle: number): void;
/**
* Write data to a port.
* @remarks
* RAM cost: 0 GB
2021-10-30 18:34:14 +02:00
*
* Write data to that netscript port.
* @returns The data popped off the queue if it was full.
*/
2022-08-17 14:50:05 +02:00
writePort(port: number, data: string | number): Promise<PortData>;
/**
* Read data from a port.
* @remarks
* RAM cost: 0 GB
2021-10-30 18:34:14 +02:00
*
* Read data from that port. A port is a serialized queue.
* This function will remove the first element from that queue and return it.
* If the queue is empty, then the string NULL PORT DATA will be returned.
* @returns the data read.
2021-10-30 18:34:14 +02:00
*/
2022-08-17 14:50:05 +02:00
readPort(port: number): PortData;
2021-10-30 18:34:14 +02:00
/**
* Get all data on a port.
* @remarks
* RAM cost: 0 GB
*
2021-10-30 18:34:14 +02:00
* Get a handle to a Netscript Port.
*
* WARNING: Port Handles only work in NetscriptJS (Netscript 2.0). They will not work in Netscript 1.0.
*
* @see https://bitburner.readthedocs.io/en/latest/netscript/netscriptmisc.html#netscript-ports
* @param port - Port number. Must be an integer between 1 and 20.
*/
2022-01-16 00:39:37 +01:00
getPortHandle(port: number): NetscriptPort;
2021-10-30 18:34:14 +02:00
/**
* Delete a file.
* @remarks
* RAM cost: 1 GB
*
2021-10-30 18:34:14 +02:00
* Removes the specified file from the current server. This function works for every file
* type except message (.msg) files.
*
* @param name - Filename of file to remove. Must include the extension.
2021-11-03 05:27:21 +01:00
* @param host - Host Address of the server on which to delete the file. Optional. Defaults to current server.
2021-10-30 18:34:14 +02:00
* @returns True if it successfully deletes the file, and false otherwise.
*/
2021-10-30 21:46:34 +02:00
rm(name: string, host?: string): boolean;
2021-10-30 18:34:14 +02:00
/**
* Check if any script with a filename is running.
* @remarks
* RAM cost: 1 GB
*
2021-10-30 18:34:14 +02:00
* Returns a boolean indicating whether any instance of the specified script is running
* on the target server, regardless of its arguments.
*
* This is different than the isRunning function because it does not try to
* identify a specific instance of a running script by its arguments.
*
* @example
2021-10-30 21:46:34 +02:00
* ```ts
2022-01-08 19:25:06 +01:00
* // NS1:
2021-10-30 18:34:14 +02:00
* //The function call will return true if there is any script named foo.script running on the foodnstuff server, and false otherwise:
* scriptRunning("foo.script", "foodnstuff");
2022-01-08 19:25:06 +01:00
*
* //The function call will return true if there is any script named “foo.script” running on the current server, and false otherwise:
* scriptRunning("foo.script", getHostname());
2021-10-30 18:34:14 +02:00
* ```
2022-01-08 19:25:06 +01:00
* * @example
2021-10-30 21:46:34 +02:00
* ```ts
2022-01-08 19:25:06 +01:00
* // NS2:
* //The function call will return true if there is any script named foo.script running on the foodnstuff server, and false otherwise:
* ns.scriptRunning("foo.script", "foodnstuff");
*
2021-10-30 18:34:14 +02:00
* //The function call will return true if there is any script named “foo.script” running on the current server, and false otherwise:
2022-01-08 19:25:06 +01:00
* ns.scriptRunning("foo.script", ns.getHostname());
2021-10-30 18:34:14 +02:00
* ```
* @param script - Filename of script to check. This is case-sensitive.
2021-11-03 05:27:21 +01:00
* @param host - Host of target server.
2021-10-30 18:34:14 +02:00
* @returns True if the specified script is running, and false otherwise.
*/
2021-10-30 21:46:34 +02:00
scriptRunning(script: string, host: string): boolean;
2021-10-30 18:34:14 +02:00
/**
* Kill all scripts with a filename.
* @remarks
* RAM cost: 1 GB
*
2021-11-03 05:27:21 +01:00
* Kills all scripts with the specified filename on the target server specified by hostname,
2021-10-30 18:34:14 +02:00
* regardless of arguments.
*
* @param script - Filename of script to kill. This is case-sensitive.
2021-11-03 05:27:21 +01:00
* @param host - Host of target server.
2021-10-30 18:34:14 +02:00
* @returns true if one or more scripts were successfully killed, and false if none were.
*/
2021-10-30 21:46:34 +02:00
scriptKill(script: string, host: string): boolean;
2021-10-30 18:34:14 +02:00
/**
* Returns the current script name.
*
2021-10-30 21:46:34 +02:00
* @remarks RAM cost: 0 GB
2021-10-30 18:34:14 +02:00
* @returns Current script name.
*/
getScriptName(): string;
/**
* Get the ram cost of a script.
* @remarks
* RAM cost: 0.1 GB
*
2021-10-30 18:34:14 +02:00
* Returns the amount of RAM required to run the specified script on the target server.
* Returns 0 if the script does not exist.
*
* @param script - Filename of script. This is case-sensitive.
2022-05-24 14:12:49 +02:00
* @param host - Host of target server the script is located on. This is optional, if it is not specified then the function will use the current server as the target server.
2022-01-16 00:39:37 +01:00
* @returns Amount of RAM (in GB) required to run the specified script on the target server, and 0 if the script does not exist.
2021-10-30 18:34:14 +02:00
*/
2021-10-30 21:46:34 +02:00
getScriptRam(script: string, host?: string): number;
2021-10-30 18:34:14 +02:00
/**
* Get the execution time of a hack() call.
* @remarks
* RAM cost: 0.05 GB
2022-07-16 05:47:19 +02:00
*
* When `hack` completes an amount of money is stolen depending on the player's skills.
* Returns the amount of time in milliseconds it takes to execute the hack Netscript function on the target server.
2022-01-08 19:25:06 +01:00
* The required time is increased by the security level of the target server and decreased by the player's hacking level.
2021-10-30 18:34:14 +02:00
*
2021-11-03 05:27:21 +01:00
* @param host - Host of target server.
2022-07-16 05:47:19 +02:00
* @returns Returns the amount of time in milliseconds it takes to execute the hack Netscript function.
2021-10-30 18:34:14 +02:00
*/
getHackTime(host: string): number;
2021-10-30 18:34:14 +02:00
/**
* Get the execution time of a grow() call.
* @remarks
* RAM cost: 0.05 GB
*
2021-11-13 15:35:13 +01:00
* Returns the amount of time in milliseconds it takes to execute the grow Netscript function on the target server.
2022-01-08 19:25:06 +01:00
* The required time is increased by the security level of the target server and decreased by the player's hacking level.
2021-10-30 18:34:14 +02:00
*
2021-11-03 05:27:21 +01:00
* @param host - Host of target server.
2022-07-16 05:47:19 +02:00
* @returns Returns the amount of time in milliseconds it takes to execute the grow Netscript function.
2021-10-30 18:34:14 +02:00
*/
getGrowTime(host: string): number;
2021-10-30 18:34:14 +02:00
/**
* Get the execution time of a weaken() call.
* @remarks
* RAM cost: 0.05 GB
*
2022-01-04 22:50:30 +01:00
* Returns the amount of time in milliseconds it takes to execute the weaken Netscript function on the target server.
2022-01-08 19:25:06 +01:00
* The required time is increased by the security level of the target server and decreased by the player's hacking level.
2021-10-30 18:34:14 +02:00
*
2021-11-03 05:27:21 +01:00
* @param host - Host of target server.
2022-07-16 05:47:19 +02:00
* @returns Returns the amount of time in milliseconds it takes to execute the weaken Netscript function.
2021-10-30 18:34:14 +02:00
*/
2022-01-16 00:39:37 +01:00
getWeakenTime(host: string): number;
2021-10-30 18:34:14 +02:00
2022-08-17 14:50:05 +02:00
/**
* Get the income of all script.
* @remarks
* RAM cost: 0.1 GB
*
* @returns an array of two values.
* The first value is the total income (dollar / second) of all of your active scripts
* (scripts that are currently running on any server).
* The second value is the total income (dollar / second) that youve earned from scripts
* since you last installed Augmentations.
*/
getTotalScriptIncome(): [number, number];
2021-10-30 18:34:14 +02:00
/**
* Get the income of a script.
* @remarks
* RAM cost: 0.1 GB
*
2021-10-30 18:34:14 +02:00
* Returns the amount of income the specified script generates while online
* (when the game is open, does not apply for offline income). Remember that
* a script is uniquely identified by both its name and its arguments. So for
* example if you ran a script with the arguments foodnstuff and 5 then
* in order to use this function to get that scripts income you must specify
* those same arguments in the same order in this function call.
*
* @param script - Filename of script.
* @param host - Server on which script is running.
* @param args - Arguments that the script is running with.
* @returns Amount of income the specified script generates while online.
*/
2022-08-17 14:50:05 +02:00
getScriptIncome(script: string, host: string, ...args: (string | number | boolean)[]): number;
2022-03-17 21:50:46 +01:00
/**
2022-08-17 14:50:05 +02:00
* Get the exp gain of all script.
* @remarks
* RAM cost: 0.1 GB
*
* @returns total experience gain rate of all of your active scripts.
2022-03-17 21:50:46 +01:00
*/
2022-08-17 14:50:05 +02:00
getTotalScriptExpGain(): number;
2021-10-30 18:34:14 +02:00
/**
* Get the exp gain of a script.
* @remarks
* RAM cost: 0.1 GB
*
2021-10-30 18:34:14 +02:00
* Returns the amount of hacking experience the specified script generates while online
* (when the game is open, does not apply for offline experience gains). Remember that a
* script is uniquely identified by both its name and its arguments.
*
* This function can also return the total experience gain rate of all of your active
* scripts by running the function with no arguments.
*
* @param script - Filename of script.
* @param host - Server on which script is running.
* @param args - Arguments that the script is running with.
* @returns Amount of hacking experience the specified script generates while online.
*/
2022-07-16 05:47:19 +02:00
getScriptExpGain(script: string, host: string, ...args: (string | number | boolean)[]): number;
2021-10-30 18:34:14 +02:00
/**
* Returns the amount of time in milliseconds that have passed since you last installed Augmentations.
*
2021-10-30 21:46:34 +02:00
* @remarks RAM cost: 0.05 GB
2021-10-30 18:34:14 +02:00
* @returns Time in milliseconds that have passed since you last installed Augmentations.
*/
getTimeSinceLastAug(): number;
/**
* Format a string.
2021-10-30 18:34:14 +02:00
*
* @remarks
* RAM cost: 0 GB
*
* see: https://github.com/alexei/sprintf.js
2021-10-30 18:34:14 +02:00
* @param format - String to format.
* @param args - Formating arguments.
* @returns Formated text.
*/
2022-01-12 13:52:36 +01:00
sprintf(format: string, ...args: any[]): string;
2021-10-30 18:34:14 +02:00
/**
* Format a string with an array of arguments.
* @remarks
* RAM cost: 0 GB
2021-10-30 18:34:14 +02:00
*
* see: https://github.com/alexei/sprintf.js
2021-10-30 18:34:14 +02:00
* @param format - String to format.
* @param args - Formating arguments.
* @returns Formated text.
*/
2022-01-12 13:52:36 +01:00
vsprintf(format: string, args: any[]): string;
2021-10-30 18:34:14 +02:00
/**
* Format a number
* @remarks
* RAM cost: 0 GB
*
2021-10-30 18:34:14 +02:00
* Converts a number into a string with the specified formatter.
* This uses the numeraljs library, so the formatters must be compatible with that.
* This is the same function that the game itself uses to display numbers.
*
* see: http://numeraljs.com/
2021-10-30 18:34:14 +02:00
* @param n - Number to format.
* @param format - Formatter.
* @returns Formated number.
*/
2022-01-08 19:25:06 +01:00
nFormat(n: number, format: string): string;
2021-10-30 18:34:14 +02:00
/**
* Format time to readable string
* @remarks
* RAM cost: 0 GB
*
* @param milliseconds - Number of millisecond to format.
* @param milliPrecision - Format time with subsecond precision, defaults to false.
* @returns The formatted time.
*/
tFormat(milliseconds: number, milliPrecision?: boolean): string;
2021-10-30 18:34:14 +02:00
/**
2022-03-17 21:50:46 +01:00
* Prompt the player with an input modal.
* @remarks
* RAM cost: 0 GB
*
2022-03-17 21:50:46 +01:00
* Prompts the player with a dialog box. If `options.type` is undefined or "boolean",
* the player is shown "Yes" and "No" prompts, which return true and false respectively.
* Passing a type of "text" will give the player a text field and a value of "select"
* will show a drop-down field. Choosing type "select" will require an array or object
* to be passed via the `options.choices` property.
* The scripts execution is halted until the player selects one of the options.
2021-10-30 18:34:14 +02:00
*
* @param txt - Text to appear in the prompt dialog box.
2022-03-17 21:50:46 +01:00
* @param options - Options to modify the prompt the player is shown.
* @returns True if the player click Yes; false if the player clicks No; or the value entered by the player.
2021-10-30 18:34:14 +02:00
*/
2022-03-17 21:50:46 +01:00
prompt(
txt: string,
options?: { type?: "boolean" | "text" | "select" | undefined; choices?: string[] },
): Promise<boolean | string>;
2021-10-30 18:34:14 +02:00
/**
* Open up a message box.
* @param msg - Message to alert.
*/
2022-08-17 14:50:05 +02:00
alert(msg: string): void;
/**
* Queue a toast (bottom-right notification).
* @param msg - Message in the toast.
* @param variant - Type of toast, must be one of success, info, warning, error. Defaults to success.
2022-01-08 21:59:28 +01:00
* @param duration - Duration of toast in ms. Can also be `null` to create a persistent toast. Defaults to 2000
*/
2022-08-17 14:50:05 +02:00
toast(msg: string, variant?: ToastVariantValues, duration?: number | null): void;
2021-10-30 18:34:14 +02:00
/**
* Download a file from the internet.
* @remarks
* RAM cost: 0 GB
*
2021-10-30 18:34:14 +02:00
* Retrieves data from a URL and downloads it to a file on the specified server.
2022-08-17 14:50:05 +02:00
* The data can only be downloaded to a script (.script, .js) or a text file (.txt).
2021-10-30 18:34:14 +02:00
* If the file already exists, it will be overwritten by this command.
* Note that it will not be possible to download data from many websites because they
* do not allow cross-origin resource sharing (CORS).
*
* IMPORTANT: This is an asynchronous function that returns a Promise.
* The Promises resolved value will be a boolean indicating whether or not the data was
* successfully retrieved from the URL. Because the function is async and returns a Promise,
* it is recommended you use wget in NetscriptJS (Netscript 2.0).
*
* In NetscriptJS, you must preface any call to wget with the await keyword (like you would hack or sleep).
* wget will still work in Netscript 1.0, but the functions execution will not be synchronous
* (i.e. it may not execute when you expect/want it to).
* Furthermore, since Promises are not supported in ES5,
* you will not be able to process the returned value of wget in Netscript 1.0.
*
* @example
2021-10-30 21:46:34 +02:00
* ```ts
2022-01-08 19:25:06 +01:00
* // NS1:
2021-10-30 18:34:14 +02:00
* wget("https://raw.githubusercontent.com/danielyxie/bitburner/master/README.md", "game_readme.txt");
* ```
2022-01-08 19:25:06 +01:00
* @example
* ```ts
* // NS2:
* await ns.wget("https://raw.githubusercontent.com/danielyxie/bitburner/master/README.md", "game_readme.txt");
* ```
2021-10-30 18:34:14 +02:00
* @param url - URL to pull data from.
* @param target - Filename to write data to. Must be script or text file.
* @param host - Optional hostname/ip of server for target file.
* @returns True if the data was successfully retrieved from the URL, false otherwise.
*/
wget(url: string, target: string, host?: string): Promise<boolean>;
/**
* Returns the amount of Faction favor required to be able to donate to a faction.
*
2021-10-30 21:46:34 +02:00
* @remarks RAM cost: 0.1 GB
2021-10-30 18:34:14 +02:00
* @returns Amount of Faction favor required to be able to donate to a faction.
*/
getFavorToDonate(): number;
/**
* Get the current Bitnode multipliers.
* @remarks
* RAM cost: 4 GB
*
2021-10-30 18:34:14 +02:00
* Returns an object containing the current BitNode multipliers.
2022-01-08 19:25:06 +01:00
* This function requires you to be in Bitnode 5 or have Source-File 5 in order to run.
2021-10-30 18:34:14 +02:00
* The multipliers are returned in decimal forms (e.g. 1.5 instead of 150%).
* The multipliers represent the difference between the current BitNode and
* the original BitNode (BitNode-1).
*
* For example, if the CrimeMoney multiplier has a value of 0.1, then that means
* that committing crimes in the current BitNode will only give 10% of the money
* you would have received in BitNode-1.
*
* @example
2021-10-30 21:46:34 +02:00
* ```ts
2022-01-08 19:25:06 +01:00
* // NS1:
* var mults = getBitNodeMultipliers();
2021-10-30 18:34:14 +02:00
* print(mults.ServerMaxMoney);
* print(mults.HackExpGain);
* ```
2022-01-08 19:25:06 +01:00
* @example
* ```ts
* // NS2:
* const {ServerMaxMoney, HackExpGain} = ns.getBitNodeMultipliers();
* print(ServerMaxMoney);
* print(HackExpGain);
* ```
2021-10-30 18:34:14 +02:00
* @returns Object containing the current BitNode multipliers.
*/
2021-10-30 21:46:34 +02:00
getBitNodeMultipliers(): BitNodeMultipliers;
/**
* Get information about the player.
2022-01-08 19:25:06 +01:00
* @remarks
* RAM cost: 0.5 GB
*
* Returns an object with information on the current player.
*
* @returns Player info
*/
getPlayer(): Player;
/**
* Add callback function when the script dies
* @remarks
* RAM cost: 0 GB
*
* NS2 exclusive
*
* Add callback to be executed when the script dies.
*/
atExit(f: () => void): void;
2022-01-12 18:53:54 +01:00
/**
* Move a file on the target server.
* @remarks
* RAM cost: 0 GB
*
* NS2 exclusive
*
* Move the source file to the specified destination on the target server.
*
* This command only works for scripts and text files (.txt). It cannot, however, be used
* to convert from script to text file, or vice versa.
*
* This function can also be used to rename files.
2022-01-16 00:39:37 +01:00
*
2022-01-12 18:53:54 +01:00
* @param host - Host of target server.
* @param source - Filename of the source file.
* @param destination - Filename of the destination file.
*/
mv(host: string, source: string, destination: string): void;
/**
* Parse command line flags.
* @remarks
* RAM cost: 0 GB
*
* Allows unix like flag parsing.
* @example
* ```ts
* // example.script
* var data = flags([
* ['delay', 0], // a default number means this flag is a number
* ['server', 'foodnstuff'], // a default string means this flag is a string
* ['exclude', []], // a default array means this flag is a default array of string
* ['help', false], // a default boolean means this flag is a boolean
* ]);
* tprint(data);
*
2022-07-21 21:09:55 +02:00
* // example.js
2022-01-08 19:25:06 +01:00
* export async function main(ns) {
* const data = ns.flags([
* ['delay', 0], // a default number means this flag is a number
* ['server', 'foodnstuff'], // a default string means this flag is a string
* ['exclude', []], // a default array means this flag is a default array of string
* ['help', false], // a default boolean means this flag is a boolean
* ]);
* ns.tprint(data);
* }
*
* // [home ~/]> run example.script
* // {"_":[],"delay":0,"server":"foodnstuff","exclude":[],"help":false}
* // [home ~/]> run example.script --delay 3000
* // {"_":[],"server":"foodnstuff","exclude":[],"help":false,"delay":3000}
* // [home ~/]> run example.script --delay 3000 --server harakiri-sushi
* // {"_":[],"exclude":[],"help":false,"delay":3000,"server":"harakiri-sushi"}
* // [home ~/]> run example.script --delay 3000 --server harakiri-sushi hello world
* // {"_":["hello","world"],"exclude":[],"help":false,"delay":3000,"server":"harakiri-sushi"}
* // [home ~/]> run example.script --delay 3000 --server harakiri-sushi hello world --exclude a --exclude b
* // {"_":["hello","world"],"help":false,"delay":3000,"server":"harakiri-sushi","exclude":["a","b"]}
* // [home ~/]> run example.script --help
* // {"_":[],"delay":0,"server":"foodnstuff","exclude":[],"help":true}
* ```
*/
2022-09-23 21:03:38 +02:00
flags(schema: [string, string | number | boolean | string[]][]): { [key: string]: ScriptArg | string[] };
2022-01-18 20:02:12 +01:00
/**
2022-01-19 01:12:52 +01:00
* Share your computer with your factions.
2022-01-18 20:02:12 +01:00
* @remarks
* RAM cost: 2.4 GB
2022-01-19 01:12:52 +01:00
*
* Increases your rep gain of hacking contracts while share is called.
* Scales with thread count.
2022-01-18 20:02:12 +01:00
*/
share(): Promise<void>;
/**
2022-01-19 01:12:52 +01:00
* Calculate your share power. Based on all the active share calls.
2022-01-18 20:02:12 +01:00
* @remarks
* RAM cost: 0.2 GB
*/
getSharePower(): number;
2022-04-13 07:35:35 +02:00
2022-04-13 08:04:51 +02:00
enums: NSEnums;
2022-04-13 07:35:35 +02:00
}
/** @public */
export declare interface NSEnums {
2022-04-13 08:04:51 +02:00
toast: typeof ToastVariant;
}
2021-12-09 00:19:30 +01:00
/**
2021-12-09 02:03:22 +01:00
* Office for a division in a city.
2021-12-09 00:19:30 +01:00
* @public
*/
2021-12-04 05:08:11 +01:00
export declare interface Office {
2021-12-09 02:03:22 +01:00
/** City of the office */
2021-12-04 05:08:11 +01:00
loc: string;
2021-12-09 02:03:22 +01:00
/** Maximum number of employee */
2021-12-04 05:08:11 +01:00
size: number;
2021-12-09 02:03:22 +01:00
/** Minimum amount of energy of the employees */
2021-12-04 05:08:11 +01:00
minEne: number;
2021-12-09 02:03:22 +01:00
/** Maximum amount of energy of the employees */
2021-12-04 05:08:11 +01:00
maxEne: number;
2021-12-09 02:03:22 +01:00
/** Minimum happiness of the employees */
2021-12-04 05:08:11 +01:00
minHap: number;
2021-12-09 02:03:22 +01:00
/** Maximum happiness of the employees */
2021-12-04 05:08:11 +01:00
maxHap: number;
2022-08-17 14:50:05 +02:00
/** Minimum morale of the employees */
minMor: number;
2021-12-09 02:03:22 +01:00
/** Maximum morale of the employees */
2021-12-04 05:08:11 +01:00
maxMor: number;
2021-12-09 02:03:22 +01:00
/** Name of all the employees */
2021-12-04 05:08:11 +01:00
employees: string[];
/** Production of the employees */
2021-12-04 05:08:11 +01:00
employeeProd: EmployeeJobs;
/** Positions of the employees */
employeeJobs: EmployeeJobs;
2021-12-04 05:08:11 +01:00
}
2021-12-09 00:19:30 +01:00
/**
2021-12-09 02:03:22 +01:00
* Corporation Office API
* @remarks
* Requires the Office API upgrade from your corporation.
2021-12-09 00:19:30 +01:00
* @public
*/
2021-12-04 05:08:11 +01:00
export declare interface OfficeAPI {
2021-12-09 02:03:22 +01:00
/**
* Assign an employee to a job.
* @param divisionName - Name of the division
* @param cityName - Name of the city
* @param employeeName - name of the employee
* @param job - Name of the job.
*/
2022-08-17 14:50:05 +02:00
assignJob(divisionName: string, cityName: string, employeeName: string, job: string): void;
2021-12-09 02:03:22 +01:00
/**
2022-01-16 17:13:45 +01:00
* Hire an employee.
2021-12-09 02:03:22 +01:00
* @param divisionName - Name of the division
* @param cityName - Name of the city
* @returns The newly hired employee, if any
*/
hireEmployee(divisionName: string, cityName: string): Employee | undefined;
/**
* Upgrade office size.
* @param divisionName - Name of the division
* @param cityName - Name of the city
* @param size - Amount of positions to open
*/
2021-12-04 05:08:11 +01:00
upgradeOfficeSize(divisionName: string, cityName: string, size: number): void;
2021-12-09 02:03:22 +01:00
/**
2022-01-16 17:13:45 +01:00
* Throw a party for your employees
2021-12-09 02:03:22 +01:00
* @param divisionName - Name of the division
* @param cityName - Name of the city
* @param costPerEmployee - Amount to spend per employee.
2022-08-17 14:50:05 +02:00
* @returns Multiplier for happiness and morale, or zero on failure
2021-12-09 02:03:22 +01:00
*/
2022-08-17 14:50:05 +02:00
throwParty(divisionName: string, cityName: string, costPerEmployee: number): number;
2021-12-09 02:03:22 +01:00
/**
* Buy coffee for your employees
* @param divisionName - Name of the division
* @param cityName - Name of the city
2022-08-17 14:50:05 +02:00
* @returns true if buying coffee was successful, false otherwise
2021-12-09 02:03:22 +01:00
*/
2022-08-17 14:50:05 +02:00
buyCoffee(divisionName: string, cityName: string): boolean;
2021-12-09 02:03:22 +01:00
/**
* Hire AdVert.
* @param divisionName - Name of the division
*/
2021-12-04 05:08:11 +01:00
hireAdVert(divisionName: string): void;
2021-12-09 02:03:22 +01:00
/**
2022-01-16 17:13:45 +01:00
* Purchase a research
2021-12-09 02:03:22 +01:00
* @param divisionName - Name of the division
* @param researchName - Name of the research
*/
2021-12-04 05:08:11 +01:00
research(divisionName: string, researchName: string): void;
2021-12-09 02:03:22 +01:00
/**
* Get data about an office
* @param divisionName - Name of the division
* @param cityName - Name of the city
* @returns Office data
*/
2021-12-04 05:08:11 +01:00
getOffice(divisionName: string, cityName: string): Office;
2021-12-09 02:03:22 +01:00
/**
* Get data about an employee
* @param divisionName - Name of the division
* @param cityName - Name of the city
* @param employeeName - Name of the employee
* @returns Employee data
*/
2021-12-04 05:08:11 +01:00
getEmployee(divisionName: string, cityName: string, employeeName: string): Employee;
2022-01-16 17:13:45 +01:00
/**
* Get the cost to Hire AdVert
* @param divisionName - Name of the division
* @returns Cost
*/
getHireAdVertCost(divisionName: string): number;
/**
* Get the number of times you have Hired AdVert
* @param divisionName - Name of the division
* @returns Number of times you have Hired AdVert
*/
getHireAdVertCount(adivisionName: string): number;
/**
* Get the cost to unlock research
* @param divisionName - Name of the division
2022-03-17 21:50:46 +01:00
* @param researchName - Name of the research
2022-01-16 17:13:45 +01:00
* @returns cost
*/
getResearchCost(divisionName: string, researchName: string): number;
/**
* Gets if you have unlocked a research
* @param divisionName - Name of the division
2022-03-17 21:50:46 +01:00
* @param researchName - Name of the research
2022-01-16 17:13:45 +01:00
* @returns true is unlocked, false if not
*/
hasResearched(divisionName: string, researchName: string): boolean;
/**
* Set the auto job assignment for a job
* @param divisionName - Name of the division
* @param cityName - Name of the city
* @param job - Name of the job
* @param amount - Number of employees to assign to that job
2022-08-17 14:50:05 +02:00
* @returns true if the employee count reached the target amount, false if not
2022-01-16 17:13:45 +01:00
*/
2022-08-17 14:50:05 +02:00
setAutoJobAssignment(divisionName: string, cityName: string, job: string, amount: number): boolean;
2022-01-16 17:13:45 +01:00
/**
* Cost to Upgrade office size.
* @param divisionName - Name of the division
* @param cityName - Name of the city
* @param size - Amount of positions to open
* @returns Cost of upgrading the office
*/
getOfficeSizeUpgradeCost(divisionName: string, cityName: string, asize: number): number;
2021-12-04 05:08:11 +01:00
}
2022-01-16 00:39:37 +01:00
/**
* @public
*/
export declare enum OrderTypes {
LimitBuy = "Limit Buy Order",
LimitSell = "Limit Sell Order",
StopBuy = "Stop Buy Order",
StopSell = "Stop Sell Order",
}
/**
* @public
*/
export declare interface Player {
2022-08-17 14:50:05 +02:00
hp: HP;
skills: Skills;
exp: Skills;
mults: Multipliers;
numPeopleKilled: number;
money: number;
city: string;
location: string;
bitNodeN: number;
totalPlaytime: number;
playtimeSinceLastAug: number;
playtimeSinceLastBitnode: number;
2022-08-17 14:50:05 +02:00
jobs: Record<string, string>;
factions: string[];
tor: boolean;
2022-01-16 17:13:45 +01:00
hasCorporation: boolean;
2022-03-17 21:50:46 +01:00
inBladeburner: boolean;
2022-03-29 21:49:31 +02:00
entropy: number;
2021-10-30 18:34:14 +02:00
}
/**
* @public
*/
2022-08-17 14:50:05 +02:00
export declare type PortData = string | number;
2021-10-30 18:34:14 +02:00
2022-01-16 00:39:37 +01:00
/**
* @public
*/
export declare enum PositionTypes {
Long = "L",
Short = "S",
}
2022-08-17 14:50:05 +02:00
/**
* @public
*/
export declare interface PossibleInfiltrationLocation {
city: string;
name: string;
}
2021-10-30 18:34:14 +02:00
/**
2021-10-30 21:46:34 +02:00
* A single process on a server.
2021-10-30 18:34:14 +02:00
* @public
*/
export declare interface ProcessInfo {
/** Script name. */
2021-10-30 21:46:34 +02:00
filename: string;
2021-10-30 18:34:14 +02:00
/** Number of threads script is running with */
threads: number;
/** Script's arguments */
2022-08-17 14:50:05 +02:00
args: (string | number | boolean)[];
2022-01-08 19:25:06 +01:00
/** Process ID */
pid: number;
2021-10-30 18:34:14 +02:00
}
2021-12-09 00:19:30 +01:00
/**
2021-12-09 02:03:22 +01:00
* Product in a warehouse
2021-12-09 00:19:30 +01:00
* @public
*/
2021-12-04 05:08:11 +01:00
export declare interface Product {
2021-12-09 02:03:22 +01:00
/** Name of the product */
2021-12-04 05:08:11 +01:00
name: string;
2022-04-13 07:35:35 +02:00
/** Demand for the product, only present if "Market Research - Demand" unlocked */
dmd: number | undefined;
/** Competition for the product, only present if "Market Research - Competition" unlocked */
cmp: number | undefined;
/** Product Rating */
rat: number;
/** Product Properties. The data is \{qlt, per, dur, rel, aes, fea\} */
properties: { [key: string]: number };
2021-12-09 02:03:22 +01:00
/** Production cost */
2021-12-04 05:08:11 +01:00
pCost: number;
2021-12-09 02:03:22 +01:00
/** Sell cost, can be "MP+5" */
2021-12-04 05:08:11 +01:00
sCost: string | number;
2022-01-17 11:24:42 +01:00
/** Data refers to the production, sale, and quantity of the products
* These values are specific to a city
2022-01-16 17:13:45 +01:00
* For each city, the data is [qty, prod, sell] */
2022-01-17 11:24:42 +01:00
cityData: { [key: string]: number[] };
2022-01-16 17:13:45 +01:00
/** Creation progress - A number between 0-100 representing percentage */
developmentProgress: number;
2021-12-04 05:08:11 +01:00
}
2022-04-13 07:35:35 +02:00
/**
* @public
*/
export declare interface RecentScript extends RunningScript {
/** Timestamp of when the script was killed */
timeOfDeath: Date;
}
/**
* Reputation formulas
* @public
*/
export declare interface ReputationFormulas {
/**
* Calculate the total required amount of faction reputation to reach a target favor.
* @param favor - target faction favor.
* @returns The calculated faction reputation required.
*/
calculateFavorToRep(favor: number): number;
/**
* Calculate the resulting faction favor of a total amount of reputation.
* (Faction favor is gained whenever you install an Augmentation.)
* @param rep - amount of reputation.
* @returns The calculated faction favor.
*/
calculateRepToFavor(rep: number): number;
2022-05-24 14:12:49 +02:00
/**
* Calculate how much rep would be gained.
* @param amount - Amount of money donated
* @param player - Player info from {@link NS.getPlayer | getPlayer}
*/
repFromDonation(amount: number, player: Player): number;
2022-04-13 07:35:35 +02:00
}
/**
* @public
*/
export declare interface RunningScript {
2022-04-13 07:35:35 +02:00
/** Arguments the script was called with */
2022-08-17 14:50:05 +02:00
args: (string | number | boolean)[];
2022-04-13 07:35:35 +02:00
/** Filename of the script */
filename: string;
2022-04-13 07:35:35 +02:00
/**
* Script logs as an array. The newest log entries are at the bottom.
* Timestamps, if enabled, are placed inside `[brackets]` at the start of each line.
**/
logs: string[];
2022-04-13 07:35:35 +02:00
/** Total amount of hacking experience earned from this script when offline */
offlineExpGained: number;
2022-04-13 07:35:35 +02:00
/** Total amount of money made by this script when offline */
offlineMoneyMade: number;
2022-04-13 07:35:35 +02:00
/** Number of seconds that the script has been running offline */
offlineRunningTime: number;
2022-04-13 07:35:35 +02:00
/** Total amount of hacking experience earned from this script when online */
onlineExpGained: number;
2022-04-13 07:35:35 +02:00
/** Total amount of money made by this script when online */
onlineMoneyMade: number;
2022-04-13 07:35:35 +02:00
/** Number of seconds that this script has been running online */
onlineRunningTime: number;
2022-04-13 07:35:35 +02:00
/** Process ID. Must be an integer */
pid: number;
2022-04-13 07:35:35 +02:00
/** How much RAM this script uses for ONE thread */
ramUsage: number;
2022-04-13 07:35:35 +02:00
/** Hostname of the server on which this script runs */
server: string;
2022-04-13 07:35:35 +02:00
/** Number of threads that this script runs with */
threads: number;
}
2022-08-17 14:50:05 +02:00
/**
* @public
*/
export declare type ScriptArg = string | number | boolean;
2021-10-30 18:34:14 +02:00
/**
2021-10-30 21:46:34 +02:00
* A single server.
2021-10-30 18:34:14 +02:00
* @public
*/
export declare interface Server {
2021-10-30 21:46:34 +02:00
/**
* How many CPU cores this server has. Maximum of 8.
* Affects magnitude of grow and weaken.
*/
2021-10-30 18:34:14 +02:00
cpuCores: number;
2021-10-30 21:46:34 +02:00
/** Flag indicating whether the FTP port is open */
2021-10-30 18:34:14 +02:00
ftpPortOpen: boolean;
2021-10-30 21:46:34 +02:00
/** Flag indicating whether player has admin/root access to this server */
2021-10-30 18:34:14 +02:00
hasAdminRights: boolean;
2021-10-30 21:46:34 +02:00
/** Hostname. Must be unique */
2021-10-30 18:34:14 +02:00
hostname: string;
2021-10-30 21:46:34 +02:00
/** Flag indicating whether HTTP Port is open */
2021-10-30 18:34:14 +02:00
httpPortOpen: boolean;
2021-10-30 21:46:34 +02:00
/** IP Address. Must be unique */
2021-10-30 18:34:14 +02:00
ip: string;
2022-02-15 18:22:49 +01:00
/** Flag indicating whether player is currently connected to this server */
2021-10-30 18:34:14 +02:00
isConnectedTo: boolean;
2021-10-30 21:46:34 +02:00
/** RAM (GB) available on this server */
2021-10-30 18:34:14 +02:00
maxRam: number;
2021-10-30 21:46:34 +02:00
/**
* Name of company/faction/etc. that this server belongs to.
* Optional, not applicable to all Servers
*/
2021-10-30 18:34:14 +02:00
organizationName: string;
2021-10-30 21:46:34 +02:00
/** RAM (GB) used. i.e. unavailable RAM */
2021-10-30 18:34:14 +02:00
ramUsed: number;
2021-10-30 21:46:34 +02:00
/** Flag indicating whether SMTP Port is open */
2021-10-30 18:34:14 +02:00
smtpPortOpen: boolean;
2021-10-30 21:46:34 +02:00
/** Flag indicating whether SQL Port is open */
2021-10-30 18:34:14 +02:00
sqlPortOpen: boolean;
2021-10-30 21:46:34 +02:00
/** Flag indicating whether the SSH Port is open */
2021-10-30 18:34:14 +02:00
sshPortOpen: boolean;
2021-12-03 22:14:13 +01:00
/** Flag indicating whether this is a purchased server */
purchasedByPlayer: boolean;
/** Flag indicating whether this server has a backdoor installed by a player */
backdoorInstalled: boolean;
/**
* Initial server security level
* (i.e. security level when the server was created)
*/
baseDifficulty: number;
/** Server Security Level */
hackDifficulty: number;
/** Minimum server security level that this server can be weakened to */
minDifficulty: number;
/** How much money currently resides on the server and can be hacked */
moneyAvailable: number;
/** Maximum amount of money that this server can hold */
moneyMax: number;
/** Number of open ports required in order to gain admin/root access */
numOpenPortsRequired: number;
/** How many ports are currently opened on the server */
openPortCount: number;
/** Hacking level required to hack this server */
requiredHackingSkill: number;
/**
* Parameter that affects how effectively this server's money can
* be increased using the grow() Netscript function
*/
serverGrowth: number;
2021-10-30 18:34:14 +02:00
}
/**
2021-10-30 21:46:34 +02:00
* Singularity API
2021-11-03 05:27:21 +01:00
* @remarks
2022-01-16 00:39:37 +01:00
* This API requires Source-File 4 to use. The RAM cost of all these functions is multiplied by 16/4/1 based on Source-File 4 levels.
2021-10-30 18:34:14 +02:00
* @public
*/
export declare interface Singularity {
2022-09-23 21:03:38 +02:00
/**
* Backup game save.
* @remarks
* RAM cost: 1 GB * 16/4/1
*
*
* This function will automatically opens the backup save prompt and claim the free faction favour if available.
*
*/
exportGame(): void;
/**
* Returns Backup save bonus availability.
* @remarks
* RAM cost: 0.5 GB * 16/4/1
*
*
* This function will check if there is a bonus for backing up your save.
*
*/
exportGameBonus(): boolean;
2021-10-30 18:34:14 +02:00
/**
2022-01-16 00:39:37 +01:00
* Take university class.
2021-11-03 05:27:21 +01:00
*
* @remarks
2022-01-16 00:39:37 +01:00
* RAM cost: 2 GB * 16/4/1
2021-11-03 05:27:21 +01:00
*
2021-10-30 18:34:14 +02:00
*
* This function will automatically set you to start taking a course at a university.
* If you are already in the middle of some working action (such as working at a
* company, for a faction, or on a program), then running this function will automatically
* cancel that action and give you your earnings.
*
* The cost and experience gains for all of these universities and classes are the same as
* if you were to manually visit and take these classes.
*
* @param universityName - Name of university. You must be in the correct city for whatever university you specify.
* @param courseName - Name of course.
2022-01-12 19:03:49 +01:00
* @param focus - Acquire player focus on this class. Optional. Defaults to true.
2022-09-23 21:03:38 +02:00
* @returns True if action is successfully started, false otherwise.
2021-10-30 18:34:14 +02:00
*/
2022-01-12 19:03:49 +01:00
universityCourse(universityName: string, courseName: string, focus?: boolean): boolean;
2021-10-30 18:34:14 +02:00
/**
2022-01-16 00:39:37 +01:00
* Workout at the gym.
2022-01-08 19:25:06 +01:00
*
2021-11-03 05:27:21 +01:00
* @remarks
2022-01-16 00:39:37 +01:00
* RAM cost: 2 GB * 16/4/1
2022-01-08 19:25:06 +01:00
*
2021-11-03 05:27:21 +01:00
2021-10-30 18:34:14 +02:00
* This function will automatically set you to start working out at a gym to train
* a particular stat. If you are already in the middle of some working action
* (such as working at a company, for a faction, or on a program), then running
* this function will automatically cancel that action and give you your earnings.
*
* The cost and experience gains for all of these gyms are the same as if you were
* to manually visit these gyms and train
*
* @param gymName - Name of gym. You must be in the correct city for whatever gym you specify.
* @param stat - The stat you want to train.
2022-01-12 19:03:49 +01:00
* @param focus - Acquire player focus on this gym workout. Optional. Defaults to true.
2021-10-30 18:34:14 +02:00
* @returns True if actions is successfully started, false otherwise.
*/
2022-01-12 19:03:49 +01:00
gymWorkout(gymName: string, stat: string, focus?: boolean): boolean;
2021-10-30 18:34:14 +02:00
/**
2022-01-16 00:39:37 +01:00
* Travel to another city.
2021-11-03 05:27:21 +01:00
* @remarks
2022-01-16 00:39:37 +01:00
* RAM cost: 2 GB * 16/4/1
2021-11-03 05:27:21 +01:00
*
2021-10-30 18:34:14 +02:00
*
* This function allows the player to travel to any city. The cost for using this
* function is the same as the cost for traveling through the Travel Agency.
*
* @param city - City to travel to.
2022-09-23 21:03:38 +02:00
* @returns True if action is successful, false otherwise.
2021-10-30 18:34:14 +02:00
*/
2021-11-03 05:27:21 +01:00
travelToCity(city: string): boolean;
2021-10-30 18:34:14 +02:00
/**
2022-01-16 00:39:37 +01:00
* Purchase the TOR router.
2021-11-03 05:27:21 +01:00
* @remarks
2022-01-16 00:39:37 +01:00
* RAM cost: 2 GB * 16/4/1
2021-11-03 05:27:21 +01:00
*
2021-10-30 18:34:14 +02:00
*
* This function allows you to automatically purchase a TOR router. The cost for
* purchasing a TOR router using this function is the same as if you were to
* manually purchase one.
*
2022-03-29 21:49:31 +02:00
* @returns True if actions is successful or you already own TOR router, false otherwise.
2021-10-30 18:34:14 +02:00
*/
purchaseTor(): boolean;
/**
2022-01-16 00:39:37 +01:00
* Purchase a program from the dark web.
2021-11-03 05:27:21 +01:00
* @remarks
2022-01-16 00:39:37 +01:00
* RAM cost: 2 GB * 16/4/1
2021-11-03 05:27:21 +01:00
*
2021-10-30 18:34:14 +02:00
*
* This function allows you to automatically purchase programs. You MUST have a
* TOR router in order to use this function. The cost of purchasing programs
* using this function is the same as if you were purchasing them through the Dark
* Web using the Terminal buy command.
*
* @example
2021-10-30 21:46:34 +02:00
* ```ts
2022-01-08 19:25:06 +01:00
* // NS1
2021-10-30 18:34:14 +02:00
* purchaseProgram("brutessh.exe");
* ```
2022-01-08 19:25:06 +01:00
* @example
* ```ts
* // NS2
* ns.purchaseProgram("brutessh.exe");
* ```
2021-10-30 18:34:14 +02:00
* @param programName - Name of program to purchase.
* @returns True if the specified program is purchased, and false otherwise.
*/
2021-11-03 05:27:21 +01:00
purchaseProgram(programName: string): boolean;
2021-10-30 18:34:14 +02:00
/**
2022-01-16 00:39:37 +01:00
* Check if the player is busy.
2021-11-03 05:27:21 +01:00
* @remarks
2022-01-16 00:39:37 +01:00
* RAM cost: 0.5 GB * 16/4/1
2021-10-30 18:34:14 +02:00
*
*
* Returns a boolean indicating whether or not the player is currently performing an
2022-03-17 21:50:46 +01:00
* action. These actions include working for a company/faction, studying at a university,
2021-10-30 18:34:14 +02:00
* working out at a gym, creating a program, committing a crime, or carrying out a Hacking Mission.
*
* @returns True if the player is currently performing an action, false otherwise.
*/
isBusy(): boolean;
/**
2022-01-16 00:39:37 +01:00
* Stop the current action.
2021-11-03 05:27:21 +01:00
* @remarks
2022-01-16 00:39:37 +01:00
* RAM cost: 1 GB * 16/4/1
2021-11-03 05:27:21 +01:00
*
2021-10-30 18:34:14 +02:00
*
* This function is used to end whatever action the player is currently performing.
* The player will receive whatever money/experience/etc. he has earned from that action.
*
* The actions that can be stopped with this function are:
*
* * Studying at a university
2022-03-17 21:50:46 +01:00
* * Working out at a gym
2021-10-30 18:34:14 +02:00
* * Working for a company/faction
* * Creating a program
2022-03-17 21:50:46 +01:00
* * Committing a crime
2021-10-30 18:34:14 +02:00
*
* This function will return true if the players action was ended.
* It will return false if the player was not performing an action when this function was called.
*
* @returns True if the players action was ended, false if the player was not performing an action.
*/
stopAction(): boolean;
/**
2022-01-16 00:39:37 +01:00
* Upgrade home computer RAM.
2021-11-03 05:27:21 +01:00
* @remarks
2022-01-16 00:39:37 +01:00
* RAM cost: 3 GB * 16/4/1
2021-11-03 05:27:21 +01:00
*
2021-10-30 18:34:14 +02:00
*
* This function will upgrade amount of RAM on the players home computer. The cost is
* the same as if you were to do it manually.
*
* This function will return true if the players home computer RAM is successfully upgraded, and false otherwise.
*
* @returns True if the players home computer RAM is successfully upgraded, and false otherwise.
*/
upgradeHomeRam(): boolean;
/**
2022-01-16 00:39:37 +01:00
* Upgrade home computer cores.
* @remarks
2022-01-16 00:39:37 +01:00
* RAM cost: 3 GB * 16/4/1
*
*
* This function will upgrade amount of cores on the players home computer. The cost is
* the same as if you were to do it manually.
*
* This function will return true if the players home computer cores is successfully upgraded, and false otherwise.
*
* @returns True if the players home computer cores is successfully upgraded, and false otherwise.
*/
upgradeHomeCores(): boolean;
2021-10-30 18:34:14 +02:00
/**
2022-01-16 00:39:37 +01:00
* Get the price of upgrading home RAM.
2021-11-03 05:27:21 +01:00
* @remarks
2022-01-16 00:39:37 +01:00
* RAM cost: 1.5 GB * 16/4/1
2021-11-03 05:27:21 +01:00
*
2021-10-30 18:34:14 +02:00
*
* Returns the cost of upgrading the players home computer RAM.
*
* @returns Cost of upgrading the players home computer RAM.
*/
getUpgradeHomeRamCost(): number;
/**
2022-01-16 00:39:37 +01:00
* Get the price of upgrading home cores.
* @remarks
2022-01-16 00:39:37 +01:00
* RAM cost: 1.5 GB * 16/4/1
*
*
* Returns the cost of upgrading the players home computer cores.
*
* @returns Cost of upgrading the players home computer cores.
*/
getUpgradeHomeCoresCost(): number;
2021-10-30 18:34:14 +02:00
/**
2022-01-16 00:39:37 +01:00
* Work for a company.
2021-11-03 05:27:21 +01:00
* @remarks
2022-01-16 00:39:37 +01:00
* RAM cost: 3 GB * 16/4/1
2021-11-03 05:27:21 +01:00
*
2021-10-30 18:34:14 +02:00
*
* This function will automatically set you to start working at the company
* at which you are employed. If you are already in the middle of some working
* action (such as working for a faction, training at a gym, or creating a program),
* then running this function will automatically cancel that action and give you
* your earnings.
*
* This function will return true if the player starts working, and false otherwise.
*
* Note that when you are working for a company, you will not actually receive your earnings (reputation, money, experience) until you FINISH the action.
*
* @example
2021-10-30 21:46:34 +02:00
* ```ts
2022-01-08 19:25:06 +01:00
* // NS1:
2021-10-30 18:34:14 +02:00
* //If you only want to work until you get 100,000 company reputation. One small hack to get around this is to continuously restart the action to receive your earnings:
* while (getCompanyRep(COMPANY HERE) < VALUE) {
* workForCompany();
* sleep(60000);
* }
* //This way, your company reputation will be updated every minute.
* ```
2022-01-08 19:25:06 +01:00
* @example
* ```ts
* // NS2:
* //If you only want to work until you get 100,000 company reputation. One small hack to get around this is to continuously restart the action to receive your earnings:
* while (ns.getCompanyRep(COMPANY HERE) < VALUE) {
* ns.workForCompany();
* await ns.sleep(60000);
* }
* //This way, your company reputation will be updated every minute.
* ```
2021-10-30 18:34:14 +02:00
* @param companyName - Name of company to work for. Must be an exact match. Optional. If not specified, this argument defaults to the last job that you worked
2022-01-08 19:25:06 +01:00
* @param focus - Acquire player focus on this work operation. Optional. Defaults to true.
2021-10-30 18:34:14 +02:00
* @returns True if the player starts working, and false otherwise.
*/
2022-08-17 14:50:05 +02:00
workForCompany(companyName: string, focus?: boolean): boolean;
2021-10-30 18:34:14 +02:00
2022-05-24 14:12:49 +02:00
/**
* Quit jobs by company.
* @remarks
* RAM cost: 3 GB * 16/4/1
*
*
* This function will finish work with the company provided and quit any jobs.
*
* @param companyName - Name of the company.
*/
quitJob(companyName?: string): void;
2021-10-30 18:34:14 +02:00
/**
2022-01-16 00:39:37 +01:00
* Apply for a job at a company.
2021-11-03 05:27:21 +01:00
* @remarks
2022-01-16 00:39:37 +01:00
* RAM cost: 3 GB * 16/4/1
2021-11-03 05:27:21 +01:00
*
2021-10-30 18:34:14 +02:00
*
* This function will automatically try to apply to the specified company
* for a position in the specified field. This function can also be used to
* apply for promotions by specifying the company and field you are already
* employed at.
*
* This function will return true if you successfully get a job/promotion,
* and false otherwise. Note that if you are trying to use this function to
* apply for a promotion and you dont get one, it will return false.
*
* @param companyName - Name of company to apply to.
* @param field - Field to which you want to apply.
* @returns True if the player successfully get a job/promotion, and false otherwise.
*/
2021-11-03 05:27:21 +01:00
applyToCompany(companyName: string, field: string): boolean;
2021-10-30 18:34:14 +02:00
/**
2022-01-16 00:39:37 +01:00
* Get company reputation.
2021-11-03 05:27:21 +01:00
* @remarks
2022-01-16 00:39:37 +01:00
* RAM cost: 1 GB * 16/4/1
2021-11-03 05:27:21 +01:00
*
2021-10-30 18:34:14 +02:00
*
* This function will return the amount of reputation you have at the specified company.
* If the company passed in as an argument is invalid, -1 will be returned.
*
* @param companyName - Name of the company.
* @returns Amount of reputation you have at the specified company.
*/
2021-11-03 05:27:21 +01:00
getCompanyRep(companyName: string): number;
2021-10-30 18:34:14 +02:00
/**
2022-01-16 00:39:37 +01:00
* Get company favor.
2021-11-03 05:27:21 +01:00
* @remarks
2022-01-16 00:39:37 +01:00
* RAM cost: 1 GB * 16/4/1
2021-11-03 05:27:21 +01:00
*
2021-10-30 18:34:14 +02:00
*
* This function will return the amount of favor you have at the specified company.
* If the company passed in as an argument is invalid, -1 will be returned.
*
* @param companyName - Name of the company.
* @returns Amount of favor you have at the specified company.
*/
2021-11-03 05:27:21 +01:00
getCompanyFavor(companyName: string): number;
2021-10-30 18:34:14 +02:00
/**
2022-01-16 00:39:37 +01:00
* Get company favor gain.
2021-11-03 05:27:21 +01:00
* @remarks
2022-01-16 00:39:37 +01:00
* RAM cost: 0.75 GB * 16/4/1
2021-11-03 05:27:21 +01:00
*
2021-10-30 18:34:14 +02:00
*
* This function will return the amount of favor you will gain for the specified
* company when you reset by installing Augmentations.
*
* @param companyName - Name of the company.
* @returns Amount of favor you gain at the specified company when you reset by installing Augmentations.
*/
2021-11-03 05:27:21 +01:00
getCompanyFavorGain(companyName: string): number;
2021-10-30 18:34:14 +02:00
/**
2022-01-16 00:39:37 +01:00
* List all current faction invitations.
2021-11-03 05:27:21 +01:00
* @remarks
2022-01-16 00:39:37 +01:00
* RAM cost: 3 GB * 16/4/1
2021-11-03 05:27:21 +01:00
*
2021-10-30 18:34:14 +02:00
*
* Returns an array with the name of all Factions you currently have oustanding invitations from.
*
* @returns Array with the name of all Factions you currently have oustanding invitations from.
*/
2021-11-03 05:27:21 +01:00
checkFactionInvitations(): string[];
2021-10-30 18:34:14 +02:00
/**
2022-01-16 00:39:37 +01:00
* Join a faction.
2021-11-03 05:27:21 +01:00
* @remarks
2022-01-16 00:39:37 +01:00
* RAM cost: 3 GB * 16/4/1
2021-11-03 05:27:21 +01:00
*
2021-10-30 18:34:14 +02:00
*
* This function will automatically accept an invitation from a faction and join it.
*
* @param faction - Name of faction to join.
* @returns True if player joined the faction, and false otherwise.
*/
2021-11-03 05:27:21 +01:00
joinFaction(faction: string): boolean;
2021-10-30 18:34:14 +02:00
/**
2022-01-16 00:39:37 +01:00
* Work for a faction.
2021-11-03 05:27:21 +01:00
* @remarks
2022-01-16 00:39:37 +01:00
* RAM cost: 3 GB * 16/4/1
2021-11-03 05:27:21 +01:00
*
2021-10-30 18:34:14 +02:00
*
* This function will automatically set you to start working for the specified faction.
* Obviously, you must be a member of the faction or else this function will fail. If
* you are already in the middle of some working action (such as working for a company,
* training at a gym, or creating a program), then running this function will automatically
* cancel that action and give you your earnings.
*
* This function will return true if you successfully start working for the specified faction, and false otherwise.
*
* Note that when you are working for a faction, you will not actually receive your earnings (reputation, experience) until you FINISH the action.
*
* @example
2021-10-30 21:46:34 +02:00
* ```ts
2022-01-08 19:25:06 +01:00
* // NS1:
2021-10-30 18:34:14 +02:00
* //If you only want to work until you get 100,000 faction reputation. One small hack to get around this is to continuously restart the action to receive your earnings:
* while (getFactionRep(FACTION NAME) < VALUE) {
* workForFaction(FACNAME, WORKTYPE);
* sleep(60000);
* }
* //This way, your faction reputation will be updated every minute.
* ```
2022-01-08 19:25:06 +01:00
* @example
* ```ts
* // NS2:
* //If you only want to work until you get 100,000 faction reputation. One small hack to get around this is to continuously restart the action to receive your earnings:
* while (ns.getFactionRep(FACTION NAME) < VALUE) {
* ns.workForFaction(FACNAME, WORKTYPE);
* await ns.sleep(60000);
* }
* //This way, your faction reputation will be updated every minute.
* ```
2021-10-30 18:34:14 +02:00
* @param faction - Name of faction to work for.
* @param workType - Type of work to perform for the faction.
2022-01-08 19:25:06 +01:00
* @param focus - Acquire player focus on this work operation. Optional. Defaults to true.
2021-10-30 18:34:14 +02:00
* @returns True if the player starts working, and false otherwise.
*/
2022-01-08 19:25:06 +01:00
workForFaction(faction: string, workType: string, focus?: boolean): boolean;
2021-10-30 18:34:14 +02:00
/**
2022-01-16 00:39:37 +01:00
* Get faction reputation.
2021-11-03 05:27:21 +01:00
* @remarks
2022-01-16 00:39:37 +01:00
* RAM cost: 1 GB * 16/4/1
2021-11-03 05:27:21 +01:00
*
2021-10-30 18:34:14 +02:00
*
* This function returns the amount of reputation you have for the specified faction.
*
* @param faction - Name of faction to work for.
* @returns Amount of reputation you have for the specified faction.
*/
2021-11-03 05:27:21 +01:00
getFactionRep(faction: string): number;
2021-10-30 18:34:14 +02:00
/**
2022-01-16 00:39:37 +01:00
* Get faction favor.
2021-11-03 05:27:21 +01:00
* @remarks
2022-01-16 00:39:37 +01:00
* RAM cost: 1 GB * 16/4/1
2021-11-03 05:27:21 +01:00
*
2021-10-30 18:34:14 +02:00
*
* This function returns the amount of favor you have for the specified faction.
*
* @param faction - Name of faction.
* @returns Amount of favor you have for the specified faction.
*/
2021-11-03 05:27:21 +01:00
getFactionFavor(faction: string): number;
2021-10-30 18:34:14 +02:00
/**
2022-01-16 00:39:37 +01:00
* Get faction favor gain.
2021-11-03 05:27:21 +01:00
* @remarks
2022-01-16 00:39:37 +01:00
* RAM cost: 0.75 GB * 16/4/1
2021-11-03 05:27:21 +01:00
*
2021-10-30 18:34:14 +02:00
*
* This function returns the amount of favor you will gain for the specified
* faction when you reset by installing Augmentations.
*
* @param faction - Name of faction.
* @returns Amount of favor you will gain for the specified faction when you reset by installing Augmentations.
*/
2021-11-03 05:27:21 +01:00
getFactionFavorGain(faction: string): number;
2021-10-30 18:34:14 +02:00
/**
2022-01-16 00:39:37 +01:00
* Donate to a faction.
2021-11-03 05:27:21 +01:00
* @remarks
2022-01-16 00:39:37 +01:00
* RAM cost: 5 GB * 16/4/1
2021-11-03 05:27:21 +01:00
*
2021-10-30 18:34:14 +02:00
*
* Attempts to donate money to the specified faction in exchange for reputation.
* Returns true if you successfully donate the money, and false otherwise.
*
* @param faction - Name of faction to donate to.
* @param amount - Amount of money to donate.
* @returns True if the money was donated, and false otherwise.
*/
2021-11-03 05:27:21 +01:00
donateToFaction(faction: string, amount: number): boolean;
2021-10-30 18:34:14 +02:00
/**
2022-01-16 00:39:37 +01:00
* Create a program.
2021-11-03 05:27:21 +01:00
* @remarks
2022-01-16 00:39:37 +01:00
* RAM cost: 5 GB * 16/4/1
2021-11-03 05:27:21 +01:00
*
2021-10-30 18:34:14 +02:00
*
* This function will automatically set you to start working on creating the
* specified program. If you are already in the middle of some working action
* (such as working for a company, training at a gym, or taking a course), then
* running this function will automatically cancel that action and give you your
* earnings.
*
* This function returns true if you successfully start working on the specified program, and false otherwise.
*
* Note that creating a program using this function has the same hacking level requirements as it normally would. These level requirements are:
* * BruteSSH.exe: 50
* * FTPCrack.exe: 100
* * relaySMTP.exe: 250
* * HTTPWorm.exe: 500
* * SQLInject.exe: 750
* * DeepscanV1.exe: 75
* * DeepscanV2.exe: 400
* * ServerProfiler.exe: 75
* * AutoLink.exe: 25
*
* @example
2021-10-30 21:46:34 +02:00
* ```ts
2022-01-08 19:25:06 +01:00
* // NS1:
2021-10-30 18:34:14 +02:00
* createProgram(relaysmtp.exe);
* ```
2022-01-08 19:25:06 +01:00
* @example
* ```ts
* // NS2:
* ns.createProgram(relaysmtp.exe);
* ```
2021-10-30 18:34:14 +02:00
* @param program - Name of program to create.
2022-01-12 19:03:49 +01:00
* @param focus - Acquire player focus on this program creation. Optional. Defaults to true.
2021-10-30 18:34:14 +02:00
* @returns True if you successfully start working on the specified program, and false otherwise.
*/
2022-01-12 19:03:49 +01:00
createProgram(program: string, focus?: boolean): boolean;
2021-10-30 18:34:14 +02:00
/**
2022-01-16 00:39:37 +01:00
* Commit a crime.
2021-11-03 05:27:21 +01:00
* @remarks
2022-01-16 00:39:37 +01:00
* RAM cost: 5 GB * 16/4/1
2021-11-03 05:27:21 +01:00
*
2021-10-30 18:34:14 +02:00
*
* This function is used to automatically attempt to commit crimes.
* If you are already in the middle of some working action (such
* as working for a company or training at a gym), then running this
* function will automatically cancel that action and give you your
* earnings.
*
2022-01-08 19:25:06 +01:00
* This function returns the number of milliseconds it takes to attempt the
* specified crime (e.g It takes 60 seconds to attempt the Rob Store crime,
* so running `commitCrime('rob store')` will return 60,000).
2021-10-30 18:34:14 +02:00
*
* Warning: I do not recommend using the time returned from this function to try
* and schedule your crime attempts. Instead, I would use the isBusy Singularity
* function to check whether you have finished attempting a crime. This is because
* although the game sets a certain crime to be X amount of seconds, there is no
* guarantee that your browser will follow that time limit.
*
* @param crime - Name of crime to attempt.
2022-09-23 21:03:38 +02:00
* @param focus - Acquire player focus on this crime. Optional. Defaults to true.
2022-01-16 00:39:37 +01:00
* @returns The number of milliseconds it takes to attempt the specified crime.
2021-10-30 18:34:14 +02:00
*/
2022-08-17 14:50:05 +02:00
commitCrime(crime: string, focus?: boolean): number;
2021-10-30 18:34:14 +02:00
/**
2022-01-16 00:39:37 +01:00
* Get chance to successfully commit a crime.
2021-11-03 05:27:21 +01:00
* @remarks
2022-01-16 00:39:37 +01:00
* RAM cost: 5 GB * 16/4/1
2021-11-03 05:27:21 +01:00
*
2021-10-30 18:34:14 +02:00
*
* This function returns your chance of success at commiting the specified crime.
*
* @param crime - Name of crime.
2021-11-03 05:27:21 +01:00
* @returns Chance of success at commiting the specified crime.
2021-10-30 18:34:14 +02:00
*/
2021-11-03 05:27:21 +01:00
getCrimeChance(crime: string): number;
2021-10-30 18:34:14 +02:00
/**
2022-01-16 00:39:37 +01:00
* Get stats related to a crime.
2021-11-03 05:27:21 +01:00
* @remarks
2022-01-16 00:39:37 +01:00
* RAM cost: 5 GB * 16/4/1
2021-11-03 05:27:21 +01:00
*
2021-10-30 18:34:14 +02:00
*
* Returns the stats of the crime.
*
* @param crime - Name of crime. Not case-sensitive
* @returns The stats of the crime.
*/
2021-11-03 05:27:21 +01:00
getCrimeStats(crime: string): CrimeStats;
2021-10-30 18:34:14 +02:00
/**
2022-01-16 00:39:37 +01:00
* Get a list of owned augmentation.
2021-11-03 05:27:21 +01:00
* @remarks
2022-01-16 00:39:37 +01:00
* RAM cost: 5 GB * 16/4/1
2021-11-03 05:27:21 +01:00
*
2021-10-30 18:34:14 +02:00
*
* This function returns an array containing the names (as strings) of all Augmentations you have.
*
* @param purchased - Specifies whether the returned array should include Augmentations you have purchased but not yet installed. By default, this argument is false which means that the return value will NOT have the purchased Augmentations.
* @returns Array containing the names (as strings) of all Augmentations you have.
*/
2021-11-03 05:27:21 +01:00
getOwnedAugmentations(purchased?: boolean): string[];
2021-10-30 18:34:14 +02:00
2022-08-17 14:50:05 +02:00
/**
* Get a list of acquired Source-Files.
* @remarks
* RAM cost: 5 GB
*
* Returns an array of source files
*
* @returns Array containing an object with number and level of the source file.
*/
getOwnedSourceFiles(): SourceFileLvl[];
2021-10-30 18:34:14 +02:00
/**
2022-01-16 00:39:37 +01:00
* Get a list of augmentation available from a faction.
2021-11-03 05:27:21 +01:00
* @remarks
2022-01-16 00:39:37 +01:00
* RAM cost: 5 GB * 16/4/1
2021-11-03 05:27:21 +01:00
*
2021-10-30 18:34:14 +02:00
*
* Returns an array containing the names (as strings) of all Augmentations
* that are available from the specified faction.
*
* @param faction - Name of faction.
* @returns Array containing the names of all Augmentations.
*/
2021-11-03 05:27:21 +01:00
getAugmentationsFromFaction(faction: string): string[];
2021-10-30 18:34:14 +02:00
/**
2022-01-16 00:39:37 +01:00
* Get the pre-requisite of an augmentation.
2021-11-03 05:27:21 +01:00
* @remarks
2022-01-16 00:39:37 +01:00
* RAM cost: 5 GB * 16/4/1
2021-11-03 05:27:21 +01:00
*
2021-10-30 18:34:14 +02:00
*
* This function returns an array with the names of the prerequisite Augmentation(s) for the specified Augmentation.
* If there are no prerequisites, a blank array is returned.
*
* @param augName - Name of Augmentation.
* @returns Array with the names of the prerequisite Augmentation(s) for the specified Augmentation.
*/
2021-11-03 05:27:21 +01:00
getAugmentationPrereq(augName: string): string[];
2021-10-30 18:34:14 +02:00
/**
2022-01-16 00:39:37 +01:00
* Get the price and reputation of an augmentation.
2021-12-03 20:12:32 +01:00
* @deprecated use getAugmentationPrice getAugmentationRepCost
* @remarks
2022-01-16 00:39:37 +01:00
* RAM cost: 5 GB * 16/4/1
*
*
* This function returns an array with two elements that gives the cost for
* the specified Augmentation. The first element in the returned array is the
* reputation requirement of the Augmentation, and the second element is the
* money cost.
*
* If an invalid Augmentation name is passed in for the augName argument, this
* function will return the array [-1, -1].
*
* @param augName - Name of Augmentation.
* @returns Array with first element as a reputation requirement and second element as the money cost.
*/
getAugmentationCost(augName: string): [number, number];
/**
2022-01-16 00:39:37 +01:00
* Get price of an augmentation.
* @remarks
2022-01-16 00:39:37 +01:00
* RAM cost: 2.5 GB * 16/4/1
*
*
* @param augName - Name of Augmentation.
* @returns Price of the augmentation.
*/
getAugmentationPrice(augName: string): number;
2022-08-17 14:50:05 +02:00
/**
* Get base price of an augmentation.
* @remarks
* RAM cost: 2.5 GB * 16/4/1
*
*
* @param augName - Name of Augmentation.
* @returns Base price of the augmentation, before price multiplier.
*/
getAugmentationBasePrice(augName: string): number;
/**
2022-01-16 00:39:37 +01:00
* Get reputation requirement of an augmentation.
* @remarks
2022-01-16 00:39:37 +01:00
* RAM cost: 2.5 GB * 16/4/1
*
*
* @param augName - Name of Augmentation.
* @returns Reputation requirement of the augmentation.
*/
getAugmentationRepReq(augName: string): number;
2021-10-30 18:34:14 +02:00
/**
2022-01-16 00:39:37 +01:00
* Purchase an augmentation
2021-11-03 05:27:21 +01:00
* @remarks
2022-01-16 00:39:37 +01:00
* RAM cost: 5 GB * 16/4/1
2021-10-30 18:34:14 +02:00
*
*
* This function will try to purchase the specified Augmentation through the given Faction.
*
* This function will return true if the Augmentation is successfully purchased, and false otherwise.
*
* @param faction - Name of faction to purchase Augmentation from.
2021-11-03 05:27:21 +01:00
* @param augmentation - Name of Augmentation to purchase.
2021-10-30 18:34:14 +02:00
* @returns True if the Augmentation is successfully purchased, and false otherwise.
*/
2021-11-03 05:27:21 +01:00
purchaseAugmentation(faction: string, augmentation: string): boolean;
2021-10-30 18:34:14 +02:00
/**
2022-01-16 00:39:37 +01:00
* Get the stats of an augmentation.
2021-11-03 05:27:21 +01:00
* @remarks
2022-01-16 00:39:37 +01:00
* RAM cost: 5 GB * 16/4/1
2021-11-03 05:27:21 +01:00
*
2021-10-30 18:34:14 +02:00
*
* This function returns augmentation stats.
*
* @param name - Name of Augmentation. CASE-SENSITIVE.
* @returns Augmentation stats.
*/
2021-11-03 05:27:21 +01:00
getAugmentationStats(name: string): AugmentationStats;
2021-10-30 18:34:14 +02:00
/**
2022-01-16 00:39:37 +01:00
* Install your purchased augmentations.
2021-11-03 05:27:21 +01:00
* @remarks
2022-01-16 00:39:37 +01:00
* RAM cost: 5 GB * 16/4/1
2021-11-03 05:27:21 +01:00
*
2021-10-30 18:34:14 +02:00
*
2022-05-24 14:12:49 +02:00
* This function will automatically install your Augmentations, resetting the game as usual. If you do not own uninstalled Augmentations then the game will not reset.
2021-10-30 18:34:14 +02:00
*
2021-11-03 05:27:21 +01:00
* @param cbScript - This is a script that will automatically be run after Augmentations are installed (after the reset). This script will be run with no arguments and 1 thread. It must be located on your home computer.
2021-10-30 18:34:14 +02:00
*/
2021-10-30 21:46:34 +02:00
installAugmentations(cbScript?: string): void;
2021-10-30 18:34:14 +02:00
/**
2022-01-16 00:39:37 +01:00
* Hospitalize the player.
* @remarks
2022-01-16 00:39:37 +01:00
* RAM cost: 0.25 GB * 16/4/1
*/
2022-04-13 07:35:35 +02:00
hospitalize(): void;
2021-10-30 18:34:14 +02:00
/**
2022-01-16 00:39:37 +01:00
* Soft reset the game.
2021-11-03 05:27:21 +01:00
* @remarks
2022-01-16 00:39:37 +01:00
* RAM cost: 5 GB * 16/4/1
2021-11-03 05:27:21 +01:00
*
2021-10-30 18:34:14 +02:00
*
* This function will perform a reset even if you dont have any augmentation installed.
*
* @param cbScript - This is a script that will automatically be run after Augmentations are installed (after the reset). This script will be run with no arguments and 1 thread. It must be located on your home computer.
*/
softReset(cbScript: string): void;
/**
2022-01-16 00:39:37 +01:00
* Go to a location.
* @remarks
2022-01-16 00:39:37 +01:00
* RAM cost: 5 GB * 16/4/1
*
*
* Move the player to a specific location.
*
* @param locationName - Name of the location.
* @returns True if the player was moved there, false otherwise.
*/
goToLocation(locationName: string): boolean;
/**
2022-01-16 00:39:37 +01:00
* Get the current server.
* @remarks
2022-01-16 00:39:37 +01:00
* RAM cost: 2 GB * 16/4/1
*
*
* @returns Name of the current server.
*/
getCurrentServer(): string;
/**
2022-01-16 00:39:37 +01:00
* Connect to a server.
* @remarks
2022-01-16 00:39:37 +01:00
* RAM cost: 2 GB * 16/4/1
*
*
* Run the connect HOSTNAME command in the terminal. Can only connect to neighbors.
*
* @returns True if the connect command was successful, false otherwise.
*/
connect(hostname: string): boolean;
/**
2022-01-16 00:39:37 +01:00
* Run the hack command in the terminal.
* @remarks
2022-01-16 00:39:37 +01:00
* RAM cost: 2 GB * 16/4/1
*
*
* @returns Amount of money stolen by manual hacking.
*/
manualHack(): Promise<number>;
/**
2022-01-16 00:39:37 +01:00
* Run the backdoor command in the terminal.
* @remarks
2022-01-16 00:39:37 +01:00
* RAM cost: 2 GB * 16/4/1
*
*
2022-01-16 00:39:37 +01:00
* @returns Promise waiting for the installation to finish.
2021-10-30 18:34:14 +02:00
*/
2021-11-22 17:36:13 +01:00
installBackdoor(): Promise<void>;
2021-12-16 18:59:11 +01:00
/**
2022-01-16 00:39:37 +01:00
* Check if the player is focused.
2021-12-16 18:59:11 +01:00
* @remarks
2022-01-16 00:39:37 +01:00
* RAM cost: 0.1 GB * 16/4/1
2021-12-16 18:59:11 +01:00
*
*
* @returns True if the player is focused.
*/
isFocused(): boolean;
/**
2022-01-16 00:39:37 +01:00
* Set the players focus.
2021-12-16 18:59:11 +01:00
* @remarks
2022-01-16 00:39:37 +01:00
* RAM cost: 0.1 GB * 16/4/1
2021-12-16 18:59:11 +01:00
*
* @returns True if the focus was changed.
*/
setFocus(focus: boolean): boolean;
2022-03-29 21:49:31 +02:00
/**
* Get a list of programs offered on the dark web.
* @remarks
* RAM cost: 1 GB * 16/4/1
*
*
* This function allows the player to get a list of programs available for purchase
* on the dark web. Players MUST have purchased Tor to get the list of programs
* available. If Tor has not been purchased yet, this function will return an
* empty list.
*
* @example
* ```ts
* // NS1
2022-05-24 14:12:49 +02:00
* getDarkwebPrograms();
2022-03-29 21:49:31 +02:00
* // returns ['BruteSSH.exe', 'FTPCrack.exe'...etc]
* ```
* @example
* ```ts
* // NS2
2022-05-24 14:12:49 +02:00
* ns.getDarkwebPrograms();
2022-03-29 21:49:31 +02:00
* // returns ['BruteSSH.exe', 'FTPCrack.exe'...etc]
* ```
* @returns - a list of programs available for purchase on the dark web, or [] if Tor has not
* been purchased
*/
getDarkwebPrograms(): string[];
/**
* Check the price of an exploit on the dark web
* @remarks
* RAM cost: 0.5 GB * 16/4/1
*
*
* This function allows you to check the price of a darkweb exploit/program.
* You MUST have a TOR router in order to use this function. The price returned
* by this function is the same price you would see with buy -l from the terminal.
* Returns the cost of the program if it has not been purchased yet, 0 if it
* has already been purchased, or -1 if Tor has not been purchased (and thus
* the program/exploit is not available for purchase).
*
* If the program does not exist, an error is thrown.
*
*
* @example
* ```ts
* // NS1
* getDarkwebProgramCost("brutessh.exe");
* ```
* @example
* ```ts
* // NS2
* ns.getDarkwebProgramCost("brutessh.exe");
* ```
* @param programName - Name of program to check the price of
* @returns Price of the specified darkweb program
* (if not yet purchased), 0 if it has already been purchased, or -1 if Tor has not been
* purchased. Throws an error if the specified program/exploit does not exist
*/
getDarkwebProgramCost(programName: string): number;
2022-05-24 14:12:49 +02:00
/**
* b1t_flum3 into a different BN.
* @remarks
* RAM cost: 16 GB * 16/4/1
*
* @param nextBN - BN number to jump to
* @param callbackScript - Name of the script to launch in the next BN.
*/
b1tflum3(nextBN: number, callbackScript?: string): void;
/**
* Destroy the w0r1d_d43m0n and move on to the next BN.
* @remarks
* RAM cost: 32 GB * 16/4/1
*
* You must have the special augment installed and the required hacking level
* OR
* Completed the final black op.
*
* @param nextBN - BN number to jump to
* @param callbackScript - Name of the script to launch in the next BN.
*/
destroyW0r1dD43m0n(nextBN: number, callbackScript?: string): void;
2022-08-17 14:50:05 +02:00
/**
* Get the current work the player is doing.
* @remarks
* RAM cost: 0.5 GB * 16/4/1
*
* @returns - An object representing the current work. Fields depend on the kind of work.
*/
getCurrentWork(): any | null;
}
/**
* @public
*/
export declare interface Skills {
hacking: number;
strength: number;
defense: number;
dexterity: number;
agility: number;
charisma: number;
intelligence: number;
}
/**
2021-12-09 01:19:07 +01:00
* Skills formulas
* @public
*/
export declare interface SkillsFormulas {
2021-12-09 01:19:07 +01:00
/**
* Calculate skill level.
* @param exp - experience for that skill
* @param skillMult - Multiplier for that skill, defaults to 1.
* @returns The calculated skill level.
*/
calculateSkill(exp: number, skillMult?: number): number;
/**
* Calculate exp for skill level.
* @param skill - target skill level
* @param skillMult - Multiplier for that skill, defaults to 1.
* @returns The calculated exp required.
*/
calculateExp(skill: number, skillMult?: number): number;
2021-10-30 18:34:14 +02:00
}
/**
2021-10-30 21:46:34 +02:00
* Sleeve API
2021-11-03 05:27:21 +01:00
* @remarks
* If you are not in BitNode-10, then you must have Source-File 10 in order to use this API.
2021-10-30 18:34:14 +02:00
* @public
*/
export declare interface Sleeve {
/**
2021-11-03 05:27:21 +01:00
* Get the number of sleeves you own.
* @remarks
* RAM cost: 4 GB
2021-10-30 18:34:14 +02:00
*
* Return the number of duplicate sleeves the player has.
*
* @returns number of duplicate sleeves the player has.
*/
getNumSleeves(): number;
/**
2021-11-03 05:27:21 +01:00
* Get the stats of a sleeve.
* @remarks
* RAM cost: 4 GB
2021-10-30 18:34:14 +02:00
*
* Return a structure containing the stats of the sleeve.
*
* @param sleeveNumber - Index of the sleeve to get stats of.
* @returns Object containing the stats of the sleeve.
*/
2021-10-30 21:46:34 +02:00
getSleeveStats(sleeveNumber: number): SleeveSkills;
2021-10-30 18:34:14 +02:00
/**
2021-11-03 05:27:21 +01:00
* Get information about a sleeve.
* @remarks
* RAM cost: 4 GB
2021-10-30 18:34:14 +02:00
*
* Return a struct containing tons of information about this sleeve
*
* @param sleeveNumber - Index of the sleeve to retrieve information.
* @returns Object containing tons of information about this sleeve.
*/
getInformation(sleeveNumber: number): SleeveInformation;
/**
2021-11-03 05:27:21 +01:00
* Get task of a sleeve.
* @remarks
* RAM cost: 4 GB
2021-10-30 18:34:14 +02:00
*
* Return the current task that the sleeve is performing. type is set to Idle if the sleeve isnt doing anything.
*
* @param sleeveNumber - Index of the sleeve to retrieve task from.
* @returns Object containing information the current task that the sleeve is performing.
*/
getTask(sleeveNumber: number): SleeveTask;
/**
2021-11-03 05:27:21 +01:00
* Set a sleeve to shock recovery.
* @remarks
* RAM cost: 4 GB
2021-10-30 18:34:14 +02:00
*
* Return a boolean indicating whether or not this action was set successfully.
*
* @param sleeveNumber - Index of the sleeve to start recovery.
* @returns True if this action was set successfully, false otherwise.
*/
setToShockRecovery(sleeveNumber: number): boolean;
/**
2021-11-03 05:27:21 +01:00
* Set a sleeve to synchronize.
* @remarks
* RAM cost: 4 GB
2021-10-30 18:34:14 +02:00
*
* Return a boolean indicating whether or not this action was set successfully.
*
* @param sleeveNumber - Index of the sleeve to start synchronizing.
* @returns True if this action was set successfully, false otherwise.
*/
setToSynchronize(sleeveNumber: number): boolean;
/**
2021-11-03 05:27:21 +01:00
* Set a sleeve to commit crime.
* @remarks
* RAM cost: 4 GB
2021-10-30 18:34:14 +02:00
*
* Return a boolean indicating whether or not this action was set successfully.
*
* Returns false if an invalid action is specified.
*
* @param sleeveNumber - Index of the sleeve to start commiting crime.
* @param name - Name of the crime. Must be an exact match.
* @returns True if this action was set successfully, false otherwise.
*/
2021-11-03 05:27:21 +01:00
setToCommitCrime(sleeveNumber: number, name: string): boolean;
2021-10-30 18:34:14 +02:00
/**
2021-11-03 05:27:21 +01:00
* Set a sleeve to work for a faction.
* @remarks
* RAM cost: 4 GB
2021-10-30 18:34:14 +02:00
*
* Return a boolean indicating whether or not the sleeve started working or this faction.
*
* @param sleeveNumber - Index of the sleeve to work for the faction.
* @param factionName - Name of the faction to work for.
* @param factionWorkType - Name of the action to perform for this faction.
2022-04-13 07:35:35 +02:00
* @returns True if the sleeve started working on this faction, false otherwise, can also throw on errors
2021-10-30 18:34:14 +02:00
*/
2022-04-13 07:35:35 +02:00
setToFactionWork(sleeveNumber: number, factionName: string, factionWorkType: string): boolean | undefined;
2021-10-30 18:34:14 +02:00
/**
2021-11-03 05:27:21 +01:00
* Set a sleeve to work for a company.
* @remarks
* RAM cost: 4 GB
2021-10-30 18:34:14 +02:00
*
* Return a boolean indicating whether or not the sleeve started working or this company.
*
* @param sleeveNumber - Index of the sleeve to work for the company.
* @param companyName - Name of the company to work for.
* @returns True if the sleeve started working on this company, false otherwise.
*/
2021-11-03 05:27:21 +01:00
setToCompanyWork(sleeveNumber: number, companyName: string): boolean;
2021-10-30 18:34:14 +02:00
/**
2021-11-03 05:27:21 +01:00
* Set a sleeve to take a class at a university.
* @remarks
* RAM cost: 4 GB
2021-10-30 18:34:14 +02:00
*
* Return a boolean indicating whether or not this action was set successfully.
*
* @param sleeveNumber - Index of the sleeve to start taking class.
* @param university - Name of the university to attend.
* @param className - Name of the class to follow.
* @returns True if this action was set successfully, false otherwise.
*/
2021-11-03 05:27:21 +01:00
setToUniversityCourse(sleeveNumber: number, university: string, className: string): boolean;
2021-10-30 18:34:14 +02:00
/**
2021-11-03 05:27:21 +01:00
* Set a sleeve to workout at the gym.
* @remarks
* RAM cost: 4 GB
2021-10-30 18:34:14 +02:00
*
* Return a boolean indicating whether or not the sleeve started working out.
*
* @param sleeveNumber - Index of the sleeve to workout at the gym.
* @param gymName - Name of the gym.
* @param stat - Name of the stat to train.
* @returns True if the sleeve started working out, false otherwise.
*/
2021-11-03 05:27:21 +01:00
setToGymWorkout(sleeveNumber: number, gymName: string, stat: string): boolean;
2021-10-30 18:34:14 +02:00
/**
2021-11-03 05:27:21 +01:00
* Make a sleeve travel to another city.
* @remarks
* RAM cost: 4 GB
2021-10-30 18:34:14 +02:00
*
* Return a boolean indicating whether or not the sleeve reached destination.
*
* @param sleeveNumber - Index of the sleeve to travel.
* @param cityName - Name of the destination city.
* @returns True if the sleeve reached destination, false otherwise.
*/
2021-11-03 05:27:21 +01:00
travel(sleeveNumber: number, cityName: string): boolean;
2021-10-30 18:34:14 +02:00
/**
2021-11-03 05:27:21 +01:00
* Get augmentations installed on a sleeve.
* @remarks
* RAM cost: 4 GB
2021-10-30 18:34:14 +02:00
*
* Return a list of augmentation names that this sleeve has installed.
*
* @param sleeveNumber - Index of the sleeve to retrieve augmentations from.
* @returns List of augmentation names that this sleeve has installed.
*/
2021-11-03 05:27:21 +01:00
getSleeveAugmentations(sleeveNumber: number): string[];
2021-10-30 18:34:14 +02:00
2022-08-17 14:50:05 +02:00
/**
* Get price of an augmentation.
* @remarks
* RAM cost: 4 GB
*
*
* @param augName - Name of Augmentation.
* @returns Price of the augmentation.
*/
getSleeveAugmentationPrice(augName: string): number;
/**
* Get reputation requirement of an augmentation.
* @remarks
* RAM cost: 4 GB
*
*
* @param augName - Name of Augmentation.
* @returns Reputation requirement of the augmentation.
*/
getSleeveAugmentationRepReq(augName: string): number;
2021-10-30 18:34:14 +02:00
/**
2021-11-03 05:27:21 +01:00
* List purchasable augs for a sleeve.
* @remarks
* RAM cost: 4 GB
2021-10-30 18:34:14 +02:00
*
* Return a list of augmentations that the player can buy for this sleeve.
*
* @param sleeveNumber - Index of the sleeve to retrieve purchasable augmentations from.
* @returns List of augmentations that the player can buy for this sleeve.
*/
getSleevePurchasableAugs(sleeveNumber: number): AugmentPair[];
/**
2021-11-03 05:27:21 +01:00
* Purchase an aug for a sleeve.
* @remarks
* RAM cost: 4 GB
2021-10-30 18:34:14 +02:00
*
* Return true if the aug was purchased and installed on the sleeve.
*
* @param sleeveNumber - Index of the sleeve to buy an aug for.
* @param augName - Name of the aug to buy. Must be an exact match.
* @returns True if the aug was purchased and installed on the sleeve, false otherwise.
*/
2021-11-03 05:27:21 +01:00
purchaseSleeveAug(sleeveNumber: number, augName: string): boolean;
2022-05-24 14:12:49 +02:00
/**
* Set a sleeve to perform bladeburner actions.
* @remarks
* RAM cost: 4 GB
*
* Return a boolean indicating whether or not the sleeve started working out.
*
* @param sleeveNumber - Index of the sleeve to workout at the gym.
* @param action - Name of the action to be performed.
* @param contract - Name of the contract if applicable.
* @returns True if the sleeve started working out, false otherwise.
*/
setToBladeburnerAction(sleeveNumber: number, action: string, contract?: string): boolean;
2021-10-30 18:34:14 +02:00
}
/**
2021-10-30 21:46:34 +02:00
* Object representing sleeve information.
2021-10-30 18:34:14 +02:00
* @public
*/
export declare interface SleeveInformation {
2022-01-08 19:25:06 +01:00
/** Location of the sleeve */
2021-11-03 05:27:21 +01:00
city: string;
2022-08-17 14:50:05 +02:00
/** hp of the sleeve */
hp: HP;
2022-01-08 19:25:06 +01:00
/** Jobs available to the sleeve */
2021-10-30 18:34:14 +02:00
jobs: string[];
2022-01-08 19:25:06 +01:00
/** Job titles available to the sleeve */
2021-11-03 05:27:21 +01:00
jobTitle: string[];
2022-01-08 19:25:06 +01:00
/** Does this sleeve have access to the tor router */
2021-10-30 18:34:14 +02:00
tor: boolean;
2022-01-08 19:25:06 +01:00
/** Sleeve multipliers */
2021-10-30 18:34:14 +02:00
mult: CharacterMult;
}
/**
2021-10-30 21:46:34 +02:00
* Object representing a sleeve stats.
2021-10-30 18:34:14 +02:00
* @public
*/
2021-10-30 21:46:34 +02:00
export declare interface SleeveSkills {
2022-01-08 19:25:06 +01:00
/** Current shock of the sleeve [0-100] */
2021-10-30 21:46:34 +02:00
shock: number;
2022-01-08 19:25:06 +01:00
/** Current sync of the sleeve [0-100] */
2021-10-30 21:46:34 +02:00
sync: number;
2022-08-17 14:50:05 +02:00
/** Current memory of the sleeve [1-100] */
memory: number;
2022-01-08 19:25:06 +01:00
/** Current hacking skill of the sleeve */
hacking: number;
2022-01-08 19:25:06 +01:00
/** Current strength of the sleeve */
2021-10-30 18:34:14 +02:00
strength: number;
2022-01-08 19:25:06 +01:00
/** Current defense of the sleeve */
2021-10-30 18:34:14 +02:00
defense: number;
2022-01-08 19:25:06 +01:00
/** Current dexterity of the sleeve */
2021-10-30 18:34:14 +02:00
dexterity: number;
2022-01-08 19:25:06 +01:00
/** Current agility of the sleeve */
2021-10-30 18:34:14 +02:00
agility: number;
2022-01-08 19:25:06 +01:00
/** Current charisma of the sleeve */
2021-10-30 18:34:14 +02:00
charisma: number;
}
/**
2021-10-30 21:46:34 +02:00
* Object representing a sleeve current task.
2021-10-30 18:34:14 +02:00
* @public
*/
2022-08-17 14:50:05 +02:00
export declare type SleeveTask = any;
2021-10-30 18:34:14 +02:00
/**
* @public
*/
export declare interface SleeveWorkGains {
2022-01-08 19:25:06 +01:00
/** Hacking exp gained from work */
2021-10-30 18:34:14 +02:00
workHackExpGain: number;
2022-01-08 19:25:06 +01:00
/** Strength exp gained from work */
2021-10-30 18:34:14 +02:00
workStrExpGain: number;
2022-01-08 19:25:06 +01:00
/** Defense exp gained from work, */
2021-10-30 18:34:14 +02:00
workDefExpGain: number;
2022-01-08 19:25:06 +01:00
/** Dexterity exp gained from work */
2021-10-30 18:34:14 +02:00
workDexExpGain: number;
2022-01-08 19:25:06 +01:00
/** Agility exp gained from work */
2021-10-30 18:34:14 +02:00
workAgiExpGain: number;
2022-01-08 19:25:06 +01:00
/** Charisma exp gained from work */
2021-10-30 18:34:14 +02:00
workChaExpGain: number;
2022-01-08 19:25:06 +01:00
/** Money gained from work */
2021-10-30 18:34:14 +02:00
workMoneyGain: number;
}
/**
* @public
*/
export declare interface SourceFileLvl {
/** The number of the source file */
2021-11-03 05:27:21 +01:00
n: number;
2021-10-30 18:34:14 +02:00
/** The level of the source file */
lvl: number;
}
2021-12-03 22:14:13 +01:00
/**
* Stanek's Gift API.
* @public
*/
export declare interface Stanek {
/**
* Stanek's Gift width.
* @remarks
* RAM cost: 0.4 GB
* @returns The width of the gift.
*/
2022-03-29 21:49:31 +02:00
giftWidth(): number;
2021-12-03 22:14:13 +01:00
/**
* Stanek's Gift height.
* @remarks
* RAM cost: 0.4 GB
* @returns The height of the gift.
*/
2022-03-29 21:49:31 +02:00
giftHeight(): number;
2021-12-03 22:14:13 +01:00
/**
2022-01-08 19:25:06 +01:00
* Charge a fragment, increasing its power.
2021-12-03 22:14:13 +01:00
* @remarks
* RAM cost: 0.4 GB
* @param rootX - rootX Root X against which to align the top left of the fragment.
* @param rootY - rootY Root Y against which to align the top left of the fragment.
* @returns Promise that lasts until the charge action is over.
*/
2022-03-29 21:49:31 +02:00
chargeFragment(rootX: number, rootY: number): Promise<void>;
2021-12-03 22:14:13 +01:00
/**
* List possible fragments.
* @remarks
2022-01-18 20:02:12 +01:00
* RAM cost: 0 GB
2021-12-03 22:14:13 +01:00
*
* @returns List of possible fragments.
*/
fragmentDefinitions(): Fragment[];
/**
* List of fragments in Stanek's Gift.
* @remarks
2022-01-18 20:02:12 +01:00
* RAM cost: 5 GB
2021-12-03 22:14:13 +01:00
*
* @returns List of active fragments placed on Stanek's Gift.
*/
activeFragments(): ActiveFragment[];
/**
* Clear the board of all fragments.
* @remarks
2022-01-18 20:02:12 +01:00
* RAM cost: 0 GB
2021-12-03 22:14:13 +01:00
*/
2022-03-29 21:49:31 +02:00
clearGift(): void;
2021-12-03 22:14:13 +01:00
/**
* Check if fragment can be placed at specified location.
* @remarks
2022-01-18 20:02:12 +01:00
* RAM cost: 0.5 GB
2021-12-03 22:14:13 +01:00
*
* @param rootX - rootX Root X against which to align the top left of the fragment.
* @param rootY - rootY Root Y against which to align the top left of the fragment.
* @param rotation - rotation A number from 0 to 3, the mount of 90 degree turn to take.
* @param fragmentId - fragmentId ID of the fragment to place.
* @returns true if the fragment can be placed at that position. false otherwise.
*/
2022-03-29 21:49:31 +02:00
canPlaceFragment(rootX: number, rootY: number, rotation: number, fragmentId: number): boolean;
2021-12-03 22:14:13 +01:00
/**
* Place fragment on Stanek's Gift.
* @remarks
2022-01-18 20:02:12 +01:00
* RAM cost: 5 GB
2021-12-03 22:14:13 +01:00
*
* @param rootX - X against which to align the top left of the fragment.
* @param rootY - Y against which to align the top left of the fragment.
* @param rotation - A number from 0 to 3, the mount of 90 degree turn to take.
* @param fragmentId - ID of the fragment to place.
* @returns true if the fragment can be placed at that position. false otherwise.
*/
2022-03-29 21:49:31 +02:00
placeFragment(rootX: number, rootY: number, rotation: number, fragmentId: number): boolean;
2021-12-03 22:14:13 +01:00
/**
* Get placed fragment at location.
* @remarks
2022-01-18 20:02:12 +01:00
* RAM cost: 5 GB
2021-12-03 22:14:13 +01:00
*
* @param rootX - X against which to align the top left of the fragment.
* @param rootY - Y against which to align the top left of the fragment.
* @returns The fragment at [rootX, rootY], if any.
*/
2022-03-29 21:49:31 +02:00
getFragment(rootX: number, rootY: number): ActiveFragment | undefined;
2021-12-03 22:14:13 +01:00
/**
* Remove fragment at location.
* @remarks
2022-01-18 20:02:12 +01:00
* RAM cost: 0.15 GB
2021-12-03 22:14:13 +01:00
*
* @param rootX - X against which to align the top left of the fragment.
* @param rootY - Y against which to align the top left of the fragment.
* @returns The fragment at [rootX, rootY], if any.
*/
2022-03-29 21:49:31 +02:00
removeFragment(rootX: number, rootY: number): boolean;
2022-05-24 14:12:49 +02:00
/**
* Accept Stanek's Gift by joining the Church of the Machine God
* @remarks
* RAM cost: 2 GB
*
* @returns true if the player is a member of the church and has the gift installed,
* false otherwise.
*/
acceptGift(): boolean;
2021-12-03 22:14:13 +01:00
}
2021-10-30 18:34:14 +02:00
/**
2021-10-30 21:46:34 +02:00
* Return value of {@link TIX.getOrders | getOrders}
2022-01-16 00:39:37 +01:00
*
* Keys are stock symbols, properties are arrays of {@link StockOrderObject}
2021-10-30 18:34:14 +02:00
* @public
*/
2021-11-03 05:33:14 +01:00
export declare interface StockOrder {
2021-11-03 05:27:21 +01:00
[key: string]: StockOrderObject[];
2021-11-03 05:33:14 +01:00
}
2021-10-30 18:34:14 +02:00
/**
2021-10-30 21:46:34 +02:00
* Value in map of {@link StockOrder}
2021-10-30 18:34:14 +02:00
* @public
*/
export declare interface StockOrderObject {
/** Number of shares */
shares: number;
/** Price per share */
price: number;
/** Order type */
2022-01-16 00:39:37 +01:00
type: OrderTypes;
2021-10-30 18:34:14 +02:00
/** Order position */
2022-01-16 00:39:37 +01:00
position: PositionTypes;
2021-11-03 05:27:21 +01:00
}
2021-10-30 18:34:14 +02:00
/**
2021-10-30 21:46:34 +02:00
* Stock market API
2021-10-30 18:34:14 +02:00
* @public
*/
export declare interface TIX {
2022-08-17 14:50:05 +02:00
/**
* Returns true if the player has access to a WSE Account
* @remarks RAM cost: 0.05 GB
*/
hasWSEAccount(): boolean;
/**
* Returns true if the player has access to the TIX API
* @remarks RAM cost: 0.05 GB
*/
hasTIXAPIAccess(): boolean;
/**
* Returns true if the player has access to the 4S Data
* @remarks RAM cost: 0.05 GB
*/
has4SData(): boolean;
/**
* Returns true if the player has access to the 4SData TIX API
* @remarks RAM cost: 0.05 GB
*/
has4SDataTIXAPI(): boolean;
2021-10-30 18:34:14 +02:00
/**
* Returns an array of the symbols of the tradable stocks
*
2021-10-30 21:46:34 +02:00
* @remarks RAM cost: 2 GB
2021-10-30 18:34:14 +02:00
* @returns Array of the symbols of the tradable stocks.
*/
2021-11-03 05:27:21 +01:00
getSymbols(): string[];
2021-10-30 18:34:14 +02:00
/**
2021-10-30 22:03:34 +02:00
* Returns the price of a stock
2021-10-30 18:34:14 +02:00
*
2021-10-30 22:03:34 +02:00
* @remarks
* RAM cost: 2 GB
* The stocks price is the average of its bid and ask price.
2021-10-30 18:34:14 +02:00
*
* @example
2021-10-30 21:46:34 +02:00
* ```ts
2022-01-08 19:25:06 +01:00
* // NS1
* stock.getPrice("FISG");
* ```
* @example
* ```ts
* // NS2
* ns.stock.getPrice("FISG");
2021-10-30 18:34:14 +02:00
* ```
* @param sym - Stock symbol.
* @returns The price of a stock.
*/
2021-11-03 05:27:21 +01:00
getPrice(sym: string): number;
2021-10-30 18:34:14 +02:00
/**
2021-10-30 22:03:34 +02:00
* Returns the ask price of that stock.
2021-10-30 21:46:34 +02:00
* @remarks RAM cost: 2 GB
2021-10-30 22:03:34 +02:00
*
2021-10-30 18:34:14 +02:00
* @param sym - Stock symbol.
* @returns The ask price of a stock.
*/
2021-11-03 05:27:21 +01:00
getAskPrice(sym: string): number;
2021-10-30 18:34:14 +02:00
/**
2021-10-30 22:03:34 +02:00
* Returns the bid price of that stock.
2021-10-30 21:46:34 +02:00
* @remarks RAM cost: 2 GB
2021-10-30 22:03:34 +02:00
*
2021-10-30 18:34:14 +02:00
* @param sym - Stock symbol.
* @returns The bid price of a stock.
*/
2021-11-03 05:27:21 +01:00
getBidPrice(sym: string): number;
2021-10-30 18:34:14 +02:00
/**
2021-10-30 22:03:34 +02:00
* Returns the players position in a stock.
* @remarks
* RAM cost: 2 GB
2021-10-30 18:34:14 +02:00
* Returns an array of four elements that represents the players position in a stock.
*
* The first element is the returned array is the number of shares the player owns of
* the stock in the Long position. The second element in the array is the average price
* of the players shares in the Long position.
*
* The third element in the array is the number of shares the player owns of the stock
* in the Short position. The fourth element in the array is the average price of the
* players Short position.
*
* All elements in the returned array are numeric.
*
* @example
2021-10-30 21:46:34 +02:00
* ```ts
2022-01-08 19:25:06 +01:00
* // NS1
* var pos = stock.getPosition("ECP");
* var shares = pos[0];
* var avgPx = pos[1];
* var sharesShort = pos[2];
* var avgPxShort = pos[3];
* ```
* @example
* ```ts
* // NS2
* const [shares, avgPx, sharesShort, avgPxShort] = ns.stock.getPosition("ECP");
2021-10-30 18:34:14 +02:00
* ```
* @param sym - Stock symbol.
* @returns Array of four elements that represents the players position in a stock.
*/
2021-11-03 05:27:21 +01:00
getPosition(sym: string): [number, number, number, number];
2021-10-30 18:34:14 +02:00
/**
2021-10-30 22:03:34 +02:00
* Returns the maximum number of shares of a stock.
* @remarks
* RAM cost: 2 GB
2021-10-30 18:34:14 +02:00
* This is the maximum amount of the stock that can be purchased
* in both the Long and Short positions combined.
*
* @param sym - Stock symbol.
* @returns Maximum number of shares that the stock has.
*/
2021-11-03 05:27:21 +01:00
getMaxShares(sym: string): number;
2021-10-30 18:34:14 +02:00
/**
2021-10-30 22:03:34 +02:00
* Calculates cost of buying stocks.
* @remarks
* RAM cost: 2 GB
2021-10-30 18:34:14 +02:00
* Calculates and returns how much it would cost to buy a given number of shares of a stock.
* This takes into account spread, large transactions influencing the price of the stock and commission fees.
*
* @param sym - Stock symbol.
* @param shares - Number of shares to purchase.
* @param posType - Specifies whether the order is a Long or Short position.
* @returns Cost to buy a given number of shares of a stock.
*/
2021-11-03 05:27:21 +01:00
getPurchaseCost(sym: string, shares: number, posType: string): number;
2021-10-30 18:34:14 +02:00
/**
2022-01-08 19:25:06 +01:00
* Calculate profit of selling stocks.
2021-10-30 22:03:34 +02:00
* @remarks
* RAM cost: 2 GB
2021-10-30 18:34:14 +02:00
* Calculates and returns how much you would gain from selling a given number of shares of a stock.
* This takes into account spread, large transactions influencing the price of the stock and commission fees.
*
* @param sym - Stock symbol.
* @param shares - Number of shares to sell.
* @param posType - Specifies whether the order is a Long or Short position.
* @returns Gain from selling a given number of shares of a stock.
*/
2021-11-03 05:27:21 +01:00
getSaleGain(sym: string, shares: number, posType: string): number;
2021-10-30 18:34:14 +02:00
/**
2021-10-30 22:03:34 +02:00
* Buy stocks.
* @remarks
* RAM cost: 2.5 GB
2021-10-30 18:34:14 +02:00
* Attempts to purchase shares of a stock using a Market Order.
*
* If the player does not have enough money to purchase the specified number of shares,
* then no shares will be purchased. Remember that every transaction on the stock exchange
* costs a certain commission fee.
*
* If this function successfully purchases the shares, it will return the stock price at which
* each share was purchased. Otherwise, it will return 0.
*
* @param sym - Stock symbol.
* @param shares - Number of shares to purchased. Must be positive. Will be rounded to nearest integer.
* @returns The stock price at which each share was purchased, otherwise 0 if the shares weren't purchased.
*/
2022-08-17 14:50:05 +02:00
buyStock(sym: string, shares: number): number;
2021-10-30 18:34:14 +02:00
/**
2021-10-30 22:03:34 +02:00
* Sell stocks.
* @remarks
* RAM cost: 2.5 GB
2021-10-30 18:34:14 +02:00
* Attempts to sell shares of a stock using a Market Order.
*
* If the specified number of shares in the function exceeds the amount that the player
* actually owns, then this function will sell all owned shares. Remember that every
* transaction on the stock exchange costs a certain commission fee.
*
* The net profit made from selling stocks with this function is reflected in the scripts
* statistics. This net profit is calculated as:
*
* shares * (sell_price - average_price_of_purchased_shares)
*
* If the sale is successful, this function will return the stock price at
* which each share was sold. Otherwise, it will return 0.
*
* @param sym - Stock symbol.
* @param shares - Number of shares to sell. Must be positive. Will be rounded to nearest integer.
* @returns The stock price at which each share was sold, otherwise 0 if the shares weren't sold.
*/
2022-08-17 14:50:05 +02:00
sellStock(sym: string, shares: number): number;
2021-10-30 18:34:14 +02:00
/**
2021-10-30 22:03:34 +02:00
* Short stocks.
* @remarks
* RAM cost: 2.5 GB
2021-10-30 18:34:14 +02:00
* Attempts to purchase a short position of a stock using a Market Order.
*
* The ability to short a stock is **not** immediately available to the player and
* must be unlocked later on in the game.
*
* If the player does not have enough money to purchase the specified number of shares,
* then no shares will be purchased. Remember that every transaction on the stock exchange
* costs a certain commission fee.
*
* If the purchase is successful, this function will return the stock price at which each
* share was purchased. Otherwise, it will return 0.
*
* @param sym - Stock symbol.
* @param shares - Number of shares to short. Must be positive. Will be rounded to nearest integer.
* @returns The stock price at which each share was purchased, otherwise 0 if the shares weren't purchased.
*/
2022-08-17 14:50:05 +02:00
buyShort(sym: string, shares: number): number;
2021-10-30 18:34:14 +02:00
/**
2021-10-30 22:03:34 +02:00
* Sell short stock.
* @remarks
* RAM cost: 2.5 GB
2021-10-30 18:34:14 +02:00
* Attempts to sell a short position of a stock using a Market Order.
*
* The ability to short a stock is **not** immediately available to the player and
* must be unlocked later on in the game.
*
* If the specified number of shares exceeds the amount that the player actually owns,
* then this function will sell all owned shares. Remember that every transaction on
* the stock exchange costs a certain commission fee.
*
* If the sale is successful, this function will return the stock price at which each
* share was sold. Otherwise it will return 0.
*
* @param sym - Stock symbol.
* @param shares - Number of shares to sell. Must be positive. Will be rounded to nearest integer.
* @returns The stock price at which each share was sold, otherwise 0 if the shares weren't sold.
*/
2021-11-03 05:27:21 +01:00
sellShort(sym: string, shares: number): number;
2021-10-30 18:34:14 +02:00
/**
2021-10-30 22:03:34 +02:00
* Place order for stocks.
* @remarks
* RAM cost: 2.5 GB
2021-10-30 18:34:14 +02:00
* Places an order on the stock market. This function only works for Limit and Stop Orders.
*
* The ability to place limit and stop orders is **not** immediately available to the player and
* must be unlocked later on in the game.
*
* Returns true if the order is successfully placed, and false otherwise.
*
* @param sym - Stock symbol.
* @param shares - Number of shares for order. Must be positive. Will be rounded to nearest integer.
* @param price - Execution price for the order.
* @param type - Type of order.
* @param pos - Specifies whether the order is a Long or Short position.
* @returns True if the order is successfully placed, and false otherwise.
*/
2021-11-03 05:27:21 +01:00
placeOrder(sym: string, shares: number, price: number, type: string, pos: string): boolean;
2021-10-30 18:34:14 +02:00
/**
2021-10-30 22:03:34 +02:00
* Cancel order for stocks.
* @remarks
* RAM cost: 2.5 GB
2021-10-30 18:34:14 +02:00
* Cancels an oustanding Limit or Stop order on the stock market.
*
* The ability to use limit and stop orders is **not** immediately available to the player and
* must be unlocked later on in the game.
*
* @param sym - Stock symbol.
* @param shares - Number of shares for order. Must be positive. Will be rounded to nearest integer.
* @param price - Execution price for the order.
* @param type - Type of order.
* @param pos - Specifies whether the order is a Long or Short position.
*/
2021-11-03 05:27:21 +01:00
cancelOrder(sym: string, shares: number, price: number, type: string, pos: string): void;
2021-10-30 18:34:14 +02:00
/**
* Returns your order book for the stock market.
2021-10-30 22:03:34 +02:00
* @remarks
* RAM cost: 2.5 GB
2021-10-30 18:34:14 +02:00
* This is an object containing information for all the Limit and Stop Orders you have in the stock market.
2022-01-16 00:39:37 +01:00
* For each symbol you have a position in, the returned object will have a key with that symbol's name.
* The object's properties are each an array of {@link StockOrderObject}
2021-10-30 18:34:14 +02:00
* The object has the following structure:
*
2021-10-30 21:46:34 +02:00
* ```ts
2021-10-30 18:34:14 +02:00
* {
2021-11-03 05:27:21 +01:00
* string1: [ // Array of orders for this stock
2021-10-30 18:34:14 +02:00
* {
* shares: Order quantity
* price: Order price
* type: Order type
* position: Either "L" or "S" for Long or Short position
* },
* {
* ...
* },
* ...
* ],
2021-11-03 05:27:21 +01:00
* string2: [ // Array of orders for this stock
2021-10-30 18:34:14 +02:00
* ...
* ],
* ...
* }
* ```
2021-10-30 22:03:34 +02:00
* The Order type property can have one of the following four values: "Limit Buy Order", "Limit Sell Order", "Stop Buy Order", "Stop Sell Order".
2021-10-30 18:34:14 +02:00
* Note that the order book will only contain information for stocks that you actually have orders in.
*
* @example
2021-10-30 21:46:34 +02:00
* ```ts
2021-10-30 18:34:14 +02:00
* "If you do not have orders in Nova Medical (NVMD), then the returned object will not have a “NVMD” property."
* {
* ECP: [
* {
* shares: 5,
* price: 100,000
* type: "Stop Buy Order",
* position: "S",
* },
* {
* shares: 25,
* price: 125,000
* type: "Limit Sell Order",
* position: "L",
* },
* ],
* SYSC: [
* {
* shares: 100,
* price: 10,000
* type: "Limit Buy Order",
* position: "L",
* },
* ],
* }
* ```
* @returns Object containing information for all the Limit and Stop Orders you have in the stock market.
*/
getOrders(): StockOrder;
/**
* Returns the volatility of the specified stock.
2021-10-30 22:03:34 +02:00
* @remarks
* RAM cost: 2.5 GB
2021-10-30 18:34:14 +02:00
* Volatility represents the maximum percentage by which a stocks price can change every tick.
* The volatility is returned as a decimal value, NOT a percentage
* (e.g. if a stock has a volatility of 3%, then this function will return 0.03, NOT 3).
*
* In order to use this function, you must first purchase access to the Four Sigma (4S) Market Data TIX API.
*
* @param sym - Stock symbol.
* @returns Volatility of the specified stock.
*/
2021-11-03 05:27:21 +01:00
getVolatility(sym: string): number;
2021-10-30 18:34:14 +02:00
/**
* Returns the probability that the specified stocks price will increase (as opposed to decrease) during the next tick.
2021-10-30 22:03:34 +02:00
* @remarks
* RAM cost: 2.5 GB
2021-10-30 18:34:14 +02:00
* The probability is returned as a decimal value, NOT a percentage
* (e.g. if a stock has a 60% chance of increasing, then this function will return 0.6, NOT 60).
*
* In other words, if this function returned 0.30 for a stock, then this means that the stocks price has a
* 30% chance of increasing and a 70% chance of decreasing during the next tick.
*
* In order to use this function, you must first purchase access to the Four Sigma (4S) Market Data TIX API.
*
* @param sym - Stock symbol.
* @returns Probability that the specified stocks price will increase (as opposed to decrease) during the next tick.
*/
2021-11-03 05:27:21 +01:00
getForecast(sym: string): number;
2021-10-30 18:34:14 +02:00
/**
* Purchase 4S Market Data Access.
2021-10-30 21:46:34 +02:00
* @remarks RAM cost: 2.5 GB
2021-10-30 18:34:14 +02:00
* @returns True if you successfully purchased it or if you already have access, false otherwise.
*/
purchase4SMarketData(): boolean;
/**
* Purchase 4S Market Data TIX API Access.
2021-10-30 21:46:34 +02:00
* @remarks RAM cost: 2.5 GB
2021-10-30 18:34:14 +02:00
* @returns True if you successfully purchased it or if you already have access, false otherwise.
*/
purchase4SMarketDataTixApi(): boolean;
2022-03-29 21:49:31 +02:00
/**
* Purchase WSE Account.
* @remarks RAM cost: 2.5 GB
* @returns True if you successfully purchased it or if you already have access, false otherwise.
*/
purchaseWseAccount(): boolean;
/**
* Purchase TIX API Access
* @remarks RAM cost: 2.5 GB
* @returns True if you successfully purchased it or if you already have access, false otherwise.
*/
purchaseTixApi(): boolean;
2021-10-30 18:34:14 +02:00
}
2022-04-13 07:35:35 +02:00
/** @public */
export declare enum ToastVariant {
SUCCESS = "success",
WARNING = "warning",
ERROR = "error",
INFO = "info",
}
2022-04-13 08:04:51 +02:00
/** @public */
export declare type ToastVariantValues = `${ToastVariant}`;
2022-01-08 19:25:06 +01:00
/**
* User Interface API.
* @public
*/
export declare interface UserInterface {
/**
2022-09-23 21:03:38 +02:00
* Get the current window size
* @remarks
* RAM cost: 0 GB
*
* @returns An array of 2 value containing the window width and height.
*/
windowSize(): [number, number];
/**
2022-01-08 19:25:06 +01:00
* Get the current theme
* @remarks
2022-01-18 20:02:12 +01:00
* RAM cost: 0 GB
2022-01-08 19:25:06 +01:00
*
* @returns An object containing the theme's colors
*/
getTheme(): UserInterfaceTheme;
/**
* Sets the current theme
* @remarks
2022-01-18 20:02:12 +01:00
* RAM cost: 0 GB
2022-01-08 19:25:06 +01:00
* @example
* Usage example (NS2)
* ```ts
* const theme = ns.ui.getTheme();
* theme.primary = '#ff5500';
* ns.ui.setTheme(theme);
* ```
*/
setTheme(newTheme: UserInterfaceTheme): void;
/**
* Resets the player's theme to the default values
* @remarks
2022-01-18 20:02:12 +01:00
* RAM cost: 0 GB
2022-01-08 19:25:06 +01:00
*/
resetTheme(): void;
2022-01-16 00:39:37 +01:00
/**
* Get the current styles
* @remarks
2022-01-18 20:02:12 +01:00
* RAM cost: 0 GB
2022-01-16 00:39:37 +01:00
*
* @returns An object containing the player's styles
*/
getStyles(): IStyleSettings;
/**
* Sets the current styles
* @remarks
2022-01-18 20:02:12 +01:00
* RAM cost: 0 GB
2022-01-16 00:39:37 +01:00
* @example
* Usage example (NS2)
* ```ts
* const styles = ns.ui.getStyles();
* styles.fontFamily = 'Comic Sans Ms';
* ns.ui.setStyles(styles);
* ```
*/
setStyles(newStyles: IStyleSettings): void;
/**
* Resets the player's styles to the default values
* @remarks
2022-01-18 20:02:12 +01:00
* RAM cost: 0 GB
2022-01-16 00:39:37 +01:00
*/
resetStyles(): void;
2022-01-18 20:02:12 +01:00
/**
* Gets the current game information (version, commit, ...)
* @remarks
* RAM cost: 0 GB
*/
getGameInfo(): GameInfo;
2022-05-24 14:12:49 +02:00
/**
* Clear the Terminal window, as if the player ran `clear` in the terminal
* @remarks
* RAM cost: 0.2 GB
*/
clearTerminal(): void;
2022-01-08 19:25:06 +01:00
}
/**
* Interface Theme
* @internal
*/
export declare interface UserInterfaceTheme {
[key: string]: string | undefined;
primarylight: string;
primary: string;
primarydark: string;
successlight: string;
success: string;
successdark: string;
errorlight: string;
error: string;
errordark: string;
secondarylight: string;
secondary: string;
secondarydark: string;
warninglight: string;
warning: string;
warningdark: string;
infolight: string;
info: string;
infodark: string;
welllight: string;
well: string;
white: string;
black: string;
hp: string;
money: string;
hack: string;
combat: string;
cha: string;
int: string;
rep: string;
disabled: string;
backgroundprimary: string;
backgroundsecondary: string;
button: string;
}
2021-12-09 00:19:30 +01:00
/**
2021-12-09 02:03:22 +01:00
* Warehouse for a division in a city
2021-12-09 00:19:30 +01:00
* @public
*/
2021-12-04 05:08:11 +01:00
export declare interface Warehouse {
2021-12-09 02:03:22 +01:00
/** Amount of size upgrade bought */
2021-12-04 05:08:11 +01:00
level: number;
2021-12-09 02:03:22 +01:00
/** City in which the warehouse is located */
2021-12-04 05:08:11 +01:00
loc: string;
2021-12-09 02:03:22 +01:00
/** Total space in the warehouse */
2021-12-04 05:08:11 +01:00
size: number;
2021-12-09 02:03:22 +01:00
/** Used space in the warehouse */
2021-12-04 05:08:11 +01:00
sizeUsed: number;
2022-01-16 17:13:45 +01:00
/** Smart Supply status in the warehouse */
smartSupplyEnabled: boolean;
2021-12-04 05:08:11 +01:00
}
2021-12-09 00:19:30 +01:00
/**
2021-12-09 02:03:22 +01:00
* Corporation Warehouse API
* @remarks
* Requires the Warehouse API upgrade from your corporation.
2021-12-09 00:19:30 +01:00
* @public
*/
2021-12-04 05:08:11 +01:00
export declare interface WarehouseAPI {
2021-12-09 02:03:22 +01:00
/**
* Set material sell data.
* @param divisionName - Name of the division
* @param cityName - Name of the city
* @param materialName - Name of the material
* @param amt - Amount to sell, can be "MAX"
* @param price - Price to sell, can be "MP"
*/
sellMaterial(divisionName: string, cityName: string, materialName: string, amt: string, price: string): void;
/**
* Set product sell data.
* @param divisionName - Name of the division
* @param cityName - Name of the city
* @param productName - Name of the product
* @param amt - Amount to sell, can be "MAX"
* @param price - Price to sell, can be "MP"
* @param all - Sell in all city
*/
2021-12-04 05:08:11 +01:00
sellProduct(
2022-01-16 00:39:37 +01:00
divisionName: string,
cityName: string,
productName: string,
amt: string,
price: string,
all: boolean,
2021-12-04 05:08:11 +01:00
): void;
2021-12-09 02:03:22 +01:00
/**
* Discontinue a product.
* @param divisionName - Name of the division
* @param productName - Name of the product
*/
2021-12-04 05:08:11 +01:00
discontinueProduct(divisionName: string, productName: string): void;
2021-12-09 02:03:22 +01:00
/**
* Set smart supply
* @param divisionName - Name of the division
* @param cityName - Name of the city
* @param enabled - smart supply enabled
*/
2021-12-04 05:08:11 +01:00
setSmartSupply(divisionName: string, cityName: string, enabled: boolean): void;
2022-03-17 21:50:46 +01:00
/**
* Set whether smart supply uses leftovers before buying
* @param divisionName - Name of the division
* @param cityName - Name of the city
* @param materialName - Name of the material
* @param enabled - smart supply use leftovers enabled
*/
setSmartSupplyUseLeftovers(divisionName: string, cityName: string, materialName: string, enabled: boolean): void;
2021-12-09 02:03:22 +01:00
/**
* Set material buy data
* @param divisionName - Name of the division
* @param cityName - Name of the city
* @param materialName - Name of the material
* @param amt - Amount of material to buy
*/
2021-12-04 05:08:11 +01:00
buyMaterial(divisionName: string, cityName: string, materialName: string, amt: number): void;
2022-01-17 11:24:42 +01:00
/**
* Set material to bulk buy
* @param divisionName - Name of the division
* @param cityName - Name of the city
* @param materialName - Name of the material
* @param amt - Amount of material to buy
*/
bulkPurchase(divisionName: string, cityName: string, materialName: string, amt: number): void;
2021-12-09 02:03:22 +01:00
/**
* Get warehouse data
* @param divisionName - Name of the division
* @param cityName - Name of the city
* @returns warehouse data
*/
2021-12-04 05:08:11 +01:00
getWarehouse(divisionName: string, cityName: string): Warehouse;
2021-12-09 02:03:22 +01:00
/**
* Get product data
* @param divisionName - Name of the division
* @param productName - Name of the product
* @returns product data
*/
2021-12-04 05:08:11 +01:00
getProduct(divisionName: string, productName: string): Product;
2021-12-09 02:03:22 +01:00
/**
* Get material data
* @param divisionName - Name of the division
* @param materialName - Name of the material
* @returns material data
*/
2021-12-04 05:08:11 +01:00
getMaterial(divisionName: string, cityName: string, materialName: string): Material;
2021-12-09 02:03:22 +01:00
/**
* Set market TA 1 for a material.
* @param divisionName - Name of the division
* @param cityName - Name of the city
* @param materialName - Name of the material
* @param on - market ta enabled
*/
2021-12-04 05:08:11 +01:00
setMaterialMarketTA1(divisionName: string, cityName: string, materialName: string, on: boolean): void;
2021-12-09 02:03:22 +01:00
/**
* Set market TA 2 for a material.
* @param divisionName - Name of the division
* @param cityName - Name of the city
* @param materialName - Name of the material
* @param on - market ta enabled
*/
2021-12-04 05:08:11 +01:00
setMaterialMarketTA2(divisionName: string, cityName: string, materialName: string, on: boolean): void;
2021-12-09 02:03:22 +01:00
/**
* Set market TA 1 for a product.
* @param divisionName - Name of the division
* @param productName - Name of the product
* @param on - market ta enabled
*/
2021-12-04 05:08:11 +01:00
setProductMarketTA1(divisionName: string, productName: string, on: boolean): void;
2021-12-09 02:03:22 +01:00
/**
* Set market TA 2 for a product.
* @param divisionName - Name of the division
* @param productName - Name of the product
* @param on - market ta enabled
*/
2021-12-04 05:08:11 +01:00
setProductMarketTA2(divisionName: string, productName: string, on: boolean): void;
2021-12-09 02:03:22 +01:00
/**
* Set material export data
* @param sourceDivision - Source division
* @param sourceCity - Source city
* @param targetDivision - Target division
* @param targetCity - Target city
* @param materialName - Name of the material
* @param amt - Amount of material to export.
*/
2021-12-04 05:08:11 +01:00
exportMaterial(
2022-01-16 00:39:37 +01:00
sourceDivision: string,
sourceCity: string,
targetDivision: string,
targetCity: string,
materialName: string,
amt: number,
2021-12-04 05:08:11 +01:00
): void;
2021-12-09 02:03:22 +01:00
/**
* Cancel material export
* @param sourceDivision - Source division
* @param sourceCity - Source city
* @param targetDivision - Target division
* @param targetCity - Target city
* @param materialName - Name of the material
* @param amt - Amount of material to export.
*/
2021-12-04 05:08:11 +01:00
cancelExportMaterial(
2022-01-16 00:39:37 +01:00
sourceDivision: string,
sourceCity: string,
targetDivision: string,
targetCity: string,
materialName: string,
amt: number,
2021-12-04 05:08:11 +01:00
): void;
2021-12-09 02:03:22 +01:00
/**
* Purchase warehouse for a new city
* @param divisionName - Name of the division
* @param cityName - Name of the city
*/
2021-12-04 05:08:11 +01:00
purchaseWarehouse(divisionName: string, cityName: string): void;
2021-12-09 02:03:22 +01:00
/**
* Upgrade warehouse
* @param divisionName - Name of the division
* @param cityName - Name of the city
2022-05-24 14:12:49 +02:00
* @param amt - amount of upgrades defaults to 1
2021-12-09 02:03:22 +01:00
*/
2022-05-24 14:12:49 +02:00
upgradeWarehouse(divisionName: string, cityName: string, amt?: number): void;
2021-12-09 02:03:22 +01:00
/**
* Create a new product
* @param divisionName - Name of the division
* @param cityName - Name of the city
* @param productName - Name of the product
* @param designInvest - Amount to invest for the design of the product.
* @param marketingInvest - Amount to invest for the marketing of the product.
*/
2021-12-04 05:08:11 +01:00
makeProduct(
2022-01-16 00:39:37 +01:00
divisionName: string,
cityName: string,
productName: string,
designInvest: number,
marketingInvest: number,
2021-12-04 05:08:11 +01:00
): void;
2022-05-24 14:12:49 +02:00
/**
* Limit Material Production.
* @param divisionName - Name of the division
* @param cityName - Name of the city
* @param materialName - Name of the material
* @param qty - Amount to limit to
*/
limitMaterialProduction(divisionName: string, cityName: string, materialName: string, qty: number): void;
/**
* Limit Product Production.
* @param divisionName - Name of the division
* @param cityName - Name of the city
* @param productName - Name of the product
* @param qty - Amount to limit to
*/
limitProductProduction(divisionName: string, cityName: string, productName: string, qty: number): void;
2022-01-16 17:13:45 +01:00
/**
* Gets the cost to purchase a warehouse
* @returns cost
*/
getPurchaseWarehouseCost(): number;
/**
* Gets the cost to upgrade a warehouse to the next level
2022-05-24 14:12:49 +02:00
* @param divisionName - Name of the division
* @param cityName - Name of the city
* @param amt - amount of upgrades defaults to 1
2022-01-16 17:13:45 +01:00
* @returns cost to upgrade
*/
2022-08-17 14:50:05 +02:00
getUpgradeWarehouseCost(adivisionName: string, acityName: string, amt?: number): number;
2022-01-16 17:13:45 +01:00
/**
* Check if you have a warehouse in city
* @returns true if warehouse is present, false if not
*/
2022-08-17 14:50:05 +02:00
hasWarehouse(adivisionName: string, acityName: string): boolean;
2021-12-04 05:08:11 +01:00
}
/**
* Work formulas
* @public
*/
export declare interface WorkFormulas {
crimeGains(crimeType: string): WorkStats;
classGains(player: Player, classType: string, locationName: string): WorkStats;
factionGains(player: Player, workType: string, favor: number): WorkStats;
}
/**
* @public
*/
export declare interface WorkStats {
money: number;
reputation: number;
hackExp: number;
strExp: number;
defExp: number;
dexExp: number;
agiExp: number;
chaExp: number;
intExp: number;
2021-12-04 05:08:11 +01:00
}
2021-10-30 18:34:14 +02:00
export { }