mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-23 11:39:50 +02:00
feat: no flags
This commit is contained in:
1 parent
0250546ab5
commit
e835498e59
13 files changed
+72
-61
No files matched your search
@@ -1,11 +1,11 @@
|
||||
import { TreeTypeEnum } from '../../components/Tanks';
|
||||
import { TreeType } from '../../components/Tanks';
|
||||
import { tankDefinitions } from '../blitzkrieg/tankDefinitions';
|
||||
|
||||
export default async function getTreeType(id: number) {
|
||||
export default async function getTreeType(id: number): Promise<TreeType> {
|
||||
const entry = (await tankDefinitions)[id];
|
||||
|
||||
if (entry.tree_type === 'collector') return TreeTypeEnum.Collector;
|
||||
if (entry.tree_type === 'premium') return TreeTypeEnum.Premium;
|
||||
if (entry.tree_type === 'collector') return 'collector';
|
||||
if (entry.tree_type === 'premium') return 'premium';
|
||||
|
||||
return TreeTypeEnum.TechTree;
|
||||
return 'researchable';
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
import { deburr } from 'lodash';
|
||||
import { Vector2Tuple } from 'three';
|
||||
import { TankType, TreeTypeString } from '../../components/Tanks';
|
||||
import { TankType, TreeType } from '../../components/Tanks';
|
||||
import { asset } from './asset';
|
||||
|
||||
export type ShellType = 'ap' | 'ap_cr' | 'hc' | 'he';
|
||||
@@ -18,7 +18,7 @@ export interface TankDefinition {
|
||||
nation: string;
|
||||
name: string;
|
||||
name_full?: string;
|
||||
tree_type: TreeTypeString;
|
||||
tree_type: TreeType;
|
||||
consumables: number;
|
||||
provisions: number;
|
||||
tier: Tier;
|
||||
|
||||
@@ -3,7 +3,7 @@ import {
|
||||
SlashCommandSubcommandBuilder,
|
||||
SlashCommandSubcommandGroupBuilder,
|
||||
} from 'discord.js';
|
||||
import { TREE_TYPE_NAMES, TreeTypeString } from '../../components/Tanks';
|
||||
import { TREE_TYPE_NAMES, TreeType } from '../../components/Tanks';
|
||||
import { encyclopediaInfo } from '../blitz/encyclopediaInfo';
|
||||
import addPeriodSubCommands from './addPeriodSubCommands';
|
||||
import addTankChoices from './addTankChoices';
|
||||
@@ -56,15 +56,15 @@ export default async function addFilterOptions<
|
||||
.addChoices(
|
||||
{
|
||||
name: TREE_TYPE_NAMES['researchable'],
|
||||
value: 'researchable' satisfies TreeTypeString,
|
||||
value: 'researchable' satisfies TreeType,
|
||||
},
|
||||
{
|
||||
name: TREE_TYPE_NAMES.premium,
|
||||
value: 'premium' satisfies TreeTypeString,
|
||||
value: 'premium' satisfies TreeType,
|
||||
},
|
||||
{
|
||||
name: TREE_TYPE_NAMES.collector,
|
||||
value: 'collector' satisfies TreeTypeString,
|
||||
value: 'collector' satisfies TreeType,
|
||||
},
|
||||
)
|
||||
.setRequired(false),
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { ButtonInteraction } from 'discord.js';
|
||||
import { TreeTypeString } from '../../components/Tanks';
|
||||
import { TreeType } from '../../components/Tanks';
|
||||
import { StatFilters } from '../statistics/filterStats';
|
||||
|
||||
export function getFiltersFromButton(interaction: ButtonInteraction) {
|
||||
@@ -10,8 +10,7 @@ export function getFiltersFromButton(interaction: ButtonInteraction) {
|
||||
tank: parseInt(url.searchParams.get('tank') ?? '0') || undefined,
|
||||
tankType: url.searchParams.get('tank-type') ?? undefined,
|
||||
treeType:
|
||||
(url.searchParams.get('tree-type') as TreeTypeString | undefined) ??
|
||||
undefined,
|
||||
(url.searchParams.get('tree-type') as TreeType | undefined) ?? undefined,
|
||||
tier: parseInt(url.searchParams.get('tier') ?? '0') || undefined,
|
||||
} satisfies StatFilters;
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
import { ChatInputCommandInteraction } from 'discord.js';
|
||||
import { TreeTypeString } from '../../components/Tanks';
|
||||
import { TreeType } from '../../components/Tanks';
|
||||
import resolveTankId from '../blitz/resolveTankId';
|
||||
import { StatFilters } from '../statistics/filterStats';
|
||||
|
||||
@@ -13,9 +13,8 @@ export async function getFiltersFromCommand(
|
||||
tier: parseInt(interaction.options.getString('tier') ?? '0') || undefined,
|
||||
tankType: interaction.options.getString('tank-type') ?? undefined,
|
||||
treeType:
|
||||
(interaction.options.getString('tree-type') as
|
||||
| TreeTypeString
|
||||
| undefined) ?? undefined,
|
||||
(interaction.options.getString('tree-type') as TreeType | undefined) ??
|
||||
undefined,
|
||||
tank: tankRaw === null ? undefined : await resolveTankId(tankRaw),
|
||||
} satisfies StatFilters;
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
import { TreeTypeString } from '../../components/Tanks';
|
||||
import { TreeType } from '../../components/Tanks';
|
||||
import { tankDefinitions } from '../blitzkrieg/tankDefinitions';
|
||||
import { DiffedTankStats } from '../blitzstars/getStatsInPeriod';
|
||||
import { tankAverages } from '../blitzstars/tankAverages';
|
||||
@@ -9,7 +9,7 @@ export interface StatFilters {
|
||||
nation?: string;
|
||||
tier?: number;
|
||||
tankType?: string;
|
||||
treeType?: TreeTypeString;
|
||||
treeType?: TreeType;
|
||||
tank?: number;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user