Compare commits

...
6 Commits
Author SHA1 Message Date
TrèsAbhi 4033e8618f feat: useAwait 2025-11-30 22:12:46 -06:00
TrèsAbhi 42cada1811 feat: move and api 2025-11-30 21:06:17 -06:00
TrèsAbhi ff7ed213c8 feat: complete 2025-11-30 21:01:53 -06:00
TrèsAbhi a0367af06b feat: start of stats 2025-11-30 20:54:36 -06:00
TrèsAbhi 58c2965c53 Merge branch 'main' into ue 2025-11-30 20:27:42 -06:00
TrèsAbhi 2101dba7c6 New Crowdin updates (#184)
* New translations en.json (Russian)

* New translations en.json (Russian)

* New translations en.json (Russian)
2025-11-28 18:12:19 -06:00
11 changed files with 383 additions and 8 deletions

No files matched your search

+2
View File
@@ -61,6 +61,7 @@
"Ddpf",
"Ddsd",
"deadrail",
"DEBUFF",
"debugflags",
"deburr",
"decalmask",
@@ -173,6 +174,7 @@
"ratingleaderboard",
"raycaster",
"Redirector",
"REGEN",
"Relogin",
"researchable",
"Resvg",
+1 -1
View File
@@ -804,7 +804,7 @@
},
"guess": {
"name": "Угадать",
"button": "What could it be?",
"button": "Что это за танк?",
"description": "Мини-игра «Силуэт»",
"seo_description": "Играйте угадывая силуэт танка из World of Tanks Blitz",
"search": {
@@ -0,0 +1,250 @@
import { TankAttributeChange_AttributeName } from "@protos/blitz_static_tank_upgrade_single_stage";
export enum CharacteristicsGroup {
Firepower,
Maneuverability,
Survivability,
Miscellaneous,
}
type CharacteristicsOrder = {
group: CharacteristicsGroup;
attributes: {
name: TankAttributeChange_AttributeName;
}[];
}[];
export const characteristicsOrder: CharacteristicsOrder = [
{
group: CharacteristicsGroup.Firepower,
attributes: [
{
name: TankAttributeChange_AttributeName.ATTRIBUTE_NAME_RELOAD_TIME,
},
{
name: TankAttributeChange_AttributeName.ATTRIBUTE_NAME_DISPERSION_ANGLE,
},
{
name: TankAttributeChange_AttributeName.ATTRIBUTE_NAME_AIMING_TIME,
},
{
name: TankAttributeChange_AttributeName.ATTRIBUTE_NAME_DISPERSION_FACTOR_VEHICLE_MOVEMENT,
},
{
name: TankAttributeChange_AttributeName.ATTRIBUTE_NAME_DISPERSION_FACTOR_VEHICLE_ROTATION,
},
{
name: TankAttributeChange_AttributeName.ATTRIBUTE_NAME_DISPERSION_FACTOR_TURRET_ROTATION,
},
{
name: TankAttributeChange_AttributeName.ATTRIBUTE_NAME_DISPERSION_FACTOR_AFTER_SHOT,
},
{
name: TankAttributeChange_AttributeName.ATTRIBUTE_NAME_DISPERSION_FACTOR_WHILE_GUN_DAMAGED,
},
{
name: TankAttributeChange_AttributeName.ATTRIBUTE_NAME_PITCH_LIMIT_DOWN,
},
{
name: TankAttributeChange_AttributeName.ATTRIBUTE_NAME_PITCH_LIMIT_UP,
},
{
name: TankAttributeChange_AttributeName.ATTRIBUTE_NAME_YAW_LIMIT_LEFT,
},
{
name: TankAttributeChange_AttributeName.ATTRIBUTE_NAME_YAW_LIMIT_RIGHT,
},
{
name: TankAttributeChange_AttributeName.ATTRIBUTE_NAME_CLIP_SIZE,
},
{
name: TankAttributeChange_AttributeName.ATTRIBUTE_NAME_CLIP_RATE,
},
{
name: TankAttributeChange_AttributeName.ATTRIBUTE_NAME_IS_PUMP,
},
{
name: TankAttributeChange_AttributeName.ATTRIBUTE_NAME_SHELLS_SLOTS,
},
{
name: TankAttributeChange_AttributeName.ATTRIBUTE_NAME_BURST_SIZE,
},
{
name: TankAttributeChange_AttributeName.ATTRIBUTE_NAME_BURST_RATE,
},
{
name: TankAttributeChange_AttributeName.ATTRIBUTE_NAME_RELOAD_SPEED_SCALE,
},
{
name: TankAttributeChange_AttributeName.ATTRIBUTE_NAME_SHELLS_ARMOR_DAMAGE_MULTIPLIER,
},
{
name: TankAttributeChange_AttributeName.ATTRIBUTE_NAME_SHELLS_SPEED_MULTIPLIER,
},
{
name: TankAttributeChange_AttributeName.ATTRIBUTE_NAME_SHELLS_PIERCING_POWER_LOSS_REDUCTION,
},
{
name: TankAttributeChange_AttributeName.ATTRIBUTE_NAME_ENGINE_HIT_CHANCE_MULTIPLIER,
},
{
name: TankAttributeChange_AttributeName.ATTRIBUTE_NAME_CREW_HIT_CHANCE_MULTIPLIER,
},
{
name: TankAttributeChange_AttributeName.ATTRIBUTE_NAME_AMMO_BAY_EXPLOSION_CHANCE_MULTIPLIER,
},
{
name: TankAttributeChange_AttributeName.ATTRIBUTE_NAME_LARGE_CALIBER_HE_PIERCING_FACTOR,
},
{
name: TankAttributeChange_AttributeName.ATTRIBUTE_NAME_SHELLS_PIERCING_MULTIPLIER_AP,
},
{
name: TankAttributeChange_AttributeName.ATTRIBUTE_NAME_SHELLS_PIERCING_MULTIPLIER_APCR,
},
{
name: TankAttributeChange_AttributeName.ATTRIBUTE_NAME_SHELLS_PIERCING_MULTIPLIER_HC,
},
{
name: TankAttributeChange_AttributeName.ATTRIBUTE_NAME_SHELLS_PIERCING_MULTIPLIER_HE,
},
{
name: TankAttributeChange_AttributeName.ATTRIBUTE_NAME_TRACER_SHELLS_ENABLED,
},
{
name: TankAttributeChange_AttributeName.ATTRIBUTE_NAME_ROTATION_RELOAD_SPEED_SCALE,
},
{
name: TankAttributeChange_AttributeName.ATTRIBUTE_NAME_ARMOR_DAMAGE_HE_SHELLS,
},
{
name: TankAttributeChange_AttributeName.ATTRIBUTE_NAME_MODULE_DAMAGE_HE_SHELLS,
},
],
},
{
group: CharacteristicsGroup.Maneuverability,
attributes: [
{
name: TankAttributeChange_AttributeName.ATTRIBUTE_NAME_GUN_ROTATION_SPEED,
},
{
name: TankAttributeChange_AttributeName.ATTRIBUTE_NAME_TURRET_ROTATION_SPEED,
},
{
name: TankAttributeChange_AttributeName.ATTRIBUTE_NAME_HULL_ROTATION_SPEED,
},
{
name: TankAttributeChange_AttributeName.ATTRIBUTE_NAME_ENGINE_POWER,
},
{
name: TankAttributeChange_AttributeName.ATTRIBUTE_NAME_BRAKE_FORCE,
},
{
name: TankAttributeChange_AttributeName.ATTRIBUTE_NAME_MASS,
},
{
name: TankAttributeChange_AttributeName.ATTRIBUTE_NAME_FORWARD_MAX_SPEED,
},
{
name: TankAttributeChange_AttributeName.ATTRIBUTE_NAME_BACKWARD_MAX_SPEED,
},
{
name: TankAttributeChange_AttributeName.ATTRIBUTE_NAME_TERRAIN_RESISTANCE_HARD,
},
{
name: TankAttributeChange_AttributeName.ATTRIBUTE_NAME_TERRAIN_RESISTANCE_MEDIUM,
},
{
name: TankAttributeChange_AttributeName.ATTRIBUTE_NAME_TERRAIN_RESISTANCE_SOFT,
},
{
name: TankAttributeChange_AttributeName.ATTRIBUTE_NAME_TERRAIN_SIDE_FRICTION,
},
{
name: TankAttributeChange_AttributeName.ATTRIBUTE_NAME_TERRAIN_FORWARD_FRICTION,
},
{
name: TankAttributeChange_AttributeName.ATTRIBUTE_NAME_RESERVE_TRACK_BACKWARD_SPEED,
},
],
},
{
group: CharacteristicsGroup.Survivability,
attributes: [
{
name: TankAttributeChange_AttributeName.ATTRIBUTE_NAME_MAX_HEALTH,
},
{
name: TankAttributeChange_AttributeName.ATTRIBUTE_NAME_HEALTH_BURN_PER_SEC,
},
{
name: TankAttributeChange_AttributeName.ATTRIBUTE_NAME_CIRCULAR_VISION_RADIUS,
},
{
name: TankAttributeChange_AttributeName.ATTRIBUTE_NAME_CONCEALMENT_MOVING,
},
{
name: TankAttributeChange_AttributeName.ATTRIBUTE_NAME_CONCEALMENT_STILL,
},
{
name: TankAttributeChange_AttributeName.ATTRIBUTE_NAME_CONCEALMENT_FIRE_PENALTY,
},
{
name: TankAttributeChange_AttributeName.ATTRIBUTE_NAME_CONCEALMENT_FACTOR_AT_SHOT,
},
{
name: TankAttributeChange_AttributeName.ATTRIBUTE_NAME_FIRE_START_CHANCE,
},
{
name: TankAttributeChange_AttributeName.ATTRIBUTE_NAME_AVERAGE_THICKNESS,
},
{
name: TankAttributeChange_AttributeName.ATTRIBUTE_NAME_CONSUMABLE_COOLDOWN_MULTIPLIER,
},
{
name: TankAttributeChange_AttributeName.ATTRIBUTE_NAME_CONSUMABLE_DURATION_MULTIPLIER,
},
{
name: TankAttributeChange_AttributeName.ATTRIBUTE_NAME_CONSUMABLE_RECHARGE_SPEED_MULTIPLIER,
},
{
name: TankAttributeChange_AttributeName.ATTRIBUTE_NAME_RAMMING_DAMAGE_RESISTANCE,
},
{
name: TankAttributeChange_AttributeName.ATTRIBUTE_NAME_LARGE_CALIBER_HE_SHELLS_DAMAGE_RESISTANCE,
},
{
name: TankAttributeChange_AttributeName.ATTRIBUTE_NAME_ENHANCED_TRACKS_ENABLED,
},
{
name: TankAttributeChange_AttributeName.ATTRIBUTE_NAME_ARMOR_MULTIPLIER,
},
{
name: TankAttributeChange_AttributeName.ATTRIBUTE_NAME_MODULE_REGEN_PER_SEC_MULTIPLIER,
},
{
name: TankAttributeChange_AttributeName.ATTRIBUTE_NAME_MODULES_DAMAGED_DEBUFF_EFFICIENCY,
},
{
name: TankAttributeChange_AttributeName.ATTRIBUTE_NAME_MAX_FIRE_DURATION,
},
],
},
{
group: CharacteristicsGroup.Miscellaneous,
attributes: [
{
name: TankAttributeChange_AttributeName.ATTRIBUTE_NAME_CREW_XP_MULTIPLIER,
},
],
},
];
+10 -1
View File
@@ -1,3 +1,12 @@
import { TankCatalogComponent } from "@protos/blitz_static_tank_component";
import { AbstractAPI } from "./abstract";
export class ClientAPI extends AbstractAPI {}
export class ClientAPI extends AbstractAPI {
async tank(id: string) {
const response = await fetch(`/api/tanks/${id}.pb`);
const buffer = await response.arrayBuffer();
const array = new Uint8Array(buffer);
return TankCatalogComponent.decode(array);
}
}
@@ -5,6 +5,10 @@ import { parse } from "yaml";
import type { TanksEntry } from "../../protos/tanks";
import { AbstractAPI } from "./abstract";
if (typeof window !== "undefined") {
throw new Error("ServerAPI is being evaluated in the browser");
}
interface LocalizationConfig {
namespaces: string[];
}
+19
View File
@@ -0,0 +1,19 @@
import { use } from "react";
const cache = new Map<string, Promise<unknown>>();
export function useAwait<Type>(
creator: () => Promise<Type>,
discriminator: string
) {
let promise;
if (cache.has(discriminator)) {
promise = cache.get(discriminator) as Promise<Type>;
} else {
promise = creator();
cache.set(discriminator, promise);
}
return use(promise);
}
@@ -0,0 +1,14 @@
import { TankCatalogComponent } from "@protos/blitz_static_tank_component";
import type { APIContext, GetStaticPaths } from "astro";
import { api } from "../../../core/api/dynamic";
export const getStaticPaths = (async () => {
const { tanks } = await api.tanks();
return tanks.map(({ id }) => ({ params: { id } }));
}) satisfies GetStaticPaths;
export async function GET({ params }: APIContext<never, { id: string }>) {
const tank = await api.tank(params.id);
return new Response(TankCatalogComponent.encode(tank).finish());
}
@@ -0,0 +1,5 @@
import { characteristicsOrder } from "../../../../constants/characteristicsOrder";
export function GET() {
return Response.json(characteristicsOrder);
}
@@ -0,0 +1,69 @@
import {
TankAttributeChange_AttributeName,
TankAttributeChange_Modifier,
} from "@protos/blitz_static_tank_upgrade_single_stage";
import { Suspense, useMemo } from "react";
import {
CharacteristicsGroup,
characteristicsOrder,
} from "../../../constants/characteristicsOrder";
import { api } from "../../../core/api/dynamic";
import { useAwait } from "../../../hooks/useAwait";
import { Tankopedia } from "../../../stores/tankopedia";
export function Page({ id }: { id: string }) {
return (
<Suspense fallback={null}>
<Content id={id} />
</Suspense>
);
}
function Content({ id }: { id: string }) {
const tank = useAwait(() => api.tank(id), `tank-${id}`);
const stage = Tankopedia.use((state) => state.stage);
const attributes = useMemo(() => {
const attributes: Partial<
Record<TankAttributeChange_AttributeName, number>
> = {};
for (const { attribute_name, value, modifier } of tank.base_stats!
.attributes) {
if (modifier !== TankAttributeChange_Modifier.MODIFIER_OVERRIDE) {
throw new Error(
`Unexpected modifier ${TankAttributeChange_Modifier[modifier]}`
);
}
attributes[attribute_name] = value;
}
return attributes;
}, [stage]);
return (
<>
<h1>{tank.name?.value}</h1>
<h2>Characteristics</h2>
{characteristicsOrder.map((group) => (
<>
<h2>{CharacteristicsGroup[group.group]}</h2>
{group.attributes.map(
(attribute) =>
attribute.name in attributes && (
<p>
{TankAttributeChange_AttributeName[attribute.name]}:{" "}
{attributes[attribute.name]}
</p>
)
)}
</>
))}
</>
);
}
@@ -1,6 +1,7 @@
---
import type { GetStaticPaths } from "astro";
import { api } from "../../../core/api/dynamic";
import { Page } from "./_index";
export const getStaticPaths = (async () => {
const { tanks } = await api.tanks();
@@ -14,9 +15,4 @@ export const getStaticPaths = (async () => {
const { id } = Astro.props;
---
<h1>Tank {id}</h1>
<code>
<pre>{JSON.stringify(await api.tank(id) , null, 2)}</pre>
</code>
<Page {id} client:load />
@@ -0,0 +1,7 @@
import { Varuna } from "varuna";
interface Tankopedia {
stage: number;
}
export const Tankopedia = new Varuna<Tankopedia>({ stage: 0 });