import React, { useEffect, useState } from "react"; import Accordion from "@mui/material/Accordion"; import AccordionSummary from "@mui/material/AccordionSummary"; import AccordionDetails from "@mui/material/AccordionDetails"; import ExpandMoreIcon from "@mui/icons-material/ExpandMore"; import Typography from "@mui/material/Typography"; import Button from "@mui/material/Button"; import { Money } from "../../ui/React/Money"; import { Player } from "@player"; import { Router } from "../../ui/GameRoot"; import { MenuItem, SelectChangeEvent, TextField, Select } from "@mui/material"; import { Bladeburner } from "../../Bladeburner/Bladeburner"; import { GangConstants } from "../../Gang/data/Constants"; import { FactionNames } from "../../Faction/data/FactionNames"; import { checkForMessagesToSend } from "../../Message/MessageHelpers"; import { ThemeEvents } from "../../Themes/ui/Theme"; export function General(): React.ReactElement { const [error, setError] = useState(false); const [corporationName, setCorporationName] = useState(""); const [gangFaction, setGangFaction] = useState("Slum Snakes"); const [devMoney, setDevMoney] = useState(0); // Money functions const addCustomMoney = () => !Number.isNaN(devMoney) && Player.gainMoney(devMoney, "other"); const addMoney = (n: number) => () => Player.gainMoney(n, "other"); const setMoney = (n: number) => () => (Player.money = Number(n)); // Ram functions const upgradeRam = () => (Player.getHomeComputer().maxRam *= 2); // Node-clearing functions const quickB1tFlum3 = () => Router.toBitVerse(true, true); const b1tflum3 = () => Router.toBitVerse(true, false); const quickHackW0r1dD43m0n = () => Router.toBitVerse(false, true); const hackW0r1dD43m0n = () => Router.toBitVerse(false, false); // Corp functions const createCorporation = () => { Player.startCorporation(corporationName, false); // Rerender so the corp menu option will show up immediately on the devmenu page selection ThemeEvents.emit(); }; const destroyCorporation = () => { Player.corporation = null; // Rerender so the corp menu option will be removed immediately on the devmenu page selection ThemeEvents.emit(); }; // Blade functions const joinBladeburner = () => { Player.bladeburner = new Bladeburner(); // Rerender so the blade menu option will show up immediately on the devmenu page selection ThemeEvents.emit(); }; const leaveBladeburner = () => { Player.bladeburner = null; // Rerender so the blade menu option will be removed immediately on the devmenu page selection ThemeEvents.emit(); }; // Gang functions const startGang = () => { const isHacking = gangFaction === FactionNames.NiteSec || gangFaction === FactionNames.TheBlackHand; Player.startGang(gangFaction, isHacking); // Rerender so the gang menu option will show up immediately on the devmenu page selection ThemeEvents.emit(); }; const stopGang = () => { Player.gang = null; // Rerender so the gang menu option will be removed immediately on the devmenu page selection ThemeEvents.emit(); }; const setGangFactionDropdown = (event: SelectChangeEvent) => setGangFaction(event.target.value); // Misc functions const checkMessages = () => checkForMessagesToSend(); useEffect(() => { if (error) throw new ReferenceError("Manually thrown error"); }, [error]); return ( }> General
Add Custom Money setDevMoney(parseFloat(x.target.value))} />
{Player.corporation ? ( ) : ( <> Corporation Name: setCorporationName(x.target.value)} /> )}
{Player.gang ? ( ) : ( <> Gang Faction: )}
{Player.bladeburner ? ( ) : ( )}
); }