From 8bc8e8bbc1aedb083ff610064799ae0c3847b824 Mon Sep 17 00:00:00 2001 From: CatLover <152669316+catloversg@users.noreply.github.com> Date: Tue, 10 Dec 2024 12:13:56 +0700 Subject: [PATCH] UI: Add reward info to intro page of infiltration --- src/Infiltration/ui/InfiltrationRoot.tsx | 1 + src/Infiltration/ui/Intro.tsx | 31 ++++++++++++++++++++++-- 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/src/Infiltration/ui/InfiltrationRoot.tsx b/src/Infiltration/ui/InfiltrationRoot.tsx index 1957c40d7b..1ff5010d5f 100644 --- a/src/Infiltration/ui/InfiltrationRoot.tsx +++ b/src/Infiltration/ui/InfiltrationRoot.tsx @@ -51,6 +51,7 @@ export function InfiltrationRoot(props: IProps): React.ReactElement { StartingDifficulty={startingSecurityLevel} Difficulty={difficulty} MaxLevel={props.location.infiltrationData.maxClearanceLevel} + Reward={reward} start={() => setStart(true)} cancel={cancel} /> diff --git a/src/Infiltration/ui/Intro.tsx b/src/Infiltration/ui/Intro.tsx index 8826687b73..fd56a72d0e 100644 --- a/src/Infiltration/ui/Intro.tsx +++ b/src/Infiltration/ui/Intro.tsx @@ -3,15 +3,23 @@ import { Box, Button, Container, Paper, Tooltip, Typography } from "@mui/materia import React from "react"; import { Location } from "../../Locations/Location"; import { Settings } from "../../Settings/Settings"; -import { formatHp, formatNumberNoSuffix } from "../../ui/formatNumber"; +import { formatHp, formatMoney, formatNumberNoSuffix, formatReputation } from "../../ui/formatNumber"; import { Player } from "@player"; import { calculateDamageAfterFailingInfiltration } from "../utils"; +import { + calculateInfiltratorsRepReward, + calculateSellInformationCashReward, + calculateTradeInformationRepReward, +} from "../formulas/victory"; +import { Factions } from "../../Faction/Factions"; +import { FactionName } from "../../Faction/Enums"; interface IProps { Location: Location; StartingDifficulty: number; Difficulty: number; MaxLevel: number; + Reward: number; start: () => void; cancel: () => void; } @@ -53,6 +61,10 @@ function coloredArrow(difficulty: number): JSX.Element { } export function Intro(props: IProps): React.ReactElement { + const repGain = calculateTradeInformationRepReward(props.Reward, props.MaxLevel, props.StartingDifficulty); + const moneyGain = calculateSellInformationCashReward(props.Reward, props.MaxLevel, props.StartingDifficulty); + const soaRepGain = calculateInfiltratorsRepReward(Factions[FactionName.ShadowsOfAnarchy], props.StartingDifficulty); + return ( @@ -71,6 +83,21 @@ export function Intro(props: IProps): React.ReactElement { Maximum Level: {props.MaxLevel} + +
+ + Reward: + + +
    +
  • Reputation: {formatReputation(repGain)}
  • +
  • Money: {formatMoney(moneyGain)}
  • + {Player.factions.includes(FactionName.ShadowsOfAnarchy) && ( +
  • SoA reputation: {formatReputation(soaRepGain)}
  • + )} +
+
+ - This location is too heavily guarded for your current stats. It is recommended that you try training, + This location is too heavily guarded for your current stats. It is recommended that you try training or finding an easier location. }