mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-05-03 06:17:04 +02:00
ENUMS: Initial Enum Helper rework + Reorganization (#596)
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
export enum CompletedProgramName {
|
||||
nuke = "NUKE.exe",
|
||||
bruteSsh = "BruteSSH.exe",
|
||||
ftpCrack = "FTPCrack.exe",
|
||||
relaySmtp = "relaySMTP.exe",
|
||||
httpWorm = "HTTPWorm.exe",
|
||||
sqlInject = "SQLInject.exe",
|
||||
deepScan1 = "DeepscanV1.exe",
|
||||
deepScan2 = "DeepscanV2.exe",
|
||||
serverProfiler = "ServerProfiler.exe",
|
||||
autoLink = "AutoLink.exe",
|
||||
formulas = "Formulas.exe",
|
||||
bitFlume = "b1t_flum3.exe",
|
||||
flight = "fl1ght.exe",
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { CompletedProgramName } from "./Programs";
|
||||
import type { CompletedProgramName } from "@enums";
|
||||
import { ProgramFilePath, asProgramFilePath } from "../Paths/ProgramFilePath";
|
||||
import { BaseServer } from "../Server/BaseServer";
|
||||
|
||||
|
||||
@@ -1,23 +1,23 @@
|
||||
import { CompletedProgramName, Programs } from "./Programs";
|
||||
import { Program } from "./Program";
|
||||
|
||||
import { Player } from "@player";
|
||||
import { Program } from "./Program";
|
||||
import { Programs } from "./Programs";
|
||||
import { getRecordEntries } from "../Types/Record";
|
||||
|
||||
//Returns the programs this player can create.
|
||||
export function getAvailableCreatePrograms(): Program[] {
|
||||
const programs: Program[] = [];
|
||||
for (const program of Object.values(CompletedProgramName)) {
|
||||
const create = Programs[program].create;
|
||||
for (const [programName, program] of getRecordEntries(Programs)) {
|
||||
const create = program.create;
|
||||
// Non-creatable program
|
||||
if (create == null) continue;
|
||||
|
||||
// Already has program
|
||||
if (Player.hasProgram(program)) continue;
|
||||
if (Player.hasProgram(programName)) continue;
|
||||
|
||||
// Does not meet requirements
|
||||
if (!create.req()) continue;
|
||||
|
||||
programs.push(Programs[program]);
|
||||
programs.push(program);
|
||||
}
|
||||
|
||||
return programs;
|
||||
|
||||
@@ -10,7 +10,7 @@ import { formatMoney } from "../ui/formatNumber";
|
||||
import { BitNodeMultipliers } from "../BitNode/BitNodeMultipliers";
|
||||
import { BitFlumeEvent } from "../BitNode/ui/BitFlumeModal";
|
||||
import { calculateHackingTime, calculateGrowTime, calculateWeakenTime } from "../Hacking";
|
||||
import { FactionNames } from "../Faction/data/FactionNames";
|
||||
import { CompletedProgramName, FactionName } from "@enums";
|
||||
|
||||
function requireHackingLevel(lvl: number) {
|
||||
return function () {
|
||||
@@ -24,22 +24,6 @@ function bitFlumeRequirements() {
|
||||
};
|
||||
}
|
||||
|
||||
export enum CompletedProgramName {
|
||||
nuke = "NUKE.exe",
|
||||
bruteSsh = "BruteSSH.exe",
|
||||
ftpCrack = "FTPCrack.exe",
|
||||
relaySmtp = "relaySMTP.exe",
|
||||
httpWorm = "HTTPWorm.exe",
|
||||
sqlInject = "SQLInject.exe",
|
||||
deepScan1 = "DeepscanV1.exe",
|
||||
deepScan2 = "DeepscanV2.exe",
|
||||
serverProfiler = "ServerProfiler.exe",
|
||||
autoLink = "AutoLink.exe",
|
||||
formulas = "Formulas.exe",
|
||||
bitFlume = "b1t_flum3.exe",
|
||||
flight = "fl1ght.exe",
|
||||
}
|
||||
|
||||
export const Programs: Record<CompletedProgramName, Program> = {
|
||||
[CompletedProgramName.nuke]: new Program({
|
||||
name: CompletedProgramName.nuke,
|
||||
@@ -313,7 +297,7 @@ export const Programs: Record<CompletedProgramName, Program> = {
|
||||
}
|
||||
|
||||
Terminal.print("We will contact you.");
|
||||
Terminal.print(`-- ${FactionNames.Daedalus} --`);
|
||||
Terminal.print(`-- ${FactionName.Daedalus} --`);
|
||||
},
|
||||
}),
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user