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

64 lines
1.6 KiB
TypeScript
Raw Normal View History

2021-09-14 02:37:35 +02:00
import React from "react";
2021-10-01 02:06:40 +02:00
import Typography from "@mui/material/Typography";
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
import { Adjuster } from "./Adjuster";
import { Player } from "@player";
2021-09-14 02:37:35 +02:00
const bigNumber = 1e27;
export function GangDev(): React.ReactElement {
2021-09-14 02:37:35 +02:00
function addTonsGangCycles(): void {
2022-09-06 15:07:12 +02:00
if (Player.gang) {
Player.gang.storedCycles = bigNumber;
2021-09-14 02:37:35 +02:00
}
}
function modifyGangCycles(modify: number): (x: number) => void {
return function (cycles: number): void {
2022-09-06 15:07:12 +02:00
if (Player.gang) {
Player.gang.storedCycles += cycles * modify;
2021-09-14 02:37:35 +02:00
}
};
}
function resetGangCycles(): void {
2022-09-06 15:07:12 +02:00
if (Player.gang) {
Player.gang.storedCycles = 0;
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>Gang</Typography>
2021-09-14 02:37:35 +02:00
</AccordionSummary>
<AccordionDetails>
<table>
<tbody>
<tr>
<td>
2021-10-01 02:06:40 +02:00
<Typography>Cycles:</Typography>
2021-09-14 02:37:35 +02:00
</td>
<td>
<Adjuster
label="cycles"
placeholder="amt"
tons={addTonsGangCycles}
add={modifyGangCycles(1)}
subtract={modifyGangCycles(-1)}
reset={resetGangCycles}
/>
</td>
</tr>
</tbody>
</table>
</AccordionDetails>
</Accordion>
);
}