From 9af553f63cb1380795550648b0134b608564fab8 Mon Sep 17 00:00:00 2001 From: Olivier Gagnon Date: Thu, 19 May 2022 02:09:00 -0400 Subject: [PATCH] Fix --- src/Locations/LocationsHelpers.tsx | 19 +++++-------- src/Locations/ui/RamButton.tsx | 2 +- .../Player/PlayerObjectServerMethods.ts | 2 +- src/SaveObject.tsx | 27 ++++++++++++++++++- src/Server/data/servers.ts | 8 ++++++ 5 files changed, 43 insertions(+), 15 deletions(-) diff --git a/src/Locations/LocationsHelpers.tsx b/src/Locations/LocationsHelpers.tsx index ec94239ea..85d197ff1 100644 --- a/src/Locations/LocationsHelpers.tsx +++ b/src/Locations/LocationsHelpers.tsx @@ -2,11 +2,11 @@ * Location and traveling-related helper functions. * Mostly used for UI */ +import { SpecialServers } from "../Server/data/SpecialServers"; import { CONSTANTS } from "../Constants"; import { IPlayer } from "../PersonObjects/IPlayer"; -import { AddToAllServers, createUniqueRandomIp } from "../Server/AllServers"; -import { safetlyCreateUniqueServer } from "../Server/ServerHelpers"; +import { GetServer } from "../Server/AllServers"; import { dialogBoxCreate } from "../ui/React/DialogBox"; @@ -25,19 +25,14 @@ export function purchaseTorRouter(p: IPlayer): void { } p.loseMoney(CONSTANTS.TorRouterCost, "other"); - const darkweb = safetlyCreateUniqueServer({ - ip: createUniqueRandomIp(), - hostname: "darkweb", - organizationName: "", - isConnectedTo: false, - adminRights: false, - purchasedByPlayer: false, - maxRam: 1, - }); - AddToAllServers(darkweb); + const darkweb = GetServer(SpecialServers.DarkWeb); + if (!darkweb) { + throw new Error("Dark web is not a server."); + } p.getHomeComputer().serversOnNetwork.push(darkweb.hostname); darkweb.serversOnNetwork.push(p.getHomeComputer().hostname); + console.log(darkweb); dialogBoxCreate( "You have purchased a TOR router!
" + "You now have access to the dark web from your home computer.
" + diff --git a/src/Locations/ui/RamButton.tsx b/src/Locations/ui/RamButton.tsx index aa1433d87..29fd6a187 100644 --- a/src/Locations/ui/RamButton.tsx +++ b/src/Locations/ui/RamButton.tsx @@ -32,7 +32,7 @@ export function RamButton(props: IProps): React.ReactElement { } const bnMult = BitNodeMultipliers.HomeComputerRamCost === 1 ? "" : `\\cdot ${BitNodeMultipliers.HomeComputerRamCost}`; - console.log(BitNodeMultipliers.HomeComputerRamCost); + return (