/**
* Root React component for the Augmentations UI page that display all of your
* owned and purchased Augmentations and Source-Files.
*/
import React, { useState, useEffect } from "react";
import { InstalledAugmentations } from "./InstalledAugmentations";
import { PlayerMultipliers } from "./PlayerMultipliers";
import { PurchasedAugmentations } from "./PurchasedAugmentations";
import { SourceFilesElement } from "./SourceFiles";
import { canGetBonus } from "../../ExportBonus";
import { use } from "../../ui/Context";
import Typography from "@mui/material/Typography";
import Button from "@mui/material/Button";
import Tooltip from "@mui/material/Tooltip";
import Box from "@mui/material/Box";
import Paper from "@mui/material/Paper";
import Container from "@mui/material/Container";
import { Settings } from "../../Settings/Settings";
import { ConfirmationModal } from "../../ui/React/ConfirmationModal";
import { IPlayer } from "../../PersonObjects/IPlayer";
import { AugmentationNames } from "../data/AugmentationNames";
import { Augmentations } from "../Augmentations";
import { CONSTANTS } from "../../Constants";
import { formatNumber } from "../../utils/StringHelperFunctions";
import { Info } from "@mui/icons-material";
interface NFGDisplayProps {
player: IPlayer;
}
const NeuroFluxDisplay = ({ player }: NFGDisplayProps): React.ReactElement => {
const level = player.augmentations.find((e) => e.name === AugmentationNames.NeuroFluxGovernor)?.level ?? 0;
return level > 0 ? (
NeuroFlux Governor - Level {level}{Augmentations[AugmentationNames.NeuroFluxGovernor].stats}
) : (
<>>
);
};
interface EntropyDisplayProps {
player: IPlayer;
}
const EntropyDisplay = ({ player }: EntropyDisplayProps): React.ReactElement => {
return player.entropy > 0 ? (
Entropy Virus - Level {player.entropy}
All multipliers decreased by: {formatNumber((1 - CONSTANTS.EntropyEffect ** player.entropy) * 100, 3)}%
(multiplicative)
) : (
<>>
);
};
interface IProps {
exportGameFn: () => void;
installAugmentationsFn: () => void;
}
export function AugmentationsRoot(props: IProps): React.ReactElement {
const [installOpen, setInstallOpen] = useState(false);
const player = use.Player();
const setRerender = useState(false)[1];
function rerender(): void {
setRerender((o) => !o);
}
useEffect(() => {
const id = setInterval(rerender, 200);
return () => clearInterval(id);
}, []);
function doExport(): void {
props.exportGameFn();
rerender();
}
function exportBonusStr(): string {
if (canGetBonus()) return "(+1 favor to all factions)";
return "";
}
function doInstall(): void {
if (!Settings.SuppressBuyAugmentationConfirmation) {
setInstallOpen(true);
} else {
props.installAugmentationsFn();
}
}
return (
Augmentations
Purchased Augmentations
Below is a list of all Augmentations you have purchased but not yet installed. Click the button
below to install them.
WARNING: Installing your Augmentations resets most of your progress, including:
- Stats/Skill levels and Experience- Money- Scripts on every computer but your home computer- Purchased servers- Hacknet Nodes- Faction/Company reputation- Stocks
Installing Augmentations lets you start over with the perks and benefits granted by all of the
Augmentations you have ever installed. Also, you will keep any scripts and RAM/Core upgrades on your
home computer (but you will lose all programs besides NUKE.exe)
>
}
>
setInstallOpen(false)}
onConfirm={props.installAugmentationsFn}
confirmationText={
<>
Installing will reset
- money
- skill / experience
- every server except home
- factions and reputation
You will keep:
- All scripts on home
- home ram and cores
It is recommended to install several Augmentations at once. Preferably everything from any faction of
your choosing.
>
}
/>
'I never asked for this'}>
It's always a good idea to backup/export your save!}>
{player.queuedAugmentations.length > 0 ? (
) : (
No Augmentations have been purchased yet
)}
e.name === AugmentationNames.NeuroFluxGovernor)?.level ?? 0) > 0) +
+!!(player.entropy > 0)
}, 1fr)`,
}}
>
);
}