From bb561847ada740b60872b98d3b73fb18d4f6a63e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tr=C3=A8sAbhi?= <43380238+tresabhi@users.noreply.github.com> Date: Sat, 29 Jun 2024 13:29:43 -0500 Subject: [PATCH] feat: premium dpm --- src/app/tools/tankopedia/components/Sort.tsx | 12 +++++++++++- .../tools/tankopedia/components/TankCard.tsx | 2 ++ .../tankopedia/components/TankSearch/index.tsx | 18 ++++++++++++++++++ src/stores/tankopedia.ts | 4 +++- 4 files changed, 34 insertions(+), 2 deletions(-) diff --git a/src/app/tools/tankopedia/components/Sort.tsx b/src/app/tools/tankopedia/components/Sort.tsx index e0a50f4a8..00727a65f 100644 --- a/src/app/tools/tankopedia/components/Sort.tsx +++ b/src/app/tools/tankopedia/components/Sort.tsx @@ -43,7 +43,17 @@ export function Sort() { }); }} > - DPM + Standard DPM + + { + mutateTankopediaFilters((draft) => { + draft.sort.by = 'fire.dpmPremium'; + }); + }} + > + Premium DPM ( ); break; + case 'fire.dpmPremium': + sorted = filtered.sort( + (a, b) => + (a.turrets.at(-1)!.guns.at(-1)!.shells[1] + ? resolveDpm( + a.turrets.at(-1)!.guns.at(-1)!, + a.turrets.at(-1)!.guns.at(-1)!.shells[1], + ) + : 0) - + (b.turrets.at(-1)!.guns.at(-1)!.shells[1] + ? resolveDpm( + b.turrets.at(-1)!.guns.at(-1)!, + b.turrets.at(-1)!.guns.at(-1)!.shells[1], + ) + : 0), + ); + break; + case 'fire.reload': sorted = filtered.sort( (a, b) => diff --git a/src/stores/tankopedia.ts b/src/stores/tankopedia.ts index 88d746e77..97f4e2af1 100644 --- a/src/stores/tankopedia.ts +++ b/src/stores/tankopedia.ts @@ -114,7 +114,8 @@ export const SORT_NAMES = { 'survivability.camouflageShooting': 'camouflage shooting', 'survivability.volume': 'volume', 'survivability.length': 'length', - 'fire.dpm': 'DPM', + 'fire.dpm': 'standard DPM', + 'fire.dpmPremium': 'premium DPM', 'fire.reload': 'reload', 'fire.caliber': 'caliber', 'fire.standardPenetration': 'standard penetration', @@ -143,6 +144,7 @@ export const SORT_UNITS: Record = { 'fire.dispersionMoving': 'm', 'fire.dispersionStill': 'm', 'fire.dpm': undefined, + 'fire.dpmPremium': undefined, 'fire.gunDepression': '°', 'fire.gunElevation': '°', 'fire.premiumPenetration': 'mm',