/** * React component for displaying a single augmentation for purchase through * the faction UI */ import { CheckBox, CheckBoxOutlineBlank, CheckCircle, NewReleases, Report } from "@mui/icons-material"; import { Box, Button, Container, Paper, Tooltip, Typography } from "@mui/material"; import React, { useState } from "react"; import { Faction } from "../../Faction/Faction"; import { IPlayer } from "../../PersonObjects/IPlayer"; import { Settings } from "../../Settings/Settings"; import { numeralWrapper } from "../../ui/numeralFormat"; import { Augmentation } from "../Augmentation"; import { AugmentationNames } from "../data/AugmentationNames"; import { StaticAugmentations } from "../StaticAugmentations"; import { PurchaseAugmentationModal } from "./PurchaseAugmentationModal"; interface IPreReqsProps { player: IPlayer; aug: Augmentation; } const PreReqs = (props: IPreReqsProps): React.ReactElement => { const ownedPreReqs = props.aug.prereqs.filter((aug) => props.player.hasAugmentation(aug)); const hasPreReqs = props.aug.prereqs.length > 0 && ownedPreReqs.length === props.aug.prereqs.length; return ( This Augmentation has the following pre-requisite(s): {props.aug.prereqs.map((preAug) => ( ))} } > {hasPreReqs ? ( <> Pre-requisites Owned ) : ( <> Missing {props.aug.prereqs.length - ownedPreReqs.length} pre-requisite(s) )} ); }; interface IExclusiveProps { player: IPlayer; aug: Augmentation; } const Exclusive = (props: IExclusiveProps): React.ReactElement => { return ( This Augmentation can only be acquired from the following source(s): } > ); }; interface IReqProps { value: string; color: string; fulfilled: boolean; } const Requirement = (props: IReqProps): React.ReactElement => { return ( {props.fulfilled ? : } {props.value} ); }; interface IPurchasableAugsProps { augNames: string[]; ownedAugNames: string[]; player: IPlayer; canPurchase: (player: IPlayer, aug: Augmentation) => boolean; purchaseAugmentation: (player: IPlayer, aug: Augmentation, showModal: (open: boolean) => void) => void; rep?: number; sleeveAugs?: boolean; faction?: Faction; } export const PurchasableAugmentations = (props: IPurchasableAugsProps): React.ReactElement => { return ( {props.augNames.map((augName: string) => ( ))} {props.ownedAugNames.map((augName: string) => ( ))} ); }; interface IPurchasableAugProps { parent: IPurchasableAugsProps; augName: string; owned: boolean; } export function PurchasableAugmentation(props: IPurchasableAugProps): React.ReactElement { const [open, setOpen] = useState(false); const aug = StaticAugmentations[props.augName]; const augCosts = aug.getCost(props.parent.player); const cost = props.parent.sleeveAugs ? aug.baseCost : augCosts.moneyCost; const repCost = augCosts.repCost; const info = typeof aug.info === "string" ? {aug.info} : aug.info; const description = ( <> {info}

{aug.stats} ); return ( <> {props.augName} {props.augName === AugmentationNames.NeuroFluxGovernor && ` - Level ${aug.getLevel(props.parent.player)}`} {description} } > {aug.name} {aug.name === AugmentationNames.NeuroFluxGovernor && ` - Level ${aug.getLevel(props.parent.player)}`} {aug.factions.length === 1 && !props.parent.sleeveAugs && ( )} {aug.prereqs.length > 0 && !props.parent.sleeveAugs && } {props.owned || ( cost} value={numeralWrapper.formatMoney(cost)} color={Settings.theme.money} /> {props.parent.rep !== undefined && ( = repCost} value={`${numeralWrapper.formatReputation(repCost)} rep`} color={Settings.theme.rep} /> )} )} {Settings.SuppressBuyAugmentationConfirmation || ( setOpen(false)} faction={props.parent.faction} aug={aug} /> )} ); }