-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathacceptFactions.js
25 lines (23 loc) · 911 Bytes
/
acceptFactions.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
import { GetSitRep } from 'sitrep.js'
import { LogMessage } from 'utils.js'
/** @param {NS} ns */
export async function main(ns) {
const sitrep = GetSitRep(ns);
let invites = ns.singularity.checkFactionInvitations();
if (sitrep.targetFactions == undefined) return;
for (const faction of sitrep.targetFactions) {
if (invites.includes(faction)) {
ns.tprint('INFO: Joining faction ' + faction);
ns.singularity.joinFaction(faction);
LogMessage(ns, 'INFO: Joining faction ' + faction);
}
}
// Make sure we join our best NFG faction for default work
for (const faction of sitrep.nfgFactions) {
if (ns.getPlayer().factions.includes(faction)) continue;
if (!invites.includes(faction)) continue;
ns.tprint('INFO: Joining faction ' + faction + ' for NFG access/grind');
ns.singularity.joinFaction(faction);
LogMessage(ns, 'INFO: Joining faction ' + faction + ' for NFG access/grind');
}
}