MISC: Rework reputation bonus after installing a backdoor (#1236)

This commit is contained in:
catloversg
2024-04-29 08:35:56 +07:00
committed by GitHub
parent 4d3dbf169d
commit d4bdb8de2b
6 changed files with 33 additions and 8 deletions
+10
View File
@@ -10,6 +10,7 @@ import { Person as IPerson } from "@nsdefs";
import { Server as IServer } from "@nsdefs";
import { workerScripts } from "../Netscript/WorkerScripts";
import { killWorkerScriptByPid } from "../Netscript/killWorkerScript";
import { serverMetadata } from "./data/servers";
/**
* Constructs a new server, while also ensuring that the new server
@@ -236,6 +237,15 @@ export function isBackdoorInstalled(server: BaseServer): boolean {
return false;
}
export function isBackdoorInstalledInCompanyServer(companyName: string): boolean {
const serverMeta = serverMetadata.find((s) => s.specialName === companyName);
const server = GetServer(serverMeta ? serverMeta.hostname : "");
if (!server) {
return false;
}
return isBackdoorInstalled(server);
}
export function getCoreBonus(cores = 1): number {
const coreBonus = 1 + (cores - 1) / 16;
return coreBonus;