forked from xxxsinx/bitburner
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsleeves.js
137 lines (114 loc) · 3.85 KB
/
sleeves.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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
import { GetBestCrime } from 'stats.js'
import { ColorPrint } from 'hack-once.js'
/** @param {NS} ns **/
export async function main(ns) {
let [task, start = 0, count = 8] = ns.args;
let getBest = task == undefined;
for (let i = start; i < count; i++) {
let cash = ns.getServerMoneyAvailable('home');
let city = ns.sleeve.getInformation(i).city;
//if (task == 'augs' && i > 3) continue;
if (getBest)
task = GetBestCrime(ns, ns.sleeve.getSleeveStats(i));
if (task == 'shock') {
ns.tprint('Setting sleeve ' + i + ' to Shock Recovery');
ns.sleeve.setToShockRecovery(i);
continue;
}
// if (task == 'Homicide') {
// ns.sleeve.setToCommitCrime(i, task);
// continue;
// }
if (task == 'augs') {
if (ns.sleeve.getSleeveStats(i).shock > 0) continue;
//if (i > 1) continue;
const owned = ns.sleeve.getSleeveAugmentations(i);
const available = ns.sleeve.getSleevePurchasableAugs(i).sort((a, b) => a.cost - b.cost).filter(s => !owned.includes(s.name));
let totalCost = 0;
for (const aug of available) {
let color = 'white';
ns.tprint(aug.name + ' => ' + ns.nFormat(aug.cost, "$0.000a"));
let stats = ns.getAugmentationStats(aug.name);
if (Object.keys(stats).length == 0) {
ColorPrint('red', ' No stats found for this augment');
}
else {
for (let key of Object.keys(stats)) {
// if (key.search('str') >= 0 ||
// key.search('def') >= 0 ||
// key.search('agi') >= 0 ||
// key.search('dex') >= 0 ||
// key.search('combat') >= 0 ||
// key.search('skills') >= 0)
// color = 'yellow';
// if (key.search('faction') >= 0)
// color = 'yellow';
// if (key.search('hack') >= 0 && key.search('hacknet') == -1)
// color = 'orange';
// if (key.search('hacknet') >= 0)
// color = 'purple';
// if (aug.cost > 15_000_000_000)
// continue;
//color = 'red';
//if (color == 'yellow') {
totalCost += aug.cost;
ns.sleeve.purchaseSleeveAug(i, aug.name);
await ns.sleep(5);
//}
ColorPrint(color, ' ' + key.padEnd(30) + ' ' + stats[key]);
}
}
}
ColorPrint('yellow', 'Total of matching augs: ' + ns.nFormat(totalCost * 8, "$0.000a"))
await ns.sleep(100);
continue;
//break;
}
if (task == 'study') {
// Travel if possible/needed
if (ns.sleeve.getInformation(i).city != 'Volhaven' && cash > 1_000_000) {
ns.sleeve.travel(i, 'Volhaven');
city = ns.sleeve.getInformation(i).city;
}
// Chose either the most expensive or free course depending on cash
const course = cash > 1_000_000 ? 'Algorithms' : 'Study Computer Science';
let uni = '';
switch (city) {
case 'Volhaven':
uni = 'ZB Institute of Technology';
break;
case 'Sector-12':
uni = 'Rothman University';
break;
default:
ns.tprint('Sleeve ' + i + ' is not in Sector-12 or Volhaven and cash is tight, aborting.');
continue;
}
ns.tprint('Sleeve ' + i + ' is starting to study ' + course + ' at ' + uni);
ns.sleeve.setToUniversityCourse(i, uni, course);
continue;
}
if (task == 'train') {
// Travel if possible/needed
if (ns.sleeve.getInformation(i).city != 'Sector-12') {
if (cash > 1_000_000) {
ns.sleeve.travel(i, 'Sector-12');
city = ns.sleeve.getInformation(i).city;
}
else {
ns.tprint('Sleeve ' + i + ' is not in Sector-12 and cash is tight, aborting training.');
continue;
}
}
const stats = ['Train Strength', 'Train Defense', 'Train Dexterity', 'Train Agility'];
const statIndex = i % 4;
ns.tprint('Sleeve ' + i + ' is starting to to ' + stats[statIndex] + ' at ' + 'Powerhouse Gym');
ns.sleeve.setToGymWorkout(i, 'Powerhouse Gym', stats[statIndex]);
continue;
}
// Default
ns.tprint('Setting sleeve ' + i + ' to ' + task);
ns.sleeve.setToCommitCrime(i, task);
continue;
}
}