mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-12-21 21:52:30 +01:00
Add triggers for faction invite check
Manually check for faction invites whenever a server is backdoored, and whenever the player uses ns.singularity.checkFactionInvites
This commit is contained in:
parent
401bfe9f31
commit
b9ffb9e42e
@ -34,6 +34,7 @@ import { dialogBoxCreate } from "../ui/React/DialogBox";
|
|||||||
import { checkEnum } from "../utils/helpers/enum";
|
import { checkEnum } from "../utils/helpers/enum";
|
||||||
import { RamCostConstants } from "./RamCostGenerator";
|
import { RamCostConstants } from "./RamCostGenerator";
|
||||||
import { isPositiveInteger, PositiveInteger } from "../types";
|
import { isPositiveInteger, PositiveInteger } from "../types";
|
||||||
|
import { Engine } from "../engine";
|
||||||
|
|
||||||
export const helpers = {
|
export const helpers = {
|
||||||
string,
|
string,
|
||||||
@ -515,6 +516,9 @@ function hack(
|
|||||||
}
|
}
|
||||||
if (manual) {
|
if (manual) {
|
||||||
server.backdoorInstalled = true;
|
server.backdoorInstalled = true;
|
||||||
|
// Manunally check for faction invites
|
||||||
|
Engine.Counters.checkFactionInvitations = 0;
|
||||||
|
Engine.checkCounters();
|
||||||
}
|
}
|
||||||
return moneyGained;
|
return moneyGained;
|
||||||
} else {
|
} else {
|
||||||
|
@ -50,6 +50,7 @@ import { saveObject } from "../SaveObject";
|
|||||||
import { calculateCrimeWorkStats } from "../Work/Formulas";
|
import { calculateCrimeWorkStats } from "../Work/Formulas";
|
||||||
import { findEnumMember } from "../utils/helpers/enum";
|
import { findEnumMember } from "../utils/helpers/enum";
|
||||||
import { areFilesEqual } from "../Terminal/DirectoryHelpers";
|
import { areFilesEqual } from "../Terminal/DirectoryHelpers";
|
||||||
|
import { Engine } from "../engine";
|
||||||
|
|
||||||
export function NetscriptSingularity(): InternalAPI<ISingularity> {
|
export function NetscriptSingularity(): InternalAPI<ISingularity> {
|
||||||
const getAugmentation = function (ctx: NetscriptContext, name: string): Augmentation {
|
const getAugmentation = function (ctx: NetscriptContext, name: string): Augmentation {
|
||||||
@ -561,13 +562,14 @@ export function NetscriptSingularity(): InternalAPI<ISingularity> {
|
|||||||
|
|
||||||
return helpers.netscriptDelay(ctx, installTime).then(function () {
|
return helpers.netscriptDelay(ctx, installTime).then(function () {
|
||||||
helpers.log(ctx, () => `Successfully installed backdoor on '${server.hostname}'`);
|
helpers.log(ctx, () => `Successfully installed backdoor on '${server.hostname}'`);
|
||||||
|
|
||||||
server.backdoorInstalled = true;
|
server.backdoorInstalled = true;
|
||||||
|
|
||||||
if (SpecialServers.WorldDaemon === server.hostname) {
|
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) => () => {
|
isFocused: (ctx) => () => {
|
||||||
@ -810,6 +812,9 @@ export function NetscriptSingularity(): InternalAPI<ISingularity> {
|
|||||||
},
|
},
|
||||||
checkFactionInvitations: (ctx) => () => {
|
checkFactionInvitations: (ctx) => () => {
|
||||||
helpers.checkSingularityAccess(ctx);
|
helpers.checkSingularityAccess(ctx);
|
||||||
|
// Manually trigger a check for faction invites
|
||||||
|
Engine.Counters.checkFactionInvitations = 0;
|
||||||
|
Engine.checkCounters();
|
||||||
// Make a copy of player.factionInvitations
|
// Make a copy of player.factionInvitations
|
||||||
return Player.factionInvitations.slice();
|
return Player.factionInvitations.slice();
|
||||||
},
|
},
|
||||||
|
@ -76,6 +76,7 @@ import { hash } from "../hash/hash";
|
|||||||
import { apr1 } from "./commands/apr1";
|
import { apr1 } from "./commands/apr1";
|
||||||
import { changelog } from "./commands/changelog";
|
import { changelog } from "./commands/changelog";
|
||||||
import { BitNodeMultipliers } from "../BitNode/BitNodeMultipliers";
|
import { BitNodeMultipliers } from "../BitNode/BitNodeMultipliers";
|
||||||
|
import { Engine } from "../engine";
|
||||||
|
|
||||||
export class Terminal {
|
export class Terminal {
|
||||||
// Flags to determine whether the player is currently running a hack or an analyze
|
// 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);
|
Router.toBitVerse(false, false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
// Manunally check for faction invites
|
||||||
|
Engine.Counters.checkFactionInvitations = 0;
|
||||||
|
Engine.checkCounters();
|
||||||
|
|
||||||
let moneyGained = calculatePercentMoneyHacked(server, Player) * BitNodeMultipliers.ManualHackMoney;
|
let moneyGained = calculatePercentMoneyHacked(server, Player) * BitNodeMultipliers.ManualHackMoney;
|
||||||
moneyGained = Math.floor(server.moneyAvailable * moneyGained);
|
moneyGained = Math.floor(server.moneyAvailable * moneyGained);
|
||||||
|
|
||||||
@ -298,6 +303,10 @@ export class Terminal {
|
|||||||
Router.toBitVerse(false, false);
|
Router.toBitVerse(false, false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
// Manunally check for faction invites
|
||||||
|
Engine.Counters.checkFactionInvitations = 0;
|
||||||
|
Engine.checkCounters();
|
||||||
|
|
||||||
this.print(`Backdoor on '${server.hostname}' successful!`);
|
this.print(`Backdoor on '${server.hostname}' successful!`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user