Merge branch 'dev' into bugfix/corp-updates

This commit is contained in:
Jack
2022-04-13 16:35:18 +08:00
committed by GitHub
171 changed files with 5830 additions and 3619 deletions

View File

@@ -101,24 +101,46 @@ interface Player {
/**
* @public
*/
interface RunningScript {
export interface RunningScript {
/** Arguments the script was called with */
args: string[];
/** Filename of the script */
filename: string;
/**
* 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[];
/** Total amount of hacking experience earned from this script when offline */
offlineExpGained: number;
/** Total amount of money made by this script when offline */
offlineMoneyMade: number;
/** Offline running time of the script, in seconds **/
/** Number of seconds that the script has been running offline */
offlineRunningTime: number;
/** Total amount of hacking experience earned from this script when online */
onlineExpGained: number;
/** Total amount of money made by this script when online */
onlineMoneyMade: number;
/** Online running time of the script, in seconds **/
/** Number of seconds that this script has been running online */
onlineRunningTime: number;
/** Process ID. Must be an integer */
pid: number;
/** How much RAM this script uses for ONE thread */
ramUsage: number;
/** Hostname of the server on which this script runs */
server: string;
/** Number of threads that this script runs with */
threads: number;
}
/**
* @public
*/
export interface RecentScript extends RunningScript {
/** Timestamp of when the script was killed */
timeOfDeath: Date;
}
/**
* Data representing the internal values of a crime.
* @public
@@ -2618,7 +2640,7 @@ export interface Hacknet {
* // NS1:
* var upgradeName = "Sell for Corporation Funds";
* if (hacknet.numHashes() > hacknet.hashCost(upgradeName)) {
* hacknet.spendHashes(upgName);
* hacknet.spendHashes(upgradeName);
* }
* ```
* @example
@@ -2626,7 +2648,7 @@ export interface Hacknet {
* // NS2:
* const upgradeName = "Sell for Corporation Funds";
* if (ns.hacknet.numHashes() > ns.hacknet.hashCost(upgradeName)) {
* ns.hacknet.spendHashes(upgName);
* ns.hacknet.spendHashes(upgradeName);
* }
* ```
* @param upgName - Name of the upgrade of Hacknet Node.
@@ -4298,7 +4320,7 @@ interface UserInterface {
* {@link https://bitburner.readthedocs.io/en/latest/netscript/netscriptjs.html| ns2 in-game docs}
* <hr>
*/
export interface NS extends Singularity {
export interface NS {
/**
* Namespace for hacknet functions.
* @remarks RAM cost: 4 GB
@@ -4555,9 +4577,10 @@ export interface NS extends Singularity {
* Returns the security increase that would occur if a hack with this many threads happened.
*
* @param threads - Amount of threads that will be used.
* @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.
* @returns The security increase.
*/
hackAnalyzeSecurity(threads: number): number;
hackAnalyzeSecurity(threads: number, hostname?: string): number;
/**
* Get the chance of successfully hacking a server.
@@ -4781,6 +4804,27 @@ export interface NS extends Singularity {
*/
getScriptLogs(fn?: string, host?: string, ...args: any[]): string[];
/**
* 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[];
/**
* Open the tail window of a script.
* @remarks
@@ -6183,7 +6227,7 @@ export interface NS extends Singularity {
* @param variant - Type of toast, must be one of success, info, warning, error. Defaults to success.
* @param duration - Duration of toast in ms. Can also be `null` to create a persistent toast. Defaults to 2000
*/
toast(msg: any, variant?: string, duration?: number | null): void;
toast(msg: any, variant?: ToastVariantValues, duration?: number | null): void;
/**
* Download a file from the internet.
@@ -6378,6 +6422,24 @@ export interface NS extends Singularity {
* RAM cost: 0.2 GB
*/
getSharePower(): number;
enums: NSEnums;
}
/** @public */
export enum ToastVariant {
SUCCESS = "success",
WARNING = "warning",
ERROR = "error",
INFO = "info",
}
/** @public */
export type ToastVariantValues = `${ToastVariant}`;
/** @public */
export interface NSEnums {
toast: typeof ToastVariant;
}
/**
@@ -6914,10 +6976,14 @@ interface Employee {
interface Product {
/** Name of the product */
name: string;
/** Demand for the product */
dmd: number;
/** Competition for the product */
cmp: number;
/** 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 };
/** Production cost */
pCost: number;
/** Sell cost, can be "MP+5" */
@@ -6941,7 +7007,11 @@ interface Material {
qty: number;
/** Quality of the material */
qlt: number;
/** Amount of material produced */
/** 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;
/** Amount of material produced */
prod: number;
/** Amount of material sold */
sell: number;
@@ -6987,8 +7057,10 @@ interface Office {
maxMor: number;
/** Name of all the employees */
employees: string[];
/** Positions of the employees */
/** Production of the employees */
employeeProd: EmployeeJobs;
/** Positions of the employees */
employeeJobs: EmployeeJobs;
}
/**