From 6ef99e138c4ae1ca6777d5cce10038f35f0111af Mon Sep 17 00:00:00 2001 From: Olivier Gagnon Date: Thu, 16 Dec 2021 12:40:24 -0500 Subject: [PATCH] fix BN exploit --- src/NetscriptFunctions.ts | 7 +++++-- src/Prestige.ts | 7 +++++++ src/ScriptEditor/NetscriptDefinitions.d.ts | 2 +- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/NetscriptFunctions.ts b/src/NetscriptFunctions.ts index c4eb0bb3f..d565f0303 100644 --- a/src/NetscriptFunctions.ts +++ b/src/NetscriptFunctions.ts @@ -2123,12 +2123,15 @@ export function NetscriptFunctions(workerScript: WorkerScript): NS { return Player.playtimeSinceLastAug; }, alert: function (message: any): void { - dialogBoxCreate(message); + message = toNative(message); + dialogBoxCreate(JSON.stringify(message)); }, toast: function (message: any, variant: any = "success"): void { if (!["success", "info", "warning", "error"].includes(variant)) throw new Error(`variant must be one of "success", "info", "warning", or "error"`); - SnackbarEvents.emit(message, variant); + + message = toNative(message); + SnackbarEvents.emit(JSON.stringify(message), variant); }, prompt: function (txt: any): any { if (!isString(txt)) { diff --git a/src/Prestige.ts b/src/Prestige.ts index 459e15785..ce0e82ab7 100755 --- a/src/Prestige.ts +++ b/src/Prestige.ts @@ -168,6 +168,13 @@ export function prestigeSourceFile(flume: boolean): void { const homeComp = Player.getHomeComputer(); + // Stop a Terminal action if there is one. + if (Terminal.action !== null) { + Terminal.finishAction(Router, Player, true); + } + Terminal.clear(); + LogBoxClearEvents.emit(); + // Delete all servers except home computer prestigeAllServers(); // Must be done before initForeignServers() diff --git a/src/ScriptEditor/NetscriptDefinitions.d.ts b/src/ScriptEditor/NetscriptDefinitions.d.ts index 8b3403a5f..d76fa75ea 100644 --- a/src/ScriptEditor/NetscriptDefinitions.d.ts +++ b/src/ScriptEditor/NetscriptDefinitions.d.ts @@ -4624,7 +4624,7 @@ export interface NS extends Singularity { * RAM cost: 0.1 GB * * Returns the server’s instrinsic “growth parameter”. This growth - * parameter is a number between 1 and 100 that represents how + * parameter is a number between 0 and 100 that represents how * quickly the server’s money grows. This parameter affects the * percentage by which the server’s money is increased when using the * grow function. A higher growth parameter will result in a