diff --git a/src/Netscript/NetscriptHelpers.ts b/src/Netscript/NetscriptHelpers.ts index 452d57fd0..be877c9da 100644 --- a/src/Netscript/NetscriptHelpers.ts +++ b/src/Netscript/NetscriptHelpers.ts @@ -34,6 +34,7 @@ import { dialogBoxCreate } from "../ui/React/DialogBox"; import { checkEnum } from "../utils/helpers/enum"; import { RamCostConstants } from "./RamCostGenerator"; import { isPositiveInteger, PositiveInteger } from "../types"; +import { Engine } from "../engine"; export const helpers = { string, @@ -515,6 +516,9 @@ function hack( } if (manual) { server.backdoorInstalled = true; + // Manunally check for faction invites + Engine.Counters.checkFactionInvitations = 0; + Engine.checkCounters(); } return moneyGained; } else { diff --git a/src/NetscriptFunctions/Singularity.ts b/src/NetscriptFunctions/Singularity.ts index c7fd32815..b8792d79d 100644 --- a/src/NetscriptFunctions/Singularity.ts +++ b/src/NetscriptFunctions/Singularity.ts @@ -50,6 +50,7 @@ import { saveObject } from "../SaveObject"; import { calculateCrimeWorkStats } from "../Work/Formulas"; import { findEnumMember } from "../utils/helpers/enum"; import { areFilesEqual } from "../Terminal/DirectoryHelpers"; +import { Engine } from "../engine"; export function NetscriptSingularity(): InternalAPI { const getAugmentation = function (ctx: NetscriptContext, name: string): Augmentation { @@ -561,13 +562,14 @@ export function NetscriptSingularity(): InternalAPI { return helpers.netscriptDelay(ctx, installTime).then(function () { helpers.log(ctx, () => `Successfully installed backdoor on '${server.hostname}'`); - server.backdoorInstalled = true; if (SpecialServers.WorldDaemon === server.hostname) { - Router.toBitVerse(false, false); + return Router.toBitVerse(false, false); } - return Promise.resolve(); + // Manunally check for faction invites + Engine.Counters.checkFactionInvitations = 0; + Engine.checkCounters(); }); }, isFocused: (ctx) => () => { @@ -810,6 +812,9 @@ export function NetscriptSingularity(): InternalAPI { }, checkFactionInvitations: (ctx) => () => { helpers.checkSingularityAccess(ctx); + // Manually trigger a check for faction invites + Engine.Counters.checkFactionInvitations = 0; + Engine.checkCounters(); // Make a copy of player.factionInvitations return Player.factionInvitations.slice(); }, diff --git a/src/Terminal/Terminal.ts b/src/Terminal/Terminal.ts index 0a071b99b..9b13fc729 100644 --- a/src/Terminal/Terminal.ts +++ b/src/Terminal/Terminal.ts @@ -76,6 +76,7 @@ import { hash } from "../hash/hash"; import { apr1 } from "./commands/apr1"; import { changelog } from "./commands/changelog"; import { BitNodeMultipliers } from "../BitNode/BitNodeMultipliers"; +import { Engine } from "../engine"; export class Terminal { // Flags to determine whether the player is currently running a hack or an analyze @@ -207,6 +208,10 @@ export class Terminal { Router.toBitVerse(false, false); return; } + // Manunally check for faction invites + Engine.Counters.checkFactionInvitations = 0; + Engine.checkCounters(); + let moneyGained = calculatePercentMoneyHacked(server, Player) * BitNodeMultipliers.ManualHackMoney; moneyGained = Math.floor(server.moneyAvailable * moneyGained); @@ -298,6 +303,10 @@ export class Terminal { Router.toBitVerse(false, false); return; } + // Manunally check for faction invites + Engine.Counters.checkFactionInvitations = 0; + Engine.checkCounters(); + this.print(`Backdoor on '${server.hostname}' successful!`); } }