From 4723984bf8873712f48a17a58e8ffda678083944 Mon Sep 17 00:00:00 2001 From: Zelow79 <32428876+Zelow79@users.noreply.github.com> Date: Wed, 15 Mar 2023 21:41:18 -0400 Subject: [PATCH] MISC: More Bladeburner Dev menu options (#414) --- src/DevMenu/ui/Bladeburner.tsx | 295 ++++++++++++++++++++++++++++++++- 1 file changed, 287 insertions(+), 8 deletions(-) diff --git a/src/DevMenu/ui/Bladeburner.tsx b/src/DevMenu/ui/Bladeburner.tsx index 670db10aa..5e5d09efe 100644 --- a/src/DevMenu/ui/Bladeburner.tsx +++ b/src/DevMenu/ui/Bladeburner.tsx @@ -1,13 +1,23 @@ -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 React, { useState } from "react"; +import { + Tooltip, + Typography, + IconButton, + InputLabel, + MenuItem, + FormControl, + Accordion, + AccordionSummary, + AccordionDetails, +} from "@mui/material"; import ExpandMoreIcon from "@mui/icons-material/ExpandMore"; -import Button from "@mui/material/Button"; +import Select, { SelectChangeEvent } from "@mui/material/Select"; +import DeleteIcon from "@mui/icons-material/Delete"; import { Adjuster } from "./Adjuster"; import { Player } from "@player"; import { CityName } from "../../Enums"; +import { Skills as AllSkills } from "../../Bladeburner/Skills"; +import { SkillNames } from "../../Bladeburner/data/SkillNames"; const bigNumber = 1e27; @@ -48,6 +58,100 @@ export function Bladeburner(): React.ReactElement { Object.values(CityName).forEach((city) => (bladeburner.cities[city].chaos += bigNumber)); }; + // Skill functions + const [skill, setSkill] = useState(SkillNames.BladesIntuition as string); + function setSkillDropdown(event: SelectChangeEvent): void { + setSkill(event.target.value); + } + const modifySkill = (modifier: number) => (levelchange: number) => { + if (bladeburner.skills[AllSkills[skill].name] == null) resetSkill(); + if (!isNaN(levelchange)) { + bladeburner.skills[AllSkills[skill].name] += levelchange * modifier; + bladeburner.updateSkillMultipliers(); + } + }; + const addTonsOfSkill = () => { + if (bladeburner.skills[AllSkills[skill].name] == null) resetSkill(); + bladeburner.skills[AllSkills[skill].name] += bigNumber; + bladeburner.updateSkillMultipliers(); + }; + const resetSkill = () => { + bladeburner.skills[AllSkills[skill].name] = 0; + bladeburner.updateSkillMultipliers(); + }; + + // Contract functions + const AllContracts = bladeburner.contracts; + const [contractTarget, setContract] = useState(AllContracts.Tracking.name as string); + function setContractDropdown(event: SelectChangeEvent): void { + setContract(event.target.value); + } + const modifyContractLevel = (modifier: number) => (levelchange: number) => { + if (!isNaN(levelchange)) { + bladeburner.contracts[AllContracts[contractTarget].name].level += levelchange * modifier; + const level = bladeburner.contracts[AllContracts[contractTarget].name].level; + bladeburner.contracts[AllContracts[contractTarget].name].maxLevel = level; + } + }; + const modifyContractCount = (modifier: number) => (countchange: number) => { + if (!isNaN(countchange)) bladeburner.contracts[AllContracts[contractTarget].name].count += countchange * modifier; + }; + const modifyContractSuccesses = (modifier: number) => (successeschange: number) => { + if (!isNaN(successeschange)) + bladeburner.contracts[AllContracts[contractTarget].name].successes += successeschange * modifier; + }; + const addTonsOfContractLevel = () => { + bladeburner.contracts[AllContracts[contractTarget].name].level += bigNumber; + const level = bladeburner.contracts[AllContracts[contractTarget].name].level; + bladeburner.contracts[AllContracts[contractTarget].name].maxLevel = level; + }; + const addTonsOfContractCount = () => (bladeburner.contracts[AllContracts[contractTarget].name].count += bigNumber); + const addTonsOfContractSuccesses = () => + (bladeburner.contracts[AllContracts[contractTarget].name].successes += bigNumber); + const resetContractLevel = () => { + bladeburner.contracts[AllContracts[contractTarget].name].level = 1; + bladeburner.contracts[AllContracts[contractTarget].name].maxLevel = 1; + }; + const resetContractCount = () => (bladeburner.contracts[AllContracts[contractTarget].name].count = 0); + const resetContractSuccesses = () => (bladeburner.contracts[AllContracts[contractTarget].name].successes = 0); + + // Operation functions + const AllOperations = bladeburner.operations; + const [operationTarget, setOperation] = useState(AllOperations.Investigation.name as string); + function setOperationDropdown(event: SelectChangeEvent): void { + setOperation(event.target.value); + } + const modifyOperationLevel = (modifier: number) => (levelchange: number) => { + if (!isNaN(levelchange)) { + bladeburner.operations[AllOperations[operationTarget].name].level += levelchange * modifier; + const level = bladeburner.operations[AllOperations[operationTarget].name].level; + bladeburner.operations[AllOperations[operationTarget].name].maxLevel = level; + } + }; + const modifyOperationCount = (modifier: number) => (countchange: number) => { + if (!isNaN(countchange)) + bladeburner.operations[AllOperations[operationTarget].name].count += countchange * modifier; + }; + const modifyOperationSuccesses = (modifier: number) => (successeschange: number) => { + if (!isNaN(successeschange)) + bladeburner.operations[AllOperations[operationTarget].name].successes += successeschange * modifier; + }; + const addTonsOfOperationLevel = () => { + bladeburner.operations[AllOperations[operationTarget].name].level += bigNumber; + const level = bladeburner.operations[AllOperations[operationTarget].name].level; + bladeburner.operations[AllOperations[operationTarget].name].maxLevel = level; + }; + const addTonsOfOperationCount = () => + (bladeburner.operations[AllOperations[operationTarget].name].count += bigNumber); + const addTonsOfOperationSuccesses = () => + (bladeburner.operations[AllOperations[operationTarget].name].successes += bigNumber); + const resetOperationLevel = () => { + bladeburner.operations[AllOperations[operationTarget].name].level = 1; + bladeburner.operations[AllOperations[operationTarget].name].maxLevel = 1; + }; + const resetOperationCount = () => (bladeburner.operations[AllOperations[operationTarget].name].count = 0); + const resetOperationSuccesses = () => (bladeburner.operations[AllOperations[operationTarget].name].successes = 0); + return ( }> @@ -103,7 +207,7 @@ export function Bladeburner(): React.ReactElement { - Chaos: + Chaos: + + + + + + + + + Skills: + + + + + + + + + + + Level: + + + + + + + + Contracts: + + + + + + + + + + + Level: + + + + + + + + Successes: + + + + + + + + Count: + + + + + + + + Operations: + + + + + + + + + + + Level: + + + + + + + + Successes: + + + + + + + + Count: + + + + - ); }