Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show max potential titan for every gear in a loadout #96

Merged
merged 1 commit into from
Jan 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "tof-tools",
"version": "3.2.0",
"version": "3.4.0",
"private": true,
"scripts": {
"dev": "next dev",
Expand Down
16 changes: 3 additions & 13 deletions pages/_layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,13 @@ export default function Layout({ children }: LayoutProps) {

<Stack mt={5} spacing={1} alignItems="center">
<RandomSticker />
<Changelog />
<Box textAlign="center">
<Typography variant="body2">
Questions? Find me on discord @apache1123
</Typography>
<Typography variant="body2">
or come hang out at our{' '}
<Link
href="https://discord.gg/vegemites"
target="_blank"
rel="noopener"
>
crew discord
</Link>{' '}
(Vegemites, APAC crew)
Questions? Find me on discord @apache1123, or submit an issue in the
Github repo
</Typography>
</Box>
<Changelog />
<Link
href="https://github.com/apache1123/tof-tools"
target="_blank"
Expand Down
8 changes: 8 additions & 0 deletions src/constants/changelog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -135,4 +135,12 @@ export const changelog: Changelog = [
</>
),
},
{
semver: '3.4.0',
date: new Date(Date.UTC(2024, 0, 8)),
title:
'Show max potential titan value for every piece of gear in a loadout',
description:
'This may help you decide which piece of gear in your loadout is the weakest, so that you can farm that piece in Joint Operation',
},
];
83 changes: 61 additions & 22 deletions src/features/GearPiece.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
Typography,
} from '@mui/material';
import Grid from '@mui/material/Unstable_Grid2';
import Image from 'next/image';
import type { ReactNode } from 'react';

import { GearTypeIcon } from '../components/GearTypeIcon/GearTypeIcon';
Expand All @@ -20,6 +21,7 @@ import { GearAttackStatsSummary } from './GearAttackStatsSummary';
import { GearRollBreakdown } from './GearRollBreakdown';
import { GearStars } from './GearStars';
import { EmptyStatEditor, StatEditor } from './StatEditor';
import { TitanGearMaxStats } from './TitanGearMaxStats';

