bitburner-src/src/DevMenu/ui/General.tsx

88 lines
2.4 KiB
TypeScript
Raw Normal View History

2021-09-14 02:37:35 +02:00
import React from "react";
2021-09-17 01:23:03 +02:00
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";
2021-09-14 02:37:35 +02:00
2021-10-01 22:22:33 +02:00
import Typography from "@mui/material/Typography";
2021-09-17 01:23:03 +02:00
import Button from "@mui/material/Button";
2021-09-14 02:37:35 +02:00
import { Money } from "../../ui/React/Money";
import { IPlayer } from "../../PersonObjects/IPlayer";
2021-09-18 01:43:08 +02:00
import { IRouter } from "../../ui/Router";
2021-09-14 02:37:35 +02:00
interface IProps {
player: IPlayer;
2021-09-18 01:43:08 +02:00
router: IRouter;
2021-09-14 02:37:35 +02:00
}
export function General(props: IProps): React.ReactElement {
function addMoney(n: number) {
return function () {
props.player.gainMoney(n);
};
}
function upgradeRam(): void {
props.player.getHomeComputer().maxRam *= 2;
}
function quickB1tFlum3(): void {
2021-09-18 01:43:08 +02:00
props.router.toBitVerse(true, true);
2021-09-14 02:37:35 +02:00
}
function b1tflum3(): void {
2021-09-18 01:43:08 +02:00
props.router.toBitVerse(true, false);
2021-09-14 02:37:35 +02:00
}
function quickHackW0r1dD43m0n(): void {
2021-09-18 01:43:08 +02:00
props.router.toBitVerse(false, true);
2021-09-14 02:37:35 +02:00
}
function hackW0r1dD43m0n(): void {
2021-09-18 01:43:08 +02:00
props.router.toBitVerse(false, false);
2021-09-14 02:37:35 +02:00
}
return (
2021-09-18 03:30:02 +02:00
<Accordion TransitionProps={{ unmountOnExit: true }}>
2021-09-14 02:37:35 +02:00
<AccordionSummary expandIcon={<ExpandMoreIcon />}>
2021-10-01 22:22:33 +02:00
<Typography>General</Typography>
2021-09-14 02:37:35 +02:00
</AccordionSummary>
<AccordionDetails>
2021-10-01 19:08:37 +02:00
<Button onClick={addMoney(1e6)}>
<pre>
+ <Money money={1e6} />
</pre>
</Button>
<Button onClick={addMoney(1e9)}>
<pre>
+ <Money money={1e9} />
</pre>
</Button>
<Button onClick={addMoney(1e12)}>
<pre>
+ <Money money={1e12} />
</pre>
</Button>
<Button onClick={addMoney(1e15)}>
<pre>
+ <Money money={1000e12} />
</pre>
</Button>
<Button onClick={addMoney(Infinity)}>
<pre>
+ <Money money={Infinity} />
</pre>
</Button>
<Button onClick={upgradeRam}>+ RAM</Button>
<br />
<Button onClick={quickB1tFlum3}>Quick b1t_flum3.exe</Button>
<Button onClick={b1tflum3}>Run b1t_flum3.exe</Button>
<Button onClick={quickHackW0r1dD43m0n}>Quick w0rld_d34m0n</Button>
<Button onClick={hackW0r1dD43m0n}>Hack w0rld_d34m0n</Button>
2021-09-14 02:37:35 +02:00
</AccordionDetails>
</Accordion>
);
}