From 1952c721871a86ea795d5127b1843b7a16d2590b Mon Sep 17 00:00:00 2001 From: apache1123 Date: Wed, 21 Feb 2024 18:35:21 +1300 Subject: [PATCH] Fix max titan gear not prioritizing loadout elemental type --- package.json | 2 +- src/features/GearPiece.tsx | 112 +++++++++--------- .../gear-comparer/GearsSideBySide.tsx | 12 +- src/features/gear-comparer/LoadoutGear.tsx | 8 +- .../gear-comparer/ReplacementGear.tsx | 8 +- src/features/loadouts/LoadoutGear.tsx | 4 +- 6 files changed, 83 insertions(+), 63 deletions(-) diff --git a/package.json b/package.json index 228c72ff..2432dc02 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "tof-tools", - "version": "3.10.0", + "version": "3.10.1", "private": true, "scripts": { "dev": "next dev", diff --git a/src/features/GearPiece.tsx b/src/features/GearPiece.tsx index 1ded2a55..42bb1346 100644 --- a/src/features/GearPiece.tsx +++ b/src/features/GearPiece.tsx @@ -35,6 +35,7 @@ export interface GearPieceProps { actions?: ReactNode; showTitanToggle?: boolean; showStatSummary?: CoreElementalType; + showMaxTitanGear?: { maxTitanGear: Gear | undefined }; additionalAccordions?: ReactNode; ['data-testid']?: string; } @@ -46,6 +47,7 @@ export const GearPiece = ({ actions, showTitanToggle, showStatSummary, + showMaxTitanGear, additionalAccordions, 'data-testid': dataTestId, }: GearPieceProps) => { @@ -53,8 +55,6 @@ export const GearPiece = ({ const isTitan = gearSnap.isAugmented; const possibleRandomStatTypes = getPossibleRandomStatTypes(gearType); - const maxTitanGear = gearSnap.getMaxTitanGear(); - return ( - - } - aria-controls="max-titan-stats-panel-content" - id="max-titan-stats-panel-header" - > - Stat values at max titan - - - <> - - The max increase amount each stat gets at max potential - titan (120 augmentations) - - {gearSnap.stars !== 5 && - gearSnap.getPossibleStars().length > 1 ? ( - - Can't determine the number of stars{' '} - - (either {gearSnap.getPossibleStars().join(' or ')}{' '} - stars) - - . Select it above to continue + {showMaxTitanGear && ( + + } + aria-controls="max-titan-stats-panel-content" + id="max-titan-stats-panel-header" + > + Stat values at max titan + + + <> + + The max increase amount each stat gets at max potential + titan (120 augmentations) - ) : gearSnap.stars !== 5 && - gearSnap.getPossibleStars().length === 1 && - gearSnap.getPossibleStars()[0] !== 5 ? ( - - Can't calculate max titan stat values if gear is not - at 5 star - - ) : gearSnap && maxTitanGear ? ( - - ) : ( - - - Can't calculate max titan stat values if gear is - not at 5 star. + {gearSnap.stars !== 5 && + gearSnap.getPossibleStars().length > 1 ? ( + + Can't determine the number of stars{' '} + + (either {gearSnap.getPossibleStars().join(' or ')}{' '} + stars) + + . Select it above to continue - - If the gear is already augmented/at titan, use the - original 5 star values (found on the augment screen) + ) : gearSnap.stars !== 5 && + gearSnap.getPossibleStars().length === 1 && + gearSnap.getPossibleStars()[0] !== 5 ? ( + + Can't calculate max titan stat values if gear is + not at 5 star - stat-original-5-star-value-example - - )} - - - + ) : ( + + + Can't calculate max titan stat values if gear is + not at 5 star. + + + If the gear is already augmented/at titan, use the + original 5 star values (found on the augment screen) + + stat-original-5-star-value-example + + )} + + + + )} {additionalAccordions} diff --git a/src/features/gear-comparer/GearsSideBySide.tsx b/src/features/gear-comparer/GearsSideBySide.tsx index c1ca12f5..0cdd3e6e 100644 --- a/src/features/gear-comparer/GearsSideBySide.tsx +++ b/src/features/gear-comparer/GearsSideBySide.tsx @@ -15,8 +15,12 @@ export function GearsSideBySide() { loadoutsState: { selectedLoadout }, } = useSnapshot(gearComparerState); - const selectedLoadoutGearMaxTitan = selectedLoadoutGear.getMaxTitanGear(); - const replacementGearMaxTitan = replacementGear.getMaxTitanGear(); + const { elementalType } = selectedLoadout; + + const selectedLoadoutGearMaxTitan = + selectedLoadoutGear.getMaxTitanGear(elementalType); + const replacementGearMaxTitan = + replacementGear.getMaxTitanGear(elementalType); const selectedLoadoutGearMaxTitanValue = selectedLoadoutGearMaxTitan ? selectedLoadout.getSubstituteGearValue(selectedLoadoutGearMaxTitan) @@ -31,7 +35,7 @@ export function GearsSideBySide() { Current gear in loadout - + - + ); diff --git a/src/features/gear-comparer/ReplacementGear.tsx b/src/features/gear-comparer/ReplacementGear.tsx index 44e4c7be..a0d2e07a 100644 --- a/src/features/gear-comparer/ReplacementGear.tsx +++ b/src/features/gear-comparer/ReplacementGear.tsx @@ -2,6 +2,7 @@ import { useSnapshot } from 'valtio'; import { GearTypeSelector } from '../../components/GearTypeSelector/GearTypeSelector'; import { gearTypesLookup } from '../../constants/gear-types'; +import type { Gear } from '../../models/gear'; import type { GearComparerState } from '../../states/gear-comparer'; import { gearComparerState } from '../../states/states'; import { GearOCRModal } from '../GearOCRModal'; @@ -9,7 +10,11 @@ import { GearPiece } from '../GearPiece'; import { GearRollSimulator } from './GearRollSimulator'; import { SaveGearModal } from './SaveGearModal'; -export function ReplacementGear() { +export function ReplacementGear({ + maxTitanGear, +}: { + maxTitanGear: Gear | undefined; +}) { const { replacementGear: gearSnap, replacementGearGearSet, @@ -53,6 +58,7 @@ export function ReplacementGear() { } showTitanToggle showStatSummary={elementalType} + showMaxTitanGear={{ maxTitanGear }} additionalAccordions={} data-testid={'replacement-gear'} /> diff --git a/src/features/loadouts/LoadoutGear.tsx b/src/features/loadouts/LoadoutGear.tsx index d8947687..fed6ab63 100644 --- a/src/features/loadouts/LoadoutGear.tsx +++ b/src/features/loadouts/LoadoutGear.tsx @@ -19,6 +19,7 @@ export function LoadoutGear({ gearSnap, gearState }: LoadoutGearProps) { const { selectedLoadout: loadoutSnap } = useSnapshot( loadoutsState ) as LoadoutsState; + const { elementalType } = loadoutSnap; const { selectedLoadoutItem: { @@ -29,7 +30,7 @@ export function LoadoutGear({ gearSnap, gearState }: LoadoutGearProps) { const gearTypeId = gearSnap.type.id; const gearValue = loadoutSnap.getGearValue(gearTypeId); - const maxTitanGear = gearSnap.getMaxTitanGear(); + const maxTitanGear = gearSnap.getMaxTitanGear(elementalType); const maxTitanGearValue = maxTitanGear ? loadoutSnap.getSubstituteGearValue(maxTitanGear) : undefined; @@ -76,6 +77,7 @@ export function LoadoutGear({ gearSnap, gearState }: LoadoutGearProps) { } showTitanToggle showStatSummary={loadoutSnap.elementalType} + showMaxTitanGear={{ maxTitanGear }} data-testid={gearTypeId} />