fix: fixed hackAnalyzeThreads returning infinity

This commit is contained in:
Chris Rabe 2022-01-31 08:14:10 +10:00
parent 9ddb1c4379
commit 3e61780fad

@ -536,6 +536,10 @@ export function NetscriptFunctions(workerScript: WorkerScript): NS {
const percentHacked = calculatePercentMoneyHacked(server, Player); const percentHacked = calculatePercentMoneyHacked(server, Player);
if (percentHacked === 0 || server.moneyAvailable === 0) {
return 0; // To prevent returning infinity below
}
return hackAmount / Math.floor(server.moneyAvailable * percentHacked); return hackAmount / Math.floor(server.moneyAvailable * percentHacked);
}, },
hackAnalyze: function (hostname: any): any { hackAnalyze: function (hostname: any): any {