import * as React from "react"; import { numeralWrapper } from "../ui/numeralFormat"; import { BitNodes } from "../BitNode/BitNode"; import { IPlayer } from "../PersonObjects/IPlayer"; import { MoneySourceTracker } from "../utils/MoneySourceTracker"; import { dialogBoxCreate } from "../../utils/DialogBox"; 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"; export function CharacterInfo(p: IPlayer): React.ReactElement { function LastEmployer(): React.ReactElement { if (p.companyName) { return <>Employer at which you last worked: {p.companyName}
; } return <>; } function LastJob(): React.ReactElement { if (p.companyName !== "") { return <>Job you last worked: {p.jobs[p.companyName]}
; } return <>; } function Employers(): React.ReactElement { if (p.jobs && Object.keys(p.jobs).length !== 0) return <> All Employers:


return <>; } function Hacknet(): React.ReactElement { // Can't import HacknetHelpers for some reason. if(!(p.bitNodeN === 9 || SourceFileFlags[9] > 0)) { return <>Hacknet Nodes owned: {p.hacknetNodes.length}
} else { return <>Hacknet Servers owned: {p.hacknetNodes.length} / {HacknetServerConstants.MaxServers}
} } function convertMoneySourceTrackerToString(src: MoneySourceTracker): React.ReactElement { let parts: any[][] = [[`Total:`, Money(src.total)]]; if (src.bladeburner) { parts.push([`Bladeburner:`, Money(src.bladeburner)]) }; if (src.codingcontract) { parts.push([`Coding Contracts:`, Money(src.codingcontract)]) }; if (src.work) { parts.push([`Company Work:`, Money(src.work)]) }; if (src.corporation) { parts.push([`Corporation:`, Money(src.corporation)]) }; if (src.crime) { parts.push([`Crimes:`, Money(src.crime)]) }; if (src.gang) { parts.push([`Gang:`, Money(src.gang)]) }; if (src.hacking) { parts.push([`Hacking:`, Money(src.hacking)]) }; if (src.hacknetnode) { parts.push([`Hacknet Nodes:`, Money(src.hacknetnode)]) }; if (src.hospitalization) { parts.push([`Hospitalization:`, Money(src.hospitalization)]) }; if (src.infiltration) { parts.push([`Infiltration:`, Money(src.infiltration)]) }; if (src.stock) { parts.push([`Stock Market:`, Money(src.stock)]) }; return StatsTable(parts, ""); } function openMoneyModal() { let content = (<> Money earned since you last installed Augmentations:
{convertMoneySourceTrackerToString(p.moneySourceA)} ); if (p.sourceFiles.length !== 0) { content = (<>{content}

Money earned in this BitNode:
{convertMoneySourceTrackerToString(p.moneySourceB)}); } dialogBoxCreate(content, false); } function Intelligence(): React.ReactElement { if (p.intelligence > 0) { return Intelligence: {numeralWrapper.formatSkill(p.intelligence)} ; } return <>; } function MultiplierTable(props: any): React.ReactElement { function bn5Stat(r: any) { if(SourceFileFlags[5] > 0 && r.length > 2 && r[1] != r[2]) { return ({numeralWrapper.formatPercentage(r[2])}) } return <>; } return <> {props.rows.map((r: any) => {bn5Stat(r)} )}
{r[0]} multiplier: {numeralWrapper.formatPercentage(r[1])}
} function CurrentBitNode(): React.ReactElement { if(p.sourceFiles.length > 0) { const index = "BitNode" + p.bitNodeN; return <> Current BitNode: {p.bitNodeN} ({BitNodes[index].name})

{BitNodes[index].info.split("
").map((t, i) =>
{t}
)}
} return <> } const timeRows = [ ['Time played since last Augmentation:', convertTimeMsToTimeElapsedString(p.playtimeSinceLastAug)], ] if(p.sourceFiles.length > 0) { timeRows.push(['Time played since last Bitnode destroyed:', convertTimeMsToTimeElapsedString(p.playtimeSinceLastBitnode)]); } timeRows.push(['Total Time played:', convertTimeMsToTimeElapsedString(p.totalPlaytime)]) return (
            General
            

Current City: {p.city}
Money: {Money(p.money.toNumber())}

Stats
Hacking: {numeralWrapper.formatSkill(p.hacking_skill)} ({numeralWrapper.formatExp(p.hacking_exp)} exp)
Strength: {numeralWrapper.formatSkill(p.strength)} ({numeralWrapper.formatExp(p.strength_exp)} exp)
Defense: {numeralWrapper.formatSkill(p.defense)} ({numeralWrapper.formatExp(p.defense_exp)} exp)
Dexterity: {numeralWrapper.formatSkill(p.dexterity)} ({numeralWrapper.formatExp(p.dexterity_exp)} exp)
Agility: {numeralWrapper.formatSkill(p.agility)} ({numeralWrapper.formatExp(p.agility_exp)} exp)
Charisma: {numeralWrapper.formatSkill(p.charisma)} ({numeralWrapper.formatExp(p.charisma_exp)} exp)












Misc.

Servers owned: {p.purchasedServers.length} / {getPurchaseServerLimit()}
Augmentations installed: {p.augmentations.length}

{StatsTable(timeRows, null)}
) }