Bitburner-Scripts/servers/home/hackallservers.ts

15 lines
617 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) {
let moneyThresh = ns.getServerMaxMoney(server) * 0.75;
let securityThresh = ns.getServerMinSecurityLevel(server) + 5;
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:07:07 -03:00
executeScriptOnServerFromAnother(ns, server, "hack.js", numThreads, [server, moneyThresh, securityThresh])
}
}