/**
* 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/modals/CreateCorporationModal";
import { LocationName } from "../data/LocationNames";
import { AugmentationNames } from "../../Augmentation/data/AugmentationNames";
import { Factions } from "../../Faction/Factions";
import { joinFaction } from "../../Faction/FactionHelpers";
import { use } from "../../ui/Context";
import { dialogBoxCreate } from "../../ui/React/DialogBox";
import { SnackbarEvents, ToastVariant } from "../../ui/React/Snackbar";
import { N00dles } from "../../utils/helpers/N00dles";
import { Exploit } from "../../Exploits/Exploit";
import { applyAugmentation } from "../../Augmentation/AugmentationHelpers";
import { CorruptableText } from "../../ui/React/CorruptableText";
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";
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 if (
p.skills.strength >= 100 &&
p.skills.defense >= 100 &&
p.skills.dexterity >= 100 &&
p.skills.agility >= 100
) {
// Apply for Bladeburner division
p.startBladeburner();
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 handleGrafting(): void {
router.toGrafting();
}
function renderBladeburner(): React.ReactElement {
if (!player.canAccessBladeburner() || BitNodeMultipliers.BladeburnerRank === 0) {
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", ToastVariant.SUCCESS, 2000);
N00dles(); // This is the true power of the noodles.
if (player.sourceFiles.length > 0) player.giveExploit(Exploit.N00dles);
if (player.sourceFileLvl(5) > 0 || player.bitNodeN === 5) {
player.exp.intelligence *= 1.0000000000000002;
}
player.exp.hacking *= 1.0000000000000002;
player.exp.strength *= 1.0000000000000002;
player.exp.defense *= 1.0000000000000002;
player.exp.agility *= 1.0000000000000002;
player.exp.dexterity *= 1.0000000000000002;
player.exp.charisma *= 1.0000000000000002;
for (const node of player.hacknetNodes) {
if (node instanceof HacknetNode) {
player.gainMoney(node.moneyGainRatePerSecond * 0.001, "other");
} else {
const server = GetServer(node);
if (!(server instanceof HacknetServer)) throw new Error(`Server ${node} is not a hacknet server.`);
player.hashManager.storeHashes(server.hashRate * 0.001);
}
}
if (player.bladeburner) {
player.bladeburner.rank += 0.00001;
}
if (player.corporation) {
player.corporation.funds += player.corporation.revenue * 0.01;
}
}
return (
<>
>
);
}
function CreateCorporation(): React.ReactElement {
const [open, setOpen] = useState(false);
if (!player.canAccessCorporation()) {
return (
<>
A businessman is yelling at a clerk. You should come back later.
>
);
}
return (
<>
setOpen(false)} />
>
);
}
function renderGrafting(): React.ReactElement {
if (!player.canAccessGrafting()) {
return <>>;
}
return (
);
}
function handleCotMG(): void {
const faction = Factions[FactionNames.ChurchOfTheMachineGod];
if (!player.factions.includes(FactionNames.ChurchOfTheMachineGod)) {
joinFaction(faction);
}
if (
!player.augmentations.some((a) => a.name === AugmentationNames.StaneksGift1) &&
!player.queuedAugmentations.some((a) => a.name === AugmentationNames.StaneksGift1)
) {
applyAugmentation({ name: AugmentationNames.StaneksGift1, level: 1 });
}
router.toStaneksGift();
}
function renderCotMG(): React.ReactElement {
const toStanek = ;
// 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- "}
{" `..` "}
if (player.hasAugmentation(AugmentationNames.StaneksGift3, true)) {
return (
<>
Allison "Mother" Stanek: ..can ...you hear them too ...? Come now, don't be shy and let me get a closer
look at you. Yes wonderful, I see my creation has taken root without consquence or much ill effect it
seems. Curious, Just how much of a machine's soul do you house in that body?
{toStanek}
{symbol}
>
);
}
if (player.hasAugmentation(AugmentationNames.StaneksGift2, true)) {
return (
<>
Allison "Mother" Stanek: I see you've taken to my creation. So much that it could hardly be recognized as
one of my own after your tinkering with it. I see you follow the ways of the Machine God as I do, and your
mastery of the gift clearly demonstrates that. My hopes are climbing by the day for you.
{toStanek}
{symbol}
>
);
}
if (player.factions.includes(FactionNames.ChurchOfTheMachineGod)) {
return (
<>
Allison "Mother" Stanek: Welcome back my child!
{toStanek}
{symbol}
>
);
}
if (!player.canAccessCotMG()) {
return (
<>
A decrepit altar stands in the middle of a dilapidated church.
A symbol is carved in the altar.
{symbol}
>
);
}
if (
player.augmentations.filter((a) => a.name !== AugmentationNames.NeuroFluxGovernor).length > 0 ||
player.queuedAugmentations.filter((a) => a.name !== AugmentationNames.NeuroFluxGovernor).length > 0
) {
return (
<>
Allison "Mother" Stanek: Begone you filth! My gift must be the first modification that your body should
have!
>
);
}
return (
<>
Allison "Mother" Stanek: Welcome child, I see your body is pure. Are you ready to ascend beyond our human
form? If you are, accept my gift.
{symbol}
>
);
}
function renderGlitch(): React.ReactElement {
return (
<>
>
);
}
switch (props.loc.name) {
case LocationName.NewTokyoVitaLife: {
return renderGrafting();
}
case LocationName.Sector12CityHall: {
return (BitNodeMultipliers.CorporationSoftcap < 0.15 && <>>) || ;
}
case LocationName.Sector12NSA: {
return renderBladeburner();
}
case LocationName.NewTokyoNoodleBar: {
return renderNoodleBar();
}
case LocationName.ChongqingChurchOfTheMachineGod: {
return renderCotMG();
}
case LocationName.IshimaGlitch: {
return renderGlitch();
}
case LocationName.NewTokyoArcade: {
return ;
}
default:
console.error(`Location ${props.loc.name} doesn't have any special properties`);
return <>>;
}
}