import React, { useState, useEffect } from "react"; import { numeralWrapper } from "../ui/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 Box from "@mui/material/Box"; import IconButton from "@mui/material/IconButton"; import MoreHorizIcon from "@mui/icons-material/MoreHoriz"; 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 <>; } function Employers(): React.ReactElement { const player = use.Player(); if (player.jobs && Object.keys(player.jobs).length !== 0) return ( <> All Employers: ); 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}`}
); } } function Intelligence(): React.ReactElement { const player = use.Player(); if (player.intelligence > 0 && (player.bitNodeN === 5 || SourceFileFlags[5] > 0)) { return ( Intelligence:  {numeralWrapper.formatSkill(player.intelligence)}  ); } 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 <>; } return ( <> {props.rows.map((r: any) => ( {`${r[0]} multiplier:`}  {numeralWrapper.formatPercentage(r[1])} {bn5Stat(r)} ))}
); } 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) { const index = "BitNode" + player.bitNodeN; return ( <> BitNode {player.bitNodeN}: {BitNodes[index].name} {BitNodes[index].info} ); } return <>; } interface IMoneyModalProps { open: boolean; onClose: () => void; } function MoneyModal({ open, onClose }: IMoneyModalProps): React.ReactElement { const player = use.Player(); function convertMoneySourceTrackerToString(src: MoneySourceTracker): React.ReactElement { const parts: any[][] = [[`Total:`, ]]; if (src.bladeburner) { parts.push([`Bladeburner:`, ]); } if (src.codingcontract) { parts.push([`Coding Contracts:`, ]); } if (src.work) { parts.push([`Company Work:`, ]); } if (src.class) { parts.push([`Class:`, ]); } if (src.corporation) { parts.push([`Corporation:`, ]); } if (src.crime) { parts.push([`Crimes:`, ]); } if (src.gang) { parts.push([`Gang:`, ]); } if (src.hacking) { parts.push([`Hacking:`, ]); } if (src.hacknetnode) { parts.push([`Hacknet Nodes:`, ]); } if (src.hospitalization) { parts.push([`Hospitalization:`, ]); } if (src.infiltration) { parts.push([`Infiltration:`, ]); } if (src.stock) { parts.push([`Stock Market:`, ]); } if (src.casino) { parts.push([`Casino:`, ]); } if (src.sleeves) { parts.push([`Sleeves:`, ]); } return ; } let content = ( <> Money earned since you last installed Augmentations
{convertMoneySourceTrackerToString(player.moneySourceA)} ); if (player.sourceFiles.length !== 0) { content = ( <> {content}

Money earned in this BitNode
{convertMoneySourceTrackerToString(player.moneySourceB)} ); } return ( {content} ); } export function CharacterStats(): React.ReactElement { const player = use.Player(); const [moneyOpen, setMoneyOpen] = useState(false); const setRerender = useState(false)[1]; function rerender(): void { setRerender((old) => !old); } useEffect(() => { const id = setInterval(rerender, 200); return () => clearInterval(id); }, []); const timeRows = [ ["Time played since last Augmentation:", convertTimeMsToTimeElapsedString(player.playtimeSinceLastAug)], ]; if (player.sourceFiles.length > 0) { timeRows.push([ "Time played since last Bitnode destroyed:", convertTimeMsToTimeElapsedString(player.playtimeSinceLastBitnode), ]); } timeRows.push(["Total Time played:", convertTimeMsToTimeElapsedString(player.totalPlaytime)]); return ( <> General Current City: {player.city} Money: setMoneyOpen(true)}>
Stats Hacking:  {numeralWrapper.formatSkill(player.hacking_skill)}  ({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










Misc {`Servers owned: ${player.purchasedServers.length} / ${getPurchaseServerLimit()}`} {`Augmentations installed: ${player.augmentations.length}`}
setMoneyOpen(false)} /> ); }