-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbootstrap32GB.js
58 lines (53 loc) · 1.74 KB
/
bootstrap32GB.js
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/*
New node init script must stay below 32GB
- make > $200k
- Hack Casino for $10b
- Upgrade home ram to 1TB
- Run init.js
*/
/** @param {NS} ns **/
export async function main(ns) {
ns.disableLog('sleep');
ns.disableLog('getServerMaxRam');
ns.disableLog('getUpgradeHomeRamCost');
ns.disableLog('getPlayer');
ns.clearLog();
ns.tail();
let casinoBreakerPid = 0;
while (true) {
await ns.sleep(100);
const player = ns.getPlayer();
//need a min of 1030 for corporation apis
//bitnode 9 2tb of home ram > $10b
//const ramWanted = 1024;
const ramWanted = 2048;
if (ns.getServerMaxRam('home') < ramWanted && player.money > ns.getUpgradeHomeRamCost()) {
ns.upgradeHomeRam();
}
if (casinoBreakerPid === -1 && ns.getServerMaxRam('home') >= ramWanted) {
//All done time to init
ns.exec('init.js', 'home');
return;
}
if (casinoBreakerPid !== 0) {
casinoBreakerPid = ns.isRunning(casinoBreakerPid) ? casinoBreakerPid : -1;
continue;
}
if (player.money > 200000 && casinoBreakerPid === 0) {
while (ns.isBusy()) {
// need to finish crime before hitting the casino
await ns.sleep(20);
}
casinoBreakerPid = ns.exec('casinoBreaker.js', 'home');
if (casinoBreakerPid === 0) {
casinoBreakerPid = ns.getRunningScript('casinoBreaker.js', 'home').pid;
ns.print(`casinoBreakerPid ${casinoBreakerPid}`);
}
continue;
}
if (ns.isBusy() || casinoBreakerPid !== 0) {
continue;
}
ns.commitCrime('shoplift');
}
}