2021-03-07 21:58:52 +01:00
|
|
|
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";
|
2021-03-31 06:45:21 +02:00
|
|
|
import { HacknetServerConstants } from "../Hacknet/data/Constants";
|
|
|
|
import { StatsTable } from "./React/StatsTable";
|
|
|
|
import { Money } from "./React/Money";
|
2021-03-07 21:58:52 +01:00
|
|
|
|
|
|
|
export function CharacterInfo(p: IPlayer): React.ReactElement {
|
2021-09-05 01:09:30 +02:00
|
|
|
function LastEmployer(): React.ReactElement {
|
|
|
|
if (p.companyName) {
|
|
|
|
return (
|
|
|
|
<>
|
|
|
|
<span>Employer at which you last worked: {p.companyName}</span>
|
|
|
|
<br />
|
|
|
|
</>
|
|
|
|
);
|
2021-03-07 21:58:52 +01:00
|
|
|
}
|
2021-09-05 01:09:30 +02:00
|
|
|
return <></>;
|
|
|
|
}
|
|
|
|
function LastJob(): React.ReactElement {
|
|
|
|
if (p.companyName !== "") {
|
|
|
|
return (
|
|
|
|
<>
|
|
|
|
<span>Job you last worked: {p.jobs[p.companyName]}</span>
|
|
|
|
<br />
|
|
|
|
</>
|
|
|
|
);
|
2021-03-07 21:58:52 +01:00
|
|
|
}
|
2021-09-05 01:09:30 +02:00
|
|
|
return <></>;
|
|
|
|
}
|
|
|
|
function Employers(): React.ReactElement {
|
|
|
|
if (p.jobs && Object.keys(p.jobs).length !== 0)
|
|
|
|
return (
|
|
|
|
<>
|
|
|
|
<span>All Employers:</span>
|
|
|
|
<br />
|
|
|
|
<ul>
|
|
|
|
{Object.keys(p.jobs).map((j) => (
|
|
|
|
<li key={j}> * {j}</li>
|
|
|
|
))}
|
|
|
|
</ul>
|
|
|
|
<br />
|
|
|
|
<br />
|
|
|
|
</>
|
|
|
|
);
|
|
|
|
return <></>;
|
|
|
|
}
|
2021-03-07 21:58:52 +01:00
|
|
|
|
2021-09-05 01:09:30 +02:00
|
|
|
function Hacknet(): React.ReactElement {
|
|
|
|
// Can't import HacknetHelpers for some reason.
|
|
|
|
if (!(p.bitNodeN === 9 || SourceFileFlags[9] > 0)) {
|
|
|
|
return (
|
|
|
|
<>
|
|
|
|
<span>{`Hacknet Nodes owned: ${p.hacknetNodes.length}`}</span>
|
|
|
|
<br />
|
|
|
|
</>
|
|
|
|
);
|
|
|
|
} else {
|
|
|
|
return (
|
|
|
|
<>
|
|
|
|
<span>{`Hacknet Servers owned: ${p.hacknetNodes.length} / ${HacknetServerConstants.MaxServers}`}</span>
|
|
|
|
<br />
|
|
|
|
</>
|
|
|
|
);
|
2021-03-31 06:45:21 +02:00
|
|
|
}
|
2021-09-05 01:09:30 +02:00
|
|
|
}
|
2021-03-31 06:45:21 +02:00
|
|
|
|
2021-09-09 05:47:34 +02:00
|
|
|
function convertMoneySourceTrackerToString(src: MoneySourceTracker): React.ReactElement {
|
2021-09-05 01:09:30 +02:00
|
|
|
const parts: any[][] = [[`Total:`, <Money money={src.total} />]];
|
|
|
|
if (src.bladeburner) {
|
|
|
|
parts.push([`Bladeburner:`, <Money money={src.bladeburner} />]);
|
2021-03-07 21:58:52 +01:00
|
|
|
}
|
2021-09-05 01:09:30 +02:00
|
|
|
if (src.codingcontract) {
|
|
|
|
parts.push([`Coding Contracts:`, <Money money={src.codingcontract} />]);
|
2021-03-07 21:58:52 +01:00
|
|
|
}
|
2021-09-05 01:09:30 +02:00
|
|
|
if (src.work) {
|
|
|
|
parts.push([`Company Work:`, <Money money={src.work} />]);
|
|
|
|
}
|
|
|
|
if (src.class) {
|
|
|
|
parts.push([`Class:`, <Money money={src.class} />]);
|
|
|
|
}
|
|
|
|
if (src.corporation) {
|
|
|
|
parts.push([`Corporation:`, <Money money={src.corporation} />]);
|
|
|
|
}
|
|
|
|
if (src.crime) {
|
|
|
|
parts.push([`Crimes:`, <Money money={src.crime} />]);
|
|
|
|
}
|
|
|
|
if (src.gang) {
|
|
|
|
parts.push([`Gang:`, <Money money={src.gang} />]);
|
|
|
|
}
|
|
|
|
if (src.hacking) {
|
|
|
|
parts.push([`Hacking:`, <Money money={src.hacking} />]);
|
|
|
|
}
|
|
|
|
if (src.hacknetnode) {
|
|
|
|
parts.push([`Hacknet Nodes:`, <Money money={src.hacknetnode} />]);
|
|
|
|
}
|
|
|
|
if (src.hospitalization) {
|
|
|
|
parts.push([`Hospitalization:`, <Money money={src.hospitalization} />]);
|
|
|
|
}
|
|
|
|
if (src.infiltration) {
|
|
|
|
parts.push([`Infiltration:`, <Money money={src.infiltration} />]);
|
|
|
|
}
|
|
|
|
if (src.stock) {
|
|
|
|
parts.push([`Stock Market:`, <Money money={src.stock} />]);
|
|
|
|
}
|
|
|
|
if (src.casino) {
|
|
|
|
parts.push([`Casino:`, <Money money={src.casino} />]);
|
|
|
|
}
|
|
|
|
if (src.sleeves) {
|
|
|
|
parts.push([`Sleeves:`, <Money money={src.sleeves} />]);
|
2021-03-07 21:58:52 +01:00
|
|
|
}
|
|
|
|
|
2021-09-05 01:09:30 +02:00
|
|
|
return StatsTable(parts);
|
|
|
|
}
|
|
|
|
|
|
|
|
function openMoneyModal(): void {
|
|
|
|
let content = (
|
|
|
|
<>
|
|
|
|
<u>Money earned since you last installed Augmentations:</u>
|
|
|
|
<br />
|
|
|
|
{convertMoneySourceTrackerToString(p.moneySourceA)}
|
|
|
|
</>
|
|
|
|
);
|
|
|
|
if (p.sourceFiles.length !== 0) {
|
|
|
|
content = (
|
|
|
|
<>
|
|
|
|
{content}
|
|
|
|
<br />
|
|
|
|
<br />
|
|
|
|
<u>Money earned in this BitNode:</u>
|
|
|
|
<br />
|
|
|
|
{convertMoneySourceTrackerToString(p.moneySourceB)}
|
2021-03-07 21:58:52 +01:00
|
|
|
</>
|
2021-09-05 01:09:30 +02:00
|
|
|
);
|
2021-03-07 21:58:52 +01:00
|
|
|
}
|
|
|
|
|
2021-09-05 01:09:30 +02:00
|
|
|
dialogBoxCreate(content, false);
|
|
|
|
}
|
|
|
|
|
|
|
|
function Intelligence(): React.ReactElement {
|
|
|
|
if (p.intelligence > 0 && (p.bitNodeN === 5 || SourceFileFlags[5] > 0)) {
|
|
|
|
return (
|
|
|
|
<tr key="5">
|
|
|
|
<td>Intelligence:</td>
|
2021-09-09 05:47:34 +02:00
|
|
|
<td style={{ textAlign: "right" }}>{numeralWrapper.formatSkill(p.intelligence)}</td>
|
2021-09-05 01:09:30 +02:00
|
|
|
</tr>
|
|
|
|
);
|
2021-05-08 03:24:16 +02:00
|
|
|
}
|
2021-09-05 01:09:30 +02:00
|
|
|
return <></>;
|
|
|
|
}
|
2021-05-08 03:24:16 +02:00
|
|
|
|
2021-09-05 01:09:30 +02:00
|
|
|
function MultiplierTable(props: any): React.ReactElement {
|
|
|
|
function bn5Stat(r: any): JSX.Element {
|
|
|
|
if (SourceFileFlags[5] > 0 && r.length > 2 && r[1] != r[2]) {
|
|
|
|
return (
|
|
|
|
<td key="2" style={{ textAlign: "right" }}>
|
|
|
|
{" "}
|
|
|
|
({numeralWrapper.formatPercentage(r[2])})
|
|
|
|
</td>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
return <></>;
|
|
|
|
}
|
|
|
|
return (
|
|
|
|
<>
|
|
|
|
<table>
|
|
|
|
<tbody>
|
|
|
|
{props.rows.map((r: any) => (
|
|
|
|
<tr key={r[0]}>
|
|
|
|
<td key="0">{`${r[0]} multiplier:`}</td>
|
|
|
|
<td key="1" style={{ textAlign: "right", paddingLeft: "5px" }}>
|
|
|
|
{numeralWrapper.formatPercentage(r[1])}
|
|
|
|
</td>
|
|
|
|
{bn5Stat(r)}
|
|
|
|
</tr>
|
|
|
|
))}
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
</>
|
|
|
|
);
|
|
|
|
}
|
2021-03-07 21:58:52 +01:00
|
|
|
|
2021-09-05 01:09:30 +02:00
|
|
|
function BladeburnerMults(): React.ReactElement {
|
|
|
|
if (!p.canAccessBladeburner()) return <></>;
|
|
|
|
return (
|
|
|
|
<>
|
|
|
|
<MultiplierTable
|
|
|
|
rows={[
|
|
|
|
["Bladeburner Success Chance", p.bladeburner_max_stamina_mult],
|
|
|
|
["Bladeburner Max Stamina", p.bladeburner_stamina_gain_mult],
|
|
|
|
["Bladeburner Stamina Gain", p.bladeburner_analysis_mult],
|
|
|
|
["Bladeburner Field Analysis", p.bladeburner_success_chance_mult],
|
|
|
|
]}
|
|
|
|
/>
|
|
|
|
<br />
|
|
|
|
</>
|
|
|
|
);
|
|
|
|
}
|
2021-03-07 21:58:52 +01:00
|
|
|
|
2021-09-05 01:09:30 +02:00
|
|
|
function CurrentBitNode(): React.ReactElement {
|
|
|
|
if (p.sourceFiles.length > 0) {
|
|
|
|
const index = "BitNode" + p.bitNodeN;
|
|
|
|
return (
|
|
|
|
<>
|
|
|
|
<span>
|
|
|
|
Current BitNode: {p.bitNodeN} ({BitNodes[index].name})
|
|
|
|
</span>
|
|
|
|
<br />
|
|
|
|
<br />
|
|
|
|
<div style={{ width: "60%", fontSize: "13px", marginLeft: "4%" }}>
|
|
|
|
{BitNodes[index].info.split("<br>").map((t, i) => (
|
|
|
|
<div key={i}>
|
2021-09-09 05:47:34 +02:00
|
|
|
<span style={{ whiteSpace: "pre-wrap", overflowWrap: "break-word" }}>{t}</span>
|
2021-09-05 01:09:30 +02:00
|
|
|
<br />
|
|
|
|
</div>
|
|
|
|
))}
|
|
|
|
</div>
|
|
|
|
</>
|
|
|
|
);
|
2021-03-07 21:58:52 +01:00
|
|
|
}
|
|
|
|
|
2021-09-05 01:09:30 +02:00
|
|
|
return <></>;
|
|
|
|
}
|
2021-03-31 06:45:21 +02:00
|
|
|
|
2021-09-09 05:47:34 +02:00
|
|
|
const timeRows = [["Time played since last Augmentation:", convertTimeMsToTimeElapsedString(p.playtimeSinceLastAug)]];
|
2021-09-05 01:09:30 +02:00
|
|
|
if (p.sourceFiles.length > 0) {
|
|
|
|
timeRows.push([
|
|
|
|
"Time played since last Bitnode destroyed:",
|
|
|
|
convertTimeMsToTimeElapsedString(p.playtimeSinceLastBitnode),
|
|
|
|
]);
|
|
|
|
}
|
2021-09-09 05:47:34 +02:00
|
|
|
timeRows.push(["Total Time played:", convertTimeMsToTimeElapsedString(p.totalPlaytime)]);
|
2021-09-05 01:09:30 +02:00
|
|
|
|
|
|
|
return (
|
|
|
|
<pre>
|
|
|
|
<b>General</b>
|
|
|
|
<br />
|
|
|
|
<br />
|
|
|
|
<span>Current City: {p.city}</span>
|
|
|
|
<br />
|
|
|
|
<LastEmployer />
|
|
|
|
<LastJob />
|
|
|
|
<Employers />
|
|
|
|
<span>
|
|
|
|
Money: <Money money={p.money.toNumber()} />
|
|
|
|
</span>
|
2021-09-09 05:47:34 +02:00
|
|
|
<button className="popup-box-button" style={{ display: "inline-block", float: "none" }} onClick={openMoneyModal}>
|
2021-09-05 01:09:30 +02:00
|
|
|
Money Statistics & Breakdown
|
|
|
|
</button>
|
|
|
|
<br />
|
|
|
|
<br />
|
|
|
|
<b>Stats</b>
|
|
|
|
<table>
|
|
|
|
<tbody>
|
|
|
|
<tr key="0">
|
|
|
|
<td key="0">Hacking:</td>
|
|
|
|
<td key="1" style={{ textAlign: "right" }}>
|
|
|
|
{numeralWrapper.formatSkill(p.hacking_skill)}
|
|
|
|
</td>
|
|
|
|
<td key="2" style={{ textAlign: "right" }}>
|
|
|
|
({numeralWrapper.formatExp(p.hacking_exp)} exp)
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
<tr key="1">
|
|
|
|
<td key="0">Strength:</td>
|
|
|
|
<td key="1" style={{ textAlign: "right" }}>
|
|
|
|
{numeralWrapper.formatSkill(p.strength)}
|
|
|
|
</td>
|
|
|
|
<td key="2" style={{ textAlign: "right" }}>
|
|
|
|
({numeralWrapper.formatExp(p.strength_exp)} exp)
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
<tr key="2">
|
|
|
|
<td key="0">Defense:</td>
|
|
|
|
<td key="1" style={{ textAlign: "right" }}>
|
|
|
|
{numeralWrapper.formatSkill(p.defense)}
|
|
|
|
</td>
|
|
|
|
<td key="2" style={{ textAlign: "right" }}>
|
|
|
|
({numeralWrapper.formatExp(p.defense_exp)} exp)
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
<tr key="3">
|
|
|
|
<td key="0">Dexterity:</td>
|
|
|
|
<td key="1" style={{ textAlign: "right" }}>
|
|
|
|
{numeralWrapper.formatSkill(p.dexterity)}
|
|
|
|
</td>
|
|
|
|
<td key="2" style={{ textAlign: "right" }}>
|
|
|
|
({numeralWrapper.formatExp(p.dexterity_exp)} exp)
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
<tr key="4">
|
|
|
|
<td key="0">Agility:</td>
|
|
|
|
<td key="1" style={{ textAlign: "right" }}>
|
|
|
|
{numeralWrapper.formatSkill(p.agility)}
|
|
|
|
</td>
|
|
|
|
<td key="2" style={{ textAlign: "right" }}>
|
|
|
|
({numeralWrapper.formatExp(p.agility_exp)} exp)
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
<tr key="5">
|
|
|
|
<td key="0">Charisma:</td>
|
|
|
|
<td key="1" style={{ textAlign: "right" }}>
|
|
|
|
{numeralWrapper.formatSkill(p.charisma)}
|
|
|
|
</td>
|
|
|
|
<td key="2" style={{ textAlign: "right" }}>
|
|
|
|
({numeralWrapper.formatExp(p.charisma_exp)} exp)
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
<Intelligence />
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
<br />
|
|
|
|
<MultiplierTable
|
|
|
|
rows={[
|
|
|
|
["Hacking Chance", p.hacking_chance_mult],
|
|
|
|
["Hacking Speed", p.hacking_speed_mult],
|
2021-09-09 05:47:34 +02:00
|
|
|
["Hacking Money", p.hacking_money_mult, p.hacking_money_mult * BitNodeMultipliers.ScriptHackMoney],
|
|
|
|
["Hacking Growth", p.hacking_grow_mult, p.hacking_grow_mult * BitNodeMultipliers.ServerGrowthRate],
|
2021-09-05 01:09:30 +02:00
|
|
|
]}
|
|
|
|
/>
|
|
|
|
<br />
|
|
|
|
<MultiplierTable
|
|
|
|
rows={[
|
2021-09-09 05:47:34 +02:00
|
|
|
["Hacking Level", p.hacking_mult, p.hacking_mult * BitNodeMultipliers.HackingLevelMultiplier],
|
|
|
|
["Hacking Experience", p.hacking_exp_mult, p.hacking_exp_mult * BitNodeMultipliers.HackExpGain],
|
2021-09-05 01:09:30 +02:00
|
|
|
]}
|
|
|
|
/>
|
|
|
|
<br />
|
2021-03-07 21:58:52 +01:00
|
|
|
|
2021-09-05 01:09:30 +02:00
|
|
|
<MultiplierTable
|
|
|
|
rows={[
|
2021-09-09 05:47:34 +02:00
|
|
|
["Strength Level", p.strength_mult, p.strength_mult * BitNodeMultipliers.StrengthLevelMultiplier],
|
2021-09-05 01:09:30 +02:00
|
|
|
["Strength Experience", p.strength_exp_mult],
|
|
|
|
]}
|
|
|
|
/>
|
|
|
|
<br />
|
2021-03-07 21:58:52 +01:00
|
|
|
|
2021-09-05 01:09:30 +02:00
|
|
|
<MultiplierTable
|
|
|
|
rows={[
|
2021-09-09 05:47:34 +02:00
|
|
|
["Defense Level", p.defense_mult, p.defense_mult * BitNodeMultipliers.DefenseLevelMultiplier],
|
2021-09-05 01:09:30 +02:00
|
|
|
["Defense Experience", p.defense_exp_mult],
|
|
|
|
]}
|
|
|
|
/>
|
|
|
|
<br />
|
2021-03-07 21:58:52 +01:00
|
|
|
|
2021-09-05 01:09:30 +02:00
|
|
|
<MultiplierTable
|
|
|
|
rows={[
|
2021-09-09 05:47:34 +02:00
|
|
|
["Dexterity Level", p.dexterity_mult, p.dexterity_mult * BitNodeMultipliers.DexterityLevelMultiplier],
|
2021-09-05 01:09:30 +02:00
|
|
|
["Dexterity Experience", p.dexterity_exp_mult],
|
|
|
|
]}
|
|
|
|
/>
|
|
|
|
<br />
|
2021-03-07 21:58:52 +01:00
|
|
|
|
2021-09-05 01:09:30 +02:00
|
|
|
<MultiplierTable
|
|
|
|
rows={[
|
2021-09-09 05:47:34 +02:00
|
|
|
["Agility Level", p.agility_mult, p.agility_mult * BitNodeMultipliers.AgilityLevelMultiplier],
|
2021-09-05 01:09:30 +02:00
|
|
|
["Agility Experience", p.agility_exp_mult],
|
|
|
|
]}
|
|
|
|
/>
|
|
|
|
<br />
|
2021-03-07 21:58:52 +01:00
|
|
|
|
2021-09-05 01:09:30 +02:00
|
|
|
<MultiplierTable
|
|
|
|
rows={[
|
2021-09-09 05:47:34 +02:00
|
|
|
["Charisma Level", p.charisma_mult, p.charisma_mult * BitNodeMultipliers.CharismaLevelMultiplier],
|
2021-09-05 01:09:30 +02:00
|
|
|
["Charisma Experience", p.charisma_exp_mult],
|
|
|
|
]}
|
|
|
|
/>
|
|
|
|
<br />
|
2021-03-07 21:58:52 +01:00
|
|
|
|
2021-09-05 01:09:30 +02:00
|
|
|
<MultiplierTable
|
|
|
|
rows={[
|
|
|
|
[
|
|
|
|
"Hacknet Node production",
|
|
|
|
p.hacknet_node_money_mult,
|
|
|
|
p.hacknet_node_money_mult * BitNodeMultipliers.HacknetNodeMoney,
|
|
|
|
],
|
|
|
|
["Hacknet Node purchase cost", p.hacknet_node_purchase_cost_mult],
|
|
|
|
["Hacknet Node RAM upgrade cost", p.hacknet_node_ram_cost_mult],
|
|
|
|
["Hacknet Node Core purchase cost", p.hacknet_node_core_cost_mult],
|
|
|
|
["Hacknet Node level upgrade cost", p.hacknet_node_level_cost_mult],
|
|
|
|
]}
|
|
|
|
/>
|
|
|
|
<br />
|
2021-03-07 21:58:52 +01:00
|
|
|
|
2021-09-05 01:09:30 +02:00
|
|
|
<MultiplierTable
|
|
|
|
rows={[
|
|
|
|
["Company reputation gain", p.company_rep_mult],
|
2021-09-09 05:47:34 +02:00
|
|
|
["Faction reputation gain", p.faction_rep_mult, p.faction_rep_mult * BitNodeMultipliers.FactionWorkRepGain],
|
|
|
|
["Salary", p.work_money_mult, p.work_money_mult * BitNodeMultipliers.CompanyWorkMoney],
|
2021-09-05 01:09:30 +02:00
|
|
|
]}
|
|
|
|
/>
|
|
|
|
<br />
|
2021-03-07 21:58:52 +01:00
|
|
|
|
2021-09-05 01:09:30 +02:00
|
|
|
<MultiplierTable
|
|
|
|
rows={[
|
|
|
|
["Crime success", p.crime_success_mult],
|
2021-09-09 05:47:34 +02:00
|
|
|
["Crime money", p.crime_money_mult, p.crime_money_mult * BitNodeMultipliers.CrimeMoney],
|
2021-09-05 01:09:30 +02:00
|
|
|
]}
|
|
|
|
/>
|
|
|
|
<br />
|
2021-05-08 03:24:16 +02:00
|
|
|
|
2021-09-05 01:09:30 +02:00
|
|
|
<BladeburnerMults />
|
|
|
|
<br />
|
2021-03-07 21:58:52 +01:00
|
|
|
|
2021-09-05 01:09:30 +02:00
|
|
|
<b>Misc.</b>
|
|
|
|
<br />
|
|
|
|
<br />
|
2021-09-09 05:47:34 +02:00
|
|
|
<span>{`Servers owned: ${p.purchasedServers.length} / ${getPurchaseServerLimit()}`}</span>
|
2021-09-05 01:09:30 +02:00
|
|
|
<br />
|
|
|
|
<Hacknet />
|
|
|
|
<span>{`Augmentations installed: ${p.augmentations.length}`}</span>
|
|
|
|
<br />
|
|
|
|
<br />
|
|
|
|
{StatsTable(timeRows)}
|
|
|
|
<br />
|
|
|
|
<CurrentBitNode />
|
|
|
|
</pre>
|
|
|
|
);
|
|
|
|
}
|