From e3e1770439adbd694c2c7dc8885a24d8d259ef60 Mon Sep 17 00:00:00 2001 From: TheMas3212 Date: Fri, 31 Dec 2021 23:31:46 +1100 Subject: [PATCH] Fix Typedef for getScriptIncome/getScriptExpGain Current Typedef does not allow using the run with no arguments for totals versions --- src/NetscriptFunctions.ts | 4 ++-- src/ScriptEditor/NetscriptDefinitions.d.ts | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/NetscriptFunctions.ts b/src/NetscriptFunctions.ts index b8d35571b..b52f1b83c 100644 --- a/src/NetscriptFunctions.ts +++ b/src/NetscriptFunctions.ts @@ -2025,7 +2025,7 @@ export function NetscriptFunctions(workerScript: WorkerScript): NS { return calculateWeakenTime(server, Player) * 1000; }, - getScriptIncome: function (scriptname: any, hostname: any, ...args: any[]): any { + getScriptIncome: function (scriptname?: any, hostname?: any, ...args: any[]): any { updateDynamicRam("getScriptIncome", getRamCost("getScriptIncome")); if (arguments.length === 0) { const res = []; @@ -2054,7 +2054,7 @@ export function NetscriptFunctions(workerScript: WorkerScript): NS { return runningScriptObj.onlineMoneyMade / runningScriptObj.onlineRunningTime; } }, - getScriptExpGain: function (scriptname: any, hostname: any, ...args: any[]): any { + getScriptExpGain: function (scriptname?: any, hostname?: any, ...args: any[]): any { updateDynamicRam("getScriptExpGain", getRamCost("getScriptExpGain")); if (arguments.length === 0) { let total = 0; diff --git a/src/ScriptEditor/NetscriptDefinitions.d.ts b/src/ScriptEditor/NetscriptDefinitions.d.ts index 5069c5d9c..d9f5a2ed6 100644 --- a/src/ScriptEditor/NetscriptDefinitions.d.ts +++ b/src/ScriptEditor/NetscriptDefinitions.d.ts @@ -5545,7 +5545,8 @@ export interface NS extends Singularity { * @param args - Arguments that the script is running with. * @returns Amount of income the specified script generates while online. */ - getScriptIncome(script: string, host: string, ...args: string[]): number | [number, number]; + getScriptIncome(): [number, number]; + getScriptIncome(script: string, host: string, ...args: string[]): number; /** * Get the exp gain of a script. @@ -5564,6 +5565,7 @@ export interface NS extends Singularity { * @param args - Arguments that the script is running with. * @returns Amount of hacking experience the specified script generates while online. */ + getScriptExpGain(): number; getScriptExpGain(script: string, host: string, ...args: string[]): number; /**