diff --git a/jest.config.js b/jest.config.js index 92f04d6c5..6ab887724 100644 --- a/jest.config.js +++ b/jest.config.js @@ -12,6 +12,7 @@ module.exports = { "\\.(css|less)$": "/test/__mocks__/styleMock.js", "\\!!raw-loader!.*$": "/test/__mocks__/rawLoader.js", "@player": "/src/Player", + "@enums": "/src/Enums", "@nsdefs": "/src/ScriptEditor/NetscriptDefinitions", "^monaco-editor$": "/test/__mocks__/monacoMock.js", "^monaco-vim$": "/test/__mocks__/monacoMock.js", diff --git a/src/Achievements/Achievements.ts b/src/Achievements/Achievements.ts index 39e5af588..01caa65da 100644 --- a/src/Achievements/Achievements.ts +++ b/src/Achievements/Achievements.ts @@ -1,8 +1,17 @@ -import { AugmentationNames } from "../Augmentation/data/AugmentationNames"; +import type { PlayerObject } from "../PersonObjects/Player/PlayerObject"; + +import { + AugmentationName, + BlackOperationName, + CityName, + CompletedProgramName, + CorpUnlockName, + FactionName, + IndustryType, +} from "@enums"; import { SkillNames } from "../Bladeburner/data/SkillNames"; import { Skills } from "../Bladeburner/Skills"; import { CONSTANTS } from "../Constants"; -import { CorpUnlockName, IndustryType } from "../Corporation/data/Enums"; import { Exploit } from "../Exploits/Exploit"; import { Factions } from "../Faction/Factions"; import { AllGangs } from "../Gang/AllGangs"; @@ -11,22 +20,17 @@ import { HacknetNodeConstants, HacknetServerConstants } from "../Hacknet/data/Co import { hasHacknetServers } from "../Hacknet/HacknetHelpers"; import { HacknetNode } from "../Hacknet/HacknetNode"; import { HacknetServer } from "../Hacknet/HacknetServer"; -import { CityName } from "../Enums"; import { Player } from "@player"; -import { CompletedProgramName } from "../Programs/Programs"; import { GetAllServers, GetServer } from "../Server/AllServers"; import { SpecialServers } from "../Server/data/SpecialServers"; import { Server } from "../Server/Server"; import { Router } from "../ui/GameRoot"; import { Page } from "../ui/Router"; import data from "./AchievementData.json"; -import { FactionNames } from "../Faction/data/FactionNames"; -import { BlackOperationNames } from "../Bladeburner/data/BlackOperationNames"; import { isClassWork } from "../Work/ClassWork"; import { BitNodeMultipliers } from "../BitNode/BitNodeMultipliers"; import { workerScripts } from "../Netscript/WorkerScripts"; -import type { PlayerObject } from "../PersonObjects/Player/PlayerObject"; import { getRecordValues } from "../Types/Record"; // Unable to correctly cast the JSON data into AchievementDataJson type otherwise... @@ -62,7 +66,7 @@ function bitNodeFinishedState(): boolean { const wd = GetServer(SpecialServers.WorldDaemon); if (!(wd instanceof Server)) return false; if (wd.backdoorInstalled) return true; - return Player.bladeburner !== null && BlackOperationNames.OperationDaedalus in Player.bladeburner.blackops; + return Player.bladeburner !== null && BlackOperationName.OperationDaedalus in Player.bladeburner.blackops; } function hasAccessToSF(player: PlayerObject, bn: number): boolean { @@ -88,40 +92,40 @@ function sfAchievement(): Achievement[] { } export const achievements: Record = { - [FactionNames.CyberSec.toUpperCase()]: { - ...achievementData[FactionNames.CyberSec.toUpperCase()], + [FactionName.CyberSec.toUpperCase()]: { + ...achievementData[FactionName.CyberSec.toUpperCase()], Icon: "CSEC", - Condition: () => Player.factions.includes(FactionNames.CyberSec), + Condition: () => Player.factions.includes(FactionName.CyberSec), }, - [FactionNames.NiteSec.toUpperCase()]: { - ...achievementData[FactionNames.NiteSec.toUpperCase()], - Icon: FactionNames.NiteSec, - Condition: () => Player.factions.includes(FactionNames.NiteSec), + [FactionName.NiteSec.toUpperCase()]: { + ...achievementData[FactionName.NiteSec.toUpperCase()], + Icon: FactionName.NiteSec, + Condition: () => Player.factions.includes(FactionName.NiteSec), }, THE_BLACK_HAND: { ...achievementData.THE_BLACK_HAND, Icon: "TBH", - Condition: () => Player.factions.includes(FactionNames.TheBlackHand), + Condition: () => Player.factions.includes(FactionName.TheBlackHand), }, - [FactionNames.BitRunners.toUpperCase()]: { - ...achievementData[FactionNames.BitRunners.toUpperCase()], - Icon: FactionNames.BitRunners.toLowerCase(), - Condition: () => Player.factions.includes(FactionNames.BitRunners), + [FactionName.BitRunners.toUpperCase()]: { + ...achievementData[FactionName.BitRunners.toUpperCase()], + Icon: FactionName.BitRunners.toLowerCase(), + Condition: () => Player.factions.includes(FactionName.BitRunners), }, - [FactionNames.Daedalus.toUpperCase()]: { - ...achievementData[FactionNames.Daedalus.toUpperCase()], - Icon: FactionNames.Daedalus.toLowerCase(), - Condition: () => Player.factions.includes(FactionNames.Daedalus), + [FactionName.Daedalus.toUpperCase()]: { + ...achievementData[FactionName.Daedalus.toUpperCase()], + Icon: FactionName.Daedalus.toLowerCase(), + Condition: () => Player.factions.includes(FactionName.Daedalus), }, THE_COVENANT: { ...achievementData.THE_COVENANT, - Icon: FactionNames.TheCovenant.toLowerCase().replace(/ /g, ""), - Condition: () => Player.factions.includes(FactionNames.TheCovenant), + Icon: FactionName.TheCovenant.toLowerCase().replace(/ /g, ""), + Condition: () => Player.factions.includes(FactionName.TheCovenant), }, - [FactionNames.Illuminati.toUpperCase()]: { - ...achievementData[FactionNames.Illuminati.toUpperCase()], - Icon: FactionNames.Illuminati.toLowerCase(), - Condition: () => Player.factions.includes(FactionNames.Illuminati), + [FactionName.Illuminati.toUpperCase()]: { + ...achievementData[FactionName.Illuminati.toUpperCase()], + Icon: FactionName.Illuminati.toLowerCase(), + Condition: () => Player.factions.includes(FactionName.Illuminati), }, "BRUTESSH.EXE": { ...achievementData["BRUTESSH.EXE"], @@ -269,7 +273,7 @@ export const achievements: Record = { NEUROFLUX_255: { ...achievementData.NEUROFLUX_255, Icon: "nf255", - Condition: () => Player.augmentations.some((a) => a.name === AugmentationNames.NeuroFluxGovernor && a.level >= 255), + Condition: () => Player.augmentations.some((a) => a.name === AugmentationName.NeuroFluxGovernor && a.level >= 255), }, NS2: { ...achievementData.NS2, @@ -730,7 +734,7 @@ export const achievements: Record = { Condition: () => Player.bitNodeN === 13 && bitNodeFinishedState() && - !Player.augmentations.some((a) => a.name === AugmentationNames.StaneksGift1), + !Player.augmentations.some((a) => a.name === AugmentationName.StaneksGift1), }, DEVMENU: { ...achievementData.DEVMENU, diff --git a/src/Augmentation/Augmentation.tsx b/src/Augmentation/Augmentation.tsx index 4be7f1ea8..2e05332ef 100644 --- a/src/Augmentation/Augmentation.tsx +++ b/src/Augmentation/Augmentation.tsx @@ -1,16 +1,14 @@ // Class definition for a single Augmentation object import * as React from "react"; -import type { CompletedProgramName } from "../Programs/Programs"; +import { AugmentationName, CompletedProgramName, FactionName } from "@enums"; import { Faction } from "../Faction/Faction"; import { Factions } from "../Faction/Factions"; import { formatPercent } from "../ui/formatNumber"; import { Money } from "../ui/React/Money"; import { Generic_fromJSON, Generic_toJSON, IReviverValue, constructorsForReviver } from "../utils/JSONReviver"; -import { FactionNames } from "../Faction/data/FactionNames"; import { Player } from "@player"; -import { AugmentationNames } from "./data/AugmentationNames"; import { CONSTANTS } from "../Constants"; import { StaticAugmentations } from "./StaticAugmentations"; import { BitNodeMultipliers } from "../BitNode/BitNodeMultipliers"; @@ -532,7 +530,7 @@ export class Augmentation { let moneyCost = augmentationReference.baseCost; let repCost = augmentationReference.baseRepRequirement; - if (augmentationReference.name === AugmentationNames.NeuroFluxGovernor) { + if (augmentationReference.name === AugmentationName.NeuroFluxGovernor) { let nextLevel = this.getLevel(); --nextLevel; const multiplier = Math.pow(CONSTANTS.NeuroFluxGovernorLevelMult, nextLevel); @@ -542,7 +540,7 @@ export class Augmentation { for (let i = 0; i < Player.queuedAugmentations.length; ++i) { moneyCost *= getBaseAugmentationPriceMultiplier(); } - } else if (augmentationReference.factions.includes(FactionNames.ShadowsOfAnarchy)) { + } else if (augmentationReference.factions.includes(FactionName.ShadowsOfAnarchy)) { const soaAugmentationNames = initSoAAugmentations().map((augmentation) => augmentation.name); const soaAugCount = soaAugmentationNames.filter((augmentationName) => Player.hasAugmentation(augmentationName), @@ -563,17 +561,17 @@ export class Augmentation { getLevel(): number { // Get current Neuroflux level based on Player's augmentations - if (this.name === AugmentationNames.NeuroFluxGovernor) { + if (this.name === AugmentationName.NeuroFluxGovernor) { let currLevel = 0; for (let i = 0; i < Player.augmentations.length; ++i) { - if (Player.augmentations[i].name === AugmentationNames.NeuroFluxGovernor) { + if (Player.augmentations[i].name === AugmentationName.NeuroFluxGovernor) { currLevel = Player.augmentations[i].level; } } // Account for purchased but uninstalled Augmentations for (let i = 0; i < Player.queuedAugmentations.length; ++i) { - if (Player.queuedAugmentations[i].name == AugmentationNames.NeuroFluxGovernor) { + if (Player.queuedAugmentations[i].name == AugmentationName.NeuroFluxGovernor) { ++currLevel; } } diff --git a/src/Augmentation/AugmentationHelpers.tsx b/src/Augmentation/AugmentationHelpers.tsx index 13d007fd1..9aa547965 100644 --- a/src/Augmentation/AugmentationHelpers.tsx +++ b/src/Augmentation/AugmentationHelpers.tsx @@ -1,7 +1,7 @@ import { Augmentation } from "./Augmentation"; import { StaticAugmentations } from "./StaticAugmentations"; import { PlayerOwnedAugmentation } from "./PlayerOwnedAugmentation"; -import { AugmentationNames } from "./data/AugmentationNames"; +import { AugmentationName, FactionName } from "@enums"; import { CONSTANTS } from "../Constants"; import { Factions, factionExists } from "../Faction/Factions"; @@ -10,7 +10,6 @@ import { prestigeAugmentation } from "../Prestige"; import { dialogBoxCreate } from "../ui/React/DialogBox"; -import { FactionNames } from "../Faction/data/FactionNames"; import { initBladeburnerAugmentations, initChurchOfTheMachineGodAugmentations, @@ -34,8 +33,8 @@ function createAugmentations(): void { initUnstableCircadianModulator(), ...initGeneralAugmentations(), ...initSoAAugmentations(), - ...(factionExists(FactionNames.Bladeburners) ? initBladeburnerAugmentations() : []), - ...(factionExists(FactionNames.ChurchOfTheMachineGod) ? initChurchOfTheMachineGodAugmentations() : []), + ...(factionExists(FactionName.Bladeburners) ? initBladeburnerAugmentations() : []), + ...(factionExists(FactionName.ChurchOfTheMachineGod) ? initChurchOfTheMachineGodAugmentations() : []), ].map(resetAugmentation); } @@ -74,14 +73,14 @@ function applyAugmentation(aug: PlayerOwnedAugmentation, reapply = false): void Player.mults = mergeMultipliers(Player.mults, staticAugmentation.mults); // Special logic for Congruity Implant - if (aug.name === AugmentationNames.CongruityImplant && !reapply) { + if (aug.name === AugmentationName.CongruityImplant && !reapply) { Player.entropy = 0; Player.applyEntropy(Player.entropy); } // Special logic for NeuroFlux Governor - const ownedNfg = Player.augmentations.find((pAug) => pAug.name === AugmentationNames.NeuroFluxGovernor); - if (aug.name === AugmentationNames.NeuroFluxGovernor && !reapply && ownedNfg) { + const ownedNfg = Player.augmentations.find((pAug) => pAug.name === AugmentationName.NeuroFluxGovernor); + if (aug.name === AugmentationName.NeuroFluxGovernor && !reapply && ownedNfg) { ownedNfg.level = aug.level; return; } @@ -102,7 +101,7 @@ function installAugmentations(force?: boolean): boolean { let augmentationList = ""; let nfgIndex = -1; for (let i = Player.queuedAugmentations.length - 1; i >= 0; i--) { - if (Player.queuedAugmentations[i].name === AugmentationNames.NeuroFluxGovernor) { + if (Player.queuedAugmentations[i].name === AugmentationName.NeuroFluxGovernor) { nfgIndex = i; break; } @@ -116,10 +115,10 @@ function installAugmentations(force?: boolean): boolean { } applyAugmentation(Player.queuedAugmentations[i]); - if (ownedAug.name === AugmentationNames.NeuroFluxGovernor && i !== nfgIndex) continue; + if (ownedAug.name === AugmentationName.NeuroFluxGovernor && i !== nfgIndex) continue; let level = ""; - if (ownedAug.name === AugmentationNames.NeuroFluxGovernor) { + if (ownedAug.name === AugmentationName.NeuroFluxGovernor) { level = ` - ${ownedAug.level}`; } augmentationList += aug.name + level + "\n"; @@ -144,7 +143,7 @@ function augmentationExists(name: string): boolean { export function isRepeatableAug(aug: Augmentation | string): boolean { const augName = typeof aug === "string" ? aug : aug.name; - return augName === AugmentationNames.NeuroFluxGovernor; + return augName === AugmentationName.NeuroFluxGovernor; } export { installAugmentations, initAugmentations, applyAugmentation, augmentationExists }; diff --git a/src/Augmentation/data/AugmentationNames.ts b/src/Augmentation/Enums.ts similarity index 99% rename from src/Augmentation/data/AugmentationNames.ts rename to src/Augmentation/Enums.ts index 6abe4e0b8..c847d8eb4 100644 --- a/src/Augmentation/data/AugmentationNames.ts +++ b/src/Augmentation/Enums.ts @@ -1,4 +1,4 @@ -export enum AugmentationNames { +export enum AugmentationName { Targeting1 = "Augmented Targeting I", Targeting2 = "Augmented Targeting II", Targeting3 = "Augmented Targeting III", diff --git a/src/Augmentation/data/AugmentationCreator.tsx b/src/Augmentation/data/AugmentationCreator.tsx index c854192b6..38824b891 100644 --- a/src/Augmentation/data/AugmentationCreator.tsx +++ b/src/Augmentation/data/AugmentationCreator.tsx @@ -1,10 +1,8 @@ -import { Augmentation, IConstructorParams } from "../Augmentation"; -import { AugmentationNames } from "./AugmentationNames"; -import { Player } from "@player"; -import { CompletedProgramName } from "../../Programs/Programs"; -import { WHRNG } from "../../Casino/RNG"; import React from "react"; -import { FactionNames } from "../../Faction/data/FactionNames"; +import { Player } from "@player"; +import { AugmentationName, CompletedProgramName, FactionName } from "@enums"; +import { Augmentation, IConstructorParams } from "../Augmentation"; +import { WHRNG } from "../../Casino/RNG"; import { CONSTANTS } from "../../Constants"; interface CircadianBonus { @@ -130,11 +128,11 @@ function getRandomBonus(): CircadianBonus { export const initSoAAugmentations = (): Augmentation[] => [ new Augmentation({ - name: AugmentationNames.WKSharmonizer, + name: AugmentationName.WKSharmonizer, repCost: 1e4, moneyCost: 1e6, info: - `A copy of the WKS harmonizer from the MIA leader of the ${FactionNames.ShadowsOfAnarchy} ` + + `A copy of the WKS harmonizer from the MIA leader of the ${FactionName.ShadowsOfAnarchy} ` + "injects *Γ-based cells that provides general enhancement to the body.", stats: ( <> @@ -143,10 +141,10 @@ export const initSoAAugmentations = (): Augmentation[] => [ ), isSpecial: true, - factions: [FactionNames.ShadowsOfAnarchy], + factions: [FactionName.ShadowsOfAnarchy], }), new Augmentation({ - name: AugmentationNames.MightOfAres, + name: AugmentationName.MightOfAres, repCost: 1e4, moneyCost: 1e6, info: @@ -156,28 +154,28 @@ export const initSoAAugmentations = (): Augmentation[] => [ <>This augmentation makes the Slash minigame easier by showing you via an indicator when the slash in coming. ), isSpecial: true, - factions: [FactionNames.ShadowsOfAnarchy], + factions: [FactionName.ShadowsOfAnarchy], }), new Augmentation({ - name: AugmentationNames.WisdomOfAthena, + name: AugmentationName.WisdomOfAthena, repCost: 1e4, moneyCost: 1e6, info: "A connective brain implant to SASHA that focuses on pattern recognition and predictive templating.", stats: <>This augmentation makes the Bracket minigame easier by removing all '[' ']'., isSpecial: true, - factions: [FactionNames.ShadowsOfAnarchy], + factions: [FactionName.ShadowsOfAnarchy], }), new Augmentation({ - name: AugmentationNames.ChaosOfDionysus, + name: AugmentationName.ChaosOfDionysus, repCost: 1e4, moneyCost: 1e6, info: "Opto-occipito implant to process visual signals before brain interpretation.", stats: <>This augmentation makes the Backwards minigame easier by flipping the words., isSpecial: true, - factions: [FactionNames.ShadowsOfAnarchy], + factions: [FactionName.ShadowsOfAnarchy], }), new Augmentation({ - name: AugmentationNames.BeautyOfAphrodite, + name: AugmentationName.BeautyOfAphrodite, repCost: 1e4, moneyCost: 1e6, info: @@ -185,28 +183,28 @@ export const initSoAAugmentations = (): Augmentation[] => [ "make conversational partners more agreeable.", stats: <>This augmentation makes the Bribe minigame easier by indicating the incorrect paths., isSpecial: true, - factions: [FactionNames.ShadowsOfAnarchy], + factions: [FactionName.ShadowsOfAnarchy], }), new Augmentation({ - name: AugmentationNames.TrickeryOfHermes, + name: AugmentationName.TrickeryOfHermes, repCost: 1e4, moneyCost: 1e6, info: "Penta-dynamo-neurovascular-valve inserted in the carpal ligament, enhances dexterity.", stats: <>This augmentation makes the Cheat Code minigame easier by allowing the opposite character., isSpecial: true, - factions: [FactionNames.ShadowsOfAnarchy], + factions: [FactionName.ShadowsOfAnarchy], }), new Augmentation({ - name: AugmentationNames.FloodOfPoseidon, + name: AugmentationName.FloodOfPoseidon, repCost: 1e4, moneyCost: 1e6, info: "Transtinatium VVD reticulator used in optico-sterbing recognition.", stats: <>This augmentation makes the Symbol matching minigame easier by indicating the correct choice., isSpecial: true, - factions: [FactionNames.ShadowsOfAnarchy], + factions: [FactionName.ShadowsOfAnarchy], }), new Augmentation({ - name: AugmentationNames.HuntOfArtemis, + name: AugmentationName.HuntOfArtemis, repCost: 1e4, moneyCost: 1e6, info: "magneto-turboencabulator based on technology by Micha Eike Siemon, increases the user's electro-magnetic sensitivity.", @@ -217,22 +215,22 @@ export const initSoAAugmentations = (): Augmentation[] => [ ), isSpecial: true, - factions: [FactionNames.ShadowsOfAnarchy], + factions: [FactionName.ShadowsOfAnarchy], }), new Augmentation({ - name: AugmentationNames.KnowledgeOfApollo, + name: AugmentationName.KnowledgeOfApollo, repCost: 1e4, moneyCost: 1e6, info: "Neodynic retention fjengeln spoofer using -φ karmions, net positive effect on implantee's delta wave.", stats: <>This augmentation makes the Wire Cutting minigame easier by indicating the incorrect wires., isSpecial: true, - factions: [FactionNames.ShadowsOfAnarchy], + factions: [FactionName.ShadowsOfAnarchy], }), ]; export const initGeneralAugmentations = (): Augmentation[] => [ new Augmentation({ - name: AugmentationNames.HemoRecirculator, + name: AugmentationName.HemoRecirculator, moneyCost: 4.5e7, repCost: 1e4, info: "A heart implant that greatly increases the body's ability to effectively use and pump blood.", @@ -240,10 +238,10 @@ export const initGeneralAugmentations = (): Augmentation[] => [ defense: 1.08, agility: 1.08, dexterity: 1.08, - factions: [FactionNames.Tetrads, FactionNames.TheDarkArmy, FactionNames.TheSyndicate], + factions: [FactionName.Tetrads, FactionName.TheDarkArmy, FactionName.TheSyndicate], }), new Augmentation({ - name: AugmentationNames.Targeting1, + name: AugmentationName.Targeting1, moneyCost: 1.5e7, repCost: 5e3, info: @@ -251,52 +249,52 @@ export const initGeneralAugmentations = (): Augmentation[] => [ "and enhances balance and hand-eye coordination.", dexterity: 1.1, factions: [ - FactionNames.SlumSnakes, - FactionNames.TheDarkArmy, - FactionNames.TheSyndicate, - FactionNames.Sector12, - FactionNames.Ishima, - FactionNames.OmniTekIncorporated, - FactionNames.KuaiGongInternational, - FactionNames.BladeIndustries, + FactionName.SlumSnakes, + FactionName.TheDarkArmy, + FactionName.TheSyndicate, + FactionName.Sector12, + FactionName.Ishima, + FactionName.OmniTekIncorporated, + FactionName.KuaiGongInternational, + FactionName.BladeIndustries, ], }), new Augmentation({ - name: AugmentationNames.Targeting2, + name: AugmentationName.Targeting2, moneyCost: 4.25e7, repCost: 8.75e3, info: "This upgraded version of the 'Augmented Targeting' implant is capable of augmenting " + "reality by digitally displaying weaknesses and vital signs of threats.", - prereqs: [AugmentationNames.Targeting1], + prereqs: [AugmentationName.Targeting1], dexterity: 1.2, factions: [ - FactionNames.TheDarkArmy, - FactionNames.TheSyndicate, - FactionNames.Sector12, - FactionNames.OmniTekIncorporated, - FactionNames.KuaiGongInternational, - FactionNames.BladeIndustries, + FactionName.TheDarkArmy, + FactionName.TheSyndicate, + FactionName.Sector12, + FactionName.OmniTekIncorporated, + FactionName.KuaiGongInternational, + FactionName.BladeIndustries, ], }), new Augmentation({ - name: AugmentationNames.Targeting3, + name: AugmentationName.Targeting3, moneyCost: 1.15e8, repCost: 2.75e4, info: "The latest version of the 'Augmented Targeting' implant adds the ability to lock-on and track threats.", - prereqs: [AugmentationNames.Targeting2, AugmentationNames.Targeting1], + prereqs: [AugmentationName.Targeting2, AugmentationName.Targeting1], dexterity: 1.3, factions: [ - FactionNames.TheDarkArmy, - FactionNames.TheSyndicate, - FactionNames.OmniTekIncorporated, - FactionNames.KuaiGongInternational, - FactionNames.BladeIndustries, - FactionNames.TheCovenant, + FactionName.TheDarkArmy, + FactionName.TheSyndicate, + FactionName.OmniTekIncorporated, + FactionName.KuaiGongInternational, + FactionName.BladeIndustries, + FactionName.TheCovenant, ], }), new Augmentation({ - name: AugmentationNames.SyntheticHeart, + name: AugmentationName.SyntheticHeart, moneyCost: 2.875e9, repCost: 7.5e5, info: @@ -305,17 +303,17 @@ export const initGeneralAugmentations = (): Augmentation[] => [ agility: 1.5, strength: 1.5, factions: [ - FactionNames.KuaiGongInternational, - FactionNames.FulcrumSecretTechnologies, - FactionNames.SpeakersForTheDead, - FactionNames.NWO, - FactionNames.TheCovenant, - FactionNames.Daedalus, - FactionNames.Illuminati, + FactionName.KuaiGongInternational, + FactionName.FulcrumSecretTechnologies, + FactionName.SpeakersForTheDead, + FactionName.NWO, + FactionName.TheCovenant, + FactionName.Daedalus, + FactionName.Illuminati, ], }), new Augmentation({ - name: AugmentationNames.SynfibrilMuscle, + name: AugmentationName.SynfibrilMuscle, repCost: 4.375e5, moneyCost: 1.125e9, info: @@ -325,18 +323,18 @@ export const initGeneralAugmentations = (): Augmentation[] => [ strength: 1.3, defense: 1.3, factions: [ - FactionNames.KuaiGongInternational, - FactionNames.FulcrumSecretTechnologies, - FactionNames.SpeakersForTheDead, - FactionNames.NWO, - FactionNames.TheCovenant, - FactionNames.Daedalus, - FactionNames.Illuminati, - FactionNames.BladeIndustries, + FactionName.KuaiGongInternational, + FactionName.FulcrumSecretTechnologies, + FactionName.SpeakersForTheDead, + FactionName.NWO, + FactionName.TheCovenant, + FactionName.Daedalus, + FactionName.Illuminati, + FactionName.BladeIndustries, ], }), new Augmentation({ - name: AugmentationNames.CombatRib1, + name: AugmentationName.CombatRib1, repCost: 7.5e3, moneyCost: 2.375e7, info: @@ -345,56 +343,56 @@ export const initGeneralAugmentations = (): Augmentation[] => [ strength: 1.1, defense: 1.1, factions: [ - FactionNames.SlumSnakes, - FactionNames.TheDarkArmy, - FactionNames.TheSyndicate, - FactionNames.Volhaven, - FactionNames.Ishima, - FactionNames.OmniTekIncorporated, - FactionNames.KuaiGongInternational, - FactionNames.BladeIndustries, + FactionName.SlumSnakes, + FactionName.TheDarkArmy, + FactionName.TheSyndicate, + FactionName.Volhaven, + FactionName.Ishima, + FactionName.OmniTekIncorporated, + FactionName.KuaiGongInternational, + FactionName.BladeIndustries, ], }), new Augmentation({ - name: AugmentationNames.CombatRib2, + name: AugmentationName.CombatRib2, repCost: 1.875e4, moneyCost: 6.5e7, info: "An upgraded version of the 'Combat Rib' augmentation that adds potent stimulants which " + "improve focus and endurance while decreasing reaction time and fatigue.", - prereqs: [AugmentationNames.CombatRib1], + prereqs: [AugmentationName.CombatRib1], strength: 1.14, defense: 1.14, factions: [ - FactionNames.TheDarkArmy, - FactionNames.TheSyndicate, - FactionNames.Volhaven, - FactionNames.OmniTekIncorporated, - FactionNames.KuaiGongInternational, - FactionNames.BladeIndustries, + FactionName.TheDarkArmy, + FactionName.TheSyndicate, + FactionName.Volhaven, + FactionName.OmniTekIncorporated, + FactionName.KuaiGongInternational, + FactionName.BladeIndustries, ], }), new Augmentation({ - name: AugmentationNames.CombatRib3, + name: AugmentationName.CombatRib3, repCost: 3.5e4, moneyCost: 1.2e8, info: "The latest version of the 'Combat Rib' augmentation releases advanced anabolic steroids that " + "improve muscle mass and physical performance while being safe and free of side effects.", - prereqs: [AugmentationNames.CombatRib2, AugmentationNames.CombatRib1], + prereqs: [AugmentationName.CombatRib2, AugmentationName.CombatRib1], strength: 1.18, defense: 1.18, factions: [ - FactionNames.TheDarkArmy, - FactionNames.TheSyndicate, - FactionNames.OmniTekIncorporated, - FactionNames.KuaiGongInternational, - FactionNames.BladeIndustries, - FactionNames.TheCovenant, + FactionName.TheDarkArmy, + FactionName.TheSyndicate, + FactionName.OmniTekIncorporated, + FactionName.KuaiGongInternational, + FactionName.BladeIndustries, + FactionName.TheCovenant, ], }), new Augmentation({ - name: AugmentationNames.NanofiberWeave, + name: AugmentationName.NanofiberWeave, repCost: 3.75e4, moneyCost: 1.25e8, info: @@ -403,17 +401,17 @@ export const initGeneralAugmentations = (): Augmentation[] => [ strength: 1.2, defense: 1.2, factions: [ - FactionNames.TheDarkArmy, - FactionNames.TheSyndicate, - FactionNames.OmniTekIncorporated, - FactionNames.BladeIndustries, - FactionNames.TianDiHui, - FactionNames.SpeakersForTheDead, - FactionNames.FulcrumSecretTechnologies, + FactionName.TheDarkArmy, + FactionName.TheSyndicate, + FactionName.OmniTekIncorporated, + FactionName.BladeIndustries, + FactionName.TianDiHui, + FactionName.SpeakersForTheDead, + FactionName.FulcrumSecretTechnologies, ], }), new Augmentation({ - name: AugmentationNames.SubdermalArmor, + name: AugmentationName.SubdermalArmor, repCost: 8.75e5, moneyCost: 3.25e9, info: @@ -424,15 +422,15 @@ export const initGeneralAugmentations = (): Augmentation[] => [ "mitigate damage from any fire or electrical traumas.", defense: 2.2, factions: [ - FactionNames.TheSyndicate, - FactionNames.FulcrumSecretTechnologies, - FactionNames.Illuminati, - FactionNames.Daedalus, - FactionNames.TheCovenant, + FactionName.TheSyndicate, + FactionName.FulcrumSecretTechnologies, + FactionName.Illuminati, + FactionName.Daedalus, + FactionName.TheCovenant, ], }), new Augmentation({ - name: AugmentationNames.WiredReflexes, + name: AugmentationName.WiredReflexes, repCost: 1.25e3, moneyCost: 2.5e6, info: @@ -441,28 +439,28 @@ export const initGeneralAugmentations = (): Augmentation[] => [ agility: 1.05, dexterity: 1.05, factions: [ - FactionNames.TianDiHui, - FactionNames.SlumSnakes, - FactionNames.Sector12, - FactionNames.Volhaven, - FactionNames.Aevum, - FactionNames.Ishima, - FactionNames.TheSyndicate, - FactionNames.TheDarkArmy, - FactionNames.SpeakersForTheDead, + FactionName.TianDiHui, + FactionName.SlumSnakes, + FactionName.Sector12, + FactionName.Volhaven, + FactionName.Aevum, + FactionName.Ishima, + FactionName.TheSyndicate, + FactionName.TheDarkArmy, + FactionName.SpeakersForTheDead, ], }), new Augmentation({ - name: AugmentationNames.GrapheneBoneLacings, + name: AugmentationName.GrapheneBoneLacings, repCost: 1.125e6, moneyCost: 4.25e9, info: "Graphene is grafted and fused into the skeletal structure, enhancing bone density and tensile strength.", strength: 1.7, defense: 1.7, - factions: [FactionNames.FulcrumSecretTechnologies, FactionNames.TheCovenant], + factions: [FactionName.FulcrumSecretTechnologies, FactionName.TheCovenant], }), new Augmentation({ - name: AugmentationNames.BionicSpine, + name: AugmentationName.BionicSpine, repCost: 4.5e4, moneyCost: 1.25e8, info: @@ -475,54 +473,54 @@ export const initGeneralAugmentations = (): Augmentation[] => [ agility: 1.15, dexterity: 1.15, factions: [ - FactionNames.SpeakersForTheDead, - FactionNames.TheSyndicate, - FactionNames.KuaiGongInternational, - FactionNames.OmniTekIncorporated, - FactionNames.BladeIndustries, + FactionName.SpeakersForTheDead, + FactionName.TheSyndicate, + FactionName.KuaiGongInternational, + FactionName.OmniTekIncorporated, + FactionName.BladeIndustries, ], }), new Augmentation({ - name: AugmentationNames.GrapheneBionicSpine, + name: AugmentationName.GrapheneBionicSpine, repCost: 1.625e6, moneyCost: 6e9, info: "An upgrade to the 'Bionic Spine' augmentation. The spine is fused with graphene " + "which enhances durability and supercharges all body functions.", - prereqs: [AugmentationNames.BionicSpine], + prereqs: [AugmentationName.BionicSpine], strength: 1.6, defense: 1.6, agility: 1.6, dexterity: 1.6, - factions: [FactionNames.FulcrumSecretTechnologies, FactionNames.ECorp], + factions: [FactionName.FulcrumSecretTechnologies, FactionName.ECorp], }), new Augmentation({ - name: AugmentationNames.BionicLegs, + name: AugmentationName.BionicLegs, repCost: 1.5e5, moneyCost: 3.75e8, info: "Cybernetic legs, created from plasteel and carbon fibers, enhance running speed.", agility: 1.6, factions: [ - FactionNames.SpeakersForTheDead, - FactionNames.TheSyndicate, - FactionNames.KuaiGongInternational, - FactionNames.OmniTekIncorporated, - FactionNames.BladeIndustries, + FactionName.SpeakersForTheDead, + FactionName.TheSyndicate, + FactionName.KuaiGongInternational, + FactionName.OmniTekIncorporated, + FactionName.BladeIndustries, ], }), new Augmentation({ - name: AugmentationNames.GrapheneBionicLegs, + name: AugmentationName.GrapheneBionicLegs, repCost: 7.5e5, moneyCost: 4.5e9, info: "An upgrade to the 'Bionic Legs' augmentation. The legs are fused " + "with graphene, greatly enhancing jumping ability.", - prereqs: [AugmentationNames.BionicLegs], + prereqs: [AugmentationName.BionicLegs], agility: 2.5, - factions: [FactionNames.MegaCorp, FactionNames.ECorp, FactionNames.FulcrumSecretTechnologies], + factions: [FactionName.MegaCorp, FactionName.ECorp, FactionName.FulcrumSecretTechnologies], }), new Augmentation({ - name: AugmentationNames.SpeechProcessor, + name: AugmentationName.SpeechProcessor, repCost: 7.5e3, moneyCost: 5e7, info: @@ -531,18 +529,18 @@ export const initGeneralAugmentations = (): Augmentation[] => [ "and inflection, to pick up on subtle cues and aid in social interactions.", charisma: 1.2, factions: [ - FactionNames.TianDiHui, - FactionNames.Chongqing, - FactionNames.Sector12, - FactionNames.NewTokyo, - FactionNames.Aevum, - FactionNames.Ishima, - FactionNames.Volhaven, - FactionNames.Silhouette, + FactionName.TianDiHui, + FactionName.Chongqing, + FactionName.Sector12, + FactionName.NewTokyo, + FactionName.Aevum, + FactionName.Ishima, + FactionName.Volhaven, + FactionName.Silhouette, ], }), new Augmentation({ - name: AugmentationNames.TITN41Injection, + name: AugmentationName.TITN41Injection, repCost: 2.5e4, moneyCost: 1.9e8, info: @@ -551,10 +549,10 @@ export const initGeneralAugmentations = (): Augmentation[] => [ "outgoing and sociable.", charisma: 1.15, charisma_exp: 1.15, - factions: [FactionNames.Silhouette], + factions: [FactionName.Silhouette], }), new Augmentation({ - name: AugmentationNames.EnhancedSocialInteractionImplant, + name: AugmentationName.EnhancedSocialInteractionImplant, repCost: 3.75e5, moneyCost: 1.375e9, info: @@ -566,25 +564,25 @@ export const initGeneralAugmentations = (): Augmentation[] => [ charisma: 1.6, charisma_exp: 1.6, factions: [ - FactionNames.BachmanAssociates, - FactionNames.NWO, - FactionNames.ClarkeIncorporated, - FactionNames.OmniTekIncorporated, - FactionNames.FourSigma, + FactionName.BachmanAssociates, + FactionName.NWO, + FactionName.ClarkeIncorporated, + FactionName.OmniTekIncorporated, + FactionName.FourSigma, ], }), new Augmentation({ - name: AugmentationNames.BitWire, + name: AugmentationName.BitWire, repCost: 3.75e3, moneyCost: 1e7, info: "A small brain implant embedded in the cerebrum. This regulates and improves the brain's computing " + "capabilities.", hacking: 1.05, - factions: [FactionNames.CyberSec, FactionNames.NiteSec], + factions: [FactionName.CyberSec, FactionName.NiteSec], }), new Augmentation({ - name: AugmentationNames.ArtificialBioNeuralNetwork, + name: AugmentationName.ArtificialBioNeuralNetwork, repCost: 2.75e5, moneyCost: 3e9, info: @@ -596,10 +594,10 @@ export const initGeneralAugmentations = (): Augmentation[] => [ hacking_speed: 1.03, hacking_money: 1.15, hacking: 1.12, - factions: [FactionNames.BitRunners, FactionNames.FulcrumSecretTechnologies], + factions: [FactionName.BitRunners, FactionName.FulcrumSecretTechnologies], }), new Augmentation({ - name: AugmentationNames.ArtificialSynapticPotentiation, + name: AugmentationName.ArtificialSynapticPotentiation, repCost: 6.25e3, moneyCost: 8e7, info: @@ -608,10 +606,10 @@ export const initGeneralAugmentations = (): Augmentation[] => [ hacking_speed: 1.02, hacking_chance: 1.05, hacking_exp: 1.05, - factions: [FactionNames.TheBlackHand, FactionNames.NiteSec], + factions: [FactionName.TheBlackHand, FactionName.NiteSec], }), new Augmentation({ - name: AugmentationNames.EnhancedMyelinSheathing, + name: AugmentationName.EnhancedMyelinSheathing, repCost: 1e5, moneyCost: 1.375e9, info: @@ -622,30 +620,30 @@ export const initGeneralAugmentations = (): Augmentation[] => [ hacking_speed: 1.03, hacking_exp: 1.1, hacking: 1.08, - factions: [FactionNames.FulcrumSecretTechnologies, FactionNames.BitRunners, FactionNames.TheBlackHand], + factions: [FactionName.FulcrumSecretTechnologies, FactionName.BitRunners, FactionName.TheBlackHand], }), new Augmentation({ - name: AugmentationNames.SynapticEnhancement, + name: AugmentationName.SynapticEnhancement, repCost: 2e3, moneyCost: 7.5e6, info: "A small cranial implant that continuously uses weak electrical signals to stimulate the brain and " + "induce stronger synaptic activity. This improves the user's cognitive abilities.", hacking_speed: 1.03, - factions: [FactionNames.CyberSec, FactionNames.Aevum], + factions: [FactionName.CyberSec, FactionName.Aevum], }), new Augmentation({ - name: AugmentationNames.NeuralRetentionEnhancement, + name: AugmentationName.NeuralRetentionEnhancement, repCost: 2e4, moneyCost: 2.5e8, info: "Chemical injections are used to permanently alter and strengthen the brain's neuronal " + "circuits, strengthening the ability to retain information.", hacking_exp: 1.25, - factions: [FactionNames.NiteSec], + factions: [FactionName.NiteSec], }), new Augmentation({ - name: AugmentationNames.DataJack, + name: AugmentationName.DataJack, repCost: 1.125e5, moneyCost: 4.5e8, info: @@ -654,15 +652,15 @@ export const initGeneralAugmentations = (): Augmentation[] => [ "and delete it.", hacking_money: 1.25, factions: [ - FactionNames.BitRunners, - FactionNames.TheBlackHand, - FactionNames.NiteSec, - FactionNames.Chongqing, - FactionNames.NewTokyo, + FactionName.BitRunners, + FactionName.TheBlackHand, + FactionName.NiteSec, + FactionName.Chongqing, + FactionName.NewTokyo, ], }), new Augmentation({ - name: AugmentationNames.ENM, + name: AugmentationName.ENM, repCost: 1.5e4, moneyCost: 2.5e8, info: @@ -673,41 +671,41 @@ export const initGeneralAugmentations = (): Augmentation[] => [ "control the traffic on a network.", hacking: 1.08, factions: [ - FactionNames.BitRunners, - FactionNames.TheBlackHand, - FactionNames.NiteSec, - FactionNames.ECorp, - FactionNames.MegaCorp, - FactionNames.FulcrumSecretTechnologies, - FactionNames.NWO, - FactionNames.BladeIndustries, + FactionName.BitRunners, + FactionName.TheBlackHand, + FactionName.NiteSec, + FactionName.ECorp, + FactionName.MegaCorp, + FactionName.FulcrumSecretTechnologies, + FactionName.NWO, + FactionName.BladeIndustries, ], }), new Augmentation({ - name: AugmentationNames.ENMCore, + name: AugmentationName.ENMCore, repCost: 175e3, moneyCost: 2.5e9, info: "The Core library is an implant that upgrades the firmware of the Embedded Netburner Module. " + "This upgrade allows the Embedded Netburner Module to generate its own data on a network.", - prereqs: [AugmentationNames.ENM], + prereqs: [AugmentationName.ENM], hacking_speed: 1.03, hacking_money: 1.1, hacking_chance: 1.03, hacking_exp: 1.07, hacking: 1.07, factions: [ - FactionNames.BitRunners, - FactionNames.TheBlackHand, - FactionNames.ECorp, - FactionNames.MegaCorp, - FactionNames.FulcrumSecretTechnologies, - FactionNames.NWO, - FactionNames.BladeIndustries, + FactionName.BitRunners, + FactionName.TheBlackHand, + FactionName.ECorp, + FactionName.MegaCorp, + FactionName.FulcrumSecretTechnologies, + FactionName.NWO, + FactionName.BladeIndustries, ], }), new Augmentation({ - name: AugmentationNames.ENMCoreV2, + name: AugmentationName.ENMCoreV2, repCost: 1e6, moneyCost: 4.5e9, info: @@ -715,89 +713,89 @@ export const initGeneralAugmentations = (): Augmentation[] => [ "This upgraded firmware allows the Embedded Netburner Module to control information on " + "a network by re-routing traffic, spoofing IP addresses, and altering the data inside network " + "packets.", - prereqs: [AugmentationNames.ENMCore, AugmentationNames.ENM], + prereqs: [AugmentationName.ENMCore, AugmentationName.ENM], hacking_speed: 1.05, hacking_money: 1.3, hacking_chance: 1.05, hacking_exp: 1.15, hacking: 1.08, factions: [ - FactionNames.BitRunners, - FactionNames.ECorp, - FactionNames.MegaCorp, - FactionNames.FulcrumSecretTechnologies, - FactionNames.NWO, - FactionNames.BladeIndustries, - FactionNames.OmniTekIncorporated, - FactionNames.KuaiGongInternational, + FactionName.BitRunners, + FactionName.ECorp, + FactionName.MegaCorp, + FactionName.FulcrumSecretTechnologies, + FactionName.NWO, + FactionName.BladeIndustries, + FactionName.OmniTekIncorporated, + FactionName.KuaiGongInternational, ], }), new Augmentation({ - name: AugmentationNames.ENMCoreV3, + name: AugmentationName.ENMCoreV3, repCost: 1.75e6, moneyCost: 7.5e9, info: "The Core V3 library is an implant that upgrades the firmware of the Embedded Netburner Module. " + "This upgraded firmware allows the Embedded Netburner Module to seamlessly inject code into " + "any device on a network.", - prereqs: [AugmentationNames.ENMCoreV2, AugmentationNames.ENMCore, AugmentationNames.ENM], + prereqs: [AugmentationName.ENMCoreV2, AugmentationName.ENMCore, AugmentationName.ENM], hacking_speed: 1.05, hacking_money: 1.4, hacking_chance: 1.1, hacking_exp: 1.25, hacking: 1.1, factions: [ - FactionNames.ECorp, - FactionNames.MegaCorp, - FactionNames.FulcrumSecretTechnologies, - FactionNames.NWO, - FactionNames.Daedalus, - FactionNames.TheCovenant, - FactionNames.Illuminati, + FactionName.ECorp, + FactionName.MegaCorp, + FactionName.FulcrumSecretTechnologies, + FactionName.NWO, + FactionName.Daedalus, + FactionName.TheCovenant, + FactionName.Illuminati, ], }), new Augmentation({ - name: AugmentationNames.ENMAnalyzeEngine, + name: AugmentationName.ENMAnalyzeEngine, repCost: 6.25e5, moneyCost: 6e9, info: "Installs the Analyze Engine for the Embedded Netburner Module, which is a CPU cluster " + "that vastly outperforms the Netburner Module's native single-core processor.", - prereqs: [AugmentationNames.ENM], + prereqs: [AugmentationName.ENM], hacking_speed: 1.1, factions: [ - FactionNames.ECorp, - FactionNames.MegaCorp, - FactionNames.FulcrumSecretTechnologies, - FactionNames.NWO, - FactionNames.Daedalus, - FactionNames.TheCovenant, - FactionNames.Illuminati, + FactionName.ECorp, + FactionName.MegaCorp, + FactionName.FulcrumSecretTechnologies, + FactionName.NWO, + FactionName.Daedalus, + FactionName.TheCovenant, + FactionName.Illuminati, ], }), new Augmentation({ - name: AugmentationNames.ENMDMA, + name: AugmentationName.ENMDMA, repCost: 1e6, moneyCost: 7e9, info: "This implant installs a Direct Memory Access (DMA) controller into the " + "Embedded Netburner Module. This allows the Module to send and receive data " + "directly to and from the main memory of devices on a network.", - prereqs: [AugmentationNames.ENM], + prereqs: [AugmentationName.ENM], hacking_money: 1.4, hacking_chance: 1.2, factions: [ - FactionNames.ECorp, - FactionNames.MegaCorp, - FactionNames.FulcrumSecretTechnologies, - FactionNames.NWO, - FactionNames.Daedalus, - FactionNames.TheCovenant, - FactionNames.Illuminati, + FactionName.ECorp, + FactionName.MegaCorp, + FactionName.FulcrumSecretTechnologies, + FactionName.NWO, + FactionName.Daedalus, + FactionName.TheCovenant, + FactionName.Illuminati, ], }), new Augmentation({ - name: AugmentationNames.Neuralstimulator, + name: AugmentationName.Neuralstimulator, repCost: 5e4, moneyCost: 3e9, info: @@ -807,20 +805,20 @@ export const initGeneralAugmentations = (): Augmentation[] => [ hacking_chance: 1.1, hacking_exp: 1.12, factions: [ - FactionNames.TheBlackHand, - FactionNames.Chongqing, - FactionNames.Sector12, - FactionNames.NewTokyo, - FactionNames.Aevum, - FactionNames.Ishima, - FactionNames.Volhaven, - FactionNames.BachmanAssociates, - FactionNames.ClarkeIncorporated, - FactionNames.FourSigma, + FactionName.TheBlackHand, + FactionName.Chongqing, + FactionName.Sector12, + FactionName.NewTokyo, + FactionName.Aevum, + FactionName.Ishima, + FactionName.Volhaven, + FactionName.BachmanAssociates, + FactionName.ClarkeIncorporated, + FactionName.FourSigma, ], }), new Augmentation({ - name: AugmentationNames.NeuralAccelerator, + name: AugmentationName.NeuralAccelerator, repCost: 2e5, moneyCost: 1.75e9, info: @@ -829,10 +827,10 @@ export const initGeneralAugmentations = (): Augmentation[] => [ hacking: 1.1, hacking_exp: 1.15, hacking_money: 1.2, - factions: [FactionNames.BitRunners], + factions: [FactionName.BitRunners], }), new Augmentation({ - name: AugmentationNames.CranialSignalProcessorsG1, + name: AugmentationName.CranialSignalProcessorsG1, repCost: 1e4, moneyCost: 7e7, info: @@ -842,10 +840,10 @@ export const initGeneralAugmentations = (): Augmentation[] => [ "so that the brain doesn't have to.", hacking_speed: 1.01, hacking: 1.05, - factions: [FactionNames.CyberSec, FactionNames.NiteSec], + factions: [FactionName.CyberSec, FactionName.NiteSec], }), new Augmentation({ - name: AugmentationNames.CranialSignalProcessorsG2, + name: AugmentationName.CranialSignalProcessorsG2, repCost: 1.875e4, moneyCost: 1.25e8, info: @@ -853,14 +851,14 @@ export const initGeneralAugmentations = (): Augmentation[] => [ "are a set of specialized microprocessors that are attached to " + "neurons in the brain. These chips process neural signals to quickly and automatically perform specific computations " + "so that the brain doesn't have to.", - prereqs: [AugmentationNames.CranialSignalProcessorsG1], + prereqs: [AugmentationName.CranialSignalProcessorsG1], hacking_speed: 1.02, hacking_chance: 1.05, hacking: 1.07, - factions: [FactionNames.CyberSec, FactionNames.NiteSec], + factions: [FactionName.CyberSec, FactionName.NiteSec], }), new Augmentation({ - name: AugmentationNames.CranialSignalProcessorsG3, + name: AugmentationName.CranialSignalProcessorsG3, repCost: 5e4, moneyCost: 5.5e8, info: @@ -868,14 +866,14 @@ export const initGeneralAugmentations = (): Augmentation[] => [ "are a set of specialized microprocessors that are attached to " + "neurons in the brain. These chips process neural signals to quickly and automatically perform specific computations " + "so that the brain doesn't have to.", - prereqs: [AugmentationNames.CranialSignalProcessorsG2, AugmentationNames.CranialSignalProcessorsG1], + prereqs: [AugmentationName.CranialSignalProcessorsG2, AugmentationName.CranialSignalProcessorsG1], hacking_speed: 1.02, hacking_money: 1.15, hacking: 1.09, - factions: [FactionNames.NiteSec, FactionNames.TheBlackHand, FactionNames.BitRunners], + factions: [FactionName.NiteSec, FactionName.TheBlackHand, FactionName.BitRunners], }), new Augmentation({ - name: AugmentationNames.CranialSignalProcessorsG4, + name: AugmentationName.CranialSignalProcessorsG4, repCost: 1.25e5, moneyCost: 1.1e9, info: @@ -884,17 +882,17 @@ export const initGeneralAugmentations = (): Augmentation[] => [ "neurons in the brain. These chips process neural signals to quickly and automatically perform specific computations " + "so that the brain doesn't have to.", prereqs: [ - AugmentationNames.CranialSignalProcessorsG3, - AugmentationNames.CranialSignalProcessorsG2, - AugmentationNames.CranialSignalProcessorsG1, + AugmentationName.CranialSignalProcessorsG3, + AugmentationName.CranialSignalProcessorsG2, + AugmentationName.CranialSignalProcessorsG1, ], hacking_speed: 1.02, hacking_money: 1.2, hacking_grow: 1.25, - factions: [FactionNames.TheBlackHand, FactionNames.BitRunners], + factions: [FactionName.TheBlackHand, FactionName.BitRunners], }), new Augmentation({ - name: AugmentationNames.CranialSignalProcessorsG5, + name: AugmentationName.CranialSignalProcessorsG5, repCost: 2.5e5, moneyCost: 2.25e9, info: @@ -903,18 +901,18 @@ export const initGeneralAugmentations = (): Augmentation[] => [ "neurons in the brain. These chips process neural signals to quickly and automatically perform specific computations " + "so that the brain doesn't have to.", prereqs: [ - AugmentationNames.CranialSignalProcessorsG4, - AugmentationNames.CranialSignalProcessorsG3, - AugmentationNames.CranialSignalProcessorsG2, - AugmentationNames.CranialSignalProcessorsG1, + AugmentationName.CranialSignalProcessorsG4, + AugmentationName.CranialSignalProcessorsG3, + AugmentationName.CranialSignalProcessorsG2, + AugmentationName.CranialSignalProcessorsG1, ], hacking: 1.3, hacking_money: 1.25, hacking_grow: 1.75, - factions: [FactionNames.BitRunners], + factions: [FactionName.BitRunners], }), new Augmentation({ - name: AugmentationNames.NeuronalDensification, + name: AugmentationName.NeuronalDensification, repCost: 1.875e5, moneyCost: 1.375e9, info: @@ -924,10 +922,10 @@ export const initGeneralAugmentations = (): Augmentation[] => [ hacking: 1.15, hacking_exp: 1.1, hacking_speed: 1.03, - factions: [FactionNames.ClarkeIncorporated], + factions: [FactionName.ClarkeIncorporated], }), new Augmentation({ - name: AugmentationNames.NuoptimalInjectorImplant, + name: AugmentationName.NuoptimalInjectorImplant, repCost: 5e3, moneyCost: 2e7, info: @@ -936,17 +934,17 @@ export const initGeneralAugmentations = (): Augmentation[] => [ "cognitive enhancements.", company_rep: 1.2, factions: [ - FactionNames.TianDiHui, - FactionNames.Volhaven, - FactionNames.NewTokyo, - FactionNames.Chongqing, - FactionNames.ClarkeIncorporated, - FactionNames.FourSigma, - FactionNames.BachmanAssociates, + FactionName.TianDiHui, + FactionName.Volhaven, + FactionName.NewTokyo, + FactionName.Chongqing, + FactionName.ClarkeIncorporated, + FactionName.FourSigma, + FactionName.BachmanAssociates, ], }), new Augmentation({ - name: AugmentationNames.SpeechEnhancement, + name: AugmentationName.SpeechEnhancement, repCost: 2.5e3, moneyCost: 1.25e7, info: @@ -956,16 +954,16 @@ export const initGeneralAugmentations = (): Augmentation[] => [ company_rep: 1.1, charisma: 1.1, factions: [ - FactionNames.TianDiHui, - FactionNames.SpeakersForTheDead, - FactionNames.FourSigma, - FactionNames.KuaiGongInternational, - FactionNames.ClarkeIncorporated, - FactionNames.BachmanAssociates, + FactionName.TianDiHui, + FactionName.SpeakersForTheDead, + FactionName.FourSigma, + FactionName.KuaiGongInternational, + FactionName.ClarkeIncorporated, + FactionName.BachmanAssociates, ], }), new Augmentation({ - name: AugmentationNames.FocusWire, + name: AugmentationName.FocusWire, repCost: 7.5e4, moneyCost: 9e8, info: "A cranial implant that stops procrastination by blocking specific neural pathways in the brain.", @@ -978,14 +976,14 @@ export const initGeneralAugmentations = (): Augmentation[] => [ company_rep: 1.1, work_money: 1.2, factions: [ - FactionNames.BachmanAssociates, - FactionNames.ClarkeIncorporated, - FactionNames.FourSigma, - FactionNames.KuaiGongInternational, + FactionName.BachmanAssociates, + FactionName.ClarkeIncorporated, + FactionName.FourSigma, + FactionName.KuaiGongInternational, ], }), new Augmentation({ - name: AugmentationNames.PCDNI, + name: AugmentationName.PCDNI, repCost: 3.75e5, moneyCost: 3.75e9, info: @@ -994,28 +992,23 @@ export const initGeneralAugmentations = (): Augmentation[] => [ "it using the brain's electrochemical signals.", company_rep: 1.3, hacking: 1.08, - factions: [ - FactionNames.FourSigma, - FactionNames.OmniTekIncorporated, - FactionNames.ECorp, - FactionNames.BladeIndustries, - ], + factions: [FactionName.FourSigma, FactionName.OmniTekIncorporated, FactionName.ECorp, FactionName.BladeIndustries], }), new Augmentation({ - name: AugmentationNames.PCDNIOptimizer, + name: AugmentationName.PCDNIOptimizer, repCost: 5e5, moneyCost: 4.5e9, info: "This is a submodule upgrade to the PC Direct-Neural Interface augmentation. It " + "improves the performance of the interface and gives the user more control options " + "to a connected computer.", - prereqs: [AugmentationNames.PCDNI], + prereqs: [AugmentationName.PCDNI], company_rep: 1.75, hacking: 1.1, - factions: [FactionNames.FulcrumSecretTechnologies, FactionNames.ECorp, FactionNames.BladeIndustries], + factions: [FactionName.FulcrumSecretTechnologies, FactionName.ECorp, FactionName.BladeIndustries], }), new Augmentation({ - name: AugmentationNames.PCDNINeuralNetwork, + name: AugmentationName.PCDNINeuralNetwork, repCost: 1.5e6, moneyCost: 7.5e9, info: @@ -1023,14 +1016,14 @@ export const initGeneralAugmentations = (): Augmentation[] => [ "PC Direct-Neural Interface augmentation. When connected to a computer, " + "the Neural Network upgrade allows the user to use their own brain's " + "processing power to aid the computer in computational tasks.", - prereqs: [AugmentationNames.PCDNI], + prereqs: [AugmentationName.PCDNI], company_rep: 2, hacking: 1.1, hacking_speed: 1.05, - factions: [FactionNames.FulcrumSecretTechnologies], + factions: [FactionName.FulcrumSecretTechnologies], }), new Augmentation({ - name: AugmentationNames.ADRPheromone1, + name: AugmentationName.ADRPheromone1, repCost: 3.75e3, moneyCost: 1.75e7, info: @@ -1040,15 +1033,15 @@ export const initGeneralAugmentations = (): Augmentation[] => [ company_rep: 1.1, faction_rep: 1.1, factions: [ - FactionNames.TianDiHui, - FactionNames.TheSyndicate, - FactionNames.NWO, - FactionNames.MegaCorp, - FactionNames.FourSigma, + FactionName.TianDiHui, + FactionName.TheSyndicate, + FactionName.NWO, + FactionName.MegaCorp, + FactionName.FourSigma, ], }), new Augmentation({ - name: AugmentationNames.ADRPheromone2, + name: AugmentationName.ADRPheromone2, repCost: 6.25e4, moneyCost: 5.5e8, info: @@ -1058,14 +1051,14 @@ export const initGeneralAugmentations = (): Augmentation[] => [ company_rep: 1.2, faction_rep: 1.2, factions: [ - FactionNames.Silhouette, - FactionNames.FourSigma, - FactionNames.BachmanAssociates, - FactionNames.ClarkeIncorporated, + FactionName.Silhouette, + FactionName.FourSigma, + FactionName.BachmanAssociates, + FactionName.ClarkeIncorporated, ], }), new Augmentation({ - name: AugmentationNames.ShadowsSimulacrum, + name: AugmentationName.ShadowsSimulacrum, repCost: 3.75e4, moneyCost: 4e8, info: @@ -1076,10 +1069,10 @@ export const initGeneralAugmentations = (): Augmentation[] => [ "espionage and surveillance work.", company_rep: 1.15, faction_rep: 1.15, - factions: [FactionNames.TheSyndicate, FactionNames.TheDarkArmy, FactionNames.SpeakersForTheDead], + factions: [FactionName.TheSyndicate, FactionName.TheDarkArmy, FactionName.SpeakersForTheDead], }), new Augmentation({ - name: AugmentationNames.HacknetNodeCPUUpload, + name: AugmentationName.HacknetNodeCPUUpload, repCost: 3.75e3, moneyCost: 1.1e7, info: @@ -1088,10 +1081,10 @@ export const initGeneralAugmentations = (): Augmentation[] => [ "for the Hacknet Node that provides better performance.", hacknet_node_money: 1.15, hacknet_node_purchase_cost: 0.85, - factions: [FactionNames.Netburners], + factions: [FactionName.Netburners], }), new Augmentation({ - name: AugmentationNames.HacknetNodeCacheUpload, + name: AugmentationName.HacknetNodeCacheUpload, repCost: 2.5e3, moneyCost: 5.5e6, info: @@ -1100,10 +1093,10 @@ export const initGeneralAugmentations = (): Augmentation[] => [ "Hacknet Node that offers better performance.", hacknet_node_money: 1.1, hacknet_node_level_cost: 0.85, - factions: [FactionNames.Netburners], + factions: [FactionName.Netburners], }), new Augmentation({ - name: AugmentationNames.HacknetNodeNICUpload, + name: AugmentationName.HacknetNodeNICUpload, repCost: 1.875e3, moneyCost: 4.5e6, info: @@ -1112,10 +1105,10 @@ export const initGeneralAugmentations = (): Augmentation[] => [ "offers better performance.", hacknet_node_money: 1.1, hacknet_node_purchase_cost: 0.9, - factions: [FactionNames.Netburners], + factions: [FactionName.Netburners], }), new Augmentation({ - name: AugmentationNames.HacknetNodeKernelDNI, + name: AugmentationName.HacknetNodeKernelDNI, repCost: 7.5e3, moneyCost: 4e7, info: @@ -1123,10 +1116,10 @@ export const initGeneralAugmentations = (): Augmentation[] => [ "Hacknet Node. This lets the user access and manipulate the Node's kernel using " + "electrochemical signals.", hacknet_node_money: 1.25, - factions: [FactionNames.Netburners], + factions: [FactionName.Netburners], }), new Augmentation({ - name: AugmentationNames.HacknetNodeCoreDNI, + name: AugmentationName.HacknetNodeCoreDNI, repCost: 1.25e4, moneyCost: 6e7, info: @@ -1134,10 +1127,10 @@ export const initGeneralAugmentations = (): Augmentation[] => [ "to a Hacknet Node. This lets the user access and manipulate the Node's processing logic using " + "electrochemical signals.", hacknet_node_money: 1.45, - factions: [FactionNames.Netburners], + factions: [FactionName.Netburners], }), new Augmentation({ - name: AugmentationNames.Neurotrainer1, + name: AugmentationName.Neurotrainer1, repCost: 1e3, moneyCost: 4e6, info: @@ -1151,10 +1144,10 @@ export const initGeneralAugmentations = (): Augmentation[] => [ dexterity_exp: 1.1, agility_exp: 1.1, charisma_exp: 1.1, - factions: [FactionNames.CyberSec, FactionNames.Aevum], + factions: [FactionName.CyberSec, FactionName.Aevum], }), new Augmentation({ - name: AugmentationNames.Neurotrainer2, + name: AugmentationName.Neurotrainer2, repCost: 1e4, moneyCost: 4.5e7, info: @@ -1167,10 +1160,10 @@ export const initGeneralAugmentations = (): Augmentation[] => [ dexterity_exp: 1.15, agility_exp: 1.15, charisma_exp: 1.15, - factions: [FactionNames.BitRunners, FactionNames.NiteSec], + factions: [FactionName.BitRunners, FactionName.NiteSec], }), new Augmentation({ - name: AugmentationNames.Neurotrainer3, + name: AugmentationName.Neurotrainer3, repCost: 2.5e4, moneyCost: 1.3e8, info: @@ -1183,10 +1176,10 @@ export const initGeneralAugmentations = (): Augmentation[] => [ dexterity_exp: 1.2, agility_exp: 1.2, charisma_exp: 1.2, - factions: [FactionNames.NWO, FactionNames.FourSigma], + factions: [FactionName.NWO, FactionName.FourSigma], }), new Augmentation({ - name: AugmentationNames.Hypersight, + name: AugmentationName.Hypersight, repCost: 1.5e5, moneyCost: 2.75e9, info: @@ -1196,10 +1189,10 @@ export const initGeneralAugmentations = (): Augmentation[] => [ dexterity: 1.4, hacking_speed: 1.03, hacking_money: 1.1, - factions: [FactionNames.BladeIndustries, FactionNames.KuaiGongInternational], + factions: [FactionName.BladeIndustries, FactionName.KuaiGongInternational], }), new Augmentation({ - name: AugmentationNames.LuminCloaking1, + name: AugmentationName.LuminCloaking1, repCost: 1.5e3, moneyCost: 5e6, info: @@ -1208,10 +1201,10 @@ export const initGeneralAugmentations = (): Augmentation[] => [ "around the skin, making the user much harder to see with the naked eye.", agility: 1.05, crime_money: 1.1, - factions: [FactionNames.SlumSnakes, FactionNames.Tetrads], + factions: [FactionName.SlumSnakes, FactionName.Tetrads], }), new Augmentation({ - name: AugmentationNames.LuminCloaking2, + name: AugmentationName.LuminCloaking2, repCost: 5e3, moneyCost: 3e7, info: @@ -1219,24 +1212,24 @@ export const initGeneralAugmentations = (): Augmentation[] => [ "reinforces the skin with highly-advanced synthetic cells. These " + "cells, when powered, are capable of not only bending light but also of bending heat, " + "making the user more resilient as well as stealthy.", - prereqs: [AugmentationNames.LuminCloaking1], + prereqs: [AugmentationName.LuminCloaking1], agility: 1.1, defense: 1.1, crime_money: 1.25, - factions: [FactionNames.SlumSnakes, FactionNames.Tetrads], + factions: [FactionName.SlumSnakes, FactionName.Tetrads], }), new Augmentation({ - name: AugmentationNames.SmartSonar, + name: AugmentationName.SmartSonar, repCost: 2.25e4, moneyCost: 7.5e7, info: "A cochlear implant that helps the player detect and locate enemies using sound propagation.", dexterity: 1.1, dexterity_exp: 1.15, crime_money: 1.25, - factions: [FactionNames.SlumSnakes], + factions: [FactionName.SlumSnakes], }), new Augmentation({ - name: AugmentationNames.PowerRecirculator, + name: AugmentationName.PowerRecirculator, repCost: 2.5e4, moneyCost: 1.8e8, info: @@ -1255,24 +1248,24 @@ export const initGeneralAugmentations = (): Augmentation[] => [ dexterity_exp: 1.1, agility_exp: 1.1, charisma_exp: 1.1, - factions: [FactionNames.Tetrads, FactionNames.TheDarkArmy, FactionNames.TheSyndicate, FactionNames.NWO], + factions: [FactionName.Tetrads, FactionName.TheDarkArmy, FactionName.TheSyndicate, FactionName.NWO], }), new Augmentation({ - name: AugmentationNames.QLink, + name: AugmentationName.QLink, repCost: 1.875e6, moneyCost: 2.5e13, info: - `A brain implant that wirelessly connects you to the ${FactionNames.Illuminati}'s ` + + `A brain implant that wirelessly connects you to the ${FactionName.Illuminati}'s ` + "quantum supercomputer, allowing you to access and use its incredible " + "computing power.", hacking: 1.75, hacking_speed: 2, hacking_chance: 2.5, hacking_money: 4, - factions: [FactionNames.Illuminati], + factions: [FactionName.Illuminati], }), new Augmentation({ - name: AugmentationNames.SPTN97, + name: AugmentationName.SPTN97, repCost: 1.25e6, moneyCost: 4.875e9, info: @@ -1285,31 +1278,31 @@ export const initGeneralAugmentations = (): Augmentation[] => [ dexterity: 1.75, agility: 1.75, hacking: 1.15, - factions: [FactionNames.TheCovenant], + factions: [FactionName.TheCovenant], }), new Augmentation({ - name: AugmentationNames.HiveMind, + name: AugmentationName.HiveMind, repCost: 1.5e6, moneyCost: 5.5e9, info: - `A brain implant developed by ${FactionNames.ECorp}. They do not reveal what ` + + `A brain implant developed by ${FactionName.ECorp}. They do not reveal what ` + "exactly the implant does, but they promise that it will greatly " + "enhance your abilities.", hacking_grow: 3, stats: null, - factions: [FactionNames.ECorp], + factions: [FactionName.ECorp], }), new Augmentation({ - name: AugmentationNames.TheRedPill, + name: AugmentationName.TheRedPill, repCost: 2.5e6, moneyCost: 0, info: "It's time to leave the cave.", stats: null, isSpecial: true, - factions: [FactionNames.Daedalus], + factions: [FactionName.Daedalus], }), new Augmentation({ - name: AugmentationNames.CordiARCReactor, + name: AugmentationName.CordiARCReactor, repCost: 1.125e6, moneyCost: 5e9, info: @@ -1325,10 +1318,10 @@ export const initGeneralAugmentations = (): Augmentation[] => [ defense_exp: 1.35, dexterity_exp: 1.35, agility_exp: 1.35, - factions: [FactionNames.MegaCorp], + factions: [FactionName.MegaCorp], }), new Augmentation({ - name: AugmentationNames.SmartJaw, + name: AugmentationName.SmartJaw, repCost: 3.75e5, moneyCost: 2.75e9, info: @@ -1339,10 +1332,10 @@ export const initGeneralAugmentations = (): Augmentation[] => [ charisma_exp: 1.5, company_rep: 1.25, faction_rep: 1.25, - factions: [FactionNames.BachmanAssociates], + factions: [FactionName.BachmanAssociates], }), new Augmentation({ - name: AugmentationNames.Neotra, + name: AugmentationName.Neotra, repCost: 5.625e5, moneyCost: 2.875e9, info: @@ -1352,10 +1345,10 @@ export const initGeneralAugmentations = (): Augmentation[] => [ "and restructure themselves.", strength: 1.55, defense: 1.55, - factions: [FactionNames.BladeIndustries], + factions: [FactionName.BladeIndustries], }), new Augmentation({ - name: AugmentationNames.Xanipher, + name: AugmentationName.Xanipher, repCost: 8.75e5, moneyCost: 4.25e9, info: @@ -1374,10 +1367,10 @@ export const initGeneralAugmentations = (): Augmentation[] => [ dexterity_exp: 1.15, agility_exp: 1.15, charisma_exp: 1.15, - factions: [FactionNames.NWO], + factions: [FactionName.NWO], }), new Augmentation({ - name: AugmentationNames.HydroflameLeftArm, + name: AugmentationName.HydroflameLeftArm, repCost: 1.25e6, moneyCost: 2.5e12, info: @@ -1386,10 +1379,10 @@ export const initGeneralAugmentations = (): Augmentation[] => [ "Even though it contains no weapons, the advanced tungsten titanium " + "alloy increases the user's strength to unbelievable levels.", strength: 2.8, - factions: [FactionNames.NWO], + factions: [FactionName.NWO], }), new Augmentation({ - name: AugmentationNames.nextSENS, + name: AugmentationName.nextSENS, repCost: 4.375e5, moneyCost: 1.925e9, info: @@ -1402,10 +1395,10 @@ export const initGeneralAugmentations = (): Augmentation[] => [ dexterity: 1.2, agility: 1.2, charisma: 1.2, - factions: [FactionNames.ClarkeIncorporated], + factions: [FactionName.ClarkeIncorporated], }), new Augmentation({ - name: AugmentationNames.OmniTekInfoLoad, + name: AugmentationName.OmniTekInfoLoad, repCost: 6.25e5, moneyCost: 2.875e9, info: @@ -1414,10 +1407,10 @@ export const initGeneralAugmentations = (): Augmentation[] => [ "hacking abilities.", hacking: 1.2, hacking_exp: 1.25, - factions: [FactionNames.OmniTekIncorporated], + factions: [FactionName.OmniTekIncorporated], }), new Augmentation({ - name: AugmentationNames.PhotosyntheticCells, + name: AugmentationName.PhotosyntheticCells, repCost: 5.625e5, moneyCost: 2.75e9, info: @@ -1428,25 +1421,25 @@ export const initGeneralAugmentations = (): Augmentation[] => [ strength: 1.4, defense: 1.4, agility: 1.4, - factions: [FactionNames.KuaiGongInternational], + factions: [FactionName.KuaiGongInternational], }), new Augmentation({ - name: AugmentationNames.Neurolink, + name: AugmentationName.Neurolink, repCost: 8.75e5, moneyCost: 4.375e9, info: "A brain implant that provides a high-bandwidth, direct neural link between your " + - `mind and the ${FactionNames.BitRunners}' data servers, which reportedly contain ` + + `mind and the ${FactionName.BitRunners}' data servers, which reportedly contain ` + "the largest database of hacking tools and information in the world.", hacking: 1.15, hacking_exp: 1.2, hacking_chance: 1.1, hacking_speed: 1.05, programs: [CompletedProgramName.ftpCrack, CompletedProgramName.relaySmtp], - factions: [FactionNames.BitRunners], + factions: [FactionName.BitRunners], }), new Augmentation({ - name: AugmentationNames.TheBlackHand, + name: AugmentationName.TheBlackHand, repCost: 1e5, moneyCost: 5.5e8, info: @@ -1459,10 +1452,10 @@ export const initGeneralAugmentations = (): Augmentation[] => [ hacking: 1.1, hacking_speed: 1.02, hacking_money: 1.1, - factions: [FactionNames.TheBlackHand], + factions: [FactionName.TheBlackHand], }), new Augmentation({ - name: AugmentationNames.CRTX42AA, + name: AugmentationName.CRTX42AA, repCost: 4.5e4, moneyCost: 2.25e8, info: @@ -1471,10 +1464,10 @@ export const initGeneralAugmentations = (): Augmentation[] => [ "cortex and improves cognitive abilities.", hacking: 1.08, hacking_exp: 1.15, - factions: [FactionNames.NiteSec], + factions: [FactionName.NiteSec], }), new Augmentation({ - name: AugmentationNames.Neuregen, + name: AugmentationName.Neuregen, repCost: 3.75e4, moneyCost: 3.75e8, info: @@ -1482,10 +1475,10 @@ export const initGeneralAugmentations = (): Augmentation[] => [ "resulting in neurons that never die, continuously " + "regenerate, and strengthen themselves.", hacking_exp: 1.4, - factions: [FactionNames.Chongqing], + factions: [FactionName.Chongqing], }), new Augmentation({ - name: AugmentationNames.CashRoot, + name: AugmentationName.CashRoot, repCost: 1.25e4, moneyCost: 1.25e8, info: ( @@ -1496,10 +1489,10 @@ export const initGeneralAugmentations = (): Augmentation[] => [ ), startingMoney: 1e6, programs: [CompletedProgramName.bruteSsh], - factions: [FactionNames.Sector12], + factions: [FactionName.Sector12], }), new Augmentation({ - name: AugmentationNames.NutriGen, + name: AugmentationName.NutriGen, repCost: 6.25e3, moneyCost: 2.5e6, info: @@ -1511,10 +1504,10 @@ export const initGeneralAugmentations = (): Augmentation[] => [ defense_exp: 1.2, dexterity_exp: 1.2, agility_exp: 1.2, - factions: [FactionNames.NewTokyo], + factions: [FactionName.NewTokyo], }), new Augmentation({ - name: AugmentationNames.PCMatrix, + name: AugmentationName.PCMatrix, repCost: 100e3, moneyCost: 2e9, info: @@ -1529,20 +1522,20 @@ export const initGeneralAugmentations = (): Augmentation[] => [ crime_success: 1.0777, crime_money: 1.0777, programs: [CompletedProgramName.deepScan1, CompletedProgramName.autoLink], - factions: [FactionNames.Aevum], + factions: [FactionName.Aevum], }), new Augmentation({ - name: AugmentationNames.INFRARet, + name: AugmentationName.INFRARet, repCost: 7.5e3, moneyCost: 3e7, info: "A tiny chip that sits behind the retina. This implant lets the user visually detect infrared radiation.", crime_success: 1.25, crime_money: 1.1, dexterity: 1.1, - factions: [FactionNames.Ishima], + factions: [FactionName.Ishima], }), new Augmentation({ - name: AugmentationNames.DermaForce, + name: AugmentationName.DermaForce, repCost: 1.5e4, moneyCost: 5e7, info: @@ -1550,38 +1543,38 @@ export const initGeneralAugmentations = (): Augmentation[] => [ "millions of nanobots capable of projecting high-density muon beams, " + "creating an energy barrier around the user.", defense: 1.4, - factions: [FactionNames.Volhaven], + factions: [FactionName.Volhaven], }), new Augmentation({ - name: AugmentationNames.GrapheneBrachiBlades, + name: AugmentationName.GrapheneBrachiBlades, repCost: 2.25e5, moneyCost: 2.5e9, info: "An upgrade to the BrachiBlades augmentation. It infuses " + "the retractable blades with an advanced graphene material " + "making them stronger and lighter.", - prereqs: [AugmentationNames.BrachiBlades], + prereqs: [AugmentationName.BrachiBlades], strength: 1.4, defense: 1.4, crime_success: 1.1, crime_money: 1.3, - factions: [FactionNames.SpeakersForTheDead], + factions: [FactionName.SpeakersForTheDead], }), new Augmentation({ - name: AugmentationNames.GrapheneBionicArms, + name: AugmentationName.GrapheneBionicArms, repCost: 5e5, moneyCost: 3.75e9, info: "An upgrade to the Bionic Arms augmentation. It infuses the " + "prosthetic arms with an advanced graphene material " + "to make them stronger and lighter.", - prereqs: [AugmentationNames.BionicArms], + prereqs: [AugmentationName.BionicArms], strength: 1.85, dexterity: 1.85, - factions: [FactionNames.TheDarkArmy], + factions: [FactionName.TheDarkArmy], }), new Augmentation({ - name: AugmentationNames.BrachiBlades, + name: AugmentationName.BrachiBlades, repCost: 1.25e4, moneyCost: 9e7, info: "A set of retractable plasteel blades that are implanted in the arm, underneath the skin.", @@ -1589,19 +1582,19 @@ export const initGeneralAugmentations = (): Augmentation[] => [ defense: 1.15, crime_success: 1.1, crime_money: 1.15, - factions: [FactionNames.TheSyndicate], + factions: [FactionName.TheSyndicate], }), new Augmentation({ - name: AugmentationNames.BionicArms, + name: AugmentationName.BionicArms, repCost: 6.25e4, moneyCost: 2.75e8, info: "Cybernetic arms created from plasteel and carbon fibers that completely replace the user's organic arms.", strength: 1.3, dexterity: 1.3, - factions: [FactionNames.Tetrads], + factions: [FactionName.Tetrads], }), new Augmentation({ - name: AugmentationNames.SNA, + name: AugmentationName.SNA, repCost: 6.25e3, moneyCost: 3e7, info: @@ -1610,10 +1603,10 @@ export const initGeneralAugmentations = (): Augmentation[] => [ work_money: 1.1, company_rep: 1.15, faction_rep: 1.15, - factions: [FactionNames.TianDiHui], + factions: [FactionName.TianDiHui], }), new Augmentation({ - name: AugmentationNames.NeuroreceptorManager, + name: AugmentationName.NeuroreceptorManager, repCost: 0.75e5, moneyCost: 5.5e8, info: @@ -1627,7 +1620,7 @@ export const initGeneralAugmentations = (): Augmentation[] => [ faction. ), - factions: [FactionNames.TianDiHui], + factions: [FactionName.TianDiHui], }), // new Augmentation({ @@ -1642,7 +1635,7 @@ export const initGeneralAugmentations = (): Augmentation[] => [ // Grafting-exclusive Augmentation new Augmentation({ - name: AugmentationNames.CongruityImplant, + name: AugmentationName.CongruityImplant, repCost: Infinity, moneyCost: 50e12, info: ( @@ -1661,7 +1654,7 @@ export const initGeneralAugmentations = (): Augmentation[] => [ // Sleeve exclusive augmentations new Augmentation({ - name: AugmentationNames.ZOE, + name: AugmentationName.ZOE, isSpecial: true, repCost: Infinity, moneyCost: 1e12, @@ -1678,7 +1671,7 @@ export const initGeneralAugmentations = (): Augmentation[] => [ export const initBladeburnerAugmentations = (): Augmentation[] => [ new Augmentation({ - name: AugmentationNames.EsperEyewear, + name: AugmentationName.EsperEyewear, repCost: 1.25e3, moneyCost: 1.65e8, info: @@ -1693,10 +1686,10 @@ export const initBladeburnerAugmentations = (): Augmentation[] => [ bladeburner_success_chance: 1.03, dexterity: 1.05, isSpecial: true, - factions: [FactionNames.Bladeburners], + factions: [FactionName.Bladeburners], }), new Augmentation({ - name: AugmentationNames.EMS4Recombination, + name: AugmentationName.EMS4Recombination, repCost: 2.5e3, moneyCost: 2.75e8, info: @@ -1708,10 +1701,10 @@ export const initBladeburnerAugmentations = (): Augmentation[] => [ bladeburner_analysis: 1.05, bladeburner_stamina_gain: 1.02, isSpecial: true, - factions: [FactionNames.Bladeburners], + factions: [FactionName.Bladeburners], }), new Augmentation({ - name: AugmentationNames.OrionShoulder, + name: AugmentationName.OrionShoulder, repCost: 6.25e3, moneyCost: 5.5e8, info: @@ -1724,10 +1717,10 @@ export const initBladeburnerAugmentations = (): Augmentation[] => [ dexterity: 1.05, bladeburner_success_chance: 1.04, isSpecial: true, - factions: [FactionNames.Bladeburners], + factions: [FactionName.Bladeburners], }), new Augmentation({ - name: AugmentationNames.HyperionV1, + name: AugmentationName.HyperionV1, repCost: 1.25e4, moneyCost: 2.75e9, info: @@ -1739,10 +1732,10 @@ export const initBladeburnerAugmentations = (): Augmentation[] => [ "and concussive force.", bladeburner_success_chance: 1.06, isSpecial: true, - factions: [FactionNames.Bladeburners], + factions: [FactionName.Bladeburners], }), new Augmentation({ - name: AugmentationNames.HyperionV2, + name: AugmentationName.HyperionV2, repCost: 2.5e4, moneyCost: 5.5e9, info: @@ -1750,13 +1743,13 @@ export const initBladeburnerAugmentations = (): Augmentation[] => [ "is more advanced and powerful than the original V1 model. This V2 model is " + "more power-efficient, more accurate, and can fire plasma bolts at a much " + "higher velocity than the V1 model.", - prereqs: [AugmentationNames.HyperionV1], + prereqs: [AugmentationName.HyperionV1], bladeburner_success_chance: 1.08, isSpecial: true, - factions: [FactionNames.Bladeburners], + factions: [FactionName.Bladeburners], }), new Augmentation({ - name: AugmentationNames.GolemSerum, + name: AugmentationName.GolemSerum, repCost: 3.125e4, moneyCost: 1.1e10, info: @@ -1770,10 +1763,10 @@ export const initBladeburnerAugmentations = (): Augmentation[] => [ agility: 1.07, bladeburner_stamina_gain: 1.05, isSpecial: true, - factions: [FactionNames.Bladeburners], + factions: [FactionName.Bladeburners], }), new Augmentation({ - name: AugmentationNames.VangelisVirus, + name: AugmentationName.VangelisVirus, repCost: 1.875e4, moneyCost: 2.75e9, info: @@ -1783,10 +1776,10 @@ export const initBladeburnerAugmentations = (): Augmentation[] => [ bladeburner_analysis: 1.1, bladeburner_success_chance: 1.04, isSpecial: true, - factions: [FactionNames.Bladeburners], + factions: [FactionName.Bladeburners], }), new Augmentation({ - name: AugmentationNames.VangelisVirus3, + name: AugmentationName.VangelisVirus3, repCost: 3.75e4, moneyCost: 1.1e10, info: @@ -1794,16 +1787,16 @@ export const initBladeburnerAugmentations = (): Augmentation[] => [ "injected into human brain tissue. On top of the benefits of the original " + "virus, this also grants accelerated healing and enhanced " + "reflexes.", - prereqs: [AugmentationNames.VangelisVirus], + prereqs: [AugmentationName.VangelisVirus], defense_exp: 1.1, dexterity_exp: 1.1, bladeburner_analysis: 1.15, bladeburner_success_chance: 1.05, isSpecial: true, - factions: [FactionNames.Bladeburners], + factions: [FactionName.Bladeburners], }), new Augmentation({ - name: AugmentationNames.INTERLINKED, + name: AugmentationName.INTERLINKED, repCost: 2.5e4, moneyCost: 5.5e9, info: @@ -1817,14 +1810,14 @@ export const initBladeburnerAugmentations = (): Augmentation[] => [ agility_exp: 1.05, bladeburner_max_stamina: 1.1, isSpecial: true, - factions: [FactionNames.Bladeburners], + factions: [FactionName.Bladeburners], }), new Augmentation({ - name: AugmentationNames.BladeRunner, + name: AugmentationName.BladeRunner, repCost: 2e4, moneyCost: 8.25e9, info: - `A cybernetic foot augmentation that was specifically created for ${FactionNames.Bladeburners} ` + + `A cybernetic foot augmentation that was specifically created for ${FactionName.Bladeburners} ` + "during the Synthoid Uprising. The organic musculature of the human foot " + "is enhanced with flexible carbon nanotube matrices that are controlled by " + "intelligent servo-motors.", @@ -1832,14 +1825,14 @@ export const initBladeburnerAugmentations = (): Augmentation[] => [ bladeburner_max_stamina: 1.05, bladeburner_stamina_gain: 1.05, isSpecial: true, - factions: [FactionNames.Bladeburners], + factions: [FactionName.Bladeburners], }), new Augmentation({ - name: AugmentationNames.BladeArmor, + name: AugmentationName.BladeArmor, repCost: 1.25e4, moneyCost: 1.375e9, info: - `A powered exoskeleton suit designed as armor for ${FactionNames.Bladeburners} units. This ` + + `A powered exoskeleton suit designed as armor for ${FactionName.Bladeburners} units. This ` + "exoskeleton is incredibly adaptable and can protect the wearer from blunt, piercing, " + "concussive, thermal, chemical, and electric trauma. It also enhances the user's " + "physical abilities.", @@ -1850,50 +1843,50 @@ export const initBladeburnerAugmentations = (): Augmentation[] => [ bladeburner_stamina_gain: 1.02, bladeburner_success_chance: 1.03, isSpecial: true, - factions: [FactionNames.Bladeburners], + factions: [FactionName.Bladeburners], }), new Augmentation({ - name: AugmentationNames.BladeArmorPowerCells, + name: AugmentationName.BladeArmorPowerCells, repCost: 1.875e4, moneyCost: 2.75e9, info: "Upgrades the BLADE-51b Tesla Armor with Ion Power Cells, which are capable of " + "more efficiently storing and using power.", - prereqs: [AugmentationNames.BladeArmor], + prereqs: [AugmentationName.BladeArmor], bladeburner_success_chance: 1.05, bladeburner_stamina_gain: 1.02, bladeburner_max_stamina: 1.05, isSpecial: true, - factions: [FactionNames.Bladeburners], + factions: [FactionName.Bladeburners], }), new Augmentation({ - name: AugmentationNames.BladeArmorEnergyShielding, + name: AugmentationName.BladeArmorEnergyShielding, repCost: 2.125e4, moneyCost: 5.5e9, info: "Upgrades the BLADE-51b Tesla Armor with a plasma energy propulsion system " + "that is capable of projecting an energy shielding force field.", - prereqs: [AugmentationNames.BladeArmor], + prereqs: [AugmentationName.BladeArmor], defense: 1.05, bladeburner_success_chance: 1.06, isSpecial: true, - factions: [FactionNames.Bladeburners], + factions: [FactionName.Bladeburners], }), new Augmentation({ - name: AugmentationNames.BladeArmorUnibeam, + name: AugmentationName.BladeArmorUnibeam, repCost: 3.125e4, moneyCost: 1.65e10, info: "Upgrades the BLADE-51b Tesla Armor with a concentrated deuterium-fluoride laser " + "weapon. It's precision and accuracy makes it useful for quickly neutralizing " + "threats while keeping casualties to a minimum.", - prereqs: [AugmentationNames.BladeArmor], + prereqs: [AugmentationName.BladeArmor], bladeburner_success_chance: 1.08, isSpecial: true, - factions: [FactionNames.Bladeburners], + factions: [FactionName.Bladeburners], }), new Augmentation({ - name: AugmentationNames.BladeArmorOmnibeam, + name: AugmentationName.BladeArmorOmnibeam, repCost: 6.25e4, moneyCost: 2.75e10, info: @@ -1901,27 +1894,27 @@ export const initBladeburnerAugmentations = (): Augmentation[] => [ "multiple-fiber system. This upgraded weapon uses multiple fiber laser " + "modules that combine together to form a single, more powerful beam of up to " + "2000MW.", - prereqs: [AugmentationNames.BladeArmorUnibeam], + prereqs: [AugmentationName.BladeArmorUnibeam], bladeburner_success_chance: 1.1, isSpecial: true, - factions: [FactionNames.Bladeburners], + factions: [FactionName.Bladeburners], }), new Augmentation({ - name: AugmentationNames.BladeArmorIPU, + name: AugmentationName.BladeArmorIPU, repCost: 1.5e4, moneyCost: 1.1e9, info: "Upgrades the BLADE-51b Tesla Armor with an AI Information Processing " + "Unit that was specially designed to analyze Synthoid related data and " + "information.", - prereqs: [AugmentationNames.BladeArmor], + prereqs: [AugmentationName.BladeArmor], bladeburner_analysis: 1.15, bladeburner_success_chance: 1.02, isSpecial: true, - factions: [FactionNames.Bladeburners], + factions: [FactionName.Bladeburners], }), new Augmentation({ - name: AugmentationNames.BladesSimulacrum, + name: AugmentationName.BladesSimulacrum, repCost: 1.25e3, moneyCost: 1.5e11, info: @@ -1937,13 +1930,13 @@ export const initBladeburnerAugmentations = (): Augmentation[] => [ ), isSpecial: true, - factions: [FactionNames.Bladeburners], + factions: [FactionName.Bladeburners], }), ]; export const initChurchOfTheMachineGodAugmentations = (): Augmentation[] => [ new Augmentation({ - name: AugmentationNames.StaneksGift1, + name: AugmentationName.StaneksGift1, repCost: 0, moneyCost: 0, info: @@ -1979,17 +1972,17 @@ export const initChurchOfTheMachineGodAugmentations = (): Augmentation[] => [ hacknet_node_level_cost: 1.1, work_money: 0.9, stats: <>Its unstable nature decreases all your stats by 10%, - factions: [FactionNames.ChurchOfTheMachineGod], + factions: [FactionName.ChurchOfTheMachineGod], }), new Augmentation({ - name: AugmentationNames.StaneksGift2, + name: AugmentationName.StaneksGift2, repCost: 1e6, moneyCost: 0, info: "The next evolution is near, a coming together of man and machine. A synthesis greater than the birth of the human " + "organism. Time spent with the gift has allowed for acclimatization of the invasive augment and the toll it takes upon " + "your frame granting a 5% reduced penalty to all stats.", - prereqs: [AugmentationNames.StaneksGift1], + prereqs: [AugmentationName.StaneksGift1], isSpecial: true, hacking_chance: 0.95 / 0.9, hacking_speed: 0.95 / 0.9, @@ -2018,10 +2011,10 @@ export const initChurchOfTheMachineGodAugmentations = (): Augmentation[] => [ hacknet_node_level_cost: 1.05 / 1.1, work_money: 0.95 / 0.9, stats: <>The penalty for the gift is reduced to 5%, - factions: [FactionNames.ChurchOfTheMachineGod], + factions: [FactionName.ChurchOfTheMachineGod], }), new Augmentation({ - name: AugmentationNames.StaneksGift3, + name: AugmentationName.StaneksGift3, repCost: 1e8, moneyCost: 0, info: @@ -2029,7 +2022,7 @@ export const initChurchOfTheMachineGodAugmentations = (): Augmentation[] => [ "You will become greater than the sum of our parts. As One. Embrace your gift " + "fully and wholly free of it's accursed toll. Serenity brings tranquility in the form " + "of no longer suffering a stat penalty. ", - prereqs: [AugmentationNames.StaneksGift2, AugmentationNames.StaneksGift1], + prereqs: [AugmentationName.StaneksGift2, AugmentationName.StaneksGift1], isSpecial: true, hacking_chance: 1 / 0.95, hacking_speed: 1 / 0.95, @@ -2058,10 +2051,10 @@ export const initChurchOfTheMachineGodAugmentations = (): Augmentation[] => [ hacknet_node_level_cost: 1 / 1.05, work_money: 1 / 0.95, stats: <>Stanek's Gift has no penalty., - factions: [FactionNames.ChurchOfTheMachineGod], + factions: [FactionName.ChurchOfTheMachineGod], }), new Augmentation({ - name: AugmentationNames.BigDsBigBrain, + name: AugmentationName.BigDsBigBrain, isSpecial: true, factions: [], repCost: Infinity, @@ -2121,7 +2114,7 @@ export const initChurchOfTheMachineGodAugmentations = (): Augmentation[] => [ export function initNeuroFluxGovernor(): Augmentation { const donationBonus = CONSTANTS.Donations / 1e6 / 100; // 1 millionth of a percent per donation return new Augmentation({ - name: AugmentationNames.NeuroFluxGovernor, + name: AugmentationName.NeuroFluxGovernor, repCost: 500, moneyCost: 750e3, info: @@ -2161,9 +2154,9 @@ export function initNeuroFluxGovernor(): Augmentation { hacknet_node_core_cost: 1 / (1.01 + donationBonus), hacknet_node_level_cost: 1 / (1.01 + donationBonus), work_money: 1.01 + donationBonus, - factions: Object.values(FactionNames).filter( + factions: Object.values(FactionName).filter( (factionName) => - ![FactionNames.ShadowsOfAnarchy, FactionNames.Bladeburners, FactionNames.ChurchOfTheMachineGod].includes( + ![FactionName.ShadowsOfAnarchy, FactionName.Bladeburners, FactionName.ChurchOfTheMachineGod].includes( factionName, ), ), @@ -2175,13 +2168,13 @@ export function initUnstableCircadianModulator(): Augmentation { const randomBonuses = getRandomBonus(); const UnstableCircadianModulatorParams: IConstructorParams = { - name: AugmentationNames.UnstableCircadianModulator, + name: AugmentationName.UnstableCircadianModulator, moneyCost: 5e9, repCost: 3.625e5, info: "An experimental nanobot injection. Its unstable nature leads to " + "unpredictable results based on your circadian rhythm.", - factions: [FactionNames.SpeakersForTheDead], + factions: [FactionName.SpeakersForTheDead], }; Object.keys(randomBonuses.bonuses).forEach( (key) => ((UnstableCircadianModulatorParams as any)[key] = randomBonuses.bonuses[key]), diff --git a/src/Augmentation/ui/AugmentationsRoot.tsx b/src/Augmentation/ui/AugmentationsRoot.tsx index 045ca7a6e..ca1a3d011 100644 --- a/src/Augmentation/ui/AugmentationsRoot.tsx +++ b/src/Augmentation/ui/AugmentationsRoot.tsx @@ -19,7 +19,7 @@ import Container from "@mui/material/Container"; import { Settings } from "../../Settings/Settings"; import { ConfirmationModal } from "../../ui/React/ConfirmationModal"; import { Player } from "@player"; -import { AugmentationNames } from "../data/AugmentationNames"; +import { AugmentationName } from "@enums"; import { StaticAugmentations } from "../StaticAugmentations"; import { CONSTANTS } from "../../Constants"; import { formatNumberNoSuffix } from "../../ui/formatNumber"; @@ -29,7 +29,7 @@ import { AlertEvents } from "../../ui/React/AlertManager"; import { useRerender } from "../../ui/React/hooks"; const NeuroFluxDisplay = (): React.ReactElement => { - const level = Player.augmentations.find((e) => e.name === AugmentationNames.NeuroFluxGovernor)?.level ?? 0; + const level = Player.augmentations.find((e) => e.name === AugmentationName.NeuroFluxGovernor)?.level ?? 0; const openBloodDonation = () => { AlertEvents.emit( @@ -50,10 +50,10 @@ const NeuroFluxDisplay = (): React.ReactElement => { NeuroFlux Governor - Level {level} - {StaticAugmentations[AugmentationNames.NeuroFluxGovernor].stats} + {StaticAugmentations[AugmentationName.NeuroFluxGovernor].stats} - The power of {AugmentationNames.NeuroFluxGovernor} increases with blood donations from players in real life. + The power of {AugmentationName.NeuroFluxGovernor} increases with blood donations from players in real life. Learn more here @@ -199,7 +199,7 @@ export function AugmentationsRoot(props: IProps): React.ReactElement { my: 1, display: "grid", gridTemplateColumns: `repeat(${ - +!!((Player.augmentations.find((e) => e.name === AugmentationNames.NeuroFluxGovernor)?.level ?? 0) > 0) + + +!!((Player.augmentations.find((e) => e.name === AugmentationName.NeuroFluxGovernor)?.level ?? 0) > 0) + +!!(Player.entropy > 0) }, 1fr)`, gap: 1, diff --git a/src/Augmentation/ui/InstalledAugmentations.tsx b/src/Augmentation/ui/InstalledAugmentations.tsx index 02455b9e3..e34a8c1b5 100644 --- a/src/Augmentation/ui/InstalledAugmentations.tsx +++ b/src/Augmentation/ui/InstalledAugmentations.tsx @@ -14,12 +14,12 @@ import { OwnedAugmentationsOrderSetting } from "../../Settings/SettingEnums"; import { Settings } from "../../Settings/Settings"; import { Player } from "@player"; import { StaticAugmentations } from "../StaticAugmentations"; -import { AugmentationNames } from "../data/AugmentationNames"; +import { AugmentationName } from "@enums"; import { useRerender } from "../../ui/React/hooks"; export function InstalledAugmentations(): React.ReactElement { const rerender = useRerender(); - const sourceAugs = Player.augmentations.slice().filter((aug) => aug.name !== AugmentationNames.NeuroFluxGovernor); + const sourceAugs = Player.augmentations.slice().filter((aug) => aug.name !== AugmentationName.NeuroFluxGovernor); const [selectedAug, setSelectedAug] = useState(sourceAugs[0]); diff --git a/src/Augmentation/ui/PurchasableAugmentations.tsx b/src/Augmentation/ui/PurchasableAugmentations.tsx index a319c6907..9ae8fd998 100644 --- a/src/Augmentation/ui/PurchasableAugmentations.tsx +++ b/src/Augmentation/ui/PurchasableAugmentations.tsx @@ -10,10 +10,9 @@ import { Player } from "@player"; import { Settings } from "../../Settings/Settings"; import { formatMoney, formatReputation } from "../../ui/formatNumber"; import { Augmentation } from "../Augmentation"; -import { AugmentationNames } from "../data/AugmentationNames"; +import { AugmentationName, FactionName } from "@enums"; import { StaticAugmentations } from "../StaticAugmentations"; import { PurchaseAugmentationModal } from "./PurchaseAugmentationModal"; -import { FactionNames } from "../../Faction/data/FactionNames"; interface IPreReqsProps { aug: Augmentation; @@ -90,8 +89,8 @@ const Exclusive = (props: IExclusiveProps): React.ReactElement => { )} {Player.canAccessGrafting() && - (!props.aug.isSpecial || props.aug.factions.includes(FactionNames.Bladeburners)) && - props.aug.name !== AugmentationNames.TheRedPill && ( + (!props.aug.isSpecial || props.aug.factions.includes(FactionName.Bladeburners)) && + props.aug.name !== AugmentationName.TheRedPill && (
  • Grafting
  • @@ -210,7 +209,7 @@ export function PurchasableAugmentation(props: IPurchasableAugProps): React.Reac <> {props.augName} - {props.augName === AugmentationNames.NeuroFluxGovernor && ` - Level ${aug.getLevel()}`} + {props.augName === AugmentationName.NeuroFluxGovernor && ` - Level ${aug.getLevel()}`} {description} @@ -227,7 +226,7 @@ export function PurchasableAugmentation(props: IPurchasableAugProps): React.Reac }} > {aug.name} - {aug.name === AugmentationNames.NeuroFluxGovernor && ` - Level ${aug.getLevel()}`} + {aug.name === AugmentationName.NeuroFluxGovernor && ` - Level ${aug.getLevel()}`} diff --git a/src/Augmentation/ui/PurchasedAugmentations.tsx b/src/Augmentation/ui/PurchasedAugmentations.tsx index 2972ad517..ec54ef1bf 100644 --- a/src/Augmentation/ui/PurchasedAugmentations.tsx +++ b/src/Augmentation/ui/PurchasedAugmentations.tsx @@ -6,14 +6,14 @@ import { List, ListItemText, Paper, Tooltip, Typography } from "@mui/material"; import * as React from "react"; import { Player } from "@player"; import { StaticAugmentations } from "../StaticAugmentations"; -import { AugmentationNames } from "../data/AugmentationNames"; +import { AugmentationName } from "@enums"; export function PurchasedAugmentations(): React.ReactElement { const augs: React.ReactElement[] = []; // Only render the last NeuroFlux (there are no findLastIndex btw) let nfgIndex = -1; for (let i = Player.queuedAugmentations.length - 1; i >= 0; i--) { - if (Player.queuedAugmentations[i].name === AugmentationNames.NeuroFluxGovernor) { + if (Player.queuedAugmentations[i].name === AugmentationName.NeuroFluxGovernor) { nfgIndex = i; break; } @@ -22,11 +22,11 @@ export function PurchasedAugmentations(): React.ReactElement { const ownedAug = Player.queuedAugmentations[i]; let displayName = ownedAug.name; - if (ownedAug.name === AugmentationNames.NeuroFluxGovernor && i !== nfgIndex) continue; + if (ownedAug.name === AugmentationName.NeuroFluxGovernor && i !== nfgIndex) continue; const aug = StaticAugmentations[ownedAug.name]; let level = null; - if (ownedAug.name === AugmentationNames.NeuroFluxGovernor) { + if (ownedAug.name === AugmentationName.NeuroFluxGovernor) { level = ownedAug.level; displayName += ` - Level ${level}`; } diff --git a/src/Augmentation/ui/SourceFileMinus1.tsx b/src/Augmentation/ui/SourceFileMinus1.tsx index 06bb4ee1a..8d30ab394 100644 --- a/src/Augmentation/ui/SourceFileMinus1.tsx +++ b/src/Augmentation/ui/SourceFileMinus1.tsx @@ -48,7 +48,7 @@ export function SourceFileMinus1(): React.ReactElement { You have found the following exploits: - {exploits.map((c: Exploit) => ( + {exploits.map((c) => ( * {ExploitName(c)} ))} diff --git a/src/Augmentation/ui/SourceFiles.tsx b/src/Augmentation/ui/SourceFiles.tsx index a791918cc..900e078d6 100644 --- a/src/Augmentation/ui/SourceFiles.tsx +++ b/src/Augmentation/ui/SourceFiles.tsx @@ -31,7 +31,7 @@ const safeGetSf = (sfNum: number): SourceFile | SfMinus1 | null => { You have found the following exploits:

    - {Player.exploits.map((c: Exploit) => ( + {Player.exploits.map((c) => ( * {ExploitName(c)}
    diff --git a/src/BitNode/BitNode.tsx b/src/BitNode/BitNode.tsx index dfa1ebe66..528897857 100644 --- a/src/BitNode/BitNode.tsx +++ b/src/BitNode/BitNode.tsx @@ -1,8 +1,7 @@ import React from "react"; import { Player } from "@player"; import { BitNodeMultipliers, IBitNodeMultipliers } from "./BitNodeMultipliers"; -import { FactionNames } from "../Faction/data/FactionNames"; -import { CityName } from "../Enums"; +import { CityName, FactionName } from "@enums"; class BitNode { // A short description, or tagline, about the BitNode @@ -72,9 +71,8 @@ export function initBitNodes() { and savagery. The organized crime factions quickly rose to the top of the modern world.

    - Certain Factions ({FactionNames.SlumSnakes}, {FactionNames.Tetrads}, {FactionNames.TheSyndicate},{" "} - {FactionNames.TheDarkArmy}, {FactionNames.SpeakersForTheDead}, {FactionNames.NiteSec},{" "} - {FactionNames.TheBlackHand} + Certain Factions ({FactionName.SlumSnakes}, {FactionName.Tetrads}, {FactionName.TheSyndicate},{" "} + {FactionName.TheDarkArmy}, {FactionName.SpeakersForTheDead}, {FactionName.NiteSec}, {FactionName.TheBlackHand} ) give the player the ability to form and manage their own gangs. These gangs will earn the player money and reputation with the corresponding Faction
    @@ -188,23 +186,23 @@ export function initBitNodes() { BitNodes.BitNode6 = new BitNode( 6, 1, - FactionNames.Bladeburners, + FactionName.Bladeburners, "Like Tears in Rain", ( <> - In the middle of the 21st century, {FactionNames.OmniTekIncorporated} began designing and manufacturing advanced + In the middle of the 21st century, {FactionName.OmniTekIncorporated} began designing and manufacturing advanced synthetic androids, or Synthoids for short. They achieved a major technological breakthrough in the sixth generation of their Synthoid design, called MK-VI, by developing a hyperintelligent AI. Many argue that this was the first sentient AI ever created. This resulted in Synthoid models that were stronger, faster, and more intelligent than the humans that had created them.

    - In this BitNode you will be able to access the {FactionNames.Bladeburners} Division at the NSA, which provides a + In this BitNode you will be able to access the {FactionName.Bladeburners} Division at the NSA, which provides a new mechanic for progression.

    Destroying this BitNode will give you Source-File 6, or if you already have this Source-File it will upgrade its - level up to a maximum of 3. This Source-File allows you to access the NSA's {FactionNames.Bladeburners} Division + level up to a maximum of 3. This Source-File allows you to access the NSA's {FactionName.Bladeburners} Division in other BitNodes. In addition, this Source-File will raise both the level and experience gain rate of all your combat stats by:
    @@ -220,24 +218,24 @@ export function initBitNodes() { BitNodes.BitNode7 = new BitNode( 7, 2, - `${FactionNames.Bladeburners} 2079`, + `${FactionName.Bladeburners} 2079`, "More human than humans", ( <> - In the middle of the 21st century, you were doing cutting-edge work at {FactionNames.OmniTekIncorporated} as - part of the AI design team for advanced synthetic androids, or Synthoids for short. You helped achieve a major + In the middle of the 21st century, you were doing cutting-edge work at {FactionName.OmniTekIncorporated} as part + of the AI design team for advanced synthetic androids, or Synthoids for short. You helped achieve a major technological breakthrough in the sixth generation of the company's Synthoid design, called MK-VI, by developing a hyperintelligent AI. Many argue that this was the first sentient AI ever created. This resulted in Synthoid models that were stronger, faster, and more intelligent than the humans that had created them.

    - In this BitNode you will be able to access the {FactionNames.Bladeburners} API, which allows you to access{" "} - {FactionNames.Bladeburners} functionality through Netscript. + In this BitNode you will be able to access the {FactionName.Bladeburners} API, which allows you to access{" "} + {FactionName.Bladeburners} functionality through Netscript.

    Destroying this BitNode will give you Source-File 7, or if you already have this Source-File it will upgrade its - level up to a maximum of 3. This Source-File allows you to access the {FactionNames.Bladeburners} Netscript API - in other BitNodes. In addition, this Source-File will increase all of your {FactionNames.Bladeburners}{" "} + level up to a maximum of 3. This Source-File allows you to access the {FactionName.Bladeburners} Netscript API + in other BitNodes. In addition, this Source-File will increase all of your {FactionName.Bladeburners}{" "} multipliers by:

    @@ -297,9 +295,9 @@ export function initBitNodes() { "Hacknet Unleashed", ( <> - When {FactionNames.FulcrumSecretTechnologies} released their open-source Linux distro Chapeau, it quickly became + When {FactionName.FulcrumSecretTechnologies} released their open-source Linux distro Chapeau, it quickly became the OS of choice for the underground hacking community. Chapeau became especially notorious for powering the - Hacknet, a global, decentralized network used for nefarious purposes. {FactionNames.FulcrumSecretTechnologies}{" "} + Hacknet, a global, decentralized network used for nefarious purposes. {FactionName.FulcrumSecretTechnologies}{" "} quickly abandoned the project and dissociated themselves from it.

    @@ -431,7 +429,7 @@ export function initBitNodes() { ( <> With the invention of Augmentations in the 2040s a religious group known as the{" "} - {FactionNames.ChurchOfTheMachineGod} has rallied far more support than anyone would have hoped. + {FactionName.ChurchOfTheMachineGod} has rallied far more support than anyone would have hoped.

    Their leader, Allison "Mother" Stanek is said to have created her own Augmentation whose power goes beyond any @@ -439,7 +437,7 @@ export function initBitNodes() {

    Destroying this BitNode will give you Source-File 13, or if you already have this Source-File it will upgrade - its level up to a maximum of 3. This Source-File lets the {FactionNames.ChurchOfTheMachineGod} appear in other + its level up to a maximum of 3. This Source-File lets the {FactionName.ChurchOfTheMachineGod} appear in other BitNodes.

    diff --git a/src/Bladeburner/BlackOperations.tsx b/src/Bladeburner/BlackOperations.tsx index b369ce2f6..8b4830a78 100644 --- a/src/Bladeburner/BlackOperations.tsx +++ b/src/Bladeburner/BlackOperations.tsx @@ -1,11 +1,11 @@ import { BlackOperation } from "./BlackOperation"; -import { BlackOperationNames } from "./data/BlackOperationNames"; +import { BlackOperationName } from "@enums"; export const BlackOperations: Record = {}; (function () { - BlackOperations[BlackOperationNames.OperationTyphoon] = new BlackOperation({ - name: BlackOperationNames.OperationTyphoon, + BlackOperations[BlackOperationName.OperationTyphoon] = new BlackOperation({ + name: BlackOperationName.OperationTyphoon, baseDifficulty: 2000, reqdRank: 2.5e3, rankGain: 50, @@ -31,8 +31,8 @@ export const BlackOperations: Record = {}; }, isKill: true, }); - BlackOperations[BlackOperationNames.OperationZero] = new BlackOperation({ - name: BlackOperationNames.OperationZero, + BlackOperations[BlackOperationName.OperationZero] = new BlackOperation({ + name: BlackOperationName.OperationZero, baseDifficulty: 2500, reqdRank: 5e3, rankGain: 60, @@ -58,8 +58,8 @@ export const BlackOperations: Record = {}; }, isStealth: true, }); - BlackOperations[BlackOperationNames.OperationX] = new BlackOperation({ - name: BlackOperationNames.OperationX, + BlackOperations[BlackOperationName.OperationX] = new BlackOperation({ + name: BlackOperationName.OperationX, baseDifficulty: 3000, reqdRank: 7.5e3, rankGain: 75, @@ -85,8 +85,8 @@ export const BlackOperations: Record = {}; }, isKill: true, }); - BlackOperations[BlackOperationNames.OperationTitan] = new BlackOperation({ - name: BlackOperationNames.OperationTitan, + BlackOperations[BlackOperationName.OperationTitan] = new BlackOperation({ + name: BlackOperationName.OperationTitan, baseDifficulty: 4000, reqdRank: 10e3, rankGain: 100, @@ -112,8 +112,8 @@ export const BlackOperations: Record = {}; }, isKill: true, }); - BlackOperations[BlackOperationNames.OperationAres] = new BlackOperation({ - name: BlackOperationNames.OperationAres, + BlackOperations[BlackOperationName.OperationAres] = new BlackOperation({ + name: BlackOperationName.OperationAres, baseDifficulty: 5000, reqdRank: 12.5e3, rankGain: 125, @@ -139,8 +139,8 @@ export const BlackOperations: Record = {}; }, isKill: true, }); - BlackOperations[BlackOperationNames.OperationArchangel] = new BlackOperation({ - name: BlackOperationNames.OperationArchangel, + BlackOperations[BlackOperationName.OperationArchangel] = new BlackOperation({ + name: BlackOperationName.OperationArchangel, baseDifficulty: 7500, reqdRank: 15e3, rankGain: 200, @@ -166,8 +166,8 @@ export const BlackOperations: Record = {}; }, isKill: true, }); - BlackOperations[BlackOperationNames.OperationJuggernaut] = new BlackOperation({ - name: BlackOperationNames.OperationJuggernaut, + BlackOperations[BlackOperationName.OperationJuggernaut] = new BlackOperation({ + name: BlackOperationName.OperationJuggernaut, baseDifficulty: 10e3, reqdRank: 20e3, rankGain: 300, @@ -193,8 +193,8 @@ export const BlackOperations: Record = {}; }, isKill: true, }); - BlackOperations[BlackOperationNames.OperationRedDragon] = new BlackOperation({ - name: BlackOperationNames.OperationRedDragon, + BlackOperations[BlackOperationName.OperationRedDragon] = new BlackOperation({ + name: BlackOperationName.OperationRedDragon, baseDifficulty: 12.5e3, reqdRank: 25e3, rankGain: 500, @@ -220,8 +220,8 @@ export const BlackOperations: Record = {}; }, isKill: true, }); - BlackOperations[BlackOperationNames.OperationK] = new BlackOperation({ - name: BlackOperationNames.OperationK, + BlackOperations[BlackOperationName.OperationK] = new BlackOperation({ + name: BlackOperationName.OperationK, baseDifficulty: 15e3, reqdRank: 30e3, rankGain: 750, @@ -247,8 +247,8 @@ export const BlackOperations: Record = {}; }, isKill: true, }); - BlackOperations[BlackOperationNames.OperationDeckard] = new BlackOperation({ - name: BlackOperationNames.OperationDeckard, + BlackOperations[BlackOperationName.OperationDeckard] = new BlackOperation({ + name: BlackOperationName.OperationDeckard, baseDifficulty: 20e3, reqdRank: 40e3, rankGain: 1e3, @@ -274,8 +274,8 @@ export const BlackOperations: Record = {}; }, isKill: true, }); - BlackOperations[BlackOperationNames.OperationTyrell] = new BlackOperation({ - name: BlackOperationNames.OperationTyrell, + BlackOperations[BlackOperationName.OperationTyrell] = new BlackOperation({ + name: BlackOperationName.OperationTyrell, baseDifficulty: 25e3, reqdRank: 50e3, rankGain: 1.5e3, @@ -301,8 +301,8 @@ export const BlackOperations: Record = {}; }, isKill: true, }); - BlackOperations[BlackOperationNames.OperationWallace] = new BlackOperation({ - name: BlackOperationNames.OperationWallace, + BlackOperations[BlackOperationName.OperationWallace] = new BlackOperation({ + name: BlackOperationName.OperationWallace, baseDifficulty: 30e3, reqdRank: 75e3, rankGain: 2e3, @@ -328,8 +328,8 @@ export const BlackOperations: Record = {}; }, isKill: true, }); - BlackOperations[BlackOperationNames.OperationShoulderOfOrion] = new BlackOperation({ - name: BlackOperationNames.OperationShoulderOfOrion, + BlackOperations[BlackOperationName.OperationShoulderOfOrion] = new BlackOperation({ + name: BlackOperationName.OperationShoulderOfOrion, baseDifficulty: 35e3, reqdRank: 100e3, rankGain: 2.5e3, @@ -355,8 +355,8 @@ export const BlackOperations: Record = {}; }, isStealth: true, }); - BlackOperations[BlackOperationNames.OperationHyron] = new BlackOperation({ - name: BlackOperationNames.OperationHyron, + BlackOperations[BlackOperationName.OperationHyron] = new BlackOperation({ + name: BlackOperationName.OperationHyron, baseDifficulty: 40e3, reqdRank: 125e3, rankGain: 3e3, @@ -382,8 +382,8 @@ export const BlackOperations: Record = {}; }, isKill: true, }); - BlackOperations[BlackOperationNames.OperationMorpheus] = new BlackOperation({ - name: BlackOperationNames.OperationMorpheus, + BlackOperations[BlackOperationName.OperationMorpheus] = new BlackOperation({ + name: BlackOperationName.OperationMorpheus, baseDifficulty: 45e3, reqdRank: 150e3, rankGain: 4e3, @@ -409,8 +409,8 @@ export const BlackOperations: Record = {}; }, isStealth: true, }); - BlackOperations[BlackOperationNames.OperationIonStorm] = new BlackOperation({ - name: BlackOperationNames.OperationIonStorm, + BlackOperations[BlackOperationName.OperationIonStorm] = new BlackOperation({ + name: BlackOperationName.OperationIonStorm, baseDifficulty: 50e3, reqdRank: 175e3, rankGain: 5e3, @@ -436,8 +436,8 @@ export const BlackOperations: Record = {}; }, isKill: true, }); - BlackOperations[BlackOperationNames.OperationAnnihilus] = new BlackOperation({ - name: BlackOperationNames.OperationAnnihilus, + BlackOperations[BlackOperationName.OperationAnnihilus] = new BlackOperation({ + name: BlackOperationName.OperationAnnihilus, baseDifficulty: 55e3, reqdRank: 200e3, rankGain: 7.5e3, @@ -463,8 +463,8 @@ export const BlackOperations: Record = {}; }, isKill: true, }); - BlackOperations[BlackOperationNames.OperationUltron] = new BlackOperation({ - name: BlackOperationNames.OperationUltron, + BlackOperations[BlackOperationName.OperationUltron] = new BlackOperation({ + name: BlackOperationName.OperationUltron, baseDifficulty: 60e3, reqdRank: 250e3, rankGain: 10e3, @@ -490,8 +490,8 @@ export const BlackOperations: Record = {}; }, isKill: true, }); - BlackOperations[BlackOperationNames.OperationCenturion] = new BlackOperation({ - name: BlackOperationNames.OperationCenturion, + BlackOperations[BlackOperationName.OperationCenturion] = new BlackOperation({ + name: BlackOperationName.OperationCenturion, baseDifficulty: 70e3, reqdRank: 300e3, rankGain: 15e3, @@ -516,8 +516,8 @@ export const BlackOperations: Record = {}; int: 0.75, }, }); - BlackOperations[BlackOperationNames.OperationVindictus] = new BlackOperation({ - name: BlackOperationNames.OperationVindictus, + BlackOperations[BlackOperationName.OperationVindictus] = new BlackOperation({ + name: BlackOperationName.OperationVindictus, baseDifficulty: 75e3, reqdRank: 350e3, rankGain: 20e3, @@ -542,8 +542,8 @@ export const BlackOperations: Record = {}; int: 0.75, }, }); - BlackOperations[BlackOperationNames.OperationDaedalus] = new BlackOperation({ - name: BlackOperationNames.OperationDaedalus, + BlackOperations[BlackOperationName.OperationDaedalus] = new BlackOperation({ + name: BlackOperationName.OperationDaedalus, baseDifficulty: 80e3, reqdRank: 400e3, rankGain: 40e3, diff --git a/src/Bladeburner/Bladeburner.tsx b/src/Bladeburner/Bladeburner.tsx index 53318516d..e704340e8 100644 --- a/src/Bladeburner/Bladeburner.tsx +++ b/src/Bladeburner/Bladeburner.tsx @@ -1,3 +1,4 @@ +import { AugmentationName, CityName, FactionName } from "@enums"; import { constructorsForReviver, Generic_toJSON, Generic_fromJSON, IReviverValue } from "../utils/JSONReviver"; import { ActionIdentifier } from "./ActionIdentifier"; import { ActionTypes } from "./data/ActionTypes"; @@ -26,17 +27,14 @@ import { Factions, factionExists } from "../Faction/Factions"; import { calculateHospitalizationCost } from "../Hospital/Hospital"; import { dialogBoxCreate } from "../ui/React/DialogBox"; import { Settings } from "../Settings/Settings"; -import { AugmentationNames } from "../Augmentation/data/AugmentationNames"; import { getTimestamp } from "../utils/helpers/getTimestamp"; import { joinFaction } from "../Faction/FactionHelpers"; import { WorkerScript } from "../Netscript/WorkerScript"; -import { FactionNames } from "../Faction/data/FactionNames"; import { KEY } from "../utils/helpers/keyCodes"; import { isSleeveInfiltrateWork } from "../PersonObjects/Sleeve/Work/SleeveInfiltrateWork"; import { isSleeveSupportWork } from "../PersonObjects/Sleeve/Work/SleeveSupportWork"; import { WorkStats, newWorkStats } from "../Work/WorkStats"; -import { CityName } from "../Enums"; -import { getRandomMember } from "../utils/helpers/enum"; +import { getEnumHelper } from "../utils/EnumHelper"; import { createEnumKeyedRecord } from "../Types/Record"; export interface BlackOpsAttempt { @@ -293,7 +291,7 @@ export class Bladeburner { prestige(): void { this.resetAction(); - const bladeburnerFac = Factions[FactionNames.Bladeburners]; + const bladeburnerFac = Factions[FactionName.Bladeburners]; if (this.rank >= BladeburnerConstants.RankNeededForFaction) { joinFaction(bladeburnerFac); } @@ -849,8 +847,9 @@ export class Bladeburner { } triggerMigration(sourceCityName: CityName): void { - let destCityName = getRandomMember(CityName); - while (destCityName === sourceCityName) destCityName = getRandomMember(CityName); + const cityHelper = getEnumHelper("CityName"); + let destCityName = cityHelper.random(); + while (destCityName === sourceCityName) destCityName = cityHelper.random(); const destCity = this.cities[destCityName]; const sourceCity = this.cities[sourceCityName]; @@ -883,13 +882,14 @@ export class Bladeburner { randomEvent(): void { const chance = Math.random(); + const cityHelper = getEnumHelper("CityName"); // Choose random source/destination city for events - const sourceCityName = getRandomMember(CityName); + const sourceCityName = cityHelper.random(); const sourceCity = this.cities[sourceCityName]; - let destCityName = getRandomMember(CityName); - while (destCityName === sourceCityName) destCityName = getRandomMember(CityName); + let destCityName = cityHelper.random(); + while (destCityName === sourceCityName) destCityName = cityHelper.random(); const destCity = this.cities[destCityName]; if (chance <= 0.05) { @@ -1607,12 +1607,12 @@ export class Bladeburner { } this.maxRank = Math.max(this.rank, this.maxRank); - const bladeburnersFactionName = FactionNames.Bladeburners; + const bladeburnersFactionName = FactionName.Bladeburners; if (factionExists(bladeburnersFactionName)) { const bladeburnerFac = Factions[bladeburnersFactionName]; if (!bladeburnerFac) { throw new Error( - `Could not properly get ${FactionNames.Bladeburners} Faction object in ${FactionNames.Bladeburners} UI Overview Faction button`, + `Could not properly get ${FactionName.Bladeburners} Faction object in ${FactionName.Bladeburners} UI Overview Faction button`, ); } if (bladeburnerFac.isMember) { @@ -1959,7 +1959,7 @@ export class Bladeburner { if (!Router.isInitialized) return; // If the Player starts doing some other actions, set action to idle and alert - if (!Player.hasAugmentation(AugmentationNames.BladesSimulacrum, true) && Player.currentWork) { + if (!Player.hasAugmentation(AugmentationName.BladesSimulacrum, true) && Player.currentWork) { if (this.action.type !== ActionTypes.Idle) { let msg = "Your Bladeburner action was cancelled because you started doing something else."; if (this.automateEnabled) { @@ -2360,12 +2360,12 @@ export class Bladeburner { } joinBladeburnerFactionNetscriptFn(workerScript: WorkerScript): boolean { - const bladeburnerFac = Factions[FactionNames.Bladeburners]; + const bladeburnerFac = Factions[FactionName.Bladeburners]; if (bladeburnerFac.isMember) { return true; } else if (this.rank >= BladeburnerConstants.RankNeededForFaction) { joinFaction(bladeburnerFac); - workerScript.log("bladeburner.joinBladeburnerFaction", () => `Joined ${FactionNames.Bladeburners} faction.`); + workerScript.log("bladeburner.joinBladeburnerFaction", () => `Joined ${FactionName.Bladeburners} faction.`); return true; } else { workerScript.log( diff --git a/src/Bladeburner/City.ts b/src/Bladeburner/City.ts index 3a78d80d8..9e6e265de 100644 --- a/src/Bladeburner/City.ts +++ b/src/Bladeburner/City.ts @@ -2,7 +2,7 @@ import { BladeburnerConstants } from "./data/Constants"; import { getRandomInt } from "../utils/helpers/getRandomInt"; import { Generic_fromJSON, Generic_toJSON, IReviverValue, constructorsForReviver } from "../utils/JSONReviver"; import { addOffset } from "../utils/helpers/addOffset"; -import { CityName } from "../Enums"; +import { CityName } from "@enums"; interface IChangePopulationByCountParams { /** How much the estimate should change by. */ diff --git a/src/Bladeburner/data/BlackOperationNames.ts b/src/Bladeburner/Enums.ts similarity index 96% rename from src/Bladeburner/data/BlackOperationNames.ts rename to src/Bladeburner/Enums.ts index 893bc7114..60ce5dee5 100644 --- a/src/Bladeburner/data/BlackOperationNames.ts +++ b/src/Bladeburner/Enums.ts @@ -1,4 +1,4 @@ -export enum BlackOperationNames { +export enum BlackOperationName { OperationTyphoon = "Operation Typhoon", OperationZero = "Operation Zero", OperationX = "Operation X", diff --git a/src/Bladeburner/data/BlackOperations.tsx b/src/Bladeburner/data/BlackOperations.tsx index c7fd4c642..0dac80ae5 100644 --- a/src/Bladeburner/data/BlackOperations.tsx +++ b/src/Bladeburner/data/BlackOperations.tsx @@ -1,41 +1,39 @@ import React from "react"; -import { FactionNames } from "../../Faction/data/FactionNames"; -import { CityName } from "../../Enums"; -import { BlackOperationNames } from "./BlackOperationNames"; +import { BlackOperationName, CityName, FactionName } from "@enums"; interface IBlackOp { desc: JSX.Element; } export const BlackOperations: Record = { - [BlackOperationNames.OperationTyphoon]: { + [BlackOperationName.OperationTyphoon]: { desc: ( <> Obadiah Zenyatta is the leader of a RedWater PMC. It has long been known among the intelligence community that Zenyatta, along with the rest of the PMC, is a Synthoid.

    - The goal of {BlackOperationNames.OperationTyphoon} is to find and eliminate Zenyatta and RedWater by any means + The goal of {BlackOperationName.OperationTyphoon} is to find and eliminate Zenyatta and RedWater by any means necessary. After the task is completed, the actions must be covered up from the general public. ), }, - [BlackOperationNames.OperationZero]: { + [BlackOperationName.OperationZero]: { desc: ( <> AeroCorp is one of the world's largest defense contractors. Its leader, Steve Watataki, is thought to be a supporter of Synthoid rights. He must be removed.

    - The goal of {BlackOperationNames.OperationZero} is to covertly infiltrate AeroCorp and uncover any incriminating + The goal of {BlackOperationName.OperationZero} is to covertly infiltrate AeroCorp and uncover any incriminating evidence or information against Watataki that will cause him to be removed from his position at AeroCorp. Incriminating evidence can be fabricated as a last resort. Be warned that AeroCorp has some of the most advanced security measures in the world. ), }, - [BlackOperationNames.OperationX]: { + [BlackOperationName.OperationX]: { desc: ( <> We have recently discovered an underground publication group called Samizdat. Even though most of their @@ -50,7 +48,7 @@ export const BlackOperations: Record = { ), }, - [BlackOperationNames.OperationTitan]: { + [BlackOperationName.OperationTitan]: { desc: ( <> Several months ago Titan Laboratories' Bioengineering department was infiltrated by Synthoids. As far as we @@ -65,7 +63,7 @@ export const BlackOperations: Record = { ), }, - [BlackOperationNames.OperationAres]: { + [BlackOperationName.OperationAres]: { desc: ( <> One of our undercover agents, Agent Carter, has informed us of a massive weapons deal going down in Dubai @@ -77,7 +75,7 @@ export const BlackOperations: Record = { ), }, - [BlackOperationNames.OperationArchangel]: { + [BlackOperationName.OperationArchangel]: { desc: ( <> Our analysts have discovered that the popular Red Rabbit brothel in Amsterdam is run and 'staffed' by MK-VI @@ -90,7 +88,7 @@ export const BlackOperations: Record = { ), }, - [BlackOperationNames.OperationJuggernaut]: { + [BlackOperationName.OperationJuggernaut]: { desc: ( <> The CIA has just encountered a new security threat. A new criminal group, lead by a shadowy operative who calls @@ -104,20 +102,20 @@ export const BlackOperations: Record = { ), }, - [BlackOperationNames.OperationRedDragon]: { + [BlackOperationName.OperationRedDragon]: { desc: ( <> - The {FactionNames.Tetrads} criminal organization is suspected of reverse-engineering the MK-VI Synthoid design. + The {FactionName.Tetrads} criminal organization is suspected of reverse-engineering the MK-VI Synthoid design. We believe they altered and possibly improved the design and began manufacturing their own Synthoid models in order to bolster their criminal activities.

    - Your task is to infiltrate and destroy the {FactionNames.Tetrads}' base of operations in Los Angeles. + Your task is to infiltrate and destroy the {FactionName.Tetrads}' base of operations in Los Angeles. Intelligence tells us that their base houses one of their Synthoid manufacturing units. ), }, - [BlackOperationNames.OperationK]: { + [BlackOperationName.OperationK]: { desc: ( <> CODE RED SITUATION. Our intelligence tells us that VitaLife has discovered a new android cloning technology. @@ -133,52 +131,51 @@ export const BlackOperations: Record = { ), }, - [BlackOperationNames.OperationDeckard]: { + [BlackOperationName.OperationDeckard]: { desc: ( <> Despite your success in eliminating VitaLife's new android-replicating technology in{" "} - {BlackOperationNames.OperationK}, we've discovered that a small group of MK-VI Synthoids were able to make off + {BlackOperationName.OperationK}, we've discovered that a small group of MK-VI Synthoids were able to make off with the schematics and design of the technology before the Operation. It is almost a certainty that these Synthoids are some of the rogue MK-VI ones from the Synthoid Uprising.

    - The goal of {BlackOperationNames.OperationDeckard} is to hunt down these Synthoids and retire them. I don't need + The goal of {BlackOperationName.OperationDeckard} is to hunt down these Synthoids and retire them. I don't need to tell you how critical this mission is. ), }, - [BlackOperationNames.OperationTyrell]: { + [BlackOperationName.OperationTyrell]: { desc: ( <> - A week ago {FactionNames.BladeIndustries} reported a small break-in at one of their {CityName.Aevum}{" "} - Augmentation storage facilities. We figured out that {FactionNames.TheDarkArmy} was behind the heist, and didn't - think any more of it. However, we've just discovered that several known MK-VI Synthoids were part of that - break-in group. + A week ago {FactionName.BladeIndustries} reported a small break-in at one of their {CityName.Aevum} Augmentation + storage facilities. We figured out that {FactionName.TheDarkArmy} was behind the heist, and didn't think any + more of it. However, we've just discovered that several known MK-VI Synthoids were part of that break-in group.

    We cannot have Synthoids upgrading their already-enhanced abilities with Augmentations. Your task is to hunt - down associated {FactionNames.TheDarkArmy} members and eliminate them. + down associated {FactionName.TheDarkArmy} members and eliminate them. ), }, - [BlackOperationNames.OperationWallace]: { + [BlackOperationName.OperationWallace]: { desc: ( <> - Based on information gathered from {BlackOperationNames.OperationTyrell}, we've discovered that{" "} - {FactionNames.TheDarkArmy} was well aware that there were Synthoids amongst their ranks. Even worse, we believe - that {FactionNames.TheDarkArmy} is working together with other criminal organizations such as{" "} - {FactionNames.TheSyndicate} and that they are planning some sort of large-scale takeover of multiple major + Based on information gathered from {BlackOperationName.OperationTyrell}, we've discovered that{" "} + {FactionName.TheDarkArmy} was well aware that there were Synthoids amongst their ranks. Even worse, we believe + that {FactionName.TheDarkArmy} is working together with other criminal organizations such as{" "} + {FactionName.TheSyndicate} and that they are planning some sort of large-scale takeover of multiple major cities, most notably {CityName.Aevum}. We suspect that Synthoids have infiltrated the ranks of these criminal factions and are trying to stage another Synthoid uprising.

    The best way to deal with this is to prevent it before it even happens. The goal of{" "} - {BlackOperationNames.OperationWallace} is to destroy {FactionNames.TheDarkArmy} and Syndicate factions in{" "} + {BlackOperationName.OperationWallace} is to destroy {FactionName.TheDarkArmy} and Syndicate factions in{" "} {CityName.Aevum} immediately. Leave no survivors. ), }, - [BlackOperationNames.OperationShoulderOfOrion]: { + [BlackOperationName.OperationShoulderOfOrion]: { desc: ( <> China's Solaris Space Systems is secretly launching the first manned spacecraft in over a decade using @@ -191,10 +188,10 @@ export const BlackOperations: Record = { ), }, - [BlackOperationNames.OperationHyron]: { + [BlackOperationName.OperationHyron]: { desc: ( <> - Our intelligence tells us that {FactionNames.FulcrumSecretTechnologies} is developing a quantum supercomputer + Our intelligence tells us that {FactionName.FulcrumSecretTechnologies} is developing a quantum supercomputer using human brains as core processors. This supercomputer is rumored to be able to store vast amounts of data and perform computations unmatched by any other supercomputer on the planet. But more importantly, the use of organic human brains means that the supercomputer may be able to reason abstractly and become self-aware. @@ -203,13 +200,13 @@ export const BlackOperations: Record = { I do not need to remind you why sentient-level AIs pose a serious threat to all of mankind.

    - The research for this project is being conducted at one of {FactionNames.FulcrumSecretTechnologies} secret + The research for this project is being conducted at one of {FactionName.FulcrumSecretTechnologies} secret facilities in {CityName.Aevum}, codenamed 'Alpha Ranch'. Infiltrate the compound, delete and destroy the work, and then find and kill the project lead. ), }, - [BlackOperationNames.OperationMorpheus]: { + [BlackOperationName.OperationMorpheus]: { desc: ( <> DreamSense Technologies is an advertising company that uses special technology to transmit their ads into the @@ -222,7 +219,7 @@ export const BlackOperations: Record = { ), }, - [BlackOperationNames.OperationIonStorm]: { + [BlackOperationName.OperationIonStorm]: { desc: ( <> Our analysts have uncovered a gathering of MK-VI Synthoids that have taken up residence in the{" "} @@ -235,26 +232,26 @@ export const BlackOperations: Record = { ), }, - [BlackOperationNames.OperationAnnihilus]: { + [BlackOperationName.OperationAnnihilus]: { desc: ( <> Our superiors have ordered us to eradicate everything and everyone in an underground facility located in{" "} {CityName.Aevum}. They tell us that the facility houses many dangerous Synthoids and belongs to a terrorist - organization called '{FactionNames.TheCovenant}'. We have no prior intelligence about this organization, so you + organization called '{FactionName.TheCovenant}'. We have no prior intelligence about this organization, so you are going in blind. ), }, - [BlackOperationNames.OperationUltron]: { + [BlackOperationName.OperationUltron]: { desc: ( <> - {FactionNames.OmniTekIncorporated}, the original designer and manufacturer of Synthoids, has notified us of a + {FactionName.OmniTekIncorporated}, the original designer and manufacturer of Synthoids, has notified us of a malfunction in their AI design. This malfunction, when triggered, causes MK-VI Synthoids to become radicalized and seek out the destruction of humanity. They say that this bug affects all MK-VI Synthoids, not just the rogue ones from the Uprising.

    - {FactionNames.OmniTekIncorporated} has also told us they believe someone has triggered this malfunction in a + {FactionName.OmniTekIncorporated} has also told us they believe someone has triggered this malfunction in a large group of MK-VI Synthoids, and that these newly-radicalized Synthoids are now amassing in{" "} {CityName.Volhaven} to form a terrorist group called Ultron.
    @@ -267,7 +264,7 @@ export const BlackOperations: Record = { ), }, - [BlackOperationNames.OperationCenturion]: { + [BlackOperationName.OperationCenturion]: { desc: ( <> {"D)@#)($M)C0293c40($*)@#D0JUMP3Rm0C<*@#)*$)#02c94830c(#$*D)"} @@ -285,7 +282,7 @@ export const BlackOperations: Record = { ), }, - [BlackOperationNames.OperationVindictus]: { + [BlackOperationName.OperationVindictus]: { desc: ( <> {"D)@#)($M)C0293c40($*)@#D0JUMP3Rm0C<*@#)*$)#02c94830c(#$*D)"} @@ -299,7 +296,7 @@ export const BlackOperations: Record = { ), }, - [BlackOperationNames.OperationDaedalus]: { + [BlackOperationName.OperationDaedalus]: { desc: <> Yesterday we obeyed kings and bent our neck to emperors. Today we kneel only to truth., }, }; diff --git a/src/Bladeburner/ui/BlackOpPage.tsx b/src/Bladeburner/ui/BlackOpPage.tsx index 715ad3941..6c6477f9a 100644 --- a/src/Bladeburner/ui/BlackOpPage.tsx +++ b/src/Bladeburner/ui/BlackOpPage.tsx @@ -1,11 +1,9 @@ import * as React from "react"; +import { Button, Typography } from "@mui/material"; +import { BlackOperationName, FactionName } from "@enums"; import { BlackOpList } from "./BlackOpList"; import { Bladeburner } from "../Bladeburner"; -import Typography from "@mui/material/Typography"; -import { FactionNames } from "../../Faction/data/FactionNames"; import { Router } from "../../ui/GameRoot"; -import { BlackOperationNames } from "../data/BlackOperationNames"; -import { Button } from "@mui/material"; import { CorruptableText } from "../../ui/React/CorruptableText"; interface IProps { @@ -21,7 +19,7 @@ export function BlackOpPage(props: IProps): React.ReactElement {

    - Your ultimate goal to climb through the ranks of {FactionNames.Bladeburners} is to complete all of the Black + Your ultimate goal to climb through the ranks of {FactionName.Bladeburners} is to complete all of the Black Ops.
    @@ -29,7 +27,7 @@ export function BlackOpPage(props: IProps): React.ReactElement { Like normal operations, you may use a team for Black Ops. Failing a black op will incur heavy HP and rank losses. - {props.bladeburner.blackops[BlackOperationNames.OperationDaedalus] ? ( + {props.bladeburner.blackops[BlackOperationName.OperationDaedalus] ? ( diff --git a/src/Bladeburner/ui/BladeburnerCinematic.tsx b/src/Bladeburner/ui/BladeburnerCinematic.tsx index e58cd31f1..49faf0927 100644 --- a/src/Bladeburner/ui/BladeburnerCinematic.tsx +++ b/src/Bladeburner/ui/BladeburnerCinematic.tsx @@ -1,5 +1,5 @@ import React from "react"; -import { FactionNames } from "../../Faction/data/FactionNames"; +import { FactionName } from "@enums"; import { Router } from "../../ui/GameRoot"; import { Page } from "../../ui/Router"; import { CinematicText } from "../../ui/React/CinematicText"; @@ -9,14 +9,14 @@ export function BladeburnerCinematic(): React.ReactElement { return ( { Router.toPage(Page.Terminal); dialogBoxCreate( - `Visit the National Security Agency (NSA) to apply for their ${FactionNames.Bladeburners} ` + + `Visit the National Security Agency (NSA) to apply for their ${FactionName.Bladeburners} ` + "division! You will need 100 of each combat stat before doing this.", ); }} diff --git a/src/Bladeburner/ui/StartButton.tsx b/src/Bladeburner/ui/StartButton.tsx index 25c13bb13..39327277f 100644 --- a/src/Bladeburner/ui/StartButton.tsx +++ b/src/Bladeburner/ui/StartButton.tsx @@ -4,7 +4,7 @@ import { Bladeburner } from "../Bladeburner"; import { BlackOperation } from "../BlackOperation"; import { Player } from "@player"; import Button from "@mui/material/Button"; -import { AugmentationNames } from "../../Augmentation/data/AugmentationNames"; +import { AugmentationName } from "@enums"; import { ActionIdentifier } from "../ActionIdentifier"; interface IProps { @@ -33,7 +33,7 @@ export function StartButton(props: IProps): React.ReactElement { if (disabled) return; props.bladeburner.action.type = props.type; props.bladeburner.action.name = props.name; - if (!Player.hasAugmentation(AugmentationNames.BladesSimulacrum, true)) Player.finishWork(true); + if (!Player.hasAugmentation(AugmentationName.BladesSimulacrum, true)) Player.finishWork(true); props.bladeburner.startAction(props.bladeburner.action); props.rerender(); } diff --git a/src/Bladeburner/ui/Stats.tsx b/src/Bladeburner/ui/Stats.tsx index b346c2423..69af2076a 100644 --- a/src/Bladeburner/ui/Stats.tsx +++ b/src/Bladeburner/ui/Stats.tsx @@ -1,7 +1,9 @@ import React, { useState, useEffect } from "react"; +import { Box, Button, Paper, Tooltip, Typography } from "@mui/material"; +import { Player } from "@player"; +import { FactionName } from "@enums"; import { convertTimeMsToTimeElapsedString } from "../../utils/StringHelperFunctions"; import { BladeburnerConstants } from "../data/Constants"; -import { Player } from "@player"; import { Money } from "../../ui/React/Money"; import { formatNumberNoSuffix, formatPopulation, formatBigNumber } from "../../ui/formatNumber"; import { Factions } from "../../Faction/Factions"; @@ -10,12 +12,6 @@ import { joinFaction } from "../../Faction/FactionHelpers"; import { Bladeburner } from "../Bladeburner"; import { TravelModal } from "./TravelModal"; -import Typography from "@mui/material/Typography"; -import Tooltip from "@mui/material/Tooltip"; -import Box from "@mui/material/Box"; -import Button from "@mui/material/Button"; -import Paper from "@mui/material/Paper"; -import { FactionNames } from "../../Faction/data/FactionNames"; interface IProps { bladeburner: Bladeburner; @@ -33,7 +29,7 @@ export function Stats(props: IProps): React.ReactElement { function openFaction(): void { if (!inFaction) return; - const faction = Factions[FactionNames.Bladeburners]; + const faction = Factions[FactionName.Bladeburners]; if (!faction.isMember) { joinFaction(faction); } diff --git a/src/Bladeburner/ui/TravelModal.tsx b/src/Bladeburner/ui/TravelModal.tsx index f5318fbd2..4d9687c03 100644 --- a/src/Bladeburner/ui/TravelModal.tsx +++ b/src/Bladeburner/ui/TravelModal.tsx @@ -1,11 +1,10 @@ import React from "react"; +import { Button, Typography } from "@mui/material"; +import { CityName } from "@enums"; import { Bladeburner } from "../Bladeburner"; import { WorldMap } from "../../ui/React/WorldMap"; import { Modal } from "../../ui/React/Modal"; -import { CityName } from "../../Enums"; import { Settings } from "../../Settings/Settings"; -import Typography from "@mui/material/Typography"; -import Button from "@mui/material/Button"; interface IProps { bladeburner: Bladeburner; diff --git a/src/Casino/CardDeck/Card.ts b/src/Casino/CardDeck/Card.ts index 575e1bf30..ae1b0469a 100644 --- a/src/Casino/CardDeck/Card.ts +++ b/src/Casino/CardDeck/Card.ts @@ -1,3 +1,4 @@ +// No enum helper needed, does not need to be in an Enums.ts // Enum values are lowercased to match css classes export enum Suit { Clubs = "clubs", diff --git a/src/CodingContracts.ts b/src/CodingContracts.ts index 446ac02b7..f46d412ee 100644 --- a/src/CodingContracts.ts +++ b/src/CodingContracts.ts @@ -55,6 +55,7 @@ for (const md of codingContractTypesMetadata) { ); } +// Numeric enum /** Enum representing the different types of rewards a Coding Contract can give */ export enum CodingContractRewardType { FactionReputation, @@ -63,6 +64,7 @@ export enum CodingContractRewardType { Money, // This must always be the last reward type } +// Numeric enum /** Enum representing the result when trying to solve the Contract */ export enum CodingContractResult { Success, diff --git a/src/Company/CompanyPosition.ts b/src/Company/CompanyPosition.ts index 16d4fe101..6c51270b2 100644 --- a/src/Company/CompanyPosition.ts +++ b/src/Company/CompanyPosition.ts @@ -1,7 +1,7 @@ import { Person as IPerson } from "@nsdefs"; import { CONSTANTS } from "../Constants"; import * as names from "./data/JobTracks"; -import { JobName } from "../Enums"; +import { JobName } from "@enums"; export interface IConstructorParams { name: JobName; diff --git a/src/Company/data/CompaniesMetadata.ts b/src/Company/data/CompaniesMetadata.ts index 0809c6703..5fa8cfdd2 100644 --- a/src/Company/data/CompaniesMetadata.ts +++ b/src/Company/data/CompaniesMetadata.ts @@ -1,8 +1,9 @@ import * as posNames from "./JobTracks"; import { IConstructorParams } from "../Company"; -import { LocationName } from "../../Enums"; +import { LocationName } from "@enums"; +// These are grossly typed, need to address // Create Objects containing Company Positions by category // Will help in metadata construction later const AllSoftwarePositions: Record = {}; diff --git a/src/Company/data/JobTracks.ts b/src/Company/data/JobTracks.ts index c90dc9776..b4d06aea2 100644 --- a/src/Company/data/JobTracks.ts +++ b/src/Company/data/JobTracks.ts @@ -1,4 +1,6 @@ -import { JobName } from "../../Enums"; +import { JobName } from "@enums"; + +// This entire file can be reworked to export const SoftwareCompanyPositions: JobName[] = [ JobName.software0, JobName.software1, diff --git a/src/Corporation/Actions.ts b/src/Corporation/Actions.ts index 9c4d50789..ef5192f13 100644 --- a/src/Corporation/Actions.ts +++ b/src/Corporation/Actions.ts @@ -12,10 +12,10 @@ import { OfficeSpace } from "./OfficeSpace"; import { Material } from "./Material"; import { Product } from "./Product"; import { Warehouse } from "./Warehouse"; -import { IndustryType } from "./data/Enums"; +import { IndustryType } from "@enums"; import { ResearchMap } from "./ResearchMap"; import { isRelevantMaterial } from "./ui/Helpers"; -import { CityName } from "../Enums"; +import { CityName } from "@enums"; import { getRandomInt } from "../utils/helpers/getRandomInt"; import { getRecordValues } from "../Types/Record"; diff --git a/src/Corporation/Corporation.ts b/src/Corporation/Corporation.ts index 3f5da798f..937519d85 100644 --- a/src/Corporation/Corporation.ts +++ b/src/Corporation/Corporation.ts @@ -1,3 +1,5 @@ +import { Player } from "@player"; +import { CorpUnlockName, CorpUpgradeName, LiteratureName } from "@enums"; import { CorporationState } from "./CorporationState"; import { CorpUnlocks } from "./data/CorporationUnlocks"; import { CorpUpgrades } from "./data/CorporationUpgrades"; @@ -6,15 +8,12 @@ import { Division } from "./Division"; import { BitNodeMultipliers } from "../BitNode/BitNodeMultipliers"; import { showLiterature } from "../Literature/LiteratureHelpers"; -import { LiteratureName } from "../Literature/data/LiteratureNames"; -import { Player } from "@player"; import { dialogBoxCreate } from "../ui/React/DialogBox"; import { constructorsForReviver, Generic_toJSON, Generic_fromJSON, IReviverValue } from "../utils/JSONReviver"; import { CorpStateName } from "@nsdefs"; import { calculateUpgradeCost } from "./helpers"; import { JSONMap, JSONSet } from "../Types/Jsonable"; -import { CorpUnlockName, CorpUpgradeName } from "./data/Enums"; import { formatMoney } from "../ui/formatNumber"; import { isPositiveInteger } from "../types"; import { createEnumKeyedRecord, getRecordValues } from "../Types/Record"; diff --git a/src/Corporation/Division.ts b/src/Corporation/Division.ts index 481383438..889f0df4a 100644 --- a/src/Corporation/Division.ts +++ b/src/Corporation/Division.ts @@ -1,8 +1,8 @@ +import { CorpMaterialName, CorpResearchName, CorpStateName } from "@nsdefs"; +import { CityName, CorpEmployeeJob, IndustryType } from "@enums"; import { constructorsForReviver, Generic_toJSON, Generic_fromJSON, IReviverValue } from "../utils/JSONReviver"; -import { CityName } from "../Enums"; import { IndustryResearchTrees, IndustriesData } from "./data/IndustryData"; import * as corpConstants from "./data/Constants"; -import { CorpEmployeeJob, IndustryType } from "./data/Enums"; import { getRandomInt } from "../utils/helpers/getRandomInt"; import { calculateEffectWithFactors } from "../utils/calculateEffectWithFactors"; import { OfficeSpace } from "./OfficeSpace"; @@ -12,7 +12,6 @@ import { isString } from "../utils/helpers/string"; import { MaterialInfo } from "./MaterialInfo"; import { Warehouse } from "./Warehouse"; import { Corporation } from "./Corporation"; -import { CorpMaterialName, CorpResearchName, CorpStateName } from "@nsdefs"; import { JSONMap, JSONSet } from "../Types/Jsonable"; import { PartialRecord, getRecordEntries, getRecordKeys, getRecordValues } from "../Types/Record"; import { Material } from "./Material"; diff --git a/src/Corporation/Enums.ts b/src/Corporation/Enums.ts new file mode 100644 index 000000000..8a8e7d977 --- /dev/null +++ b/src/Corporation/Enums.ts @@ -0,0 +1,111 @@ +import { Member } from "src/types"; + +export enum IndustryType { + Water = "Water Utilities", + Spring = "Spring Water", + Agriculture = "Agriculture", + Fishing = "Fishing", + Mining = "Mining", + Refinery = "Refinery", + Restaurant = "Restaurant", + Tobacco = "Tobacco", + Chemical = "Chemical", + Pharmaceutical = "Pharmaceutical", + Computers = "Computer Hardware", + Robotics = "Robotics", + Software = "Software", + Healthcare = "Healthcare", + RealEstate = "Real Estate", +} + +export enum CorpEmployeeJob { + Operations = "Operations", + Engineer = "Engineer", + Business = "Business", + Management = "Management", + RandD = "Research & Development", + Intern = "Intern", + Unassigned = "Unassigned", +} + +export enum CorpUnlockName { + Export = "Export", + SmartSupply = "Smart Supply", + MarketResearchDemand = "Market Research - Demand", + MarketDataCompetition = "Market Data - Competition", + VeChain = "VeChain", + ShadyAccounting = "Shady Accounting", + GovernmentPartnership = "Government Partnership", + WarehouseAPI = "Warehouse API", + OfficeAPI = "Office API", +} + +export enum CorpUpgradeName { + SmartFactories = "Smart Factories", + SmartStorage = "Smart Storage", + DreamSense = "DreamSense", + WilsonAnalytics = "Wilson Analytics", + NuoptimalNootropicInjectorImplants = "Nuoptimal Nootropic Injector Implants", + SpeechProcessorImplants = "Speech Processor Implants", + NeuralAccelerators = "Neural Accelerators", + FocusWires = "FocusWires", + ABCSalesBots = "ABC SalesBots", + ProjectInsight = "Project Insight", +} + +// As const + type for now, convert to enum later +export const CorpMaterialName = { + Water: "Water", + Ore: "Ore", + Minerals: "Minerals", + Food: "Food", + Plants: "Plants", + Metal: "Metal", + Hardware: "Hardware", + Chemicals: "Chemicals", + Drugs: "Drugs", + Robots: "Robots", + AiCores: "AI Cores", + RealEstate: "Real Estate", +} as const; +export type CorpMaterialName = Member; + +// As const + type for now, convert to enum later +export const SmartSupplyOption = { + leftovers: "leftovers", + imports: "imports", + none: "none", +} as const; +export type SmartSupplyOption = Member; + +// As const + type for now, convert to enum later +export const CorpBaseResearchName = { + Lab: "Hi-Tech R&D Laboratory", + AutoBrew: "AutoBrew", + AutoParty: "AutoPartyManager", + AutoDrug: "Automatic Drug Administration", + CPH4Inject: "CPH4 Injections", + Drones: "Drones", + DronesAssembly: "Drones - Assembly", + DronesTransport: "Drones - Transport", + GoJuice: "Go-Juice", + RecruitHR: "HRBuddy-Recruitment", + TrainingHR: "HRBuddy-Training", + MarketTa1: "Market-TA.I", + MarketTa2: "Market-TA.II", + Overclock: "Overclock", + SelfCorrectAssemblers: "Self-Correcting Assemblers", + Stimu: "Sti.mu", +} as const; +export type CorpBaseResearchName = Member; + +export const CorpProductResearchName = { + Capacity1: "uPgrade: Capacity.I", + Capacity2: "uPgrade: Capacity.II", + Dashboard: "uPgrade: Dashboard", + Fulcrum: "uPgrade: Fulcrum", +} as const; +export type CorpProductResearchName = Member; + +export const CorpResearchName = { ...CorpProductResearchName, ...CorpBaseResearchName }; +export type CorpResearchName = Member; diff --git a/src/Corporation/Export.ts b/src/Corporation/Export.ts index 63717d64e..430056737 100644 --- a/src/Corporation/Export.ts +++ b/src/Corporation/Export.ts @@ -1,4 +1,4 @@ -import { CityName } from "../Enums"; +import type { CityName } from "@enums"; export interface Export { division: string; diff --git a/src/Corporation/OfficeSpace.ts b/src/Corporation/OfficeSpace.ts index 57f95c640..efaee169d 100644 --- a/src/Corporation/OfficeSpace.ts +++ b/src/Corporation/OfficeSpace.ts @@ -1,10 +1,9 @@ -import { CorpEmployeeJob } from "./data/Enums"; +import { CityName, CorpEmployeeJob } from "@enums"; import * as corpConstants from "./data/Constants"; import { Generic_fromJSON, Generic_toJSON, IReviverValue, constructorsForReviver } from "../utils/JSONReviver"; import { Division } from "./Division"; import { Corporation } from "./Corporation"; import { getRandomInt } from "../utils/helpers/getRandomInt"; -import { CityName } from "../Enums"; import { createEnumKeyedRecord, getRecordKeys } from "../Types/Record"; interface IParams { diff --git a/src/Corporation/Product.ts b/src/Corporation/Product.ts index 3963cb091..1959492d5 100644 --- a/src/Corporation/Product.ts +++ b/src/Corporation/Product.ts @@ -1,12 +1,12 @@ -import { CorpEmployeeJob } from "./data/Enums"; +import type { Division } from "./Division"; + +import { CorpMaterialName } from "@nsdefs"; +import { CityName, CorpEmployeeJob } from "@enums"; import { IndustriesData } from "./data/IndustryData"; import { MaterialInfo } from "./MaterialInfo"; -import { Division } from "./Division"; import { Generic_fromJSON, Generic_toJSON, IReviverValue, constructorsForReviver } from "../utils/JSONReviver"; import { getRandomInt } from "../utils/helpers/getRandomInt"; -import { CityName } from "../Enums"; -import { CorpMaterialName } from "@nsdefs"; import { PartialRecord, createEnumKeyedRecord, getRecordEntries, getRecordKeys } from "../Types/Record"; interface IConstructorParams { diff --git a/src/Corporation/Warehouse.ts b/src/Corporation/Warehouse.ts index c20d5bda6..2d4720048 100644 --- a/src/Corporation/Warehouse.ts +++ b/src/Corporation/Warehouse.ts @@ -1,15 +1,14 @@ +import type { Corporation } from "./Corporation"; +import type { Division } from "./Division"; + import { Player } from "@player"; import { CorpMaterialName, CorpSmartSupplyOption } from "@nsdefs"; - +import { CityName, CorpUnlockName } from "@enums"; import { Material } from "./Material"; -import { Corporation } from "./Corporation"; -import { Division } from "./Division"; import { MaterialInfo } from "./MaterialInfo"; import { Generic_fromJSON, Generic_toJSON, IReviverValue, constructorsForReviver } from "../utils/JSONReviver"; -import { CityName } from "../Enums"; import { materialNames } from "./data/Constants"; import { createFullRecordFromEntries, getRecordEntries } from "../Types/Record"; -import { CorpUnlockName } from "./data/Enums"; interface IConstructorParams { division: Division; diff --git a/src/Corporation/data/Constants.ts b/src/Corporation/data/Constants.ts index dacf362e9..2dc986b74 100644 --- a/src/Corporation/data/Constants.ts +++ b/src/Corporation/data/Constants.ts @@ -1,21 +1,26 @@ import { CorpEmployeePosition, CorpIndustryName, - CorpMaterialName, + CorpMaterialName as APIMaterialName, CorpResearchName, CorpSmartSupplyOption, CorpStateName, - CorpUnlockName, - CorpUpgradeName, + CorpUnlockName as APIUnlockName, + CorpUpgradeName as APIUpgradeName, } from "@nsdefs"; import { CONSTANTS } from "../../Constants"; -import { IndustryType, CorpEmployeeJob } from "./Enums"; +import { + IndustryType, + CorpEmployeeJob, + CorpMaterialName, + CorpUnlockName, + CorpUpgradeName, + SmartSupplyOption, + CorpBaseResearchName, + CorpProductResearchName, +} from "@enums"; import { PositiveInteger } from "../../types"; -// For typed strings, we need runtime objects to do API typechecking against. - -// This structure + import * as corpConstants allows easier type definitions for individual properties. - /** Names of all corporation game states */ export const stateNames: CorpStateName[] = ["START", "PURCHASE", "PRODUCTION", "EXPORT", "SALE"], // TODO: remove IndustryType and EmployeePositions enums and just use the typed strings. @@ -24,70 +29,14 @@ export const stateNames: CorpStateName[] = ["START", "PURCHASE", "PRODUCTION", " /** Names of all industries. */ industryNames: CorpIndustryName[] = Object.values(IndustryType), /** Names of all materials */ - materialNames: CorpMaterialName[] = [ - "Water", - "Ore", - "Minerals", - "Food", - "Plants", - "Metal", - "Hardware", - "Chemicals", - "Drugs", - "Robots", - "AI Cores", - "Real Estate", - ], + materialNames: APIMaterialName[] = Object.values(CorpMaterialName), /** Names of all one-time corporation-wide unlocks */ - unlockNames: CorpUnlockName[] = [ - "Export", - "Smart Supply", - "Market Research - Demand", - "Market Data - Competition", - "VeChain", - "Shady Accounting", - "Government Partnership", - "Warehouse API", - "Office API", - ], - upgradeNames: CorpUpgradeName[] = [ - "Smart Factories", - "Smart Storage", - "DreamSense", - "Wilson Analytics", - "Nuoptimal Nootropic Injector Implants", - "Speech Processor Implants", - "Neural Accelerators", - "FocusWires", - "ABC SalesBots", - "Project Insight", - ], + unlockNames: APIUnlockName[] = Object.values(CorpUnlockName), + upgradeNames: APIUpgradeName[] = Object.values(CorpUpgradeName), /** Names of all reasearches common to all industries */ - researchNamesBase: CorpResearchName[] = [ - "Hi-Tech R&D Laboratory", - "AutoBrew", - "AutoPartyManager", - "Automatic Drug Administration", - "CPH4 Injections", - "Drones", - "Drones - Assembly", - "Drones - Transport", - "Go-Juice", - "HRBuddy-Recruitment", - "HRBuddy-Training", - "Market-TA.I", - "Market-TA.II", - "Overclock", - "Self-Correcting Assemblers", - "Sti.mu", - ], + researchNamesBase: CorpResearchName[] = Object.values(CorpBaseResearchName), /** Names of all researches only available to product industries */ - researchNamesProductOnly: CorpResearchName[] = [ - "uPgrade: Capacity.I", - "uPgrade: Capacity.II", - "uPgrade: Dashboard", - "uPgrade: Fulcrum", - ], + researchNamesProductOnly: CorpResearchName[] = Object.values(CorpProductResearchName), /** Names of all researches */ researchNames: CorpResearchName[] = [...researchNamesBase, ...researchNamesProductOnly], initialShares = 1e9, @@ -123,7 +72,7 @@ export const stateNames: CorpStateName[] = ["START", "PURCHASE", "PRODUCTION", " /** Minimum decay value for employee morale/energy */ minEmployeeDecay = 10, /** smart supply options */ - smartSupplyOptions: CorpSmartSupplyOption[] = ["leftovers", "imports", "none"], + smartSupplyOptions: CorpSmartSupplyOption[] = Object.values(SmartSupplyOption), PurchaseMultipliers = { x1: 1 as PositiveInteger, x5: 5 as PositiveInteger, diff --git a/src/Corporation/data/CorporationUnlocks.ts b/src/Corporation/data/CorporationUnlocks.ts index db79f55dc..43537f9be 100644 --- a/src/Corporation/data/CorporationUnlocks.ts +++ b/src/Corporation/data/CorporationUnlocks.ts @@ -1,4 +1,4 @@ -import { CorpUnlockName } from "./Enums"; +import { CorpUnlockName } from "@enums"; export interface CorpUnlock { name: CorpUnlockName; diff --git a/src/Corporation/data/CorporationUpgrades.ts b/src/Corporation/data/CorporationUpgrades.ts index e9583361a..364247d41 100644 --- a/src/Corporation/data/CorporationUpgrades.ts +++ b/src/Corporation/data/CorporationUpgrades.ts @@ -1,4 +1,4 @@ -import { CorpUpgradeName } from "./Enums"; +import { CorpUpgradeName } from "@enums"; export interface CorpUpgrade { name: CorpUpgradeName; diff --git a/src/Corporation/data/Enums.ts b/src/Corporation/data/Enums.ts deleted file mode 100644 index 54aec3f01..000000000 --- a/src/Corporation/data/Enums.ts +++ /dev/null @@ -1,52 +0,0 @@ -export enum IndustryType { - Water = "Water Utilities", - Spring = "Spring Water", - Agriculture = "Agriculture", - Fishing = "Fishing", - Mining = "Mining", - Refinery = "Refinery", - Restaurant = "Restaurant", - Tobacco = "Tobacco", - Chemical = "Chemical", - Pharmaceutical = "Pharmaceutical", - Computers = "Computer Hardware", - Robotics = "Robotics", - Software = "Software", - Healthcare = "Healthcare", - RealEstate = "Real Estate", -} - -export enum CorpEmployeeJob { - Operations = "Operations", - Engineer = "Engineer", - Business = "Business", - Management = "Management", - RandD = "Research & Development", - Intern = "Intern", - Unassigned = "Unassigned", -} - -export enum CorpUnlockName { - Export = "Export", - SmartSupply = "Smart Supply", - MarketResearchDemand = "Market Research - Demand", - MarketDataCompetition = "Market Data - Competition", - VeChain = "VeChain", - ShadyAccounting = "Shady Accounting", - GovernmentPartnership = "Government Partnership", - WarehouseAPI = "Warehouse API", - OfficeAPI = "Office API", -} - -export enum CorpUpgradeName { - SmartFactories = "Smart Factories", - SmartStorage = "Smart Storage", - DreamSense = "DreamSense", - WilsonAnalytics = "Wilson Analytics", - NuoptimalNootropicInjectorImplants = "Nuoptimal Nootropic Injector Implants", - SpeechProcessorImplants = "Speech Processor Implants", - NeuralAccelerators = "Neural Accelerators", - FocusWires = "FocusWires", - ABCSalesBots = "ABC SalesBots", - ProjectInsight = "Project Insight", -} diff --git a/src/Corporation/data/IndustryData.ts b/src/Corporation/data/IndustryData.ts index 1c2b9ddb4..c2b7e0ea5 100644 --- a/src/Corporation/data/IndustryData.ts +++ b/src/Corporation/data/IndustryData.ts @@ -1,7 +1,7 @@ import { CorpIndustryData } from "@nsdefs"; import { createFullRecordFromEntries } from "../../Types/Record"; -import { IndustryType } from "./Enums"; +import { IndustryType } from "@enums"; import { getBaseResearchTreeCopy, getProductIndustryResearchTreeCopy } from "./BaseResearchTree"; export const IndustriesData: Record = { diff --git a/src/Corporation/ui/CityTabs.tsx b/src/Corporation/ui/CityTabs.tsx index b6105ba7f..821a237a4 100644 --- a/src/Corporation/ui/CityTabs.tsx +++ b/src/Corporation/ui/CityTabs.tsx @@ -1,13 +1,13 @@ // React Components for the Corporation UI's City navigation tabs // These allow player to navigate between different cities for each industry +import type { OfficeSpace } from "../OfficeSpace"; + import React, { useState } from "react"; -import { OfficeSpace } from "../OfficeSpace"; +import { Tab, Tabs } from "@mui/material"; +import { CityName } from "@enums"; import { Division } from "./Division"; import { ExpandNewCity } from "./ExpandNewCity"; import { useDivision } from "./Context"; -import Tabs from "@mui/material/Tabs"; -import Tab from "@mui/material/Tab"; -import { CityName } from "../../Enums"; import { getRecordKeys } from "../../Types/Record"; interface IProps { diff --git a/src/Corporation/ui/Division.tsx b/src/Corporation/ui/Division.tsx index 3dcada66d..0f6846f6e 100644 --- a/src/Corporation/ui/Division.tsx +++ b/src/Corporation/ui/Division.tsx @@ -1,15 +1,14 @@ // React Component for managing the Corporation's Industry UI // This Industry component does NOT include the city tabs at the top import React from "react"; - +import { Box } from "@mui/material"; +import { CityName } from "@enums"; import { DivisionOffice } from "./DivisionOffice"; import { DivisionOverview } from "./DivisionOverview"; import { DivisionWarehouse } from "./DivisionWarehouse"; import { Warehouse } from "../Warehouse"; import { OfficeSpace } from "../OfficeSpace"; import { useCorporation, useDivision } from "./Context"; -import Box from "@mui/material/Box"; -import { CityName } from "../../Enums"; interface IProps { city: CityName; diff --git a/src/Corporation/ui/DivisionOffice.tsx b/src/Corporation/ui/DivisionOffice.tsx index d5ea09d24..7a59e5673 100644 --- a/src/Corporation/ui/DivisionOffice.tsx +++ b/src/Corporation/ui/DivisionOffice.tsx @@ -3,7 +3,7 @@ import React, { useState } from "react"; import { OfficeSpace } from "../OfficeSpace"; -import { CorpUnlockName, CorpEmployeeJob } from "../data/Enums"; +import { CorpUnlockName, CorpEmployeeJob } from "@enums"; import { BuyTea } from "../Actions"; import { MoneyCost } from "./MoneyCost"; diff --git a/src/Corporation/ui/DivisionOverview.tsx b/src/Corporation/ui/DivisionOverview.tsx index d88591537..a53b69cd5 100644 --- a/src/Corporation/ui/DivisionOverview.tsx +++ b/src/Corporation/ui/DivisionOverview.tsx @@ -2,7 +2,7 @@ // (top-left panel in the Division UI) import React, { useState } from "react"; -import { CorpUnlockName, IndustryType } from "../data/Enums"; +import { CorpUnlockName, IndustryType } from "@enums"; import { HireAdVert } from "../Actions"; import { formatBigNumber } from "../../ui/formatNumber"; import { createProgressBarText } from "../../utils/helpers/createProgressBarText"; diff --git a/src/Corporation/ui/DivisionWarehouse.tsx b/src/Corporation/ui/DivisionWarehouse.tsx index 338aadd16..7f0df5663 100644 --- a/src/Corporation/ui/DivisionWarehouse.tsx +++ b/src/Corporation/ui/DivisionWarehouse.tsx @@ -1,8 +1,10 @@ // React Component for displaying an Industry's warehouse information // (right-side panel in the Industry UI) import React, { useState } from "react"; - +import { createStyles, makeStyles } from "@mui/styles"; +import { Box, Button, Paper, Tooltip, Typography } from "@mui/material"; import * as corpConstants from "../data/Constants"; +import { CityName, CorpUnlockName } from "@enums"; import { Warehouse } from "../Warehouse"; import { SmartSupplyModal } from "./modals/SmartSupplyModal"; import { ProductElem } from "./ProductElem"; @@ -19,16 +21,7 @@ import { IndustryProductEquation } from "./IndustryProductEquation"; import { purchaseWarehouse } from "../Actions"; import { useCorporation, useDivision } from "./Context"; -import Typography from "@mui/material/Typography"; -import Tooltip from "@mui/material/Tooltip"; -import Paper from "@mui/material/Paper"; import { ButtonWithTooltip } from "../../ui/Components/ButtonWithTooltip"; -import Button from "@mui/material/Button"; -import Box from "@mui/material/Box"; -import makeStyles from "@mui/styles/makeStyles"; -import createStyles from "@mui/styles/createStyles"; -import { CityName } from "../../Enums"; -import { CorpUnlockName } from "../data/Enums"; interface WarehouseProps { corp: Corporation; diff --git a/src/Corporation/ui/ExpandNewCity.tsx b/src/Corporation/ui/ExpandNewCity.tsx index 7ce0db773..a12474650 100644 --- a/src/Corporation/ui/ExpandNewCity.tsx +++ b/src/Corporation/ui/ExpandNewCity.tsx @@ -1,5 +1,6 @@ import React, { useState } from "react"; import * as corpConstants from "../data/Constants"; +import { CityName } from "@enums"; import { dialogBoxCreate } from "../../ui/React/DialogBox"; import { purchaseOffice } from "../Actions"; import { MoneyCost } from "./MoneyCost"; @@ -8,7 +9,6 @@ import Typography from "@mui/material/Typography"; import MenuItem from "@mui/material/MenuItem"; import Select, { SelectChangeEvent } from "@mui/material/Select"; import { ButtonWithTooltip } from "../../ui/Components/ButtonWithTooltip"; -import { CityName } from "../../Enums"; interface IProps { cityStateSetter: (city: CityName | "Expand") => void; diff --git a/src/Corporation/ui/IndustryDescription.tsx b/src/Corporation/ui/IndustryDescription.tsx index 19140281c..0f6427c9b 100644 --- a/src/Corporation/ui/IndustryDescription.tsx +++ b/src/Corporation/ui/IndustryDescription.tsx @@ -4,7 +4,7 @@ import Typography from "@mui/material/Typography"; import { MoneyCost } from "./MoneyCost"; import { Corporation } from "../Corporation"; -import { IndustryType } from "../data/Enums"; +import { IndustryType } from "@enums"; import { IndustriesData } from "../data/IndustryData"; interface IProps { diff --git a/src/Corporation/ui/LevelableUpgrade.tsx b/src/Corporation/ui/LevelableUpgrade.tsx index 04d92de56..d625db64e 100644 --- a/src/Corporation/ui/LevelableUpgrade.tsx +++ b/src/Corporation/ui/LevelableUpgrade.tsx @@ -11,7 +11,7 @@ import { ButtonWithTooltip } from "../../ui/Components/ButtonWithTooltip"; import Box from "@mui/material/Box"; import Grid from "@mui/material/Grid"; import { calculateMaxAffordableUpgrade, calculateUpgradeCost } from "../helpers"; -import { CorpUpgradeName } from "../data/Enums"; +import { CorpUpgradeName } from "@enums"; import { PositiveInteger } from "../../types"; interface IProps { diff --git a/src/Corporation/ui/MainPanel.tsx b/src/Corporation/ui/MainPanel.tsx index 3a610c279..7d56c576c 100644 --- a/src/Corporation/ui/MainPanel.tsx +++ b/src/Corporation/ui/MainPanel.tsx @@ -6,7 +6,7 @@ import React from "react"; import { CityTabs } from "./CityTabs"; import { Context, useCorporation } from "./Context"; -import { CityName } from "../../Enums"; +import { CityName } from "@enums"; interface IProps { divisionName: string; diff --git a/src/Corporation/ui/MaterialElem.tsx b/src/Corporation/ui/MaterialElem.tsx index 4f0226e23..aee6110ba 100644 --- a/src/Corporation/ui/MaterialElem.tsx +++ b/src/Corporation/ui/MaterialElem.tsx @@ -1,28 +1,19 @@ // React Component for displaying an Industry's warehouse information // (right-side panel in the Industry UI) import React, { useState } from "react"; - +import { Box, Button, Paper, Tooltip, Typography } from "@mui/material"; +import { CityName, CorpUnlockName } from "@enums"; import { Material } from "../Material"; import { Warehouse } from "../Warehouse"; import { ExportModal } from "./modals/ExportModal"; import { MaterialMarketTaModal } from "./modals/MaterialMarketTaModal"; import { SellMaterialModal } from "./modals/SellMaterialModal"; import { PurchaseMaterialModal } from "./modals/PurchaseMaterialModal"; - import { formatBigNumber, formatCorpStat, formatMoney, formatQuality } from "../../ui/formatNumber"; - import { isString } from "../../utils/helpers/string"; import { Money } from "../../ui/React/Money"; import { useCorporation, useDivision } from "./Context"; - -import Typography from "@mui/material/Typography"; -import Tooltip from "@mui/material/Tooltip"; -import Paper from "@mui/material/Paper"; -import Button from "@mui/material/Button"; -import Box from "@mui/material/Box"; import { LimitMaterialProductionModal } from "./modals/LimitMaterialProductionModal"; -import { CityName } from "../../Enums"; -import { CorpUnlockName } from "../data/Enums"; interface IMaterialProps { warehouse: Warehouse; diff --git a/src/Corporation/ui/NewDivisionTab.tsx b/src/Corporation/ui/NewDivisionTab.tsx index 9110fc6b1..164a77401 100644 --- a/src/Corporation/ui/NewDivisionTab.tsx +++ b/src/Corporation/ui/NewDivisionTab.tsx @@ -8,7 +8,7 @@ import Typography from "@mui/material/Typography"; import { dialogBoxCreate } from "../../ui/React/DialogBox"; import { IndustriesData } from "../data/IndustryData"; -import { IndustryType } from "../data/Enums"; +import { IndustryType } from "@enums"; import { useCorporation } from "./Context"; import { NewDivision } from "../Actions"; diff --git a/src/Corporation/ui/ProductElem.tsx b/src/Corporation/ui/ProductElem.tsx index e77aa47f7..69ef55381 100644 --- a/src/Corporation/ui/ProductElem.tsx +++ b/src/Corporation/ui/ProductElem.tsx @@ -1,6 +1,6 @@ import React, { useState } from "react"; - -import type { CityName } from "src/Enums"; +import { Box, Button, Paper, Tooltip, Typography } from "@mui/material"; +import { CityName, CorpUnlockName } from "@enums"; import * as corpConstants from "../data/Constants"; import { Product } from "../Product"; import { DiscontinueProductModal } from "./modals/DiscontinueProductModal"; @@ -15,13 +15,6 @@ import { isString } from "../../utils/helpers/string"; import { Money } from "../../ui/React/Money"; import { useCorporation, useDivision } from "./Context"; -import Typography from "@mui/material/Typography"; -import Tooltip from "@mui/material/Tooltip"; -import Paper from "@mui/material/Paper"; -import Button from "@mui/material/Button"; -import Box from "@mui/material/Box"; -import { CorpUnlockName } from "../data/Enums"; - interface IProductProps { city: CityName; product: Product; diff --git a/src/Corporation/ui/Unlock.tsx b/src/Corporation/ui/Unlock.tsx index 5ffd3909e..13ef9e9e7 100644 --- a/src/Corporation/ui/Unlock.tsx +++ b/src/Corporation/ui/Unlock.tsx @@ -9,7 +9,7 @@ import Tooltip from "@mui/material/Tooltip"; import Button from "@mui/material/Button"; import Box from "@mui/material/Box"; import Grid from "@mui/material/Grid"; -import { CorpUnlockName } from "../data/Enums"; +import { CorpUnlockName } from "@enums"; import { dialogBoxCreate } from "../../ui/React/DialogBox"; interface UnlockProps { diff --git a/src/Corporation/ui/modals/ExportModal.tsx b/src/Corporation/ui/modals/ExportModal.tsx index 2235b6641..a3884f814 100644 --- a/src/Corporation/ui/modals/ExportModal.tsx +++ b/src/Corporation/ui/modals/ExportModal.tsx @@ -1,4 +1,5 @@ import React, { useState } from "react"; +import { CityName } from "@enums"; import { dialogBoxCreate } from "../../../ui/React/DialogBox"; import { Material } from "../../Material"; import { Export } from "../../Export"; @@ -13,7 +14,6 @@ import Button from "@mui/material/Button"; import Box from "@mui/material/Box"; import MenuItem from "@mui/material/MenuItem"; import Select, { SelectChangeEvent } from "@mui/material/Select"; -import { CityName } from "../../../Enums"; import { useRerender } from "../../../ui/React/hooks"; import { getRecordKeys } from "../../../Types/Record"; diff --git a/src/Corporation/ui/modals/LimitProductProductionModal.tsx b/src/Corporation/ui/modals/LimitProductProductionModal.tsx index 9689f7e1b..f14c30381 100644 --- a/src/Corporation/ui/modals/LimitProductProductionModal.tsx +++ b/src/Corporation/ui/modals/LimitProductProductionModal.tsx @@ -1,5 +1,5 @@ import React, { useEffect, useState } from "react"; -import type { CityName } from "../../../Enums"; +import type { CityName } from "@enums"; import type { Product } from "../../Product"; import { LimitProductProduction } from "../../Actions"; import { Modal } from "../../../ui/React/Modal"; diff --git a/src/Corporation/ui/modals/MakeProductModal.tsx b/src/Corporation/ui/modals/MakeProductModal.tsx index 6d8275c56..dd424945e 100644 --- a/src/Corporation/ui/modals/MakeProductModal.tsx +++ b/src/Corporation/ui/modals/MakeProductModal.tsx @@ -2,7 +2,7 @@ import React, { useState } from "react"; import { dialogBoxCreate } from "../../../ui/React/DialogBox"; import { Modal } from "../../../ui/React/Modal"; import { IndustriesData } from "../../data/IndustryData"; -import { IndustryType } from "../../data/Enums"; +import { IndustryType } from "@enums"; import { MakeProduct } from "../../Actions"; import { useCorporation, useDivision } from "../Context"; import Typography from "@mui/material/Typography"; @@ -12,7 +12,7 @@ import MenuItem from "@mui/material/MenuItem"; import Select, { SelectChangeEvent } from "@mui/material/Select"; import { KEY } from "../../../utils/helpers/keyCodes"; import { NumberInput } from "../../../ui/React/NumberInput"; -import { CityName } from "../../../Enums"; +import { CityName } from "@enums"; import { getRecordKeys } from "../../../Types/Record"; interface IProps { diff --git a/src/Corporation/ui/modals/SellDivisionModal.tsx b/src/Corporation/ui/modals/SellDivisionModal.tsx index a861b258d..95388f1cd 100644 --- a/src/Corporation/ui/modals/SellDivisionModal.tsx +++ b/src/Corporation/ui/modals/SellDivisionModal.tsx @@ -6,7 +6,7 @@ import Button from "@mui/material/Button"; import MenuItem from "@mui/material/MenuItem"; import Select, { SelectChangeEvent } from "@mui/material/Select"; import { useCorporation } from "../../ui/Context"; -import { CityName } from "../../../Enums"; +import { CityName } from "@enums"; import * as corpConstants from "../../data/Constants"; import { formatMoney } from "../../../ui/formatNumber"; import { removeDivision as removeDivision } from "../../Actions"; diff --git a/src/Corporation/ui/modals/SellProductModal.tsx b/src/Corporation/ui/modals/SellProductModal.tsx index 5c250a974..0b17a9996 100644 --- a/src/Corporation/ui/modals/SellProductModal.tsx +++ b/src/Corporation/ui/modals/SellProductModal.tsx @@ -10,7 +10,7 @@ import Button from "@mui/material/Button"; import FormControlLabel from "@mui/material/FormControlLabel"; import Switch from "@mui/material/Switch"; import { KEY } from "../../../utils/helpers/keyCodes"; -import { CityName } from "../../../Enums"; +import { CityName } from "@enums"; function initialPrice(product: Product, city: CityName): string { let val = String(product.cityData[city].desiredSellPrice || ""); diff --git a/src/CotMG/FragmentType.ts b/src/CotMG/FragmentType.ts index 09f3387e6..09c1bfc38 100644 --- a/src/CotMG/FragmentType.ts +++ b/src/CotMG/FragmentType.ts @@ -1,3 +1,4 @@ +// Numeric enum export enum FragmentType { // Special fragments for the UI None, diff --git a/src/CotMG/StaneksGift.ts b/src/CotMG/StaneksGift.ts index 1340fc6a2..4edfa4142 100644 --- a/src/CotMG/StaneksGift.ts +++ b/src/CotMG/StaneksGift.ts @@ -1,4 +1,5 @@ -import { FactionNames } from "../Faction/data/FactionNames"; +import { Player } from "@player"; +import { AugmentationName, FactionName } from "@enums"; import { Fragment } from "./Fragment"; import { ActiveFragment } from "./ActiveFragment"; import { FragmentType } from "./FragmentType"; @@ -9,8 +10,6 @@ import { StaneksGiftEvents } from "./StaneksGiftEvents"; import { Generic_fromJSON, Generic_toJSON, IReviverValue, constructorsForReviver } from "../utils/JSONReviver"; import { StanekConstants } from "./data/Constants"; import { BitNodeMultipliers } from "../BitNode/BitNodeMultipliers"; -import { Player } from "@player"; -import { AugmentationNames } from "../Augmentation/data/AugmentationNames"; import { defaultMultipliers, mergeMultipliers, Multipliers, scaleMultipliers } from "../PersonObjects/Multipliers"; import { StaticAugmentations } from "../Augmentation/StaticAugmentations"; import { getKeyList } from "../utils/helpers/getKeyList"; @@ -42,7 +41,7 @@ export class StaneksGift extends BaseGift { af.numCharge += threads / af.highestCharge; } - const cotmg = Factions[FactionNames.ChurchOfTheMachineGod]; + const cotmg = Factions[FactionName.ChurchOfTheMachineGod]; cotmg.playerReputation += (Player.mults.faction_rep * (Math.pow(threads, 0.95) * (cotmg.favor + 100))) / 1000; this.justCharged = true; } @@ -52,7 +51,7 @@ export class StaneksGift extends BaseGift { } process(numCycles = 1): void { - if (!Player.hasAugmentation(AugmentationNames.StaneksGift1)) return; + if (!Player.hasAugmentation(AugmentationName.StaneksGift1)) return; this.storedCycles += numCycles; const usedCycles = this.isBonusCharging ? 5 : 1; this.isBonusCharging = false; @@ -217,13 +216,13 @@ export class StaneksGift extends BaseGift { const mults = this.calculateMults(); Player.mults = mergeMultipliers(Player.mults, mults); Player.updateSkillLevels(); - const zoeAmt = Player.sleeves.reduce((n, sleeve) => n + (sleeve.hasAugmentation(AugmentationNames.ZOE) ? 1 : 0), 0); + const zoeAmt = Player.sleeves.reduce((n, sleeve) => n + (sleeve.hasAugmentation(AugmentationName.ZOE) ? 1 : 0), 0); if (zoeAmt === 0) return; // Less powerful for each copy. const scaling = 3 / (zoeAmt + 2); const sleeveMults = scaleMultipliers(mults, scaling); for (const sleeve of Player.sleeves) { - if (!sleeve.hasAugmentation(AugmentationNames.ZOE)) continue; + if (!sleeve.hasAugmentation(AugmentationName.ZOE)) continue; sleeve.resetMultipliers(); //reapplying augmentation's multiplier for (let i = 0; i < sleeve.augmentations.length; ++i) { diff --git a/src/Crime/Crime.ts b/src/Crime/Crime.ts index 18ceb9647..f418fe9d3 100644 --- a/src/Crime/Crime.ts +++ b/src/Crime/Crime.ts @@ -2,7 +2,7 @@ import { CONSTANTS } from "../Constants"; import { Player } from "@player"; import { Person as IPerson } from "@nsdefs"; import { WorkerScript } from "../Netscript/WorkerScript"; -import { CrimeType } from "../Enums"; +import { CrimeType } from "@enums"; import { CrimeWork } from "../Work/CrimeWork"; import { calculateIntelligenceBonus } from "../PersonObjects/formulas/intelligence"; diff --git a/src/Crime/CrimeHelpers.ts b/src/Crime/CrimeHelpers.ts index adcb71572..1200a739d 100644 --- a/src/Crime/CrimeHelpers.ts +++ b/src/Crime/CrimeHelpers.ts @@ -2,23 +2,22 @@ import { Crimes } from "./Crimes"; import { Crime } from "./Crime"; import { Player } from "@player"; -import { dialogBoxCreate } from "../ui/React/DialogBox"; -import { checkEnum } from "../utils/helpers/enum"; -import { CrimeType } from "../Enums"; +import { getEnumHelper } from "../utils/EnumHelper"; +import { CrimeType } from "@enums"; //This is only used for the player -export function determineCrimeSuccess(type: string): boolean { - if (!checkEnum(CrimeType, type)) { - dialogBoxCreate(`ERR: Unrecognized crime type: ${type} This is probably a bug please contact the developer`); - return false; - } +export function determineCrimeSuccess(type: CrimeType): boolean { const crime = Crimes[type]; const chance = crime.successRate(Player); return Math.random() <= chance; } export function findCrime(roughName: string): Crime | null { - if (checkEnum(CrimeType, roughName)) return Crimes[roughName]; + const helper = getEnumHelper("CrimeType"); + if (helper.isMember(roughName)) return Crimes[roughName]; + const fuzzMatch = getEnumHelper("CrimeType").fuzzyGetMember(roughName); + if (fuzzMatch) return Crimes[fuzzMatch]; + // This can probably all be removed roughName = roughName.toLowerCase(); if (roughName.includes("shoplift")) return Crimes[CrimeType.shoplift]; else if (roughName.includes("rob") && roughName.includes("store")) return Crimes[CrimeType.robStore]; @@ -33,5 +32,6 @@ export function findCrime(roughName: string): Crime | null { else if (roughName.includes("kidnap")) return Crimes[CrimeType.kidnap]; else if (roughName.includes("assassin")) return Crimes[CrimeType.assassination]; else if (roughName.includes("heist")) return Crimes[CrimeType.heist]; + // return null; } diff --git a/src/Crime/Crimes.ts b/src/Crime/Crimes.ts index e1d474519..cc2767d0e 100644 --- a/src/Crime/Crimes.ts +++ b/src/Crime/Crimes.ts @@ -1,6 +1,6 @@ import { Crime } from "./Crime"; import { CONSTANTS } from "../Constants"; -import { CrimeType } from "../Enums"; +import { CrimeType } from "@enums"; export const Crimes: Record = { [CrimeType.shoplift]: new Crime( diff --git a/src/Crime/Enums.ts b/src/Crime/Enums.ts new file mode 100644 index 000000000..997ef00c8 --- /dev/null +++ b/src/Crime/Enums.ts @@ -0,0 +1,14 @@ +export enum CrimeType { + shoplift = "Shoplift", + robStore = "Rob Store", + mug = "Mug", + larceny = "Larceny", + dealDrugs = "Deal Drugs", + bondForgery = "Bond Forgery", + traffickArms = "Traffick Arms", + homicide = "Homicide", + grandTheftAuto = "Grand Theft Auto", + kidnap = "Kidnap", + assassination = "Assassination", + heist = "Heist", +} diff --git a/src/DarkWeb/DarkWebItem.ts b/src/DarkWeb/DarkWebItem.ts index 505f423fd..362b3ef29 100644 --- a/src/DarkWeb/DarkWebItem.ts +++ b/src/DarkWeb/DarkWebItem.ts @@ -1,4 +1,4 @@ -import type { CompletedProgramName } from "../Programs/Programs"; +import type { CompletedProgramName } from "@enums"; export class DarkWebItem { program: CompletedProgramName; diff --git a/src/DarkWeb/DarkWebItems.ts b/src/DarkWeb/DarkWebItems.ts index cdf5eb5f8..cdb78305a 100644 --- a/src/DarkWeb/DarkWebItems.ts +++ b/src/DarkWeb/DarkWebItems.ts @@ -1,5 +1,5 @@ import { DarkWebItem } from "./DarkWebItem"; -import { CompletedProgramName } from "../Programs/Programs"; +import { CompletedProgramName } from "@enums"; export const DarkWebItems = { BruteSSHProgram: new DarkWebItem(CompletedProgramName.bruteSsh, 500e3, "Opens up SSH Ports."), diff --git a/src/DevMenu.tsx b/src/DevMenu.tsx index ca07bc16e..c7ba32f31 100644 --- a/src/DevMenu.tsx +++ b/src/DevMenu.tsx @@ -1,5 +1,5 @@ import { Player } from "@player"; -import { AugmentationNames } from "./Augmentation/data/AugmentationNames"; +import { AugmentationName } from "@enums"; import React, { useEffect } from "react"; @@ -52,7 +52,7 @@ export function DevMenuRoot(): React.ReactElement { {Player.hasWseAccount && } {Player.sleeves.length > 0 && } - {Player.augmentations.some((aug) => aug.name === AugmentationNames.StaneksGift1) && } + {Player.augmentations.some((aug) => aug.name === AugmentationName.StaneksGift1) && } diff --git a/src/DevMenu/ui/Augmentations.tsx b/src/DevMenu/ui/Augmentations.tsx index 49ad2d9d1..c79e36c8a 100644 --- a/src/DevMenu/ui/Augmentations.tsx +++ b/src/DevMenu/ui/Augmentations.tsx @@ -1,3 +1,5 @@ +import { Player } from "@player"; +import React, { useState } from "react"; import { Clear, ExpandMore, Reply, ReplyAll } from "@mui/icons-material"; import { Accordion, @@ -10,9 +12,7 @@ import { SelectChangeEvent, Typography, } from "@mui/material"; -import React, { useState } from "react"; -import { AugmentationNames } from "../../Augmentation/data/AugmentationNames"; -import { Player } from "@player"; +import { AugmentationName } from "@enums"; export function Augmentations(): React.ReactElement { const [augmentation, setAugmentation] = useState("Augmented Targeting I"); @@ -25,7 +25,7 @@ export function Augmentations(): React.ReactElement { } function queueAllAugs(): void { - for (const augName of Object.values(AugmentationNames)) { + for (const augName of Object.values(AugmentationName)) { Player.queueAugmentation(augName); } } @@ -65,7 +65,7 @@ export function Augmentations(): React.ReactElement { } > - {Object.values(AugmentationNames).map((aug) => ( + {Object.values(AugmentationName).map((aug) => ( {aug} diff --git a/src/DevMenu/ui/Bladeburner.tsx b/src/DevMenu/ui/Bladeburner.tsx index c421d0375..f8ef95dfd 100644 --- a/src/DevMenu/ui/Bladeburner.tsx +++ b/src/DevMenu/ui/Bladeburner.tsx @@ -15,7 +15,7 @@ import Select, { SelectChangeEvent } from "@mui/material/Select"; import DeleteIcon from "@mui/icons-material/Delete"; import { Adjuster } from "./Adjuster"; import { Player } from "@player"; -import { CityName } from "../../Enums"; +import { CityName } from "@enums"; import { Skills as AllSkills } from "../../Bladeburner/Skills"; import { SkillNames } from "../../Bladeburner/data/SkillNames"; diff --git a/src/DevMenu/ui/Companies.tsx b/src/DevMenu/ui/Companies.tsx index cf64bea52..dc90e1fb3 100644 --- a/src/DevMenu/ui/Companies.tsx +++ b/src/DevMenu/ui/Companies.tsx @@ -4,19 +4,19 @@ import Accordion from "@mui/material/Accordion"; import AccordionSummary from "@mui/material/AccordionSummary"; import AccordionDetails from "@mui/material/AccordionDetails"; import ExpandMoreIcon from "@mui/icons-material/ExpandMore"; - import Typography from "@mui/material/Typography"; import Button from "@mui/material/Button"; import Select, { SelectChangeEvent } from "@mui/material/Select"; -import { Companies as AllCompanies } from "../../Company/Companies"; import MenuItem from "@mui/material/MenuItem"; + +import { FactionName } from "@enums"; +import { Companies as AllCompanies } from "../../Company/Companies"; import { Adjuster } from "./Adjuster"; -import { FactionNames } from "../../Faction/data/FactionNames"; const bigNumber = 1e12; export function Companies(): React.ReactElement { - const [company, setCompany] = useState(FactionNames.ECorp as string); + const [company, setCompany] = useState(FactionName.ECorp as string); function setCompanyDropdown(event: SelectChangeEvent): void { setCompany(event.target.value); } diff --git a/src/DevMenu/ui/Factions.tsx b/src/DevMenu/ui/Factions.tsx index 68efd51e9..0b6d1d35f 100644 --- a/src/DevMenu/ui/Factions.tsx +++ b/src/DevMenu/ui/Factions.tsx @@ -1,28 +1,30 @@ import React, { useState } from "react"; -import Accordion from "@mui/material/Accordion"; -import AccordionSummary from "@mui/material/AccordionSummary"; -import AccordionDetails from "@mui/material/AccordionDetails"; +import { Player } from "@player"; +import { FactionName } from "@enums"; +import { + Accordion, + AccordionSummary, + AccordionDetails, + Button, + FormControl, + IconButton, + InputLabel, + MenuItem, + Typography, +} from "@mui/material"; import ExpandMoreIcon from "@mui/icons-material/ExpandMore"; -import Typography from "@mui/material/Typography"; -import Button from "@mui/material/Button"; import Select, { SelectChangeEvent } from "@mui/material/Select"; import { Adjuster } from "./Adjuster"; -import { Player } from "@player"; import { Factions as AllFaction } from "../../Faction/Factions"; -import FormControl from "@mui/material/FormControl"; -import MenuItem from "@mui/material/MenuItem"; -import IconButton from "@mui/material/IconButton"; import ReplyAllIcon from "@mui/icons-material/ReplyAll"; import ReplyIcon from "@mui/icons-material/Reply"; -import InputLabel from "@mui/material/InputLabel"; -import { FactionNames } from "../../Faction/data/FactionNames"; const bigNumber = 1e12; export function Factions(): React.ReactElement { - const [faction, setFaction] = useState(FactionNames.Illuminati as string); + const [faction, setFaction] = useState(FactionName.Illuminati as string); function setFactionDropdown(event: SelectChangeEvent): void { setFaction(event.target.value); @@ -33,7 +35,7 @@ export function Factions(): React.ReactElement { } function receiveAllInvites(): void { - Object.values(FactionNames).forEach((faction) => Player.receiveInvite(faction)); + Object.values(FactionName).forEach((faction) => Player.receiveInvite(faction)); } function modifyFactionRep(modifier: number): (x: number) => void { diff --git a/src/DevMenu/ui/General.tsx b/src/DevMenu/ui/General.tsx index d58bceedc..6db4eeac5 100644 --- a/src/DevMenu/ui/General.tsx +++ b/src/DevMenu/ui/General.tsx @@ -11,7 +11,7 @@ import { Router } from "../../ui/GameRoot"; import { MenuItem, SelectChangeEvent, TextField, Select } from "@mui/material"; import { Bladeburner } from "../../Bladeburner/Bladeburner"; import { GangConstants } from "../../Gang/data/Constants"; -import { FactionNames } from "../../Faction/data/FactionNames"; +import { FactionName } from "@enums"; import { checkForMessagesToSend } from "../../Message/MessageHelpers"; import { ThemeEvents } from "../../Themes/ui/Theme"; @@ -61,7 +61,7 @@ export function General(): React.ReactElement { // Gang functions const startGang = () => { - const isHacking = gangFaction === FactionNames.NiteSec || gangFaction === FactionNames.TheBlackHand; + const isHacking = gangFaction === FactionName.NiteSec || gangFaction === FactionName.TheBlackHand; Player.startGang(gangFaction, isHacking); // Rerender so the gang menu option will show up immediately on the devmenu page selection ThemeEvents.emit(); diff --git a/src/DevMenu/ui/Programs.tsx b/src/DevMenu/ui/Programs.tsx index 17beca121..939005003 100644 --- a/src/DevMenu/ui/Programs.tsx +++ b/src/DevMenu/ui/Programs.tsx @@ -10,7 +10,7 @@ import Button from "@mui/material/Button"; import Select, { SelectChangeEvent } from "@mui/material/Select"; import { Player } from "@player"; import MenuItem from "@mui/material/MenuItem"; -import { CompletedProgramName } from "../../Programs/Programs"; +import { CompletedProgramName } from "@enums"; export function Programs(): React.ReactElement { const [program, setProgram] = useState(CompletedProgramName.bruteSsh); diff --git a/src/DevMenu/ui/SaveFile.tsx b/src/DevMenu/ui/SaveFile.tsx index a54ddce18..a80b278ea 100644 --- a/src/DevMenu/ui/SaveFile.tsx +++ b/src/DevMenu/ui/SaveFile.tsx @@ -7,7 +7,8 @@ import ExpandMoreIcon from "@mui/icons-material/ExpandMore"; import Typography from "@mui/material/Typography"; import { saveObject } from "../../SaveObject"; -import { SnackbarEvents, ToastVariant } from "../../ui/React/Snackbar"; +import { SnackbarEvents } from "../../ui/React/Snackbar"; +import { ToastVariant } from "@enums"; import { Upload } from "@mui/icons-material"; import { Button } from "@mui/material"; import { OptionSwitch } from "../../ui/React/OptionSwitch"; diff --git a/src/Electron.tsx b/src/Electron.tsx index 21ab46407..2d6140bfe 100644 --- a/src/Electron.tsx +++ b/src/Electron.tsx @@ -1,7 +1,8 @@ import { Player } from "@player"; import { Router } from "./ui/GameRoot"; import { Terminal } from "./Terminal"; -import { SnackbarEvents, ToastVariant } from "./ui/React/Snackbar"; +import { SnackbarEvents } from "./ui/React/Snackbar"; +import { ToastVariant } from "@enums"; import { IReturnStatus } from "./types"; import { GetServer } from "./Server/AllServers"; import { ImportPlayerData, SaveData, saveObject } from "./SaveObject"; diff --git a/src/Enums.ts b/src/Enums.ts index f305cfafe..6d3b3190f 100644 --- a/src/Enums.ts +++ b/src/Enums.ts @@ -1,157 +1,14 @@ -/** Job for company work */ -export enum JobName { - software0 = "Software Engineering Intern", - software1 = "Junior Software Engineer", - software2 = "Senior Software Engineer", - software3 = "Lead Software Developer", - software4 = "Head of Software", - software5 = "Head of Engineering", - software6 = "Vice President of Technology", - software7 = "Chief Technology Officer", - IT0 = "IT Intern", - IT1 = "IT Analyst", - IT2 = "IT Manager", - IT3 = "Systems Administrator", - securityEng = "Security Engineer", - networkEng0 = "Network Engineer", - networkEng1 = "Network Administrator", - business0 = "Business Intern", - business1 = "Business Analyst", - business2 = "Business Manager", - business3 = "Operations Manager", - business4 = "Chief Financial Officer", - business5 = "Chief Executive Officer", - security0 = "Police Officer", - security1 = "Police Chief", - security2 = "Security Guard", - security3 = "Security Officer", - security4 = "Security Supervisor", - security5 = "Head of Security", - agent0 = "Field Agent", - agent1 = "Secret Agent", - agent2 = "Special Operative", - waiter = "Waiter", - employee = "Employee", - softwareConsult0 = "Software Consultant", - softwareConsult1 = "Senior Software Consultant", - businessConsult0 = "Business Consultant", - businessConsult1 = "Senior Business Consultant", - waiterPT = "Part-time Waiter", - employeePT = "Part-time Employee", -} +// Using this file makes importing enums easier, and also verifies that no enums have the same name as each other -/** Crime names */ -export enum CrimeType { - shoplift = "Shoplift", - robStore = "Rob Store", - mug = "Mug", - larceny = "Larceny", - dealDrugs = "Deal Drugs", - bondForgery = "Bond Forgery", - traffickArms = "Traffick Arms", - homicide = "Homicide", - grandTheftAuto = "Grand Theft Auto", - kidnap = "Kidnap", - assassination = "Assassination", - heist = "Heist", -} - -export enum FactionWorkType { - hacking = "hacking", - field = "field", - security = "security", -} - -export enum UniversityClassType { - computerScience = "Computer Science", - dataStructures = "Data Structures", - networks = "Networks", - algorithms = "Algorithms", - management = "Management", - leadership = "Leadership", -} - -//Uses skill short codes to allow easier fuzzy matching with player input -export enum GymType { - strength = "str", - defense = "def", - dexterity = "dex", - agility = "agi", -} - -/** Names of all cities */ -export enum CityName { - Aevum = "Aevum", - Chongqing = "Chongqing", - Sector12 = "Sector-12", - NewTokyo = "New Tokyo", - Ishima = "Ishima", - Volhaven = "Volhaven", -} - -/** Names of all locations */ -export enum LocationName { - AevumAeroCorp = "AeroCorp", - AevumBachmanAndAssociates = "Bachman & Associates", - AevumClarkeIncorporated = "Clarke Incorporated", - AevumCrushFitnessGym = "Crush Fitness Gym", - AevumECorp = "ECorp", - AevumFulcrumTechnologies = "Fulcrum Technologies", - AevumGalacticCybersystems = "Galactic Cybersystems", - AevumNetLinkTechnologies = "NetLink Technologies", - AevumPolice = "Aevum Police Headquarters", - AevumRhoConstruction = "Rho Construction", - AevumSnapFitnessGym = "Snap Fitness Gym", - AevumSummitUniversity = "Summit University", - AevumWatchdogSecurity = "Watchdog Security", - AevumCasino = "Iker Molina Casino", - - ChongqingKuaiGongInternational = "KuaiGong International", - ChongqingSolarisSpaceSystems = "Solaris Space Systems", - ChongqingChurchOfTheMachineGod = "Church of the Machine God", - - Sector12AlphaEnterprises = "Alpha Enterprises", - Sector12BladeIndustries = "Blade Industries", - Sector12CIA = "Central Intelligence Agency", - Sector12CarmichaelSecurity = "Carmichael Security", - Sector12CityHall = "Sector-12 City Hall", - Sector12DeltaOne = "DeltaOne", - Sector12FoodNStuff = "FoodNStuff", - Sector12FourSigma = "Four Sigma", - Sector12IcarusMicrosystems = "Icarus Microsystems", - Sector12IronGym = "Iron Gym", - Sector12JoesGuns = "Joe's Guns", - Sector12MegaCorp = "MegaCorp", - Sector12NSA = "National Security Agency", - Sector12PowerhouseGym = "Powerhouse Gym", - Sector12RothmanUniversity = "Rothman University", - Sector12UniversalEnergy = "Universal Energy", - - NewTokyoDefComm = "DefComm", - NewTokyoGlobalPharmaceuticals = "Global Pharmaceuticals", - NewTokyoNoodleBar = "Noodle Bar", - NewTokyoVitaLife = "VitaLife", - NewTokyoArcade = "Arcade", - - IshimaNovaMedical = "Nova Medical", - IshimaOmegaSoftware = "Omega Software", - IshimaStormTechnologies = "Storm Technologies", - IshimaGlitch = "0x6C1", - - VolhavenCompuTek = "CompuTek", - VolhavenHeliosLabs = "Helios Labs", - VolhavenLexoCorp = "LexoCorp", - VolhavenMilleniumFitnessGym = "Millenium Fitness Gym", - VolhavenNWO = "NWO", - VolhavenOmniTekIncorporated = "OmniTek Incorporated", - VolhavenOmniaCybersystems = "Omnia Cybersystems", - VolhavenSysCoreSecurities = "SysCore Securities", - VolhavenZBInstituteOfTechnology = "ZB Institute of Technology", - - Hospital = "Hospital", - Slums = "The Slums", - TravelAgency = "Travel Agency", - WorldStockExchange = "World Stock Exchange", - - Void = "The Void", -} +export * from "./Augmentation/Enums"; +export * from "./Bladeburner/Enums"; +export * from "./Corporation/Enums"; +export * from "./Crime/Enums"; +export * from "./Faction/Enums"; +export * from "./Literature/Enums"; +export * from "./Locations/Enums"; +export * from "./Message/Enums"; +export * from "./Programs/Enums"; +export * from "./StockMarket/Enums"; +export * from "./ui/Enums"; +export * from "./Work/Enums"; diff --git a/src/Exploits/Exploit.ts b/src/Exploits/Exploit.ts index ce7ab2217..27c259099 100644 --- a/src/Exploits/Exploit.ts +++ b/src/Exploits/Exploit.ts @@ -10,6 +10,7 @@ hacking game is very much in the spirit of the game. Source-File minus 1 is extremely weak because it can be fully level up quickly. */ +// Exploits don't need an enum helper so they are not in an enums file export enum Exploit { Bypass = "Bypass", PrototypeTampering = "PrototypeTampering", @@ -27,7 +28,7 @@ export enum Exploit { EditSaveFile = "EditSaveFile", } -const names: Record = { +const names: Record = { Bypass: "by circumventing the ram cost of document.", EditSaveFile: "by editing your save file.", PrototypeTampering: "by tampering with Numbers prototype.", @@ -41,11 +42,12 @@ const names: Record = { INeedARainbow: "by using the power of the rainbow.", }; -export function ExploitName(exploit: string): string { +export function ExploitName(exploit: Exploit): string { return names[exploit]; } +// Needed in case player edits save file poorly export function sanitizeExploits(exploits: Exploit[]): Exploit[] { - exploits = exploits.filter((e: Exploit) => Object.keys(Exploit).includes(e)); + exploits = exploits.filter((e: Exploit) => Object.values(Exploit).includes(e)); return [...new Set(exploits)]; } diff --git a/src/Faction/data/FactionNames.ts b/src/Faction/Enums.ts similarity index 97% rename from src/Faction/data/FactionNames.ts rename to src/Faction/Enums.ts index ebee021a6..c48999844 100644 --- a/src/Faction/data/FactionNames.ts +++ b/src/Faction/Enums.ts @@ -1,4 +1,4 @@ -export enum FactionNames { +export enum FactionName { Illuminati = "Illuminati", Daedalus = "Daedalus", TheCovenant = "The Covenant", diff --git a/src/Faction/FactionHelpers.tsx b/src/Faction/FactionHelpers.tsx index 295c461aa..41a296081 100644 --- a/src/Faction/FactionHelpers.tsx +++ b/src/Faction/FactionHelpers.tsx @@ -1,7 +1,7 @@ import { StaticAugmentations } from "../Augmentation/StaticAugmentations"; import { Augmentation } from "../Augmentation/Augmentation"; import { PlayerOwnedAugmentation } from "../Augmentation/PlayerOwnedAugmentation"; -import { AugmentationNames } from "../Augmentation/data/AugmentationNames"; +import { AugmentationName, FactionName } from "@enums"; import { BitNodeMultipliers } from "../BitNode/BitNodeMultipliers"; import { Faction } from "./Faction"; @@ -16,7 +16,6 @@ import { import { dialogBoxCreate } from "../ui/React/DialogBox"; import { InvitationEvent } from "./ui/InvitationModal"; -import { FactionNames } from "./data/FactionNames"; import { SFC32RNG } from "../Casino/RNG"; import { isFactionWork } from "../Work/FactionWork"; @@ -32,7 +31,7 @@ export function joinFaction(faction: Faction): void { if (faction.isMember) return; faction.isMember = true; Player.factions.push(faction.name); - const allFactions = Object.values(FactionNames).map((faction) => faction as string); + const allFactions = Object.values(FactionName).map((faction) => faction as string); Player.factions.sort((a, b) => allFactions.indexOf(a) - allFactions.indexOf(b)); const factionInfo = faction.getInfo(); @@ -80,7 +79,7 @@ export function purchaseAugmentation(aug: Augmentation, fac: Faction, sing = fal dialogBoxCreate(txt); } else if (augCosts.moneyCost === 0 || Player.money >= augCosts.moneyCost) { const queuedAugmentation = new PlayerOwnedAugmentation(aug.name); - if (aug.name == AugmentationNames.NeuroFluxGovernor) { + if (aug.name == AugmentationName.NeuroFluxGovernor) { queuedAugmentation.level = aug.getLevel(); } Player.queuedAugmentations.push(queuedAugmentation); @@ -138,11 +137,11 @@ export const getFactionAugmentationsFiltered = (faction: Faction): string[] => { let augs = Object.values(StaticAugmentations); // Remove special augs - augs = augs.filter((a) => !a.isSpecial && a.name !== AugmentationNames.CongruityImplant); + augs = augs.filter((a) => !a.isSpecial && a.name !== AugmentationName.CongruityImplant); if (Player.bitNodeN === 2) { // TRP is not available outside of BN2 for Gangs - augs.push(StaticAugmentations[AugmentationNames.TheRedPill]); + augs.push(StaticAugmentations[AugmentationName.TheRedPill]); } const rng = SFC32RNG(`BN${Player.bitNodeN}.${Player.sourceFileLvl(Player.bitNodeN)}`); diff --git a/src/Faction/FactionInfo.tsx b/src/Faction/FactionInfo.tsx index f435a7dfb..68d804dee 100644 --- a/src/Faction/FactionInfo.tsx +++ b/src/Faction/FactionInfo.tsx @@ -1,5 +1,5 @@ import React from "react"; -import { FactionNames } from "./data/FactionNames"; +import { FactionName } from "@enums"; import { Router } from "../ui/GameRoot"; import { Page } from "../ui/Router"; import { Option } from "./ui/Option"; @@ -62,7 +62,7 @@ export class FactionInfo { /** A map of all factions and associated info to them. */ export const FactionInfos: Record = { // Endgame - [FactionNames.Illuminati]: new FactionInfo({ + [FactionName.Illuminati]: new FactionInfo({ infoText: ( <> Humanity never changes. No matter how civilized society becomes, it will eventually fall back into chaos. And @@ -73,13 +73,13 @@ export const FactionInfos: Record = { offerFieldWork: true, }), - [FactionNames.Daedalus]: new FactionInfo({ + [FactionName.Daedalus]: new FactionInfo({ infoText: <>Yesterday we obeyed kings and bent our necks to emperors. Today we kneel only to truth., offerHackingWork: true, offerFieldWork: true, }), - [FactionNames.TheCovenant]: new FactionInfo({ + [FactionName.TheCovenant]: new FactionInfo({ infoText: ( <> Surrender yourself. Give up your empty individuality to become part of something great, something eternal. @@ -94,11 +94,11 @@ export const FactionInfos: Record = { }), // Megacorporations, each forms its own faction - [FactionNames.ECorp]: new FactionInfo({ + [FactionName.ECorp]: new FactionInfo({ infoText: ( <> - {FactionNames.ECorp}'s mission is simple: to connect the world of today with the technology of tomorrow. With - our wide range of Internet-related software and commercial hardware, {FactionNames.ECorp} makes the world's + {FactionName.ECorp}'s mission is simple: to connect the world of today with the technology of tomorrow. With our + wide range of Internet-related software and commercial hardware, {FactionName.ECorp} makes the world's information universally accessible. ), @@ -108,15 +108,15 @@ export const FactionInfos: Record = { keepOnInstall: true, }), - [FactionNames.MegaCorp]: new FactionInfo({ + [FactionName.MegaCorp]: new FactionInfo({ infoText: ( <> - {FactionNames.MegaCorp} does what no other dares to do. We imagine. We create. We invent. We create what others + {FactionName.MegaCorp} does what no other dares to do. We imagine. We create. We invent. We create what others have never even dreamed of. Our work fills the world's needs for food, water, power, and transportation on an unprecedented scale, in ways that no other company can.

    - In our labs and factories and on the ground with customers, {FactionNames.MegaCorp} is ushering in a new era for + In our labs and factories and on the ground with customers, {FactionName.MegaCorp} is ushering in a new era for the world. ), @@ -126,7 +126,7 @@ export const FactionInfos: Record = { keepOnInstall: true, }), - [FactionNames.BachmanAssociates]: new FactionInfo({ + [FactionName.BachmanAssociates]: new FactionInfo({ infoText: ( <> Where Law and Business meet - that's where we are. @@ -141,7 +141,7 @@ export const FactionInfos: Record = { keepOnInstall: true, }), - [FactionNames.BladeIndustries]: new FactionInfo({ + [FactionName.BladeIndustries]: new FactionInfo({ infoText: <>Augmentation is Salvation., offerHackingWork: true, offerFieldWork: true, @@ -149,7 +149,7 @@ export const FactionInfos: Record = { keepOnInstall: true, }), - [FactionNames.NWO]: new FactionInfo({ + [FactionName.NWO]: new FactionInfo({ infoText: ( <> Humans don't truly desire freedom. They want to be observed, understood, and judged. They want to be given @@ -163,7 +163,7 @@ export const FactionInfos: Record = { keepOnInstall: true, }), - [FactionNames.ClarkeIncorporated]: new FactionInfo({ + [FactionName.ClarkeIncorporated]: new FactionInfo({ infoText: <>The Power of the Genome - Unlocked., offerHackingWork: true, offerFieldWork: true, @@ -171,7 +171,7 @@ export const FactionInfos: Record = { keepOnInstall: true, }), - [FactionNames.OmniTekIncorporated]: new FactionInfo({ + [FactionName.OmniTekIncorporated]: new FactionInfo({ infoText: <>Simply put, our mission is to design and build robots that make a difference., offerHackingWork: true, offerFieldWork: true, @@ -179,11 +179,11 @@ export const FactionInfos: Record = { keepOnInstall: true, }), - [FactionNames.FourSigma]: new FactionInfo({ + [FactionName.FourSigma]: new FactionInfo({ infoText: ( <> The scientific method is the best way to approach investing. Big strategies backed up with big data. Driven by - deep learning and innovative ideas. And improved by iteration. That's {FactionNames.FourSigma}. + deep learning and innovative ideas. And improved by iteration. That's {FactionName.FourSigma}. ), offerHackingWork: true, @@ -192,7 +192,7 @@ export const FactionInfos: Record = { keepOnInstall: true, }), - [FactionNames.KuaiGongInternational]: new FactionInfo({ + [FactionName.KuaiGongInternational]: new FactionInfo({ infoText: <>Dream big. Work hard. Make history., offerHackingWork: true, offerFieldWork: true, @@ -201,7 +201,7 @@ export const FactionInfos: Record = { }), // Other Corporations - [FactionNames.FulcrumSecretTechnologies]: new FactionInfo({ + [FactionName.FulcrumSecretTechnologies]: new FactionInfo({ infoText: ( <> The human organism has an innate desire to worship. That is why they created gods. If there were no gods, it @@ -214,7 +214,7 @@ export const FactionInfos: Record = { }), // Hacker groups - [FactionNames.BitRunners]: new FactionInfo({ + [FactionName.BitRunners]: new FactionInfo({ infoText: ( <> Our entire lives are controlled by bits. All of our actions, our thoughts, our personal information. It's all @@ -230,7 +230,7 @@ export const FactionInfos: Record = { offerHackingWork: true, }), - [FactionNames.TheBlackHand]: new FactionInfo({ + [FactionName.TheBlackHand]: new FactionInfo({ infoText: ( <> The world, so afraid of strong government, now has no government. Only power - Digital power. Financial power. @@ -246,7 +246,7 @@ export const FactionInfos: Record = { }), // prettier-ignore - [FactionNames.NiteSec]: new FactionInfo({ + [FactionName.NiteSec]: new FactionInfo({ infoText:(<> {" __..__ "}
    {" _.nITESECNIt. "}
    @@ -291,77 +291,71 @@ export const FactionInfos: Record = { }), // City factions, essentially governments - [FactionNames.Aevum]: new FactionInfo({ + [FactionName.Aevum]: new FactionInfo({ infoText: <>The Silicon City., - enemies: [FactionNames.Chongqing, FactionNames.NewTokyo, FactionNames.Ishima, FactionNames.Volhaven], + enemies: [FactionName.Chongqing, FactionName.NewTokyo, FactionName.Ishima, FactionName.Volhaven], offerHackingWork: true, offerFieldWork: true, offerSecurityWork: true, }), - [FactionNames.Chongqing]: new FactionInfo({ + [FactionName.Chongqing]: new FactionInfo({ infoText: <>Serve the People., - enemies: [FactionNames.Sector12, FactionNames.Aevum, FactionNames.Volhaven], + enemies: [FactionName.Sector12, FactionName.Aevum, FactionName.Volhaven], offerHackingWork: true, offerFieldWork: true, offerSecurityWork: true, }), - [FactionNames.Ishima]: new FactionInfo({ + [FactionName.Ishima]: new FactionInfo({ infoText: <>The East Asian Order of the Future., - enemies: [FactionNames.Sector12, FactionNames.Aevum, FactionNames.Volhaven], + enemies: [FactionName.Sector12, FactionName.Aevum, FactionName.Volhaven], offerHackingWork: true, offerFieldWork: true, offerSecurityWork: true, }), - [FactionNames.NewTokyo]: new FactionInfo({ + [FactionName.NewTokyo]: new FactionInfo({ infoText: <>Asia's World City., - enemies: [FactionNames.Sector12, FactionNames.Aevum, FactionNames.Volhaven], + enemies: [FactionName.Sector12, FactionName.Aevum, FactionName.Volhaven], offerHackingWork: true, offerFieldWork: true, offerSecurityWork: true, }), - [FactionNames.Sector12]: new FactionInfo({ + [FactionName.Sector12]: new FactionInfo({ infoText: <>The City of the Future., - enemies: [FactionNames.Chongqing, FactionNames.NewTokyo, FactionNames.Ishima, FactionNames.Volhaven], + enemies: [FactionName.Chongqing, FactionName.NewTokyo, FactionName.Ishima, FactionName.Volhaven], offerHackingWork: true, offerFieldWork: true, offerSecurityWork: true, }), - [FactionNames.Volhaven]: new FactionInfo({ + [FactionName.Volhaven]: new FactionInfo({ infoText: <>Benefit, Honor, and Glory., - enemies: [ - FactionNames.Chongqing, - FactionNames.Sector12, - FactionNames.NewTokyo, - FactionNames.Aevum, - FactionNames.Ishima, - ], + enemies: [FactionName.Chongqing, FactionName.Sector12, FactionName.NewTokyo, FactionName.Aevum, FactionName.Ishima], offerHackingWork: true, offerFieldWork: true, offerSecurityWork: true, }), // Criminal Organizations/Gangs - [FactionNames.SpeakersForTheDead]: new FactionInfo({ + [FactionName.SpeakersForTheDead]: new FactionInfo({ infoText: <>It is better to reign in Hell than to serve in Heaven., offerHackingWork: true, offerFieldWork: true, offerSecurityWork: true, }), - [FactionNames.TheDarkArmy]: new FactionInfo({ + [FactionName.TheDarkArmy]: new FactionInfo({ infoText: <>The World doesn't care about right or wrong. It only cares about power., offerHackingWork: true, offerFieldWork: true, }), - [FactionNames.TheSyndicate]: new FactionInfo({ + [FactionName.TheSyndicate]: new FactionInfo({ infoText: <>Honor holds you back., offerHackingWork: true, offerFieldWork: true, offerSecurityWork: true, }), - [FactionNames.Silhouette]: new FactionInfo({ + [FactionName.Silhouette]: new FactionInfo({ infoText: ( <> Corporations have filled the void of power left behind by the collapse of Western government. The issue is @@ -376,34 +370,34 @@ export const FactionInfos: Record = { offerFieldWork: true, }), - [FactionNames.Tetrads]: new FactionInfo({ + [FactionName.Tetrads]: new FactionInfo({ infoText: <>Following the mandate of Heaven and carrying out the way., offerFieldWork: true, offerSecurityWork: true, }), - [FactionNames.SlumSnakes]: new FactionInfo({ - infoText: <>{FactionNames.SlumSnakes} rule!, + [FactionName.SlumSnakes]: new FactionInfo({ + infoText: <>{FactionName.SlumSnakes} rule!, offerFieldWork: true, offerSecurityWork: true, }), // Early game factions - factions the player will prestige with early on that don't belong in other categories. - [FactionNames.Netburners]: new FactionInfo({ + [FactionName.Netburners]: new FactionInfo({ infoText: <>{"~~//*>H4CK||3T 8URN3R5**>?>\\~~"}, offerHackingWork: true, }), - [FactionNames.TianDiHui]: new FactionInfo({ + [FactionName.TianDiHui]: new FactionInfo({ infoText: <>Obey Heaven and work righteously., offerHackingWork: true, offerSecurityWork: true, }), - [FactionNames.CyberSec]: new FactionInfo({ + [FactionName.CyberSec]: new FactionInfo({ infoText: ( <> The Internet is the first thing that was built that we don't fully understand, the largest experiment in anarchy @@ -415,14 +409,14 @@ export const FactionInfos: Record = { }), // Special Factions - [FactionNames.Bladeburners]: new FactionInfo({ + [FactionName.Bladeburners]: new FactionInfo({ infoText: ( <> It's too bad they won't live. But then again, who does?

    - Note that for this faction, reputation can only be gained through {FactionNames.Bladeburners} actions.{" "} - Completing {FactionNames.Bladeburners} contracts/operations will increase your reputation. + Note that for this faction, reputation can only be gained through {FactionName.Bladeburners} actions. Completing{" "} + {FactionName.Bladeburners} contracts/operations will increase your reputation. ), @@ -438,7 +432,7 @@ export const FactionInfos: Record = { }, }), - [FactionNames.ChurchOfTheMachineGod]: new FactionInfo({ + [FactionName.ChurchOfTheMachineGod]: new FactionInfo({ // prettier-ignore infoText:(<> {" `` "}
    @@ -489,7 +483,7 @@ export const FactionInfos: Record = { ); }, }), - [FactionNames.ShadowsOfAnarchy]: new FactionInfo({ + [FactionName.ShadowsOfAnarchy]: new FactionInfo({ infoText: ( <> The government is ruled by the corporations that we have allowed to consume it. To release the world from its @@ -499,7 +493,7 @@ export const FactionInfos: Record = { special: true, keepOnInstall: true, assignment: (): React.ReactElement => { - return {FactionNames.ShadowsOfAnarchy} can only gain reputation by infiltrating.; + return {FactionName.ShadowsOfAnarchy} can only gain reputation by infiltrating.; }, }), }; diff --git a/src/Faction/ui/AugmentationsPage.tsx b/src/Faction/ui/AugmentationsPage.tsx index 224093627..55c1aa3ca 100644 --- a/src/Faction/ui/AugmentationsPage.tsx +++ b/src/Faction/ui/AugmentationsPage.tsx @@ -3,7 +3,7 @@ import React from "react"; import { StaticAugmentations } from "../../Augmentation/StaticAugmentations"; import { getGenericAugmentationPriceMultiplier } from "../../Augmentation/AugmentationHelpers"; -import { AugmentationNames } from "../../Augmentation/data/AugmentationNames"; +import { AugmentationName, FactionName } from "@enums"; import { PurchasableAugmentations } from "../../Augmentation/ui/PurchasableAugmentations"; import { PurchaseAugmentationsOrderSetting } from "../../Settings/SettingEnums"; import { Settings } from "../../Settings/Settings"; @@ -11,7 +11,6 @@ import { Player } from "@player"; import { formatBigNumber } from "../../ui/formatNumber"; import { Favor } from "../../ui/React/Favor"; import { Reputation } from "../../ui/React/Reputation"; -import { FactionNames } from "../data/FactionNames"; import { Faction } from "../Faction"; import { getFactionAugmentationsFiltered, hasAugmentationPrereqs, purchaseAugmentation } from "../FactionHelpers"; import { CONSTANTS } from "../../Constants"; @@ -121,13 +120,13 @@ export function AugmentationsPage(props: IProps): React.ReactElement { const augs = getAugsSorted(); const purchasable = augs.filter( (aug: string) => - aug === AugmentationNames.NeuroFluxGovernor || + aug === AugmentationName.NeuroFluxGovernor || (!Player.augmentations.some((a) => a.name === aug) && !Player.queuedAugmentations.some((a) => a.name === aug)), ); const owned = augs.filter((aug: string) => !purchasable.includes(aug)); const multiplierComponent = - props.faction.name !== FactionNames.ShadowsOfAnarchy ? ( + props.faction.name !== FactionName.ShadowsOfAnarchy ? ( @@ -144,7 +143,7 @@ export function AugmentationsPage(props: IProps): React.ReactElement { - This price multiplier increases for each {FactionNames.ShadowsOfAnarchy} augmentation already purchased. The + This price multiplier increases for each {FactionName.ShadowsOfAnarchy} augmentation already purchased. The multiplier is NOT reset when installing augmentations. } @@ -183,7 +182,7 @@ export function AugmentationsPage(props: IProps): React.ReactElement { = favorToDonate; - const canPurchaseSleeves = faction.name === FactionNames.TheCovenant && Player.bitNodeN === 10; + const canPurchaseSleeves = faction.name === FactionName.TheCovenant && Player.bitNodeN === 10; return ( <> diff --git a/src/Faction/ui/FactionsRoot.tsx b/src/Faction/ui/FactionsRoot.tsx index 67fbe4c23..8417b7321 100644 --- a/src/Faction/ui/FactionsRoot.tsx +++ b/src/Faction/ui/FactionsRoot.tsx @@ -5,7 +5,7 @@ import { Player } from "@player"; import { Settings } from "../../Settings/Settings"; import { formatFavor, formatReputation } from "../../ui/formatNumber"; import { Router } from "../../ui/GameRoot"; -import { FactionNames } from "../data/FactionNames"; +import { FactionName } from "@enums"; import { Faction } from "../Faction"; import { getFactionAugmentationsFiltered, joinFaction } from "../FactionHelpers"; import { Factions } from "../Factions"; @@ -175,7 +175,7 @@ export function FactionsRoot(): React.ReactElement { }); }, []); - const allFactions = Object.values(FactionNames).map((faction) => faction as string); + const allFactions = Object.values(FactionName).map((faction) => faction as string); const allJoinedFactions = [...Player.factions]; allJoinedFactions.sort((a, b) => allFactions.indexOf(a) - allFactions.indexOf(b)); const invitations = Player.factionInvitations; diff --git a/src/GameOptions/ui/GameOptionsSidebar.tsx b/src/GameOptions/ui/GameOptionsSidebar.tsx index b1bcbc576..0f7d43596 100644 --- a/src/GameOptions/ui/GameOptionsSidebar.tsx +++ b/src/GameOptions/ui/GameOptionsSidebar.tsx @@ -18,7 +18,8 @@ import { StyleEditorButton } from "../../Themes/ui/StyleEditorButton"; import { ThemeEditorButton } from "../../Themes/ui/ThemeEditorButton"; import { ConfirmationModal } from "../../ui/React/ConfirmationModal"; import { DeleteGameButton } from "../../ui/React/DeleteGameButton"; -import { SnackbarEvents, ToastVariant } from "../../ui/React/Snackbar"; +import { SnackbarEvents } from "../../ui/React/Snackbar"; +import { ToastVariant } from "@enums"; import { SoftResetButton } from "../../ui/React/SoftResetButton"; import { Router } from "../../ui/GameRoot"; import { Page } from "../../ui/Router"; diff --git a/src/Gang/AllGangs.ts b/src/Gang/AllGangs.ts index d7838b340..3e480f2cc 100644 --- a/src/Gang/AllGangs.ts +++ b/src/Gang/AllGangs.ts @@ -1,4 +1,4 @@ -import { FactionNames } from "../Faction/data/FactionNames"; +import { FactionName } from "@enums"; import { Reviver } from "../utils/JSONReviver"; interface GangTerritory { @@ -7,31 +7,31 @@ interface GangTerritory { } export let AllGangs: Record = { - [FactionNames.SlumSnakes]: { + [FactionName.SlumSnakes]: { power: 1, territory: 1 / 7, }, - [FactionNames.Tetrads]: { + [FactionName.Tetrads]: { power: 1, territory: 1 / 7, }, - [FactionNames.TheSyndicate]: { + [FactionName.TheSyndicate]: { power: 1, territory: 1 / 7, }, - [FactionNames.TheDarkArmy]: { + [FactionName.TheDarkArmy]: { power: 1, territory: 1 / 7, }, - [FactionNames.SpeakersForTheDead]: { + [FactionName.SpeakersForTheDead]: { power: 1, territory: 1 / 7, }, - [FactionNames.NiteSec]: { + [FactionName.NiteSec]: { power: 1, territory: 1 / 7, }, - [FactionNames.TheBlackHand]: { + [FactionName.TheBlackHand]: { power: 1, territory: 1 / 7, }, @@ -39,31 +39,31 @@ export let AllGangs: Record = { export function resetGangs(): void { AllGangs = { - [FactionNames.SlumSnakes]: { + [FactionName.SlumSnakes]: { power: 1, territory: 1 / 7, }, - [FactionNames.Tetrads]: { + [FactionName.Tetrads]: { power: 1, territory: 1 / 7, }, - [FactionNames.TheSyndicate]: { + [FactionName.TheSyndicate]: { power: 1, territory: 1 / 7, }, - [FactionNames.TheDarkArmy]: { + [FactionName.TheDarkArmy]: { power: 1, territory: 1 / 7, }, - [FactionNames.SpeakersForTheDead]: { + [FactionName.SpeakersForTheDead]: { power: 1, territory: 1 / 7, }, - [FactionNames.NiteSec]: { + [FactionName.NiteSec]: { power: 1, territory: 1 / 7, }, - [FactionNames.TheBlackHand]: { + [FactionName.TheBlackHand]: { power: 1, territory: 1 / 7, }, diff --git a/src/Gang/data/Constants.ts b/src/Gang/data/Constants.ts index f19c322de..b975dda12 100644 --- a/src/Gang/data/Constants.ts +++ b/src/Gang/data/Constants.ts @@ -1,5 +1,5 @@ import { CONSTANTS } from "../../Constants"; -import { FactionNames } from "../../Faction/data/FactionNames"; +import { FactionName } from "@enums"; export const GangConstants = { // Respect is divided by this to get rep gain @@ -10,13 +10,13 @@ export const GangConstants = { AscensionMultiplierRatio: 0.15, // Names of possible Gangs Names: [ - FactionNames.SlumSnakes, - FactionNames.Tetrads, - FactionNames.TheSyndicate, - FactionNames.TheDarkArmy, - FactionNames.SpeakersForTheDead, - FactionNames.NiteSec, - FactionNames.TheBlackHand, + FactionName.SlumSnakes, + FactionName.Tetrads, + FactionName.TheSyndicate, + FactionName.TheDarkArmy, + FactionName.SpeakersForTheDead, + FactionName.NiteSec, + FactionName.TheBlackHand, ] as string[], GangKarmaRequirement: -54000, /** Normal number of game cycles processed at once (2 seconds) */ diff --git a/src/Gang/data/power.ts b/src/Gang/data/power.ts index ee981ae60..517da8cae 100644 --- a/src/Gang/data/power.ts +++ b/src/Gang/data/power.ts @@ -1,10 +1,10 @@ -import { FactionNames } from "../../Faction/data/FactionNames"; +import { FactionName } from "@enums"; export const PowerMultiplier: Record = { - [FactionNames.SlumSnakes]: 1, - [FactionNames.Tetrads]: 2, - [FactionNames.TheSyndicate]: 2, - [FactionNames.TheDarkArmy]: 2, - [FactionNames.SpeakersForTheDead]: 5, - [FactionNames.NiteSec]: 2, - [FactionNames.TheBlackHand]: 5, + [FactionName.SlumSnakes]: 1, + [FactionName.Tetrads]: 2, + [FactionName.TheSyndicate]: 2, + [FactionName.TheDarkArmy]: 2, + [FactionName.SpeakersForTheDead]: 5, + [FactionName.NiteSec]: 2, + [FactionName.TheBlackHand]: 5, }; diff --git a/src/Gang/data/upgrades.ts b/src/Gang/data/upgrades.ts index 3ba387be7..6811a4162 100644 --- a/src/Gang/data/upgrades.ts +++ b/src/Gang/data/upgrades.ts @@ -7,6 +7,7 @@ export interface IMults { cha?: number; } +// Does not need an enum helper, not in an enums file export enum UpgradeType { Weapon = "w", Armor = "a", diff --git a/src/Hacknet/ui/HacknetUpgradeElem.tsx b/src/Hacknet/ui/HacknetUpgradeElem.tsx index 6b7233a37..38113fb70 100644 --- a/src/Hacknet/ui/HacknetUpgradeElem.tsx +++ b/src/Hacknet/ui/HacknetUpgradeElem.tsx @@ -15,7 +15,7 @@ import Typography from "@mui/material/Typography"; import Paper from "@mui/material/Paper"; import Button from "@mui/material/Button"; import { SelectChangeEvent } from "@mui/material/Select"; -import { FactionNames } from "../../Faction/data/FactionNames"; +import { FactionName } from "@enums"; import { companiesMetadata } from "../../Company/data/CompaniesMetadata"; interface IProps { @@ -29,7 +29,7 @@ const companiesMap: Record = {}; export function HacknetUpgradeElem(props: IProps): React.ReactElement { const [selectedServer, setSelectedServer] = useState( - serversMap[props.upg.name] ? serversMap[props.upg.name] : FactionNames.ECorp.toLowerCase(), + serversMap[props.upg.name] ? serversMap[props.upg.name] : FactionName.ECorp.toLowerCase(), ); function changeTargetServer(event: SelectChangeEvent): void { setSelectedServer(event.target.value); diff --git a/src/Infiltration/formulas/victory.ts b/src/Infiltration/formulas/victory.ts index eee81afac..77f483202 100644 --- a/src/Infiltration/formulas/victory.ts +++ b/src/Infiltration/formulas/victory.ts @@ -1,7 +1,7 @@ import { Player } from "@player"; import { BitNodeMultipliers } from "../../BitNode/BitNodeMultipliers"; import { LocationsMetadata } from "../../Locations/data/LocationsMetadata"; -import { AugmentationNames } from "../../Augmentation/data/AugmentationNames"; +import { AugmentationName } from "@enums"; import { Faction } from "../../Faction/Faction"; export function calculateSellInformationCashReward(reward: number, maxLevel: number, difficulty: number): number { @@ -12,7 +12,7 @@ export function calculateSellInformationCashReward(reward: number, maxLevel: num Math.pow(difficulty, 3) * 3e3 * levelBonus * - (Player.hasAugmentation(AugmentationNames.WKSharmonizer, true) ? 1.5 : 1) * + (Player.hasAugmentation(AugmentationName.WKSharmonizer, true) ? 1.5 : 1) * BitNodeMultipliers.InfiltrationMoney ); } @@ -25,7 +25,7 @@ export function calculateTradeInformationRepReward(reward: number, maxLevel: num Math.pow(difficulty, 1.2) * 30 * levelBonus * - (Player.hasAugmentation(AugmentationNames.WKSharmonizer, true) ? 1.5 : 1) * + (Player.hasAugmentation(AugmentationName.WKSharmonizer, true) ? 1.5 : 1) * BitNodeMultipliers.InfiltrationRep ); } @@ -38,6 +38,6 @@ export function calculateInfiltratorsRepReward(faction: Faction, difficulty: num const baseRepGain = (difficulty / maxStartingSecurityLevel) * 5000; return ( - baseRepGain * (Player.hasAugmentation(AugmentationNames.WKSharmonizer, true) ? 2 : 1) * (1 + faction.favor / 100) + baseRepGain * (Player.hasAugmentation(AugmentationName.WKSharmonizer, true) ? 2 : 1) * (1 + faction.favor / 100) ); } diff --git a/src/Infiltration/ui/BackwardGame.tsx b/src/Infiltration/ui/BackwardGame.tsx index 92c07621a..6f8fafa87 100644 --- a/src/Infiltration/ui/BackwardGame.tsx +++ b/src/Infiltration/ui/BackwardGame.tsx @@ -1,6 +1,6 @@ import { Paper, Typography } from "@mui/material"; import React, { useState } from "react"; -import { AugmentationNames } from "../../Augmentation/data/AugmentationNames"; +import { AugmentationName } from "@enums"; import { Player } from "@player"; import { KEY } from "../../utils/helpers/keyCodes"; import { random } from "../utils"; @@ -35,7 +35,7 @@ export function BackwardGame(props: IMinigameProps): React.ReactElement { const timer = difficulty.timer; const [answer] = useState(makeAnswer(difficulty)); const [guess, setGuess] = useState(""); - const hasAugment = Player.hasAugmentation(AugmentationNames.ChaosOfDionysus, true); + const hasAugment = Player.hasAugmentation(AugmentationName.ChaosOfDionysus, true); function ignorableKeyboardEvent(event: KeyboardEvent): boolean { return event.key === KEY.BACKSPACE || (event.shiftKey && event.key === "Shift") || event.ctrlKey || event.altKey; diff --git a/src/Infiltration/ui/BracketGame.tsx b/src/Infiltration/ui/BracketGame.tsx index 3ae6c2838..120883c16 100644 --- a/src/Infiltration/ui/BracketGame.tsx +++ b/src/Infiltration/ui/BracketGame.tsx @@ -1,6 +1,6 @@ import { Paper, Typography } from "@mui/material"; import React, { useState } from "react"; -import { AugmentationNames } from "../../Augmentation/data/AugmentationNames"; +import { AugmentationName } from "@enums"; import { Player } from "@player"; import { KEY } from "../../utils/helpers/keyCodes"; import { random } from "../utils"; @@ -32,7 +32,7 @@ const difficulties: { function generateLeftSide(difficulty: Difficulty): string { let str = ""; const options = [KEY.OPEN_BRACKET, KEY.LESS_THAN, KEY.OPEN_PARENTHESIS, KEY.OPEN_BRACE]; - if (Player.hasAugmentation(AugmentationNames.WisdomOfAthena, true)) { + if (Player.hasAugmentation(AugmentationName.WisdomOfAthena, true)) { options.splice(0, 1); } const length = random(difficulty.min, difficulty.max); diff --git a/src/Infiltration/ui/BribeGame.tsx b/src/Infiltration/ui/BribeGame.tsx index e861638dd..7c4ffe5bf 100644 --- a/src/Infiltration/ui/BribeGame.tsx +++ b/src/Infiltration/ui/BribeGame.tsx @@ -1,6 +1,6 @@ import { Paper, Typography } from "@mui/material"; import React, { useEffect, useState } from "react"; -import { AugmentationNames } from "../../Augmentation/data/AugmentationNames"; +import { AugmentationName } from "@enums"; import { Player } from "@player"; import { Settings } from "../../Settings/Settings"; import { KEY } from "../../utils/helpers/keyCodes"; @@ -46,7 +46,7 @@ export function BribeGame(props: IMinigameProps): React.ReactElement { let upColor = defaultColor; let downColor = defaultColor; let choiceColor = defaultColor; - const hasAugment = Player.hasAugmentation(AugmentationNames.BeautyOfAphrodite, true); + const hasAugment = Player.hasAugmentation(AugmentationName.BeautyOfAphrodite, true); if (hasAugment) { const upIndex = index + 1 >= choices.length ? 0 : index + 1; diff --git a/src/Infiltration/ui/CheatCodeGame.tsx b/src/Infiltration/ui/CheatCodeGame.tsx index c2d923f0e..0a3c19b45 100644 --- a/src/Infiltration/ui/CheatCodeGame.tsx +++ b/src/Infiltration/ui/CheatCodeGame.tsx @@ -1,6 +1,6 @@ import { Paper, Typography } from "@mui/material"; import React, { useState } from "react"; -import { AugmentationNames } from "../../Augmentation/data/AugmentationNames"; +import { AugmentationName } from "@enums"; import { Player } from "@player"; import { downArrowSymbol, @@ -41,7 +41,7 @@ export function CheatCodeGame(props: IMinigameProps): React.ReactElement { const timer = difficulty.timer; const [code] = useState(generateCode(difficulty)); const [index, setIndex] = useState(0); - const hasAugment = Player.hasAugmentation(AugmentationNames.TrickeryOfHermes, true); + const hasAugment = Player.hasAugmentation(AugmentationName.TrickeryOfHermes, true); function press(this: Document, event: KeyboardEvent): void { event.preventDefault(); diff --git a/src/Infiltration/ui/Cyberpunk2077Game.tsx b/src/Infiltration/ui/Cyberpunk2077Game.tsx index ef52f71d8..e75c2dd12 100644 --- a/src/Infiltration/ui/Cyberpunk2077Game.tsx +++ b/src/Infiltration/ui/Cyberpunk2077Game.tsx @@ -1,6 +1,6 @@ import { Paper, Typography, Box } from "@mui/material"; import React, { useState } from "react"; -import { AugmentationNames } from "../../Augmentation/data/AugmentationNames"; +import { AugmentationName } from "@enums"; import { Player } from "@player"; import { Settings } from "../../Settings/Settings"; import { KEY } from "../../utils/helpers/keyCodes"; @@ -45,7 +45,7 @@ export function Cyberpunk2077Game(props: IMinigameProps): React.ReactElement { const [currentAnswerIndex, setCurrentAnswerIndex] = useState(0); const [pos, setPos] = useState([0, 0]); - const hasAugment = Player.hasAugmentation(AugmentationNames.FloodOfPoseidon, true); + const hasAugment = Player.hasAugmentation(AugmentationName.FloodOfPoseidon, true); function press(this: Document, event: KeyboardEvent): void { event.preventDefault(); const move = [0, 0]; diff --git a/src/Infiltration/ui/Game.tsx b/src/Infiltration/ui/Game.tsx index 86bd616a0..e7640399d 100644 --- a/src/Infiltration/ui/Game.tsx +++ b/src/Infiltration/ui/Game.tsx @@ -1,6 +1,6 @@ import { Button, Container, Paper, Typography } from "@mui/material"; import React, { useState } from "react"; -import { AugmentationNames } from "../../Augmentation/data/AugmentationNames"; +import { AugmentationName } from "@enums"; import { Router } from "../../ui/GameRoot"; import { Page } from "../../ui/Router"; import { Player } from "@player"; @@ -92,7 +92,7 @@ export function Game(props: IProps): React.ReactElement { // it's clear they're not meant to const damage = options?.automated ? Player.hp.current - : props.StartingDifficulty * 3 * (Player.hasAugmentation(AugmentationNames.WKSharmonizer, true) ? 0.5 : 1); + : props.StartingDifficulty * 3 * (Player.hasAugmentation(AugmentationName.WKSharmonizer, true) ? 0.5 : 1); if (Player.takeDamage(damage)) { Router.toPage(Page.City); return; diff --git a/src/Infiltration/ui/GameTimer.tsx b/src/Infiltration/ui/GameTimer.tsx index f406dd3d9..176de5f87 100644 --- a/src/Infiltration/ui/GameTimer.tsx +++ b/src/Infiltration/ui/GameTimer.tsx @@ -1,6 +1,6 @@ import { Paper } from "@mui/material"; import React, { useEffect, useState } from "react"; -import { AugmentationNames } from "../../Augmentation/data/AugmentationNames"; +import { AugmentationName } from "@enums"; import { Player } from "@player"; import { ProgressBar } from "../../ui/React/Progress"; @@ -14,7 +14,7 @@ interface IProps { export function GameTimer(props: IProps): React.ReactElement { const [v, setV] = useState(100); const totalMillis = - (!props.ignoreAugment_WKSharmonizer && Player.hasAugmentation(AugmentationNames.WKSharmonizer, true) ? 1.3 : 1) * + (!props.ignoreAugment_WKSharmonizer && Player.hasAugmentation(AugmentationName.WKSharmonizer, true) ? 1.3 : 1) * props.millis; const tick = 200; diff --git a/src/Infiltration/ui/MinesweeperGame.tsx b/src/Infiltration/ui/MinesweeperGame.tsx index 67ab2ef25..1a9bb518b 100644 --- a/src/Infiltration/ui/MinesweeperGame.tsx +++ b/src/Infiltration/ui/MinesweeperGame.tsx @@ -2,7 +2,7 @@ import { Close, Flag, Report } from "@mui/icons-material"; import { Box, Paper, Typography } from "@mui/material"; import { uniqueId } from "lodash"; import React, { useEffect, useState } from "react"; -import { AugmentationNames } from "../../Augmentation/data/AugmentationNames"; +import { AugmentationName } from "@enums"; import { Player } from "@player"; import { Settings } from "../../Settings/Settings"; import { KEY } from "../../utils/helpers/keyCodes"; @@ -40,7 +40,7 @@ export function MinesweeperGame(props: IMinigameProps): React.ReactElement { const [answer, setAnswer] = useState(generateEmptyField(difficulty)); const [pos, setPos] = useState([0, 0]); const [memoryPhase, setMemoryPhase] = useState(true); - const hasAugment = Player.hasAugmentation(AugmentationNames.HuntOfArtemis, true); + const hasAugment = Player.hasAugmentation(AugmentationName.HuntOfArtemis, true); function press(this: Document, event: KeyboardEvent): void { event.preventDefault(); if (memoryPhase) return; diff --git a/src/Infiltration/ui/SlashGame.tsx b/src/Infiltration/ui/SlashGame.tsx index 3f4589a37..73d34593c 100644 --- a/src/Infiltration/ui/SlashGame.tsx +++ b/src/Infiltration/ui/SlashGame.tsx @@ -1,6 +1,6 @@ import { Box, Paper, Typography } from "@mui/material"; import React, { useEffect, useState } from "react"; -import { AugmentationNames } from "../../Augmentation/data/AugmentationNames"; +import { AugmentationName } from "@enums"; import { Player } from "@player"; import { KEY } from "../../utils/helpers/keyCodes"; import { interpolate } from "./Difficulty"; @@ -39,7 +39,7 @@ export function SlashGame(props: IMinigameProps): React.ReactElement { props.onSuccess(); } } - const hasAugment = Player.hasAugmentation(AugmentationNames.MightOfAres, true); + const hasAugment = Player.hasAugmentation(AugmentationName.MightOfAres, true); const guardingTime = Math.random() * 3250 + 1500 - (250 + difficulty.window); const preparingTime = difficulty.window; const attackingTime = 250; diff --git a/src/Infiltration/ui/Victory.tsx b/src/Infiltration/ui/Victory.tsx index 1e689364e..247ebf3e4 100644 --- a/src/Infiltration/ui/Victory.tsx +++ b/src/Infiltration/ui/Victory.tsx @@ -1,6 +1,6 @@ import { Box, Button, MenuItem, Paper, Select, SelectChangeEvent, Typography } from "@mui/material"; import React, { useState } from "react"; -import { FactionNames } from "../../Faction/data/FactionNames"; +import { FactionName } from "@enums"; import { inviteToFaction } from "../../Faction/FactionHelpers"; import { Factions } from "../../Faction/Factions"; import { Router } from "../../ui/GameRoot"; @@ -30,12 +30,12 @@ export function Victory(props: IProps): React.ReactElement { Router.toPage(Page.City); } - const soa = Factions[FactionNames.ShadowsOfAnarchy]; + const soa = Factions[FactionName.ShadowsOfAnarchy]; const repGain = calculateTradeInformationRepReward(props.Reward, props.MaxLevel, props.StartingDifficulty); const moneyGain = calculateSellInformationCashReward(props.Reward, props.MaxLevel, props.StartingDifficulty); const infiltrationRepGain = calculateInfiltratorsRepReward(soa, props.StartingDifficulty); - const isMemberOfInfiltrators = Player.factions.includes(FactionNames.ShadowsOfAnarchy); + const isMemberOfInfiltrators = Player.factions.includes(FactionName.ShadowsOfAnarchy); function sell(): void { Player.gainMoney(moneyGain, "infiltration"); @@ -53,7 +53,7 @@ export function Victory(props: IProps): React.ReactElement { } function handleInfiltrators(): void { - inviteToFaction(Factions[FactionNames.ShadowsOfAnarchy]); + inviteToFaction(Factions[FactionName.ShadowsOfAnarchy]); if (isMemberOfInfiltrators) { soa.playerReputation += infiltrationRepGain; } @@ -66,7 +66,7 @@ export function Victory(props: IProps): React.ReactElement { You{" "} {isMemberOfInfiltrators ? ( <> - have gained {formatNumberNoSuffix(infiltrationRepGain, 2)} rep for {FactionNames.ShadowsOfAnarchy} and{" "} + have gained {formatNumberNoSuffix(infiltrationRepGain, 2)} rep for {FactionName.ShadowsOfAnarchy} and{" "} ) : ( <> diff --git a/src/Infiltration/ui/WireCuttingGame.tsx b/src/Infiltration/ui/WireCuttingGame.tsx index 88898b92b..ec36a47d4 100644 --- a/src/Infiltration/ui/WireCuttingGame.tsx +++ b/src/Infiltration/ui/WireCuttingGame.tsx @@ -1,6 +1,6 @@ import { Box, Paper, Typography } from "@mui/material"; import React, { useEffect, useState } from "react"; -import { AugmentationNames } from "../../Augmentation/data/AugmentationNames"; +import { AugmentationName } from "@enums"; import { Player } from "@player"; import { Settings } from "../../Settings/Settings"; import { KEY } from "../../utils/helpers/keyCodes"; @@ -63,7 +63,7 @@ export function WireCuttingGame(props: IMinigameProps): React.ReactElement { const [wires] = useState(generateWires(difficulty)); const [cutWires, setCutWires] = useState(new Array(wires.length).fill(false)); const [questions] = useState(generateQuestion(wires, difficulty)); - const hasAugment = Player.hasAugmentation(AugmentationNames.KnowledgeOfApollo, true); + const hasAugment = Player.hasAugmentation(AugmentationName.KnowledgeOfApollo, true); function checkWire(wireNum: number): boolean { return questions.some((q) => q.shouldCut(wires[wireNum - 1], wireNum - 1)); diff --git a/src/InteractiveTutorial.ts b/src/InteractiveTutorial.ts index a7aa11cdc..5af6ccfb0 100644 --- a/src/InteractiveTutorial.ts +++ b/src/InteractiveTutorial.ts @@ -1,5 +1,5 @@ import { Player } from "@player"; -import { LiteratureName } from "./Literature/data/LiteratureNames"; +import { LiteratureName } from "@enums"; import { ITutorialEvents } from "./ui/InteractiveTutorial/ITutorialEvents"; // Ordered array of keys to Interactive Tutorial Steps diff --git a/src/Literature/data/LiteratureNames.ts b/src/Literature/Enums.ts similarity index 100% rename from src/Literature/data/LiteratureNames.ts rename to src/Literature/Enums.ts diff --git a/src/Literature/Literature.ts b/src/Literature/Literature.ts index 366a07d38..579e51cb8 100644 --- a/src/Literature/Literature.ts +++ b/src/Literature/Literature.ts @@ -1,5 +1,5 @@ import { FilePath, asFilePath } from "../Paths/FilePath"; -import type { LiteratureName } from "./data/LiteratureNames"; +import type { LiteratureName } from "@enums"; interface LiteratureConstructorParams { title: string; diff --git a/src/Literature/LiteratureHelpers.ts b/src/Literature/LiteratureHelpers.ts index 4d3028c4e..dff34e4ca 100644 --- a/src/Literature/LiteratureHelpers.ts +++ b/src/Literature/LiteratureHelpers.ts @@ -1,6 +1,6 @@ import { Literatures } from "./Literatures"; import { dialogBoxCreate } from "../ui/React/DialogBox"; -import { LiteratureName } from "./data/LiteratureNames"; +import { LiteratureName } from "@enums"; export function showLiterature(fn: LiteratureName): void { const litObj = Literatures[fn]; diff --git a/src/Literature/Literatures.ts b/src/Literature/Literatures.ts index 2ad0821a0..e52eac351 100644 --- a/src/Literature/Literatures.ts +++ b/src/Literature/Literatures.ts @@ -1,7 +1,5 @@ -import { CityName } from "./../Enums"; +import { CityName, FactionName, LiteratureName } from "@enums"; import { Literature } from "./Literature"; -import { LiteratureName } from "./data/LiteratureNames"; -import { FactionNames } from "../Faction/data/FactionNames"; export const Literatures: Record = { [LiteratureName.HackersStartingHandbook]: new Literature({ @@ -87,29 +85,29 @@ export const Literatures: Record = { "Synthetic androids, or Synthoids for short, are genetically engineered robots and, short of Augmentations, " + "are composed entirely of organic substances. For this reason, Synthoids are virtually identical to " + "humans in form, composition, and appearance.

    " + - `Synthoids were first designed and manufactured by ${FactionNames.OmniTekIncorporated} sometime around the middle of the century. ` + + `Synthoids were first designed and manufactured by ${FactionName.OmniTekIncorporated} sometime around the middle of the century. ` + "Their original purpose was to be used for manual labor and as emergency responders for disasters. As such, they " + "were initially programmed only for their specific tasks. Each iteration that followed improved upon the " + "intelligence and capabilities of the Synthoids. By the 6th iteration, called MK-VI, the Synthoids were " + - `so smart and capable enough of making their own decisions that many argued ${FactionNames.OmniTekIncorporated} had created the first ` + + `so smart and capable enough of making their own decisions that many argued ${FactionName.OmniTekIncorporated} had created the first ` + "sentient AI. These MK-VI Synthoids were produced in mass quantities (estimates up to 50 billion) with the hopes of increasing society's " + "productivity and bolstering the global economy. Stemming from humanity's desire for technological advancement, optimism " + "and excitement about the future had never been higher.

    " + "All of that excitement and optimism quickly turned to fear, panic, and dread in 2070, when a terrorist group " + - `called Ascendis Totalis hacked into ${FactionNames.OmniTekIncorporated} and uploaded a rogue AI into several of their Synthoid manufacturing facilities. ` + - `This hack went undetected and for months ${FactionNames.OmniTekIncorporated} unknowingly churned out legions of Synthoids embedded with this ` + + `called Ascendis Totalis hacked into ${FactionName.OmniTekIncorporated} and uploaded a rogue AI into several of their Synthoid manufacturing facilities. ` + + `This hack went undetected and for months ${FactionName.OmniTekIncorporated} unknowingly churned out legions of Synthoids embedded with this ` + "rogue AI. Then, on December 24th, 2070, Omnica activated dormant protocols in the rogue AI, causing all of the " + "infected Synthoids to immediately launch a military campaign to seek and destroy all of humanity.

    " + "What ensued was the deadliest conflict in human history. This crisis, now commonly known as the Synthoid Uprising, " + "resulted in almost ten billion deaths over the course of a year. Despite the nations of the world banding together " + "to combat the threat, the MK-VI Synthoids were simply stronger, faster, more intelligent, and more adaptable than humans, " + "outsmarting them at every turn.

    " + - `It wasn't until the sacrifice of an elite international military taskforce, called the ${FactionNames.Bladeburners}, that humanity ` + - `was finally able to defeat the Synthoids. The ${FactionNames.Bladeburners}' final act was a suicide bombing mission that ` + + `It wasn't until the sacrifice of an elite international military taskforce, called the ${FactionName.Bladeburners}, that humanity ` + + `was finally able to defeat the Synthoids. The ${FactionName.Bladeburners}' final act was a suicide bombing mission that ` + "destroyed a large portion of the MK-VI Synthoids, including many of its leaders. In the following " + "weeks militaries from around the world were able to round up and shut down the remaining rogue MK-VI Synthoids, ending " + "the Synthoid Uprising.

    " + - `In the aftermath of the bloodshed, the Synthoid Accords were drawn up. These Accords banned ${FactionNames.OmniTekIncorporated} ` + + `In the aftermath of the bloodshed, the Synthoid Accords were drawn up. These Accords banned ${FactionName.OmniTekIncorporated} ` + "from manufacturing any Synthoids beyond the MK-III series. They also banned any other corporation " + "from constructing androids with advanced, near-sentient AI. MK-VI Synthoids that did not have the rogue Ascendis Totalis " + "AI were allowed to continue their existence, but they were stripped of all rights and protections as they " + @@ -117,7 +115,7 @@ export const Literatures: Record = { "as working for any military/defense organization or conducting any bioengineering, computing, or robotics related research.

    " + "Unfortunately, many believe that not all of the rogue MK-VI Synthoids from the Uprising were found and destroyed, " + "and that many of them are blending in as normal humans in society today. In response, many nations have created " + - `${FactionNames.Bladeburners} divisions, special military branches that are tasked with investigating and dealing with any Synthoid threats.

    ` + + `${FactionName.Bladeburners} divisions, special military branches that are tasked with investigating and dealing with any Synthoid threats.

    ` + "To this day, tensions still exist between the remaining Synthoids and humans as a result of the Uprising.

    " + "Nobody knows what happened to the terrorist group Ascendis Totalis.", }), @@ -202,9 +200,9 @@ export const Literatures: Record = { title: "Brighter than the Sun", filename: LiteratureName.BrighterThanTheSun, text: - `When people think about the corporations that dominate the East, they typically think of ${FactionNames.KuaiGongInternational}, which ` + + `When people think about the corporations that dominate the East, they typically think of ${FactionName.KuaiGongInternational}, which ` + "holds a complete monopoly for manufacturing and commerce in Asia, or Global Pharmaceuticals, the world's largest " + - `drug company, or ${FactionNames.OmniTekIncorporated}, the global leader in intelligent and autonomous robots. But there's one company ` + + `drug company, or ${FactionName.OmniTekIncorporated}, the global leader in intelligent and autonomous robots. But there's one company ` + "that has seen a rapid rise in the last year and is poised to dominate not only the East, but the entire world: TaiYang Digital.

    " + "TaiYang Digital is a Chinese internet-technology corporation that provides services such as " + "online advertising, search engines, gaming, media, entertainment, and cloud computing/storage. Its name TaiYang comes from the Chinese word " + @@ -216,7 +214,7 @@ export const Literatures: Record = { "TaiYang Digital's meteoric rise is extremely surprising in modern society. This sort of growth is " + "something you'd commonly see in the first half of the century, especially for tech companies. However in " + "the last two decades the number of corporations has significantly declined as the largest entities " + - `quickly took over the economy. Corporations such as ${FactionNames.ECorp}, ${FactionNames.MegaCorp}, and ${FactionNames.KuaiGongInternational} have established ` + + `quickly took over the economy. Corporations such as ${FactionName.ECorp}, ${FactionName.MegaCorp}, and ${FactionName.KuaiGongInternational} have established ` + "such strong monopolies in their market sectors that they have effectively killed off all " + "of the smaller and new corporations that have tried to start up over the years. This is what makes " + "the rise of TaiYang Digital so impressive. And if TaiYang continues down this path, then they have " + @@ -249,7 +247,7 @@ export const Literatures: Record = { "whether these figures indicate the beginning of a sustained increase in crime rates, or whether " + "the year was just an unfortunate outlier. He states that many intelligence and law enforcement " + "agents have noticed an increase in organized crime activities, and believes that these figures may " + - `be the result of an uprising from criminal organizations such as ${FactionNames.TheSyndicate} or the ${FactionNames.SlumSnakes}.`, + `be the result of an uprising from criminal organizations such as ${FactionName.TheSyndicate} or the ${FactionName.SlumSnakes}.`, }), [LiteratureName.ManAndMachine]: new Literature({ title: "Man and the Machine", @@ -279,15 +277,15 @@ export const Literatures: Record = { "most radical of conspiracy theorists claiming that they control everything in the entire world. And while the world " + "may never know for sure, it is likely that many secret societies do actually exist, even today.

    " + "However, the secret societies of the modern world are nothing like those that (supposedly) existed " + - `decades and centuries ago. The Freemasons, Knights Templar, and ${FactionNames.Illuminati}, while they may have been around ` + + `decades and centuries ago. The Freemasons, Knights Templar, and ${FactionName.Illuminati}, while they may have been around ` + "at the turn of the 21st century, almost assuredly do not exist today. The dominance of the Web in " + "our everyday lives and the fact that so much of the world is now digital has given rise to a new breed " + "of secret societies: Internet-based ones.

    " + "Commonly called 'hacker groups', Internet-based secret societies have become well-known in today's " + - `world. Some of these, such as ${FactionNames.TheBlackHand}, are black hat groups that claim they are trying to ` + - `help the oppressed by attacking the elite and powerful. Others, such as ${FactionNames.NiteSec}, are hacktivist groups ` + + `world. Some of these, such as ${FactionName.TheBlackHand}, are black hat groups that claim they are trying to ` + + `help the oppressed by attacking the elite and powerful. Others, such as ${FactionName.NiteSec}, are hacktivist groups ` + "that try to push political and social agendas. Perhaps the most intriguing hacker group " + - `is the mysterious ${FactionNames.BitRunners}, whose purpose still remains unknown.`, + `is the mysterious ${FactionName.BitRunners}, whose purpose still remains unknown.`, }), [LiteratureName.TheFailedFrontier]: new Literature({ title: "Space: The Failed Frontier", @@ -316,7 +314,7 @@ export const Literatures: Record = { "Medical, service, and manufacturing robots. All of these are examples of how far AI has come and how much it has " + "improved our daily lives. However, the question still remains of whether AI will ever be advanced enough to re-create " + "human intelligence.

    " + - `We've certainly come close to artificial intelligence that is similar to humans. For example ${FactionNames.OmniTekIncorporated}'s ` + + `We've certainly come close to artificial intelligence that is similar to humans. For example ${FactionName.OmniTekIncorporated}'s ` + "CompanionBot, a robot meant to act as a comforting friend for lonely and grieving people, is eerily human-like " + "in its appearance, speech, mannerisms, and even movement. However its artificial intelligence isn't the same as " + "that of humans. Not yet. It doesn't have sentience or self-awareness or consciousness.

    " + @@ -343,9 +341,9 @@ export const Literatures: Record = { filename: LiteratureName.TensionsInTechRace, text: "Have we entered a new Cold War? Is WWIII just beyond the horizon?

    " + - `After rumors came out that ${FactionNames.OmniTekIncorporated} had begun developing advanced robotic supersoldiers, ` + + `After rumors came out that ${FactionName.OmniTekIncorporated} had begun developing advanced robotic supersoldiers, ` + "geopolitical tensions quickly flared between the USA, Russia, and several Asian superpowers. " + - `In a rare show of cooperation between corporations, ${FactionNames.MegaCorp} and ${FactionNames.ECorp} have ` + + `In a rare show of cooperation between corporations, ${FactionName.MegaCorp} and ${FactionName.ECorp} have ` + "reportedly launched hundreds of new surveillance and espionage satellites. " + "Defense contractors such as " + "DeltaOne and AeroCorp have been working with the CIA and NSA to prepare " + @@ -384,13 +382,13 @@ export const Literatures: Record = { text: "WAKE UP SHEEPLE

    " + "THE GOVERNMENT DOES NOT EXIST. CORPORATIONS DO NOT RUN SOCIETY

    " + - `THE ${FactionNames.Illuminati.toUpperCase()} ARE THE SECRET RULERS OF THE WORLD!

    ` + - `Yes, the ${FactionNames.Illuminati} of legends. The ancient secret society that controls the entire ` + + `THE ${FactionName.Illuminati.toUpperCase()} ARE THE SECRET RULERS OF THE WORLD!

    ` + + `Yes, the ${FactionName.Illuminati} of legends. The ancient secret society that controls the entire ` + "world from the shadows with their invisible hand. The group of the rich and wealthy " + "that have penetrated every major government, financial agency, and corporation in the last " + "three hundred years.

    " + "OPEN YOUR EYES

    " + - `It was the ${FactionNames.Illuminati} that brought an end to democracy in the world. They are the driving force ` + + `It was the ${FactionName.Illuminati} that brought an end to democracy in the world. They are the driving force ` + "behind everything that happens.

    " + "THEY ARE ALL AROUND YOU

    " + "After destabilizing the world's governments, they are now entering the final stage of their master plan. " + @@ -419,15 +417,15 @@ export const Literatures: Record = { "territories. They were often considered one of the first and biggest criminal secret societies. " + "While most of the branches of the Triads have been destroyed over the past few decades, the " + "crime faction has spawned and inspired a number of other Asian crime organizations over the past few years. " + - `The most notable of these is the ${FactionNames.Tetrads}.

    ` + - `It is widely believed that the ${FactionNames.Tetrads} are a rogue group that splintered off from the Triads sometime in the ` + - `mid 21st century. The founders of the ${FactionNames.Tetrads}, all of whom were ex-Triad members, believed that the ` + - `Triads were losing their purpose and direction. The ${FactionNames.Tetrads} started off as a small group that mainly engaged ` + + `The most notable of these is the ${FactionName.Tetrads}.

    ` + + `It is widely believed that the ${FactionName.Tetrads} are a rogue group that splintered off from the Triads sometime in the ` + + `mid 21st century. The founders of the ${FactionName.Tetrads}, all of whom were ex-Triad members, believed that the ` + + `Triads were losing their purpose and direction. The ${FactionName.Tetrads} started off as a small group that mainly engaged ` + "in fraud and extortion. They were largely unknown until just a few years ago when they took over the illegal " + "drug trade in all of the major Asian cities. They quickly became the most powerful crime syndicate in the " + "continent.

    " + - `Not much else is known about the ${FactionNames.Tetrads}, or about the efforts the Asian governments and corporations are making ` + - `to take down this large new crime organization. Many believe that the ${FactionNames.Tetrads} have infiltrated the governments ` + + `Not much else is known about the ${FactionName.Tetrads}, or about the efforts the Asian governments and corporations are making ` + + `to take down this large new crime organization. Many believe that the ${FactionName.Tetrads} have infiltrated the governments ` + "and powerful corporations in Asia, which has helped facilitate their recent rapid rise.", }), [LiteratureName.TheSecretWar]: new Literature({ diff --git a/src/Locations/Cities.ts b/src/Locations/Cities.ts index 7b6c1149e..a6951be11 100644 --- a/src/Locations/Cities.ts +++ b/src/Locations/Cities.ts @@ -1,11 +1,5 @@ import { City } from "./City"; -import { CityName } from "../Enums"; +import { CityName } from "@enums"; +import { createEnumKeyedRecord } from "../Types/Record"; -export const Cities: Record = { - [CityName.Aevum]: new City(CityName.Aevum), - [CityName.Chongqing]: new City(CityName.Chongqing), - [CityName.Ishima]: new City(CityName.Ishima), - [CityName.NewTokyo]: new City(CityName.NewTokyo), - [CityName.Sector12]: new City(CityName.Sector12), - [CityName.Volhaven]: new City(CityName.Volhaven), -}; +export const Cities = createEnumKeyedRecord(CityName, (name) => new City(name)); diff --git a/src/Locations/City.ts b/src/Locations/City.ts index 8bd486cdb..857cc1202 100644 --- a/src/Locations/City.ts +++ b/src/Locations/City.ts @@ -1,4 +1,4 @@ -import { LocationName, CityName } from "../Enums"; +import { LocationName, CityName } from "@enums"; /** Class representing a City in the game */ export class City { diff --git a/src/Locations/Enums.ts b/src/Locations/Enums.ts new file mode 100644 index 000000000..1fc0a513b --- /dev/null +++ b/src/Locations/Enums.ts @@ -0,0 +1,89 @@ +/** Names of all locations */ +export enum LocationName { + AevumAeroCorp = "AeroCorp", + AevumBachmanAndAssociates = "Bachman & Associates", + AevumClarkeIncorporated = "Clarke Incorporated", + AevumCrushFitnessGym = "Crush Fitness Gym", + AevumECorp = "ECorp", + AevumFulcrumTechnologies = "Fulcrum Technologies", + AevumGalacticCybersystems = "Galactic Cybersystems", + AevumNetLinkTechnologies = "NetLink Technologies", + AevumPolice = "Aevum Police Headquarters", + AevumRhoConstruction = "Rho Construction", + AevumSnapFitnessGym = "Snap Fitness Gym", + AevumSummitUniversity = "Summit University", + AevumWatchdogSecurity = "Watchdog Security", + AevumCasino = "Iker Molina Casino", + + ChongqingKuaiGongInternational = "KuaiGong International", + ChongqingSolarisSpaceSystems = "Solaris Space Systems", + ChongqingChurchOfTheMachineGod = "Church of the Machine God", + + Sector12AlphaEnterprises = "Alpha Enterprises", + Sector12BladeIndustries = "Blade Industries", + Sector12CIA = "Central Intelligence Agency", + Sector12CarmichaelSecurity = "Carmichael Security", + Sector12CityHall = "Sector-12 City Hall", + Sector12DeltaOne = "DeltaOne", + Sector12FoodNStuff = "FoodNStuff", + Sector12FourSigma = "Four Sigma", + Sector12IcarusMicrosystems = "Icarus Microsystems", + Sector12IronGym = "Iron Gym", + Sector12JoesGuns = "Joe's Guns", + Sector12MegaCorp = "MegaCorp", + Sector12NSA = "National Security Agency", + Sector12PowerhouseGym = "Powerhouse Gym", + Sector12RothmanUniversity = "Rothman University", + Sector12UniversalEnergy = "Universal Energy", + + NewTokyoDefComm = "DefComm", + NewTokyoGlobalPharmaceuticals = "Global Pharmaceuticals", + NewTokyoNoodleBar = "Noodle Bar", + NewTokyoVitaLife = "VitaLife", + NewTokyoArcade = "Arcade", + + IshimaNovaMedical = "Nova Medical", + IshimaOmegaSoftware = "Omega Software", + IshimaStormTechnologies = "Storm Technologies", + IshimaGlitch = "0x6C1", + + VolhavenCompuTek = "CompuTek", + VolhavenHeliosLabs = "Helios Labs", + VolhavenLexoCorp = "LexoCorp", + VolhavenMilleniumFitnessGym = "Millenium Fitness Gym", + VolhavenNWO = "NWO", + VolhavenOmniTekIncorporated = "OmniTek Incorporated", + VolhavenOmniaCybersystems = "Omnia Cybersystems", + VolhavenSysCoreSecurities = "SysCore Securities", + VolhavenZBInstituteOfTechnology = "ZB Institute of Technology", + + Hospital = "Hospital", + Slums = "The Slums", + TravelAgency = "Travel Agency", + WorldStockExchange = "World Stock Exchange", + + Void = "The Void", +} + +/** Names of all cities */ +export enum CityName { + Aevum = "Aevum", + Chongqing = "Chongqing", + Sector12 = "Sector-12", + NewTokyo = "New Tokyo", + Ishima = "Ishima", + Volhaven = "Volhaven", +} + +export enum LocationType { + Company = "Company", + Gym = "Gym", + Hospital = "Hospital", + Slums = "Slums", + Special = "Special", // This location has special options/activities (e.g. Bladeburner, Re-sleeving) + StockMarket = "Stock Market", + TechVendor = "Tech Vendor", + TravelAgency = "Travel Agency", + University = "University", + Casino = "Casino", +} diff --git a/src/Locations/Location.ts b/src/Locations/Location.ts index 591fa75bd..94578b6cf 100644 --- a/src/Locations/Location.ts +++ b/src/Locations/Location.ts @@ -1,5 +1,4 @@ -import { CityName, LocationName } from "../Enums"; -import { LocationType } from "./LocationTypeEnum"; +import { CityName, LocationName, LocationType } from "@enums"; interface IInfiltrationMetadata { maxClearanceLevel: number; diff --git a/src/Locations/LocationTypeEnum.ts b/src/Locations/LocationTypeEnum.ts deleted file mode 100644 index eb587f19a..000000000 --- a/src/Locations/LocationTypeEnum.ts +++ /dev/null @@ -1,13 +0,0 @@ -/** Enum defining the different types of possible locations */ -export enum LocationType { - Company, - Gym, - Hospital, - Slums, - Special, // This location has special options/activities (e.g. Bladeburner, Re-sleeving) - StockMarket, - TechVendor, - TravelAgency, - University, - Casino, -} diff --git a/src/Locations/Locations.ts b/src/Locations/Locations.ts index 3c95c1a73..f72b051c9 100644 --- a/src/Locations/Locations.ts +++ b/src/Locations/Locations.ts @@ -4,7 +4,7 @@ */ import { Cities } from "./Cities"; import { Location, IConstructorParams } from "./Location"; -import { CityName } from "../Enums"; +import { CityName } from "@enums"; import { LocationsMetadata } from "./data/LocationsMetadata"; export const Locations: Record = {}; diff --git a/src/Locations/data/LocationsMetadata.ts b/src/Locations/data/LocationsMetadata.ts index 6de114bc2..1582767b2 100644 --- a/src/Locations/data/LocationsMetadata.ts +++ b/src/Locations/data/LocationsMetadata.ts @@ -2,9 +2,8 @@ * Metadata for constructing Location objects for all Locations * in the game */ -import { CityName, LocationName } from "../../Enums"; +import { CityName, LocationName, LocationType } from "@enums"; import { IConstructorParams } from "../Location"; -import { LocationType } from "../LocationTypeEnum"; export const LocationsMetadata: IConstructorParams[] = [ { diff --git a/src/Locations/ui/City.tsx b/src/Locations/ui/City.tsx index 8d9cc29ac..4aad8a1c8 100644 --- a/src/Locations/ui/City.tsx +++ b/src/Locations/ui/City.tsx @@ -7,7 +7,7 @@ import * as React from "react"; import { City } from "../City"; import { Cities } from "../Cities"; -import { LocationName } from "../../Enums"; +import { LocationName, LocationType } from "@enums"; import { Locations } from "../Locations"; import { Location } from "../Location"; import { Settings } from "../../Settings/Settings"; @@ -17,7 +17,6 @@ import { Router } from "../../ui/GameRoot"; import { Page } from "../../ui/Router"; import Typography from "@mui/material/Typography"; import Button from "@mui/material/Button"; -import { LocationType } from "../LocationTypeEnum"; import { Theme } from "@mui/material/styles"; import makeStyles from "@mui/styles/makeStyles"; import createStyles from "@mui/styles/createStyles"; diff --git a/src/Locations/ui/CompanyLocation.tsx b/src/Locations/ui/CompanyLocation.tsx index 4859eb6a4..b24f06644 100644 --- a/src/Locations/ui/CompanyLocation.tsx +++ b/src/Locations/ui/CompanyLocation.tsx @@ -12,7 +12,7 @@ import Box from "@mui/material/Box"; import { ApplyToJobButton } from "./ApplyToJobButton"; import { Locations } from "../Locations"; -import { LocationName } from "../../Enums"; +import { LocationName } from "@enums"; import { Companies } from "../../Company/Companies"; import { CompanyPositions } from "../../Company/CompanyPositions"; diff --git a/src/Locations/ui/GenericLocation.tsx b/src/Locations/ui/GenericLocation.tsx index 86d083a04..bd2abbbe4 100644 --- a/src/Locations/ui/GenericLocation.tsx +++ b/src/Locations/ui/GenericLocation.tsx @@ -19,7 +19,7 @@ import { UniversityLocation } from "./UniversityLocation"; import { CasinoLocation } from "./CasinoLocation"; import { Location } from "../Location"; -import { LocationType } from "../LocationTypeEnum"; +import { LocationType } from "@enums"; import { Settings } from "../../Settings/Settings"; diff --git a/src/Locations/ui/GymLocation.tsx b/src/Locations/ui/GymLocation.tsx index 425a785a5..89505a5f5 100644 --- a/src/Locations/ui/GymLocation.tsx +++ b/src/Locations/ui/GymLocation.tsx @@ -16,7 +16,7 @@ import { Page } from "../../ui/Router"; import { Box } from "@mui/material"; import { ClassWork, Classes } from "../../Work/ClassWork"; import { calculateCost } from "../../Work/Formulas"; -import { GymType } from "../../Enums"; +import { GymType } from "@enums"; interface IProps { loc: Location; diff --git a/src/Locations/ui/SpecialLocation.tsx b/src/Locations/ui/SpecialLocation.tsx index 6a85209cd..836670222 100644 --- a/src/Locations/ui/SpecialLocation.tsx +++ b/src/Locations/ui/SpecialLocation.tsx @@ -16,8 +16,7 @@ import Button from "@mui/material/Button"; import { Location } from "../Location"; import { CreateCorporationModal } from "../../Corporation/ui/modals/CreateCorporationModal"; -import { LocationName } from "../../Enums"; -import { AugmentationNames } from "../../Augmentation/data/AugmentationNames"; +import { AugmentationName, FactionName, LocationName, ToastVariant } from "@enums"; import { Factions } from "../../Faction/Factions"; import { joinFaction } from "../../Faction/FactionHelpers"; @@ -26,7 +25,7 @@ import { Page } from "../../ui/Router"; import { Player } from "@player"; import { dialogBoxCreate } from "../../ui/React/DialogBox"; -import { SnackbarEvents, ToastVariant } from "../../ui/React/Snackbar"; +import { SnackbarEvents } from "../../ui/React/Snackbar"; import { N00dles } from "../../utils/helpers/N00dles"; import { Exploit } from "../../Exploits/Exploit"; import { applyAugmentation } from "../../Augmentation/AugmentationHelpers"; @@ -35,14 +34,13 @@ import { HacknetNode } from "../../Hacknet/HacknetNode"; import { HacknetServer } from "../../Hacknet/HacknetServer"; import { GetServer } from "../../Server/AllServers"; import { ArcadeRoot } from "../../Arcade/ui/ArcadeRoot"; -import { FactionNames } from "../../Faction/data/FactionNames"; import { BitNodeMultipliers } from "../../BitNode/BitNodeMultipliers"; -interface IProps { +interface SpecialLocationProps { loc: Location; } -export function SpecialLocation(props: IProps): React.ReactElement { +export function SpecialLocation(props: SpecialLocationProps): React.ReactElement { const setRerender = useState(false)[1]; /** Click handler for Bladeburner button at Sector-12 NSA */ @@ -163,15 +161,15 @@ export function SpecialLocation(props: IProps): React.ReactElement { } function handleCotMG(): void { - const faction = Factions[FactionNames.ChurchOfTheMachineGod]; - if (!Player.factions.includes(FactionNames.ChurchOfTheMachineGod)) { + const faction = Factions[FactionName.ChurchOfTheMachineGod]; + if (!Player.factions.includes(FactionName.ChurchOfTheMachineGod)) { joinFaction(faction); } if ( - !Player.augmentations.some((a) => a.name === AugmentationNames.StaneksGift1) && - !Player.queuedAugmentations.some((a) => a.name === AugmentationNames.StaneksGift1) + !Player.augmentations.some((a) => a.name === AugmentationName.StaneksGift1) && + !Player.queuedAugmentations.some((a) => a.name === AugmentationName.StaneksGift1) ) { - applyAugmentation({ name: AugmentationNames.StaneksGift1, level: 1 }); + applyAugmentation({ name: AugmentationName.StaneksGift1, level: 1 }); } Router.toPage(Page.StaneksGift); @@ -209,7 +207,7 @@ export function SpecialLocation(props: IProps): React.ReactElement { {" sNNo-.`.-omNy` "}
    {" -smNNNNmdo- "}
    {" `..` "} - if (Player.hasAugmentation(AugmentationNames.StaneksGift3, true)) { + if (Player.hasAugmentation(AugmentationName.StaneksGift3, true)) { return ( <> @@ -226,7 +224,7 @@ export function SpecialLocation(props: IProps): React.ReactElement { ); } - if (Player.hasAugmentation(AugmentationNames.StaneksGift2, true)) { + if (Player.hasAugmentation(AugmentationName.StaneksGift2, true)) { return ( <> @@ -243,7 +241,7 @@ export function SpecialLocation(props: IProps): React.ReactElement { ); } - if (Player.factions.includes(FactionNames.ChurchOfTheMachineGod)) { + if (Player.factions.includes(FactionName.ChurchOfTheMachineGod)) { return ( <> @@ -272,8 +270,8 @@ export function SpecialLocation(props: IProps): React.ReactElement { } if ( - Player.augmentations.filter((a) => a.name !== AugmentationNames.NeuroFluxGovernor).length > 0 || - Player.queuedAugmentations.filter((a) => a.name !== AugmentationNames.NeuroFluxGovernor).length > 0 + Player.augmentations.filter((a) => a.name !== AugmentationName.NeuroFluxGovernor).length > 0 || + Player.queuedAugmentations.filter((a) => a.name !== AugmentationName.NeuroFluxGovernor).length > 0 ) { return ( <> diff --git a/src/Locations/ui/TravelAgencyRoot.tsx b/src/Locations/ui/TravelAgencyRoot.tsx index 4062bed99..ce71737d6 100644 --- a/src/Locations/ui/TravelAgencyRoot.tsx +++ b/src/Locations/ui/TravelAgencyRoot.tsx @@ -5,7 +5,7 @@ */ import React, { useState } from "react"; -import { CityName } from "../../Enums"; +import { CityName } from "@enums"; import { TravelConfirmationModal } from "./TravelConfirmationModal"; import { CONSTANTS } from "../../Constants"; diff --git a/src/Locations/ui/UniversityLocation.tsx b/src/Locations/ui/UniversityLocation.tsx index 20e613625..ca311a9bc 100644 --- a/src/Locations/ui/UniversityLocation.tsx +++ b/src/Locations/ui/UniversityLocation.tsx @@ -17,7 +17,7 @@ import { Box } from "@mui/material"; import { ClassWork, Classes } from "../../Work/ClassWork"; import { calculateCost } from "../../Work/Formulas"; -import { UniversityClassType } from "../../Enums"; +import { UniversityClassType } from "@enums"; interface IProps { loc: Location; diff --git a/src/Message/Enums.ts b/src/Message/Enums.ts new file mode 100644 index 000000000..af08566a6 --- /dev/null +++ b/src/Message/Enums.ts @@ -0,0 +1,12 @@ +export enum MessageFilename { + Jumper0 = "j0.msg", + Jumper1 = "j1.msg", + Jumper2 = "j2.msg", + Jumper3 = "j3.msg", + Jumper4 = "j4.msg", + CyberSecTest = "csec-test.msg", + NiteSecTest = "nitesec-test.msg", + BitRunnersTest = "19dfj3l1nd.msg", + TruthGazer = "truthgazer.msg", + RedPill = "icarus.msg", +} diff --git a/src/Message/Message.ts b/src/Message/Message.ts index a84a11cb4..8fea986c5 100644 --- a/src/Message/Message.ts +++ b/src/Message/Message.ts @@ -1,5 +1,5 @@ import { FilePath, asFilePath } from "../Paths/FilePath"; -import { MessageFilename } from "./MessageHelpers"; +import { MessageFilename } from "@enums"; export class Message { // Name of Message file diff --git a/src/Message/MessageHelpers.tsx b/src/Message/MessageHelpers.tsx index d1772b530..d58fa2112 100644 --- a/src/Message/MessageHelpers.tsx +++ b/src/Message/MessageHelpers.tsx @@ -1,15 +1,13 @@ import React from "react"; import { Message } from "./Message"; -import { AugmentationNames } from "../Augmentation/data/AugmentationNames"; +import { AugmentationName, CompletedProgramName, FactionName, MessageFilename } from "@enums"; import { Router } from "../ui/GameRoot"; -import { CompletedProgramName } from "../Programs/Programs"; import { Player } from "@player"; import { Page } from "../ui/Router"; import { GetServer } from "../Server/AllServers"; import { SpecialServers } from "../Server/data/SpecialServers"; import { Settings } from "../Settings/Settings"; import { dialogBoxCreate } from "../ui/React/DialogBox"; -import { FactionNames } from "../Faction/data/FactionNames"; import { Server } from "../Server/Server"; //Sends message to player, including a pop up @@ -53,7 +51,7 @@ function recvd(name: MessageFilename): boolean { function checkForMessagesToSend(): void { if (Router.page() === Page.BitVerse) return; - if (Player.hasAugmentation(AugmentationNames.TheRedPill, true)) { + if (Player.hasAugmentation(AugmentationName.TheRedPill, true)) { //Get the world daemon required hacking level const worldDaemon = GetServer(SpecialServers.WorldDaemon); if (!(worldDaemon instanceof Server)) { @@ -90,19 +88,6 @@ function checkForMessagesToSend(): void { } } -export enum MessageFilename { - Jumper0 = "j0.msg", - Jumper1 = "j1.msg", - Jumper2 = "j2.msg", - Jumper3 = "j3.msg", - Jumper4 = "j4.msg", - CyberSecTest = "csec-test.msg", - NiteSecTest = "nitesec-test.msg", - BitRunnersTest = "19dfj3l1nd.msg", - TruthGazer = "truthgazer.msg", - RedPill = "icarus.msg", -} - // This type ensures that all members of the MessageFilename enum are valid keys const Messages: Record = { //jump3R Messages @@ -119,7 +104,7 @@ const Messages: Record = { [MessageFilename.Jumper1]: new Message( MessageFilename.Jumper1, - `Soon you will be contacted by a hacking group known as ${FactionNames.CyberSec}. ` + + `Soon you will be contacted by a hacking group known as ${FactionName.CyberSec}. ` + "They can help you with your search. \n\n" + "You should join them, garner their favor, and " + "exploit them for their Augmentations. But do not trust them. " + @@ -131,14 +116,14 @@ const Messages: Record = { MessageFilename.Jumper2, "Do not try to save the world. There is no world to save. If " + "you want to find the truth, worry only about yourself. Ethics and " + - `morals will get you killed. \n\nWatch out for a hacking group known as ${FactionNames.NiteSec}.` + + `morals will get you killed. \n\nWatch out for a hacking group known as ${FactionName.NiteSec}.` + "\n\n-jump3R", ), [MessageFilename.Jumper3]: new Message( MessageFilename.Jumper3, "You must learn to walk before you can run. And you must " + - `run before you can fly. Look for ${FactionNames.TheBlackHand}. \n\n` + + `run before you can fly. Look for ${FactionName.TheBlackHand}. \n\n` + "I.I.I.I \n\n-jump3R", ), @@ -156,7 +141,7 @@ const Messages: Record = { "your talents. If you join us, you can put your skills to good use and change " + "the world for the better. If you join us, we can unlock your full potential. \n\n" + "But first, you must pass our test. Find and install the backdoor on our server. \n\n" + - `-${FactionNames.CyberSec}`, + `-${FactionName.CyberSec}`, ), [MessageFilename.NiteSecTest]: new Message( @@ -167,7 +152,7 @@ const Messages: Record = { "and ideas with bullets. \n\n" + "Join us, and people will fear you, too. \n\n" + "Find and install the backdoor on our server, avmnite-02h. Then, we will contact you again." + - `\n\n-${FactionNames.NiteSec}`, + `\n\n-${FactionName.NiteSec}`, ), [MessageFilename.BitRunnersTest]: new Message( diff --git a/src/Milestones/Milestones.ts b/src/Milestones/Milestones.ts index a1214689c..47dac470f 100644 --- a/src/Milestones/Milestones.ts +++ b/src/Milestones/Milestones.ts @@ -3,7 +3,7 @@ import { Player } from "@player"; import { Factions } from "../Faction/Factions"; import { Faction } from "../Faction/Faction"; import { GetServer } from "../Server/AllServers"; -import { FactionNames } from "../Faction/data/FactionNames"; +import { FactionName } from "@enums"; import { Server } from "../Server/Server"; function allFactionAugs(f: Faction): boolean { @@ -39,60 +39,60 @@ export const Milestones: Milestone[] = [ { title: "Join the faction hinted at in csec-test.msg", fulfilled: (): boolean => { - return Player.factions.includes(FactionNames.CyberSec); + return Player.factions.includes(FactionName.CyberSec); }, }, { - title: `Install all the Augmentations from ${FactionNames.CyberSec}`, + title: `Install all the Augmentations from ${FactionName.CyberSec}`, fulfilled: (): boolean => { - return allFactionAugs(Factions[FactionNames.CyberSec]); + return allFactionAugs(Factions[FactionName.CyberSec]); }, }, { title: "Join the faction hinted at in nitesec-test.msg", fulfilled: (): boolean => { - return Player.factions.includes(FactionNames.NiteSec); + return Player.factions.includes(FactionName.NiteSec); }, }, { - title: `Install all the Augmentations from ${FactionNames.NiteSec}`, + title: `Install all the Augmentations from ${FactionName.NiteSec}`, fulfilled: (): boolean => { - return allFactionAugs(Factions[FactionNames.NiteSec]); + return allFactionAugs(Factions[FactionName.NiteSec]); }, }, { title: "Join the faction hinted at in j3.msg", fulfilled: (): boolean => { - return Player.factions.includes(FactionNames.TheBlackHand); + return Player.factions.includes(FactionName.TheBlackHand); }, }, { - title: `Install all the Augmentations from ${FactionNames.TheBlackHand}`, + title: `Install all the Augmentations from ${FactionName.TheBlackHand}`, fulfilled: (): boolean => { - return allFactionAugs(Factions[FactionNames.TheBlackHand]); + return allFactionAugs(Factions[FactionName.TheBlackHand]); }, }, { title: "Join the faction hinted at in 19dfj3l1nd.msg", fulfilled: (): boolean => { - return Player.factions.includes(FactionNames.BitRunners); + return Player.factions.includes(FactionName.BitRunners); }, }, { - title: `Install all the Augmentations from ${FactionNames.BitRunners}`, + title: `Install all the Augmentations from ${FactionName.BitRunners}`, fulfilled: (): boolean => { - return allFactionAugs(Factions[FactionNames.BitRunners]); + return allFactionAugs(Factions[FactionName.BitRunners]); }, }, { title: "Complete fl1ght.exe", fulfilled: (): boolean => { // technically wrong but whatever - return Player.factions.includes(FactionNames.Daedalus); + return Player.factions.includes(FactionName.Daedalus); }, }, { - title: `Install the special Augmentation from ${FactionNames.Daedalus}`, + title: `Install the special Augmentation from ${FactionName.Daedalus}`, fulfilled: (): boolean => { return Player.augmentations.some((aug) => aug.name == "The Red Pill"); }, diff --git a/src/Netscript/NetscriptHelpers.tsx b/src/Netscript/NetscriptHelpers.tsx index abae95b02..cfd5e677e 100644 --- a/src/Netscript/NetscriptHelpers.tsx +++ b/src/Netscript/NetscriptHelpers.tsx @@ -7,7 +7,6 @@ import { Player } from "@player"; import { ScriptDeath } from "./ScriptDeath"; import { formatExp, formatMoney, formatRam, formatThreads } from "../ui/formatNumber"; import { ScriptArg } from "./ScriptArg"; -import { CityName } from "../Enums"; import { BasicHGWOptions, RunningScript as IRunningScript, Person as IPerson, Server as IServer } from "@nsdefs"; import { Server } from "../Server/Server"; import { @@ -33,7 +32,6 @@ import { arrayToString } from "../utils/helpers/ArrayHelpers"; import { HacknetServer } from "../Hacknet/HacknetServer"; import { BaseServer } from "../Server/BaseServer"; import { dialogBoxCreate } from "../ui/React/DialogBox"; -import { checkEnum } from "../utils/helpers/enum"; import { RamCostConstants } from "./RamCostGenerator"; import { isPositiveInteger, PositiveInteger, Unknownify } from "../types"; import { Engine } from "../engine"; @@ -55,7 +53,6 @@ export const helpers = { checkSingularityAccess, netscriptDelay, updateDynamicRam, - city, getServer, scriptIdentifier, hack, @@ -83,17 +80,6 @@ export interface CompleteRunOptions { preventDuplicates: boolean; } -export function assertMember( - ctx: NetscriptContext, - obj: Record | T[], - typeName: string, - argName: string, - v: unknown, -): asserts v is T { - assertString(ctx, argName, v); - if (!checkEnum(obj, v)) throw makeRuntimeErrorMsg(ctx, `${argName}: ${v} is not a valid ${typeName}.`, "TYPE"); -} - export function assertString(ctx: NetscriptContext, argName: string, v: unknown): asserts v is string { if (typeof v !== "string") throw makeRuntimeErrorMsg(ctx, `${argName} expected to be a string. ${debugType(v)}`, "TYPE"); @@ -412,13 +398,6 @@ function updateDynamicRam(ctx: NetscriptContext, ramCost: number): void { } } -/** Validates the input v as being a CityName. Throws an error if it is not. */ -function city(ctx: NetscriptContext, argName: string, v: unknown): CityName { - if (typeof v !== "string" || !checkEnum(CityName, v)) - throw makeRuntimeErrorMsg(ctx, `${argName} should be a city name.`); - return v; -} - function scriptIdentifier( ctx: NetscriptContext, scriptID: unknown, diff --git a/src/Netscript/RecentScripts.ts b/src/Netscript/RecentScripts.ts index ded6f8856..3ebd0d785 100644 --- a/src/Netscript/RecentScripts.ts +++ b/src/Netscript/RecentScripts.ts @@ -1,6 +1,6 @@ -import { RunningScript } from "src/Script/RunningScript"; +import type { RunningScript } from "../Script/RunningScript"; +import type { WorkerScript } from "./WorkerScript"; import { Settings } from "../Settings/Settings"; -import { WorkerScript } from "./WorkerScript"; export const recentScripts: RecentScript[] = []; diff --git a/src/Netscript/WorkerScript.ts b/src/Netscript/WorkerScript.ts index 821f0f541..3a9e207d7 100644 --- a/src/Netscript/WorkerScript.ts +++ b/src/Netscript/WorkerScript.ts @@ -7,17 +7,17 @@ * RunningScript objects */ import type React from "react"; +import type { BaseServer } from "../Server/BaseServer"; +import type { NSFull } from "../NetscriptFunctions"; +import type { ScriptFilePath } from "../Paths/ScriptFilePath"; +import type { RunningScript } from "../Script/RunningScript"; +import type { Script } from "../Script/Script"; +import type { ScriptArg } from "./ScriptArg"; +import type { ScriptDeath } from "./ScriptDeath"; + import { Environment } from "./Environment"; import { RamCostConstants } from "./RamCostGenerator"; - -import { RunningScript } from "../Script/RunningScript"; -import { Script } from "../Script/Script"; import { GetServer } from "../Server/AllServers"; -import { BaseServer } from "../Server/BaseServer"; -import { ScriptDeath } from "./ScriptDeath"; -import { ScriptArg } from "./ScriptArg"; -import { NSFull } from "../NetscriptFunctions"; -import { ScriptFilePath } from "src/Paths/ScriptFilePath"; export class WorkerScript { /** Script's arguments */ diff --git a/src/NetscriptFunctions.ts b/src/NetscriptFunctions.ts index 88eec6892..d666c81f0 100644 --- a/src/NetscriptFunctions.ts +++ b/src/NetscriptFunctions.ts @@ -13,7 +13,18 @@ import { import { netscriptCanGrow, netscriptCanWeaken } from "./Hacking/netscriptCanHack"; import { Terminal } from "./Terminal"; import { Player } from "@player"; -import { CompletedProgramName } from "./Programs/Programs"; +import { + CityName, + CompletedProgramName, + CrimeType, + FactionWorkType, + GymType, + JobName, + LiteratureName, + LocationName, + ToastVariant, + UniversityClassType, +} from "@enums"; import { PromptEvent } from "./ui/React/PromptManager"; import { GetServer, DeleteServer, AddToAllServers, createUniqueRandomIp } from "./Server/AllServers"; import { @@ -68,8 +79,7 @@ import { NS, RecentScript, BasicHGWOptions, ProcessInfo, NSEnums } from "@nsdefs import { NetscriptSingularity } from "./NetscriptFunctions/Singularity"; import { dialogBoxCreate } from "./ui/React/DialogBox"; -import { SnackbarEvents, ToastVariant } from "./ui/React/Snackbar"; -import { checkEnum } from "./utils/helpers/enum"; +import { SnackbarEvents } from "./ui/React/Snackbar"; import { matchScriptPathExact } from "./utils/helpers/scriptKey"; import { Flags } from "./NetscriptFunctions/Flags"; @@ -81,26 +91,24 @@ import { INetscriptExtra } from "./NetscriptFunctions/Extra"; import { ScriptDeath } from "./Netscript/ScriptDeath"; import { getBitNodeMultipliers } from "./BitNode/BitNode"; import { assert, arrayAssert, stringAssert, objectAssert } from "./utils/helpers/typeAssertion"; -import { CityName, JobName, CrimeType, GymType, LocationName, UniversityClassType } from "./Enums"; import { cloneDeep, escapeRegExp } from "lodash"; -import { FactionWorkType } from "./Enums"; import numeral from "numeral"; import { clearPort, peekPort, portHandle, readPort, tryWritePort, writePort } from "./NetscriptPort"; import { FilePath, resolveFilePath } from "./Paths/FilePath"; import { hasScriptExtension } from "./Paths/ScriptFilePath"; import { hasTextExtension } from "./Paths/TextFilePath"; import { ContentFilePath } from "./Paths/ContentFile"; -import { LiteratureName } from "./Literature/data/LiteratureNames"; import { hasContractExtension } from "./Paths/ContractFilePath"; import { getRamCost } from "./Netscript/RamCostGenerator"; +import { getEnumHelper } from "./utils/EnumHelper"; export const enums: NSEnums = { CityName, CrimeType, FactionWorkType, GymType, - LocationName, JobName, + LocationName, ToastVariant, UniversityClassType, }; @@ -1600,10 +1608,8 @@ export const ns: InternalAPI = { (ctx) => (_message, _variant = ToastVariant.SUCCESS, _duration = 2000) => { const message = helpers.string(ctx, "message", _message); - const variant = helpers.string(ctx, "variant", _variant); + const variant = getEnumHelper("ToastVariant").nsGetMember(ctx, _variant); const duration = _duration === null ? null : helpers.number(ctx, "duration", _duration); - if (!checkEnum(ToastVariant, variant)) - throw new Error(`variant must be one of ${Object.values(ToastVariant).join(", ")}`); SnackbarEvents.emit(message, variant as ToastVariant, duration); }, prompt: (ctx) => (_txt, _options) => { diff --git a/src/NetscriptFunctions/Bladeburner.ts b/src/NetscriptFunctions/Bladeburner.ts index 3c043e9b1..70de05b0c 100644 --- a/src/NetscriptFunctions/Bladeburner.ts +++ b/src/NetscriptFunctions/Bladeburner.ts @@ -1,13 +1,13 @@ +import type { Bladeburner as INetscriptBladeburner } from "@nsdefs"; +import type { Action } from "../Bladeburner/Action"; +import type { InternalAPI, NetscriptContext } from "../Netscript/APIWrapper"; + import { Player } from "@player"; import { Bladeburner } from "../Bladeburner/Bladeburner"; import { BitNodeMultipliers } from "../BitNode/BitNodeMultipliers"; -import { Bladeburner as INetscriptBladeburner } from "@nsdefs"; -import { Action } from "src/Bladeburner/Action"; -import { InternalAPI, NetscriptContext } from "src/Netscript/APIWrapper"; import { BlackOperation } from "../Bladeburner/BlackOperation"; import { helpers } from "../Netscript/NetscriptHelpers"; -import { checkEnum } from "../utils/helpers/enum"; -import { CityName } from "../Enums"; +import { getEnumHelper } from "../utils/EnumHelper"; export function NetscriptBladeburner(): InternalAPI { const checkBladeburnerAccess = function (ctx: NetscriptContext): void { @@ -266,20 +266,17 @@ export function NetscriptBladeburner(): InternalAPI { }, getCityEstimatedPopulation: (ctx) => (_cityName) => { const bladeburner = getBladeburner(ctx); - const cityName = helpers.string(ctx, "cityName", _cityName); - if (!checkEnum(CityName, cityName)) throw new Error(`Invalid city: ${cityName}`); + const cityName = getEnumHelper("CityName").nsGetMember(ctx, _cityName); return bladeburner.cities[cityName].popEst; }, getCityCommunities: (ctx) => (_cityName) => { const bladeburner = getBladeburner(ctx); - const cityName = helpers.string(ctx, "cityName", _cityName); - if (!checkEnum(CityName, cityName)) throw new Error(`Invalid city: ${cityName}`); + const cityName = getEnumHelper("CityName").nsGetMember(ctx, _cityName); return bladeburner.cities[cityName].comms; }, getCityChaos: (ctx) => (_cityName) => { const bladeburner = getBladeburner(ctx); - const cityName = helpers.string(ctx, "cityName", _cityName); - if (!checkEnum(CityName, cityName)) throw new Error(`Invalid city: ${cityName}`); + const cityName = getEnumHelper("CityName").nsGetMember(ctx, _cityName); return bladeburner.cities[cityName].chaos; }, getCity: (ctx) => () => { @@ -288,8 +285,7 @@ export function NetscriptBladeburner(): InternalAPI { }, switchCity: (ctx) => (_cityName) => { const bladeburner = getBladeburner(ctx); - const cityName = helpers.string(ctx, "cityName", _cityName); - if (!checkEnum(CityName, cityName)) throw new Error(`Invalid city: ${cityName}`); + const cityName = getEnumHelper("CityName").nsGetMember(ctx, _cityName); bladeburner.city = cityName; return true; }, diff --git a/src/NetscriptFunctions/Corporation.ts b/src/NetscriptFunctions/Corporation.ts index f38a950b2..fdbd64245 100644 --- a/src/NetscriptFunctions/Corporation.ts +++ b/src/NetscriptFunctions/Corporation.ts @@ -51,16 +51,15 @@ import { } from "../Corporation/Actions"; import { CorpUnlocks } from "../Corporation/data/CorporationUnlocks"; import { CorpUpgrades } from "../Corporation/data/CorporationUpgrades"; -import { CorpUnlockName, CorpUpgradeName, CorpEmployeeJob, IndustryType } from "../Corporation/data/Enums"; +import { CorpUnlockName, CorpUpgradeName, CorpEmployeeJob, CityName } from "@enums"; import { IndustriesData, IndustryResearchTrees } from "../Corporation/data/IndustryData"; import * as corpConstants from "../Corporation/data/Constants"; import { ResearchMap } from "../Corporation/ResearchMap"; import { Factions } from "../Faction/Factions"; import { BitNodeMultipliers } from "../BitNode/BitNodeMultipliers"; import { InternalAPI, NetscriptContext, removedFunction } from "../Netscript/APIWrapper"; -import { assertMember, helpers } from "../Netscript/NetscriptHelpers"; -import { checkEnum } from "../utils/helpers/enum"; -import { CityName } from "../Enums"; +import { helpers } from "../Netscript/NetscriptHelpers"; +import { getEnumHelper } from "../utils/EnumHelper"; import { MaterialInfo } from "../Corporation/MaterialInfo"; import { calculateUpgradeCost } from "../Corporation/helpers"; import { PositiveInteger } from "../types"; @@ -207,17 +206,15 @@ export function NetscriptCorporation(): InternalAPI { return division; } - function getOffice(divisionName: string, cityName: string): OfficeSpace { + function getOffice(divisionName: string, cityName: CityName): OfficeSpace { const division = getDivision(divisionName); - if (!checkEnum(CityName, cityName)) throw new Error(`Invalid city name '${cityName}'`); const office = division.offices[cityName]; if (!office) throw new Error(`${division.name} has not expanded to '${cityName}'`); return office; } - function getWarehouse(divisionName: string, cityName: string): Warehouse { + function getWarehouse(divisionName: string, cityName: CityName): Warehouse { const division = getDivision(divisionName); - if (!checkEnum(CityName, cityName)) throw new Error(`Invalid city name '${cityName}'`); const warehouse = division.warehouses[cityName]; if (!warehouse) throw new Error(`${division.name} does not have a warehouse in '${cityName}'`); return warehouse; @@ -272,7 +269,7 @@ export function NetscriptCorporation(): InternalAPI { (_divisionName, _cityName, _amt = 1) => { checkAccess(ctx, CorpUnlockName.WarehouseAPI); const divisionName = helpers.string(ctx, "divisionName", _divisionName); - const cityName = helpers.city(ctx, "cityName", _cityName); + const cityName = getEnumHelper("CityName").nsGetMember(ctx, _cityName); const amt = helpers.number(ctx, "amount", _amt); if (amt < 1) { throw helpers.makeRuntimeErrorMsg(ctx, "You must provide a positive number"); @@ -283,14 +280,14 @@ export function NetscriptCorporation(): InternalAPI { hasWarehouse: (ctx) => (_divisionName, _cityName) => { checkAccess(ctx, CorpUnlockName.WarehouseAPI); const divisionName = helpers.string(ctx, "divisionName", _divisionName); - const cityName = helpers.city(ctx, "cityName", _cityName); + const cityName = getEnumHelper("CityName").nsGetMember(ctx, _cityName); const division = getDivision(divisionName); return cityName in division.warehouses; }, getWarehouse: (ctx) => (_divisionName, _cityName) => { checkAccess(ctx, CorpUnlockName.WarehouseAPI); const divisionName = helpers.string(ctx, "divisionName", _divisionName); - const cityName = helpers.city(ctx, "cityName", _cityName); + const cityName = getEnumHelper("CityName").nsGetMember(ctx, _cityName); const warehouse = getWarehouse(divisionName, cityName); return { level: warehouse.level, @@ -300,11 +297,11 @@ export function NetscriptCorporation(): InternalAPI { smartSupplyEnabled: warehouse.smartSupplyEnabled, }; }, - getMaterial: (ctx) => (_divisionName, _cityName, materialName) => { + getMaterial: (ctx) => (_divisionName, _cityName, _materialName) => { checkAccess(ctx, CorpUnlockName.WarehouseAPI); const divisionName = helpers.string(ctx, "divisionName", _divisionName); - const cityName = helpers.city(ctx, "cityName", _cityName); - assertMember(ctx, corpConstants.materialNames, "Material Name", "materialName", materialName); + const cityName = getEnumHelper("CityName").nsGetMember(ctx, _cityName); + const materialName = getEnumHelper("CorpMaterialName").nsGetMember(ctx, _materialName, "materialName"); const material = getMaterial(divisionName, cityName, materialName); const corporation = getCorporation(); const exports = cloneDeep(material.exports); @@ -326,7 +323,7 @@ export function NetscriptCorporation(): InternalAPI { checkAccess(ctx, CorpUnlockName.WarehouseAPI); const divisionName = helpers.string(ctx, "divisionName", _divisionName); const productName = helpers.string(ctx, "productName", _productName); - const cityName = helpers.city(ctx, "cityName", _cityName); + const cityName = getEnumHelper("CityName").nsGetMember(ctx, _cityName); const product = getProduct(divisionName, productName); const corporation = getCorporation(); const cityData = product.cityData[cityName]; @@ -349,7 +346,7 @@ export function NetscriptCorporation(): InternalAPI { purchaseWarehouse: (ctx) => (_divisionName, _cityName) => { checkAccess(ctx, CorpUnlockName.WarehouseAPI); const divisionName = helpers.string(ctx, "divisionName", _divisionName); - const cityName = helpers.city(ctx, "cityName", _cityName); + const cityName = getEnumHelper("CityName").nsGetMember(ctx, _cityName); const corporation = getCorporation(); purchaseWarehouse(corporation, getDivision(divisionName), cityName); }, @@ -358,7 +355,7 @@ export function NetscriptCorporation(): InternalAPI { (_divisionName, _cityName, _amt = 1): void => { checkAccess(ctx, CorpUnlockName.WarehouseAPI); const divisionName = helpers.string(ctx, "divisionName", _divisionName); - const cityName = helpers.city(ctx, "cityName", _cityName); + const cityName = getEnumHelper("CityName").nsGetMember(ctx, _cityName); const amt = helpers.number(ctx, "amount", _amt); const corporation = getCorporation(); if (amt < 1) { @@ -366,11 +363,11 @@ export function NetscriptCorporation(): InternalAPI { } UpgradeWarehouse(corporation, getDivision(divisionName), getWarehouse(divisionName, cityName), amt); }, - sellMaterial: (ctx) => (_divisionName, _cityName, materialName, _amt, _price) => { + sellMaterial: (ctx) => (_divisionName, _cityName, _materialName, _amt, _price) => { checkAccess(ctx, CorpUnlockName.WarehouseAPI); const divisionName = helpers.string(ctx, "divisionName", _divisionName); - const cityName = helpers.city(ctx, "cityName", _cityName); - assertMember(ctx, corpConstants.materialNames, "Material Name", "materialName", materialName); + const cityName = getEnumHelper("CityName").nsGetMember(ctx, _cityName); + const materialName = getEnumHelper("CorpMaterialName").nsGetMember(ctx, _materialName, "materialName"); const amt = helpers.string(ctx, "amt", _amt); const price = helpers.string(ctx, "price", _price); const material = getMaterial(divisionName, cityName, materialName); @@ -381,7 +378,7 @@ export function NetscriptCorporation(): InternalAPI { (_divisionName, _cityName, _productName, _amt, _price, _all): void => { checkAccess(ctx, CorpUnlockName.WarehouseAPI); const divisionName = helpers.string(ctx, "divisionName", _divisionName); - const cityName = helpers.city(ctx, "cityName", _cityName); + const cityName = getEnumHelper("CityName").nsGetMember(ctx, _cityName); const productName = helpers.string(ctx, "productName", _productName); const amt = helpers.string(ctx, "amt", _amt); const price = helpers.string(ctx, "price", _price); @@ -398,43 +395,42 @@ export function NetscriptCorporation(): InternalAPI { setSmartSupply: (ctx) => (_divisionName, _cityName, _enabled) => { checkAccess(ctx, CorpUnlockName.WarehouseAPI); const divisionName = helpers.string(ctx, "divisionName", _divisionName); - const cityName = helpers.city(ctx, "cityName", _cityName); + const cityName = getEnumHelper("CityName").nsGetMember(ctx, _cityName); const enabled = !!_enabled; const warehouse = getWarehouse(divisionName, cityName); if (!hasUnlock(CorpUnlockName.SmartSupply)) throw helpers.makeRuntimeErrorMsg(ctx, `You have not purchased the Smart Supply upgrade!`); SetSmartSupply(warehouse, enabled); }, - setSmartSupplyOption: (ctx) => (_divisionName, _cityName, materialName, _option) => { + setSmartSupplyOption: (ctx) => (_divisionName, _cityName, _materialName, _option) => { checkAccess(ctx, CorpUnlockName.WarehouseAPI); const divisionName = helpers.string(ctx, "divisionName", _divisionName); - const cityName = helpers.city(ctx, "cityName", _cityName); - assertMember(ctx, corpConstants.materialNames, "Material Name", "materialName", materialName); + const cityName = getEnumHelper("CityName").nsGetMember(ctx, _cityName); + const materialName = getEnumHelper("CorpMaterialName").nsGetMember(ctx, _materialName, "materialName"); const warehouse = getWarehouse(divisionName, cityName); const material = getMaterial(divisionName, cityName, materialName); - const option = helpers.string(ctx, "option", _option); - assertMember(ctx, corpConstants.smartSupplyOptions, "Smart Supply Option", "option", option); + const option = getEnumHelper("SmartSupplyOption").nsGetMember(ctx, _option); if (!hasUnlock(CorpUnlockName.SmartSupply)) throw helpers.makeRuntimeErrorMsg(ctx, `You have not purchased the Smart Supply upgrade!`); SetSmartSupplyOption(warehouse, material, option); }, - buyMaterial: (ctx) => (_divisionName, _cityName, materialName, _amt) => { + buyMaterial: (ctx) => (_divisionName, _cityName, _materialName, _amt) => { checkAccess(ctx, CorpUnlockName.WarehouseAPI); const divisionName = helpers.string(ctx, "divisionName", _divisionName); - const cityName = helpers.city(ctx, "cityName", _cityName); - assertMember(ctx, corpConstants.materialNames, "Material Name", "materialName", materialName); + const cityName = getEnumHelper("CityName").nsGetMember(ctx, _cityName); + const materialName = getEnumHelper("CorpMaterialName").nsGetMember(ctx, _materialName, "materialName"); const amt = helpers.number(ctx, "amt", _amt); if (amt < 0 || !Number.isFinite(amt)) throw new Error("Invalid value for amount field! Must be numeric and greater than 0"); const material = getMaterial(divisionName, cityName, materialName); BuyMaterial(material, amt); }, - bulkPurchase: (ctx) => (_divisionName, _cityName, materialName, _amt) => { + bulkPurchase: (ctx) => (_divisionName, _cityName, _materialName, _amt) => { checkAccess(ctx, CorpUnlockName.WarehouseAPI); const divisionName = helpers.string(ctx, "divisionName", _divisionName); const corporation = getCorporation(); - const cityName = helpers.city(ctx, "cityName", _cityName); - assertMember(ctx, corpConstants.materialNames, "Material Name", "materialName", materialName); + const cityName = getEnumHelper("CityName").nsGetMember(ctx, _cityName); + const materialName = getEnumHelper("CorpMaterialName").nsGetMember(ctx, _materialName, "materialName"); const amt = helpers.number(ctx, "amt", _amt); const warehouse = getWarehouse(divisionName, cityName); const material = getMaterial(divisionName, cityName, materialName); @@ -445,7 +441,7 @@ export function NetscriptCorporation(): InternalAPI { (_divisionName, _cityName, _productName, _designInvest, _marketingInvest): void => { checkAccess(ctx, CorpUnlockName.WarehouseAPI); const divisionName = helpers.string(ctx, "divisionName", _divisionName); - const cityName = helpers.city(ctx, "cityName", _cityName); + const cityName = getEnumHelper("CityName").nsGetMember(ctx, _cityName); const productName = helpers.string(ctx, "productName", _productName); const designInvest = helpers.number(ctx, "designInvest", _designInvest); const marketingInvest = helpers.number(ctx, "marketingInvest", _marketingInvest); @@ -455,57 +451,58 @@ export function NetscriptCorporation(): InternalAPI { limitProductProduction: (ctx) => (_divisionName, _cityName, _productName, _qty) => { checkAccess(ctx, CorpUnlockName.WarehouseAPI); const divisionName = helpers.string(ctx, "divisionName", _divisionName); - const cityName = helpers.city(ctx, "cityName", _cityName); + const cityName = getEnumHelper("CityName").nsGetMember(ctx, _cityName); const productName = helpers.string(ctx, "productName", _productName); const qty = helpers.number(ctx, "qty", _qty); LimitProductProduction(getProduct(divisionName, productName), cityName, qty); }, exportMaterial: (ctx) => - (_sourceDivision, sourceCity, _targetDivision, targetCity, materialName, _amt): void => { + (_sourceDivision, _sourceCity, _targetDivision, _targetCity, _materialName, _amt): void => { checkAccess(ctx, CorpUnlockName.WarehouseAPI); const sourceDivision = helpers.string(ctx, "sourceDivision", _sourceDivision); - assertMember(ctx, CityName, "City", "sourceCity", sourceCity); + const sourceCity = getEnumHelper("CityName").nsGetMember(ctx, _sourceCity, "sourceCity"); const targetDivision = getDivision(helpers.string(ctx, "targetDivision", _targetDivision)); - assertMember(ctx, CityName, "City", "targetCity", targetCity); - assertMember(ctx, corpConstants.materialNames, "Material Name", "materialName", materialName); + const targetCity = getEnumHelper("CityName").nsGetMember(ctx, _targetCity, "targetCity"); + const materialName = getEnumHelper("CorpMaterialName").nsGetMember(ctx, _materialName, "materialName"); const amt = helpers.string(ctx, "amt", _amt); + ExportMaterial(targetDivision, targetCity, getMaterial(sourceDivision, sourceCity, materialName), amt); }, cancelExportMaterial: (ctx) => - (_sourceDivision, sourceCity, _targetDivision, targetCity, materialName): void => { + (_sourceDivision, _sourceCity, _targetDivision, _targetCity, _materialName): void => { checkAccess(ctx, CorpUnlockName.WarehouseAPI); const sourceDivision = helpers.string(ctx, "sourceDivision", _sourceDivision); - assertMember(ctx, CityName, "City Name", "sourceCity", sourceCity); + const sourceCity = getEnumHelper("CityName").nsGetMember(ctx, _sourceCity, "sourceCity"); const targetDivision = helpers.string(ctx, "targetDivision", _targetDivision); - assertMember(ctx, CityName, "City Name", "targetCity", targetCity); - assertMember(ctx, corpConstants.materialNames, "Material Name", "materialName", materialName); + const targetCity = getEnumHelper("CityName").nsGetMember(ctx, _targetCity, "targetCity"); + const materialName = getEnumHelper("CorpMaterialName").nsGetMember(ctx, _materialName, "materialName"); CancelExportMaterial(targetDivision, targetCity, getMaterial(sourceDivision, sourceCity, materialName)); }, - limitMaterialProduction: (ctx) => (_divisionName, cityName, materialName, _qty) => { + limitMaterialProduction: (ctx) => (_divisionName, _cityName, _materialName, _qty) => { checkAccess(ctx, CorpUnlockName.WarehouseAPI); const divisionName = helpers.string(ctx, "divisionName", _divisionName); - assertMember(ctx, CityName, "City Name", "cityName", cityName); - assertMember(ctx, corpConstants.materialNames, "Material Name", "materialName", materialName); + const cityName = getEnumHelper("CityName").nsGetMember(ctx, _cityName); + const materialName = getEnumHelper("CorpMaterialName").nsGetMember(ctx, _materialName, "materialName"); const qty = helpers.number(ctx, "qty", _qty); LimitMaterialProduction(getMaterial(divisionName, cityName, materialName), qty); }, - setMaterialMarketTA1: (ctx) => (_divisionName, cityName, materialName, _on) => { + setMaterialMarketTA1: (ctx) => (_divisionName, _cityName, _materialName, _on) => { checkAccess(ctx, CorpUnlockName.WarehouseAPI); const divisionName = helpers.string(ctx, "divisionName", _divisionName); - assertMember(ctx, CityName, "City Name", "cityName", cityName); - assertMember(ctx, corpConstants.materialNames, "Material Name", "materialName", materialName); + const cityName = getEnumHelper("CityName").nsGetMember(ctx, _cityName); + const materialName = getEnumHelper("CorpMaterialName").nsGetMember(ctx, _materialName, "materialName"); const on = !!_on; if (!getDivision(divisionName).hasResearch("Market-TA.I")) throw helpers.makeRuntimeErrorMsg(ctx, `You have not researched MarketTA.I for division: ${divisionName}`); SetMaterialMarketTA1(getMaterial(divisionName, cityName, materialName), on); }, - setMaterialMarketTA2: (ctx) => (_divisionName, cityName, materialName, _on) => { + setMaterialMarketTA2: (ctx) => (_divisionName, _cityName, _materialName, _on) => { checkAccess(ctx, CorpUnlockName.WarehouseAPI); const divisionName = helpers.string(ctx, "divisionName", _divisionName); - assertMember(ctx, CityName, "City Name", "cityName", cityName); - assertMember(ctx, corpConstants.materialNames, "Material Name", "materialName", materialName); + const cityName = getEnumHelper("CityName").nsGetMember(ctx, _cityName); + const materialName = getEnumHelper("CorpMaterialName").nsGetMember(ctx, _materialName, "materialName"); const on = !!_on; if (!getDivision(divisionName).hasResearch("Market-TA.II")) throw helpers.makeRuntimeErrorMsg(ctx, `You have not researched MarketTA.II for division: ${divisionName}`); @@ -544,22 +541,22 @@ export function NetscriptCorporation(): InternalAPI { const division = getDivision(divisionName); return division.numAdVerts; }, - getResearchCost: (ctx) => (_divisionName, researchName) => { + getResearchCost: (ctx) => (_divisionName, _researchName) => { checkAccess(ctx, CorpUnlockName.OfficeAPI); const divisionName = helpers.string(ctx, "divisionName", _divisionName); - assertMember(ctx, corpConstants.researchNames, "Research Name", "researchName", researchName); + const researchName = getEnumHelper("CorpResearchName").nsGetMember(ctx, _researchName, "researchName"); return getResearchCost(getDivision(divisionName), researchName); }, - hasResearched: (ctx) => (_divisionName, researchName) => { + hasResearched: (ctx) => (_divisionName, _researchName) => { checkAccess(ctx, CorpUnlockName.OfficeAPI); const divisionName = helpers.string(ctx, "divisionName", _divisionName); - assertMember(ctx, corpConstants.researchNames, "Research Name", "researchName", researchName); + const researchName = getEnumHelper("CorpResearchName").nsGetMember(ctx, _researchName, "researchName"); return hasResearched(getDivision(divisionName), researchName); }, getOfficeSizeUpgradeCost: (ctx) => (_divisionName, _cityName, _size) => { checkAccess(ctx, CorpUnlockName.OfficeAPI); const divisionName = helpers.string(ctx, "divisionName", _divisionName); - const cityName = helpers.city(ctx, "cityName", _cityName); + const cityName = getEnumHelper("CityName").nsGetMember(ctx, _cityName); const size = helpers.number(ctx, "size", _size); if (size < 0) throw new Error("Invalid value for size field! Must be numeric and greater than 0"); const office = getOffice(divisionName, cityName); @@ -574,11 +571,10 @@ export function NetscriptCorporation(): InternalAPI { setAutoJobAssignment: (ctx) => (_divisionName, _cityName, _job, _amount) => { checkAccess(ctx, CorpUnlockName.OfficeAPI); const divisionName = helpers.string(ctx, "divisionName", _divisionName); - const cityName = helpers.city(ctx, "cityName", _cityName); + const cityName = getEnumHelper("CityName").nsGetMember(ctx, _cityName); const amount = helpers.number(ctx, "amount", _amount); - const job = helpers.string(ctx, "job", _job); + const job = getEnumHelper("CorpEmployeeJob").nsGetMember(ctx, _job, "job"); - if (!checkEnum(CorpEmployeeJob, job)) throw new Error(`'${job}' is not a valid job.`); if (job === CorpEmployeeJob.Unassigned) return false; if (amount < 0 || !Number.isInteger(amount)) throw helpers.makeRuntimeErrorMsg( @@ -600,18 +596,16 @@ export function NetscriptCorporation(): InternalAPI { hireEmployee: (ctx) => (_divisionName, _cityName, _position?) => { checkAccess(ctx, CorpUnlockName.OfficeAPI); const divisionName = helpers.string(ctx, "divisionName", _divisionName); - const cityName = helpers.city(ctx, "cityName", _cityName); - const position = _position ? helpers.string(ctx, "position", _position) : CorpEmployeeJob.Unassigned; - if (!checkEnum(CorpEmployeeJob, position)) { - throw helpers.makeRuntimeErrorMsg(ctx, `Invalid position: ${position}`); - } + const cityName = getEnumHelper("CityName").nsGetMember(ctx, _cityName); + const position = getEnumHelper("CorpEmployeeJob").nsGetMember(ctx, _position, "position"); + const office = getOffice(divisionName, cityName); return office.hireRandomEmployee(position); }, upgradeOfficeSize: (ctx) => (_divisionName, _cityName, _size) => { checkAccess(ctx, CorpUnlockName.OfficeAPI); const divisionName = helpers.string(ctx, "divisionName", _divisionName); - const cityName = helpers.city(ctx, "cityName", _cityName); + const cityName = getEnumHelper("CityName").nsGetMember(ctx, _cityName); const size = helpers.number(ctx, "size", _size); if (size < 0) throw new Error("Invalid value for size field! Must be numeric and greater than 0"); const office = getOffice(divisionName, cityName); @@ -621,7 +615,7 @@ export function NetscriptCorporation(): InternalAPI { throwParty: (ctx) => (_divisionName, _cityName, _costPerEmployee) => { checkAccess(ctx, CorpUnlockName.OfficeAPI); const divisionName = helpers.string(ctx, "divisionName", _divisionName); - const cityName = helpers.city(ctx, "cityName", _cityName); + const cityName = getEnumHelper("CityName").nsGetMember(ctx, _cityName); const costPerEmployee = helpers.number(ctx, "costPerEmployee", _costPerEmployee); if (costPerEmployee < 0) { @@ -635,7 +629,7 @@ export function NetscriptCorporation(): InternalAPI { buyTea: (ctx) => (_divisionName, _cityName) => { checkAccess(ctx, CorpUnlockName.OfficeAPI); const divisionName = helpers.string(ctx, "divisionName", _divisionName); - const cityName = helpers.city(ctx, "cityName", _cityName); + const cityName = getEnumHelper("CityName").nsGetMember(ctx, _cityName); const corporation = getCorporation(); const office = getOffice(divisionName, cityName); @@ -647,16 +641,16 @@ export function NetscriptCorporation(): InternalAPI { const corporation = getCorporation(); HireAdVert(corporation, getDivision(divisionName)); }, - research: (ctx) => (_divisionName, researchName) => { + research: (ctx) => (_divisionName, _researchName) => { checkAccess(ctx, CorpUnlockName.OfficeAPI); const divisionName = helpers.string(ctx, "divisionName", _divisionName); - assertMember(ctx, corpConstants.researchNames, "Research Name", "reseatchName", researchName); + const researchName = getEnumHelper("CorpResearchName").nsGetMember(ctx, _researchName, "researchName"); Research(getDivision(divisionName), researchName); }, getOffice: (ctx) => (_divisionName, _cityName) => { checkAccess(ctx, CorpUnlockName.OfficeAPI); const divisionName = helpers.string(ctx, "divisionName", _divisionName); - const cityName = helpers.city(ctx, "cityName", _cityName); + const cityName = getEnumHelper("CityName").nsGetMember(ctx, _cityName); const office = getOffice(divisionName, cityName); return { city: office.city, @@ -688,23 +682,17 @@ export function NetscriptCorporation(): InternalAPI { }, getIndustryData: (ctx) => (_industryName) => { checkAccess(ctx); - const industryName = helpers.string(ctx, "industryName", _industryName); - if (!checkEnum(IndustryType, industryName)) { - throw helpers.makeRuntimeErrorMsg(ctx, `Invalid industry: ${industryName}`); - } + const industryName = getEnumHelper("IndustryType").nsGetMember(ctx, _industryName, "industryName"); return cloneDeep(IndustriesData[industryName]); }, - getMaterialData: (ctx) => (materialName) => { + getMaterialData: (ctx) => (_materialName) => { checkAccess(ctx); - assertMember(ctx, corpConstants.materialNames, "Material Name", "materialName", materialName); + const materialName = getEnumHelper("CorpMaterialName").nsGetMember(ctx, _materialName, "materialName"); return cloneDeep(MaterialInfo[materialName]); }, expandIndustry: (ctx) => (_industryName, _divisionName) => { checkAccess(ctx); - const industryName = helpers.string(ctx, "industryName", _industryName); - if (!checkEnum(IndustryType, industryName)) { - throw helpers.makeRuntimeErrorMsg(ctx, `Invalid industry: ${industryName}`); - } + const industryName = getEnumHelper("IndustryType").nsGetMember(ctx, _industryName, "industryName"); const divisionName = helpers.string(ctx, "divisionName", _divisionName); const corporation = getCorporation(); NewDivision(corporation, industryName, divisionName); @@ -712,23 +700,21 @@ export function NetscriptCorporation(): InternalAPI { expandCity: (ctx) => (_divisionName, _cityName) => { checkAccess(ctx); const divisionName = helpers.string(ctx, "divisionName", _divisionName); - const cityName = helpers.city(ctx, "cityName", _cityName); + const cityName = getEnumHelper("CityName").nsGetMember(ctx, _cityName); const corporation = getCorporation(); const division = getDivision(divisionName); purchaseOffice(corporation, division, cityName); }, purchaseUnlock: (ctx) => (_unlockName) => { checkAccess(ctx); - const unlockName = helpers.string(ctx, "upgradeName", _unlockName); - if (!checkEnum(CorpUnlockName, unlockName)) throw new Error(`No unlock named ${unlockName}`); + const unlockName = getEnumHelper("CorpUnlockName").nsGetMember(ctx, _unlockName, "unlockName"); const corporation = getCorporation(); const message = corporation.purchaseUnlock(unlockName); if (message) throw new Error(`Could not unlock ${unlockName}: ${message}`); }, levelUpgrade: (ctx) => (_upgradeName) => { checkAccess(ctx); - const upgradeName = helpers.string(ctx, "upgradeName", _upgradeName); - if (!checkEnum(CorpUpgradeName, upgradeName)) throw new Error(`No upgrade named '${upgradeName}'`); + const upgradeName = getEnumHelper("CorpUpgradeName").nsGetMember(ctx, _upgradeName, "upgradeName"); const corporation = getCorporation(); const message = corporation.purchaseUpgrade(upgradeName, 1); if (message) throw new Error(`Could not upgrade ${upgradeName}: ${message}`); @@ -794,26 +780,22 @@ export function NetscriptCorporation(): InternalAPI { }, hasUnlock: (ctx) => (_unlockName) => { checkAccess(ctx); - const unlockName = helpers.string(ctx, "upgradeName", _unlockName); - if (!checkEnum(CorpUnlockName, unlockName)) throw new Error(`${unlockName} is not a valid unlock name.`); + const unlockName = getEnumHelper("CorpUnlockName").nsGetMember(ctx, _unlockName, "unlockName"); return hasUnlock(unlockName); }, getUnlockCost: (ctx) => (_unlockName) => { checkAccess(ctx); - const unlockName = helpers.string(ctx, "upgradeName", _unlockName); - if (!checkEnum(CorpUnlockName, unlockName)) throw new Error(`${unlockName} is not a valid unlock name.`); + const unlockName = getEnumHelper("CorpUnlockName").nsGetMember(ctx, _unlockName, "unlockName"); return getUnlockCost(unlockName); }, getUpgradeLevel: (ctx) => (_upgradeName) => { checkAccess(ctx); - const upgradeName = helpers.string(ctx, "upgradeName", _upgradeName); - if (!checkEnum(CorpUpgradeName, upgradeName)) throw new Error(`${upgradeName} is not a valid upgrade name.`); + const upgradeName = getEnumHelper("CorpUpgradeName").nsGetMember(ctx, _upgradeName, "upgradeName"); return getUpgradeLevel(upgradeName); }, getUpgradeLevelCost: (ctx) => (_upgradeName) => { checkAccess(ctx); - const upgradeName = helpers.string(ctx, "upgradeName", _upgradeName); - if (!checkEnum(CorpUpgradeName, upgradeName)) throw new Error(`${upgradeName} is not a valid upgrade name.`); + const upgradeName = getEnumHelper("CorpUpgradeName").nsGetMember(ctx, _upgradeName, "upgradeName"); return getUpgradeLevelCost(upgradeName); }, getInvestmentOffer: (ctx) => () => { diff --git a/src/NetscriptFunctions/Formulas.ts b/src/NetscriptFunctions/Formulas.ts index e089a7a9e..d56b9d7ec 100644 --- a/src/NetscriptFunctions/Formulas.ts +++ b/src/NetscriptFunctions/Formulas.ts @@ -26,7 +26,15 @@ import { calculateGrowTime, calculateWeakenTime, } from "../Hacking"; -import { CompletedProgramName } from "../Programs/Programs"; +import { + CityName, + CompletedProgramName, + FactionWorkType, + GymType, + JobName, + LocationName, + UniversityClassType, +} from "@enums"; import { Formulas as IFormulas, Player as IPlayer, Person as IPerson } from "@nsdefs"; import { calculateRespectGain, @@ -45,11 +53,10 @@ import { calculateCompanyWorkStats } from "../Work/Formulas"; import { Companies } from "../Company/Companies"; import { calculateClassEarnings } from "../Work/Formulas"; import { calculateFactionExp, calculateFactionRep } from "../Work/Formulas"; -import { FactionWorkType, GymType, UniversityClassType, LocationName, CityName } from "../Enums"; import { defaultMultipliers } from "../PersonObjects/Multipliers"; -import { checkEnum, findEnumMember } from "../utils/helpers/enum"; -import { JobName } from "../Enums"; +import { findEnumMember } from "../utils/helpers/enum"; +import { getEnumHelper } from "../utils/EnumHelper"; import { CompanyPositions } from "../Company/CompanyPositions"; import { findCrime } from "../Crime/CrimeHelpers"; @@ -384,8 +391,7 @@ export function NetscriptFormulas(): InternalAPI { const person = helpers.person(ctx, _person); const classType = findEnumMember(GymType, helpers.string(ctx, "classType", _classType)); if (!classType) throw new Error(`Invalid gym training type: ${_classType}`); - const locationName = helpers.string(ctx, "locationName", _locationName); - if (!checkEnum(LocationName, locationName)) throw new Error(`Invalid location name: ${locationName}`); + const locationName = getEnumHelper("LocationName").nsGetMember(ctx, _locationName); return calculateClassEarnings(person, classType, locationName); }, universityGains: (ctx) => (_person, _classType, _locationName) => { @@ -393,8 +399,7 @@ export function NetscriptFormulas(): InternalAPI { const person = helpers.person(ctx, _person); const classType = findEnumMember(UniversityClassType, helpers.string(ctx, "classType", _classType)); if (!classType) throw new Error(`Invalid university class type: ${_classType}`); - const locationName = helpers.string(ctx, "locationName", _locationName); - if (!checkEnum(LocationName, locationName)) throw new Error(`Invalid location name: ${locationName}`); + const locationName = getEnumHelper("LocationName").nsGetMember(ctx, _locationName); return calculateClassEarnings(person, classType, locationName); }, factionGains: (ctx) => (_player, _workType, _favor) => { diff --git a/src/NetscriptFunctions/Gang.ts b/src/NetscriptFunctions/Gang.ts index 9a68504f5..5cb35e42f 100644 --- a/src/NetscriptFunctions/Gang.ts +++ b/src/NetscriptFunctions/Gang.ts @@ -1,4 +1,4 @@ -import { FactionNames } from "../Faction/data/FactionNames"; +import { FactionName } from "@enums"; import { GangConstants } from "../Gang/data/Constants"; import { Player } from "@player"; import { Gang } from "../Gang/Gang"; @@ -43,7 +43,7 @@ export function NetscriptGang(): InternalAPI { if (Player.gang) return false; if (!Player.factions.includes(faction)) return false; - const isHacking = faction === FactionNames.NiteSec || faction === FactionNames.TheBlackHand; + const isHacking = faction === FactionName.NiteSec || faction === FactionName.TheBlackHand; Player.startGang(faction, isHacking); return true; }, diff --git a/src/NetscriptFunctions/Grafting.ts b/src/NetscriptFunctions/Grafting.ts index 4ccef3bbe..4d05c8d08 100644 --- a/src/NetscriptFunctions/Grafting.ts +++ b/src/NetscriptFunctions/Grafting.ts @@ -1,10 +1,10 @@ -import { InternalAPI, NetscriptContext } from "../Netscript/APIWrapper"; +import type { InternalAPI, NetscriptContext } from "../Netscript/APIWrapper"; import { StaticAugmentations } from "../Augmentation/StaticAugmentations"; import { hasAugmentationPrereqs } from "../Faction/FactionHelpers"; -import { CityName } from "../Enums"; +import { CityName } from "@enums"; import { GraftableAugmentation } from "../PersonObjects/Grafting/GraftableAugmentation"; import { getGraftingAvailableAugs, calculateGraftingTimeWithBonus } from "../PersonObjects/Grafting/GraftingHelpers"; -import { Player as player } from "../Player"; +import { Player } from "@player"; import { Grafting as IGrafting } from "@nsdefs"; import { Router } from "../ui/GameRoot"; import { Page } from "../ui/Router"; @@ -14,7 +14,7 @@ import { augmentationExists } from "../Augmentation/AugmentationHelpers"; export function NetscriptGrafting(): InternalAPI { const checkGraftingAPIAccess = (ctx: NetscriptContext): void => { - if (!player.canAccessGrafting()) { + if (!Player.canAccessGrafting()) { throw helpers.makeRuntimeErrorMsg( ctx, "You do not currently have access to the Grafting API. This is either because you are not in BitNode 10 or because you do not have Source-File 10", @@ -58,7 +58,7 @@ export function NetscriptGrafting(): InternalAPI { const augName = helpers.string(ctx, "augName", _augName); const focus = !!_focus; checkGraftingAPIAccess(ctx); - if (player.city !== CityName.NewTokyo) { + if (Player.city !== CityName.NewTokyo) { throw helpers.makeRuntimeErrorMsg(ctx, "You must be in New Tokyo to begin grafting an Augmentation."); } if (!isValidGraftingAugName(augName)) { @@ -66,10 +66,10 @@ export function NetscriptGrafting(): InternalAPI { return false; } - const wasFocusing = player.focus; + const wasFocusing = Player.focus; const craftableAug = new GraftableAugmentation(StaticAugmentations[augName]); - if (player.money < craftableAug.cost) { + if (Player.money < craftableAug.cost) { helpers.log(ctx, () => `You don't have enough money to craft ${augName}`); return false; } @@ -79,7 +79,7 @@ export function NetscriptGrafting(): InternalAPI { return false; } - player.startWork( + Player.startWork( new GraftingWork({ singularity: true, augmentation: augName, @@ -87,10 +87,10 @@ export function NetscriptGrafting(): InternalAPI { ); if (focus) { - player.startFocusing(); + Player.startFocusing(); Router.toPage(Page.Work); } else if (wasFocusing) { - player.stopFocusing(); + Player.stopFocusing(); Router.toPage(Page.Terminal); } diff --git a/src/NetscriptFunctions/Infiltration.ts b/src/NetscriptFunctions/Infiltration.ts index de1baf14f..8cda15e91 100644 --- a/src/NetscriptFunctions/Infiltration.ts +++ b/src/NetscriptFunctions/Infiltration.ts @@ -1,4 +1,6 @@ -import { Infiltration as IInfiltration, InfiltrationLocation } from "@nsdefs"; +import type { InternalAPI, NetscriptContext } from "../Netscript/APIWrapper"; +import { Infiltration as NetscriptInfiltation, InfiltrationLocation } from "@nsdefs"; +import { FactionName, LocationName } from "@enums"; import { Location } from "../Locations/Location"; import { Locations } from "../Locations/Locations"; import { calculateDifficulty, calculateReward } from "../Infiltration/formulas/game"; @@ -7,21 +9,17 @@ import { calculateSellInformationCashReward, calculateTradeInformationRepReward, } from "../Infiltration/formulas/victory"; -import { FactionNames } from "../Faction/data/FactionNames"; import { Factions } from "../Faction/Factions"; -import { InternalAPI, NetscriptContext } from "../Netscript/APIWrapper"; -import { checkEnum } from "../utils/helpers/enum"; -import { LocationName } from "../Enums"; +import { getEnumHelper } from "../utils/EnumHelper"; import { helpers } from "../Netscript/NetscriptHelpers"; import { filterTruthy } from "../utils/helpers/ArrayHelpers"; -export function NetscriptInfiltration(): InternalAPI { +export function NetscriptInfiltration(): InternalAPI { const getLocationsWithInfiltrations = Object.values(Locations).filter( (location: Location) => location.infiltrationData, ); - const calculateInfiltrationData = (ctx: NetscriptContext, locationName: string): InfiltrationLocation => { - if (!checkEnum(LocationName, locationName)) throw new Error(`Location '${locationName}' does not exists.`); + const calculateInfiltrationData = (ctx: NetscriptContext, locationName: LocationName): InfiltrationLocation => { const location = Locations[locationName]; if (location === undefined) throw helpers.makeRuntimeErrorMsg(ctx, `Location '${location}' does not exists.`); if (location.infiltrationData === undefined) @@ -35,7 +33,7 @@ export function NetscriptInfiltration(): InternalAPI { reward: { tradeRep: calculateTradeInformationRepReward(reward, maxLevel, startingSecurityLevel), sellCash: calculateSellInformationCashReward(reward, maxLevel, startingSecurityLevel), - SoARep: calculateInfiltratorsRepReward(Factions[FactionNames.ShadowsOfAnarchy], startingSecurityLevel), + SoARep: calculateInfiltratorsRepReward(Factions[FactionName.ShadowsOfAnarchy], startingSecurityLevel), }, difficulty: difficulty, }; @@ -52,9 +50,9 @@ export function NetscriptInfiltration(): InternalAPI { }), ); }, - getInfiltration: (ctx) => (_location) => { - const location = helpers.string(ctx, "location", _location); - return calculateInfiltrationData(ctx, location); + getInfiltration: (ctx) => (_locationName) => { + const locationName = getEnumHelper("LocationName").nsGetMember(ctx, _locationName); + return calculateInfiltrationData(ctx, locationName); }, }; } diff --git a/src/NetscriptFunctions/Singularity.ts b/src/NetscriptFunctions/Singularity.ts index 9698a8876..90a39dfbd 100644 --- a/src/NetscriptFunctions/Singularity.ts +++ b/src/NetscriptFunctions/Singularity.ts @@ -1,20 +1,29 @@ +import type { Singularity as ISingularity } from "@nsdefs"; +import type { Augmentation } from "../Augmentation/Augmentation"; +import type { Company } from "../Company/Company"; +import type { Faction } from "../Faction/Faction"; + import { Player } from "@player"; +import { + AugmentationName, + BlackOperationName, + CityName, + FactionName, + FactionWorkType, + GymType, + LocationName, + UniversityClassType, +} from "@enums"; import { purchaseAugmentation, joinFaction, getFactionAugmentationsFiltered } from "../Faction/FactionHelpers"; import { startWorkerScript } from "../NetscriptWorker"; -import { Augmentation } from "../Augmentation/Augmentation"; import { StaticAugmentations } from "../Augmentation/StaticAugmentations"; import { augmentationExists, installAugmentations } from "../Augmentation/AugmentationHelpers"; -import { AugmentationNames } from "../Augmentation/data/AugmentationNames"; import { CONSTANTS } from "../Constants"; import { RunningScript } from "../Script/RunningScript"; import { calculateAchievements } from "../Achievements/Achievements"; - -import { Singularity as ISingularity } from "@nsdefs"; - import { findCrime } from "../Crime/CrimeHelpers"; import { CompanyPositions } from "../Company/CompanyPositions"; import { DarkWebItems } from "../DarkWeb/DarkWebItems"; -import { CityName, LocationName, JobName } from "../Enums"; import { Router } from "../ui/GameRoot"; import { SpecialServers } from "../Server/data/SpecialServers"; import { Page } from "../ui/Router"; @@ -23,11 +32,9 @@ import { GetServer } from "../Server/AllServers"; import { Programs } from "../Programs/Programs"; import { formatMoney, formatRam, formatReputation } from "../ui/formatNumber"; import { BitNodeMultipliers } from "../BitNode/BitNodeMultipliers"; -import { Company } from "../Company/Company"; import { Companies } from "../Company/Companies"; import { companiesMetadata } from "../Company/data/CompaniesMetadata"; import { Factions, factionExists } from "../Faction/Factions"; -import { Faction } from "../Faction/Faction"; import { helpers } from "../Netscript/NetscriptHelpers"; import { convertTimeMsToTimeElapsedString } from "../utils/StringHelperFunctions"; import { getServerOnNetwork } from "../Server/ServerHelpers"; @@ -37,20 +44,17 @@ import { Server } from "../Server/Server"; import { netscriptCanHack } from "../Hacking/netscriptCanHack"; import { FactionInfos } from "../Faction/FactionInfo"; import { InternalAPI, NetscriptContext, removedFunction } from "../Netscript/APIWrapper"; -import { BlackOperationNames } from "../Bladeburner/data/BlackOperationNames"; import { enterBitNode } from "../RedPill"; -import { FactionNames } from "../Faction/data/FactionNames"; import { ClassWork } from "../Work/ClassWork"; import { CreateProgramWork, isCreateProgramWork } from "../Work/CreateProgramWork"; import { FactionWork } from "../Work/FactionWork"; -import { FactionWorkType, GymType, UniversityClassType } from "../Enums"; import { CompanyWork } from "../Work/CompanyWork"; import { canGetBonus, onExport } from "../ExportBonus"; import { saveObject } from "../SaveObject"; import { calculateCrimeWorkStats } from "../Work/Formulas"; import { findEnumMember } from "../utils/helpers/enum"; import { Engine } from "../engine"; -import { checkEnum } from "../utils/helpers/enum"; +import { getEnumHelper } from "../utils/EnumHelper"; import { ScriptFilePath, resolveScriptFilePath } from "../Paths/ScriptFilePath"; import { root } from "../Paths/Directory"; @@ -170,7 +174,7 @@ export function NetscriptSingularity(): InternalAPI { return false; } - const isNeuroflux = aug.name === AugmentationNames.NeuroFluxGovernor; + const isNeuroflux = aug.name === AugmentationName.NeuroFluxGovernor; if (!isNeuroflux) { for (let j = 0; j < Player.queuedAugmentations.length; ++j) { if (Player.queuedAugmentations[j].name === aug.name) { @@ -405,7 +409,7 @@ export function NetscriptSingularity(): InternalAPI { travelToCity: (ctx) => (_cityName) => { helpers.checkSingularityAccess(ctx); - const cityName = helpers.city(ctx, "cityName", _cityName); + const cityName = getEnumHelper("CityName").nsGetMember(ctx, _cityName); switch (cityName) { case CityName.Aevum: @@ -698,18 +702,13 @@ export function NetscriptSingularity(): InternalAPI { getCompanyPositionInfo: (ctx) => (_companyName, _positionName) => { helpers.checkSingularityAccess(ctx); const companyName = helpers.string(ctx, "companyName", _companyName); - const positionName = helpers.string(ctx, "positionName", _positionName); + const positionName = getEnumHelper("JobName").nsGetMember(ctx, _positionName, "positionName"); // Make sure its a valid company if (!(companyName in Companies)) { throw helpers.makeRuntimeErrorMsg(ctx, `Invalid company: '${companyName}'`); } - // Make sure its a valid position - if (!checkEnum(JobName, positionName)) { - throw helpers.makeRuntimeErrorMsg(ctx, `Invalid position: '${positionName}'`); - } - if (!Companies[companyName].hasPosition(positionName)) { throw helpers.makeRuntimeErrorMsg(ctx, `Company '${companyName}' does not have position '${positionName}'`); } @@ -1025,7 +1024,7 @@ export function NetscriptSingularity(): InternalAPI { helpers.log(ctx, () => `You can't donate to '${facName}' because youre managing a gang for it`); return false; } - if (faction.name === FactionNames.ChurchOfTheMachineGod || faction.name === FactionNames.Bladeburners) { + if (faction.name === FactionName.ChurchOfTheMachineGod || faction.name === FactionName.Bladeburners) { helpers.log(ctx, () => `You can't donate to '${facName}' because they do not accept donations`); return false; } @@ -1228,7 +1227,7 @@ export function NetscriptSingularity(): InternalAPI { }; const bladeburnerRequirements = () => { if (!Player.bladeburner) return false; - return Player.bladeburner.blackops[BlackOperationNames.OperationDaedalus]; + return Player.bladeburner.blackops[BlackOperationName.OperationDaedalus]; }; if (!hackingRequirements() && !bladeburnerRequirements()) { diff --git a/src/NetscriptFunctions/Sleeve.ts b/src/NetscriptFunctions/Sleeve.ts index b2e6c40b5..04df5352d 100644 --- a/src/NetscriptFunctions/Sleeve.ts +++ b/src/NetscriptFunctions/Sleeve.ts @@ -1,11 +1,10 @@ import { Player } from "@player"; +import type { Sleeve as NetscriptSleeve } from "@nsdefs"; import { StaticAugmentations } from "../Augmentation/StaticAugmentations"; -import { CityName } from "../Enums"; import { findCrime } from "../Crime/CrimeHelpers"; import { Augmentation } from "../Augmentation/Augmentation"; -import { Sleeve } from "@nsdefs"; -import { checkEnum } from "../utils/helpers/enum"; +import { getEnumHelper } from "../utils/EnumHelper"; import { InternalAPI, NetscriptContext, removedFunction } from "../Netscript/APIWrapper"; import { isSleeveBladeburnerWork } from "../PersonObjects/Sleeve/Work/SleeveBladeburnerWork"; import { isSleeveFactionWork } from "../PersonObjects/Sleeve/Work/SleeveFactionWork"; @@ -13,7 +12,7 @@ import { isSleeveCompanyWork } from "../PersonObjects/Sleeve/Work/SleeveCompanyW import { helpers } from "../Netscript/NetscriptHelpers"; import { cloneDeep } from "lodash"; -export function NetscriptSleeve(): InternalAPI { +export function NetscriptSleeve(): InternalAPI { const checkSleeveAPIAccess = function (ctx: NetscriptContext) { if (Player.bitNodeN !== 10 && !Player.sourceFileLvl(10)) { throw helpers.makeRuntimeErrorMsg( @@ -31,7 +30,7 @@ export function NetscriptSleeve(): InternalAPI { } }; - const sleeveFunctions: InternalAPI = { + const sleeveFunctions: InternalAPI = { getNumSleeves: (ctx) => () => { checkSleeveAPIAccess(ctx); return Player.sleeves.length; @@ -73,14 +72,10 @@ export function NetscriptSleeve(): InternalAPI { }, travel: (ctx) => (_sleeveNumber, _cityName) => { const sleeveNumber = helpers.number(ctx, "sleeveNumber", _sleeveNumber); - const cityName = helpers.string(ctx, "cityName", _cityName); + const cityName = getEnumHelper("CityName").nsGetMember(ctx, _cityName); checkSleeveAPIAccess(ctx); checkSleeveNumber(ctx, sleeveNumber); - if (checkEnum(CityName, cityName)) { - return Player.sleeves[sleeveNumber].travel(cityName); - } else { - throw helpers.makeRuntimeErrorMsg(ctx, `Invalid city name: '${cityName}'.`); - } + return Player.sleeves[sleeveNumber].travel(cityName); }, setToCompanyWork: (ctx) => (_sleeveNumber, acompanyName) => { const sleeveNumber = helpers.number(ctx, "sleeveNumber", _sleeveNumber); diff --git a/src/NetscriptFunctions/Stanek.ts b/src/NetscriptFunctions/Stanek.ts index 553544252..a4a124f37 100644 --- a/src/NetscriptFunctions/Stanek.ts +++ b/src/NetscriptFunctions/Stanek.ts @@ -1,21 +1,20 @@ -import { Player as player } from "../Player"; +import { Player } from "@player"; +import { AugmentationName, FactionName } from "@enums"; import { staneksGift } from "../CotMG/Helper"; import { Fragments, FragmentById } from "../CotMG/Fragment"; import { FragmentType } from "../CotMG/FragmentType"; import { Stanek as IStanek } from "@nsdefs"; -import { AugmentationNames } from "../Augmentation/data/AugmentationNames"; import { NetscriptContext, InternalAPI } from "../Netscript/APIWrapper"; import { applyAugmentation } from "../Augmentation/AugmentationHelpers"; -import { FactionNames } from "../Faction/data/FactionNames"; import { joinFaction } from "../Faction/FactionHelpers"; import { Factions } from "../Faction/Factions"; import { helpers } from "../Netscript/NetscriptHelpers"; export function NetscriptStanek(): InternalAPI { function checkStanekAPIAccess(ctx: NetscriptContext): void { - if (!player.hasAugmentation(AugmentationNames.StaneksGift1, true)) { + if (!Player.hasAugmentation(AugmentationName.StaneksGift1, true)) { throw helpers.makeRuntimeErrorMsg(ctx, "Stanek's Gift is not installed"); } } @@ -108,28 +107,28 @@ export function NetscriptStanek(): InternalAPI { acceptGift: (ctx) => () => { //Check if the player is eligible to join the church if ( - player.canAccessCotMG() && - player.augmentations.filter((a) => a.name !== AugmentationNames.NeuroFluxGovernor).length == 0 && - player.queuedAugmentations.filter((a) => a.name !== AugmentationNames.NeuroFluxGovernor).length == 0 + Player.canAccessCotMG() && + Player.augmentations.filter((a) => a.name !== AugmentationName.NeuroFluxGovernor).length == 0 && + Player.queuedAugmentations.filter((a) => a.name !== AugmentationName.NeuroFluxGovernor).length == 0 ) { //Attempt to join CotMG - joinFaction(Factions[FactionNames.ChurchOfTheMachineGod]); + joinFaction(Factions[FactionName.ChurchOfTheMachineGod]); //Attempt to install the first Stanek aug if ( - !player.hasAugmentation(AugmentationNames.StaneksGift1) && - !player.queuedAugmentations.some((a) => a.name === AugmentationNames.StaneksGift1) + !Player.hasAugmentation(AugmentationName.StaneksGift1) && + !Player.queuedAugmentations.some((a) => a.name === AugmentationName.StaneksGift1) ) { - applyAugmentation({ name: AugmentationNames.StaneksGift1, level: 1 }); + applyAugmentation({ name: AugmentationName.StaneksGift1, level: 1 }); helpers.log( ctx, - () => `'${FactionNames.ChurchOfTheMachineGod}' joined and '${AugmentationNames.StaneksGift1}' installed.`, + () => `'${FactionName.ChurchOfTheMachineGod}' joined and '${AugmentationName.StaneksGift1}' installed.`, ); } } //Return true iff the player is in CotMG and has the first Stanek aug installed return ( - Factions[FactionNames.ChurchOfTheMachineGod].isMember && - player.hasAugmentation(AugmentationNames.StaneksGift1, true) + Factions[FactionName.ChurchOfTheMachineGod].isMember && + Player.hasAugmentation(AugmentationName.StaneksGift1, true) ); }, }; diff --git a/src/NetscriptFunctions/StockMarket.ts b/src/NetscriptFunctions/StockMarket.ts index 43bfd9cfe..33cbef034 100644 --- a/src/NetscriptFunctions/StockMarket.ts +++ b/src/NetscriptFunctions/StockMarket.ts @@ -2,9 +2,7 @@ import { Player as player } from "../Player"; import { buyStock, sellStock, shortStock, sellShort } from "../StockMarket/BuyingAndSelling"; import { StockMarket, SymbolToStockMap, placeOrder, cancelOrder, initStockMarket } from "../StockMarket/StockMarket"; import { getBuyTransactionCost, getSellTransactionGain } from "../StockMarket/StockMarketHelpers"; -import { OrderTypes } from "../StockMarket/data/OrderTypes"; -import { PositionTypes } from "../StockMarket/data/PositionTypes"; -import { StockSymbols } from "../StockMarket/data/StockSymbols"; +import { PositionType, OrderType, StockSymbol } from "@enums"; import { getStockMarket4SDataCost, getStockMarket4STixApiCost, @@ -51,7 +49,7 @@ export function NetscriptStockMarket(): InternalAPI { }, getSymbols: (ctx) => () => { checkTixApiAccess(ctx); - return Object.values(StockSymbols); + return Object.values(StockSymbol); }, getPrice: (ctx) => (_symbol) => { const symbol = helpers.string(ctx, "symbol", _symbol); @@ -108,9 +106,9 @@ export function NetscriptStockMarket(): InternalAPI { let pos; const sanitizedPosType = posType.toLowerCase(); if (sanitizedPosType.includes("l")) { - pos = PositionTypes.Long; + pos = PositionType.Long; } else if (sanitizedPosType.includes("s")) { - pos = PositionTypes.Short; + pos = PositionType.Short; } else { return Infinity; } @@ -133,9 +131,9 @@ export function NetscriptStockMarket(): InternalAPI { let pos; const sanitizedPosType = posType.toLowerCase(); if (sanitizedPosType.includes("l")) { - pos = PositionTypes.Long; + pos = PositionType.Long; } else if (sanitizedPosType.includes("s")) { - pos = PositionTypes.Short; + pos = PositionType.Short; } else { return 0; } @@ -219,22 +217,22 @@ export function NetscriptStockMarket(): InternalAPI { let orderPos; const ltype = type.toLowerCase(); if (ltype.includes("limit") && ltype.includes("buy")) { - orderType = OrderTypes.LimitBuy; + orderType = OrderType.LimitBuy; } else if (ltype.includes("limit") && ltype.includes("sell")) { - orderType = OrderTypes.LimitSell; + orderType = OrderType.LimitSell; } else if (ltype.includes("stop") && ltype.includes("buy")) { - orderType = OrderTypes.StopBuy; + orderType = OrderType.StopBuy; } else if (ltype.includes("stop") && ltype.includes("sell")) { - orderType = OrderTypes.StopSell; + orderType = OrderType.StopSell; } else { throw helpers.makeRuntimeErrorMsg(ctx, `Invalid order type: ${type}`); } const lpos = pos.toLowerCase(); if (lpos.includes("l")) { - orderPos = PositionTypes.Long; + orderPos = PositionType.Long; } else if (lpos.includes("s")) { - orderPos = PositionTypes.Short; + orderPos = PositionType.Short; } else { throw helpers.makeRuntimeErrorMsg(ctx, `Invalid position type: ${pos}`); } @@ -267,22 +265,22 @@ export function NetscriptStockMarket(): InternalAPI { let orderPos; const ltype = type.toLowerCase(); if (ltype.includes("limit") && ltype.includes("buy")) { - orderType = OrderTypes.LimitBuy; + orderType = OrderType.LimitBuy; } else if (ltype.includes("limit") && ltype.includes("sell")) { - orderType = OrderTypes.LimitSell; + orderType = OrderType.LimitSell; } else if (ltype.includes("stop") && ltype.includes("buy")) { - orderType = OrderTypes.StopBuy; + orderType = OrderType.StopBuy; } else if (ltype.includes("stop") && ltype.includes("sell")) { - orderType = OrderTypes.StopSell; + orderType = OrderType.StopSell; } else { throw helpers.makeRuntimeErrorMsg(ctx, `Invalid order type: ${type}`); } const lpos = pos.toLowerCase(); if (lpos.includes("l")) { - orderPos = PositionTypes.Long; + orderPos = PositionType.Long; } else if (lpos.includes("s")) { - orderPos = PositionTypes.Short; + orderPos = PositionType.Short; } else { throw helpers.makeRuntimeErrorMsg(ctx, `Invalid position type: ${pos}`); } diff --git a/src/PersonObjects/Grafting/ui/GraftingRoot.tsx b/src/PersonObjects/Grafting/ui/GraftingRoot.tsx index 3df795e52..b52574eff 100644 --- a/src/PersonObjects/Grafting/ui/GraftingRoot.tsx +++ b/src/PersonObjects/Grafting/ui/GraftingRoot.tsx @@ -1,13 +1,15 @@ +import type { Augmentation } from "../../../Augmentation/Augmentation"; + +import React, { useState } from "react"; import { CheckBox, CheckBoxOutlineBlank, Construction } from "@mui/icons-material"; import { Box, Button, Container, List, ListItemButton, Paper, Typography } from "@mui/material"; -import React, { useState } from "react"; + +import { Player } from "@player"; +import { AugmentationName, LocationName } from "@enums"; import { GraftingWork } from "../../../Work/GraftingWork"; -import { Augmentation } from "../../../Augmentation/Augmentation"; -import { AugmentationNames } from "../../../Augmentation/data/AugmentationNames"; import { StaticAugmentations } from "../../../Augmentation/StaticAugmentations"; import { CONSTANTS } from "../../../Constants"; import { hasAugmentationPrereqs } from "../../../Faction/FactionHelpers"; -import { LocationName } from "../../../Enums"; import { Locations } from "../../../Locations/Locations"; import { PurchaseAugmentationsOrderSetting } from "../../../Settings/SettingEnums"; import { Settings } from "../../../Settings/Settings"; @@ -17,7 +19,6 @@ import { ConfirmationModal } from "../../../ui/React/ConfirmationModal"; import { Money } from "../../../ui/React/Money"; import { formatNumberNoSuffix } from "../../../ui/formatNumber"; import { convertTimeMsToTimeElapsedString } from "../../../utils/StringHelperFunctions"; -import { Player } from "@player"; import { GraftableAugmentation } from "../GraftableAugmentation"; import { calculateGraftingTimeWithBonus, getGraftingAvailableAugs } from "../GraftingHelpers"; import { useRerender } from "../../../ui/React/hooks"; @@ -158,7 +159,7 @@ export const GraftingRoot = (): React.ReactElement => { <> Cancelling grafting will not save grafting progress, and the money you spend will not{" "} be returned. - {!Player.hasAugmentation(AugmentationNames.CongruityImplant) && ( + {!Player.hasAugmentation(AugmentationName.CongruityImplant) && ( <>

    diff --git a/src/PersonObjects/Person.ts b/src/PersonObjects/Person.ts index e8a0f7d2e..013848120 100644 --- a/src/PersonObjects/Person.ts +++ b/src/PersonObjects/Person.ts @@ -1,11 +1,12 @@ +import type { Skills } from "./Skills"; +import type { HP } from "./HP"; +import type { Person as IPerson } from "@nsdefs"; + import * as personMethods from "./PersonMethods"; +import { CityName } from "@enums"; import { PlayerOwnedAugmentation } from "../Augmentation/PlayerOwnedAugmentation"; -import { CityName } from "../Enums"; import { calculateSkill } from "./formulas/skill"; import { defaultMultipliers } from "./Multipliers"; -import { Skills } from "./Skills"; -import { HP } from "./HP"; -import { Person as IPerson } from "@nsdefs"; import { IReviverValue } from "../utils/JSONReviver"; // Base class representing a person-like object diff --git a/src/PersonObjects/Player/PlayerObject.ts b/src/PersonObjects/Player/PlayerObject.ts index f37495d8d..c825bbfe7 100644 --- a/src/PersonObjects/Player/PlayerObject.ts +++ b/src/PersonObjects/Player/PlayerObject.ts @@ -1,3 +1,13 @@ +import type { Player as IPlayer } from "@nsdefs"; +import type { PlayerAchievement } from "../../Achievements/Achievements"; +import type { Bladeburner } from "../../Bladeburner/Bladeburner"; +import type { Corporation } from "../../Corporation/Corporation"; +import type { Exploit } from "../../Exploits/Exploit"; +import type { Gang } from "../../Gang/Gang"; +import type { HacknetNode } from "../../Hacknet/HacknetNode"; +import type { Sleeve } from "../Sleeve/Sleeve"; +import type { Work } from "../../Work/Work"; + import * as augmentationMethods from "./PlayerObjectAugmentationMethods"; import * as bladeburnerMethods from "./PlayerObjectBladeburnerMethods"; import * as corporationMethods from "./PlayerObjectCorporationMethods"; @@ -7,27 +17,15 @@ import * as serverMethods from "./PlayerObjectServerMethods"; import * as workMethods from "./PlayerObjectWorkMethods"; import { setPlayer } from "../../Player"; -import { Sleeve } from "../Sleeve/Sleeve"; -import { Exploit } from "../../Exploits/Exploit"; - -import { LocationName } from "../../Enums"; -import { Corporation } from "../../Corporation/Corporation"; -import { Gang } from "../../Gang/Gang"; -import { Bladeburner } from "../../Bladeburner/Bladeburner"; -import { HacknetNode } from "../../Hacknet/HacknetNode"; - +import { LocationName } from "@enums"; import { HashManager } from "../../Hacknet/HashManager"; - import { MoneySourceTracker } from "../../utils/MoneySourceTracker"; import { constructorsForReviver, Generic_toJSON, Generic_fromJSON, IReviverValue } from "../../utils/JSONReviver"; import { JSONMap } from "../../Types/Jsonable"; -import { PlayerAchievement } from "../../Achievements/Achievements"; import { cyrb53 } from "../../utils/StringHelperFunctions"; import { getRandomInt } from "../../utils/helpers/getRandomInt"; import { CONSTANTS } from "../../Constants"; -import { Work } from "src/Work/Work"; import { Person } from "../Person"; -import { Player as IPlayer } from "@nsdefs"; export class PlayerObject extends Person implements IPlayer { // Player-specific properties diff --git a/src/PersonObjects/Player/PlayerObjectCorporationMethods.ts b/src/PersonObjects/Player/PlayerObjectCorporationMethods.ts index cd8eabda4..80fce4d98 100644 --- a/src/PersonObjects/Player/PlayerObjectCorporationMethods.ts +++ b/src/PersonObjects/Player/PlayerObjectCorporationMethods.ts @@ -1,4 +1,4 @@ -import { CorpUnlockName } from "../../Corporation/data/Enums"; +import { CorpUnlockName } from "@enums"; import { resetIndustryResearchTrees } from "../../Corporation/data/IndustryData"; import { Corporation } from "../../Corporation/Corporation"; diff --git a/src/PersonObjects/Player/PlayerObjectGeneralMethods.ts b/src/PersonObjects/Player/PlayerObjectGeneralMethods.ts index b2e6790ab..58cc95195 100644 --- a/src/PersonObjects/Player/PlayerObjectGeneralMethods.ts +++ b/src/PersonObjects/Player/PlayerObjectGeneralMethods.ts @@ -1,6 +1,9 @@ +import type { PlayerObject } from "./PlayerObject"; +import type { ProgramFilePath } from "../../Paths/ProgramFilePath"; + import { applyAugmentation } from "../../Augmentation/AugmentationHelpers"; import { PlayerOwnedAugmentation } from "../../Augmentation/PlayerOwnedAugmentation"; -import { AugmentationNames } from "../../Augmentation/data/AugmentationNames"; +import { AugmentationName, CityName, CompletedProgramName, FactionName, LocationName, ToastVariant } from "@enums"; import { BitNodeMultipliers } from "../../BitNode/BitNodeMultipliers"; import { CodingContractRewardType, ICodingContractReward } from "../../CodingContracts"; import { Company } from "../../Company/Company"; @@ -11,14 +14,12 @@ import { CompanyPositions } from "../../Company/CompanyPositions"; import { CompanyPosition } from "../../Company/CompanyPosition"; import * as posNames from "../../Company/data/JobTracks"; import { CONSTANTS } from "../../Constants"; -import { CompletedProgramName } from "../../Programs/Programs"; import { Exploit } from "../../Exploits/Exploit"; import { Faction } from "../../Faction/Faction"; import { Factions } from "../../Faction/Factions"; import { resetGangs } from "../../Gang/AllGangs"; import { Cities } from "../../Locations/Cities"; import { Locations } from "../../Locations/Locations"; -import { CityName, LocationName } from "../../Enums"; import { Sleeve } from "../Sleeve/Sleeve"; import { isSleeveCompanyWork } from "../Sleeve/Work/SleeveCompanyWork"; import { calculateSkillProgress as calculateSkillProgressF, ISkillProgress } from "../formulas/skill"; @@ -37,16 +38,12 @@ import { formatMoney } from "../../ui/formatNumber"; import { MoneySourceTracker } from "../../utils/MoneySourceTracker"; import { dialogBoxCreate } from "../../ui/React/DialogBox"; -import { SnackbarEvents, ToastVariant } from "../../ui/React/Snackbar"; +import { SnackbarEvents } from "../../ui/React/Snackbar"; import { achievements } from "../../Achievements/Achievements"; -import { FactionNames } from "../../Faction/data/FactionNames"; import { isCompanyWork } from "../../Work/CompanyWork"; import { serverMetadata } from "../../Server/data/servers"; -import type { PlayerObject } from "./PlayerObject"; -import { ProgramFilePath } from "src/Paths/ProgramFilePath"; - export function init(this: PlayerObject): void { /* Initialize Player's home computer */ const t_homeComp = safelyCreateUniqueServer({ @@ -560,7 +557,7 @@ export function reapplyAllAugmentations(this: PlayerObject, resetMultipliers = t const playerAug = this.augmentations[i]; const augName = playerAug.name; - if (augName == AugmentationNames.NeuroFluxGovernor) { + if (augName == AugmentationName.NeuroFluxGovernor) { for (let j = 0; j < playerAug.level; ++j) { applyAugmentation(this.augmentations[i], true); } @@ -625,7 +622,7 @@ export function checkForFactionInvitations(this: PlayerObject): Faction[] { } //Illuminati - const illuminatiFac = Factions[FactionNames.Illuminati]; + const illuminatiFac = Factions[FactionName.Illuminati]; if ( !illuminatiFac.isBanned && !illuminatiFac.isMember && @@ -642,7 +639,7 @@ export function checkForFactionInvitations(this: PlayerObject): Faction[] { } //Daedalus - const daedalusFac = Factions[FactionNames.Daedalus]; + const daedalusFac = Factions[FactionName.Daedalus]; if ( !daedalusFac.isBanned && !daedalusFac.isMember && @@ -659,7 +656,7 @@ export function checkForFactionInvitations(this: PlayerObject): Faction[] { } //The Covenant - const covenantFac = Factions[FactionNames.TheCovenant]; + const covenantFac = Factions[FactionName.TheCovenant]; if ( !covenantFac.isBanned && !covenantFac.isMember && @@ -676,7 +673,7 @@ export function checkForFactionInvitations(this: PlayerObject): Faction[] { } //ECorp - const ecorpFac = Factions[FactionNames.ECorp]; + const ecorpFac = Factions[FactionName.ECorp]; if ( !ecorpFac.isBanned && !ecorpFac.isMember && @@ -687,7 +684,7 @@ export function checkForFactionInvitations(this: PlayerObject): Faction[] { } //MegaCorp - const megacorpFac = Factions[FactionNames.MegaCorp]; + const megacorpFac = Factions[FactionName.MegaCorp]; if ( !megacorpFac.isBanned && !megacorpFac.isMember && @@ -698,7 +695,7 @@ export function checkForFactionInvitations(this: PlayerObject): Faction[] { } //Bachman & Associates - const bachmanandassociatesFac = Factions[FactionNames.BachmanAssociates]; + const bachmanandassociatesFac = Factions[FactionName.BachmanAssociates]; if ( !bachmanandassociatesFac.isBanned && !bachmanandassociatesFac.isMember && @@ -709,7 +706,7 @@ export function checkForFactionInvitations(this: PlayerObject): Faction[] { } //Blade Industries - const bladeindustriesFac = Factions[FactionNames.BladeIndustries]; + const bladeindustriesFac = Factions[FactionName.BladeIndustries]; if ( !bladeindustriesFac.isBanned && !bladeindustriesFac.isMember && @@ -720,7 +717,7 @@ export function checkForFactionInvitations(this: PlayerObject): Faction[] { } //NWO - const nwoFac = Factions[FactionNames.NWO]; + const nwoFac = Factions[FactionName.NWO]; if ( !nwoFac.isBanned && !nwoFac.isMember && @@ -731,7 +728,7 @@ export function checkForFactionInvitations(this: PlayerObject): Faction[] { } //Clarke Incorporated - const clarkeincorporatedFac = Factions[FactionNames.ClarkeIncorporated]; + const clarkeincorporatedFac = Factions[FactionName.ClarkeIncorporated]; if ( !clarkeincorporatedFac.isBanned && !clarkeincorporatedFac.isMember && @@ -742,7 +739,7 @@ export function checkForFactionInvitations(this: PlayerObject): Faction[] { } //OmniTek Incorporated - const omnitekincorporatedFac = Factions[FactionNames.OmniTekIncorporated]; + const omnitekincorporatedFac = Factions[FactionName.OmniTekIncorporated]; if ( !omnitekincorporatedFac.isBanned && !omnitekincorporatedFac.isMember && @@ -753,7 +750,7 @@ export function checkForFactionInvitations(this: PlayerObject): Faction[] { } //Four Sigma - const foursigmaFac = Factions[FactionNames.FourSigma]; + const foursigmaFac = Factions[FactionName.FourSigma]; if ( !foursigmaFac.isBanned && !foursigmaFac.isMember && @@ -764,7 +761,7 @@ export function checkForFactionInvitations(this: PlayerObject): Faction[] { } //KuaiGong International - const kuaigonginternationalFac = Factions[FactionNames.KuaiGongInternational]; + const kuaigonginternationalFac = Factions[FactionName.KuaiGongInternational]; if ( !kuaigonginternationalFac.isBanned && !kuaigonginternationalFac.isMember && @@ -775,12 +772,12 @@ export function checkForFactionInvitations(this: PlayerObject): Faction[] { } //Fulcrum Secret Technologies - If you've unlocked fulcrum secret technologies server and have a high rep with the company - const fulcrumsecrettechonologiesFac = Factions[FactionNames.FulcrumSecretTechnologies]; + const fulcrumsecrettechonologiesFac = Factions[FactionName.FulcrumSecretTechnologies]; const fulcrumSecretServer = GetServer(SpecialServers.FulcrumSecretTechnologies); if (!(fulcrumSecretServer instanceof Server)) - throw new Error(`${FactionNames.FulcrumSecretTechnologies} should be normal server`); + throw new Error(`${FactionName.FulcrumSecretTechnologies} should be normal server`); if (fulcrumSecretServer == null) { - console.error(`Could not find ${FactionNames.FulcrumSecretTechnologies} Server`); + console.error(`Could not find ${FactionName.FulcrumSecretTechnologies} Server`); } else if ( !fulcrumsecrettechonologiesFac.isBanned && !fulcrumsecrettechonologiesFac.isMember && @@ -792,11 +789,11 @@ export function checkForFactionInvitations(this: PlayerObject): Faction[] { } //BitRunners - const bitrunnersFac = Factions[FactionNames.BitRunners]; + const bitrunnersFac = Factions[FactionName.BitRunners]; const bitrunnersServer = GetServer(SpecialServers.BitRunnersServer); - if (!(bitrunnersServer instanceof Server)) throw new Error(`${FactionNames.BitRunners} should be normal server`); + if (!(bitrunnersServer instanceof Server)) throw new Error(`${FactionName.BitRunners} should be normal server`); if (bitrunnersServer == null) { - console.error(`Could not find ${FactionNames.BitRunners} Server`); + console.error(`Could not find ${FactionName.BitRunners} Server`); } else if ( !bitrunnersFac.isBanned && !bitrunnersFac.isMember && @@ -808,11 +805,11 @@ export function checkForFactionInvitations(this: PlayerObject): Faction[] { //The Black Hand - const theblackhandFac = Factions[FactionNames.TheBlackHand]; + const theblackhandFac = Factions[FactionName.TheBlackHand]; const blackhandServer = GetServer(SpecialServers.TheBlackHandServer); - if (!(blackhandServer instanceof Server)) throw new Error(`${FactionNames.TheBlackHand} should be normal server`); + if (!(blackhandServer instanceof Server)) throw new Error(`${FactionName.TheBlackHand} should be normal server`); if (blackhandServer == null) { - console.error(`Could not find ${FactionNames.TheBlackHand} Server`); + console.error(`Could not find ${FactionName.TheBlackHand} Server`); } else if ( !theblackhandFac.isBanned && !theblackhandFac.isMember && @@ -823,11 +820,11 @@ export function checkForFactionInvitations(this: PlayerObject): Faction[] { } //NiteSec - const nitesecFac = Factions[FactionNames.NiteSec]; + const nitesecFac = Factions[FactionName.NiteSec]; const nitesecServer = GetServer(SpecialServers.NiteSecServer); - if (!(nitesecServer instanceof Server)) throw new Error(`${FactionNames.NiteSec} should be normal server`); + if (!(nitesecServer instanceof Server)) throw new Error(`${FactionName.NiteSec} should be normal server`); if (nitesecServer == null) { - console.error(`Could not find ${FactionNames.NiteSec} Server`); + console.error(`Could not find ${FactionName.NiteSec} Server`); } else if ( !nitesecFac.isBanned && !nitesecFac.isMember && @@ -838,7 +835,7 @@ export function checkForFactionInvitations(this: PlayerObject): Faction[] { } //Chongqing - const chongqingFac = Factions[FactionNames.Chongqing]; + const chongqingFac = Factions[FactionName.Chongqing]; if ( !chongqingFac.isBanned && !chongqingFac.isMember && @@ -850,7 +847,7 @@ export function checkForFactionInvitations(this: PlayerObject): Faction[] { } //Sector-12 - const sector12Fac = Factions[FactionNames.Sector12]; + const sector12Fac = Factions[FactionName.Sector12]; if ( !sector12Fac.isBanned && !sector12Fac.isMember && @@ -862,7 +859,7 @@ export function checkForFactionInvitations(this: PlayerObject): Faction[] { } //New Tokyo - const newtokyoFac = Factions[FactionNames.NewTokyo]; + const newtokyoFac = Factions[FactionName.NewTokyo]; if ( !newtokyoFac.isBanned && !newtokyoFac.isMember && @@ -874,7 +871,7 @@ export function checkForFactionInvitations(this: PlayerObject): Faction[] { } //Aevum - const aevumFac = Factions[FactionNames.Aevum]; + const aevumFac = Factions[FactionName.Aevum]; if ( !aevumFac.isBanned && !aevumFac.isMember && @@ -886,7 +883,7 @@ export function checkForFactionInvitations(this: PlayerObject): Faction[] { } //Ishima - const ishimaFac = Factions[FactionNames.Ishima]; + const ishimaFac = Factions[FactionName.Ishima]; if ( !ishimaFac.isBanned && !ishimaFac.isMember && @@ -898,7 +895,7 @@ export function checkForFactionInvitations(this: PlayerObject): Faction[] { } //Volhaven - const volhavenFac = Factions[FactionNames.Volhaven]; + const volhavenFac = Factions[FactionName.Volhaven]; if ( !volhavenFac.isBanned && !volhavenFac.isMember && @@ -910,7 +907,7 @@ export function checkForFactionInvitations(this: PlayerObject): Faction[] { } //Speakers for the Dead - const speakersforthedeadFac = Factions[FactionNames.SpeakersForTheDead]; + const speakersforthedeadFac = Factions[FactionName.SpeakersForTheDead]; if ( !speakersforthedeadFac.isBanned && !speakersforthedeadFac.isMember && @@ -929,7 +926,7 @@ export function checkForFactionInvitations(this: PlayerObject): Faction[] { } //The Dark Army - const thedarkarmyFac = Factions[FactionNames.TheDarkArmy]; + const thedarkarmyFac = Factions[FactionName.TheDarkArmy]; if ( !thedarkarmyFac.isBanned && !thedarkarmyFac.isMember && @@ -949,7 +946,7 @@ export function checkForFactionInvitations(this: PlayerObject): Faction[] { } //The Syndicate - const thesyndicateFac = Factions[FactionNames.TheSyndicate]; + const thesyndicateFac = Factions[FactionName.TheSyndicate]; if ( !thesyndicateFac.isBanned && !thesyndicateFac.isMember && @@ -969,7 +966,7 @@ export function checkForFactionInvitations(this: PlayerObject): Faction[] { } //Silhouette - const silhouetteFac = Factions[FactionNames.Silhouette]; + const silhouetteFac = Factions[FactionName.Silhouette]; if ( !silhouetteFac.isBanned && !silhouetteFac.isMember && @@ -984,7 +981,7 @@ export function checkForFactionInvitations(this: PlayerObject): Faction[] { } //Tetrads - const tetradsFac = Factions[FactionNames.Tetrads]; + const tetradsFac = Factions[FactionName.Tetrads]; if ( !tetradsFac.isBanned && !tetradsFac.isMember && @@ -1000,7 +997,7 @@ export function checkForFactionInvitations(this: PlayerObject): Faction[] { } //SlumSnakes - const slumsnakesFac = Factions[FactionNames.SlumSnakes]; + const slumsnakesFac = Factions[FactionName.SlumSnakes]; if ( !slumsnakesFac.isBanned && !slumsnakesFac.isMember && @@ -1016,7 +1013,7 @@ export function checkForFactionInvitations(this: PlayerObject): Faction[] { } //Netburners - const netburnersFac = Factions[FactionNames.Netburners]; + const netburnersFac = Factions[FactionName.Netburners]; let totalHacknetRam = 0; let totalHacknetCores = 0; let totalHacknetLevels = 0; @@ -1048,7 +1045,7 @@ export function checkForFactionInvitations(this: PlayerObject): Faction[] { } //Tian Di Hui - const tiandihuiFac = Factions[FactionNames.TianDiHui]; + const tiandihuiFac = Factions[FactionName.TianDiHui]; if ( !tiandihuiFac.isBanned && !tiandihuiFac.isMember && @@ -1061,11 +1058,11 @@ export function checkForFactionInvitations(this: PlayerObject): Faction[] { } //CyberSec - const cybersecFac = Factions[FactionNames.CyberSec]; + const cybersecFac = Factions[FactionName.CyberSec]; const cybersecServer = GetServer(SpecialServers.CyberSecServer); - if (!(cybersecServer instanceof Server)) throw new Error(`${FactionNames.CyberSec} should be normal server`); + if (!(cybersecServer instanceof Server)) throw new Error(`${FactionName.CyberSec} should be normal server`); if (cybersecServer == null) { - console.error(`Could not find ${FactionNames.CyberSec} Server`); + console.error(`Could not find ${FactionName.CyberSec} Server`); } else if ( !cybersecFac.isBanned && !cybersecFac.isMember && @@ -1126,7 +1123,7 @@ export function gainCodingContractReward( const totalGain = CONSTANTS.CodingContractBaseFactionRepGain * difficulty; // Ignore Bladeburners and other special factions for this calculation - const specialFactions = [FactionNames.Bladeburners as string]; + const specialFactions = [FactionName.Bladeburners as string]; const factions = this.factions.slice().filter((f) => { return !specialFactions.includes(f); }); @@ -1217,7 +1214,7 @@ export function sourceFileLvl(this: PlayerObject, n: number): number { export function focusPenalty(this: PlayerObject): number { let focus = 1; - if (!this.hasAugmentation(AugmentationNames.NeuroreceptorManager, true)) { + if (!this.hasAugmentation(AugmentationName.NeuroreceptorManager, true)) { focus = this.focus ? 1 : CONSTANTS.BaseFocusBonus; } return focus; diff --git a/src/PersonObjects/Sleeve/Sleeve.ts b/src/PersonObjects/Sleeve/Sleeve.ts index 5be9a807d..dfc8ab3fd 100644 --- a/src/PersonObjects/Sleeve/Sleeve.ts +++ b/src/PersonObjects/Sleeve/Sleeve.ts @@ -18,16 +18,14 @@ import { CompanyPosition } from "../../Company/CompanyPosition"; import { CompanyPositions } from "../../Company/CompanyPositions"; import { Contracts } from "../../Bladeburner/data/Contracts"; import { CONSTANTS } from "../../Constants"; -import { CityName, CrimeType, GymType, LocationName, UniversityClassType } from "../../Enums"; +import { ClassType, CityName, CrimeType, FactionWorkType, GymType, LocationName, UniversityClassType } from "@enums"; import { Factions } from "../../Faction/Factions"; import { Generic_fromJSON, Generic_toJSON, IReviverValue, constructorsForReviver } from "../../utils/JSONReviver"; import { formatPercent } from "../../ui/formatNumber"; -import { FactionWorkType } from "../../Enums"; import { SleeveWork } from "./Work/Work"; import { SleeveClassWork } from "./Work/SleeveClassWork"; -import { ClassType } from "../../Work/ClassWork"; import { SleeveSynchroWork } from "./Work/SleeveSynchroWork"; import { SleeveRecoveryWork } from "./Work/SleeveRecoveryWork"; import { SleeveFactionWork } from "./Work/SleeveFactionWork"; diff --git a/src/PersonObjects/Sleeve/SleeveMethods.ts b/src/PersonObjects/Sleeve/SleeveMethods.ts index 3856b5886..e32548681 100644 --- a/src/PersonObjects/Sleeve/SleeveMethods.ts +++ b/src/PersonObjects/Sleeve/SleeveMethods.ts @@ -1,13 +1,10 @@ -import { FactionNames } from "../../Faction/data/FactionNames"; -import { Sleeve } from "./Sleeve"; - import { Player } from "@player"; - +import { AugmentationName, FactionName } from "@enums"; +import { Sleeve } from "./Sleeve"; import { Augmentation } from "../../Augmentation/Augmentation"; import { StaticAugmentations } from "../../Augmentation/StaticAugmentations"; import { Factions } from "../../Faction/Factions"; import { mergeMultipliers, Multipliers } from "../Multipliers"; -import { AugmentationNames } from "../../Augmentation/data/AugmentationNames"; import { getFactionAugmentationsFiltered } from "../../Faction/FactionHelpers"; /** Updates this object's multipliers for the given augmentation */ @@ -74,8 +71,8 @@ export function findPurchasableAugs(this: Sleeve): Augmentation[] { } for (const facName of Player.factions) { - if (facName === FactionNames.Bladeburners) continue; - if (facName === FactionNames.Netburners) continue; + if (facName === FactionName.Bladeburners) continue; + if (facName === FactionName.Netburners) continue; const fac = Factions[facName]; if (!fac) continue; @@ -90,8 +87,8 @@ export function findPurchasableAugs(this: Sleeve): Augmentation[] { } // Add the stanek sleeve aug - if (!ownedAugNames.includes(AugmentationNames.ZOE) && Player.factions.includes(FactionNames.ChurchOfTheMachineGod)) { - const aug = StaticAugmentations[AugmentationNames.ZOE]; + if (!ownedAugNames.includes(AugmentationName.ZOE) && Player.factions.includes(FactionName.ChurchOfTheMachineGod)) { + const aug = StaticAugmentations[AugmentationName.ZOE]; availableAugs.push(aug); } diff --git a/src/PersonObjects/Sleeve/Work/SleeveBladeburnerWork.ts b/src/PersonObjects/Sleeve/Work/SleeveBladeburnerWork.ts index 40c6d2aa6..a2513c501 100644 --- a/src/PersonObjects/Sleeve/Work/SleeveBladeburnerWork.ts +++ b/src/PersonObjects/Sleeve/Work/SleeveBladeburnerWork.ts @@ -1,7 +1,7 @@ import { Player } from "@player"; import { Generic_fromJSON, Generic_toJSON, IReviverValue, constructorsForReviver } from "../../../utils/JSONReviver"; import { Sleeve } from "../Sleeve"; -import { applySleeveGains, Work, WorkType } from "./Work"; +import { applySleeveGains, SleeveWorkClass, SleeveWorkType } from "./Work"; import { CONSTANTS } from "../../../Constants"; import { GeneralActions } from "../../../Bladeburner/data/GeneralActions"; import { scaleWorkStats } from "../../../Work/WorkStats"; @@ -11,11 +11,11 @@ interface SleeveBladeburnerWorkParams { name: string; } -export const isSleeveBladeburnerWork = (w: Work | null): w is SleeveBladeburnerWork => - w !== null && w.type === WorkType.BLADEBURNER; +export const isSleeveBladeburnerWork = (w: SleeveWorkClass | null): w is SleeveBladeburnerWork => + w !== null && w.type === SleeveWorkType.BLADEBURNER; -export class SleeveBladeburnerWork extends Work { - type: WorkType.BLADEBURNER = WorkType.BLADEBURNER; +export class SleeveBladeburnerWork extends SleeveWorkClass { + type: SleeveWorkType.BLADEBURNER = SleeveWorkType.BLADEBURNER; cyclesWorked = 0; actionType: "General" | "Contracts"; actionName: string; @@ -65,7 +65,7 @@ export class SleeveBladeburnerWork extends Work { APICopy(sleeve: Sleeve) { return { - type: WorkType.BLADEBURNER as "BLADEBURNER", + type: SleeveWorkType.BLADEBURNER as "BLADEBURNER", actionType: this.actionType, actionName: this.actionName, cyclesWorked: this.cyclesWorked, diff --git a/src/PersonObjects/Sleeve/Work/SleeveClassWork.ts b/src/PersonObjects/Sleeve/Work/SleeveClassWork.ts index f80921414..273616446 100644 --- a/src/PersonObjects/Sleeve/Work/SleeveClassWork.ts +++ b/src/PersonObjects/Sleeve/Work/SleeveClassWork.ts @@ -1,23 +1,23 @@ +import { ClassType, LocationName, UniversityClassType } from "@enums"; import { Generic_fromJSON, Generic_toJSON, IReviverValue, constructorsForReviver } from "../../../utils/JSONReviver"; -import { applySleeveGains, Work, WorkType } from "./Work"; -import { Classes, ClassType } from "../../../Work/ClassWork"; -import { LocationName } from "../../../Enums"; +import { applySleeveGains, SleeveWorkClass, SleeveWorkType } from "./Work"; +import { Classes } from "../../../Work/ClassWork"; import { calculateClassEarnings } from "../../../Work/Formulas"; import { Sleeve } from "../Sleeve"; import { scaleWorkStats, WorkStats } from "../../../Work/WorkStats"; -import { GymType, UniversityClassType } from "../../../Enums"; -import { checkEnum } from "../../../utils/helpers/enum"; import { Locations } from "../../../Locations/Locations"; +import { isMember } from "../../../utils/EnumHelper"; -export const isSleeveClassWork = (w: Work | null): w is SleeveClassWork => w !== null && w.type === WorkType.CLASS; +export const isSleeveClassWork = (w: SleeveWorkClass | null): w is SleeveClassWork => + w !== null && w.type === SleeveWorkType.CLASS; interface ClassWorkParams { classType: ClassType; location: LocationName; } -export class SleeveClassWork extends Work { - type: WorkType.CLASS = WorkType.CLASS; +export class SleeveClassWork extends SleeveWorkClass { + type: SleeveWorkType.CLASS = SleeveWorkType.CLASS; classType: ClassType; location: LocationName; @@ -32,7 +32,7 @@ export class SleeveClassWork extends Work { } isGym(): boolean { - return checkEnum(GymType, this.classType); + return isMember("GymType", this.classType); } process(sleeve: Sleeve, cycles: number) { @@ -42,7 +42,7 @@ export class SleeveClassWork extends Work { APICopy() { return { - type: WorkType.CLASS as "CLASS", + type: SleeveWorkType.CLASS as "CLASS", classType: this.classType, location: this.location, }; diff --git a/src/PersonObjects/Sleeve/Work/SleeveCompanyWork.ts b/src/PersonObjects/Sleeve/Work/SleeveCompanyWork.ts index ffc3baf79..a568391e9 100644 --- a/src/PersonObjects/Sleeve/Work/SleeveCompanyWork.ts +++ b/src/PersonObjects/Sleeve/Work/SleeveCompanyWork.ts @@ -1,20 +1,20 @@ +import { Player } from "@player"; +import { LocationName } from "@enums"; import { Generic_fromJSON, Generic_toJSON, IReviverValue, constructorsForReviver } from "../../../utils/JSONReviver"; import { Sleeve } from "../Sleeve"; -import { applySleeveGains, Work, WorkType } from "./Work"; -import { LocationName } from "../../../Enums"; +import { applySleeveGains, SleeveWorkClass, SleeveWorkType } from "./Work"; import { Companies } from "../../../Company/Companies"; import { Company } from "../../../Company/Company"; import { calculateCompanyWorkStats } from "../../../Work/Formulas"; import { scaleWorkStats, WorkStats } from "../../../Work/WorkStats"; import { influenceStockThroughCompanyWork } from "../../../StockMarket/PlayerInfluencing"; -import { Player } from "@player"; import { CompanyPositions } from "../../../Company/CompanyPositions"; -export const isSleeveCompanyWork = (w: Work | null): w is SleeveCompanyWork => - w !== null && w.type === WorkType.COMPANY; +export const isSleeveCompanyWork = (w: SleeveWorkClass | null): w is SleeveCompanyWork => + w !== null && w.type === SleeveWorkType.COMPANY; -export class SleeveCompanyWork extends Work { - type: WorkType.COMPANY = WorkType.COMPANY; +export class SleeveCompanyWork extends SleeveWorkClass { + type: SleeveWorkType.COMPANY = SleeveWorkType.COMPANY; companyName: string; constructor(companyName?: string) { @@ -47,7 +47,7 @@ export class SleeveCompanyWork extends Work { APICopy() { return { - type: WorkType.COMPANY as "COMPANY", + type: SleeveWorkType.COMPANY as "COMPANY", companyName: this.companyName, }; } diff --git a/src/PersonObjects/Sleeve/Work/SleeveCrimeWork.ts b/src/PersonObjects/Sleeve/Work/SleeveCrimeWork.ts index 2713a19f3..08db4b33d 100644 --- a/src/PersonObjects/Sleeve/Work/SleeveCrimeWork.ts +++ b/src/PersonObjects/Sleeve/Work/SleeveCrimeWork.ts @@ -1,20 +1,20 @@ import { Player } from "@player"; import { Generic_fromJSON, Generic_toJSON, IReviverValue, constructorsForReviver } from "../../../utils/JSONReviver"; import { Sleeve } from "../Sleeve"; -import { applySleeveGains, Work, WorkType } from "./Work"; -import { CrimeType } from "../../../Enums"; +import { applySleeveGains, SleeveWorkClass, SleeveWorkType } from "./Work"; +import { CrimeType } from "@enums"; import { Crimes } from "../../../Crime/Crimes"; import { Crime } from "../../../Crime/Crime"; import { scaleWorkStats, WorkStats } from "../../../Work/WorkStats"; import { CONSTANTS } from "../../../Constants"; -import { checkEnum } from "../../../utils/helpers/enum"; import { calculateCrimeWorkStats } from "../../../Work/Formulas"; import { findCrime } from "../../../Crime/CrimeHelpers"; -export const isSleeveCrimeWork = (w: Work | null): w is SleeveCrimeWork => w !== null && w.type === WorkType.CRIME; +export const isSleeveCrimeWork = (w: SleeveWorkClass | null): w is SleeveCrimeWork => + w !== null && w.type === SleeveWorkType.CRIME; -export class SleeveCrimeWork extends Work { - type: WorkType.CRIME = WorkType.CRIME; +export class SleeveCrimeWork extends SleeveWorkClass { + type: SleeveWorkType.CRIME = SleeveWorkType.CRIME; crimeType: CrimeType; cyclesWorked = 0; constructor(crimeType?: CrimeType) { @@ -23,7 +23,6 @@ export class SleeveCrimeWork extends Work { } getCrime(): Crime { - if (!checkEnum(CrimeType, this.crimeType)) throw new Error("crime should not be undefined"); return Crimes[this.crimeType]; } @@ -52,7 +51,7 @@ export class SleeveCrimeWork extends Work { APICopy() { return { - type: WorkType.CRIME as "CRIME", + type: SleeveWorkType.CRIME as "CRIME", crimeType: this.crimeType, cyclesWorked: this.cyclesWorked, cyclesNeeded: this.cyclesNeeded(), diff --git a/src/PersonObjects/Sleeve/Work/SleeveFactionWork.ts b/src/PersonObjects/Sleeve/Work/SleeveFactionWork.ts index b82b5a6dc..ea0a1ac7d 100644 --- a/src/PersonObjects/Sleeve/Work/SleeveFactionWork.ts +++ b/src/PersonObjects/Sleeve/Work/SleeveFactionWork.ts @@ -1,9 +1,8 @@ import { Player } from "@player"; import { Generic_fromJSON, Generic_toJSON, IReviverValue, constructorsForReviver } from "../../../utils/JSONReviver"; import { Sleeve } from "../Sleeve"; -import { applySleeveGains, Work, WorkType } from "./Work"; -import { FactionWorkType } from "../../../Enums"; -import { FactionNames } from "../../../Faction/data/FactionNames"; +import { applySleeveGains, SleeveWorkClass, SleeveWorkType } from "./Work"; +import { FactionName, FactionWorkType } from "@enums"; import { Factions } from "../../../Faction/Factions"; import { calculateFactionExp, calculateFactionRep } from "../../../Work/Formulas"; import { Faction } from "../../../Faction/Faction"; @@ -15,18 +14,18 @@ interface SleeveFactionWorkParams { factionName: string; } -export const isSleeveFactionWork = (w: Work | null): w is SleeveFactionWork => - w !== null && w.type === WorkType.FACTION; +export const isSleeveFactionWork = (w: SleeveWorkClass | null): w is SleeveFactionWork => + w !== null && w.type === SleeveWorkType.FACTION; -export class SleeveFactionWork extends Work { - type: WorkType.FACTION = WorkType.FACTION; +export class SleeveFactionWork extends SleeveWorkClass { + type: SleeveWorkType.FACTION = SleeveWorkType.FACTION; factionWorkType: FactionWorkType; factionName: string; constructor(params?: SleeveFactionWorkParams) { super(); this.factionWorkType = params?.factionWorkType ?? FactionWorkType.hacking; - this.factionName = params?.factionName ?? FactionNames.Sector12; + this.factionName = params?.factionName ?? FactionName.Sector12; } getExpRates(sleeve: Sleeve): WorkStats { @@ -54,7 +53,7 @@ export class SleeveFactionWork extends Work { APICopy() { return { - type: WorkType.FACTION as "FACTION", + type: SleeveWorkType.FACTION as "FACTION", factionWorkType: this.factionWorkType, factionName: this.factionName, }; diff --git a/src/PersonObjects/Sleeve/Work/SleeveInfiltrateWork.ts b/src/PersonObjects/Sleeve/Work/SleeveInfiltrateWork.ts index 474fadcf6..dbf6ef8f8 100644 --- a/src/PersonObjects/Sleeve/Work/SleeveInfiltrateWork.ts +++ b/src/PersonObjects/Sleeve/Work/SleeveInfiltrateWork.ts @@ -1,16 +1,16 @@ import { Player } from "@player"; import { Generic_fromJSON, Generic_toJSON, IReviverValue, constructorsForReviver } from "../../../utils/JSONReviver"; import { Sleeve } from "../Sleeve"; -import { Work, WorkType } from "./Work"; +import { SleeveWorkClass, SleeveWorkType } from "./Work"; import { CONSTANTS } from "../../../Constants"; const infiltrateCycles = 60000 / CONSTANTS.MilliPerCycle; -export const isSleeveInfiltrateWork = (w: Work | null): w is SleeveInfiltrateWork => - w !== null && w.type === WorkType.INFILTRATE; +export const isSleeveInfiltrateWork = (w: SleeveWorkClass | null): w is SleeveInfiltrateWork => + w !== null && w.type === SleeveWorkType.INFILTRATE; -export class SleeveInfiltrateWork extends Work { - type: WorkType.INFILTRATE = WorkType.INFILTRATE; +export class SleeveInfiltrateWork extends SleeveWorkClass { + type: SleeveWorkType.INFILTRATE = SleeveWorkType.INFILTRATE; cyclesWorked = 0; cyclesNeeded(): number { @@ -28,7 +28,7 @@ export class SleeveInfiltrateWork extends Work { APICopy() { return { - type: WorkType.INFILTRATE as "INFILTRATE", + type: SleeveWorkType.INFILTRATE as "INFILTRATE", cyclesWorked: this.cyclesWorked, cyclesNeeded: this.cyclesNeeded(), }; diff --git a/src/PersonObjects/Sleeve/Work/SleeveRecoveryWork.ts b/src/PersonObjects/Sleeve/Work/SleeveRecoveryWork.ts index 3065a4bff..717d4006b 100644 --- a/src/PersonObjects/Sleeve/Work/SleeveRecoveryWork.ts +++ b/src/PersonObjects/Sleeve/Work/SleeveRecoveryWork.ts @@ -1,13 +1,13 @@ import { Generic_fromJSON, Generic_toJSON, IReviverValue, constructorsForReviver } from "../../../utils/JSONReviver"; import { Sleeve } from "../Sleeve"; -import { Work, WorkType } from "./Work"; +import { SleeveWorkClass, SleeveWorkType } from "./Work"; import { calculateIntelligenceBonus } from "../../formulas/intelligence"; -export const isSleeveRecoveryWork = (w: Work | null): w is SleeveRecoveryWork => - w !== null && w.type === WorkType.RECOVERY; +export const isSleeveRecoveryWork = (w: SleeveWorkClass | null): w is SleeveRecoveryWork => + w !== null && w.type === SleeveWorkType.RECOVERY; -export class SleeveRecoveryWork extends Work { - type: WorkType.RECOVERY = WorkType.RECOVERY; +export class SleeveRecoveryWork extends SleeveWorkClass { + type: SleeveWorkType.RECOVERY = SleeveWorkType.RECOVERY; process(sleeve: Sleeve, cycles: number) { sleeve.shock = Math.max( @@ -18,7 +18,7 @@ export class SleeveRecoveryWork extends Work { } APICopy() { - return { type: WorkType.RECOVERY as "RECOVERY" }; + return { type: SleeveWorkType.RECOVERY as "RECOVERY" }; } /** Serialize the current object to a JSON save state. */ diff --git a/src/PersonObjects/Sleeve/Work/SleeveSupportWork.ts b/src/PersonObjects/Sleeve/Work/SleeveSupportWork.ts index 0310e62f1..d20f363e5 100644 --- a/src/PersonObjects/Sleeve/Work/SleeveSupportWork.ts +++ b/src/PersonObjects/Sleeve/Work/SleeveSupportWork.ts @@ -1,12 +1,12 @@ import { Player } from "@player"; import { Generic_fromJSON, Generic_toJSON, IReviverValue, constructorsForReviver } from "../../../utils/JSONReviver"; -import { Work, WorkType } from "./Work"; +import { SleeveWorkClass, SleeveWorkType } from "./Work"; -export const isSleeveSupportWork = (w: Work | null): w is SleeveSupportWork => - w !== null && w.type === WorkType.SUPPORT; +export const isSleeveSupportWork = (w: SleeveWorkClass | null): w is SleeveSupportWork => + w !== null && w.type === SleeveWorkType.SUPPORT; -export class SleeveSupportWork extends Work { - type: WorkType.SUPPORT = WorkType.SUPPORT; +export class SleeveSupportWork extends SleeveWorkClass { + type: SleeveWorkType.SUPPORT = SleeveWorkType.SUPPORT; constructor() { super(); Player.bladeburner?.sleeveSupport(true); @@ -21,7 +21,7 @@ export class SleeveSupportWork extends Work { } APICopy() { - return { type: WorkType.SUPPORT as "SUPPORT" }; + return { type: SleeveWorkType.SUPPORT as "SUPPORT" }; } /** Serialize the current object to a JSON save state. */ diff --git a/src/PersonObjects/Sleeve/Work/SleeveSynchroWork.ts b/src/PersonObjects/Sleeve/Work/SleeveSynchroWork.ts index 0c9cab0a2..7543137b1 100644 --- a/src/PersonObjects/Sleeve/Work/SleeveSynchroWork.ts +++ b/src/PersonObjects/Sleeve/Work/SleeveSynchroWork.ts @@ -1,14 +1,14 @@ import { Player } from "@player"; import { Generic_fromJSON, Generic_toJSON, IReviverValue, constructorsForReviver } from "../../../utils/JSONReviver"; import { Sleeve } from "../Sleeve"; -import { Work, WorkType } from "./Work"; +import { SleeveWorkClass, SleeveWorkType } from "./Work"; import { calculateIntelligenceBonus } from "../../formulas/intelligence"; -export const isSleeveSynchroWork = (w: Work | null): w is SleeveSynchroWork => - w !== null && w.type === WorkType.SYNCHRO; +export const isSleeveSynchroWork = (w: SleeveWorkClass | null): w is SleeveSynchroWork => + w !== null && w.type === SleeveWorkType.SYNCHRO; -export class SleeveSynchroWork extends Work { - type: WorkType.SYNCHRO = WorkType.SYNCHRO; +export class SleeveSynchroWork extends SleeveWorkClass { + type: SleeveWorkType.SYNCHRO = SleeveWorkType.SYNCHRO; process(sleeve: Sleeve, cycles: number) { sleeve.sync = Math.min( @@ -19,7 +19,7 @@ export class SleeveSynchroWork extends Work { } APICopy() { - return { type: WorkType.SYNCHRO as "SYNCHRO" }; + return { type: SleeveWorkType.SYNCHRO as "SYNCHRO" }; } /** Serialize the current object to a JSON save state. */ diff --git a/src/PersonObjects/Sleeve/Work/Work.ts b/src/PersonObjects/Sleeve/Work/Work.ts index 677550158..4c7777a2e 100644 --- a/src/PersonObjects/Sleeve/Work/Work.ts +++ b/src/PersonObjects/Sleeve/Work/Work.ts @@ -23,8 +23,8 @@ export const applySleeveGains = (sleeve: Sleeve, shockedStats: WorkStats, mult = Player.sleeves.forEach((s) => s !== sleeve && applyWorkStatsExp(s, shockedStats, mult * sync * s.shockBonus())); }; -export abstract class Work { - abstract type: WorkType; +export abstract class SleeveWorkClass { + abstract type: SleeveWorkType; abstract process(sleeve: Sleeve, cycles: number): void; abstract APICopy(sleeve: Sleeve): SleeveTask; abstract toJSON(): IReviverValue; @@ -33,7 +33,7 @@ export abstract class Work { } } -export enum WorkType { +export enum SleeveWorkType { COMPANY = "COMPANY", FACTION = "FACTION", CRIME = "CRIME", diff --git a/src/PersonObjects/Sleeve/ui/CovenantPurchasesRoot.tsx b/src/PersonObjects/Sleeve/ui/CovenantPurchasesRoot.tsx index 3bde0955c..aa4b7881d 100644 --- a/src/PersonObjects/Sleeve/ui/CovenantPurchasesRoot.tsx +++ b/src/PersonObjects/Sleeve/ui/CovenantPurchasesRoot.tsx @@ -16,7 +16,7 @@ import { Player } from "@player"; import { dialogBoxCreate } from "../../../ui/React/DialogBox"; import Typography from "@mui/material/Typography"; import Button from "@mui/material/Button"; -import { FactionNames } from "../../../Faction/data/FactionNames"; +import { FactionName } from "@enums"; import { useRerender } from "../../../ui/React/hooks"; interface IProps { @@ -68,7 +68,7 @@ export function CovenantPurchasesRoot(props: IProps): React.ReactElement { <> Purchase an additional Sleeves. These Duplicate Sleeves are permanent (they persist through BitNodes). You - can purchase a total of {MaxSleevesFromCovenant} from {FactionNames.TheCovenant}. + can purchase a total of {MaxSleevesFromCovenant} from {FactionName.TheCovenant}.