formulas time in millis

This commit is contained in:
Olivier Gagnon 2021-11-05 00:27:30 -04:00
parent 5d37eecdd6
commit 73d0f2074c
4 changed files with 13 additions and 13 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -1276,7 +1276,7 @@ export function NetscriptFunctions(workerScript: WorkerScript): NS {
updateDynamicRam("getServerMoneyAvailable", getRamCost("getServerMoneyAvailable")); updateDynamicRam("getServerMoneyAvailable", getRamCost("getServerMoneyAvailable"));
const server = safeGetServer(hostname, "getServerMoneyAvailable"); const server = safeGetServer(hostname, "getServerMoneyAvailable");
if (!(server instanceof Server)) { if (!(server instanceof Server)) {
workerScript.log("getServerNumPortsRequired", "Cannot be executed on this server."); workerScript.log("getServerMoneyAvailable", "Cannot be executed on this server.");
return 0; return 0;
} }
if (failOnHacknetServer(server, "getServerMoneyAvailable")) { if (failOnHacknetServer(server, "getServerMoneyAvailable")) {
@ -1300,7 +1300,7 @@ export function NetscriptFunctions(workerScript: WorkerScript): NS {
updateDynamicRam("getServerSecurityLevel", getRamCost("getServerSecurityLevel")); updateDynamicRam("getServerSecurityLevel", getRamCost("getServerSecurityLevel"));
const server = safeGetServer(hostname, "getServerSecurityLevel"); const server = safeGetServer(hostname, "getServerSecurityLevel");
if (!(server instanceof Server)) { if (!(server instanceof Server)) {
workerScript.log("getServerNumPortsRequired", "Cannot be executed on this server."); workerScript.log("getServerSecurityLevel", "Cannot be executed on this server.");
return 1; return 1;
} }
if (failOnHacknetServer(server, "getServerSecurityLevel")) { if (failOnHacknetServer(server, "getServerSecurityLevel")) {
@ -1320,7 +1320,7 @@ export function NetscriptFunctions(workerScript: WorkerScript): NS {
); );
const server = safeGetServer(hostname, "getServerBaseSecurityLevel"); const server = safeGetServer(hostname, "getServerBaseSecurityLevel");
if (!(server instanceof Server)) { if (!(server instanceof Server)) {
workerScript.log("getServerNumPortsRequired", "Cannot be executed on this server."); workerScript.log("getServerBaseSecurityLevel", "Cannot be executed on this server.");
return 1; return 1;
} }
if (failOnHacknetServer(server, "getServerBaseSecurityLevel")) { if (failOnHacknetServer(server, "getServerBaseSecurityLevel")) {
@ -1336,7 +1336,7 @@ export function NetscriptFunctions(workerScript: WorkerScript): NS {
updateDynamicRam("getServerMinSecurityLevel", getRamCost("getServerMinSecurityLevel")); updateDynamicRam("getServerMinSecurityLevel", getRamCost("getServerMinSecurityLevel"));
const server = safeGetServer(hostname, "getServerMinSecurityLevel"); const server = safeGetServer(hostname, "getServerMinSecurityLevel");
if (!(server instanceof Server)) { if (!(server instanceof Server)) {
workerScript.log("getServerNumPortsRequired", "Cannot be executed on this server."); workerScript.log("getServerMinSecurityLevel", "Cannot be executed on this server.");
return 1; return 1;
} }
if (failOnHacknetServer(server, "getServerMinSecurityLevel")) { if (failOnHacknetServer(server, "getServerMinSecurityLevel")) {
@ -1352,7 +1352,7 @@ export function NetscriptFunctions(workerScript: WorkerScript): NS {
updateDynamicRam("getServerRequiredHackingLevel", getRamCost("getServerRequiredHackingLevel")); updateDynamicRam("getServerRequiredHackingLevel", getRamCost("getServerRequiredHackingLevel"));
const server = safeGetServer(hostname, "getServerRequiredHackingLevel"); const server = safeGetServer(hostname, "getServerRequiredHackingLevel");
if (!(server instanceof Server)) { if (!(server instanceof Server)) {
workerScript.log("getServerNumPortsRequired", "Cannot be executed on this server."); workerScript.log("getServerRequiredHackingLevel", "Cannot be executed on this server.");
return 1; return 1;
} }
if (failOnHacknetServer(server, "getServerRequiredHackingLevel")) { if (failOnHacknetServer(server, "getServerRequiredHackingLevel")) {
@ -1368,7 +1368,7 @@ export function NetscriptFunctions(workerScript: WorkerScript): NS {
updateDynamicRam("getServerMaxMoney", getRamCost("getServerMaxMoney")); updateDynamicRam("getServerMaxMoney", getRamCost("getServerMaxMoney"));
const server = safeGetServer(hostname, "getServerMaxMoney"); const server = safeGetServer(hostname, "getServerMaxMoney");
if (!(server instanceof Server)) { if (!(server instanceof Server)) {
workerScript.log("getServerNumPortsRequired", "Cannot be executed on this server."); workerScript.log("getServerMaxMoney", "Cannot be executed on this server.");
return 0; return 0;
} }
if (failOnHacknetServer(server, "getServerMaxMoney")) { if (failOnHacknetServer(server, "getServerMaxMoney")) {
@ -1384,7 +1384,7 @@ export function NetscriptFunctions(workerScript: WorkerScript): NS {
updateDynamicRam("getServerGrowth", getRamCost("getServerGrowth")); updateDynamicRam("getServerGrowth", getRamCost("getServerGrowth"));
const server = safeGetServer(hostname, "getServerGrowth"); const server = safeGetServer(hostname, "getServerGrowth");
if (!(server instanceof Server)) { if (!(server instanceof Server)) {
workerScript.log("getServerNumPortsRequired", "Cannot be executed on this server."); workerScript.log("getServerGrowth", "Cannot be executed on this server.");
return 1; return 1;
} }
if (failOnHacknetServer(server, "getServerGrowth")) { if (failOnHacknetServer(server, "getServerGrowth")) {

@ -100,15 +100,15 @@ export function NetscriptFormulas(player: IPlayer, workerScript: WorkerScript, h
}, },
hackTime: function (server: any, player: any): any { hackTime: function (server: any, player: any): any {
checkFormulasAccess("basic.hackTime"); checkFormulasAccess("basic.hackTime");
return calculateHackingTime(server, player); return calculateHackingTime(server, player) / 1000;
}, },
growTime: function (server: any, player: any): any { growTime: function (server: any, player: any): any {
checkFormulasAccess("basic.growTime"); checkFormulasAccess("basic.growTime");
return calculateGrowTime(server, player); return calculateGrowTime(server, player) / 1000;
}, },
weakenTime: function (server: any, player: any): any { weakenTime: function (server: any, player: any): any {
checkFormulasAccess("basic.weakenTime"); checkFormulasAccess("basic.weakenTime");
return calculateWeakenTime(server, player); return calculateWeakenTime(server, player) / 1000;
}, },
}, },
hacknetNodes: { hacknetNodes: {