Merge pull request #2640 from deathly809/bug/getWeakenTime_should_take_optional_hostname

GetWeakenTime should take optional hostname as docs suggest
This commit is contained in:
hydroflame 2022-01-15 10:49:32 -05:00 committed by GitHub
commit 903e8f16a2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

2
dist/bitburner.d.ts vendored

@ -3848,7 +3848,7 @@ export declare interface NS extends Singularity {
* @param host - Host of target server. * @param host - Host of target server.
* @returns Returns the amount of time in milliseconds it takes to execute the weaken Netscript function. Returns Infinity if called on a Hacknet Server. * @returns Returns the amount of time in milliseconds it takes to execute the weaken Netscript function. Returns Infinity if called on a Hacknet Server.
*/ */
getWeakenTime(host: string): number; getWeakenTime(host?: string): number;
/** /**
* Get the income of a script. * Get the income of a script.

@ -2012,7 +2012,7 @@ export function NetscriptFunctions(workerScript: WorkerScript): NS {
return calculateGrowTime(server, Player) * 1000; return calculateGrowTime(server, Player) * 1000;
}, },
getWeakenTime: function (hostname: any): any { getWeakenTime: function (hostname: any = workerScript.hostname): any {
updateDynamicRam("getWeakenTime", getRamCost(Player, "getWeakenTime")); updateDynamicRam("getWeakenTime", getRamCost(Player, "getWeakenTime"));
const server = safeGetServer(hostname, "getWeakenTime"); const server = safeGetServer(hostname, "getWeakenTime");
if (!(server instanceof Server)) { if (!(server instanceof Server)) {