mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-05-01 05:17:04 +02:00
MISC: Added features to DevMenu (#353)
* More blade devmenu functions * Custom money field, set money to 0 option * Options for removing blade/gang/corp * Better dev menu responsiveness (dev menu rerenders after adding or removing blade/gang/corp) * Some general code style changes
This commit is contained in:
@@ -1,54 +1,52 @@
|
||||
import React from "react";
|
||||
|
||||
import Typography from "@mui/material/Typography";
|
||||
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 Button from "@mui/material/Button";
|
||||
import { Adjuster } from "./Adjuster";
|
||||
import { Player } from "@player";
|
||||
import { CityName } from "../../Enums";
|
||||
|
||||
const bigNumber = 1e27;
|
||||
|
||||
export function Bladeburner(): React.ReactElement {
|
||||
if (!Player.bladeburner) return <></>;
|
||||
const bladeburner = Player.bladeburner;
|
||||
if (bladeburner === null) return <></>;
|
||||
function modifyBladeburnerRank(modify: number): (x: number) => void {
|
||||
return function (rank: number): void {
|
||||
if (!bladeburner) return;
|
||||
bladeburner.changeRank(Player, rank * modify);
|
||||
};
|
||||
}
|
||||
|
||||
function resetBladeburnerRank(): void {
|
||||
if (!bladeburner) return;
|
||||
// Rank functions
|
||||
const modifyBladeburnerRank = (modify: number) => (rank: number) => bladeburner.changeRank(Player, rank * modify);
|
||||
const resetBladeburnerRank = () => {
|
||||
bladeburner.rank = 0;
|
||||
bladeburner.maxRank = 0;
|
||||
}
|
||||
};
|
||||
const addTonsBladeburnerRank = () => bladeburner.changeRank(Player, bigNumber);
|
||||
|
||||
function addTonsBladeburnerRank(): void {
|
||||
if (!bladeburner) return;
|
||||
// Skill point functions
|
||||
const modifyBladeburnerSP = (modify: number) => (skillPoints: number) => {
|
||||
bladeburner.skillPoints += skillPoints * modify;
|
||||
};
|
||||
const resetBladeburnerSP = () => {
|
||||
bladeburner.skillPoints = 0;
|
||||
bladeburner.totalSkillPoints = 0;
|
||||
};
|
||||
const addTonsBladeburnerSP = () => (bladeburner.skillPoints = bigNumber);
|
||||
|
||||
bladeburner.changeRank(Player, bigNumber);
|
||||
}
|
||||
// Cycles functions
|
||||
const modifyBladeburnerCycles = (modify: number) => (cycles: number) => (bladeburner.storedCycles += cycles * modify);
|
||||
const resetBladeburnerCycles = () => (bladeburner.storedCycles = 0);
|
||||
const addTonsBladeburnerCycles = () => (bladeburner.storedCycles += bigNumber);
|
||||
|
||||
function modifyBladeburnerCycles(modify: number): (x: number) => void {
|
||||
return function (cycles: number): void {
|
||||
if (!bladeburner) return;
|
||||
bladeburner.storedCycles += cycles * modify;
|
||||
};
|
||||
}
|
||||
|
||||
function resetBladeburnerCycles(): void {
|
||||
if (!bladeburner) return;
|
||||
bladeburner.storedCycles = 0;
|
||||
}
|
||||
|
||||
function addTonsBladeburnerCycles(): void {
|
||||
if (!bladeburner) return;
|
||||
bladeburner.storedCycles += bigNumber;
|
||||
}
|
||||
// Chaos functions
|
||||
const wipeAllChaos = () => Object.values(CityName).forEach((city) => (bladeburner.cities[city].chaos = 0));
|
||||
const wipeActiveCityChaos = () => (bladeburner.cities[bladeburner.city].chaos = 0);
|
||||
const addAllChaos = (modify: number) => (chaos: number) => {
|
||||
Object.values(CityName).forEach((city) => (bladeburner.cities[city].chaos += chaos * modify));
|
||||
};
|
||||
const addTonsAllChaos = () => {
|
||||
Object.values(CityName).forEach((city) => (bladeburner.cities[city].chaos += bigNumber));
|
||||
};
|
||||
|
||||
return (
|
||||
<Accordion TransitionProps={{ unmountOnExit: true }}>
|
||||
@@ -75,7 +73,22 @@ export function Bladeburner(): React.ReactElement {
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<Typography>Cycles:</Typography>
|
||||
<Typography>SP:</Typography>
|
||||
</td>
|
||||
<td>
|
||||
<Adjuster
|
||||
label="skill points"
|
||||
placeholder="amt"
|
||||
tons={addTonsBladeburnerSP}
|
||||
add={modifyBladeburnerSP(1)}
|
||||
subtract={modifyBladeburnerSP(-1)}
|
||||
reset={resetBladeburnerSP}
|
||||
/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<Typography>Cycles: </Typography>
|
||||
</td>
|
||||
<td>
|
||||
<Adjuster
|
||||
@@ -88,9 +101,25 @@ export function Bladeburner(): React.ReactElement {
|
||||
/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<Typography title="This is for ALL cities">Chaos:</Typography>
|
||||
</td>
|
||||
<td>
|
||||
<Adjuster
|
||||
label="chaos in all cities"
|
||||
placeholder="amt"
|
||||
tons={addTonsAllChaos}
|
||||
add={addAllChaos(1)}
|
||||
subtract={addAllChaos(-1)}
|
||||
reset={wipeAllChaos}
|
||||
/>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</AccordionDetails>
|
||||
<Button onClick={wipeActiveCityChaos}>Clear Active City's Chaos</Button>
|
||||
</Accordion>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user