-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhack-cycle.js
More file actions
26 lines (23 loc) · 831 Bytes
/
Copy pathhack-cycle.js
File metadata and controls
26 lines (23 loc) · 831 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import { scanAndRun } from 'common.js'
/** @param {NS} ns **/
export async function main(ns) {
const args = ns.flags([['help', false]]);
if (args.help) {
ns.tprint('??????????????????????????????????');
ns.tprint('??????????????????????????????????');
ns.tprint('??????????????????????????????????');
ns.tprint(`Usage: run ${ns.getScriptName()}`);
return;
}
ns.disableLog('scan');
ns.disableLog('getHackingLevel');
ns.disableLog('getServerRequiredHackingLevel');
while (true) {
await scanAndRun(ns, async function (hostname) {
if ((ns.getHackingLevel() >= ns.getServerRequiredHackingLevel(hostname))
&& (ns.getServer(hostname).moneyAvailable > 0.0)) {
await ns.hack(hostname);
}
});
}
}