Fix use-before-defined import issue

This commit is contained in:
Snarling 2022-09-13 13:15:36 -04:00
parent 91a69d7d8f
commit 1ac57d2e48
5 changed files with 33 additions and 29 deletions

@ -5,7 +5,7 @@ import { uniqueId } from "lodash";
import React from "react"; import React from "react";
import { SpecialServers } from "../../Server/data/SpecialServers"; import { SpecialServers } from "../../Server/data/SpecialServers";
import { Settings } from "../../Settings/Settings"; import { Settings } from "../../Settings/Settings";
import { Player } from "../../ui/Player"; import { Player } from "../../Player";
import { StatsRow } from "../../ui/React/StatsRow"; import { StatsRow } from "../../ui/React/StatsRow";
import { defaultMultipliers, getBitNodeMultipliers } from "../BitNode"; import { defaultMultipliers, getBitNodeMultipliers } from "../BitNode";
import { IBitNodeMultipliers } from "../BitNodeMultipliers"; import { IBitNodeMultipliers } from "../BitNodeMultipliers";

@ -2,19 +2,22 @@ import { DarkWebItem } from "./DarkWebItem";
import { IMap } from "../types"; import { IMap } from "../types";
import { Programs } from "../Programs/Programs"; import { Programs } from "../Programs/Programs";
export const DarkWebItems: IMap<DarkWebItem> = { export const DarkWebItems: IMap<DarkWebItem> = {};
BruteSSHProgram: new DarkWebItem(Programs.BruteSSHProgram.name, 500e3, "Opens up SSH Ports."), export function initDarkWebItems() {
FTPCrackProgram: new DarkWebItem(Programs.FTPCrackProgram.name, 1500e3, "Opens up FTP Ports."), Object.assign(DarkWebItems, {
RelaySMTPProgram: new DarkWebItem(Programs.RelaySMTPProgram.name, 5e6, "Opens up SMTP Ports."), BruteSSHProgram: new DarkWebItem(Programs.BruteSSHProgram.name, 500e3, "Opens up SSH Ports."),
HTTPWormProgram: new DarkWebItem(Programs.HTTPWormProgram.name, 30e6, "Opens up HTTP Ports."), FTPCrackProgram: new DarkWebItem(Programs.FTPCrackProgram.name, 1500e3, "Opens up FTP Ports."),
SQLInjectProgram: new DarkWebItem(Programs.SQLInjectProgram.name, 250e6, "Opens up SQL Ports."), RelaySMTPProgram: new DarkWebItem(Programs.RelaySMTPProgram.name, 5e6, "Opens up SMTP Ports."),
ServerProfiler: new DarkWebItem( HTTPWormProgram: new DarkWebItem(Programs.HTTPWormProgram.name, 30e6, "Opens up HTTP Ports."),
Programs.ServerProfiler.name, SQLInjectProgram: new DarkWebItem(Programs.SQLInjectProgram.name, 250e6, "Opens up SQL Ports."),
500000, ServerProfiler: new DarkWebItem(
"Displays detailed information about a server.", Programs.ServerProfiler.name,
), 500000,
DeepscanV1: new DarkWebItem(Programs.DeepscanV1.name, 500000, "Enables 'scan-analyze' with a depth up to 5."), "Displays detailed information about a server.",
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'."), DeepscanV1: new DarkWebItem(Programs.DeepscanV1.name, 500000, "Enables 'scan-analyze' with a depth up to 5."),
FormulasProgram: new DarkWebItem(Programs.Formulas.name, 5e9, "Unlock access to the formulas API."), 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."),
});
}

@ -44,39 +44,39 @@ export function GenericLocation({ loc }: IProps): React.ReactElement {
const content: React.ReactNode[] = []; const content: React.ReactNode[] = [];
if (loc.types.includes(LocationType.Company)) { if (loc.types.includes(LocationType.Company)) {
content.push(<CompanyLocation key={"companylocation"} locName={loc.name} />); content.push(<CompanyLocation locName={loc.name} />);
} }
if (loc.types.includes(LocationType.Gym)) { if (loc.types.includes(LocationType.Gym)) {
content.push(<GymLocation key={"gymlocation"} loc={loc} />); content.push(<GymLocation loc={loc} />);
} }
if (loc.types.includes(LocationType.Hospital)) { if (loc.types.includes(LocationType.Hospital)) {
content.push(<HospitalLocation key={"hospitallocation"} />); content.push(<HospitalLocation />);
} }
if (loc.types.includes(LocationType.Slums)) { if (loc.types.includes(LocationType.Slums)) {
content.push(<SlumsLocation key={"slumslocation"} />); content.push(<SlumsLocation />);
} }
if (loc.types.includes(LocationType.Special)) { if (loc.types.includes(LocationType.Special)) {
content.push(<SpecialLocation key={"speciallocation"} loc={loc} />); content.push(<SpecialLocation loc={loc} />);
} }
if (loc.types.includes(LocationType.TechVendor)) { if (loc.types.includes(LocationType.TechVendor)) {
content.push(<TechVendorLocation key={"techvendorlocation"} loc={loc} />); content.push(<TechVendorLocation loc={loc} />);
} }
if (loc.types.includes(LocationType.TravelAgency)) { if (loc.types.includes(LocationType.TravelAgency)) {
content.push(<TravelAgencyRoot key={"travelagencylocation"} />); content.push(<TravelAgencyRoot />);
} }
if (loc.types.includes(LocationType.University)) { if (loc.types.includes(LocationType.University)) {
content.push(<UniversityLocation key={"universitylocation"} loc={loc} />); content.push(<UniversityLocation loc={loc} />);
} }
if (loc.types.includes(LocationType.Casino)) { if (loc.types.includes(LocationType.Casino)) {
content.push(<CasinoLocation key={"casinoLocation"} />); content.push(<CasinoLocation />);
} }
return content; return content;

@ -17,6 +17,7 @@ type IState = {
currHp: number; currHp: number;
}; };
//Todo: Make this a functional component
export class HospitalLocation extends React.Component<Record<string, never>, IState> { export class HospitalLocation extends React.Component<Record<string, never>, IState> {
/** /**
* Stores button styling that sets them all to block display * Stores button styling that sets them all to block display
@ -26,9 +27,6 @@ export class HospitalLocation extends React.Component<Record<string, never>, ISt
constructor() { constructor() {
super({}); super({});
this.getCost = this.getCost.bind(this);
this.getHealed = this.getHealed.bind(this);
this.state = { this.state = {
currHp: Player.hp.current, currHp: Player.hp.current,
}; };

@ -5,6 +5,7 @@ import { convertTimeMsToTimeElapsedString } from "./utils/StringHelperFunctions"
import { initAugmentations } from "./Augmentation/AugmentationHelpers"; import { initAugmentations } from "./Augmentation/AugmentationHelpers";
import { AugmentationNames } from "./Augmentation/data/AugmentationNames"; import { AugmentationNames } from "./Augmentation/data/AugmentationNames";
import { initBitNodeMultipliers } from "./BitNode/BitNode"; import { initBitNodeMultipliers } from "./BitNode/BitNode";
import { initDarkWebItems } from "./DarkWeb/DarkWebItems";
import { Bladeburner } from "./Bladeburner/Bladeburner"; import { Bladeburner } from "./Bladeburner/Bladeburner";
import { generateRandomContract } from "./CodingContractGenerator"; import { generateRandomContract } from "./CodingContractGenerator";
import { initCompanies } from "./Company/Companies"; import { initCompanies } from "./Company/Companies";
@ -241,6 +242,7 @@ const Engine: {
ThemeEvents.emit(); ThemeEvents.emit();
initBitNodeMultipliers(); initBitNodeMultipliers();
initDarkWebItems();
initAugmentations(); // Also calls Player.reapplyAllAugmentations() initAugmentations(); // Also calls Player.reapplyAllAugmentations()
Player.reapplyAllSourceFiles(); Player.reapplyAllSourceFiles();
if (Player.hasWseAccount) { if (Player.hasWseAccount) {
@ -398,6 +400,7 @@ const Engine: {
initForeignServers(Player.getHomeComputer()); initForeignServers(Player.getHomeComputer());
initCompanies(); initCompanies();
initFactions(); initFactions();
initDarkWebItems();
initAugmentations(); initAugmentations();
// Start interactive tutorial // Start interactive tutorial