feat: more definition data

This commit is contained in:
TrèsAbhi committed 2023-12-17 20:47:33 -06:00
1 parent 68239351b5
commit 7a22ce5af5
5 files changed
+132 -108

No files matched your search

+1
View File
@@ -63,6 +63,7 @@
"tankstats",
"TEXCOORD",
"tresabhi",
"ubjson",
"Unicum",
"Unregistering",
"vickers",
+1 -1
View File
@@ -56,7 +56,7 @@
"react-dom": "^18.2.0",
"react-fuzzysort": "^1.0.1",
"satori": "^0.10.8",
"sharp": "^0.33.0",
"sharp": "^0.33.1",
"three": "^0.159.0",
"vite-node": "^0.34.5",
"vitepress": "^1.0.0-rc.20",
+20 -6
View File
@@ -19,6 +19,7 @@ import {
GunDefinition,
ShellDefinition,
ShellType,
TankDefinitionPrice,
TankDefinitions,
Tier,
TurretDefinition,
@@ -89,6 +90,7 @@ type ShellDefinitionsList = Record<
icons: Record<string, string>;
};
interface VehicleDefinitions {
invisibility: { moving: number; still: number; firePenalty: number };
turrets0: {
[key: string]: {
userString: number;
@@ -188,6 +190,10 @@ if (allTargets || targets?.includes('definitions')) {
for (const tankKey in tankList.root) {
const tank = tankList.root[tankKey];
const tankPrice: TankDefinitionPrice =
typeof tank.price === 'number'
? { type: 'credits', value: tank.price }
: { type: 'gold', value: tank.price['#text'] };
const tankDefinition = await readXMLDVPL<{ root: VehicleDefinitions }>(
`${DATA}/${DOI.vehicleDefinitions}/${nation}/${tankKey}.xml.dvpl`,
);
@@ -197,6 +203,13 @@ if (allTargets || targets?.includes('definitions')) {
(turretKey) => {
const turret = tankDefinition.root.turrets0[turretKey];
const turretId = toUniqueId(nation, turretList.root.ids[turretKey]);
const turretYaw = (
typeof turret.yawLimits === 'string'
? turret.yawLimits
: turret.yawLimits.at(-1)!
)
.split(' ')
.map(Number) as [number, number];
const turretGuns = Object.keys(turret.guns).map((gunKey) => {
const turretGunEntry = turret.guns[gunKey];
const gunId = toUniqueId(nation, gunList.root.ids[gunKey]);
@@ -272,12 +285,7 @@ if (allTargets || targets?.includes('definitions')) {
.replaceAll('_', ' ')
.replace(/^(Turret ([0-9] )?)+/, ''),
tier: turret.level as Tier,
yaw: (typeof turret.yawLimits === 'string'
? turret.yawLimits
: turret.yawLimits.at(-1)!
)
.split(' ')
.map(Number) as [number, number],
yaw: -turretYaw[0] + turretYaw[1] === 360 ? undefined : turretYaw,
guns: turretGuns,
} satisfies TurretDefinition;
},
@@ -301,6 +309,12 @@ if (allTargets || targets?.includes('definitions')) {
type: blitzTankTypeToBlitzkrieg[tankTags[0] as BlitzTankType],
testing: tankTags.includes('testTank') ? true : undefined,
turrets: tankTurrets,
price: tankPrice,
camouflage: {
still: tankDefinition.root.invisibility.still,
moving: tankDefinition.root.invisibility.moving,
firing: tankDefinition.root.invisibility.firePenalty,
},
};
}
}),
+49 -42
View File
@@ -3,6 +3,55 @@ import { TankType, TreeTypeString } from '../../components/Tanks';
import { asset } from './asset';
export type ShellType = 'ap' | 'ap_cr' | 'hc' | 'he';
export type TankDefinitions = Record<number, TankDefinition>;
export interface TankDefinition {
id: number;
nation: string;
name: string;
tree_type: TreeTypeString;
tier: Tier;
type: TankType;
testing?: boolean;
turrets: TurretDefinition[];
price: TankDefinitionPrice;
camouflage: { still: number; moving: number; firing: number };
}
export type TankDefinitionPrice =
| { type: 'credits'; value: number }
| { type: 'gold'; value: number };
export interface TurretDefinition {
id: number;
name: string;
tier: Tier;
yaw?: [number, number];
guns: GunDefinition[];
}
export type GunDefinition = GunDefinitionBase &
(GunDefinitionRegular | GunDefinitionAutoLoader | GunDefinitionAutoReloader);
interface GunDefinitionBase {
id: number;
name: string;
tier: Tier;
pitch: [number, number];
shells: ShellDefinition[];
}
interface GunDefinitionRegular {
type: 'regular';
reload: number;
}
interface GunDefinitionAutoLoader {
type: 'auto_loader';
reload: number;
interClip: number;
count: number;
}
interface GunDefinitionAutoReloader {
type: 'auto_reloader';
reload: number[];
interClip: number;
count: number;
}
export interface ShellDefinition {
id: number;
name: string;
@@ -14,48 +63,6 @@ export interface ShellDefinition {
type: ShellType;
icon: string;
}
export type GunDefinition = {
id: number;
name: string;
tier: Tier;
pitch: [number, number];
shells: ShellDefinition[];
} & (
| {
type: 'regular';
reload: number;
}
| {
type: 'auto_loader';
reload: number;
interClip: number;
count: number;
}
| {
type: 'auto_reloader';
reload: number[];
interClip: number;
count: number;
}
);
export interface TurretDefinition {
id: number;
name: string;
tier: Tier;
yaw: [number, number];
guns: GunDefinition[];
}
export interface TankDefinition {
id: number;
nation: string;
name: string;
tree_type: TreeTypeString;
tier: Tier;
type: TankType;
testing?: boolean;
turrets: TurretDefinition[];
}
export type TankDefinitions = Record<number, TankDefinition>;
export const tankDefinitions = fetch(asset('definitions/tanks.json'), {
cache: 'no-cache',
+61 -59
View File
@@ -826,17 +826,17 @@
resolved "https://registry.yarnpkg.com/@floating-ui/utils/-/utils-0.1.6.tgz#22958c042e10b67463997bd6ea7115fe28cbcaf9"
integrity sha512-OfX7E2oUDYxtBvsuS4e/jSn4Q9Qb6DzgeYtsAdkPZ47znpoNsMgZw0+tVijiv3uGNR6dgNlty6r9rzIzHjtd/A==
"@img/[email protected].0":
version "0.33.0"
resolved "https://registry.yarnpkg.com/@img/sharp-darwin-arm64/-/sharp-darwin-arm64-0.33.0.tgz#b3e4ed1887f53faca5e95e3fd9f25181432353ed"
integrity sha512-070tEheekI1LJWTGPC9WlQEa5UoKTXzzlORBHMX4TbfUxMiL336YHR8vBEUNsjse0RJCX8dZ4ZXwT595aEF1ug==
"@img/[email protected].1":
version "0.33.1"
resolved "https://registry.yarnpkg.com/@img/sharp-darwin-arm64/-/sharp-darwin-arm64-0.33.1.tgz#9d3cb0e4899b10b003608a018877b45b6db02861"
integrity sha512-esr2BZ1x0bo+wl7Gx2hjssYhjrhUsD88VQulI0FrG8/otRQUOxLWHMBd1Y1qo2Gfg2KUvXNpT0ASnV9BzJCexw==
optionalDependencies:
"@img/sharp-libvips-darwin-arm64" "1.0.0"
"@img/[email protected].0":
version "0.33.0"
resolved "https://registry.yarnpkg.com/@img/sharp-darwin-x64/-/sharp-darwin-x64-0.33.0.tgz#277714bff6e6d468162146019933a416467f3082"
integrity sha512-pu/nvn152F3qbPeUkr+4e9zVvEhD3jhwzF473veQfMPkOYo9aoWXSfdZH/E6F+nYC3qvFjbxbvdDbUtEbghLqw==
"@img/[email protected].1":
version "0.33.1"
resolved "https://registry.yarnpkg.com/@img/sharp-darwin-x64/-/sharp-darwin-x64-0.33.1.tgz#3ad6b275dba0ed9995ce4403fc2c59b0475a0162"
integrity sha512-YrnuB3bXuWdG+hJlXtq7C73lF8ampkhU3tMxg5Hh+E7ikxbUVOU9nlNtVTloDXz6pRHt2y2oKJq7DY/yt+UXYw==
optionalDependencies:
"@img/sharp-libvips-darwin-x64" "1.0.0"
@@ -880,64 +880,64 @@
resolved "https://registry.yarnpkg.com/@img/sharp-libvips-linuxmusl-x64/-/sharp-libvips-linuxmusl-x64-1.0.0.tgz#af33a04e75f192c5396c6a41df8b7b7bf15a8006"
integrity sha512-FW8iK6rJrg+X2jKD0Ajhjv6y74lToIBEvkZhl42nZt563FfxkCYacrXZtd+q/sRQDypQLzY5WdLkVTbJoPyqNg==
"@img/[email protected].0":
version "0.33.0"
resolved "https://registry.yarnpkg.com/@img/sharp-linux-arm64/-/sharp-linux-arm64-0.33.0.tgz#d9a361c1d5344754f6038cc9d74e1dd4d217f52f"
integrity sha512-dcomVSrtgF70SyOr8RCOCQ8XGVThXwe71A1d8MGA+mXEVRJ/J6/TrCbBEJh9ddcEIIsrnrkolaEvYSHqVhswQw==
"@img/[email protected].1":
version "0.33.1"
resolved "https://registry.yarnpkg.com/@img/sharp-linux-arm64/-/sharp-linux-arm64-0.33.1.tgz#3f419eb6f9ace924c511903a4d9034fb847de06b"
integrity sha512-59B5GRO2d5N3tIfeGHAbJps7cLpuWEQv/8ySd9109ohQ3kzyCACENkFVAnGPX00HwPTQcaBNF7HQYEfZyZUFfw==
optionalDependencies:
"@img/sharp-libvips-linux-arm64" "1.0.0"
"@img/[email protected].0":
version "0.33.0"
resolved "https://registry.yarnpkg.com/@img/sharp-linux-arm/-/sharp-linux-arm-0.33.0.tgz#e0f804033d99ce2af73c78d47eeb118e28b4af41"
integrity sha512-4horD3wMFd5a0ddbDY8/dXU9CaOgHjEHALAddXgafoR5oWq5s8X61PDgsSeh4Qupsdo6ycfPPSSNBrfVQnwwrg==
"@img/[email protected].1":
version "0.33.1"
resolved "https://registry.yarnpkg.com/@img/sharp-linux-arm/-/sharp-linux-arm-0.33.1.tgz#87e157716c55fa274dd652e71bf9a5b7c260f8ab"
integrity sha512-Ii4X1vnzzI4j0+cucsrYA5ctrzU9ciXERfJR633S2r39CiD8npqH2GMj63uFZRCFt3E687IenAdbwIpQOJ5BNA==
optionalDependencies:
"@img/sharp-libvips-linux-arm" "1.0.0"
"@img/[email protected].0":
version "0.33.0"
resolved "https://registry.yarnpkg.com/@img/sharp-linux-s390x/-/sharp-linux-s390x-0.33.0.tgz#4b6d49f87364c60ae015825746f365385f1c3b54"
integrity sha512-TiVJbx38J2rNVfA309ffSOB+3/7wOsZYQEOlKqOUdWD/nqkjNGrX+YQGz7nzcf5oy2lC+d37+w183iNXRZNngQ==
"@img/[email protected].1":
version "0.33.1"
resolved "https://registry.yarnpkg.com/@img/sharp-linux-s390x/-/sharp-linux-s390x-0.33.1.tgz#c554567bb211cb1e916562752e70ef65df0cdcb7"
integrity sha512-tRGrb2pHnFUXpOAj84orYNxHADBDIr0J7rrjwQrTNMQMWA4zy3StKmMvwsI7u3dEZcgwuMMooIIGWEWOjnmG8A==
optionalDependencies:
"@img/sharp-libvips-linux-s390x" "1.0.0"
"@img/[email protected].0":
version "0.33.0"
resolved "https://registry.yarnpkg.com/@img/sharp-linux-x64/-/sharp-linux-x64-0.33.0.tgz#a4fb262f143f468aec974aad6e53d1859a75ec90"
integrity sha512-PaZM4Zi7/Ek71WgTdvR+KzTZpBqrQOFcPe7/8ZoPRlTYYRe43k6TWsf4GVH6XKRLMYeSp8J89RfAhBrSP4itNA==
"@img/[email protected].1":
version "0.33.1"
resolved "https://registry.yarnpkg.com/@img/sharp-linux-x64/-/sharp-linux-x64-0.33.1.tgz#c8623c743e2a68b460b63bd2e225b1b5a485d144"
integrity sha512-4y8osC0cAc1TRpy02yn5omBeloZZwS62fPZ0WUAYQiLhSFSpWJfY/gMrzKzLcHB9ulUV6ExFiu2elMaixKDbeg==
optionalDependencies:
"@img/sharp-libvips-linux-x64" "1.0.0"
"@img/[email protected].0":
version "0.33.0"
resolved "https://registry.yarnpkg.com/@img/sharp-linuxmusl-arm64/-/sharp-linuxmusl-arm64-0.33.0.tgz#423a9e5e3ec1e6476dbdfd78dda91c6f062bfd67"
integrity sha512-1QLbbN0zt+32eVrg7bb1lwtvEaZwlhEsY1OrijroMkwAqlHqFj6R33Y47s2XUv7P6Ie1PwCxK/uFnNqMnkd5kg==
"@img/[email protected].1":
version "0.33.1"
resolved "https://registry.yarnpkg.com/@img/sharp-linuxmusl-arm64/-/sharp-linuxmusl-arm64-0.33.1.tgz#1b17f9950246108cb22cf98f1822fbe4a5b0dc9e"
integrity sha512-D3lV6clkqIKUizNS8K6pkuCKNGmWoKlBGh5p0sLO2jQERzbakhu4bVX1Gz+RS4vTZBprKlWaf+/Rdp3ni2jLfA==
optionalDependencies:
"@img/sharp-libvips-linuxmusl-arm64" "1.0.0"
"@img/[email protected].0":
version "0.33.0"
resolved "https://registry.yarnpkg.com/@img/sharp-linuxmusl-x64/-/sharp-linuxmusl-x64-0.33.0.tgz#9d0beac9a71cd7d3bc41eef63521e60edc3820f5"
integrity sha512-CecqgB/CnkvCWFhmfN9ZhPGMLXaEBXl4o7WtA6U3Ztrlh/s7FUKX4vNxpMSYLIrWuuzjiaYdfU3+Tdqh1xaHfw==
"@img/[email protected].1":
version "0.33.1"
resolved "https://registry.yarnpkg.com/@img/sharp-linuxmusl-x64/-/sharp-linuxmusl-x64-0.33.1.tgz#69e2ab197c6d6e7a09748e0f2d03244d2c2afed7"
integrity sha512-LOGKNu5w8uu1evVqUAUKTix2sQu1XDRIYbsi5Q0c/SrXhvJ4QyOx+GaajxmOg5PZSsSnCYPSmhjHHsRBx06/wQ==
optionalDependencies:
"@img/sharp-libvips-linuxmusl-x64" "1.0.0"
"@img/[email protected].0":
version "0.33.0"
resolved "https://registry.yarnpkg.com/@img/sharp-wasm32/-/sharp-wasm32-0.33.0.tgz#5b085509f04256c43f201552fce5144fe0bd66b9"
integrity sha512-Hn4js32gUX9qkISlemZBUPuMs0k/xNJebUNl/L6djnU07B/HAA2KaxRVb3HvbU5fL242hLOcp0+tR+M8dvJUFw==
"@img/[email protected].1":
version "0.33.1"
resolved "https://registry.yarnpkg.com/@img/sharp-wasm32/-/sharp-wasm32-0.33.1.tgz#aa6f33a8535e6bd4a66c59aeb569499db9d30043"
integrity sha512-vWI/sA+0p+92DLkpAMb5T6I8dg4z2vzCUnp8yvxHlwBpzN8CIcO3xlSXrLltSvK6iMsVMNswAv+ub77rsf25lA==
dependencies:
"@emnapi/runtime" "^0.44.0"
"@img/[email protected].0":
version "0.33.0"
resolved "https://registry.yarnpkg.com/@img/sharp-win32-ia32/-/sharp-win32-ia32-0.33.0.tgz#a89bc502a70e5547cbff9451d06f9962425e7b39"
integrity sha512-5HfcsCZi3l5nPRF2q3bllMVMDXBqEWI3Q8KQONfzl0TferFE5lnsIG0A1YrntMAGqvkzdW6y1Ci1A2uTvxhfzg==
"@img/[email protected].1":
version "0.33.1"
resolved "https://registry.yarnpkg.com/@img/sharp-win32-ia32/-/sharp-win32-ia32-0.33.1.tgz#8df522d79b3c08f59e65fbe773849daa353c4f12"
integrity sha512-/xhYkylsKL05R+NXGJc9xr2Tuw6WIVl2lubFJaFYfW4/MQ4J+dgjIo/T4qjNRizrqs/szF/lC9a5+updmY9jaQ==
"@img/[email protected].0":
version "0.33.0"
resolved "https://registry.yarnpkg.com/@img/sharp-win32-x64/-/sharp-win32-x64-0.33.0.tgz#bfae1b82608a0d420e4b0b836ddb7dd58eaffa8e"
integrity sha512-i3DtP/2ce1yKFj4OzOnOYltOEL/+dp4dc4dJXJBv6god1AFTcmkaA99H/7SwOmkCOBQkbVvA3lCGm3/5nDtf9Q==
"@img/[email protected].1":
version "0.33.1"
resolved "https://registry.yarnpkg.com/@img/sharp-win32-x64/-/sharp-win32-x64-0.33.1.tgz#8b56e97dc9d987b070d7530a357161d0f057c5af"
integrity sha512-XaM69X0n6kTEsp9tVYYLhXdg7Qj32vYJlAKRutxUsm1UlgQNx6BOhHwZPwukCGXBU2+tH87ip2eV1I/E8MQnZg==
"@isaacs/cliui@^8.0.2":
version "8.0.2"
@@ -5454,17 +5454,17 @@ [email protected]:
resolved "https://registry.yarnpkg.com/setprototypeof/-/setprototypeof-1.2.0.tgz#66c9a24a73f9fc28cbe66b09fed3d33dcaf1b424"
integrity sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==
sharp@^0.33.0:
version "0.33.0"
resolved "https://registry.yarnpkg.com/sharp/-/sharp-0.33.0.tgz#95f77cda3684522e210ab55a167dad6cb5fbfe4f"
integrity sha512-99DZKudjm/Rmz+M0/26t4DKpXyywAOJaayGS9boEn7FvgtG0RYBi46uPE2c+obcJRtA3AZa0QwJot63gJQ1F0Q==
sharp@^0.33.1:
version "0.33.1"
resolved "https://registry.yarnpkg.com/sharp/-/sharp-0.33.1.tgz#81e8778b9f5e2b195666cf56b2e5a110c2399d70"
integrity sha512-iAYUnOdTqqZDb3QjMneBKINTllCJDZ3em6WaWy7NPECM4aHncvqHRm0v0bN9nqJxMiwamv5KIdauJ6lUzKDpTQ==
dependencies:
color "^4.2.3"
detect-libc "^2.0.2"
semver "^7.5.4"
optionalDependencies:
"@img/sharp-darwin-arm64" "0.33.0"
"@img/sharp-darwin-x64" "0.33.0"
"@img/sharp-darwin-arm64" "0.33.1"
"@img/sharp-darwin-x64" "0.33.1"
"@img/sharp-libvips-darwin-arm64" "1.0.0"
"@img/sharp-libvips-darwin-x64" "1.0.0"
"@img/sharp-libvips-linux-arm" "1.0.0"
@@ -5473,15 +5473,15 @@ sharp@^0.33.0:
"@img/sharp-libvips-linux-x64" "1.0.0"
"@img/sharp-libvips-linuxmusl-arm64" "1.0.0"
"@img/sharp-libvips-linuxmusl-x64" "1.0.0"
"@img/sharp-linux-arm" "0.33.0"
"@img/sharp-linux-arm64" "0.33.0"
"@img/sharp-linux-s390x" "0.33.0"
"@img/sharp-linux-x64" "0.33.0"
"@img/sharp-linuxmusl-arm64" "0.33.0"
"@img/sharp-linuxmusl-x64" "0.33.0"
"@img/sharp-wasm32" "0.33.0"
"@img/sharp-win32-ia32" "0.33.0"
"@img/sharp-win32-x64" "0.33.0"
"@img/sharp-linux-arm" "0.33.1"
"@img/sharp-linux-arm64" "0.33.1"
"@img/sharp-linux-s390x" "0.33.1"
"@img/sharp-linux-x64" "0.33.1"
"@img/sharp-linuxmusl-arm64" "0.33.1"
"@img/sharp-linuxmusl-x64" "0.33.1"
"@img/sharp-wasm32" "0.33.1"
"@img/sharp-win32-ia32" "0.33.1"
"@img/sharp-win32-x64" "0.33.1"
shebang-command@^2.0.0:
version "2.0.0"
@@ -5624,6 +5624,7 @@ streamsearch@^1.1.0:
integrity sha512-Mcc5wHehp9aXz1ax6bZUyY5afg9u2rv5cqQI3mRrYkGC8rW2hM02jWuwjtL++LS5qinSyhj2QfLyNsuc+VsExg==
"string-width-cjs@npm:string-width@^4.2.0", string-width@^4.1.0:
name string-width-cjs
version "4.2.3"
resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010"
integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
@@ -5674,6 +5675,7 @@ stringify-entities@^4.0.0:
character-entities-legacy "^3.0.0"
"strip-ansi-cjs@npm:strip-ansi@^6.0.1", strip-ansi@^6.0.0, strip-ansi@^6.0.1:
name strip-ansi-cjs
version "6.0.1"
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9"
integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==