mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-23 03:29:51 +02:00
feat: more defs
This commit is contained in:
1 parent
2e2ab9b2d9
commit
66dbc5b2ed
10 files changed
+192
-73
No files matched your search
@@ -7,7 +7,7 @@ import { TreeTypeEnum } from '../../../components/Tanks';
|
||||
import { WARGAMING_APPLICATION_ID } from '../../../constants/wargamingApplicationID';
|
||||
import fetchBlitz from '../../../core/blitz/fetchBlitz';
|
||||
import {
|
||||
TankDefinition,
|
||||
BlitzkriegTankDefinition,
|
||||
tankDefinitions,
|
||||
} from '../../../core/blitzkrieg/definitions/tanks';
|
||||
import { tankAverages } from '../../../core/blitzstars/tankAverages';
|
||||
@@ -30,7 +30,7 @@ export default function SessionPage() {
|
||||
|
||||
list: {
|
||||
stats: IndividualTankStats;
|
||||
tankDefinitions?: TankDefinition;
|
||||
tankDefinitions?: BlitzkriegTankDefinition;
|
||||
career: IndividualTankStats;
|
||||
currentWN8?: number;
|
||||
careerWN8?: number;
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import { CaretLeftIcon, CaretRightIcon } from '@radix-ui/react-icons';
|
||||
import { Button, Flex, TextField } from '@radix-ui/themes';
|
||||
import { useEffect, useRef } from 'react';
|
||||
import { TankDefinition } from '../../../../core/blitzkrieg/definitions/tanks';
|
||||
import { BlitzkriegTankDefinition } from '../../../../core/blitzkrieg/definitions/tanks';
|
||||
|
||||
interface PageTurnerProps {
|
||||
page: number;
|
||||
setPage: (page: number) => void;
|
||||
searchedList: TankDefinition[];
|
||||
searchedList: BlitzkriegTankDefinition[];
|
||||
tanksPerPage: number;
|
||||
}
|
||||
|
||||
|
||||
@@ -20,11 +20,11 @@ import { Suspense, use, useEffect, useMemo, useRef, useState } from 'react';
|
||||
import PageWrapper from '../../../components/PageWrapper';
|
||||
import { asset } from '../../../core/blitzkrieg/asset';
|
||||
import {
|
||||
BlitzkriegTankDefinition,
|
||||
TANK_ICONS,
|
||||
TANK_ICONS_COLLECTOR,
|
||||
TANK_ICONS_PREMIUM,
|
||||
TIER_ROMAN_NUMERALS,
|
||||
TankDefinition,
|
||||
tanksDefinitionsArray,
|
||||
} from '../../../core/blitzkrieg/definitions/tanks';
|
||||
import { tankIcon } from '../../../core/blitzkrieg/tankIcon';
|
||||
@@ -125,7 +125,7 @@ export default function Page() {
|
||||
'name',
|
||||
'name_short',
|
||||
'id',
|
||||
] satisfies (keyof TankDefinition)[],
|
||||
] satisfies (keyof BlitzkriegTankDefinition)[],
|
||||
}).map(({ obj }) => obj),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -10,8 +10,8 @@ import getTankStats from '../core/blitz/getTankStats';
|
||||
import getTreeType from '../core/blitz/getTreeType';
|
||||
import resolveTankName from '../core/blitz/resolveTankName';
|
||||
import {
|
||||
BlitzkriegTankDefinition,
|
||||
TIER_ROMAN_NUMERALS,
|
||||
TankDefinition,
|
||||
Tier,
|
||||
tankDefinitions,
|
||||
} from '../core/blitzkrieg/definitions/tanks';
|
||||
@@ -48,7 +48,7 @@ export const ownedTanksCommand: CommandRegistry = {
|
||||
)
|
||||
).filter((tank) => tank.tankDefinitions?.tier === tier);
|
||||
const clanAccountInfo = await getClanAccountInfo(server, id, ['clan']);
|
||||
const groupedTanks: Record<string, TankDefinition[]> = {};
|
||||
const groupedTanks: Record<string, BlitzkriegTankDefinition[]> = {};
|
||||
const nations: string[] = [];
|
||||
|
||||
filteredTanks.forEach((tank) => {
|
||||
|
||||
@@ -5,5 +5,5 @@ export async function readXMLDVPL<Type>(file: string) {
|
||||
const parser = new XMLParser();
|
||||
const xml = await readStringDVPL(file);
|
||||
|
||||
return parser.parse(xml).root as Type;
|
||||
return parser.parse(xml) as Type;
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
import { NATION_IDS } from '../../constants/nations';
|
||||
|
||||
export function toUniqueId(nation: string, id: number) {
|
||||
return (id << 8) + (NATION_IDS[nation] << 4) + 1;
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
export interface BlitzkriegGunDefinition {
|
||||
id: number;
|
||||
name: string;
|
||||
tier: number;
|
||||
pitch: [number, number];
|
||||
}
|
||||
|
||||
export type BlitzkriegGunDefinitions = Record<number, BlitzkriegGunDefinition>;
|
||||
@@ -2,27 +2,31 @@ import { deburr } from 'lodash';
|
||||
import { TankType, TreeTypeString } from '../../../components/Tanks';
|
||||
import { asset } from '../asset';
|
||||
|
||||
export interface TankDefinition {
|
||||
export interface BlitzkriegTankDefinition {
|
||||
id: number;
|
||||
nation: string;
|
||||
name: string;
|
||||
name_short?: string;
|
||||
tree_type: TreeTypeString;
|
||||
tier: Tier;
|
||||
type: TankType;
|
||||
testing?: boolean;
|
||||
turrets: number[];
|
||||
}
|
||||
|
||||
export type TankDefinitions = Record<number, TankDefinition>;
|
||||
export type BlitzkriegTankDefinitions = Record<
|
||||
number,
|
||||
BlitzkriegTankDefinition
|
||||
>;
|
||||
|
||||
export const tankDefinitions = fetch(asset('definitions/tanks.json'), {
|
||||
cache: 'no-cache',
|
||||
}).then(async (response) => response.json() as Promise<TankDefinitions>);
|
||||
}).then(
|
||||
async (response) => response.json() as Promise<BlitzkriegTankDefinitions>,
|
||||
);
|
||||
|
||||
const entries = new Promise<TankDefinition[]>(async (resolve) => {
|
||||
const entries = new Promise<BlitzkriegTankDefinition[]>(async (resolve) => {
|
||||
resolve(Object.entries(await tankDefinitions).map(([, entry]) => entry));
|
||||
});
|
||||
export const tanksDefinitionsArray = new Promise<TankDefinition[]>(
|
||||
export const tanksDefinitionsArray = new Promise<BlitzkriegTankDefinition[]>(
|
||||
async (resolve) => {
|
||||
resolve((await entries).map((entry) => entry));
|
||||
},
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
export interface BlitzkriegTurretDefinition {
|
||||
id: number;
|
||||
name: string;
|
||||
tier: number;
|
||||
yaw: [number, number];
|
||||
guns: number[];
|
||||
}
|
||||
|
||||
export type BlitzkriegTurretDefinitions = Record<
|
||||
number,
|
||||
BlitzkriegTurretDefinition
|
||||
>;
|
||||
Reference in new issue
Block a user