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 { MaxNumberHacknetServers } from "../Hacknet/HacknetServer";
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:
{Object.keys(p.jobs).map(j =>
* {j}
)}
>
return <>>;
}
function convertMoneySourceTrackerToString(src: MoneySourceTracker): string {
let parts: string[] = [`Total: ${numeralWrapper.formatMoney(src.total)}`];
if (src.bladeburner) { parts.push(`Bladeburner: ${numeralWrapper.formatMoney(src.bladeburner)}`) };
if (src.codingcontract) { parts.push(`Coding Contracts: ${numeralWrapper.formatMoney(src.codingcontract)}`) };
if (src.work) { parts.push(`Company Work: ${numeralWrapper.formatMoney(src.work)}`) };
if (src.corporation) { parts.push(`Corporation: ${numeralWrapper.formatMoney(src.corporation)}`) };
if (src.crime) { parts.push(`Crimes: ${numeralWrapper.formatMoney(src.crime)}`) };
if (src.gang) { parts.push(`Gang: ${numeralWrapper.formatMoney(src.gang)}`) };
if (src.hacking) { parts.push(`Hacking: ${numeralWrapper.formatMoney(src.hacking)}`) };
if (src.hacknetnode) { parts.push(`Hacknet Nodes: ${numeralWrapper.formatMoney(src.hacknetnode)}`) };
if (src.hospitalization) { parts.push(`Hospitalization: ${numeralWrapper.formatMoney(src.hospitalization)}`) };
if (src.infiltration) { parts.push(`Infiltration: ${numeralWrapper.formatMoney(src.infiltration)}`) };
if (src.stock) { parts.push(`Stock Market: ${numeralWrapper.formatMoney(src.stock)}`) };
return parts.join(" ");
}
function openMoneyModal() {
let txt: string = "Money earned since you last installed Augmentations: " +
convertMoneySourceTrackerToString(p.moneySourceA);
if (p.sourceFiles.length !== 0) {
txt += "
Money earned in this BitNode: " +
convertMoneySourceTrackerToString(p.moneySourceB);
}
dialogBoxCreate(txt, false);
}
function Intelligence(): React.ReactElement {
if (p.intelligence > 0) {
return
Servers owned: {p.purchasedServers.length} / {getPurchaseServerLimit()} Hacknet Nodes owned: {p.hacknetNodes.length} Augmentations installed: {p.augmentations.length} Time played since last Augmentation: {convertTimeMsToTimeElapsedString(p.playtimeSinceLastAug)} Time played: {convertTimeMsToTimeElapsedString(p.totalPlaytime)}