2021-06-18 22:22:12 +02:00
|
|
|
import React, { useState, useEffect } from "react";
|
2021-09-25 20:42:57 +02:00
|
|
|
import { formatNumber, convertTimeMsToTimeElapsedString } from "../../utils/StringHelperFunctions";
|
2021-06-18 22:22:12 +02:00
|
|
|
import { BladeburnerConstants } from "../data/Constants";
|
|
|
|
import { IPlayer } from "../../PersonObjects/IPlayer";
|
|
|
|
import { Money } from "../../ui/React/Money";
|
|
|
|
import { StatsTable } from "../../ui/React/StatsTable";
|
|
|
|
import { numeralWrapper } from "../../ui/numeralFormat";
|
2021-08-16 03:49:08 +02:00
|
|
|
import { Factions } from "../../Faction/Factions";
|
2021-09-18 01:43:08 +02:00
|
|
|
import { IRouter } from "../../ui/Router";
|
|
|
|
import { joinFaction } from "../../Faction/FactionHelpers";
|
2021-09-05 01:09:30 +02:00
|
|
|
import { IBladeburner } from "../IBladeburner";
|
2021-08-16 03:49:08 +02:00
|
|
|
|
2021-09-27 23:09:48 +02:00
|
|
|
import { TravelModal } from "./TravelModal";
|
|
|
|
import Typography from "@mui/material/Typography";
|
|
|
|
import Tooltip from "@mui/material/Tooltip";
|
|
|
|
import Box from "@mui/material/Box";
|
|
|
|
import Button from "@mui/material/Button";
|
|
|
|
import Paper from "@mui/material/Paper";
|
2021-06-18 22:22:12 +02:00
|
|
|
|
|
|
|
interface IProps {
|
2021-09-05 01:09:30 +02:00
|
|
|
bladeburner: IBladeburner;
|
2021-09-18 01:43:08 +02:00
|
|
|
router: IRouter;
|
2021-09-05 01:09:30 +02:00
|
|
|
player: IPlayer;
|
2021-06-18 22:22:12 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
export function Stats(props: IProps): React.ReactElement {
|
2021-09-27 23:09:48 +02:00
|
|
|
const [travelOpen, setTravelOpen] = useState(false);
|
2021-09-05 01:09:30 +02:00
|
|
|
const setRerender = useState(false)[1];
|
2021-06-18 22:22:12 +02:00
|
|
|
|
2021-09-27 23:09:48 +02:00
|
|
|
const inFaction = props.bladeburner.rank >= BladeburnerConstants.RankNeededForFaction;
|
2021-09-05 01:09:30 +02:00
|
|
|
useEffect(() => {
|
|
|
|
const id = setInterval(() => setRerender((old) => !old), 1000);
|
|
|
|
return () => clearInterval(id);
|
|
|
|
}, []);
|
2021-06-18 22:22:12 +02:00
|
|
|
|
2021-09-05 01:09:30 +02:00
|
|
|
function openFaction(): void {
|
2021-09-27 23:09:48 +02:00
|
|
|
if (!inFaction) return;
|
2021-09-05 01:09:30 +02:00
|
|
|
const faction = Factions["Bladeburners"];
|
2021-09-27 23:09:48 +02:00
|
|
|
if (!faction.isMember) {
|
|
|
|
joinFaction(faction);
|
2021-08-10 17:25:21 +02:00
|
|
|
}
|
2021-09-27 23:09:48 +02:00
|
|
|
|
|
|
|
props.router.toFaction(faction);
|
2021-09-05 01:09:30 +02:00
|
|
|
}
|
2021-08-10 17:25:21 +02:00
|
|
|
|
2021-09-05 01:09:30 +02:00
|
|
|
return (
|
2021-09-27 23:09:48 +02:00
|
|
|
<Paper sx={{ p: 1 }}>
|
|
|
|
<Box display="flex">
|
|
|
|
<Tooltip disableInteractive title={<Typography>Your rank within the Bladeburner division.</Typography>}>
|
|
|
|
<Typography>Rank: {formatNumber(props.bladeburner.rank, 2)}</Typography>
|
|
|
|
</Tooltip>
|
|
|
|
</Box>
|
2021-09-05 01:09:30 +02:00
|
|
|
<br />
|
2021-09-27 23:09:48 +02:00
|
|
|
<Box display="flex">
|
|
|
|
<Tooltip
|
|
|
|
disableInteractive
|
|
|
|
title={
|
|
|
|
<Typography>
|
|
|
|
Performing actions will use up your stamina.
|
|
|
|
<br />
|
|
|
|
<br />
|
|
|
|
Your max stamina is determined primarily by your agility stat.
|
|
|
|
<br />
|
|
|
|
<br />
|
|
|
|
Your stamina gain rate is determined by both your agility and your max stamina. Higher max stamina leads
|
|
|
|
to a higher gain rate.
|
|
|
|
<br />
|
|
|
|
<br />
|
|
|
|
Once your stamina falls below 50% of its max value, it begins to negatively affect the success rate of
|
|
|
|
your contracts/operations. This penalty is shown in the overview panel. If the penalty is 15%, then this
|
|
|
|
means your success rate would be multipled by 85% (100 - 15).
|
|
|
|
<br />
|
|
|
|
<br />
|
|
|
|
Your max stamina and stamina gain rate can also be increased by training, or through skills and
|
|
|
|
Augmentation upgrades.
|
|
|
|
</Typography>
|
|
|
|
}
|
|
|
|
>
|
|
|
|
<Typography>
|
|
|
|
Stamina: {formatNumber(props.bladeburner.stamina, 3)} / {formatNumber(props.bladeburner.maxStamina, 3)}
|
|
|
|
</Typography>
|
|
|
|
</Tooltip>
|
|
|
|
</Box>
|
2021-09-05 01:09:30 +02:00
|
|
|
<br />
|
2021-09-27 23:09:48 +02:00
|
|
|
<Typography>
|
|
|
|
Stamina Penalty: {formatNumber((1 - props.bladeburner.calculateStaminaPenalty()) * 100, 1)}%
|
|
|
|
</Typography>
|
2021-09-05 01:09:30 +02:00
|
|
|
<br />
|
2021-09-27 23:09:48 +02:00
|
|
|
<Typography>Team Size: {formatNumber(props.bladeburner.teamSize, 0)}</Typography>
|
|
|
|
<Typography>Team Members Lost: {formatNumber(props.bladeburner.teamLost, 0)}</Typography>
|
2021-09-05 01:09:30 +02:00
|
|
|
<br />
|
2021-09-27 23:09:48 +02:00
|
|
|
<Typography>Num Times Hospitalized: {props.bladeburner.numHosp}</Typography>
|
|
|
|
<Typography>
|
2021-09-09 05:47:34 +02:00
|
|
|
Money Lost From Hospitalizations: <Money money={props.bladeburner.moneyLost} />
|
2021-09-27 23:09:48 +02:00
|
|
|
</Typography>
|
2021-09-05 01:09:30 +02:00
|
|
|
<br />
|
2021-09-27 23:09:48 +02:00
|
|
|
<Typography>Current City: {props.bladeburner.city}</Typography>
|
|
|
|
<Box display="flex">
|
|
|
|
<Tooltip
|
|
|
|
disableInteractive
|
|
|
|
title={
|
|
|
|
<Typography>
|
|
|
|
This is your Bladeburner division's estimate of how many Synthoids exist in your current city. An accurate
|
|
|
|
population count increases success rate estimates.
|
|
|
|
</Typography>
|
|
|
|
}
|
|
|
|
>
|
|
|
|
<Typography>
|
|
|
|
Est. Synthoid Population: {numeralWrapper.formatPopulation(props.bladeburner.getCurrentCity().popEst)}
|
|
|
|
</Typography>
|
|
|
|
</Tooltip>
|
|
|
|
</Box>
|
2021-09-05 01:09:30 +02:00
|
|
|
<br />
|
2021-09-27 23:09:48 +02:00
|
|
|
<Box display="flex">
|
|
|
|
<Tooltip
|
|
|
|
disableInteractive
|
|
|
|
title={
|
|
|
|
<Typography>
|
|
|
|
This is your Bladeburner divison's estimate of how many Synthoid communities exist in your current city.
|
|
|
|
</Typography>
|
|
|
|
}
|
|
|
|
>
|
|
|
|
<Typography>
|
|
|
|
Est. Synthoid Communities: {formatNumber(props.bladeburner.getCurrentCity().comms, 0)}
|
|
|
|
</Typography>
|
|
|
|
</Tooltip>
|
|
|
|
</Box>
|
2021-09-05 01:09:30 +02:00
|
|
|
<br />
|
2021-09-27 23:09:48 +02:00
|
|
|
<Box display="flex">
|
|
|
|
<Tooltip
|
|
|
|
disableInteractive
|
|
|
|
title={
|
|
|
|
<Typography>
|
|
|
|
The city's chaos level due to tensions and conflicts between humans and Synthoids. Having too high of a
|
|
|
|
chaos level can make contracts and operations harder.
|
|
|
|
</Typography>
|
|
|
|
}
|
|
|
|
>
|
|
|
|
<Typography>City Chaos: {formatNumber(props.bladeburner.getCurrentCity().chaos)}</Typography>
|
|
|
|
</Tooltip>
|
|
|
|
</Box>
|
2021-09-05 01:09:30 +02:00
|
|
|
<br />
|
2021-09-27 23:09:48 +02:00
|
|
|
{(props.bladeburner.storedCycles / BladeburnerConstants.CyclesPerSecond) * 1000 > 15000 && (
|
|
|
|
<>
|
|
|
|
<Box display="flex">
|
|
|
|
<Tooltip
|
|
|
|
disableInteractive
|
|
|
|
title={
|
|
|
|
<Typography>
|
|
|
|
You gain bonus time while offline or when the game is inactive (e.g. when the tab is throttled by
|
|
|
|
browser). Bonus time makes the Bladeburner mechanic progress faster, up to 5x the normal speed.
|
|
|
|
</Typography>
|
|
|
|
}
|
|
|
|
>
|
|
|
|
<Typography>
|
|
|
|
Bonus time:{" "}
|
|
|
|
{convertTimeMsToTimeElapsedString(
|
|
|
|
(props.bladeburner.storedCycles / BladeburnerConstants.CyclesPerSecond) * 1000,
|
|
|
|
)}
|
|
|
|
</Typography>
|
|
|
|
</Tooltip>
|
|
|
|
</Box>
|
|
|
|
<br />
|
|
|
|
</>
|
|
|
|
)}
|
|
|
|
<Typography>Skill Points: {formatNumber(props.bladeburner.skillPoints, 0)}</Typography>
|
2021-09-05 01:09:30 +02:00
|
|
|
<br />
|
2021-09-18 19:29:01 +02:00
|
|
|
<StatsTable
|
|
|
|
rows={[
|
|
|
|
["Aug. Success Chance mult: ", formatNumber(props.player.bladeburner_success_chance_mult * 100, 1) + "%"],
|
|
|
|
["Aug. Max Stamina mult: ", formatNumber(props.player.bladeburner_max_stamina_mult * 100, 1) + "%"],
|
|
|
|
["Aug. Stamina Gain mult: ", formatNumber(props.player.bladeburner_stamina_gain_mult * 100, 1) + "%"],
|
|
|
|
["Aug. Field Analysis mult: ", formatNumber(props.player.bladeburner_analysis_mult * 100, 1) + "%"],
|
|
|
|
]}
|
|
|
|
/>
|
2021-09-05 01:09:30 +02:00
|
|
|
<br />
|
2021-09-27 23:09:48 +02:00
|
|
|
<Button onClick={() => setTravelOpen(true)}>Travel</Button>
|
|
|
|
<Tooltip title={!inFaction ? <Typography>Rank 25 required.</Typography> : ""}>
|
|
|
|
<span>
|
|
|
|
<Button disabled={!inFaction} onClick={openFaction}>
|
|
|
|
Faction
|
|
|
|
</Button>
|
2021-09-05 01:09:30 +02:00
|
|
|
</span>
|
2021-09-27 23:09:48 +02:00
|
|
|
</Tooltip>
|
|
|
|
<TravelModal open={travelOpen} onClose={() => setTravelOpen(false)} bladeburner={props.bladeburner} />
|
|
|
|
</Paper>
|
2021-09-05 01:09:30 +02:00
|
|
|
);
|
2021-08-10 17:25:21 +02:00
|
|
|
}
|