From ed8e1537d626383e909df73544d637c11942e5cf Mon Sep 17 00:00:00 2001 From: nickofolas Date: Thu, 7 Apr 2022 11:31:06 -0500 Subject: [PATCH 01/26] Initial overhaul work --- src/ui/CharacterStats.tsx | 642 +++++++++++++++++++------------------- src/ui/React/StatsRow.tsx | 4 +- 2 files changed, 324 insertions(+), 322 deletions(-) diff --git a/src/ui/CharacterStats.tsx b/src/ui/CharacterStats.tsx index 0ee401d47..f1b387d34 100644 --- a/src/ui/CharacterStats.tsx +++ b/src/ui/CharacterStats.tsx @@ -1,42 +1,23 @@ -import React, { useState, useEffect } from "react"; - -import { numeralWrapper } from "./numeralFormat"; -import { convertTimeMsToTimeElapsedString } from "../utils/StringHelperFunctions"; -import { BitNodeMultipliers } from "../BitNode/BitNodeMultipliers"; -import { SourceFileFlags } from "../SourceFile/SourceFileFlags"; -import { getPurchaseServerLimit } from "../Server/ServerPurchases"; -import { HacknetServerConstants } from "../Hacknet/data/Constants"; -import { StatsTable } from "./React/StatsTable"; -import { Money } from "./React/Money"; -import { use } from "./Context"; -import { MoneySourceTracker } from "../utils/MoneySourceTracker"; -import { BitNodes } from "../BitNode/BitNode"; - -import Typography from "@mui/material/Typography"; +import MoreHorizIcon from "@mui/icons-material/MoreHoriz"; +import { Paper, Table, TableBody } from "@mui/material"; import Box from "@mui/material/Box"; import IconButton from "@mui/material/IconButton"; -import MoreHorizIcon from "@mui/icons-material/MoreHoriz"; +import Typography from "@mui/material/Typography"; +import React, { useEffect, useState } from "react"; +import { BitNodes } from "../BitNode/BitNode"; +import { BitNodeMultipliers } from "../BitNode/BitNodeMultipliers"; +import { HacknetServerConstants } from "../Hacknet/data/Constants"; +import { getPurchaseServerLimit } from "../Server/ServerPurchases"; +import { Settings } from "../Settings/Settings"; +import { SourceFileFlags } from "../SourceFile/SourceFileFlags"; +import { MoneySourceTracker } from "../utils/MoneySourceTracker"; +import { convertTimeMsToTimeElapsedString } from "../utils/StringHelperFunctions"; +import { use } from "./Context"; +import { numeralWrapper } from "./numeralFormat"; import { Modal } from "./React/Modal"; - -import TableBody from "@mui/material/TableBody"; -import { Table, TableCell } from "./React/Table"; -import TableRow from "@mui/material/TableRow"; - -function LastEmployer(): React.ReactElement { - const player = use.Player(); - if (player.companyName) { - return Employer at which you last worked: {player.companyName}; - } - return <>; -} - -function LastJob(): React.ReactElement { - const player = use.Player(); - if (player.companyName !== "") { - return Job you last worked: {player.jobs[player.companyName]}; - } - return <>; -} +import { Money } from "./React/Money"; +import { StatsRow } from "./React/StatsRow"; +import { StatsTable } from "./React/StatsTable"; function Employers(): React.ReactElement { const player = use.Player(); @@ -55,75 +36,43 @@ function Employers(): React.ReactElement { return <>; } -function Hacknet(): React.ReactElement { - const player = use.Player(); - // Can't import HacknetHelpers for some reason. - if (!(player.bitNodeN === 9 || SourceFileFlags[9] > 0)) { - return ( - <> - {`Hacknet Nodes owned: ${player.hacknetNodes.length}`} -
- - ); - } else { - return ( - <> - {`Hacknet Servers owned: ${player.hacknetNodes.length} / ${HacknetServerConstants.MaxServers}`} -
- - ); - } +interface MultTableProps { + rows: (string | number)[][]; + color: string; } -function Intelligence(): React.ReactElement { - const player = use.Player(); - if (player.intelligence > 0 && (player.bitNodeN === 5 || SourceFileFlags[5] > 0)) { - return ( - - - Intelligence:  - - - {numeralWrapper.formatSkill(player.intelligence)}  - - - ({numeralWrapper.formatExp(player.intelligence_exp)} exp) - - - ); - } - return <>; -} - -function MultiplierTable(props: any): React.ReactElement { - function bn5Stat(r: any): JSX.Element { - if (SourceFileFlags[5] > 0 && r.length > 2 && r[1] != r[2]) { - return ( - - ({numeralWrapper.formatPercentage(r[2])}) - - ); - } - return <>; - } +function MultiplierTable(props: MultTableProps): React.ReactElement { return ( - <> - - - {props.rows.map((r: any) => ( - - - {`${r[0]} multiplier:`}  - - - {numeralWrapper.formatPercentage(r[1])} - - {bn5Stat(r)} - - ))} - -
- + + + {props.rows.map((data) => { + const mult = data[0] as string, + value = data[1] as number, + modded = data[2] as number | null; + + if (modded && modded !== value && SourceFileFlags[5] > 0) { + return ( + + <> + + {numeralWrapper.formatPercentage(value)}{" "} + {numeralWrapper.formatPercentage(modded)} + + + + ); + } + return ( + + ); + })} + +
); } @@ -138,6 +87,7 @@ function BladeburnerMults(): React.ReactElement { ["Bladeburner Stamina Gain", player.bladeburner_stamina_gain_mult], ["Bladeburner Field Analysis", player.bladeburner_analysis_mult], ]} + color={Settings.theme.primary} /> ); } @@ -147,14 +97,15 @@ function CurrentBitNode(): React.ReactElement { if (player.sourceFiles.length > 0) { const index = "BitNode" + player.bitNodeN; return ( - <> - - BitNode {player.bitNodeN}: {BitNodes[index].name} - - - {BitNodes[index].info} - - + + + + BitNode {player.bitNodeN}: {BitNodes[index].name} (Level {Math.min(SourceFileFlags[player.bitNodeN] + 1, 3)} + ) + + {BitNodes[index].info} + + ); } @@ -273,227 +224,276 @@ export function CharacterStats(): React.ReactElement { }, []); const timeRows = [ - ["Time played since last Augmentation:", convertTimeMsToTimeElapsedString(player.playtimeSinceLastAug)], + ["Since last Augmentation installation", convertTimeMsToTimeElapsedString(player.playtimeSinceLastAug)], ]; if (player.sourceFiles.length > 0) { - timeRows.push([ - "Time played since last Bitnode destroyed:", - convertTimeMsToTimeElapsedString(player.playtimeSinceLastBitnode), - ]); + timeRows.push(["Since last Bitnode destroyed", convertTimeMsToTimeElapsedString(player.playtimeSinceLastBitnode)]); } - timeRows.push(["Total Time played:", convertTimeMsToTimeElapsedString(player.totalPlaytime)]); + timeRows.push(["Total", convertTimeMsToTimeElapsedString(player.totalPlaytime)]); return ( <> - General - - Current City: {player.city} - - - - - - Money: - setMoneyOpen(true)}> - - - + + + General + + + + + <> + + setMoneyOpen(true)} sx={{ p: 0 }}> + + + + + {player.companyName && ( + <> + + + + )} + + 0 ? "Servers" : "Nodes"} owned`} + color={Settings.theme.primary} + data={{ + content: `${player.hacknetNodes.length}${ + player.bitNodeN === 9 || SourceFileFlags[9] > 0 ? ` / ${HacknetServerConstants.MaxServers}` : "" + }`, + }} + /> + + +
+ +
+ + Skills + + + + + + + + + {player.intelligence > 0 && (player.bitNodeN === 5 || SourceFileFlags[5] > 0) && ( + + )} + +
+
-
- Stats - - - - - - Hacking:  - - - {numeralWrapper.formatSkill(player.hacking)}  - - - ({numeralWrapper.formatExp(player.hacking_exp)} exp) - - - - - Strength:  - - - {numeralWrapper.formatSkill(player.strength)}  - - - ({numeralWrapper.formatExp(player.strength_exp)} exp) - - - - - Defense:  - - - {numeralWrapper.formatSkill(player.defense)}  - - - ({numeralWrapper.formatExp(player.defense_exp)} exp) - - - - - Dexterity:  - - - {numeralWrapper.formatSkill(player.dexterity)}  - - - ({numeralWrapper.formatExp(player.dexterity_exp)} exp) - - - - - Agility:  - - - {numeralWrapper.formatSkill(player.agility)}  - - - ({numeralWrapper.formatExp(player.agility_exp)} exp) - - - - - Charisma:  - - - {numeralWrapper.formatSkill(player.charisma)}  - - - ({numeralWrapper.formatExp(player.charisma_exp)} exp) - - - - -
-
+ + + Multipliers + + + +
+ +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + + +
+ + +
+ + +
+ +
+
+
+
-
- Multipliers - - -
- -
- -
- - -
- - -
- - -
- - -
- - -
- - -
- - -
- + + + Time Played + + + {timeRows.map(([name, content]) => ( + + + + ))} + +
+
-
- - Misc - - {`Servers owned: ${player.purchasedServers.length} / ${getPurchaseServerLimit()}`} - - {`Augmentations installed: ${player.augmentations.length}`} - - -
setMoneyOpen(false)} /> diff --git a/src/ui/React/StatsRow.tsx b/src/ui/React/StatsRow.tsx index eed5c7184..74241c235 100644 --- a/src/ui/React/StatsRow.tsx +++ b/src/ui/React/StatsRow.tsx @@ -17,9 +17,10 @@ interface IProps { color: string; classes?: any; data: ITableRowData; + children?: React.ReactElement; } -export const StatsRow = ({ name, color, classes = useStyles(), data }: IProps): React.ReactElement => { +export const StatsRow = ({ name, color, classes = useStyles(), children, data }: IProps): React.ReactElement => { let content; if (data.content !== undefined) { @@ -37,6 +38,7 @@ export const StatsRow = ({ name, color, classes = useStyles(), data }: IProps): {content} + {children} ); From 3651a8d379449ae1df8a03b733a4f1f77e7cc64f Mon Sep 17 00:00:00 2001 From: nickofolas Date: Thu, 7 Apr 2022 11:50:23 -0500 Subject: [PATCH 02/26] Add employers modal to stats page --- src/ui/CharacterStats.tsx | 38 +++++++++++++++++++++++++++----------- 1 file changed, 27 insertions(+), 11 deletions(-) diff --git a/src/ui/CharacterStats.tsx b/src/ui/CharacterStats.tsx index f1b387d34..8e6e8b940 100644 --- a/src/ui/CharacterStats.tsx +++ b/src/ui/CharacterStats.tsx @@ -19,22 +19,27 @@ import { Money } from "./React/Money"; import { StatsRow } from "./React/StatsRow"; import { StatsTable } from "./React/StatsTable"; -function Employers(): React.ReactElement { - const player = use.Player(); - if (player.jobs && Object.keys(player.jobs).length !== 0) - return ( - <> - All Employers: +interface EmployersModalProps { + open: boolean; + onClose: () => void; +} + +const EmployersModal = ({ open, onClose }: EmployersModalProps): React.ReactElement => { + const player = use.Player(); + return ( + + <> + All Employers
    {Object.keys(player.jobs).map((j) => ( - * {j} + * {j} ))}
- ); - return <>; -} +
+ ); +}; interface MultTableProps { rows: (string | number)[][]; @@ -213,6 +218,7 @@ function MoneyModal({ open, onClose }: IMoneyModalProps): React.ReactElement { export function CharacterStats(): React.ReactElement { const player = use.Player(); const [moneyOpen, setMoneyOpen] = useState(false); + const [employersOpen, setEmployersOpen] = useState(false); const setRerender = useState(false)[1]; function rerender(): void { setRerender((old) => !old); @@ -261,6 +267,16 @@ export function CharacterStats(): React.ReactElement { /> )} + {player.jobs && Object.keys(player.jobs).length !== 0 && ( + + <> + {Object.keys(player.jobs).length} total + setEmployersOpen(true)} sx={{ p: 0 }}> + + + + + )} - Skills @@ -496,6 +511,7 @@ export function CharacterStats(): React.ReactElement {
setMoneyOpen(false)} /> + setEmployersOpen(false)} /> ); } From a9a31662cecd3a61aed644f823f24fffbeaa3e8c Mon Sep 17 00:00:00 2001 From: nickofolas <60761231+nickofolas@users.noreply.github.com> Date: Thu, 7 Apr 2022 13:17:27 -0500 Subject: [PATCH 03/26] Tweak style for stats page --- src/ui/CharacterStats.tsx | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/ui/CharacterStats.tsx b/src/ui/CharacterStats.tsx index 8e6e8b940..26873d197 100644 --- a/src/ui/CharacterStats.tsx +++ b/src/ui/CharacterStats.tsx @@ -19,7 +19,6 @@ import { Money } from "./React/Money"; import { StatsRow } from "./React/StatsRow"; import { StatsTable } from "./React/StatsTable"; - interface EmployersModalProps { open: boolean; onClose: () => void; @@ -101,12 +100,13 @@ function CurrentBitNode(): React.ReactElement { const player = use.Player(); if (player.sourceFiles.length > 0) { const index = "BitNode" + player.bitNodeN; + const currentSourceFile = player.sourceFiles.find((sourceFile) => sourceFile.n == player.bitNodeN); + const lvl = currentSourceFile ? currentSourceFile.lvl : 0; return ( - BitNode {player.bitNodeN}: {BitNodes[index].name} (Level {Math.min(SourceFileFlags[player.bitNodeN] + 1, 3)} - ) + BitNode {player.bitNodeN}: {BitNodes[index].name} (Level {lvl}) {BitNodes[index].info} @@ -239,7 +239,9 @@ export function CharacterStats(): React.ReactElement { return ( <> - + General @@ -344,7 +346,7 @@ export function CharacterStats(): React.ReactElement {
- + Multipliers @@ -495,15 +497,13 @@ export function CharacterStats(): React.ReactElement { - + Time Played {timeRows.map(([name, content]) => ( - - - + ))}
From c94b4f4fd3f354c79061bdf11209d3e15d4c68dc Mon Sep 17 00:00:00 2001 From: nickofolas <60761231+nickofolas@users.noreply.github.com> Date: Thu, 7 Apr 2022 17:53:58 -0500 Subject: [PATCH 04/26] Initial aug page overhaul work --- src/Augmentation/ui/AugmentationsRoot.tsx | 220 ++++++++++++------ .../ui/InstalledAugmentations.tsx | 132 ++++++----- src/Augmentation/ui/PlayerMultipliers.tsx | 144 +++++++----- .../ui/PurchasedAugmentations.tsx | 8 +- src/Augmentation/ui/SourceFiles.tsx | 172 ++++++++++++-- 5 files changed, 456 insertions(+), 220 deletions(-) diff --git a/src/Augmentation/ui/AugmentationsRoot.tsx b/src/Augmentation/ui/AugmentationsRoot.tsx index 9f7ad401d..f3a64e6e3 100644 --- a/src/Augmentation/ui/AugmentationsRoot.tsx +++ b/src/Augmentation/ui/AugmentationsRoot.tsx @@ -7,7 +7,7 @@ import React, { useState, useEffect } from "react"; import { InstalledAugmentations } from "./InstalledAugmentations"; import { PlayerMultipliers } from "./PlayerMultipliers"; import { PurchasedAugmentations } from "./PurchasedAugmentations"; -import { SourceFiles } from "./SourceFiles"; +import { SourceFilesElement } from "./SourceFiles"; import { canGetBonus } from "../../ExportBonus"; import { use } from "../../ui/Context"; @@ -16,8 +16,53 @@ import Typography from "@mui/material/Typography"; import Button from "@mui/material/Button"; import Tooltip from "@mui/material/Tooltip"; import Box from "@mui/material/Box"; +import Paper from "@mui/material/Paper"; +import Container from "@mui/material/Container"; import { Settings } from "../../Settings/Settings"; import { ConfirmationModal } from "../../ui/React/ConfirmationModal"; +import { IPlayer } from "../../PersonObjects/IPlayer"; +import { AugmentationNames } from "../data/AugmentationNames"; +import { Augmentations } from "../Augmentations"; +import { CONSTANTS } from "../../Constants"; +import { formatNumber } from "../../utils/StringHelperFunctions"; +import { Info } from "@mui/icons-material"; + +interface NFGDisplayProps { + player: IPlayer; +} + +const NeuroFluxDisplay = ({ player }: NFGDisplayProps): React.ReactElement => { + const level = player.augmentations.find((e) => e.name === AugmentationNames.NeuroFluxGovernor)?.level ?? 0; + + return level > 0 ? ( + + NeuroFlux Governor - Level {level} + {Augmentations[AugmentationNames.NeuroFluxGovernor].stats} + + ) : ( + <> + ); +}; + +interface EntropyDisplayProps { + player: IPlayer; +} + +const EntropyDisplay = ({ player }: EntropyDisplayProps): React.ReactElement => { + return player.entropy > 0 ? ( + + + Entropy Virus - Level {player.entropy} + + + All multipliers decreased by: {formatNumber((1 - CONSTANTS.EntropyEffect ** player.entropy) * 100, 3)}% + (multiplicative) + + + ) : ( + <> + ); +}; interface IProps { exportGameFn: () => void; @@ -55,81 +100,112 @@ export function AugmentationsRoot(props: IProps): React.ReactElement { } return ( - <> + Augmentations - - - Below is a list of all Augmentations you have purchased but not yet installed. Click the button below to - install them. - - WARNING: Installing your Augmentations resets most of your progress, including: -
- - Stats/Skill levels and Experience - - Money - - Scripts on every computer but your home computer - - Purchased servers - - Hacknet Nodes - - Faction/Company reputation - - Stocks -
- - Installing Augmentations lets you start over with the perks and benefits granted by all of the Augmentations - you have ever installed. Also, you will keep any scripts and RAM/Core upgrades on your home computer (but you - will lose all programs besides NUKE.exe) - + + + + Purchased Augmentations + + + Below is a list of all Augmentations you have purchased but not yet installed. Click the button + below to install them. + + + WARNING: Installing your Augmentations resets most of your progress, including: + +
+ - Stats/Skill levels and Experience + - Money + - Scripts on every computer but your home computer + - Purchased servers + - Hacknet Nodes + - Faction/Company reputation + - Stocks +
+ + Installing Augmentations lets you start over with the perks and benefits granted by all of the + Augmentations you have ever installed. Also, you will keep any scripts and RAM/Core upgrades on your + home computer (but you will lose all programs besides NUKE.exe) + + + } + > + +
+
+ setInstallOpen(false)} + onConfirm={props.installAugmentationsFn} + confirmationText={ + <> + Installing will reset +
+
- money +
- skill / experience +
- every server except home +
- factions and reputation +
+
+ You will keep: +
+
- All scripts on home +
- home ram and cores +
+
+ It is recommended to install several Augmentations at once. Preferably everything from any faction of + your choosing. + + } + /> + + 'I never asked for this'}> + + + + + It's always a good idea to backup/export your save!}> + + + +
+ {player.queuedAugmentations.length > 0 ? ( + + + + + ) : ( + + No Augmentations have been purchased yet + + )}
- - Purchased Augmentations - - - 'I never asked for this'}> - - - - - setInstallOpen(false)} - onConfirm={props.installAugmentationsFn} - confirmationText={ - <> - Installing will reset -
-
- money -
- skill / experience -
- every server except home -
- factions and reputation -
-
- You will keep: -
-
- All scripts on home -
- home ram and cores -
-
- It is recommended to install several Augmentations at once. Preferably everything from any faction of your - choosing. - - } - /> - It's always a good idea to backup/export your save!}> - - - + + e.name === AugmentationNames.NeuroFluxGovernor)?.level ?? 0) > 0) + + +!!(player.entropy > 0) + }, 1fr)`, + }} + > + + - Installed Augmentations - - - List of all Augmentations that have been installed. You have gained the effects of these. - + + - - - + +
); } diff --git a/src/Augmentation/ui/InstalledAugmentations.tsx b/src/Augmentation/ui/InstalledAugmentations.tsx index eccfd94ec..6f208789f 100644 --- a/src/Augmentation/ui/InstalledAugmentations.tsx +++ b/src/Augmentation/ui/InstalledAugmentations.tsx @@ -5,29 +5,24 @@ * It also contains 'configuration' buttons that allow you to change how the * Augs/SF's are displayed */ +import { Box, ListItemButton, Paper, Typography } from "@mui/material"; +import Button from "@mui/material/Button"; +import List from "@mui/material/List"; +import Tooltip from "@mui/material/Tooltip"; import React, { useState } from "react"; - -import { AugmentationAccordion } from "../../ui/React/AugmentationAccordion"; -import { Augmentations } from "../Augmentations"; -import { AugmentationNames } from "../data/AugmentationNames"; - +import { OwnedAugmentationsOrderSetting } from "../../Settings/SettingEnums"; import { Settings } from "../../Settings/Settings"; import { use } from "../../ui/Context"; -import { OwnedAugmentationsOrderSetting } from "../../Settings/SettingEnums"; -import Button from "@mui/material/Button"; -import Tooltip from "@mui/material/Tooltip"; -import List from "@mui/material/List"; -import { ExpandLess, ExpandMore } from "@mui/icons-material"; -import { Box, Paper, ListItemButton, ListItemText, Typography, Collapse } from "@mui/material"; -import { CONSTANTS } from "../../Constants"; -import { formatNumber } from "../../utils/StringHelperFunctions"; +import { Augmentations } from "../Augmentations"; +import { AugmentationNames } from "../data/AugmentationNames"; export function InstalledAugmentations(): React.ReactElement { const setRerender = useState(true)[1]; const player = use.Player(); - const sourceAugs = player.augmentations.slice(); + const [selectedAug, setSelectedAug] = useState(sourceAugs[0]); + if (Settings.OwnedAugmentationsOrder === OwnedAugmentationsOrderSetting.Alphabetically) { sourceAugs.sort((aug1, aug2) => { return aug1.name.localeCompare(aug2.name); @@ -49,59 +44,62 @@ export function InstalledAugmentations(): React.ReactElement { } return ( - <> - - - - - - - - {player.entropy > 0 && - (() => { - const [open, setOpen] = useState(false); + + + Installed Augmentations + + + + + + + + + + {sourceAugs.length > 0 ? ( + + + + {sourceAugs + .filter((aug) => aug.name !== AugmentationNames.NeuroFluxGovernor) + .map((k, i) => ( + setSelectedAug(k)} selected={selectedAug === k}> + {k.name} + + ))} + + + + + {selectedAug.name} + + + {(() => { + const aug = Augmentations[selectedAug.name]; - return ( - - setOpen((old) => !old)}> - - Entropy Virus - Level {player.entropy} - - } - /> - {open ? ( - - ) : ( - - )} - - - - - All multipliers decreased by:{" "} - {formatNumber((1 - CONSTANTS.EntropyEffect ** player.entropy) * 100, 3)}% (multiplicative) - - - - - ); - })()} - - {sourceAugs.map((e) => { - const aug = Augmentations[e.name]; - - let level = null; - if (e.name === AugmentationNames.NeuroFluxGovernor) { - level = e.level; - } - - return ; - })} - - + const info = typeof aug.info === "string" ? {aug.info} : aug.info; + const tooltip = ( + <> + {info} +
+
+ {aug.stats} + + ); + return tooltip; + })()} + +
+ + ) : ( + + No Augmentations have been installed yet + + )} +
); } diff --git a/src/Augmentation/ui/PlayerMultipliers.tsx b/src/Augmentation/ui/PlayerMultipliers.tsx index be2c1bf47..d866bb340 100644 --- a/src/Augmentation/ui/PlayerMultipliers.tsx +++ b/src/Augmentation/ui/PlayerMultipliers.tsx @@ -1,17 +1,14 @@ /** * React component for displaying the player's multipliers on the Augmentation UI page */ +import { Box, Typography, List, ListItemText, ListItem, Paper } from "@mui/material"; import * as React from "react"; - +import { BitNodeMultipliers } from "../../BitNode/BitNodeMultipliers"; import { Player } from "../../Player"; import { numeralWrapper } from "../../ui/numeralFormat"; import { Augmentations } from "../Augmentations"; -import { Table, TableCell } from "../../ui/React/Table"; -import TableBody from "@mui/material/TableBody"; -import TableRow from "@mui/material/TableRow"; -import Typography from "@mui/material/Typography"; -import Box from "@mui/material/Box"; -import { BitNodeMultipliers } from "../../BitNode/BitNodeMultipliers"; +import { DoubleArrow } from "@mui/icons-material"; +import { Settings } from "../../Settings/Settings"; function calculateAugmentedStats(): any { const augP: any = {}; @@ -25,53 +22,63 @@ function calculateAugmentedStats(): any { return augP; } -function Improvements({ r, m }: { r: number; m: number }): React.ReactElement { - if (r) { - return ( - <> - -  {"=>"}  - - - - {numeralWrapper.formatPercentage(r)} - - - - ); - } - return <>; -} - -interface IBN5StatsProps { +interface BitNodeModifiedStatsProps { base: number; mult: number; + color: string; } -function BN5Stat(props: IBN5StatsProps): React.ReactElement { - if (props.mult === 1) return <>; - return <>({numeralWrapper.formatPercentage(props.base * props.mult)}); -} +function BitNodeModifiedStats(props: BitNodeModifiedStatsProps): React.ReactElement { + if (props.mult === 1) + return {numeralWrapper.formatPercentage(props.base)}; -function MultiplierTable({ rows }: { rows: [string, number, number, number][] }): React.ReactElement { return ( - - - {rows.map((r: any) => ( - - - {r[0]} multiplier:  - - - - {numeralWrapper.formatPercentage(r[1])} - - - - - ))} - -
+ + {numeralWrapper.formatPercentage(props.base)}{" "} + {numeralWrapper.formatPercentage(props.base * props.mult)} + + ); +} + +interface MultListProps { + rows: (string | number)[][]; + color: string; +} + +function MultiplierList(props: MultListProps): React.ReactElement { + return ( + + {props.rows.map((data) => { + const mult = data[0] as string, + value = data[1] as number, + improved = data[2] as number | null, + bnMult = data[3] as number; + + if (improved) { + return ( + + + {mult} + + } + secondary={ + + + + + + } + disableTypography + /> + + ); + } + return <>; + })} + ); } @@ -82,7 +89,7 @@ export function PlayerMultipliers(): React.ReactElement { if (!Player.canAccessBladeburner()) return <>; return ( <> -
@@ -116,20 +124,21 @@ export function PlayerMultipliers(): React.ReactElement { } return ( - <> - Multipliers - - + Multipliers + +
-
-
-
-
-
-
-
-
-
- + ); } diff --git a/src/Augmentation/ui/PurchasedAugmentations.tsx b/src/Augmentation/ui/PurchasedAugmentations.tsx index a8aa13b55..6b0402b5e 100644 --- a/src/Augmentation/ui/PurchasedAugmentations.tsx +++ b/src/Augmentation/ui/PurchasedAugmentations.tsx @@ -9,7 +9,7 @@ import { AugmentationNames } from "../data/AugmentationNames"; import { Player } from "../../Player"; import { AugmentationAccordion } from "../../ui/React/AugmentationAccordion"; -import List from "@mui/material/List"; +import { List, Paper } from "@mui/material"; export function PurchasedAugmentations(): React.ReactElement { const augs: React.ReactElement[] = []; @@ -32,5 +32,9 @@ export function PurchasedAugmentations(): React.ReactElement { augs.push(); } - return {augs}; + return ( + + {augs} + + ); } diff --git a/src/Augmentation/ui/SourceFiles.tsx b/src/Augmentation/ui/SourceFiles.tsx index 1293f2298..ec9da77dd 100644 --- a/src/Augmentation/ui/SourceFiles.tsx +++ b/src/Augmentation/ui/SourceFiles.tsx @@ -1,21 +1,161 @@ -import React from "react"; -import { SourceFileMinus1 } from "./SourceFileMinus1"; -import { OwnedSourceFiles } from "./OwnedSourceFiles"; -import List from "@mui/material/List"; - -import Typography from "@mui/material/Typography"; +import { ListItemButton, ListItemText, Paper } from "@mui/material"; import Box from "@mui/material/Box"; +import List from "@mui/material/List"; +import Typography from "@mui/material/Typography"; +import React, { useState } from "react"; +import { Exploit, ExploitName } from "../../Exploits/Exploit"; +import { Player } from "../../Player"; +import { OwnedAugmentationsOrderSetting } from "../../Settings/SettingEnums"; +import { Settings } from "../../Settings/Settings"; +import { SourceFile } from "../../SourceFile/SourceFile"; +import { SourceFiles } from "../../SourceFile/SourceFiles"; + +interface SfMinus1 { + info: React.ReactElement; + n: number; + name: string; +} + +const safeGetSf = (sfNum: number): SourceFile | SfMinus1 | null => { + if (sfNum === -1) { + return { + info: ( + <> + This Source-File can only be acquired with obscure knowledge of the game, javascript, and the web ecosystem. +
+
+ It increases all of the player's multipliers by 0.1% +
+
+ You have found the following exploits: +
+
+ {Player.exploits.map((c: Exploit) => ( + + * {ExploitName(c)} +
+
+ ))} + + ), + lvl: Player.exploits.length, + n: -1, + name: "Source-File -1: Exploits in the BitNodes", + }; + } + + const srcFileKey = "SourceFile" + sfNum; + const sfObj = SourceFiles[srcFileKey]; + if (sfObj == null) { + console.error(`Invalid source file number: ${sfNum}`); + return null; + } + return sfObj; +}; + +export function SourceFilesElement(): React.ReactElement { + const sourceSfs = Player.sourceFiles.slice(); + const exploits = Player.exploits; + + if (Settings.OwnedAugmentationsOrder === OwnedAugmentationsOrderSetting.Alphabetically) { + sourceSfs.sort((sf1, sf2) => { + return sf1.n - sf2.n; + }); + } + + const [selectedSf, setSelectedSf] = useState(sourceSfs[0]); -export function SourceFiles(): React.ReactElement { return ( - <> - Source Files - - - - - - - + + + Source Files + + {sourceSfs.length > 0 ? ( + + + + {exploits.length > 0 && ( + setSelectedSf({ n: -1, lvl: exploits.length })} + selected={selectedSf.n === -1} + sx={{ py: 0 }} + > + Source-File -1: Exploits in the BitNodes} + secondary={ + + Level {exploits.length} / {Object.keys(Exploit).length} + + } + /> + + )} + + {sourceSfs.map((e, i) => { + const sfObj = safeGetSf(e.n); + const maxLevel = sfObj?.n === 12 ? "∞" : "3"; + + return ( + setSelectedSf(e)} + selected={selectedSf === e} + sx={{ py: 0 }} + > + {sfObj?.name}} + secondary={ + + Level {selectedSf.lvl} / {maxLevel} + + } + /> + + ); + })} + + + + + {safeGetSf(selectedSf.n)?.name} + + + {(() => { + const sfObj = safeGetSf(selectedSf.n); + + let maxLevel; + switch (sfObj?.n) { + case 12: + maxLevel = "∞"; + break; + case -1: + maxLevel = Object.keys(Exploit).length; + break; + default: + maxLevel = "3"; + } + + return ( + <> + Level {selectedSf.lvl} / {maxLevel} +
+
+ {sfObj?.info} + + ); + })()} +
+
+
+ ) : ( + <> + )} +
); } From d728648bfa00c33a06a8bb05bd2d056661ec9183 Mon Sep 17 00:00:00 2001 From: nickofolas <60761231+nickofolas@users.noreply.github.com> Date: Thu, 7 Apr 2022 18:32:11 -0500 Subject: [PATCH 05/26] Stats tweaks --- src/ui/CharacterStats.tsx | 53 +++++++++++++++++++++++---------------- 1 file changed, 32 insertions(+), 21 deletions(-) diff --git a/src/ui/CharacterStats.tsx b/src/ui/CharacterStats.tsx index 26873d197..c35583bb8 100644 --- a/src/ui/CharacterStats.tsx +++ b/src/ui/CharacterStats.tsx @@ -1,8 +1,5 @@ -import MoreHorizIcon from "@mui/icons-material/MoreHoriz"; -import { Paper, Table, TableBody } from "@mui/material"; -import Box from "@mui/material/Box"; -import IconButton from "@mui/material/IconButton"; -import Typography from "@mui/material/Typography"; +import { Paper, Table, TableBody, Box, IconButton, Typography, Container, Tooltip } from "@mui/material"; +import { MoreHoriz, Info } from "@mui/icons-material"; import React, { useEffect, useState } from "react"; import { BitNodes } from "../BitNode/BitNode"; import { BitNodeMultipliers } from "../BitNode/BitNodeMultipliers"; @@ -29,7 +26,7 @@ const EmployersModal = ({ open, onClose }: EmployersModalProps): React.ReactElem return ( <> - All Employers + All Employers
    {Object.keys(player.jobs).map((j) => ( * {j} @@ -103,9 +100,9 @@ function CurrentBitNode(): React.ReactElement { const currentSourceFile = player.sourceFiles.find((sourceFile) => sourceFile.n == player.bitNodeN); const lvl = currentSourceFile ? currentSourceFile.lvl : 0; return ( - + - + BitNode {player.bitNodeN}: {BitNodes[index].name} (Level {lvl}) {BitNodes[index].info} @@ -238,12 +235,11 @@ export function CharacterStats(): React.ReactElement { timeRows.push(["Total", convertTimeMsToTimeElapsedString(player.totalPlaytime)]); return ( - <> - + + Stats + - General + General @@ -251,7 +247,7 @@ export function CharacterStats(): React.ReactElement { <> setMoneyOpen(true)} sx={{ p: 0 }}> - + @@ -274,7 +270,7 @@ export function CharacterStats(): React.ReactElement { <> {Object.keys(player.jobs).length} total setEmployersOpen(true)} sx={{ p: 0 }}> - + @@ -302,7 +298,7 @@ export function CharacterStats(): React.ReactElement {
    - Skills + Skills - + - Multipliers + + Multipliers + + Displays your current multipliers. +
    +
    + When there is a dim number next to a multiplier, that means that the multiplier in question is being + affected by BitNode multipliers. +
    + } + > + + + - + - Time Played + Time Played
    {timeRows.map(([name, content]) => ( @@ -512,6 +523,6 @@ export function CharacterStats(): React.ReactElement { setMoneyOpen(false)} /> setEmployersOpen(false)} /> - + ); } From 960dc354c1fe76281e08ce597c14b899abf3e29b Mon Sep 17 00:00:00 2001 From: nickofolas <60761231+nickofolas@users.noreply.github.com> Date: Thu, 7 Apr 2022 19:06:42 -0500 Subject: [PATCH 06/26] Further tweaks/fixes --- src/Augmentation/ui/PlayerMultipliers.tsx | 87 +++++++++++------------ src/ui/CharacterStats.tsx | 26 +++---- 2 files changed, 50 insertions(+), 63 deletions(-) diff --git a/src/Augmentation/ui/PlayerMultipliers.tsx b/src/Augmentation/ui/PlayerMultipliers.tsx index d866bb340..99b49616d 100644 --- a/src/Augmentation/ui/PlayerMultipliers.tsx +++ b/src/Augmentation/ui/PlayerMultipliers.tsx @@ -43,43 +43,51 @@ function BitNodeModifiedStats(props: BitNodeModifiedStatsProps): React.ReactElem interface MultListProps { rows: (string | number)[][]; color: string; + noMargin?: boolean; } -function MultiplierList(props: MultListProps): React.ReactElement { - return ( - - {props.rows.map((data) => { - const mult = data[0] as string, - value = data[1] as number, - improved = data[2] as number | null, - bnMult = data[3] as number; +function MultiplierList({ rows, color, noMargin = false }: MultListProps): React.ReactElement { + const listItems = rows + .map((data) => { + const mult = data[0] as string, + value = data[1] as number, + improved = data[2] as number | null, + bnMult = data[3] as number; - if (improved) { - return ( - - - {mult} - - } - secondary={ - - - - - - } - disableTypography - /> - - ); - } - return <>; - })} - - ); + if (improved) { + return ( + + + {mult} + + } + secondary={ + + + + + + } + disableTypography + /> + + ); + } + return; + }) + .filter((i) => i !== undefined); + + if (listItems.length > 0) { + return ( + + {listItems} + + ); + } + return <>; } export function PlayerMultipliers(): React.ReactElement { @@ -125,7 +133,6 @@ export function PlayerMultipliers(): React.ReactElement { return ( - Multipliers -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    diff --git a/src/ui/CharacterStats.tsx b/src/ui/CharacterStats.tsx index c35583bb8..e31bb3919 100644 --- a/src/ui/CharacterStats.tsx +++ b/src/ui/CharacterStats.tsx @@ -40,11 +40,12 @@ const EmployersModal = ({ open, onClose }: EmployersModalProps): React.ReactElem interface MultTableProps { rows: (string | number)[][]; color: string; + noMargin?: boolean; } function MultiplierTable(props: MultTableProps): React.ReactElement { return ( -
    +
    {props.rows.map((data) => { const mult = data[0] as string, @@ -89,6 +90,7 @@ function BladeburnerMults(): React.ReactElement { ["Bladeburner Field Analysis", player.bladeburner_analysis_mult], ]} color={Settings.theme.primary} + noMargin /> ); } @@ -354,6 +356,10 @@ export function CharacterStats(): React.ReactElement {
    When there is a dim number next to a multiplier, that means that the multiplier in question is being affected by BitNode multipliers. +
    +
    + The dim number is the raw multiplier, and the undimmed number is the effective multiplier, as dictated + by the BitNode. } > @@ -379,7 +385,6 @@ export function CharacterStats(): React.ReactElement { ]} color={Settings.theme.hack} /> -
    -
    - -
    - -
    - -
    - -
    - @@ -477,8 +473,6 @@ export function CharacterStats(): React.ReactElement { ]} color={Settings.theme.primary} /> -
    - -
    - -
    -
    From 9dea3815363b9a5e8678e999f583bf329c156818 Mon Sep 17 00:00:00 2001 From: nickofolas Date: Thu, 7 Apr 2022 20:44:29 -0500 Subject: [PATCH 07/26] Fix SF levels and tweak spacing --- src/Augmentation/ui/AugmentationsRoot.tsx | 2 +- src/Augmentation/ui/PlayerMultipliers.tsx | 2 +- src/Augmentation/ui/SourceFiles.tsx | 6 ++++-- src/ui/CharacterStats.tsx | 2 +- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/Augmentation/ui/AugmentationsRoot.tsx b/src/Augmentation/ui/AugmentationsRoot.tsx index f3a64e6e3..2bcd1ad9a 100644 --- a/src/Augmentation/ui/AugmentationsRoot.tsx +++ b/src/Augmentation/ui/AugmentationsRoot.tsx @@ -133,7 +133,7 @@ export function AugmentationsRoot(props: IProps): React.ReactElement { } > - + - + } diff --git a/src/Augmentation/ui/SourceFiles.tsx b/src/Augmentation/ui/SourceFiles.tsx index ec9da77dd..288cfcea0 100644 --- a/src/Augmentation/ui/SourceFiles.tsx +++ b/src/Augmentation/ui/SourceFiles.tsx @@ -98,6 +98,7 @@ export function SourceFilesElement(): React.ReactElement { {sourceSfs.map((e, i) => { const sfObj = safeGetSf(e.n); + if (!sfObj) return; const maxLevel = sfObj?.n === 12 ? "∞" : "3"; return ( @@ -109,10 +110,10 @@ export function SourceFilesElement(): React.ReactElement { > {sfObj?.name}} + primary={{sfObj.name}} secondary={ - Level {selectedSf.lvl} / {maxLevel} + Level {e.lvl} / {maxLevel} } /> @@ -128,6 +129,7 @@ export function SourceFilesElement(): React.ReactElement { {(() => { const sfObj = safeGetSf(selectedSf.n); + if (!sfObj) return; let maxLevel; switch (sfObj?.n) { diff --git a/src/ui/CharacterStats.tsx b/src/ui/CharacterStats.tsx index e31bb3919..5d0cc6d77 100644 --- a/src/ui/CharacterStats.tsx +++ b/src/ui/CharacterStats.tsx @@ -363,7 +363,7 @@ export function CharacterStats(): React.ReactElement { } > - + From 3d296e2bf0e7b35b08fd0abdd339c21494012f91 Mon Sep 17 00:00:00 2001 From: nickofolas Date: Thu, 7 Apr 2022 23:19:05 -0500 Subject: [PATCH 08/26] Consistently respect SF5 BN mult unlock --- src/Augmentation/ui/PlayerMultipliers.tsx | 3 +- src/ui/CharacterStats.tsx | 36 ++++++++++++----------- 2 files changed, 21 insertions(+), 18 deletions(-) diff --git a/src/Augmentation/ui/PlayerMultipliers.tsx b/src/Augmentation/ui/PlayerMultipliers.tsx index 504482cc3..7cb4d1877 100644 --- a/src/Augmentation/ui/PlayerMultipliers.tsx +++ b/src/Augmentation/ui/PlayerMultipliers.tsx @@ -8,6 +8,7 @@ import { Player } from "../../Player"; import { numeralWrapper } from "../../ui/numeralFormat"; import { Augmentations } from "../Augmentations"; import { DoubleArrow } from "@mui/icons-material"; +import { SourceFileFlags } from "../../SourceFile/SourceFileFlags"; import { Settings } from "../../Settings/Settings"; function calculateAugmentedStats(): any { @@ -29,7 +30,7 @@ interface BitNodeModifiedStatsProps { } function BitNodeModifiedStats(props: BitNodeModifiedStatsProps): React.ReactElement { - if (props.mult === 1) + if (props.mult === 1 || SourceFileFlags[5] === 0) return {numeralWrapper.formatPercentage(props.base)}; return ( diff --git a/src/ui/CharacterStats.tsx b/src/ui/CharacterStats.tsx index 5d0cc6d77..2ebc3b476 100644 --- a/src/ui/CharacterStats.tsx +++ b/src/ui/CharacterStats.tsx @@ -348,23 +348,25 @@ export function CharacterStats(): React.ReactElement { Multipliers - - Displays your current multipliers. -
    -
    - When there is a dim number next to a multiplier, that means that the multiplier in question is being - affected by BitNode multipliers. -
    -
    - The dim number is the raw multiplier, and the undimmed number is the effective multiplier, as dictated - by the BitNode. -
    - } - > - - + {SourceFileFlags[5] > 0 && ( + + Displays your current multipliers. +
    +
    + When there is a dim number next to a multiplier, that means that the multiplier in question is being + affected by BitNode multipliers. +
    +
    + The dim number is the raw multiplier, and the undimmed number is the effective multiplier, as + dictated by the BitNode. + + } + > + +
    + )} From e720930f043b0936c5cc522409b482793d905ea8 Mon Sep 17 00:00:00 2001 From: nickofolas Date: Thu, 7 Apr 2022 23:29:24 -0500 Subject: [PATCH 09/26] Improve sizing of some list-based menus --- src/Augmentation/ui/InstalledAugmentations.tsx | 4 ++-- src/Augmentation/ui/SourceFiles.tsx | 4 ++-- src/PersonObjects/Grafting/ui/GraftingRoot.tsx | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Augmentation/ui/InstalledAugmentations.tsx b/src/Augmentation/ui/InstalledAugmentations.tsx index 6f208789f..58631cc7f 100644 --- a/src/Augmentation/ui/InstalledAugmentations.tsx +++ b/src/Augmentation/ui/InstalledAugmentations.tsx @@ -63,7 +63,7 @@ export function InstalledAugmentations(): React.ReactElement { {sourceAugs.length > 0 ? ( - + {sourceAugs .filter((aug) => aug.name !== AugmentationNames.NeuroFluxGovernor) .map((k, i) => ( @@ -77,7 +77,7 @@ export function InstalledAugmentations(): React.ReactElement { {selectedAug.name} - + {(() => { const aug = Augmentations[selectedAug.name]; diff --git a/src/Augmentation/ui/SourceFiles.tsx b/src/Augmentation/ui/SourceFiles.tsx index 288cfcea0..d52e4590a 100644 --- a/src/Augmentation/ui/SourceFiles.tsx +++ b/src/Augmentation/ui/SourceFiles.tsx @@ -74,7 +74,7 @@ export function SourceFilesElement(): React.ReactElement { {exploits.length > 0 && ( @@ -126,7 +126,7 @@ export function SourceFilesElement(): React.ReactElement { {safeGetSf(selectedSf.n)?.name} - + {(() => { const sfObj = safeGetSf(selectedSf.n); if (!sfObj) return; diff --git a/src/PersonObjects/Grafting/ui/GraftingRoot.tsx b/src/PersonObjects/Grafting/ui/GraftingRoot.tsx index 7b61841f0..b909be6d7 100644 --- a/src/PersonObjects/Grafting/ui/GraftingRoot.tsx +++ b/src/PersonObjects/Grafting/ui/GraftingRoot.tsx @@ -94,7 +94,7 @@ export const GraftingRoot = (): React.ReactElement => { Graft Augmentations {getAvailableAugs(player).length > 0 ? ( - + {getAvailableAugs(player).map((k, i) => ( setSelectedAug(k)} selected={selectedAug === k}> {k} From e7ad5c5f9e3ea2c7888a6a26f56f8fb95ec32196 Mon Sep 17 00:00:00 2001 From: nickofolas Date: Thu, 7 Apr 2022 23:33:47 -0500 Subject: [PATCH 10/26] Remove unnecessary code --- src/ui/CharacterStats.tsx | 30 ++++++++++++------------------ 1 file changed, 12 insertions(+), 18 deletions(-) diff --git a/src/ui/CharacterStats.tsx b/src/ui/CharacterStats.tsx index 2ebc3b476..95d59ea54 100644 --- a/src/ui/CharacterStats.tsx +++ b/src/ui/CharacterStats.tsx @@ -78,23 +78,6 @@ function MultiplierTable(props: MultTableProps): React.ReactElement { ); } -function BladeburnerMults(): React.ReactElement { - const player = use.Player(); - if (!player.canAccessBladeburner()) return <>; - return ( - - ); -} - function CurrentBitNode(): React.ReactElement { const player = use.Player(); if (player.sourceFiles.length > 0) { @@ -494,7 +477,18 @@ export function CharacterStats(): React.ReactElement { ]} color={Settings.theme.combat} /> - + {player.canAccessBladeburner() && ( + + )} From 5dea27bc2894b442e6dfacf1c4d79bdd19f506e6 Mon Sep 17 00:00:00 2001 From: nickofolas <60761231+nickofolas@users.noreply.github.com> Date: Fri, 8 Apr 2022 09:43:09 -0500 Subject: [PATCH 11/26] Fix NFG appearing in installed list --- src/Augmentation/ui/InstalledAugmentations.tsx | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/Augmentation/ui/InstalledAugmentations.tsx b/src/Augmentation/ui/InstalledAugmentations.tsx index 58631cc7f..d200ebfa6 100644 --- a/src/Augmentation/ui/InstalledAugmentations.tsx +++ b/src/Augmentation/ui/InstalledAugmentations.tsx @@ -19,7 +19,7 @@ import { AugmentationNames } from "../data/AugmentationNames"; export function InstalledAugmentations(): React.ReactElement { const setRerender = useState(true)[1]; const player = use.Player(); - const sourceAugs = player.augmentations.slice(); + const sourceAugs = player.augmentations.slice().filter((aug) => aug.name !== AugmentationNames.NeuroFluxGovernor); const [selectedAug, setSelectedAug] = useState(sourceAugs[0]); @@ -64,13 +64,11 @@ export function InstalledAugmentations(): React.ReactElement { - {sourceAugs - .filter((aug) => aug.name !== AugmentationNames.NeuroFluxGovernor) - .map((k, i) => ( - setSelectedAug(k)} selected={selectedAug === k}> - {k.name} - - ))} + {sourceAugs.map((k, i) => ( + setSelectedAug(k)} selected={selectedAug === k}> + {k.name} + + ))} From 81f971b52ef6990c10c225ff3e021e15cd000466 Mon Sep 17 00:00:00 2001 From: nickofolas <60761231+nickofolas@users.noreply.github.com> Date: Fri, 8 Apr 2022 09:43:21 -0500 Subject: [PATCH 12/26] Add coloring to NFG display --- src/Augmentation/ui/AugmentationsRoot.tsx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Augmentation/ui/AugmentationsRoot.tsx b/src/Augmentation/ui/AugmentationsRoot.tsx index 2bcd1ad9a..35bf1d221 100644 --- a/src/Augmentation/ui/AugmentationsRoot.tsx +++ b/src/Augmentation/ui/AugmentationsRoot.tsx @@ -36,8 +36,10 @@ const NeuroFluxDisplay = ({ player }: NFGDisplayProps): React.ReactElement => { return level > 0 ? ( - NeuroFlux Governor - Level {level} - {Augmentations[AugmentationNames.NeuroFluxGovernor].stats} + + NeuroFlux Governor - Level {level} + + {Augmentations[AugmentationNames.NeuroFluxGovernor].stats} ) : ( <> @@ -196,6 +198,7 @@ export function AugmentationsRoot(props: IProps): React.ReactElement { +!!((player.augmentations.find((e) => e.name === AugmentationNames.NeuroFluxGovernor)?.level ?? 0) > 0) + +!!(player.entropy > 0) }, 1fr)`, + gap: 1, }} > From a4bc793cf1ceb52e11c4abc0a55875faa621bd82 Mon Sep 17 00:00:00 2001 From: nickofolas <60761231+nickofolas@users.noreply.github.com> Date: Fri, 8 Apr 2022 10:21:40 -0500 Subject: [PATCH 13/26] Hide SF display when no SFs owned --- src/Augmentation/ui/SourceFiles.tsx | 151 ++++++++++++++-------------- 1 file changed, 73 insertions(+), 78 deletions(-) diff --git a/src/Augmentation/ui/SourceFiles.tsx b/src/Augmentation/ui/SourceFiles.tsx index d52e4590a..895119091 100644 --- a/src/Augmentation/ui/SourceFiles.tsx +++ b/src/Augmentation/ui/SourceFiles.tsx @@ -65,99 +65,94 @@ export function SourceFilesElement(): React.ReactElement { const [selectedSf, setSelectedSf] = useState(sourceSfs[0]); + if (sourceSfs.length === 0) { + return <>; + } + return ( Source Files - {sourceSfs.length > 0 ? ( - - - - {exploits.length > 0 && ( - setSelectedSf({ n: -1, lvl: exploits.length })} - selected={selectedSf.n === -1} - sx={{ py: 0 }} - > + + + + {exploits.length > 0 && ( + setSelectedSf({ n: -1, lvl: exploits.length })} + selected={selectedSf.n === -1} + sx={{ py: 0 }} + > + Source-File -1: Exploits in the BitNodes} + secondary={ + + Level {exploits.length} / {Object.keys(Exploit).length} + + } + /> + + )} + + {sourceSfs.map((e, i) => { + const sfObj = safeGetSf(e.n); + if (!sfObj) return; + const maxLevel = sfObj?.n === 12 ? "∞" : "3"; + + return ( + setSelectedSf(e)} selected={selectedSf === e} sx={{ py: 0 }}> Source-File -1: Exploits in the BitNodes} + primary={{sfObj.name}} secondary={ - Level {exploits.length} / {Object.keys(Exploit).length} + Level {e.lvl} / {maxLevel} } /> - )} + ); + })} + + + + + {safeGetSf(selectedSf.n)?.name} + + + {(() => { + const sfObj = safeGetSf(selectedSf.n); + if (!sfObj) return; - {sourceSfs.map((e, i) => { - const sfObj = safeGetSf(e.n); - if (!sfObj) return; - const maxLevel = sfObj?.n === 12 ? "∞" : "3"; + let maxLevel; + switch (sfObj?.n) { + case 12: + maxLevel = "∞"; + break; + case -1: + maxLevel = Object.keys(Exploit).length; + break; + default: + maxLevel = "3"; + } - return ( - setSelectedSf(e)} - selected={selectedSf === e} - sx={{ py: 0 }} - > - {sfObj.name}} - secondary={ - - Level {e.lvl} / {maxLevel} - - } - /> - - ); - })} - - - - - {safeGetSf(selectedSf.n)?.name} - - - {(() => { - const sfObj = safeGetSf(selectedSf.n); - if (!sfObj) return; - - let maxLevel; - switch (sfObj?.n) { - case 12: - maxLevel = "∞"; - break; - case -1: - maxLevel = Object.keys(Exploit).length; - break; - default: - maxLevel = "3"; - } - - return ( - <> - Level {selectedSf.lvl} / {maxLevel} -
    -
    - {sfObj?.info} - - ); - })()} -
    -
    -
    - ) : ( - <> - )} + return ( + <> + Level {selectedSf.lvl} / {maxLevel} +
    +
    + {sfObj?.info} + + ); + })()} + +
    +
    ); } From b9cc6321fd7d602c535b153481ed5f3b4c3b0345 Mon Sep 17 00:00:00 2001 From: nickofolas <60761231+nickofolas@users.noreply.github.com> Date: Fri, 8 Apr 2022 10:49:10 -0500 Subject: [PATCH 14/26] SF -1 related fixes --- src/Augmentation/ui/SourceFiles.tsx | 66 ++++++++++++++--------------- 1 file changed, 31 insertions(+), 35 deletions(-) diff --git a/src/Augmentation/ui/SourceFiles.tsx b/src/Augmentation/ui/SourceFiles.tsx index 895119091..53c9e9102 100644 --- a/src/Augmentation/ui/SourceFiles.tsx +++ b/src/Augmentation/ui/SourceFiles.tsx @@ -14,11 +14,12 @@ interface SfMinus1 { info: React.ReactElement; n: number; name: string; + lvl: number; } const safeGetSf = (sfNum: number): SourceFile | SfMinus1 | null => { if (sfNum === -1) { - return { + const sfMinus1: SfMinus1 = { info: ( <> This Source-File can only be acquired with obscure knowledge of the game, javascript, and the web ecosystem. @@ -42,6 +43,7 @@ const safeGetSf = (sfNum: number): SourceFile | SfMinus1 | null => { n: -1, name: "Source-File -1: Exploits in the BitNodes", }; + return sfMinus1; } const srcFileKey = "SourceFile" + sfNum; @@ -53,9 +55,31 @@ const safeGetSf = (sfNum: number): SourceFile | SfMinus1 | null => { return sfObj; }; +const getMaxLevel = (sfObj: SourceFile | SfMinus1): string | number => { + let maxLevel; + switch (sfObj.n) { + case 12: + maxLevel = "∞"; + break; + case -1: + maxLevel = Object.keys(Exploit).length; + break; + default: + maxLevel = "3"; + } + return maxLevel; +}; + export function SourceFilesElement(): React.ReactElement { const sourceSfs = Player.sourceFiles.slice(); const exploits = Player.exploits; + // Create a fake SF for -1, if "owned" + if (exploits.length > 0) { + sourceSfs.unshift({ + n: -1, + lvl: exploits.length, + }); + } if (Settings.OwnedAugmentationsOrder === OwnedAugmentationsOrderSetting.Alphabetically) { sourceSfs.sort((sf1, sf2) => { @@ -63,12 +87,12 @@ export function SourceFilesElement(): React.ReactElement { }); } - const [selectedSf, setSelectedSf] = useState(sourceSfs[0]); - if (sourceSfs.length === 0) { return <>; } + const [selectedSf, setSelectedSf] = useState(sourceSfs[0]); + return ( @@ -80,29 +104,11 @@ export function SourceFilesElement(): React.ReactElement { sx={{ height: 400, overflowY: "scroll", borderRight: `1px solid ${Settings.theme.welllight}` }} disablePadding > - {exploits.length > 0 && ( - setSelectedSf({ n: -1, lvl: exploits.length })} - selected={selectedSf.n === -1} - sx={{ py: 0 }} - > - Source-File -1: Exploits in the BitNodes} - secondary={ - - Level {exploits.length} / {Object.keys(Exploit).length} - - } - /> - - )} - {sourceSfs.map((e, i) => { const sfObj = safeGetSf(e.n); if (!sfObj) return; - const maxLevel = sfObj?.n === 12 ? "∞" : "3"; + + const maxLevel = getMaxLevel(sfObj); return ( setSelectedSf(e)} selected={selectedSf === e} sx={{ py: 0 }}> @@ -129,24 +135,14 @@ export function SourceFilesElement(): React.ReactElement { const sfObj = safeGetSf(selectedSf.n); if (!sfObj) return; - let maxLevel; - switch (sfObj?.n) { - case 12: - maxLevel = "∞"; - break; - case -1: - maxLevel = Object.keys(Exploit).length; - break; - default: - maxLevel = "3"; - } + const maxLevel = getMaxLevel(sfObj); return ( <> Level {selectedSf.lvl} / {maxLevel}

    - {sfObj?.info} + {sfObj.info} ); })()} From 96226f199f2b47e90d802109221943afb32fbc31 Mon Sep 17 00:00:00 2001 From: nickofolas <60761231+nickofolas@users.noreply.github.com> Date: Fri, 8 Apr 2022 11:22:46 -0500 Subject: [PATCH 15/26] Improve purchased Augs section --- src/Augmentation/ui/AugmentationsRoot.tsx | 2 +- src/Augmentation/ui/PlayerMultipliers.tsx | 4 +- .../ui/PurchasedAugmentations.tsx | 37 +++++++++++++++++-- 3 files changed, 38 insertions(+), 5 deletions(-) diff --git a/src/Augmentation/ui/AugmentationsRoot.tsx b/src/Augmentation/ui/AugmentationsRoot.tsx index 35bf1d221..a40afd517 100644 --- a/src/Augmentation/ui/AugmentationsRoot.tsx +++ b/src/Augmentation/ui/AugmentationsRoot.tsx @@ -179,7 +179,7 @@ export function AugmentationsRoot(props: IProps): React.ReactElement {
    {player.queuedAugmentations.length > 0 ? ( - + diff --git a/src/Augmentation/ui/PlayerMultipliers.tsx b/src/Augmentation/ui/PlayerMultipliers.tsx index 7cb4d1877..2d5696c79 100644 --- a/src/Augmentation/ui/PlayerMultipliers.tsx +++ b/src/Augmentation/ui/PlayerMultipliers.tsx @@ -133,7 +133,7 @@ export function PlayerMultipliers(): React.ReactElement { } return ( - + + + ); + + augs.push( + + {(() => { + const info = typeof aug.info === "string" ? {aug.info} : aug.info; + const tooltip = ( + <> + {info} +
    +
    + {aug.stats} + + ); + return tooltip; + })()} + + } + enterDelay={500} + > + + + +
    , + ); } return ( - {augs} + + {augs} + ); } From 2d904e08b4196e8505d50efd468828879b26d998 Mon Sep 17 00:00:00 2001 From: nickofolas Date: Fri, 8 Apr 2022 11:48:37 -0500 Subject: [PATCH 16/26] Fix keys --- src/Augmentation/ui/PurchasedAugmentations.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Augmentation/ui/PurchasedAugmentations.tsx b/src/Augmentation/ui/PurchasedAugmentations.tsx index 2ef903105..c66502dcb 100644 --- a/src/Augmentation/ui/PurchasedAugmentations.tsx +++ b/src/Augmentation/ui/PurchasedAugmentations.tsx @@ -8,7 +8,6 @@ import { Augmentations } from "../Augmentations"; import { AugmentationNames } from "../data/AugmentationNames"; import { Player } from "../../Player"; -import { AugmentationAccordion } from "../../ui/React/AugmentationAccordion"; import { List, Paper, ListItemText, ListItem, Tooltip, Typography } from "@mui/material"; export function PurchasedAugmentations(): React.ReactElement { @@ -53,8 +52,9 @@ export function PurchasedAugmentations(): React.ReactElement { } enterDelay={500} + key={displayName} > - + , From f40af55f469e71aeb8269779962f583979c0542a Mon Sep 17 00:00:00 2001 From: nickofolas Date: Fri, 8 Apr 2022 16:10:35 -0500 Subject: [PATCH 17/26] Change money stat color --- src/Augmentation/ui/PurchasedAugmentations.tsx | 2 +- src/ui/CharacterStats.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Augmentation/ui/PurchasedAugmentations.tsx b/src/Augmentation/ui/PurchasedAugmentations.tsx index c66502dcb..818596729 100644 --- a/src/Augmentation/ui/PurchasedAugmentations.tsx +++ b/src/Augmentation/ui/PurchasedAugmentations.tsx @@ -51,7 +51,7 @@ export function PurchasedAugmentations(): React.ReactElement { })()} } - enterDelay={500} + enterNextDelay={1000} key={displayName} > diff --git a/src/ui/CharacterStats.tsx b/src/ui/CharacterStats.tsx index 95d59ea54..eaf040a5d 100644 --- a/src/ui/CharacterStats.tsx +++ b/src/ui/CharacterStats.tsx @@ -468,7 +468,7 @@ export function CharacterStats(): React.ReactElement { ], ["Salary", player.work_money_mult, player.work_money_mult * BitNodeMultipliers.CompanyWorkMoney], ]} - color={Settings.theme.primary} + color={Settings.theme.money} /> Date: Fri, 8 Apr 2022 16:27:16 -0500 Subject: [PATCH 18/26] Overhaul PlayerMultipliers columns logic --- src/Augmentation/ui/PlayerMultipliers.tsx | 420 ++++++++++------------ 1 file changed, 197 insertions(+), 223 deletions(-) diff --git a/src/Augmentation/ui/PlayerMultipliers.tsx b/src/Augmentation/ui/PlayerMultipliers.tsx index 2d5696c79..01b146040 100644 --- a/src/Augmentation/ui/PlayerMultipliers.tsx +++ b/src/Augmentation/ui/PlayerMultipliers.tsx @@ -1,18 +1,22 @@ /** * React component for displaying the player's multipliers on the Augmentation UI page */ -import { Box, Typography, List, ListItemText, ListItem, Paper } from "@mui/material"; +import { DoubleArrow } from "@mui/icons-material"; +import { List, ListItem, ListItemText, Paper, Typography } from "@mui/material"; import * as React from "react"; import { BitNodeMultipliers } from "../../BitNode/BitNodeMultipliers"; import { Player } from "../../Player"; +import { Settings } from "../../Settings/Settings"; +import { SourceFileFlags } from "../../SourceFile/SourceFileFlags"; import { numeralWrapper } from "../../ui/numeralFormat"; import { Augmentations } from "../Augmentations"; -import { DoubleArrow } from "@mui/icons-material"; -import { SourceFileFlags } from "../../SourceFile/SourceFileFlags"; -import { Settings } from "../../Settings/Settings"; -function calculateAugmentedStats(): any { - const augP: any = {}; +interface IAugmentedStats { + [index: string]: number; +} + +function calculateAugmentedStats(): IAugmentedStats { + const augP: IAugmentedStats = {}; for (const aug of Player.queuedAugmentations) { const augObj = Augmentations[aug.name]; for (const mult of Object.keys(augObj.mults)) { @@ -23,13 +27,13 @@ function calculateAugmentedStats(): any { return augP; } -interface BitNodeModifiedStatsProps { +interface IBitNodeModifiedStatsProps { base: number; mult: number; color: string; } -function BitNodeModifiedStats(props: BitNodeModifiedStatsProps): React.ReactElement { +function BitNodeModifiedStats(props: IBitNodeModifiedStatsProps): React.ReactElement { if (props.mult === 1 || SourceFileFlags[5] === 0) return {numeralWrapper.formatPercentage(props.base)}; @@ -41,19 +45,27 @@ function BitNodeModifiedStats(props: BitNodeModifiedStatsProps): React.ReactElem ); } -interface MultListProps { - rows: (string | number)[][]; - color: string; +type MultiplierListItemData = [ + multiplier: string, + currentValue: number, + augmentedValue: number, + bitNodeMultiplier: number, + color: string, +]; + +interface IMultiplierListProps { + rows: MultiplierListItemData[]; noMargin?: boolean; } -function MultiplierList({ rows, color, noMargin = false }: MultListProps): React.ReactElement { +function MultiplierList({ rows, noMargin = false }: IMultiplierListProps): React.ReactElement { const listItems = rows .map((data) => { - const mult = data[0] as string, - value = data[1] as number, - improved = data[2] as number | null, - bnMult = data[3] as number; + const mult = data[0], + value = data[1], + improved = data[2], + bnMult = data[3], + color = data[4]; if (improved) { return ( @@ -94,217 +106,179 @@ function MultiplierList({ rows, color, noMargin = false }: MultListProps): React export function PlayerMultipliers(): React.ReactElement { const mults = calculateAugmentedStats(); - function BladeburnerMults(): React.ReactElement { - if (!Player.canAccessBladeburner()) return <>; - return ( - <> - -
    - + const leftColData: MultiplierListItemData[] = [ + ...[ + ["Hacking Chance ", Player.hacking_chance_mult, Player.hacking_chance_mult * mults.hacking_chance_mult, 1], + ["Hacking Speed ", Player.hacking_speed_mult, Player.hacking_speed_mult * mults.hacking_speed_mult, 1], + ["Hacking Money ", Player.hacking_money_mult, Player.hacking_money_mult * mults.hacking_money_mult, 1], + ["Hacking Growth ", Player.hacking_grow_mult, Player.hacking_grow_mult * mults.hacking_grow_mult, 1], + [ + "Hacking Level ", + Player.hacking_mult, + Player.hacking_mult * mults.hacking_mult, + BitNodeMultipliers.HackingLevelMultiplier, + ], + [ + "Hacking Experience ", + Player.hacking_exp_mult, + Player.hacking_exp_mult * mults.hacking_exp_mult, + BitNodeMultipliers.HackExpGain, + ], + ].map((data): MultiplierListItemData => (data as any).concat([Settings.theme.hack])), + ...[ + [ + "Strength Level ", + Player.strength_mult, + Player.strength_mult * mults.strength_mult, + BitNodeMultipliers.StrengthLevelMultiplier, + ], + ["Strength Experience ", Player.strength_exp_mult, Player.strength_exp_mult * mults.strength_exp_mult, 1], + [ + "Defense Level ", + Player.defense_mult, + Player.defense_mult * mults.defense_mult, + BitNodeMultipliers.DefenseLevelMultiplier, + ], + ["Defense Experience ", Player.defense_exp_mult, Player.defense_exp_mult * mults.defense_exp_mult, 1], + [ + "Dexterity Level ", + Player.dexterity_mult, + Player.dexterity_mult * mults.dexterity_mult, + BitNodeMultipliers.DexterityLevelMultiplier, + ], + ["Dexterity Experience ", Player.dexterity_exp_mult, Player.dexterity_exp_mult * mults.dexterity_exp_mult, 1], + [ + "Agility Level ", + Player.agility_mult, + Player.agility_mult * mults.agility_mult, + BitNodeMultipliers.AgilityLevelMultiplier, + ], + ["Agility Experience ", Player.agility_exp_mult, Player.agility_exp_mult * mults.agility_exp_mult, 1], + ].map((data): MultiplierListItemData => (data as any).concat([Settings.theme.combat])), + [ + "Charisma Level ", + Player.charisma_mult, + Player.charisma_mult * mults.charisma_mult, + BitNodeMultipliers.CharismaLevelMultiplier, + Settings.theme.cha, + ], + [ + "Charisma Experience ", + Player.charisma_exp_mult, + Player.charisma_exp_mult * mults.charisma_exp_mult, + 1, + Settings.theme.cha, + ], + ]; + const rightColData: MultiplierListItemData[] = [ + ...[ + [ + "Hacknet Node production ", + Player.hacknet_node_money_mult, + Player.hacknet_node_money_mult * mults.hacknet_node_money_mult, + BitNodeMultipliers.HacknetNodeMoney, + ], + [ + "Hacknet Node purchase cost ", + Player.hacknet_node_purchase_cost_mult, + Player.hacknet_node_purchase_cost_mult * mults.hacknet_node_purchase_cost_mult, + 1, + ], + [ + "Hacknet Node RAM upgrade cost ", + Player.hacknet_node_ram_cost_mult, + Player.hacknet_node_ram_cost_mult * mults.hacknet_node_ram_cost_mult, + 1, + ], + [ + "Hacknet Node Core purchase cost ", + Player.hacknet_node_core_cost_mult, + Player.hacknet_node_core_cost_mult * mults.hacknet_node_core_cost_mult, + 1, + ], + [ + "Hacknet Node level upgrade cost ", + Player.hacknet_node_level_cost_mult, + Player.hacknet_node_level_cost_mult * mults.hacknet_node_level_cost_mult, + 1, + ], + ["Company reputation gain ", Player.company_rep_mult, Player.company_rep_mult * mults.company_rep_mult, 1], + [ + "Faction reputation gain ", + Player.faction_rep_mult, + Player.faction_rep_mult * mults.faction_rep_mult, + BitNodeMultipliers.FactionWorkRepGain, + ], + ].map((data): MultiplierListItemData => (data as any).concat([Settings.theme.primary])), + [ + "Salary ", + Player.work_money_mult, + Player.work_money_mult * mults.work_money_mult, + BitNodeMultipliers.CompanyWorkMoney, + Settings.theme.money, + ], + [ + "Crime success ", + Player.crime_success_mult, + Player.crime_success_mult * mults.crime_success_mult, + 1, + Settings.theme.combat, + ], + [ + "Crime money ", + Player.crime_money_mult, + Player.crime_money_mult * mults.crime_money_mult, + BitNodeMultipliers.CrimeMoney, + Settings.theme.money, + ], + ]; + + if (Player.canAccessBladeburner()) { + rightColData.push( + ...[ + [ + "Bladeburner Success Chance", + Player.bladeburner_success_chance_mult, + Player.bladeburner_success_chance_mult * mults.bladeburner_success_chance_mult, + 1, + ], + [ + "Bladeburner Max Stamina", + Player.bladeburner_max_stamina_mult, + Player.bladeburner_max_stamina_mult * mults.bladeburner_max_stamina_mult, + 1, + ], + [ + "Bladeburner Stamina Gain", + Player.bladeburner_stamina_gain_mult, + Player.bladeburner_stamina_gain_mult * mults.bladeburner_stamina_gain_mult, + 1, + ], + [ + "Bladeburner Field Analysis", + Player.bladeburner_analysis_mult, + Player.bladeburner_analysis_mult * mults.bladeburner_analysis_mult, + 1, + ], + ].map((data): MultiplierListItemData => (data as any).concat([Settings.theme.primary])), ); } + const hasLeftImprovements = +!!(leftColData.filter((item) => item[2] !== 0).length > 0), + hasRightImprovements = +!!(rightColData.filter((item) => item[2] !== 0).length > 0); + return ( - - - - - - - - - - - - - - - - - - - - - - - - - - + + + ); } From 34ca4d236b61cc2bb87f7ce1a95de6bb1b6e0fe6 Mon Sep 17 00:00:00 2001 From: nickofolas Date: Fri, 8 Apr 2022 16:28:43 -0500 Subject: [PATCH 19/26] Add ability to clear queued augs from dev menu --- src/DevMenu/ui/Augmentations.tsx | 101 +++++++++++++++---------------- 1 file changed, 48 insertions(+), 53 deletions(-) diff --git a/src/DevMenu/ui/Augmentations.tsx b/src/DevMenu/ui/Augmentations.tsx index 3927ac5fd..1a2295b14 100644 --- a/src/DevMenu/ui/Augmentations.tsx +++ b/src/DevMenu/ui/Augmentations.tsx @@ -1,19 +1,18 @@ +import { Clear, ExpandMore, Reply, ReplyAll } from "@mui/icons-material"; +import { + Accordion, + AccordionDetails, + AccordionSummary, + Button, + IconButton, + MenuItem, + Select, + SelectChangeEvent, + Typography +} from "@mui/material"; import React, { 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 Select, { SelectChangeEvent } from "@mui/material/Select"; -import { IPlayer } from "../../PersonObjects/IPlayer"; import { AugmentationNames } from "../../Augmentation/data/AugmentationNames"; -import Typography from "@mui/material/Typography"; -import MenuItem from "@mui/material/MenuItem"; -import IconButton from "@mui/material/IconButton"; -import ReplyAllIcon from "@mui/icons-material/ReplyAll"; -import ReplyIcon from "@mui/icons-material/Reply"; -import ClearIcon from "@mui/icons-material/Clear"; +import { IPlayer } from "../../PersonObjects/IPlayer"; interface IProps { player: IPlayer; @@ -39,50 +38,46 @@ export function Augmentations(props: IProps): React.ReactElement { props.player.augmentations = []; } + function clearQueuedAugs(): void { + props.player.queuedAugmentations = []; + } + return ( - }> + }> Augmentations -
    - - - - - - -
    - Aug: - - -
    + + ); From 7c9fc3248fd2aa79fafc2d3b2fd2044a2d7bddf0 Mon Sep 17 00:00:00 2001 From: nickofolas Date: Fri, 8 Apr 2022 16:29:15 -0500 Subject: [PATCH 20/26] Reduce purchased aug tooltip delay --- src/Augmentation/ui/PurchasedAugmentations.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Augmentation/ui/PurchasedAugmentations.tsx b/src/Augmentation/ui/PurchasedAugmentations.tsx index 818596729..be4d336f6 100644 --- a/src/Augmentation/ui/PurchasedAugmentations.tsx +++ b/src/Augmentation/ui/PurchasedAugmentations.tsx @@ -51,7 +51,7 @@ export function PurchasedAugmentations(): React.ReactElement { })()}
    } - enterNextDelay={1000} + enterNextDelay={500} key={displayName} > From 693ca7baba376019ced4d899c3a00aaf5c89fe50 Mon Sep 17 00:00:00 2001 From: nickofolas Date: Fri, 8 Apr 2022 16:40:06 -0500 Subject: [PATCH 21/26] Change theme variable used for entropy color --- src/Augmentation/ui/AugmentationsRoot.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Augmentation/ui/AugmentationsRoot.tsx b/src/Augmentation/ui/AugmentationsRoot.tsx index a40afd517..fcb5bd861 100644 --- a/src/Augmentation/ui/AugmentationsRoot.tsx +++ b/src/Augmentation/ui/AugmentationsRoot.tsx @@ -53,10 +53,10 @@ interface EntropyDisplayProps { const EntropyDisplay = ({ player }: EntropyDisplayProps): React.ReactElement => { return player.entropy > 0 ? ( - + Entropy Virus - Level {player.entropy} - + All multipliers decreased by: {formatNumber((1 - CONSTANTS.EntropyEffect ** player.entropy) * 100, 3)}% (multiplicative) From 271173dca209ebf24eb9d343eb01f491d61288fe Mon Sep 17 00:00:00 2001 From: nickofolas Date: Fri, 8 Apr 2022 16:58:21 -0500 Subject: [PATCH 22/26] Fix consistency of purchased aug list --- src/Augmentation/ui/PurchasedAugmentations.tsx | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/Augmentation/ui/PurchasedAugmentations.tsx b/src/Augmentation/ui/PurchasedAugmentations.tsx index be4d336f6..f3982f035 100644 --- a/src/Augmentation/ui/PurchasedAugmentations.tsx +++ b/src/Augmentation/ui/PurchasedAugmentations.tsx @@ -2,13 +2,11 @@ * React component for displaying all of the player's purchased (but not installed) * Augmentations on the Augmentations UI. */ +import { List, ListItemText, Paper, Tooltip, Typography } from "@mui/material"; import * as React from "react"; - +import { Player } from "../../Player"; import { Augmentations } from "../Augmentations"; import { AugmentationNames } from "../data/AugmentationNames"; -import { Player } from "../../Player"; - -import { List, Paper, ListItemText, ListItem, Tooltip, Typography } from "@mui/material"; export function PurchasedAugmentations(): React.ReactElement { const augs: React.ReactElement[] = []; @@ -54,15 +52,13 @@ export function PurchasedAugmentations(): React.ReactElement { enterNextDelay={500} key={displayName} > - - - + , ); } return ( - + {augs} From 236a5cd6458690065c77d82413326de77e25fc15 Mon Sep 17 00:00:00 2001 From: nickofolas Date: Sat, 9 Apr 2022 08:35:31 -0500 Subject: [PATCH 23/26] Minor code improvements --- src/Augmentation/ui/PlayerMultipliers.tsx | 33 +++++++++-------------- 1 file changed, 12 insertions(+), 21 deletions(-) diff --git a/src/Augmentation/ui/PlayerMultipliers.tsx b/src/Augmentation/ui/PlayerMultipliers.tsx index 01b146040..b5ec5edd7 100644 --- a/src/Augmentation/ui/PlayerMultipliers.tsx +++ b/src/Augmentation/ui/PlayerMultipliers.tsx @@ -34,6 +34,7 @@ interface IBitNodeModifiedStatsProps { } function BitNodeModifiedStats(props: IBitNodeModifiedStatsProps): React.ReactElement { + // If player doesn't have SF5 or if the property isn't affected by BitNode mults if (props.mult === 1 || SourceFileFlags[5] === 0) return {numeralWrapper.formatPercentage(props.base)}; @@ -55,33 +56,28 @@ type MultiplierListItemData = [ interface IMultiplierListProps { rows: MultiplierListItemData[]; - noMargin?: boolean; } -function MultiplierList({ rows, noMargin = false }: IMultiplierListProps): React.ReactElement { - const listItems = rows +function MultiplierList(props: IMultiplierListProps): React.ReactElement { + const listItems = props.rows .map((data) => { - const mult = data[0], - value = data[1], - improved = data[2], - bnMult = data[3], - color = data[4]; + const [multiplier, currentValue, augmentedValue, bitNodeMultiplier, color] = data; - if (improved) { + if (!isNaN(augmentedValue)) { return ( - + - {mult} + {multiplier} } secondary={ - + - + } disableTypography @@ -93,19 +89,14 @@ function MultiplierList({ rows, noMargin = false }: IMultiplierListProps): React }) .filter((i) => i !== undefined); - if (listItems.length > 0) { - return ( - - {listItems} - - ); - } - return <>; + return listItems.length > 0 ? {listItems} : <>; } export function PlayerMultipliers(): React.ReactElement { const mults = calculateAugmentedStats(); + // Column data is a bit janky, so it's set up here to allow for + // easier logic in setting up the layout const leftColData: MultiplierListItemData[] = [ ...[ ["Hacking Chance ", Player.hacking_chance_mult, Player.hacking_chance_mult * mults.hacking_chance_mult, 1], From 48895c8d2d91ed8626ffba47769dc33c3cf6dbf3 Mon Sep 17 00:00:00 2001 From: nickofolas Date: Sat, 9 Apr 2022 08:41:03 -0500 Subject: [PATCH 24/26] Fix SF list selection --- src/Augmentation/ui/SourceFiles.tsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Augmentation/ui/SourceFiles.tsx b/src/Augmentation/ui/SourceFiles.tsx index 53c9e9102..f649d3890 100644 --- a/src/Augmentation/ui/SourceFiles.tsx +++ b/src/Augmentation/ui/SourceFiles.tsx @@ -111,7 +111,12 @@ export function SourceFilesElement(): React.ReactElement { const maxLevel = getMaxLevel(sfObj); return ( - setSelectedSf(e)} selected={selectedSf === e} sx={{ py: 0 }}> + setSelectedSf(e)} + selected={selectedSf.n === e.n} + sx={{ py: 0 }} + > {sfObj.name}} From 4a0998c568710cfc8aa83894ab5fd9cdc1d19ac2 Mon Sep 17 00:00:00 2001 From: nickofolas Date: Sat, 9 Apr 2022 09:06:32 -0500 Subject: [PATCH 25/26] Fix DOM parse warnings --- src/ui/CharacterStats.tsx | 8 ++++++-- src/ui/React/StatsRow.tsx | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/ui/CharacterStats.tsx b/src/ui/CharacterStats.tsx index eaf040a5d..0c24fb734 100644 --- a/src/ui/CharacterStats.tsx +++ b/src/ui/CharacterStats.tsx @@ -236,7 +236,7 @@ export function CharacterStats(): React.ReactElement { - {player.companyName && ( + {player.companyName ? ( <> + ) : ( + <> )} - {player.jobs && Object.keys(player.jobs).length !== 0 && ( + {player.jobs && Object.keys(player.jobs).length !== 0 ? ( <> {Object.keys(player.jobs).length} total @@ -259,6 +261,8 @@ export function CharacterStats(): React.ReactElement { + ) : ( + <> )} {name} - {content} + {content ? {content} : <>} {children} From f6af85a38d8286aec702556f1296565de5a5067f Mon Sep 17 00:00:00 2001 From: nickofolas Date: Sun, 10 Apr 2022 15:57:34 -0500 Subject: [PATCH 26/26] Fix prettier --- src/DevMenu/ui/Augmentations.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/DevMenu/ui/Augmentations.tsx b/src/DevMenu/ui/Augmentations.tsx index 1a2295b14..be569e1d3 100644 --- a/src/DevMenu/ui/Augmentations.tsx +++ b/src/DevMenu/ui/Augmentations.tsx @@ -8,7 +8,7 @@ import { MenuItem, Select, SelectChangeEvent, - Typography + Typography, } from "@mui/material"; import React, { useState } from "react"; import { AugmentationNames } from "../../Augmentation/data/AugmentationNames";