From 53174db3519cbaa3380e3d70230412a8e59b8f0e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tr=C3=A8sAbhi?= <43380238+tresabhi@users.noreply.github.com> Date: Thu, 7 Mar 2024 18:30:02 -0600 Subject: [PATCH] feat: rename tank types to tank classes --- scripts/buildAssets/definitions.ts | 4 +-- src/app/embeds/session/page.tsx | 2 +- .../[id]/components/Characteristics/index.tsx | 29 ++++++------------- .../tankopedia/[id]/components/Title.tsx | 2 +- .../TankSearch/components/Options/index.tsx | 8 ++--- .../components/TankSearch/index.tsx | 8 ++--- src/commands/breakdown.tsx | 2 +- src/commands/ownedTanks.tsx | 4 +-- src/components/Breakdown/components/Row.tsx | 4 +-- src/components/Tanks/components/Item.tsx | 8 ++--- src/core/blitzkrieg/filtersToDescription.ts | 2 +- src/core/blitzkrieg/tankDefinitions.ts | 10 +++---- src/core/discord/addFilterOptions.ts | 16 +++++----- src/core/discord/getFiltersFromButton.ts | 2 +- src/core/discord/getFiltersFromCommand.ts | 2 +- src/core/statistics/filterStats.ts | 2 +- src/lang/en-US.json | 8 ++--- src/stores/tankopedia.ts | 4 +-- 18 files changed, 53 insertions(+), 64 deletions(-) diff --git a/scripts/buildAssets/definitions.ts b/scripts/buildAssets/definitions.ts index 1dbd313a1..d73cf9208 100644 --- a/scripts/buildAssets/definitions.ts +++ b/scripts/buildAssets/definitions.ts @@ -2,7 +2,7 @@ import { readdir } from 'fs/promises'; import { parse as parsePath } from 'path'; import { Vector3Tuple } from 'three'; import { parse as parseYaml } from 'yaml'; -import { TankType } from '../../src/components/Tanks'; +import { TankClass } from '../../src/components/Tanks'; import { readXMLDVPL } from '../../src/core/blitz/readXMLDVPL'; import { readYAMLDVPL } from '../../src/core/blitz/readYAMLDVPL'; import { toUniqueId } from '../../src/core/blitz/toUniqueId'; @@ -488,7 +488,7 @@ export async function definitions(production: boolean) { ? 'premium' : 'researchable', tier: tank.level as Tier, - type: tankTags[0] as TankType, + class: tankTags[0] as TankClass, testing: tankTags.includes('testTank') ? true : undefined, price: tankPrice, camouflage: { diff --git a/src/app/embeds/session/page.tsx b/src/app/embeds/session/page.tsx index c4b81a6f9..85b766b22 100644 --- a/src/app/embeds/session/page.tsx +++ b/src/app/embeds/session/page.tsx @@ -311,7 +311,7 @@ export default function SessionPage({ naked = true }: SessionPageProps) { tankDefinitions?.name ?? `Unknown tank ${stats.tank_id}` } type="tank" - tankType={tankDefinitions?.type} + tankType={tankDefinitions?.class} treeType={tankDefinitions?.treeType} stats={session.customColumns.map((customColumn) => { const rowStat = rowStats[customColumn.display]; diff --git a/src/app/tools/tankopedia/[id]/components/Characteristics/index.tsx b/src/app/tools/tankopedia/[id]/components/Characteristics/index.tsx index dae69588d..a7b4b308c 100644 --- a/src/app/tools/tankopedia/[id]/components/Characteristics/index.tsx +++ b/src/app/tools/tankopedia/[id]/components/Characteristics/index.tsx @@ -136,12 +136,13 @@ export function Characteristics() { ]); const enginePowerCoefficient = coefficient( [ - hasEngineAccelerator && (tank.type === 'lightTank' || tank.type === 'mediumTank'), + hasEngineAccelerator && + (tank.class === 'lightTank' || tank.class === 'mediumTank'), 0.05, ], [ hasEngineAccelerator && - (tank.type === 'heavyTank' || tank.type === 'AT-SPG'), + (tank.class === 'heavyTank' || tank.class === 'AT-SPG'), 0.07, ], [hasEnginePowerBoost, 0.2], @@ -163,7 +164,7 @@ export function Characteristics() { const viewRangeCoefficient = coefficient([ hasImprovedOptics, - tank.type === 'AT-SPG' ? 0.05 : tank.type === 'heavyTank' ? 0.07 : 0.1, + tank.class === 'AT-SPG' ? 0.05 : tank.class === 'heavyTank' ? 0.07 : 0.1, ]) * coefficient([true, progressiveStat(commanderMastery)]); const fireChanceCoefficient = coefficient([hasProtectiveKit, -0.2]); @@ -180,38 +181,26 @@ export function Characteristics() { const camouflageSumMoving = sum( [ hasCamouflageNet, - tank.type === 'heavyTank' - ? 0.03 - : tank.type === 'AT-SPG' - ? 0.07 - : 0.05, + tank.class === 'heavyTank' ? 0.03 : tank.class === 'AT-SPG' ? 0.07 : 0.05, ], [ camouflage, - tank.type === 'AT-SPG' - ? 0.04 - : tank.type === 'heavyTank' - ? 0.03 - : 0.02, + tank.class === 'AT-SPG' ? 0.04 : tank.class === 'heavyTank' ? 0.03 : 0.02, ], ); const camouflageSumStill = sum( [ hasCamouflageNet, 2 * - (tank.type === 'heavyTank' + (tank.class === 'heavyTank' ? 0.03 - : tank.type === 'AT-SPG' + : tank.class === 'AT-SPG' ? 0.07 : 0.05), ], [ camouflage, - tank.type === 'AT-SPG' - ? 0.04 - : tank.type === 'heavyTank' - ? 0.03 - : 0.02, + tank.class === 'AT-SPG' ? 0.04 : tank.class === 'heavyTank' ? 0.03 : 0.02, ], ); diff --git a/src/app/tools/tankopedia/[id]/components/Title.tsx b/src/app/tools/tankopedia/[id]/components/Title.tsx index 24a8febde..22caff8ce 100644 --- a/src/app/tools/tankopedia/[id]/components/Title.tsx +++ b/src/app/tools/tankopedia/[id]/components/Title.tsx @@ -30,7 +30,7 @@ export function Title() { - {[...TANK_TYPES].map((type, index) => ( + {[...TANK_CLASSES].map((type, index) => (