From c688e20876486a1d639f7057b609176e627f8d58 Mon Sep 17 00:00:00 2001 From: nickofolas Date: Sat, 7 May 2022 16:51:34 -0500 Subject: [PATCH] Refactor character stats table --- src/ui/CharacterStats.tsx | 234 +++++++++++++++++++++++++------------- 1 file changed, 158 insertions(+), 76 deletions(-) diff --git a/src/ui/CharacterStats.tsx b/src/ui/CharacterStats.tsx index c14bdfb69..a13ff9ba4 100644 --- a/src/ui/CharacterStats.tsx +++ b/src/ui/CharacterStats.tsx @@ -37,8 +37,22 @@ const EmployersModal = ({ open, onClose }: EmployersModalProps): React.ReactElem ); }; +interface IMultRow { + // The name of the multiplier + mult: string; + + // The player's raw multiplier value + value: number; + + // The player's effective multiplier value, affected by BitNode mults + effValue?: number; + + // The text color for the row + color?: string; +} + interface MultTableProps { - rows: (string | number)[][]; + rows: IMultRow[]; color: string; noMargin?: boolean; } @@ -49,29 +63,22 @@ function MultiplierTable(props: MultTableProps): React.ReactElement { {props.rows.map((data) => { - const mult = data[0] as string, - value = data[1] as number, - modded = data[2] as number | null; + const { mult, value, effValue = null, color = props.color } = data; - if (modded && modded !== value && player.sourceFileLvl(5) > 0) { + if (effValue && effValue !== value && player.sourceFileLvl(5) > 0) { return ( - + <> - + {numeralWrapper.formatPercentage(value)}{" "} - {numeralWrapper.formatPercentage(modded)} + {numeralWrapper.formatPercentage(effValue)} ); } return ( - + ); })} @@ -359,76 +366,109 @@ export function CharacterStats(): React.ReactElement { {player.canAccessBladeburner() && (