feat: rename tank types to tank classes

This commit is contained in:
TrèsAbhi committed 2024-03-07 18:30:02 -06:00
1 parent 3325536bbc
commit 53174db351
18 files changed
+53 -64

No files matched your search

+1 -1
View File
@@ -19,7 +19,7 @@ export async function filtersToDescription(
translate('bot.common.filters.tier', [TIER_ROMAN_NUMERALS[tier as Tier]]),
);
}
if (tankType) info.push(translate(`common.tank_type_short.${tankType}`));
if (tankType) info.push(translate(`common.tank_class_short.${tankType}`));
if (treeType) info.push(translate(`common.tree_type.${treeType}`));
return info.length === 0
+5 -5
View File
@@ -1,6 +1,6 @@
import { deburr } from 'lodash';
import { Vector2Tuple } from 'three';
import { TankType, TreeType } from '../../components/Tanks';
import { TankClass, TreeType } from '../../components/Tanks';
import { asset } from './asset';
import { fetchCdonLz4 } from './fetchCdonLz4';
@@ -44,7 +44,7 @@ export interface TankDefinition {
consumables: number;
provisions: number;
tier: Tier;
type: TankType;
class: TankClass;
testing?: boolean;
turrets: TurretDefinition[];
engines: EngineDefinition[];
@@ -180,21 +180,21 @@ export const tankNames = tanksDefinitionsArray.then((tanks) =>
),
);
export const TANK_ICONS: Record<TankType, string> = {
export const TANK_ICONS: Record<TankClass, string> = {
'AT-SPG': 'https://i.imgur.com/BIHSEH0.png',
lightTank: 'https://i.imgur.com/CSNha5V.png',
mediumTank: 'https://i.imgur.com/wvf3ltm.png',
heavyTank: 'https://i.imgur.com/ECeqlZa.png',
};
export const TANK_ICONS_PREMIUM: Record<TankType, string> = {
export const TANK_ICONS_PREMIUM: Record<TankClass, string> = {
'AT-SPG': 'https://i.imgur.com/TCu3EdR.png',
lightTank: 'https://i.imgur.com/zdkpTRb.png',
mediumTank: 'https://i.imgur.com/3z7eHX6.png',
heavyTank: 'https://i.imgur.com/P3vbmyA.png',
};
export const TANK_ICONS_COLLECTOR: Record<TankType, string> = {
export const TANK_ICONS_COLLECTOR: Record<TankClass, string> = {
'AT-SPG': 'https://i.imgur.com/WTjeirB.png',
lightTank: 'https://i.imgur.com/EwhtKkU.png',
mediumTank: 'https://i.imgur.com/u8YDMBh.png',
+8 -8
View File
@@ -4,7 +4,7 @@ import {
SlashCommandBuilder,
SlashCommandSubcommandBuilder,
} from 'discord.js';
import { TANK_TYPES, TREE_TYPES } from '../../components/Tanks';
import { TANK_CLASSES, TREE_TYPES } from '../../components/Tanks';
import { translator } from '../localization/translator';
import addTankChoices from './addTankChoices';
import addTierChoices from './addTierChoices';
@@ -46,26 +46,26 @@ export function addFilterOptions<
.addStringOption((option) => addTierChoices(option).setRequired(false))
.addStringOption((option) =>
option
.setName(translate('bot.common.options.filters.tank_type'))
.setName(translate('bot.common.options.filters.tank_class'))
.setNameLocalizations(
localizationObject('bot.common.options.filters.tank_type'),
localizationObject('bot.common.options.filters.tank_class'),
)
.setDescription(
translate('bot.common.options.filters.tank_type.description'),
translate('bot.common.options.filters.tank_class.description'),
)
.setDescriptionLocalizations(
localizationObject(
'bot.common.options.filters.tank_type.description',
'bot.common.options.filters.tank_class.description',
),
)
.addChoices(
...TANK_TYPES.map(
...TANK_CLASSES.map(
(tankType) =>
({
value: tankType,
name: translate(`common.tank_type_short.${tankType}`),
name: translate(`common.tank_class_short.${tankType}`),
name_localizations: localizationObject(
`common.tank_type_short.${tankType}`,
`common.tank_class_short.${tankType}`,
),
}) satisfies APIApplicationCommandOptionChoice,
),
+1 -1
View File
@@ -8,7 +8,7 @@ export function getFiltersFromButton(interaction: ButtonInteraction) {
return {
nation: url.searchParams.get('nation') ?? undefined,
tank: parseInt(url.searchParams.get('tank') ?? '0') || undefined,
tankType: url.searchParams.get('tank-type') ?? undefined,
tankType: url.searchParams.get('tank-class') ?? undefined,
treeType:
(url.searchParams.get('tree-type') as TreeType | undefined) ?? undefined,
tier: parseInt(url.searchParams.get('tier') ?? '0') || undefined,
+1 -1
View File
@@ -11,7 +11,7 @@ export async function getFiltersFromCommand(
return {
nation: interaction.options.getString('nation') ?? undefined,
tier: parseInt(interaction.options.getString('tier') ?? '0') || undefined,
tankType: interaction.options.getString('tank-type') ?? undefined,
tankType: interaction.options.getString('tank-class') ?? undefined,
treeType:
(interaction.options.getString('tree-type') as TreeType | undefined) ??
undefined,
+1 -1
View File
@@ -29,7 +29,7 @@ export async function filterStats(
entry &&
(filters.nation === undefined || entry.nation === filters.nation) &&
(filters.tier === undefined || entry.tier === filters.tier) &&
(filters.tankType === undefined || entry.type === filters.tankType) &&
(filters.tankType === undefined || entry.class === filters.tankType) &&
(filters.treeType === undefined ||
(filters.treeType === 'collector' && entry.treeType === 'collector') ||
(filters.treeType === 'premium' && entry.treeType === 'premium') ||