Add hack all servers function

This commit is contained in:
2023-11-03 15:07:07 -03:00
parent abdcc8d682
commit f34a37a3fb
5 changed files with 33 additions and 18 deletions

View File

@ -1,15 +0,0 @@
/** @param {NS} ns */
export async function main(ns) {
var target = ns.args[0]
var moneyThresh = ns.args[1]
var securityThresh = ns.args[2]
while (true) {
if (ns.getServerSecurityLevel(target) > securityThresh) {
await ns.weaken(target);
} else if (ns.getServerMoneyAvailable(target) < moneyThresh) {
await ns.grow(target);
} else {
await ns.hack(target);
}
}
}