forked from MercuriusXeno/BitBurnerScripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
agency-manager.js
26 lines (24 loc) · 955 Bytes
/
agency-manager.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
// the purpose of the agency manager is simply to join factions when they become available.
export async function main(ns) {
const desiredFactions = ["Sector-12", "Netburners", "CyberSec", "NiteSec", "The Black Hand", "BitRunners", "Daedalus"];
var allFactionsJoined = false;
while (!allFactionsJoined) {
var invites = ns.checkFactionInvitations();
for(var i in invites) {
ns.joinFaction(invites[i])
}
// check if we're already a member of all the factions we want to be in
var factionsJoinedCheck = true;
var info = ns.getCharacterInformation();
var alreadyInFactions = info.factions;
for(var d in desiredFactions) {
if (!alreadyInFactions.includes(d)) {
factionsJoinedCheck = false;
}
}
if (factionsJoinedCheck) {
allFactionsJoined = true;
}
await ns.sleep(1000);
}
}