From 1ac57d2e486f574b5b9f798d1c0d542d9acf8c63 Mon Sep 17 00:00:00 2001 From: Snarling <84951833+Snarling@users.noreply.github.com> Date: Tue, 13 Sep 2022 13:15:36 -0400 Subject: [PATCH] Fix use-before-defined import issue --- .../ui/BitnodeMultipliersDescription.tsx | 2 +- src/DarkWeb/DarkWebItems.ts | 35 ++++++++++--------- src/Locations/ui/GenericLocation.tsx | 18 +++++----- src/Locations/ui/HospitalLocation.tsx | 4 +-- src/engine.tsx | 3 ++ 5 files changed, 33 insertions(+), 29 deletions(-) diff --git a/src/BitNode/ui/BitnodeMultipliersDescription.tsx b/src/BitNode/ui/BitnodeMultipliersDescription.tsx index 21225d995..c42dc1a2a 100644 --- a/src/BitNode/ui/BitnodeMultipliersDescription.tsx +++ b/src/BitNode/ui/BitnodeMultipliersDescription.tsx @@ -5,7 +5,7 @@ import { uniqueId } from "lodash"; import React from "react"; import { SpecialServers } from "../../Server/data/SpecialServers"; import { Settings } from "../../Settings/Settings"; -import { Player } from "../../ui/Player"; +import { Player } from "../../Player"; import { StatsRow } from "../../ui/React/StatsRow"; import { defaultMultipliers, getBitNodeMultipliers } from "../BitNode"; import { IBitNodeMultipliers } from "../BitNodeMultipliers"; diff --git a/src/DarkWeb/DarkWebItems.ts b/src/DarkWeb/DarkWebItems.ts index ff9161f9e..c6515d032 100644 --- a/src/DarkWeb/DarkWebItems.ts +++ b/src/DarkWeb/DarkWebItems.ts @@ -2,19 +2,22 @@ import { DarkWebItem } from "./DarkWebItem"; import { IMap } from "../types"; import { Programs } from "../Programs/Programs"; -export const DarkWebItems: IMap = { - BruteSSHProgram: new DarkWebItem(Programs.BruteSSHProgram.name, 500e3, "Opens up SSH Ports."), - FTPCrackProgram: new DarkWebItem(Programs.FTPCrackProgram.name, 1500e3, "Opens up FTP Ports."), - RelaySMTPProgram: new DarkWebItem(Programs.RelaySMTPProgram.name, 5e6, "Opens up SMTP Ports."), - HTTPWormProgram: new DarkWebItem(Programs.HTTPWormProgram.name, 30e6, "Opens up HTTP Ports."), - SQLInjectProgram: new DarkWebItem(Programs.SQLInjectProgram.name, 250e6, "Opens up SQL Ports."), - ServerProfiler: new DarkWebItem( - Programs.ServerProfiler.name, - 500000, - "Displays detailed information about a server.", - ), - DeepscanV1: new DarkWebItem(Programs.DeepscanV1.name, 500000, "Enables 'scan-analyze' with a depth up to 5."), - DeepscanV2: new DarkWebItem(Programs.DeepscanV2.name, 25e6, "Enables 'scan-analyze' with a depth up to 10."), - AutolinkProgram: new DarkWebItem(Programs.AutoLink.name, 1e6, "Enables direct connect via 'scan-analyze'."), - FormulasProgram: new DarkWebItem(Programs.Formulas.name, 5e9, "Unlock access to the formulas API."), -}; +export const DarkWebItems: IMap = {}; +export function initDarkWebItems() { + Object.assign(DarkWebItems, { + BruteSSHProgram: new DarkWebItem(Programs.BruteSSHProgram.name, 500e3, "Opens up SSH Ports."), + FTPCrackProgram: new DarkWebItem(Programs.FTPCrackProgram.name, 1500e3, "Opens up FTP Ports."), + RelaySMTPProgram: new DarkWebItem(Programs.RelaySMTPProgram.name, 5e6, "Opens up SMTP Ports."), + HTTPWormProgram: new DarkWebItem(Programs.HTTPWormProgram.name, 30e6, "Opens up HTTP Ports."), + SQLInjectProgram: new DarkWebItem(Programs.SQLInjectProgram.name, 250e6, "Opens up SQL Ports."), + ServerProfiler: new DarkWebItem( + Programs.ServerProfiler.name, + 500000, + "Displays detailed information about a server.", + ), + DeepscanV1: new DarkWebItem(Programs.DeepscanV1.name, 500000, "Enables 'scan-analyze' with a depth up to 5."), + DeepscanV2: new DarkWebItem(Programs.DeepscanV2.name, 25e6, "Enables 'scan-analyze' with a depth up to 10."), + AutolinkProgram: new DarkWebItem(Programs.AutoLink.name, 1e6, "Enables direct connect via 'scan-analyze'."), + FormulasProgram: new DarkWebItem(Programs.Formulas.name, 5e9, "Unlock access to the formulas API."), + }); +} diff --git a/src/Locations/ui/GenericLocation.tsx b/src/Locations/ui/GenericLocation.tsx index 956dda058..97455a1e3 100644 --- a/src/Locations/ui/GenericLocation.tsx +++ b/src/Locations/ui/GenericLocation.tsx @@ -44,39 +44,39 @@ export function GenericLocation({ loc }: IProps): React.ReactElement { const content: React.ReactNode[] = []; if (loc.types.includes(LocationType.Company)) { - content.push(); + content.push(); } if (loc.types.includes(LocationType.Gym)) { - content.push(); + content.push(); } if (loc.types.includes(LocationType.Hospital)) { - content.push(); + content.push(); } if (loc.types.includes(LocationType.Slums)) { - content.push(); + content.push(); } if (loc.types.includes(LocationType.Special)) { - content.push(); + content.push(); } if (loc.types.includes(LocationType.TechVendor)) { - content.push(); + content.push(); } if (loc.types.includes(LocationType.TravelAgency)) { - content.push(); + content.push(); } if (loc.types.includes(LocationType.University)) { - content.push(); + content.push(); } if (loc.types.includes(LocationType.Casino)) { - content.push(); + content.push(); } return content; diff --git a/src/Locations/ui/HospitalLocation.tsx b/src/Locations/ui/HospitalLocation.tsx index 9467120f8..1268f621a 100644 --- a/src/Locations/ui/HospitalLocation.tsx +++ b/src/Locations/ui/HospitalLocation.tsx @@ -17,6 +17,7 @@ type IState = { currHp: number; }; +//Todo: Make this a functional component export class HospitalLocation extends React.Component, IState> { /** * Stores button styling that sets them all to block display @@ -26,9 +27,6 @@ export class HospitalLocation extends React.Component, ISt constructor() { super({}); - this.getCost = this.getCost.bind(this); - this.getHealed = this.getHealed.bind(this); - this.state = { currHp: Player.hp.current, }; diff --git a/src/engine.tsx b/src/engine.tsx index 03ceac12d..d12e408cf 100644 --- a/src/engine.tsx +++ b/src/engine.tsx @@ -5,6 +5,7 @@ import { convertTimeMsToTimeElapsedString } from "./utils/StringHelperFunctions" import { initAugmentations } from "./Augmentation/AugmentationHelpers"; import { AugmentationNames } from "./Augmentation/data/AugmentationNames"; import { initBitNodeMultipliers } from "./BitNode/BitNode"; +import { initDarkWebItems } from "./DarkWeb/DarkWebItems"; import { Bladeburner } from "./Bladeburner/Bladeburner"; import { generateRandomContract } from "./CodingContractGenerator"; import { initCompanies } from "./Company/Companies"; @@ -241,6 +242,7 @@ const Engine: { ThemeEvents.emit(); initBitNodeMultipliers(); + initDarkWebItems(); initAugmentations(); // Also calls Player.reapplyAllAugmentations() Player.reapplyAllSourceFiles(); if (Player.hasWseAccount) { @@ -398,6 +400,7 @@ const Engine: { initForeignServers(Player.getHomeComputer()); initCompanies(); initFactions(); + initDarkWebItems(); initAugmentations(); // Start interactive tutorial