Bitburner-Scripts/servers/home/hack.ts

24 lines
744 B
TypeScript
Raw Normal View History

2023-11-03 15:07:07 -03:00
import {NS} from "NetscriptDefinitions";
export async function main(ns: NS) {
const server: string = <string>ns.args[0];
while (true) {
2023-11-03 15:31:57 -03:00
/* This code checks conditions that are not needed with smart scheduling
const moneyThresh: number = <number>ns.args[1];
const securityThresh: number = <number>ns.args[2];
2023-11-03 15:07:07 -03:00
if (ns.getServerSecurityLevel(server) > securityThresh) {
await ns.weaken(server);
} else if (ns.getServerMoneyAvailable(server) < moneyThresh) {
await ns.grow(server);
} else {
await ns.hack(server);
}
2023-11-03 15:31:57 -03:00
*/
// Guide
// https://darktechnomancer.github.io/#glossary-of-terms
await ns.weaken(server);
await ns.grow(server);
await ns.weaken(server);
await ns.hack(server);
2023-11-03 15:07:07 -03:00
}
}