export interface GearPieceProps {
gearSnap: Gear;
Expand All @@ -30,7 +32,6 @@ export interface GearPieceProps {
/** External actions such as `Import gear` & `Save gear` that make no sense to be orchestrated by a `Gear` instance, but can be slotted here (for layout purposes) */
actions?: ReactNode;
showStatSummary?: CoreElementalType;
maxTitanStatsContent?: ReactNode;
additionalAccordions?: ReactNode;
['data-testid']?: string;
}
Expand All @@ -41,14 +42,15 @@ export const GearPiece = ({
gearTypeSelector,
actions,
showStatSummary,
maxTitanStatsContent,
additionalAccordions,
'data-testid': dataTestId,
}: GearPieceProps) => {
const gearType = gearSnap.type;
const isTitan = gearSnap.isAugmented;
const possibleRandomStatTypes = getPossibleRandomStatTypes(gearType);

const maxTitanGear = gearSnap.getMaxTitanGear();

return (
<Layout
typeIcon={
Expand Down Expand Up @@ -86,7 +88,7 @@ export const GearPiece = ({
<>
{showStatSummary && (
<GearAttackStatsSummary
gearSnap={gearSnap as Gear}
gearSnap={gearSnap}
elementalType={showStatSummary}
/>
)}
Expand All @@ -103,26 +105,63 @@ export const GearPiece = ({
<GearRollBreakdown gearSnap={gearSnap} />
</AccordionDetails>
</Accordion>
{maxTitanStatsContent && (
<Accordion elevation={3}>
<AccordionSummary
expandIcon={<ExpandMoreIcon />}
aria-controls="max-titan-stats-panel-content"
id="max-titan-stats-panel-header"
>
<Typography>Stat values at max titan</Typography>
</AccordionSummary>
<AccordionDetails data-testid="max-titan-stats-panel-content">
<>
<Typography sx={{ mb: 3 }}>
The max increase amount each stat gets at max potential
titan (120 augmentations)
<Accordion elevation={3}>
<AccordionSummary
expandIcon={<ExpandMoreIcon />}
aria-controls="max-titan-stats-panel-content"
id="max-titan-stats-panel-header"
>
<Typography>Stat values at max titan</Typography>
</AccordionSummary>
<AccordionDetails data-testid="max-titan-stats-panel-content">
<>
<Typography sx={{ mb: 3 }}>
The max increase amount each stat gets at max potential
titan (120 augmentations)
</Typography>
{gearSnap.stars !== 5 &&
gearSnap.getPossibleStars().length > 1 ? (
<Typography color="info.main" gutterBottom>
Can&apos;t determine the number of stars{' '}
<strong>
(either {gearSnap.getPossibleStars().join(' or ')}{' '}
stars)
</strong>
. Select it above to continue
</Typography>
) : gearSnap.stars !== 5 &&
gearSnap.getPossibleStars().length === 1 &&
gearSnap.getPossibleStars()[0] !== 5 ? (
<Typography color="info.main" gutterBottom>
Can&apos;t calculate max titan stat values if gear is not
at 5 star
</Typography>
{maxTitanStatsContent}
</>
</AccordionDetails>
</Accordion>
)}
) : gearSnap && maxTitanGear ? (
<TitanGearMaxStats
maxTitanGearSnap={maxTitanGear}
elementalType={showStatSummary}
/>
) : (
<Box>
<Typography color="info.main">
Can&apos;t calculate max titan stat values if gear is
not at 5 star.
</Typography>
<Typography color="info.main" mt={2} gutterBottom>
If the gear is already augmented/at titan, use the
original 5 star values (found on the augment screen)
</Typography>
<Image
src="/stat_original_5_star_value_example.jpg"
alt="stat-original-5-star-value-example"
width={415}
height={230}
/>
</Box>
)}
</>
</AccordionDetails>
</Accordion>
{additionalAccordions}
</Box>
</>
Expand Down
25 changes: 2 additions & 23 deletions src/features/gear-comparer/GearComparer.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
import { Box, Divider, Link, Paper, Stack, Typography } from '@mui/material';
import Grid from '@mui/material/Unstable_Grid2';

import { BuffSummary } from './BuffSummary';
import { GearComparerOptions } from './GearComparerOptions';
import { LoadoutGear } from './LoadoutGear';
import { LoadoutGearValue } from './LoadoutGearValue';
import { GearsSideBySide } from './GearsSideBySide';
import { LoadoutStats } from './LoadoutStats';
import { LoadoutTeam } from './LoadoutTeam';
import { LoadoutTitle } from './LoadoutTitle';
import { ReplacementGear } from './ReplacementGear';
import { ReplacementGearValue } from './ReplacementGearValue';

export function GearComparer() {
return (
Expand All @@ -24,24 +20,7 @@ export function GearComparer() {
<LoadoutTeam />
<LoadoutStats />

<Grid container spacing={3}>
<Grid xs={12} md={6}>
<Typography variant="h5" mb={1}>
Current gear in loadout
</Typography>
<LoadoutGear />
<LoadoutGearValue />
</Grid>
<Grid xs={12} md={6}>
<Box display="flex" justifyContent="space-between">
<Typography variant="h5" mb={1}>
New gear
</Typography>
</Box>
<ReplacementGear />
<ReplacementGearValue />
</Grid>
</Grid>
<GearsSideBySide />
</Stack>
</Paper>

Expand Down
61 changes: 61 additions & 0 deletions src/features/gear-comparer/GearsSideBySide.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
import { Box, Typography } from '@mui/material';
import Grid from '@mui/material/Unstable_Grid2';
import { useSnapshot } from 'valtio';

import { gearComparerState } from '../../states/states';
import { LoadoutGear } from './LoadoutGear';
import { LoadoutGearValue } from './LoadoutGearValue';
import { ReplacementGear } from './ReplacementGear';
import { ReplacementGearValue } from './ReplacementGearValue';

export function GearsSideBySide() {
const { selectedLoadoutGear, replacementGear, selectedLoadout } =
useSnapshot(gearComparerState);

const selectedLoadoutGearMaxTitan = selectedLoadoutGear.getMaxTitanGear();
const replacementGearMaxTitan = replacementGear.getMaxTitanGear();

const selectedLoadoutGearMaxTitanValue = selectedLoadoutGearMaxTitan
? selectedLoadout.getSubstituteGearValue(selectedLoadoutGearMaxTitan)
: undefined;
const replacementGearMaxTitanValue = replacementGearMaxTitan
? selectedLoadout.getSubstituteGearValue(replacementGearMaxTitan)
: undefined;

return (
<Grid container spacing={3}>
<Grid xs={12} md={6}>
<Typography variant="h5" mb={1}>
Current gear in loadout
</Typography>
<LoadoutGear />
<LoadoutGearValue
maxTitanGearValue={selectedLoadoutGearMaxTitanValue}
isMaxTitanGearValueHigher={
selectedLoadoutGearMaxTitanValue !== undefined
? selectedLoadoutGearMaxTitanValue >=
(replacementGearMaxTitanValue ?? 0)
: undefined
}
/>
</Grid>
<Grid xs={12} md={6}>
<Box display="flex" justifyContent="space-between">
<Typography variant="h5" mb={1}>
New gear
</Typography>
</Box>
<ReplacementGear />
<ReplacementGearValue
maxTitanGearValue={replacementGearMaxTitanValue}
isMaxTitanGearValueHigher={
replacementGearMaxTitanValue !== undefined
? replacementGearMaxTitanValue >=
(selectedLoadoutGearMaxTitanValue ?? 0)
: undefined
}
/>
</Grid>
</Grid>
);
}
50 changes: 0 additions & 50 deletions src/features/gear-comparer/LoadoutGear.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
import { Box, Typography } from '@mui/material';
import Image from 'next/image';
import { useSnapshot } from 'valtio';

import { GearTypeSelector } from '../../components/GearTypeSelector/GearTypeSelector';
import type { Gear } from '../../models/gear';
import type { GearComparerState } from '../../states/gear-comparer';
import { gearComparerState } from '../../states/states';
import { GearOCRModal } from '../GearOCRModal';
import { GearPiece } from '../GearPiece';
import { TitanGearMaxStats } from '../TitanGearMaxStats';
import { gearComparerGearMaxTitansState } from './states/derived/gear-comparer-gear-max-titans';

export function LoadoutGear() {
const {
Expand All @@ -18,8 +13,6 @@ export function LoadoutGear() {
} = useSnapshot(gearComparerState) as GearComparerState;
const gearState = gearComparerState.selectedLoadoutGear;

const maxTitansSnap = useSnapshot(gearComparerGearMaxTitansState);

return (
<GearPiece
gearSnap={gearSnap}
Expand All @@ -45,49 +38,6 @@ export function LoadoutGear() {
/>
}
showStatSummary={elementalType}
maxTitanStatsContent={
gearSnap.stars !== 5 &&
(gearSnap as Gear).getPossibleStars().length > 1 ? (
<Typography color="info.main" gutterBottom>
Can&apos;t determine the number of stars{' '}
<strong>
(either {(gearSnap as Gear).getPossibleStars().join(' or ')}{' '}
stars)
</strong>
. Select it above to continue
</Typography>
) : gearSnap.stars !== 5 &&
(gearSnap as Gear).getPossibleStars().length === 1 &&
(gearSnap as Gear).getPossibleStars()[0] !== 5 ? (
<Typography color="info.main" gutterBottom>
Can&apos;t calculate max titan stat values if gear is not at 5 star
</Typography>
) : gearSnap && maxTitansSnap.titansByReferenceGearId[gearSnap.id] ? (
<TitanGearMaxStats
maxTitanGearSnap={
maxTitansSnap.titansByReferenceGearId[gearSnap.id] as Gear
}
elementalType={elementalType}
/>
) : (
<Box>
<Typography color="info.main">
Can&apos;t calculate max titan stat values if gear is not at 5
star.
</Typography>
<Typography color="info.main" mt={2} gutterBottom>
If the gear is already augmented/at titan, use the original 5 star
values (found on the augment screen)
</Typography>
<Image
src="/stat_original_5_star_value_example.jpg"
alt="stat-original-5-star-value-example"
width={415}
height={230}
/>
</Box>
)
}
data-testid={'loadout-gear'}
/>
);
Expand Down
Loading
Loading