2021-09-27 02:55:38 +02:00
|
|
|
import React from "react";
|
2022-03-11 06:02:32 +01:00
|
|
|
|
2022-04-07 01:30:08 +02:00
|
|
|
import { Typography, Table, TableBody, TableCell, TableRow } from "@mui/material";
|
2021-09-27 02:55:38 +02:00
|
|
|
|
2022-03-11 06:02:32 +01:00
|
|
|
import { numeralWrapper } from "../../../ui/numeralFormat";
|
2022-03-08 03:03:23 +01:00
|
|
|
import { Settings } from "../../../Settings/Settings";
|
2022-03-12 22:49:07 +01:00
|
|
|
import { StatsRow } from "../../../ui/React/StatsRow";
|
2022-03-08 03:03:23 +01:00
|
|
|
import { characterOverviewStyles as useStyles } from "../../../ui/React/CharacterOverview";
|
|
|
|
import { Money } from "../../../ui/React/Money";
|
|
|
|
import { MoneyRate } from "../../../ui/React/MoneyRate";
|
|
|
|
import { ReputationRate } from "../../../ui/React/ReputationRate";
|
|
|
|
|
2022-03-11 06:02:32 +01:00
|
|
|
import { Sleeve } from "../Sleeve";
|
2022-07-28 02:37:32 +02:00
|
|
|
import { isSleeveClassWork } from "../Work/SleeveClassWork";
|
|
|
|
import { isSleeveFactionWork } from "../Work/SleeveFactionWork";
|
|
|
|
import { isSleeveCompanyWork } from "../Work/SleeveCompanyWork";
|
2022-07-28 08:46:34 +02:00
|
|
|
import { isSleeveCrimeWork } from "../Work/SleeveCrimeWork";
|
2022-08-25 17:18:01 +02:00
|
|
|
import { BitNodeMultipliers } from "../../../BitNode/BitNodeMultipliers";
|
2022-03-11 06:02:32 +01:00
|
|
|
|
2021-09-10 03:38:05 +02:00
|
|
|
interface IProps {
|
|
|
|
sleeve: Sleeve;
|
|
|
|
}
|
|
|
|
|
|
|
|
export function StatsElement(props: IProps): React.ReactElement {
|
2022-03-08 03:03:23 +01:00
|
|
|
const classes = useStyles();
|
|
|
|
|
|
|
|
return (
|
2022-04-07 01:30:08 +02:00
|
|
|
<Table sx={{ display: "table", mb: 1, width: "100%" }}>
|
2022-03-08 03:03:23 +01:00
|
|
|
<TableBody>
|
2022-03-12 22:49:07 +01:00
|
|
|
<StatsRow name="City" color={Settings.theme.primary} data={{ content: props.sleeve.city }} />
|
2022-04-07 01:30:08 +02:00
|
|
|
<StatsRow
|
|
|
|
name="HP"
|
|
|
|
color={Settings.theme.hp}
|
|
|
|
data={{
|
2022-07-27 05:54:17 +02:00
|
|
|
content: `${numeralWrapper.formatHp(props.sleeve.hp.current)} / ${numeralWrapper.formatHp(
|
|
|
|
props.sleeve.hp.max,
|
|
|
|
)}`,
|
2022-04-07 01:30:08 +02:00
|
|
|
}}
|
|
|
|
/>
|
|
|
|
<StatsRow
|
|
|
|
name="Hacking"
|
|
|
|
color={Settings.theme.hack}
|
2022-07-27 05:54:17 +02:00
|
|
|
data={{ level: props.sleeve.skills.hacking, exp: props.sleeve.exp.hacking }}
|
2022-04-07 01:30:08 +02:00
|
|
|
/>
|
|
|
|
<StatsRow
|
|
|
|
name="Strength"
|
|
|
|
color={Settings.theme.combat}
|
2022-07-27 05:54:17 +02:00
|
|
|
data={{ level: props.sleeve.skills.strength, exp: props.sleeve.exp.strength }}
|
2022-04-07 01:30:08 +02:00
|
|
|
/>
|
|
|
|
<StatsRow
|
|
|
|
name="Defense"
|
|
|
|
color={Settings.theme.combat}
|
2022-07-27 05:54:17 +02:00
|
|
|
data={{ level: props.sleeve.skills.defense, exp: props.sleeve.exp.defense }}
|
2022-04-07 01:30:08 +02:00
|
|
|
/>
|
|
|
|
<StatsRow
|
|
|
|
name="Dexterity"
|
|
|
|
color={Settings.theme.combat}
|
2022-07-27 05:54:17 +02:00
|
|
|
data={{ level: props.sleeve.skills.dexterity, exp: props.sleeve.exp.dexterity }}
|
2022-04-07 01:30:08 +02:00
|
|
|
/>
|
|
|
|
<StatsRow
|
|
|
|
name="Agility"
|
|
|
|
color={Settings.theme.combat}
|
2022-07-27 05:54:17 +02:00
|
|
|
data={{ level: props.sleeve.skills.agility, exp: props.sleeve.exp.agility }}
|
2022-04-07 01:30:08 +02:00
|
|
|
/>
|
|
|
|
<StatsRow
|
|
|
|
name="Charisma"
|
|
|
|
color={Settings.theme.cha}
|
2022-07-27 05:54:17 +02:00
|
|
|
data={{ level: props.sleeve.skills.charisma, exp: props.sleeve.exp.charisma }}
|
2022-03-11 05:47:18 +01:00
|
|
|
/>
|
2022-03-08 03:03:23 +01:00
|
|
|
<TableRow>
|
|
|
|
<TableCell classes={{ root: classes.cellNone }}>
|
|
|
|
<br />
|
|
|
|
</TableCell>
|
|
|
|
</TableRow>
|
2022-04-07 01:30:08 +02:00
|
|
|
<StatsRow
|
|
|
|
name="Shock"
|
|
|
|
color={Settings.theme.primary}
|
|
|
|
data={{ content: numeralWrapper.formatSleeveShock(100 - props.sleeve.shock) }}
|
|
|
|
/>
|
|
|
|
<StatsRow
|
|
|
|
name="Sync"
|
|
|
|
color={Settings.theme.primary}
|
|
|
|
data={{ content: numeralWrapper.formatSleeveSynchro(props.sleeve.sync) }}
|
|
|
|
/>
|
|
|
|
<StatsRow
|
|
|
|
name="Memory"
|
|
|
|
color={Settings.theme.primary}
|
|
|
|
data={{ content: numeralWrapper.formatSleeveMemory(props.sleeve.memory) }}
|
|
|
|
/>
|
2022-03-08 03:03:23 +01:00
|
|
|
</TableBody>
|
|
|
|
</Table>
|
2022-04-07 01:30:08 +02:00
|
|
|
);
|
2021-03-16 04:40:28 +01:00
|
|
|
}
|
2022-03-08 03:03:23 +01:00
|
|
|
|
|
|
|
export function EarningsElement(props: IProps): React.ReactElement {
|
|
|
|
const classes = useStyles();
|
|
|
|
|
2022-07-18 09:11:49 +02:00
|
|
|
let data: (string | JSX.Element)[][] = [];
|
2022-07-28 08:46:34 +02:00
|
|
|
if (isSleeveCrimeWork(props.sleeve.currentWork)) {
|
2022-10-08 16:19:20 +02:00
|
|
|
const gains = props.sleeve.currentWork.getExp(props.sleeve);
|
2022-03-08 03:03:23 +01:00
|
|
|
data = [
|
2022-08-25 23:27:39 +02:00
|
|
|
[`Money:`, <Money money={5 * gains.money} />],
|
2022-10-08 16:19:20 +02:00
|
|
|
[`Hacking Exp:`, `${numeralWrapper.formatExp(5 * gains.hackExp)}`],
|
|
|
|
[`Strength Exp:`, `${numeralWrapper.formatExp(5 * gains.strExp)}`],
|
|
|
|
[`Defense Exp:`, `${numeralWrapper.formatExp(5 * gains.defExp)}`],
|
|
|
|
[`Dexterity Exp:`, `${numeralWrapper.formatExp(5 * gains.dexExp)}`],
|
|
|
|
[`Agility Exp:`, `${numeralWrapper.formatExp(5 * gains.agiExp)}`],
|
|
|
|
[`Charisma Exp:`, `${numeralWrapper.formatExp(5 * gains.chaExp)}`],
|
2022-03-08 03:03:23 +01:00
|
|
|
];
|
|
|
|
}
|
2022-07-28 02:37:32 +02:00
|
|
|
if (isSleeveClassWork(props.sleeve.currentWork)) {
|
2022-09-06 15:07:12 +02:00
|
|
|
const rates = props.sleeve.currentWork.calculateRates(props.sleeve);
|
2022-07-28 02:37:32 +02:00
|
|
|
data = [
|
|
|
|
[`Money:`, <MoneyRate money={5 * rates.money} />],
|
2022-08-25 23:27:39 +02:00
|
|
|
[`Hacking Exp:`, `${numeralWrapper.formatExp(5 * rates.hackExp)} / sec`],
|
|
|
|
[`Strength Exp:`, `${numeralWrapper.formatExp(5 * rates.strExp)} / sec`],
|
|
|
|
[`Defense Exp:`, `${numeralWrapper.formatExp(5 * rates.defExp)} / sec`],
|
|
|
|
[`Dexterity Exp:`, `${numeralWrapper.formatExp(5 * rates.dexExp)} / sec`],
|
|
|
|
[`Agility Exp:`, `${numeralWrapper.formatExp(5 * rates.agiExp)} / sec`],
|
|
|
|
[`Charisma Exp:`, `${numeralWrapper.formatExp(5 * rates.chaExp)} / sec`],
|
2022-07-28 02:37:32 +02:00
|
|
|
];
|
|
|
|
}
|
|
|
|
if (isSleeveFactionWork(props.sleeve.currentWork)) {
|
|
|
|
const rates = props.sleeve.currentWork.getExpRates(props.sleeve);
|
|
|
|
const repGain = props.sleeve.currentWork.getReputationRate(props.sleeve);
|
|
|
|
data = [
|
2022-08-25 23:27:39 +02:00
|
|
|
[`Hacking Exp:`, `${numeralWrapper.formatExp(5 * rates.hackExp)} / sec`],
|
|
|
|
[`Strength Exp:`, `${numeralWrapper.formatExp(5 * rates.strExp)} / sec`],
|
|
|
|
[`Defense Exp:`, `${numeralWrapper.formatExp(5 * rates.defExp)} / sec`],
|
|
|
|
[`Dexterity Exp:`, `${numeralWrapper.formatExp(5 * rates.dexExp)} / sec`],
|
|
|
|
[`Agility Exp:`, `${numeralWrapper.formatExp(5 * rates.agiExp)} / sec`],
|
|
|
|
[`Charisma Exp:`, `${numeralWrapper.formatExp(5 * rates.chaExp)} / sec`],
|
|
|
|
[`Reputation:`, <ReputationRate reputation={repGain} />],
|
2022-07-28 02:37:32 +02:00
|
|
|
];
|
|
|
|
}
|
|
|
|
|
|
|
|
if (isSleeveCompanyWork(props.sleeve.currentWork)) {
|
2022-09-06 15:07:12 +02:00
|
|
|
const rates = props.sleeve.currentWork.getGainRates(props.sleeve);
|
2022-07-28 02:37:32 +02:00
|
|
|
data = [
|
2022-08-25 17:18:01 +02:00
|
|
|
[`Money:`, <MoneyRate money={5 * rates.money * BitNodeMultipliers.CompanyWorkMoney} />],
|
2022-08-25 23:27:39 +02:00
|
|
|
[`Hacking Exp:`, `${numeralWrapper.formatExp(5 * rates.hackExp)} / sec`],
|
|
|
|
[`Strength Exp:`, `${numeralWrapper.formatExp(5 * rates.strExp)} / sec`],
|
|
|
|
[`Defense Exp:`, `${numeralWrapper.formatExp(5 * rates.defExp)} / sec`],
|
|
|
|
[`Dexterity Exp:`, `${numeralWrapper.formatExp(5 * rates.dexExp)} / sec`],
|
|
|
|
[`Agility Exp:`, `${numeralWrapper.formatExp(5 * rates.agiExp)} / sec`],
|
|
|
|
[`Charisma Exp:`, `${numeralWrapper.formatExp(5 * rates.chaExp)} / sec`],
|
2022-07-28 02:37:32 +02:00
|
|
|
[`Reputation:`, <ReputationRate reputation={5 * rates.reputation} />],
|
|
|
|
];
|
|
|
|
}
|
2022-03-08 03:03:23 +01:00
|
|
|
|
|
|
|
return (
|
2022-04-07 01:30:08 +02:00
|
|
|
<Table sx={{ display: "table", mb: 1, width: "100%", lineHeight: 0 }}>
|
2022-03-08 03:03:23 +01:00
|
|
|
<TableBody>
|
|
|
|
<TableRow>
|
|
|
|
<TableCell classes={{ root: classes.cellNone }}>
|
2022-07-28 02:37:32 +02:00
|
|
|
<Typography variant="h6">Earnings {props.sleeve.storedCycles > 50 ? "(overclock)" : ""}</Typography>
|
2022-03-08 03:03:23 +01:00
|
|
|
</TableCell>
|
|
|
|
</TableRow>
|
|
|
|
{data.map(([a, b]) => (
|
|
|
|
<TableRow key={a.toString() + b.toString()}>
|
|
|
|
<TableCell classes={{ root: classes.cellNone }}>
|
|
|
|
<Typography>{a}</Typography>
|
|
|
|
</TableCell>
|
|
|
|
<TableCell align="right" classes={{ root: classes.cellNone }}>
|
|
|
|
<Typography>{b}</Typography>
|
|
|
|
</TableCell>
|
|
|
|
</TableRow>
|
|
|
|
))}
|
|
|
|
</TableBody>
|
|
|
|
</Table>
|
2022-04-07 01:30:08 +02:00
|
|
|
);
|
2022-03-11 05:21:02 +01:00
|
|
|
}
|