Bitburner-Scripts/servers/home/hackallservers.ts

17 lines
765 B
TypeScript
Raw Normal View History

2023-11-03 15:07:07 -03:00
import {NS} from "NetscriptDefinitions";
import {recursiveScan} from "./utils";
import {executeScriptOnServerFromAnother} from "./utils";
export async function main(ns: NS) {
let servers: string[] = recursiveScan(ns);
for (const server of servers) {
2023-11-03 15:31:57 -03:00
// Commented out code is not needed with smart scheduling
//let moneyThresh = ns.getServerMaxMoney(server) * 0.75;
//let securityThresh = ns.getServerMinSecurityLevel(server) + 5;
2023-11-03 15:07:07 -03:00
let numThreads = ns.getServerMaxRam(server) / ns.getScriptRam("hack.js")
2023-11-03 15:22:12 -03:00
numThreads = Math.floor(numThreads);
2023-11-03 15:31:57 -03:00
//executeScriptOnServerFromAnother(ns, server, "hack.js", numThreads, [server, moneyThresh, securityThresh])
executeScriptOnServerFromAnother(ns, server, "hack.js", numThreads, [server])
2023-11-03 15:07:07 -03:00
}
}