diff --git a/src/CotMG/ui/ActiveFragmentSummary.tsx b/src/CotMG/ui/ActiveFragmentSummary.tsx new file mode 100644 index 000000000..a2ea7297d --- /dev/null +++ b/src/CotMG/ui/ActiveFragmentSummary.tsx @@ -0,0 +1,50 @@ +import React, { useState, useEffect } from "react"; +import { ActiveFragment } from "../ActiveFragment"; +import { IStaneksGift } from "../IStaneksGift"; +import { FragmentType, Effect } from "../FragmentType"; +import { numeralWrapper } from "../../ui/numeralFormat"; + +import Paper from "@mui/material/Paper"; +import Typography from "@mui/material/Typography"; +import Box from "@mui/material/Box"; + +type IProps = { + gift: IStaneksGift; +}; + +export function ActiveFragmentSummary(props: IProps): React.ReactElement { + const [, setC] = useState(new Date()); + + useEffect(() => { + const id = setInterval(() => setC(new Date()), 250); + + return () => clearInterval(id); + }, []); + + const effects = props.gift.fragments.map((fragment: ActiveFragment) => { + const f = fragment.fragment(); + + let effect = "N/A"; + effect = "[" + fragment.x + "," + fragment.y + "] "; + // Boosters and cooling don't deal with heat. + if ([FragmentType.Booster, FragmentType.None, FragmentType.Delete].includes(f.type)) { + return ""; + } else if (Effect(f.type).includes("+x%")) { + effect += Effect(f.type).replace(/-*x%/, numeralWrapper.formatPercentage(props.gift.effect(fragment) - 1)); + } else if (Effect(f.type).includes("-x%")) { + const effectAmt = props.gift.effect(fragment); + const perc = numeralWrapper.formatPercentage(1 - 1 / effectAmt); + effect += Effect(f.type).replace(/-x%/, perc); + } + + return {effect}; + }); + + return ( + + Summary of current effects: + {effects.length <= 0 && None currently.} + {effects} + + ); +} diff --git a/src/CotMG/ui/FragmentInspector.tsx b/src/CotMG/ui/FragmentInspector.tsx index 7365ad4a9..3582c3b55 100644 --- a/src/CotMG/ui/FragmentInspector.tsx +++ b/src/CotMG/ui/FragmentInspector.tsx @@ -25,23 +25,21 @@ export function FragmentInspector(props: IProps): React.ReactElement { if (props.fragment === undefined) { return ( - + + [X, Y] {props.x}, {props.y} +
+
ID: N/A
Effect: N/A
- Magnitude: N/A + Base Power: N/A
Charge: N/A
- Heat: N/A + root [X, Y] N/A
- Effect: N/A -
- [X, Y] N/A -
- [X, Y] {props.x}, {props.y}
); @@ -63,8 +61,11 @@ export function FragmentInspector(props: IProps): React.ReactElement { } return ( - + + [X, Y] {props.x}, {props.y} +
+
ID: {props.fragment.id}
Effect: {effect} @@ -73,10 +74,8 @@ export function FragmentInspector(props: IProps): React.ReactElement {
Charge: {charge}
-
root [X, Y] {props.fragment.x}, {props.fragment.y}
- [X, Y] {props.x}, {props.y}
); diff --git a/src/CotMG/ui/MainBoard.tsx b/src/CotMG/ui/MainBoard.tsx index 873592b76..86361e876 100644 --- a/src/CotMG/ui/MainBoard.tsx +++ b/src/CotMG/ui/MainBoard.tsx @@ -9,6 +9,9 @@ import Button from "@mui/material/Button"; import { Table } from "../../ui/React/Table"; import { Grid } from "./Grid"; import { zeros, calculateGrid } from "../Helper"; +import { ActiveFragmentSummary } from "./ActiveFragmentSummary"; +import Tooltip from "@mui/material/Tooltip/Tooltip"; +import Typography from "@mui/material/Typography/Typography"; interface IProps { gift: IStaneksGift; @@ -84,9 +87,8 @@ export function MainBoard(props: IProps): React.ReactElement { return ( <> - - - + +
- + + + + + + + + WARNING : This will remove all active fragment from the grid.
+ All cumulated charges will be lost. + + } + > + +
); } diff --git a/src/CotMG/ui/StaneksGiftRoot.tsx b/src/CotMG/ui/StaneksGiftRoot.tsx index 88b226605..eaacc58ad 100644 --- a/src/CotMG/ui/StaneksGiftRoot.tsx +++ b/src/CotMG/ui/StaneksGiftRoot.tsx @@ -10,6 +10,7 @@ import Typography from "@mui/material/Typography"; import { ActiveFragment } from "../ActiveFragment"; import { Fragments } from "../Fragment"; import { DummyGrid } from "./DummyGrid"; +import Container from "@mui/material/Container"; type IProps = { staneksGift: IStaneksGift; @@ -22,7 +23,7 @@ export function StaneksGiftRoot({ staneksGift }: IProps): React.ReactElement { } useEffect(() => StaneksGiftEvents.subscribe(rerender), []); return ( - <> + Stanek's Gift - + The gift is a grid on which you can place upgrades called fragments. The main type of fragment increases a stat, like your hacking skill or agility exp. Once a stat fragment is placed it then needs to be charged via scripts in order to become useful. The other kind of fragments are called booster fragments. They increase the efficiency of the neighboring fragments (not diagonally). Use Q/E to rotate fragments. {staneksGift.storedCycles > 5 && ( - + Bonus time: {convertTimeMsToTimeElapsedString(CONSTANTS._idleSpeed * staneksGift.storedCycles)} )} - + ); }