forked from xxxsinx/bitburner
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfavorStatus.js
33 lines (28 loc) · 1.45 KB
/
favorStatus.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
import { GetSitRep } from 'sitrep.js'
import { LogMessage } from 'utils.js'
/** @param {NS} ns */
export async function main(ns) {
let favorInstall = false;
for (const faction of ['BitRunners', 'Daedalus']) {
if (!ns.getPlayer().factions.includes(faction)) {
//ns.tprint('WARN: Player isn\'t part of ' + faction + ' factions: ' + ns.getPlayer().factions);
continue;
}
const current = ns.singularity.getFactionFavor(faction);
const gain = ns.singularity.getFactionFavorGain(faction);
//ns.tprint('INFO: ' + faction + ' favor is ' + current + ' gain is ' + gain + ' total after install would be ' + (current + gain));
if (current < 75 && current + gain >= 75) {
LogMessage(ns, 'INFO: Ready to trigger an install for favor on ' + faction + ' current: ' + current + ' after install: ' + (current + gain));
ns.tprint('INFO: Ready to trigger an install for favor on ' + faction + ' current: ' + current + ' after install: ' + (current + gain));
favorInstall = true;
}
if (current < 150 && current + gain >= 150) {
LogMessage(ns, 'INFO: Ready to trigger an install for favor on ' + faction + ' current: ' + current + ' after install: ' + (current + gain));
ns.tprint('INFO: Ready to trigger an install for favor on ' + faction + ' current: ' + current + ' after install: ' + (current + gain));
favorInstall = true;
}
}
const sitrep = GetSitRep(ns);
sitrep.favorInstall = favorInstall;
ns.write('sitrep.txt', JSON.stringify(sitrep), 'w');
}