From 0ebf9f6c3deec2b93aaaec6bd7555008e5efbf64 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tr=C3=A8sAbhi?= <43380238+tresabhi@users.noreply.github.com> Date: Mon, 2 Feb 2026 22:00:46 -0600 Subject: [PATCH] feat: tank icon api --- packages/website-ue/src/core/game/game.ts | 5 +++++ packages/website-ue/src/pages/api/tanks/[id].webp.ts | 11 +++++++++++ packages/website-ue/src/protos/tank.proto | 3 ++- 3 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 packages/website-ue/src/core/game/game.ts create mode 100644 packages/website-ue/src/pages/api/tanks/[id].webp.ts diff --git a/packages/website-ue/src/core/game/game.ts b/packages/website-ue/src/core/game/game.ts new file mode 100644 index 000000000..696ab4e8e --- /dev/null +++ b/packages/website-ue/src/core/game/game.ts @@ -0,0 +1,5 @@ +import { GameInterface } from "@blitzkit/game"; + +export const game = new GameInterface( + "C:/Program Files (x86)/Steam/steamapps/common/World of Tanks Blitz Playtest", +); diff --git a/packages/website-ue/src/pages/api/tanks/[id].webp.ts b/packages/website-ue/src/pages/api/tanks/[id].webp.ts new file mode 100644 index 000000000..21cea66e8 --- /dev/null +++ b/packages/website-ue/src/pages/api/tanks/[id].webp.ts @@ -0,0 +1,11 @@ +import type { APIContext } from "astro"; +import { api } from "../../../core/api/dynamic"; +import { game } from "../../../core/game/game"; + +export { getStaticPaths } from "./[id].pb"; + +export async function GET({ params }: APIContext) { + const tank = await api.tank(params.id); + const image = game.tankBigIcon(params.id, tank.tank!.visual_data); + return new Response(new Uint8Array(image)); +} diff --git a/packages/website-ue/src/protos/tank.proto b/packages/website-ue/src/protos/tank.proto index c4f980327..c1cdeae6b 100644 --- a/packages/website-ue/src/protos/tank.proto +++ b/packages/website-ue/src/protos/tank.proto @@ -9,5 +9,6 @@ message Tank { blitz_static_tank_component.TankCatalogComponent tank = 1; blitz_static_compensation_component.CompensationComponent compensation = 2; - string slug = 3; + string id = 3; + string slug = 4; } \ No newline at end of file