forked from MercuriusXeno/BitBurnerScripts
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathtor-manager.js
More file actions
27 lines (24 loc) · 684 Bytes
/
tor-manager.js
File metadata and controls
27 lines (24 loc) · 684 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
27
// the purpose of tor-manager is to buy the TOR router ASAP
// so that another script can buy the port breakers. This script
// dies a natural death once tor is bought.
export async function main(ns) {
const torCost = 200000;
while (true) {
if (hasTor(ns)) {
ns.tprint("hasTorRouter: true");
break;
} else {
if (torCost <= getPlayerMoney(ns)) {
ns.purchaseTor();
}
}
await ns.sleep(200);
}
}
function getPlayerMoney(ns) {
return ns.getServerMoneyAvailable("home");
}
function hasTor(ns) {
var homeNodes = ns.scan("home");
return homeNodes.includes("darkweb");
}