/** * React Subcomponent for displaying a location's UI, when that location has special * actions/options/properties * * Examples: * - Bladeburner @ NSA * - Re-sleeving @ VitaLife * - Create Corporation @ City Hall * * This subcomponent creates all of the buttons for interacting with those special * properties */ import React, { useState } from "react"; import Typography from "@mui/material/Typography"; import Button from "@mui/material/Button"; import { Location } from "../Location"; import { CreateCorporationModal } from "../../Corporation/ui/CreateCorporationModal"; import { LocationName } from "../data/LocationNames"; import { use } from "../../ui/Context"; import { dialogBoxCreate } from "../../ui/React/DialogBox"; import { SnackbarEvents } from "../../ui/React/Snackbar"; type IProps = { loc: Location; }; export function SpecialLocation(props: IProps): React.ReactElement { const player = use.Player(); const router = use.Router(); const setRerender = useState(false)[1]; const inBladeburner = player.inBladeburner(); /** * Click handler for Bladeburner button at Sector-12 NSA */ function handleBladeburner(): void { const p = player; if (p.inBladeburner()) { // Enter Bladeburner division router.toBladeburner(); } else { // Apply for Bladeburner division if (p.strength >= 100 && p.defense >= 100 && p.dexterity >= 100 && p.agility >= 100) { p.startBladeburner({ new: true }); dialogBoxCreate("You have been accepted into the Bladeburner division!"); setRerender((old) => !old); const worldHeader = document.getElementById("world-menu-header"); if (worldHeader instanceof HTMLElement) { worldHeader.click(); worldHeader.click(); } } else { dialogBoxCreate("Rejected! Please apply again when you have 100 of each combat stat (str, def, dex, agi)"); } } } /** * Click handler for Resleeving button at New Tokyo VitaLife */ function handleResleeving(): void { router.toResleeves(); } function renderBladeburner(): React.ReactElement { if (!player.canAccessBladeburner()) { return <>; } const text = inBladeburner ? "Enter Bladeburner Headquarters" : "Apply to Bladeburner Division"; return ; } function renderNoodleBar(): React.ReactElement { function EatNoodles(): void { SnackbarEvents.emit("You ate some delicious noodles and feel refreshed", "success"); } return ; } function CreateCorporation(): React.ReactElement { const [open, setOpen] = useState(false); if (!player.canAccessCorporation()) { return ( <> A business man is yelling at a clerk. You should come back later. ); } return ( <> setOpen(false)} /> ); } function renderResleeving(): React.ReactElement { if (!player.canAccessResleeving()) { return <>; } return ; } function renderCotMG(): React.ReactElement { // prettier-ignore const symbol = {" `` "}
{" -odmmNmds: "}
{" `hNmo:..-omNh. "}
{" yMd` `hNh "}
{" mMd oNm "}
{" oMNo .mM/ "}
{" `dMN+ -mM+ "}
{" -mMNo -mN+ "}
{" .+- :mMNo/mN/ "}
{":yNMd. :NMNNN/ "}
{"-mMMMh. /NMMh` "}
{" .dMMMd. /NMMMy` "}
{" `yMMMd. /NNyNMMh` "}
{" `sMMMd. +Nm: +NMMh. "}
{" oMMMm- oNm: /NMMd. "}
{" +NMMmsMm- :mMMd. "}
{" /NMMMm- -mMMd. "}
{" /MMMm- -mMMd. "}
{" `sMNMMm- .mMmo "}
{" `sMd:hMMm. ./. "}
{" `yMy` `yNMd` "}
{" `hMs` oMMy "}
{" `hMh sMN- "}
{" /MM- .NMo "}
{" +MM: :MM+ "}
{" sNNo-.`.-omNy` "}
{" -smNNNNmdo- "}
{" `..` "}
return ( <> A decrepit altar stands in the middle of a dilapidated church.

A symbol is carved in the altar.

{symbol} ); } switch (props.loc.name) { case LocationName.NewTokyoVitaLife: { return renderResleeving(); } case LocationName.Sector12CityHall: { return ; } case LocationName.Sector12NSA: { return renderBladeburner(); } case LocationName.NewTokyoNoodleBar: { return renderNoodleBar(); } case LocationName.ChongqingChurchOfTheMachineGod: { return renderCotMG(); } default: console.error(`Location ${props.loc.name} doesn't have any special properties`); return <>; } }