From 6024c81113486cdaa8c01dabe76a61300d7f1fc6 Mon Sep 17 00:00:00 2001 From: Snarling <84951833+Snarling@users.noreply.github.com> Date: Tue, 25 Apr 2023 05:22:36 -0400 Subject: [PATCH] NETSCRIPT: add ns.getResetInfo(#490) * Move lastAugReset and lastNodeReset back to main API under getResetInfo, also included currentNode. * The associated properties are deprecated on getPlayer() --- markdown/bitburner.md | 1 + markdown/bitburner.ns.getresetinfo.md | 31 ++++++ markdown/bitburner.ns.md | 3 +- markdown/bitburner.ns.mv.md | 2 - markdown/bitburner.ns.nformat.md | 4 +- markdown/bitburner.player.bitnoden.md | 11 --- markdown/bitburner.player.md | 1 - markdown/bitburner.resetinfo.currentnode.md | 13 +++ markdown/bitburner.resetinfo.lastaugreset.md | 13 +++ markdown/bitburner.resetinfo.lastnodereset.md | 13 +++ markdown/bitburner.resetinfo.md | 22 +++++ .../bitburner.singularity.getlastaugreset.md | 23 ----- .../bitburner.singularity.getlastnodereset.md | 23 ----- markdown/bitburner.singularity.md | 2 - src/Netscript/RamCostGenerator.ts | 3 +- src/NetscriptFunctions.ts | 98 +++++++++++-------- src/NetscriptFunctions/Formulas.ts | 5 +- src/NetscriptFunctions/Singularity.ts | 8 -- src/ScriptEditor/NetscriptDefinitions.d.ts | 50 +++++----- 19 files changed, 183 insertions(+), 143 deletions(-) create mode 100644 markdown/bitburner.ns.getresetinfo.md delete mode 100644 markdown/bitburner.player.bitnoden.md create mode 100644 markdown/bitburner.resetinfo.currentnode.md create mode 100644 markdown/bitburner.resetinfo.lastaugreset.md create mode 100644 markdown/bitburner.resetinfo.lastnodereset.md create mode 100644 markdown/bitburner.resetinfo.md delete mode 100644 markdown/bitburner.singularity.getlastaugreset.md delete mode 100644 markdown/bitburner.singularity.getlastnodereset.md diff --git a/markdown/bitburner.md b/markdown/bitburner.md index 07415a3ba..9be6a5a0c 100644 --- a/markdown/bitburner.md +++ b/markdown/bitburner.md @@ -86,6 +86,7 @@ | [Product](./bitburner.product.md) | Product in a warehouse | | [RecentScript](./bitburner.recentscript.md) | | | [ReputationFormulas](./bitburner.reputationformulas.md) | Reputation formulas | +| [ResetInfo](./bitburner.resetinfo.md) | Various info about resets | | [RunningScript](./bitburner.runningscript.md) | | | [RunOptions](./bitburner.runoptions.md) | | | [Server](./bitburner.server.md) | A server. Not all servers have all of these properties - optional properties are missing on certain servers. | diff --git a/markdown/bitburner.ns.getresetinfo.md b/markdown/bitburner.ns.getresetinfo.md new file mode 100644 index 000000000..c1a4d1dd4 --- /dev/null +++ b/markdown/bitburner.ns.getresetinfo.md @@ -0,0 +1,31 @@ + + +[Home](./index.md) > [bitburner](./bitburner.md) > [NS](./bitburner.ns.md) > [getResetInfo](./bitburner.ns.getresetinfo.md) + +## NS.getResetInfo() method + +Get information about resets. + +**Signature:** + +```typescript +getResetInfo(): ResetInfo; +``` +**Returns:** + +[ResetInfo](./bitburner.resetinfo.md) + +## Remarks + +RAM cost: 1 GB + +## Example + + +```js +const resetInfo = ns.getResetInfo(); +const lastAugReset = resetInfo.lastAugReset; +ns.tprint(`The last augmentation reset was: ${new Date(lastAugReset)}`); +ns.tprint(`It has been ${Date.now() - lastAugReset}ms since the last augmentation reset.`); +``` + diff --git a/markdown/bitburner.ns.md b/markdown/bitburner.ns.md index 9d8c79bee..7de26f7bb 100644 --- a/markdown/bitburner.ns.md +++ b/markdown/bitburner.ns.md @@ -97,6 +97,7 @@ export async function main(ns) { | [getPurchasedServers()](./bitburner.ns.getpurchasedservers.md) | Returns an array with the hostnames of all of the servers you have purchased. | | [getPurchasedServerUpgradeCost(hostname, ram)](./bitburner.ns.getpurchasedserverupgradecost.md) | Get cost of upgrading a purchased server to the given ram. | | [getRecentScripts()](./bitburner.ns.getrecentscripts.md) | Get an array of recently killed scripts across all servers. | +| [getResetInfo()](./bitburner.ns.getresetinfo.md) | Get information about resets. | | [getRunningScript(filename, hostname, args)](./bitburner.ns.getrunningscript.md) | Get general info about a running script. | | [getScriptExpGain(script, host, args)](./bitburner.ns.getscriptexpgain.md) | Get the exp gain of a script. | | [getScriptIncome(script, host, args)](./bitburner.ns.getscriptincome.md) | Get the income of a script. | @@ -138,7 +139,7 @@ export async function main(ns) { | [ls(host, substring)](./bitburner.ns.ls.md) | List files on a server. | | [moveTail(x, y, pid)](./bitburner.ns.movetail.md) | Move a tail window. | | [mv(host, source, destination)](./bitburner.ns.mv.md) | Move a file on the target server. | -| [nFormat(n, format)](./bitburner.ns.nformat.md) | Format a number using the numeral library. This function is deprecated and will be removed in 2.3. | +| [nFormat(n, format)](./bitburner.ns.nformat.md) | Format a number using the numeral library. This function is deprecated and will be removed in 2.4. | | [nuke(host)](./bitburner.ns.nuke.md) | Runs NUKE.exe on a server. | | [peek(portNumber)](./bitburner.ns.peek.md) | Get a copy of the data from a port without popping it. | | [print(args)](./bitburner.ns.print.md) | Prints one or more values or variables to the script’s logs. | diff --git a/markdown/bitburner.ns.mv.md b/markdown/bitburner.ns.mv.md index af2ee56b9..1e267fa29 100644 --- a/markdown/bitburner.ns.mv.md +++ b/markdown/bitburner.ns.mv.md @@ -28,8 +28,6 @@ void 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. diff --git a/markdown/bitburner.ns.nformat.md b/markdown/bitburner.ns.nformat.md index 46634dcbf..ff39390eb 100644 --- a/markdown/bitburner.ns.nformat.md +++ b/markdown/bitburner.ns.nformat.md @@ -6,10 +6,10 @@ > Warning: This API is now obsolete. > -> Use ns.formatNumber, formatRam, or formatPercent instead. Will be removed in 2.3. +> Use ns.formatNumber, formatRam, or formatPercent instead. Will be removed in 2.4. > -Format a number using the numeral library. This function is deprecated and will be removed in 2.3. +Format a number using the numeral library. This function is deprecated and will be removed in 2.4. **Signature:** diff --git a/markdown/bitburner.player.bitnoden.md b/markdown/bitburner.player.bitnoden.md deleted file mode 100644 index dd1e15262..000000000 --- a/markdown/bitburner.player.bitnoden.md +++ /dev/null @@ -1,11 +0,0 @@ - - -[Home](./index.md) > [bitburner](./bitburner.md) > [Player](./bitburner.player.md) > [bitNodeN](./bitburner.player.bitnoden.md) - -## Player.bitNodeN property - -**Signature:** - -```typescript -bitNodeN: number; -``` diff --git a/markdown/bitburner.player.md b/markdown/bitburner.player.md index 1334ad1ae..f0b28f00a 100644 --- a/markdown/bitburner.player.md +++ b/markdown/bitburner.player.md @@ -16,7 +16,6 @@ interface Player extends Person | Property | Modifiers | Type | Description | | --- | --- | --- | --- | -| [bitNodeN](./bitburner.player.bitnoden.md) | | number | | | [entropy](./bitburner.player.entropy.md) | | number | | | [factions](./bitburner.player.factions.md) | | string\[\] | | | [jobs](./bitburner.player.jobs.md) | | Record<string, string> | | diff --git a/markdown/bitburner.resetinfo.currentnode.md b/markdown/bitburner.resetinfo.currentnode.md new file mode 100644 index 000000000..67cd90017 --- /dev/null +++ b/markdown/bitburner.resetinfo.currentnode.md @@ -0,0 +1,13 @@ + + +[Home](./index.md) > [bitburner](./bitburner.md) > [ResetInfo](./bitburner.resetinfo.md) > [currentNode](./bitburner.resetinfo.currentnode.md) + +## ResetInfo.currentNode property + +The current bitnode + +**Signature:** + +```typescript +currentNode: number; +``` diff --git a/markdown/bitburner.resetinfo.lastaugreset.md b/markdown/bitburner.resetinfo.lastaugreset.md new file mode 100644 index 000000000..fb66fefa6 --- /dev/null +++ b/markdown/bitburner.resetinfo.lastaugreset.md @@ -0,0 +1,13 @@ + + +[Home](./index.md) > [bitburner](./bitburner.md) > [ResetInfo](./bitburner.resetinfo.md) > [lastAugReset](./bitburner.resetinfo.lastaugreset.md) + +## ResetInfo.lastAugReset property + +Numeric timestamp (from Date.now()) of last augmentation reset + +**Signature:** + +```typescript +lastAugReset: number; +``` diff --git a/markdown/bitburner.resetinfo.lastnodereset.md b/markdown/bitburner.resetinfo.lastnodereset.md new file mode 100644 index 000000000..b76049752 --- /dev/null +++ b/markdown/bitburner.resetinfo.lastnodereset.md @@ -0,0 +1,13 @@ + + +[Home](./index.md) > [bitburner](./bitburner.md) > [ResetInfo](./bitburner.resetinfo.md) > [lastNodeReset](./bitburner.resetinfo.lastnodereset.md) + +## ResetInfo.lastNodeReset property + +Numeric timestamp (from Date.now()) of last bitnode reset + +**Signature:** + +```typescript +lastNodeReset: number; +``` diff --git a/markdown/bitburner.resetinfo.md b/markdown/bitburner.resetinfo.md new file mode 100644 index 000000000..b9388dc41 --- /dev/null +++ b/markdown/bitburner.resetinfo.md @@ -0,0 +1,22 @@ + + +[Home](./index.md) > [bitburner](./bitburner.md) > [ResetInfo](./bitburner.resetinfo.md) + +## ResetInfo interface + +Various info about resets + +**Signature:** + +```typescript +interface ResetInfo +``` + +## Properties + +| Property | Modifiers | Type | Description | +| --- | --- | --- | --- | +| [currentNode](./bitburner.resetinfo.currentnode.md) | | number | The current bitnode | +| [lastAugReset](./bitburner.resetinfo.lastaugreset.md) | | number | Numeric timestamp (from Date.now()) of last augmentation reset | +| [lastNodeReset](./bitburner.resetinfo.lastnodereset.md) | | number | Numeric timestamp (from Date.now()) of last bitnode reset | + diff --git a/markdown/bitburner.singularity.getlastaugreset.md b/markdown/bitburner.singularity.getlastaugreset.md deleted file mode 100644 index 4d8ed1779..000000000 --- a/markdown/bitburner.singularity.getlastaugreset.md +++ /dev/null @@ -1,23 +0,0 @@ - - -[Home](./index.md) > [bitburner](./bitburner.md) > [Singularity](./bitburner.singularity.md) > [getLastAugReset](./bitburner.singularity.getlastaugreset.md) - -## Singularity.getLastAugReset() method - -Get the last timestamp from when you installed augmentations. - -**Signature:** - -```typescript -getLastAugReset(): number; -``` -**Returns:** - -number - -The timestamp in milliseconds from your last augmentation install. - -## Remarks - -RAM cost: 0.5 GB \* 16/4/1 - diff --git a/markdown/bitburner.singularity.getlastnodereset.md b/markdown/bitburner.singularity.getlastnodereset.md deleted file mode 100644 index 21d094b96..000000000 --- a/markdown/bitburner.singularity.getlastnodereset.md +++ /dev/null @@ -1,23 +0,0 @@ - - -[Home](./index.md) > [bitburner](./bitburner.md) > [Singularity](./bitburner.singularity.md) > [getLastNodeReset](./bitburner.singularity.getlastnodereset.md) - -## Singularity.getLastNodeReset() method - -Get the last timestamp from when you finished a bitnode. - -**Signature:** - -```typescript -getLastNodeReset(): number; -``` -**Returns:** - -number - -The timestamp in milliseconds from your last bitnode finish. - -## Remarks - -RAM cost: 0.5 GB \* 16/4/1 - diff --git a/markdown/bitburner.singularity.md b/markdown/bitburner.singularity.md index 322fea368..adf1e26dc 100644 --- a/markdown/bitburner.singularity.md +++ b/markdown/bitburner.singularity.md @@ -50,8 +50,6 @@ This API requires Source-File 4 to use. The RAM cost of all these functions is m | [getFactionFavor(faction)](./bitburner.singularity.getfactionfavor.md) | Get faction favor. | | [getFactionFavorGain(faction)](./bitburner.singularity.getfactionfavorgain.md) | Get faction favor gain. | | [getFactionRep(faction)](./bitburner.singularity.getfactionrep.md) | Get faction reputation. | -| [getLastAugReset()](./bitburner.singularity.getlastaugreset.md) | Get the last timestamp from when you installed augmentations. | -| [getLastNodeReset()](./bitburner.singularity.getlastnodereset.md) | Get the last timestamp from when you finished a bitnode. | | [getOwnedAugmentations(purchased)](./bitburner.singularity.getownedaugmentations.md) | Get a list of owned augmentation. | | [getOwnedSourceFiles()](./bitburner.singularity.getownedsourcefiles.md) | Get a list of acquired Source-Files. | | [getUpgradeHomeCoresCost()](./bitburner.singularity.getupgradehomecorescost.md) | Get the price of upgrading home cores. | diff --git a/src/Netscript/RamCostGenerator.ts b/src/Netscript/RamCostGenerator.ts index 2c47c5f9f..244673b35 100644 --- a/src/Netscript/RamCostGenerator.ts +++ b/src/Netscript/RamCostGenerator.ts @@ -204,8 +204,6 @@ const singularity = { b1tflum3: SF4Cost(16), destroyW0r1dD43m0n: SF4Cost(32), getCurrentWork: SF4Cost(0.5), - getLastAugReset: SF4Cost(0.5), - getLastNodeReset: SF4Cost(0.5), } as const; // Gang API @@ -535,6 +533,7 @@ export const RamCosts: RamCostTree = { getPlayer: RamCostConstants.SingularityFn1 / 4, getMoneySources: RamCostConstants.GetMoneySourcesCost, mv: 0, + getResetInfo: 1, tail: 0, toast: 0, moveTail: 0, diff --git a/src/NetscriptFunctions.ts b/src/NetscriptFunctions.ts index 0f57b624a..b98f01727 100644 --- a/src/NetscriptFunctions.ts +++ b/src/NetscriptFunctions.ts @@ -76,7 +76,7 @@ import { Flags } from "./NetscriptFunctions/Flags"; import { calculateIntelligenceBonus } from "./PersonObjects/formulas/intelligence"; import { CalculateShareMult, StartSharing } from "./NetworkShare/Share"; import { recentScripts } from "./Netscript/RecentScripts"; -import { InternalAPI, removedFunction, NSProxy, NetscriptContext } from "./Netscript/APIWrapper"; +import { InternalAPI, removedFunction, NSProxy } from "./Netscript/APIWrapper"; import { INetscriptExtra } from "./NetscriptFunctions/Extra"; import { ScriptDeath } from "./Netscript/ScriptDeath"; import { getBitNodeMultipliers } from "./BitNode/BitNode"; @@ -1012,7 +1012,6 @@ export const ns: InternalAPI = { }, getServerBaseSecurityLevel: (ctx) => (_hostname) => { const hostname = helpers.string(ctx, "hostname", _hostname); - helpers.log(ctx, () => `getServerBaseSecurityLevel is deprecated because it's not useful.`); const server = helpers.getServer(ctx, hostname); if (!(server instanceof Server)) { helpers.log(ctx, () => "Cannot be executed on this server."); @@ -1568,8 +1567,12 @@ export const ns: InternalAPI = { const multStart = helpers.number(ctx, "multStart", _multStart); return formatPercent(n, fractionalDigits, multStart); }, - // Todo: Remove function in 2.3. Until then it just directly wraps numeral. + // Todo: Remove function for real though in 2.4. Until then it just directly wraps numeral. nFormat: (ctx) => (_n, _format) => { + deprecationWarning( + "ns.nFormat", + "Use ns.formatNumber, formatRam, formatPercent, or js builtins like Intl.NumberFormat instead.", + ); const n = helpers.number(ctx, "n", _n); const format = helpers.string(ctx, "format", _format); return numeral(n).format(format); @@ -1580,6 +1583,7 @@ export const ns: InternalAPI = { return convertTimeMsToTimeElapsedString(milliseconds, milliPrecision); }, getTimeSinceLastAug: () => () => { + deprecationWarning("ns.getTimeSinceLastAug()", "Use ns.getResetInfo().lastAugReset instead."); return Player.playtimeSinceLastAug; }, alert: (ctx) => (_message) => { @@ -1670,38 +1674,40 @@ export const ns: InternalAPI = { getFavorToDonate: () => () => { return Math.floor(CONSTANTS.BaseFavorToDonate * BitNodeMultipliers.RepToDonateToFaction); }, - getPlayer: (ctx) => () => { + getPlayer: () => () => { const data = { + // Person hp: cloneDeep(Player.hp), skills: cloneDeep(Player.skills), exp: cloneDeep(Player.exp), mults: cloneDeep(Player.mults), + city: Player.city, + // Player-specific numPeopleKilled: Player.numPeopleKilled, money: Player.money, - city: Player.city, location: Player.location, - bitNodeN: Player.bitNodeN, totalPlaytime: Player.totalPlaytime, jobs: cloneDeep(Player.jobs), factions: Player.factions.slice(), entropy: Player.entropy, }; - createDeprecatedProperty( - ctx, - data, - "playtimeSinceLastAug", - Player.playtimeSinceLastAug, - "getPlayer.playtimeSinceLastAug", - "Use ns.getPlaytimeSinceLastAug or ns.singularity.getLastAugReset instead.", - ); - createDeprecatedProperty( - ctx, - data, - "playtimeSinceLastBitnode", - Player.playtimeSinceLastBitnode, - "getPlayer.playtimeSinceLastBitnode", - "Use ns.singularity.getLastNodeReset instead.", - ); + setDeprecatedProperties(data, { + playtimeSinceLastAug: { + identifier: "ns.getPlayer().playtimeSinceLastAug", + message: "Use ns.getResetInfo().lastAugReset instead. This is a static timestamp instead of an elapsed time.", + value: Player.playtimeSinceLastAug, + }, + playtimeSinceLastBitnode: { + identifier: "ns.getPlayer().playtimeSinceLastBitnode", + message: "Use ns.getResetInfo().lastNodeReset instead. This is a static timestamp instead of an elapsed time.", + value: Player.playtimeSinceLastBitnode, + }, + bitNodeN: { + identifier: "ns.getPlayer().bitNodeN", + message: "Use ns.getResetInto().currentNode instead", + value: Player.bitNodeN, + }, + }); return data; }, getMoneySources: () => () => ({ @@ -1747,6 +1753,11 @@ export const ns: InternalAPI = { } helpers.log(ctx, () => `ERROR: Failed. Was unable to remove file ${sourcePath} from its original location.`); }, + getResetInfo: () => () => ({ + lastAugReset: Player.lastAugReset, + lastNodeReset: Player.lastNodeReset, + currentNode: Player.bitNodeN, + }), flags: Flags, ...NetscriptExtra(), }; @@ -1776,27 +1787,28 @@ function getFunctionNames(obj: object, prefix: string): string[] { } const deprecatedWarningsGiven = new Set(); -function createDeprecatedProperty( - ctx: NetscriptContext, +function setDeprecatedProperties( obj: object, - propName: string, - value: any, - identifier: string, - message: string, + properties: Record, ) { - Object.defineProperty(obj, propName, { - set: (newVal: any) => (value = newVal), - get: () => { - if (!deprecatedWarningsGiven.has(identifier)) { - deprecatedWarningsGiven.add(identifier); - Terminal.warn(`Deprecated property ${propName} accessed from ns.${ctx.functionPath} return value.`); - Terminal.warn(`This is no longer supported usage and will be removed in a later version.`); - Terminal.warn(message); - Terminal.info(`Note that this message can also appear if you iterate through the object's values.`); - Terminal.info(`This message will only be shown once per game session for each deprecated property accessed.`); - } - return value; - }, - enumerable: true, - }); + for (const [name, info] of Object.entries(properties)) { + Object.defineProperty(obj, name, { + get: () => { + deprecationWarning(info.identifier, info.message); + return info.value; + }, + set: (value: any) => (info.value = value), + enumerable: true, + }); + } +} +function deprecationWarning(identifier: string, message: string) { + if (!deprecatedWarningsGiven.has(identifier)) { + deprecatedWarningsGiven.add(identifier); + Terminal.warn(`Accessed deprecated function or property: ${identifier}`); + Terminal.warn(`This is no longer supported usage and will be removed in a later version.`); + Terminal.warn(message); + Terminal.info(`This message can also appear for object properties when the object's values are iterated.`); + Terminal.info(`This message will only be shown once per game session for each deprecated item accessed.`); + } } diff --git a/src/NetscriptFunctions/Formulas.ts b/src/NetscriptFunctions/Formulas.ts index aa0830b8e..e089a7a9e 100644 --- a/src/NetscriptFunctions/Formulas.ts +++ b/src/NetscriptFunctions/Formulas.ts @@ -87,15 +87,16 @@ export function NetscriptFormulas(): InternalAPI { serverGrowth: 0, }), mockPlayer: () => (): IPlayer => ({ + // Person hp: { current: 0, max: 0 }, skills: { hacking: 0, strength: 0, defense: 0, dexterity: 0, agility: 0, charisma: 0, intelligence: 0 }, exp: { hacking: 0, strength: 0, defense: 0, dexterity: 0, agility: 0, charisma: 0, intelligence: 0 }, mults: defaultMultipliers(), + city: CityName.Sector12, + // Player-specific numPeopleKilled: 0, money: 0, - city: CityName.Sector12, location: LocationName.TravelAgency, - bitNodeN: 0, totalPlaytime: 0, jobs: {}, factions: [], diff --git a/src/NetscriptFunctions/Singularity.ts b/src/NetscriptFunctions/Singularity.ts index 22f316bee..b55ce50f5 100644 --- a/src/NetscriptFunctions/Singularity.ts +++ b/src/NetscriptFunctions/Singularity.ts @@ -1254,14 +1254,6 @@ export function NetscriptSingularity(): InternalAPI { helpers.checkSingularityAccess(ctx); return canGetBonus(); }, - getLastAugReset: (ctx) => () => { - helpers.checkSingularityAccess(ctx); - return Player.lastAugReset; - }, - getLastNodeReset: (ctx) => () => { - helpers.checkSingularityAccess(ctx); - return Player.lastNodeReset; - }, }; Object.assign(singularityAPI, { getAugmentationCost: removedFunction( diff --git a/src/ScriptEditor/NetscriptDefinitions.d.ts b/src/ScriptEditor/NetscriptDefinitions.d.ts index b340facbf..e4db7bd00 100644 --- a/src/ScriptEditor/NetscriptDefinitions.d.ts +++ b/src/ScriptEditor/NetscriptDefinitions.d.ts @@ -50,7 +50,6 @@ interface Player extends Person { entropy: number; jobs: Record; factions: string[]; - bitNodeN: number; totalPlaytime: number; location: string; } @@ -67,6 +66,17 @@ interface SleevePerson extends Person { storedCycles: number; } +/** Various info about resets + * @public */ +interface ResetInfo { + /** Numeric timestamp (from Date.now()) of last augmentation reset */ + lastAugReset: number; + /** Numeric timestamp (from Date.now()) of last bitnode reset */ + lastNodeReset: number; + /** The current bitnode */ + currentNode: number; +} + /** @public */ interface MoneySource { bladeburner: number; @@ -2361,24 +2371,6 @@ export interface Singularity { * @returns - An object representing the current work. Fields depend on the kind of work. */ getCurrentWork(): any | null; - - /** - * Get the last timestamp from when you installed augmentations. - * @remarks - * RAM cost: 0.5 GB * 16/4/1 - * - * @returns The timestamp in milliseconds from your last augmentation install. - */ - getLastAugReset(): number; - - /** - * Get the last timestamp from when you finished a bitnode. - * @remarks - * RAM cost: 0.5 GB * 16/4/1 - * - * @returns The timestamp in milliseconds from your last bitnode finish. - */ - getLastNodeReset(): number; } /** @@ -6573,8 +6565,8 @@ export interface NS { formatPercent(n: number, fractionalDigits?: number, multStart?: number): string; /** - * Format a number using the numeral library. This function is deprecated and will be removed in 2.3. - * @deprecated Use ns.formatNumber, formatRam, or formatPercent instead. Will be removed in 2.3. + * Format a number using the numeral library. This function is deprecated and will be removed in 2.4. + * @deprecated Use ns.formatNumber, formatRam, or formatPercent instead. Will be removed in 2.4. * @remarks * RAM cost: 0 GB * @@ -6815,8 +6807,6 @@ export interface NS { * @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 @@ -6830,6 +6820,20 @@ export interface NS { */ mv(host: string, source: string, destination: string): void; + /** Get information about resets. + * @remarks + * RAM cost: 1 GB + * + * @example + * ```js + * const resetInfo = ns.getResetInfo(); + * const lastAugReset = resetInfo.lastAugReset; + * ns.tprint(`The last augmentation reset was: ${new Date(lastAugReset)}`); + * ns.tprint(`It has been ${Date.now() - lastAugReset}ms since the last augmentation reset.`); + * ``` + * */ + getResetInfo(): ResetInfo; + /** * Parse command line flags. * @remarks