Bitburner-Scripts/servers/home/hack.ts

15 lines
396 B
TypeScript
Raw Normal View History

2023-11-03 18:42:37 -03:00
export async function main(ns: NS) {
const server: string = <string> ns.args[0]
while (true) {
// Guide https://darktechnomancer.github.io/#glossary-of-terms
2023-11-03 19:11:52 -03:00
if (ns.getServerSecurityLevel(server) > 5) {
await ns.weaken(server)
} else if (ns.getServerMoneyAvailable(server) < ns.getServerMaxMoney(server) * 0.95) {
await ns.grow(server)
} else {
await ns.hack(server)
}
2023-11-03 18:42:37 -03:00
}
}