strict types

This commit is contained in:
tresabhi committed 2026-09-13 13:20:45 -05:00
1 parent 491b03ad00
commit 3be91469aa
14 files changed
+156 -32

No files matched your search

+1
View File
@@ -26,6 +26,7 @@
"name": "@blitzkit/core",
"dependencies": {
"@blitzkit/i18n": "workspace:*",
"@blitzkit/protos": "workspace:*",
"@bufbuild/protobuf": "^2.9.0",
"@octokit/plugin-throttling": "^11.0.1",
"@octokit/rest": "^22.0.0",
+2
View File
@@ -1,6 +1,8 @@
{
"words": [
"gamemodes",
"Recoverkit",
"Repairkit",
"Tankopedia"
]
}
+1
View File
@@ -5,6 +5,7 @@
"main": "src/index.ts",
"dependencies": {
"@blitzkit/i18n": "workspace:*",
"@blitzkit/protos": "workspace:*",
"@bufbuild/protobuf": "^2.9.0",
"@octokit/plugin-throttling": "^11.0.1",
"@octokit/rest": "^22.0.0",
+1 -1
View File
@@ -1,4 +1,4 @@
import { TankClass, TankType } from "../protos";
import { TankClass, TankType } from "@blitzkit/protos";
import type { BlitzStats } from "../statistics";
export const TANK_TYPES = [
+2 -2
View File
@@ -1,5 +1,4 @@
import { alias } from "@blitzkit/core";
import { fetchPB } from "../../protobuf";
import {
CamouflageDefinitions,
ConsumableDefinitions,
@@ -11,7 +10,8 @@ import {
ProvisionDefinitions,
SkillDefinitions,
TankDefinitions,
} from "../../protos";
} from "@blitzkit/protos";
import { fetchPB } from "../../protobuf";
import { BlitzKitAPI } from "./base";
export class ClientBlitzKitAPI extends BlitzKitAPI {
@@ -4,7 +4,7 @@ import {
GunDefinition,
Provision,
TankDefinition,
} from "../protos";
} from "@blitzkit/protos";
export function checkConsumableProvisionInclusivity(
consumableProvision: Consumable | Provision,
+1 -1
View File
@@ -1,5 +1,5 @@
import { GameDefinitions, TankDefinition, TankType } from "@blitzkit/protos";
import { TANK_CLASSES } from "../blitz/constants";
import { GameDefinitions, TankDefinition, TankType } from "../protos";
const treeTypeOrder = [
TankType.TANK_TYPE_RESEARCHABLE,
@@ -1,4 +1,4 @@
import { Equalizer, ShellType } from "../protos";
import { Equalizer, ShellType } from "@blitzkit/protos";
export function resolvePenetrationCoefficient(
calibratedShells: boolean,
@@ -1,5 +1,5 @@
import { CrewType, ShellType, TankClass, TankType } from "@blitzkit/protos";
import { times } from "lodash-es";
import { CrewType, ShellType, TankClass, TankType } from "../../protos";
export const SHELL_NAMES: Record<ShellType, string> = {
[ShellType.SHELL_TYPE_AP]: "AP",
+1 -1
View File
@@ -1,7 +1,7 @@
import { BlitzKitAPI } from "@blitzkit/core/src/blitzkit/api/base";
import locales from "@blitzkit/i18n/locales.json";
import { I18nString } from "@blitzkit/protos";
import { deburr, times } from "lodash-es";
import { I18nString } from "../protos";
export async function fetchTankNames(api: BlitzKitAPI) {
const [tankDefinitions, camouflageDefinitions] = await Promise.all([
+2 -8
View File
@@ -1,3 +1,4 @@
import { ProvisionConsumableScript } from "@blitzkit/core/src/types/provisionConsumableScript";
import { ConsumablesVehicleFilter } from "./consumablesVehicleFilter";
export interface ConsumablesCommon {
@@ -12,13 +13,6 @@ export interface ConsumablesCommon {
include: { vehicle: ConsumablesVehicleFilter; nations?: string };
exclude?: { vehicle: ConsumablesVehicleFilter; nations?: string };
};
script: {
"#text": string;
automatic?: boolean;
cooldown: number;
duration?: number;
shotEffect?: string;
bonusValues?: { [key: string]: number };
} & Record<string, string>;
script: ProvisionConsumableScript;
};
}
@@ -0,0 +1,140 @@
export type ProvisionConsumableScript =
| {
"#text": "Extinguisher";
cooldown: number;
automatic: boolean;
}
| {
"#text": "Repairkit";
cooldown: number;
}
| {
"#text": "Afterburning";
cooldown: number;
duration: number;
bonusValues: {
enginePowerIncrease: number;
};
}
| {
"#text": "Berserk";
cooldown: number;
duration: number;
bonusValues: {
gunReloadSpeedIncrease: number;
};
}
| {
"#text": "Recoverkit";
cooldown: number;
}
| {
"#text": "ImprovedAfterburning";
cooldown: number;
duration: number;
enginePowerIncrease: number;
rotationSpeedFactor: number;
fwdSpeedLimitBias: number;
bkwdSpeedLimitBias: number;
}
| {
"#text": "FireControlSystem";
cooldown: number;
duration: number;
shotDispersionAngleFactor: number;
aimingTimeFactor: number;
}
| {
"#text": "NewAutoloader";
cooldown: number;
duration: number;
clipReloadTimeFactor: number;
gunReloadTimeFactor: number;
}
| {
"#text": "ShieldKit";
cooldown: number;
duration: number;
shieldCoef: number;
}
| {
"#text": "TungstenTip";
cooldown: number;
duration: number;
minDamageFactor: number;
maxDamageFactor: number;
shotEffect: "dangerousTracer";
}
| {
"#text": "ArmorMover";
cooldown: number;
duration: number;
deactivateStates: number;
activateStates: number;
bonusValues: {
damageReductionPercent: number;
};
}
| {
"#text": "ImprovedAfterburning";
cooldown: number;
duration: number;
enginePowerIncrease: number;
rotationSpeedFactor: number;
fwdSpeedLimitBias: number;
bkwdSpeedLimitBias: number;
}
| {
"#text": "Stimulator";
bonusValues: {
crewLevelIncrease: number;
};
}
| {
"#text": "AntiHighExplosive";
bonusValues: {
factor: number;
};
}
| {
"#text": "Fuel";
bonusValues: {
enginePowerIncrease: number;
turretRotationSpeedIncrease: number;
};
}
| {
"#text": "SafetySet";
bonusValues: {
crewChanceToHitFactor: number;
repairSpeedIncrease: number;
fireProtectionIncrease: number;
explosivesHealthIncrease: number;
};
}
| {
"#text": "SmallHPStock";
hpStockPercent: number;
}
| {
"#text": "GearOil";
bonusValues: {
fwdSpeedLimitBias: number;
bkwdSpeedLimitBias: number;
enginePowerIncrease: number;
};
}
| {
"#text": "GunPowder";
bonusValues: {
projectileSpeedFactor: number;
};
}
| {
"#text": "AttributesModifier";
attributes: {
firmGroundPassabilityIncrease: number;
mediumGroundPassabilityIncrease: number;
repairSpeedFactor: number;
};
};
+2 -6
View File
@@ -1,3 +1,4 @@
import { ProvisionConsumableScript } from "@blitzkit/core/src/types/provisionConsumableScript";
import { ConsumablesVehicleFilter } from "./consumablesVehicleFilter";
export interface ProvisionsCommon {
@@ -12,11 +13,6 @@ export interface ProvisionsCommon {
include: { vehicle: ConsumablesVehicleFilter; nations?: string };
exclude?: { vehicle: ConsumablesVehicleFilter; nations?: string };
};
script: {
"#text": string;
automatic?: boolean;
shotEffect?: string;
bonusValues?: { [key: string]: number };
} & Record<string, string>;
script: ProvisionConsumableScript;
};
}
@@ -1,20 +1,10 @@
import { ConsumableDefinitions } from "@blitzkit/core";
import { api } from "../../../blitzkit/api";
import { vfs } from "../../../core/blitzkit/vfs";
export { getStaticPaths } from "../_index";
export async function GET() {
const test = await vfs.xml(
"Data/XML/item_defs/vehicles/common/consumables/common.xml",
);
return Response.json(test);
const definitions = await api.consumables();
return Response.json(definitions);
const bytes = ConsumableDefinitions.encode(definitions).finish();
return new Response(bytes);