added logic to rewward and invite to infiltrators on infil completion

This commit is contained in:
phyzical
2022-03-23 23:23:01 +08:00
parent 0b171822df
commit 80edb744bf
5 changed files with 45 additions and 12 deletions
+7 -5
View File
@@ -84,6 +84,7 @@ export class PlayerObject implements IPlayer {
lastUpdate: number;
lastSave: number;
totalPlaytime: number;
hasCompletedAnInfiltration: boolean;
// Stats
hacking: number;
@@ -466,6 +467,7 @@ export class PlayerObject implements IPlayer {
this.lastUpdate = 0;
this.lastSave = 0;
this.totalPlaytime = 0;
this.hasCompletedAnInfiltration = true;
this.playtimeSinceLastAug = 0;
this.playtimeSinceLastBitnode = 0;
@@ -483,11 +485,11 @@ export class PlayerObject implements IPlayer {
// Let's get a hash of some semi-random stuff so we have something unique.
this.identifier = cyrb53(
"I-" +
new Date().getTime() +
navigator.userAgent +
window.innerWidth +
window.innerHeight +
getRandomInt(100, 999),
new Date().getTime() +
navigator.userAgent +
window.innerWidth +
window.innerHeight +
getRandomInt(100, 999),
);
this.init = generalMethods.init;
@@ -2086,6 +2086,12 @@ export function checkForFactionInvitations(this: IPlayer): Faction[] {
return allCompanies.includes(companyName) && getCompanyRep(companyName) > repNeeded;
}
//Infiltrators
const InfiltratorsFac = Factions[FactionNames.Infiltrators];
if (this.hasCompletedAnInfiltration && !InfiltratorsFac.isMember && !InfiltratorsFac.alreadyInvited) {
invitedFactions.push(InfiltratorsFac);
}
//Illuminati
const illuminatiFac = Factions[FactionNames.Illuminati];
if (