fix: some more imports

This commit is contained in:
TrèsAbhi committed 2026-04-14 20:34:28 -05:00
1 parent 13927927b3
commit a149af50fd
11 files changed
+79 -81

No files matched your search

+3 -2
View File
@@ -1,4 +1,6 @@
{ {
"js/ts.experimental.useTsgo": true,
"protobuf.includes": ["${workspaceFolder}/path/to/protos"],
"cSpell.words": [ "cSpell.words": [
"AABBOX", "AABBOX",
"Abhi", "Abhi",
@@ -262,6 +264,5 @@
"youtuber", "youtuber",
"youtubers", "youtubers",
"zoomable" "zoomable"
], ]
"protobuf.includes": ["${workspaceFolder}/path/to/protos"]
} }
+9 -9
View File
@@ -1,14 +1,14 @@
import type { Strings } from "@blitzkit/i18n"; import type { Strings } from "@blitzkit/i18n";
import locales from "@blitzkit/i18n/locales.json"; import locales from "@blitzkit/i18n/locales.json";
import type { Avatar } from "../../protos/avatar"; import type { Avatar } from "@protos/blitzkit/avatar";
import type { AvatarList } from "../../protos/avatar_list"; import type { AvatarList } from "@protos/blitzkit/avatar_list";
import type { Avatars } from "../../protos/avatars"; import type { Avatars } from "@protos/blitzkit/avatars";
import type { Background } from "../../protos/background"; import type { Background } from "@protos/blitzkit/background";
import type { Backgrounds } from "../../protos/backgrounds"; import type { Backgrounds } from "@protos/blitzkit/backgrounds";
import type { PopularTanks } from "../../protos/popular_tanks"; import type { PopularTanks } from "@protos/blitzkit/popular_tanks";
import type { Tank } from "../../protos/tank"; import type { Tank } from "@protos/blitzkit/tank";
import type { TankList } from "../../protos/tank_list"; import type { TankList } from "@protos/blitzkit/tank_list";
import type { Tanks } from "../../protos/tanks"; import type { Tanks } from "@protos/blitzkit/tanks";
export abstract class AbstractAPI { export abstract class AbstractAPI {
abstract tankList(): Promise<TankList>; abstract tankList(): Promise<TankList>;
+14 -18
View File
@@ -186,7 +186,7 @@ export class ServerAPI extends AbstractAPI {
return strings; return strings;
} }
@Cache() // @Cache()
async gameStrings(locale: string) { async gameStrings(locale: string) {
const group = this.metadata.group("ClientConfigsEntity"); const group = this.metadata.group("ClientConfigsEntity");
@@ -199,8 +199,6 @@ export class ServerAPI extends AbstractAPI {
const clientConfig = this.metadata.item(group[0].id); const clientConfig = this.metadata.item(group[0].id);
const localizationResources = clientConfig.LocalizationResources(); const localizationResources = clientConfig.LocalizationResources();
console.log("localizationResources", localizationResources);
if (localizationResources.remote_storages.length !== 1) { if (localizationResources.remote_storages.length !== 1) {
throw new RangeError( throw new RangeError(
`Don't know how to handle ${group.length} remote_storages`, `Don't know how to handle ${group.length} remote_storages`,
@@ -227,7 +225,7 @@ export class ServerAPI extends AbstractAPI {
} }
const strings: Record<string, string> = {}; const strings: Record<string, string> = {};
const configPath = `${remoteStorage.url}/${remoteStorage.relative_path}/config.yaml`; const configPath = `${remoteStorage.url}${remoteStorage.relative_path}/config.yaml`;
try { try {
const config = await fetch(configPath) const config = await fetch(configPath)
@@ -235,23 +233,21 @@ export class ServerAPI extends AbstractAPI {
.then((text) => parse(text) as LocalizationConfig); .then((text) => parse(text) as LocalizationConfig);
for (const namespace of config.namespaces) { for (const namespace of config.namespaces) {
Object.assign( const url = `${remoteStorage.url}${remoteStorage.relative_path}/${namespace}/${locale}.yaml`;
strings, const response = await fetch(url);
await fetch( const text = await response.text();
`${remoteStorage.url}${remoteStorage.relative_path}/${namespace}/${locale}.yaml`, const namespaceStrings: Record<string, string> = {};
) const parsed = parse(text) as Record<string, string>;
.then((response) => response.text())
.then((text) => {
const strings: Record<string, string> = {};
const parsed = parse(text) as Record<string, string>;
for (const key in parsed) { for (const key in parsed) {
strings[key] = parsed[key].replaceAll('\\"', '"'); strings[key] = parsed[key].replaceAll('\\"', '"');
} }
return strings; console.log(
}), namespaceStrings["ProfileAvatarEntity__1_ct_legendary__DisplayName"],
); );
Object.assign(strings, namespaceStrings);
} }
} catch (error) { } catch (error) {
console.warn( console.warn(
@@ -1,16 +1,16 @@
import { StandardSinglePrice } from "@protos/blitz_static_standard_single_price"; import { TankAttributeChange } from "@protos/game/proto/legacy/auto_items";
import { PenetrationGroup } from "@protos/blitz_static_tank_penetration_group"; import { StandardSinglePrice } from "@protos/game/proto/legacy/blitz_static_standard_single_price";
import { PenetrationGroup } from "@protos/game/proto/legacy/blitz_static_tank_penetration_group";
import { import {
PenetrationGroupUpgrade, PenetrationGroupUpgrade,
PitchLimit, PitchLimit,
ShellUpgrade, ShellUpgrade,
ShellUpgrageSingleChange, ShellUpgradeSingleChange,
StageParameters, StageParameters,
TankAttributeChange,
TankAttributeChange_AttributeName, TankAttributeChange_AttributeName,
TankAttributeChange_Modifier, TankAttributeChange_Modifier,
VisualChanges, VisualChanges,
} from "@protos/blitz_static_tank_upgrade_single_stage"; } from "@protos/game/proto/legacy/blitz_static_tank_upgrade_single_stage";
function patch(stage0: StageParameters, stage1: StageParameters) { function patch(stage0: StageParameters, stage1: StageParameters) {
if (stage1.stage_number !== ++stage0.stage_number) { if (stage1.stage_number !== ++stage0.stage_number) {
@@ -29,14 +29,14 @@ function patch(stage0: StageParameters, stage1: StageParameters) {
case TankAttributeChange_Modifier.MODIFIER_ADD: case TankAttributeChange_Modifier.MODIFIER_ADD:
const attribute0 = stage0.attributes.find( const attribute0 = stage0.attributes.find(
(attribute0) => (attribute0) =>
attribute0.attribute_name === attribute1.attribute_name attribute0.attribute_name === attribute1.attribute_name,
); );
if (!attribute0) { if (!attribute0) {
throw new Error( throw new Error(
`Missing attribute ${ `Missing attribute ${
TankAttributeChange_AttributeName[attribute1.attribute_name] TankAttributeChange_AttributeName[attribute1.attribute_name]
} (${attribute1.attribute_name}) to modify` } (${attribute1.attribute_name}) to modify`,
); );
} }
@@ -54,7 +54,7 @@ function patch(stage0: StageParameters, stage1: StageParameters) {
throw new Error( throw new Error(
`Unhandled modified ${ `Unhandled modified ${
TankAttributeChange_Modifier[attribute1.modifier] TankAttributeChange_Modifier[attribute1.modifier]
}` }`,
); );
} }
@@ -64,7 +64,7 @@ function patch(stage0: StageParameters, stage1: StageParameters) {
value: value1, value: value1,
}); });
const index0 = stage0.attributes.findIndex( const index0 = stage0.attributes.findIndex(
(attribute) => attribute.attribute_name === attribute1.attribute_name (attribute) => attribute.attribute_name === attribute1.attribute_name,
); );
if (index0 === -1) { if (index0 === -1) {
@@ -76,7 +76,7 @@ function patch(stage0: StageParameters, stage1: StageParameters) {
for (const penetrationGroupUpgrade1 of stage1.penetration_groups_upgrades) { for (const penetrationGroupUpgrade1 of stage1.penetration_groups_upgrades) {
const penetrationGroupUpgrade0 = stage0.penetration_groups_upgrades.find( const penetrationGroupUpgrade0 = stage0.penetration_groups_upgrades.find(
(group) => group.tank_part === penetrationGroupUpgrade1.tank_part (group) => group.tank_part === penetrationGroupUpgrade1.tank_part,
); );
if (penetrationGroupUpgrade0) { if (penetrationGroupUpgrade0) {
@@ -87,7 +87,8 @@ function patch(stage0: StageParameters, stage1: StageParameters) {
for (const penetrationGroup1 of penetrationGroupUpgrade1.penetration_groups) { for (const penetrationGroup1 of penetrationGroupUpgrade1.penetration_groups) {
const penetrationGroup0 = const penetrationGroup0 =
penetrationGroupUpgrade0.penetration_groups.find( penetrationGroupUpgrade0.penetration_groups.find(
(baseGroup) => baseGroup.group_name === penetrationGroup1.group_name (baseGroup) =>
baseGroup.group_name === penetrationGroup1.group_name,
); );
if (penetrationGroup0) { if (penetrationGroup0) {
@@ -95,13 +96,13 @@ function patch(stage0: StageParameters, stage1: StageParameters) {
penetrationGroup0.armor = penetrationGroup1.armor; penetrationGroup0.armor = penetrationGroup1.armor;
} else { } else {
penetrationGroupUpgrade0.penetration_groups.push( penetrationGroupUpgrade0.penetration_groups.push(
PenetrationGroup.create(penetrationGroup1) PenetrationGroup.create(penetrationGroup1),
); );
} }
} }
} else { } else {
stage0.penetration_groups_upgrades.push( stage0.penetration_groups_upgrades.push(
PenetrationGroupUpgrade.create(penetrationGroupUpgrade1) PenetrationGroupUpgrade.create(penetrationGroupUpgrade1),
); );
} }
} }
@@ -112,7 +113,7 @@ function patch(stage0: StageParameters, stage1: StageParameters) {
for (const shellUpgrades1 of stage1.shells_upgrades) { for (const shellUpgrades1 of stage1.shells_upgrades) {
let shellUpgrades0 = stage0.shells_upgrades.find( let shellUpgrades0 = stage0.shells_upgrades.find(
(baseShell) => baseShell.shell_id === shellUpgrades1.shell_id (baseShell) => baseShell.shell_id === shellUpgrades1.shell_id,
); );
if (shellUpgrades0) { if (shellUpgrades0) {
@@ -122,14 +123,14 @@ function patch(stage0: StageParameters, stage1: StageParameters) {
const shellUpgrade0 = shellUpgrades0.changes.find( const shellUpgrade0 = shellUpgrades0.changes.find(
(baseShellUpgrade) => (baseShellUpgrade) =>
baseShellUpgrade.attribute_name === baseShellUpgrade.attribute_name ===
changedShellUpgrade.attribute_name changedShellUpgrade.attribute_name,
); );
if (shellUpgrade0) { if (shellUpgrade0) {
shellUpgrade0.value = changedShellUpgrade.value; shellUpgrade0.value = changedShellUpgrade.value;
} else { } else {
shellUpgrades0.changes.push( shellUpgrades0.changes.push(
ShellUpgrageSingleChange.create(changedShellUpgrade) ShellUpgradeSingleChange.create(changedShellUpgrade),
); );
} }
} }
@@ -169,7 +170,7 @@ function patch(stage0: StageParameters, stage1: StageParameters) {
for (const visualChange1 of stage1.visual_changes) { for (const visualChange1 of stage1.visual_changes) {
const visualChange0 = stage0.visual_changes.find( const visualChange0 = stage0.visual_changes.find(
(baseVisualChange) => (baseVisualChange) =>
baseVisualChange.tank_part === visualChange1.tank_part baseVisualChange.tank_part === visualChange1.tank_part,
); );
if (visualChange0) { if (visualChange0) {
@@ -182,7 +183,7 @@ function patch(stage0: StageParameters, stage1: StageParameters) {
export function aggregateStageParameters( export function aggregateStageParameters(
base: StageParameters, base: StageParameters,
stages: StageParameters[] stages: StageParameters[],
) { ) {
const stage0 = StageParameters.create({ ...base, stage_number: 0 }); const stage0 = StageParameters.create({ ...base, stage_number: 0 });
@@ -195,7 +196,7 @@ export function aggregateStageParameters(
if (base.stage_number === 0 && import.meta.env.DEV) { if (base.stage_number === 0 && import.meta.env.DEV) {
throw new Error( throw new Error(
"Base stats are now stage 0. In-game bug fixed, please remove hack." "Base stats are now stage 0. In-game bug fixed, please remove hack.",
); );
} }
@@ -1,11 +1,11 @@
import { TankClass } from "@protos/blitz_static_tank_component"; import type { Tank } from "@protos/blitzkit/tank";
import { TankClass } from "@protos/game/proto/legacy/blitz_static_tank_component";
import { import {
ShellUpgrageSingleChange_AttributeName, ShellUpgradeSingleChange_AttributeName,
StageParameters, StageParameters,
TankAttributeChange_AttributeName, TankAttributeChange_AttributeName,
} from "@protos/blitz_static_tank_upgrade_single_stage"; } from "@protos/game/proto/legacy/blitz_static_tank_upgrade_single_stage";
import { radToDeg } from "three/src/math/MathUtils.js"; import { radToDeg } from "three/src/math/MathUtils.js";
import type { Tank } from "../../protos/tank";
import { applyPitchYawLimits } from "./applyPitchYawLimits"; import { applyPitchYawLimits } from "./applyPitchYawLimits";
import { TerrainHardness, type TankState } from "./tankState"; import { TerrainHardness, type TankState } from "./tankState";
@@ -15,8 +15,8 @@ type Characteristic = (helpers: {
characteristic: (name: CharacteristicName) => CharacteristicOutput; characteristic: (name: CharacteristicName) => CharacteristicOutput;
attribute: (name: TankAttributeChange_AttributeName) => number; attribute: (name: TankAttributeChange_AttributeName) => number;
attributeSafe: (name: TankAttributeChange_AttributeName) => number | null; attributeSafe: (name: TankAttributeChange_AttributeName) => number | null;
shell: (name: ShellUpgrageSingleChange_AttributeName) => number; shell: (name: ShellUpgradeSingleChange_AttributeName) => number;
shellSafe: (name: ShellUpgrageSingleChange_AttributeName) => number | null; shellSafe: (name: ShellUpgradeSingleChange_AttributeName) => number | null;
state: TankState; state: TankState;
tank: Tank; tank: Tank;
parameters: StageParameters; parameters: StageParameters;
@@ -60,19 +60,19 @@ export const characteristics = {
damage({ shell }) { damage({ shell }) {
return shell( return shell(
ShellUpgrageSingleChange_AttributeName.ATTRIBUTE_NAME_ARMOR_DAMAGE, ShellUpgradeSingleChange_AttributeName.ATTRIBUTE_NAME_ARMOR_DAMAGE,
); );
}, },
module_damage({ shell }) { module_damage({ shell }) {
return shell( return shell(
ShellUpgrageSingleChange_AttributeName.ATTRIBUTE_NAME_MODULE_DAMAGE, ShellUpgradeSingleChange_AttributeName.ATTRIBUTE_NAME_MODULE_DAMAGE,
); );
}, },
penetration({ shell }) { penetration({ shell }) {
return shell( return shell(
ShellUpgrageSingleChange_AttributeName.ATTRIBUTE_NAME_PIERCING_POWER, ShellUpgradeSingleChange_AttributeName.ATTRIBUTE_NAME_PIERCING_POWER,
); );
}, },
@@ -168,37 +168,37 @@ export const characteristics = {
}, },
caliber({ shell }) { caliber({ shell }) {
return shell(ShellUpgrageSingleChange_AttributeName.ATTRIBUTE_NAME_CALIBER); return shell(ShellUpgradeSingleChange_AttributeName.ATTRIBUTE_NAME_CALIBER);
}, },
normalization({ shellSafe }) { normalization({ shellSafe }) {
return shellSafe( return shellSafe(
ShellUpgrageSingleChange_AttributeName.ATTRIBUTE_NAME_NORMALIZATION, ShellUpgradeSingleChange_AttributeName.ATTRIBUTE_NAME_NORMALIZATION,
); );
}, },
ricochet({ shell }) { ricochet({ shell }) {
return shell( return shell(
ShellUpgrageSingleChange_AttributeName.ATTRIBUTE_NAME_RICOCHET_ANGLE, ShellUpgradeSingleChange_AttributeName.ATTRIBUTE_NAME_RICOCHET_ANGLE,
); );
}, },
shell_velocity({ shell }) { shell_velocity({ shell }) {
return ( return (
shell(ShellUpgrageSingleChange_AttributeName.ATTRIBUTE_NAME_SPEED) / 100 shell(ShellUpgradeSingleChange_AttributeName.ATTRIBUTE_NAME_SPEED) / 100
); );
}, },
shell_range({ shellSafe }) { shell_range({ shellSafe }) {
const maxDistance = shellSafe( const maxDistance = shellSafe(
ShellUpgrageSingleChange_AttributeName.ATTRIBUTE_NAME_MAX_DISTANCE, ShellUpgradeSingleChange_AttributeName.ATTRIBUTE_NAME_MAX_DISTANCE,
); );
return maxDistance === null ? Infinity : maxDistance / 100; return maxDistance === null ? Infinity : maxDistance / 100;
}, },
shell_capacity({ shellSafe }) { shell_capacity({ shellSafe }) {
const count = shellSafe( const count = shellSafe(
ShellUpgrageSingleChange_AttributeName.ATTRIBUTE_NAME_MAX_COUNT, ShellUpgradeSingleChange_AttributeName.ATTRIBUTE_NAME_MAX_COUNT,
); );
return count === -1 || count === null ? Infinity : count; return count === -1 || count === null ? Infinity : count;
}, },
@@ -2,7 +2,7 @@ import {
Nation, Nation,
TankClass, TankClass,
TankType, TankType,
} from "@protos/blitz_static_tank_component"; } from "@protos/game/proto/legacy/blitz_static_tank_component";
import { import {
GunType, GunType,
type CharacteristicName, type CharacteristicName,
@@ -1,8 +1,8 @@
import type { Tank } from "@blitzkit/closed/protos/blitzkit/tank";
import { import {
ShellUpgrageSingleChange_AttributeName, ShellUpgradeSingleChange_AttributeName,
TankAttributeChange_AttributeName, TankAttributeChange_AttributeName,
} from "@protos/blitz_static_tank_upgrade_single_stage"; } from "@protos/game/proto/legacy/blitz_static_tank_upgrade_single_stage";
import type { Tank } from "../../protos/tank";
import { aggregateStageParameters } from "./aggregateStageParameters"; import { aggregateStageParameters } from "./aggregateStageParameters";
import { import {
characteristics, characteristics,
@@ -19,11 +19,11 @@ export type ComputedCharacteristics = Record<
export function computeCharacteristics( export function computeCharacteristics(
id: string, id: string,
tank: Tank, tank: Tank,
state: TankState state: TankState,
) { ) {
const parameters = aggregateStageParameters( const parameters = aggregateStageParameters(
tank.tank!.base_stats!, tank.tank!.base_stats!,
tank.tank!.upgrade_stages.slice(0, state.stage) tank.tank!.upgrade_stages.slice(0, state.stage),
); );
const computed: Partial<ComputedCharacteristics> = {}; const computed: Partial<ComputedCharacteristics> = {};
@@ -35,7 +35,7 @@ export function computeCharacteristics(
function attributeSafe(name: TankAttributeChange_AttributeName) { function attributeSafe(name: TankAttributeChange_AttributeName) {
const attribute = parameters.attributes.find( const attribute = parameters.attributes.find(
(attribute) => attribute.attribute_name === name (attribute) => attribute.attribute_name === name,
); );
return attribute ? attribute.value : null; return attribute ? attribute.value : null;
@@ -46,37 +46,37 @@ export function computeCharacteristics(
if (attribute === null) { if (attribute === null) {
throw new Error( throw new Error(
`Attribute ${TankAttributeChange_AttributeName[name]} (${name}) not found` `Attribute ${TankAttributeChange_AttributeName[name]} (${name}) not found`,
); );
} }
return attribute; return attribute;
} }
function shellSafe(name: ShellUpgrageSingleChange_AttributeName) { function shellSafe(name: ShellUpgradeSingleChange_AttributeName) {
const shell = parameters.shells_upgrades.find( const shell = parameters.shells_upgrades.find(
(shell) => shell.shell_id === state.shell (shell) => shell.shell_id === state.shell,
); );
if (!shell) { if (!shell) {
throw new Error( throw new Error(
`Shell ${ShellUpgrageSingleChange_AttributeName[name]} (${name}) not found` `Shell ${ShellUpgradeSingleChange_AttributeName[name]} (${name}) not found`,
); );
} }
const attribute = shell.changes.find( const attribute = shell.changes.find(
(change) => change.attribute_name === name (change) => change.attribute_name === name,
); );
return attribute ? attribute.value : null; return attribute ? attribute.value : null;
} }
function shell(name: ShellUpgrageSingleChange_AttributeName) { function shell(name: ShellUpgradeSingleChange_AttributeName) {
const attribute = shellSafe(name); const attribute = shellSafe(name);
if (attribute === null) { if (attribute === null) {
throw new Error( throw new Error(
`Shell attribute ${ShellUpgrageSingleChange_AttributeName[name]} (${name}) not found` `Shell attribute ${ShellUpgradeSingleChange_AttributeName[name]} (${name}) not found`,
); );
} }
@@ -1,6 +1,6 @@
import { Tank } from "@protos/blitzkit/tank";
import type { APIContext, GetStaticPaths } from "astro"; import type { APIContext, GetStaticPaths } from "astro";
import { api } from "../../../core/api/dynamic"; import { api } from "../../../core/api/dynamic";
import { Tank } from "../../../protos/tank";
export const getStaticPaths = (async () => { export const getStaticPaths = (async () => {
const { list } = await api.tankList(); const { list } = await api.tankList();
@@ -1,5 +1,5 @@
import { Tanks } from "@protos/blitzkit/tanks";
import { api } from "../../../core/api/dynamic"; import { api } from "../../../core/api/dynamic";
import { Tanks } from "../../../protos/tanks";
/** /**
* Literally all the tanks in one place lmao. * Literally all the tanks in one place lmao.
@@ -1,5 +1,5 @@
import { TankList } from "@protos/blitzkit/tank_list";
import { api } from "../../../core/api/dynamic"; import { api } from "../../../core/api/dynamic";
import { TankList } from "../../../protos/tank_list";
/** /**
* List!! * List!!
@@ -1,5 +1,5 @@
import { PopularTanks } from "@protos/blitzkit/popular_tanks";
import { api } from "../../../core/api/dynamic"; import { api } from "../../../core/api/dynamic";
import { PopularTanks } from "../../../protos/popular_tanks";
export async function GET() { export async function GET() {
const popular = await api.popularTanks(); const popular = await api.popularTanks();