mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-21 18:57:03 +02:00
feat: type errors in definitions
This commit is contained in:
1 parent
3e18d5a8db
commit
61fe8c7e7c
22 files changed
+1728
-1692
No files matched your search
@@ -1,4 +1,5 @@
|
||||
import { AverageDefinitions } from '../../protos';
|
||||
import { fetchPB } from '../../types';
|
||||
import { asset } from '../asset';
|
||||
|
||||
export interface AverageDefinitionsManifest {
|
||||
@@ -13,14 +14,10 @@ export async function fetchAverageDefinitions() {
|
||||
const manifestResponse = await fetch(asset('averages/manifest.json'));
|
||||
const manifestJson =
|
||||
(await manifestResponse.json()) as AverageDefinitionsManifest;
|
||||
const averageDefinitionsResponse = await fetch(
|
||||
return await fetchPB(
|
||||
asset(`averages/${manifestJson.latest}.pb`),
|
||||
AverageDefinitions,
|
||||
);
|
||||
const averageDefinitionsBuffer =
|
||||
await averageDefinitionsResponse.arrayBuffer();
|
||||
const averageDefinitionsArray = new Uint8Array(averageDefinitionsBuffer);
|
||||
|
||||
return AverageDefinitions.deserializeBinary(averageDefinitionsArray);
|
||||
}
|
||||
|
||||
export * from './constants';
|
||||
@@ -1,10 +1,7 @@
|
||||
import { CamouflageDefinitions } from '../protos';
|
||||
import { fetchPB } from '../types';
|
||||
import { asset } from './asset';
|
||||
|
||||
export async function fetchCamouflageDefinitions() {
|
||||
const response = await fetch(asset('definitions/camoufles.pb'));
|
||||
const buffer = await response.arrayBuffer();
|
||||
const array = new Uint8Array(buffer);
|
||||
|
||||
return CamouflageDefinitions.deserializeBinary(array).toObject();
|
||||
export function fetchCamouflageDefinitions() {
|
||||
return fetchPB(asset('definitions/camoufles.pb'), CamouflageDefinitions);
|
||||
}
|
||||
@@ -1,10 +1,7 @@
|
||||
import { ConsumableDefinitions } from '../protos';
|
||||
import { fetchPB } from '../types';
|
||||
import { asset } from './asset';
|
||||
|
||||
export async function fetchConsumableDefinitions() {
|
||||
const response = await fetch(asset('definitions/consumables.pb'));
|
||||
const buffer = await response.arrayBuffer();
|
||||
const array = new Uint8Array(buffer);
|
||||
|
||||
return ConsumableDefinitions.deserializeBinary(array).toObject();
|
||||
export function fetchConsumableDefinitions() {
|
||||
return fetchPB(asset('definitions/consumables.pb'), ConsumableDefinitions);
|
||||
}
|
||||
@@ -1,10 +1,7 @@
|
||||
import { EquipmentDefinitions } from '../protos';
|
||||
import { fetchPB } from '../types';
|
||||
import { asset } from './asset';
|
||||
|
||||
export async function fetchEquipmentDefinitions() {
|
||||
const response = await fetch(asset('definitions/equipment.pb'));
|
||||
const buffer = await response.arrayBuffer();
|
||||
const array = new Uint8Array(buffer);
|
||||
|
||||
return EquipmentDefinitions.deserializeBinary(array).toObject();
|
||||
export function fetchEquipmentDefinitions() {
|
||||
return fetchPB(asset('definitions/equipment.pb'), EquipmentDefinitions);
|
||||
}
|
||||
@@ -1,10 +1,7 @@
|
||||
import { GameDefinitions } from '../protos';
|
||||
import { fetchPB } from '../types';
|
||||
import { asset } from './asset';
|
||||
|
||||
export async function fetchGameDefinitions() {
|
||||
const response = await fetch(asset('definitions/game.pb'));
|
||||
const buffer = await response.arrayBuffer();
|
||||
const array = new Uint8Array(buffer);
|
||||
|
||||
return GameDefinitions.deserializeBinary(array).toObject();
|
||||
export function fetchGameDefinitions() {
|
||||
return fetchPB(asset('definitions/game.pb'), GameDefinitions);
|
||||
}
|
||||
@@ -1,13 +1,7 @@
|
||||
import { MapDefinitions } from '../protos';
|
||||
import { fetchPB } from '../types';
|
||||
import { asset } from './asset';
|
||||
import { fetchCdonLz4 } from './fetchCdonLz4';
|
||||
|
||||
export interface MapDefinitions {
|
||||
[id: number]: {
|
||||
id: number;
|
||||
name: string;
|
||||
};
|
||||
export function fetchMapDefinitions() {
|
||||
return fetchPB(asset('definitions/maps.pb'), MapDefinitions);
|
||||
}
|
||||
|
||||
export const mapDefinitions = fetchCdonLz4<MapDefinitions>(
|
||||
asset('definitions/maps.cdon.lz4'),
|
||||
);
|
||||
@@ -1,10 +1,7 @@
|
||||
import { ModelDefinitions } from '../protos';
|
||||
import { fetchPB } from '../types';
|
||||
import { asset } from './asset';
|
||||
|
||||
export async function fetchModelDefinitions() {
|
||||
const response = await fetch(asset('definitions/models.pb'));
|
||||
const buffer = await response.arrayBuffer();
|
||||
const array = new Uint8Array(buffer);
|
||||
|
||||
return ModelDefinitions.deserializeBinary(array).toObject();
|
||||
export function fetchModelDefinitions() {
|
||||
return fetchPB(asset('definitions/models.pb'), ModelDefinitions);
|
||||
}
|
||||
@@ -1,10 +1,7 @@
|
||||
import { ProvisionDefinitions } from '../protos';
|
||||
import { fetchPB } from '../types';
|
||||
import { asset } from './asset';
|
||||
|
||||
export async function fetchProvisionDefinitions() {
|
||||
const response = await fetch(asset('definitions/provisions.pb'));
|
||||
const buffer = await response.arrayBuffer();
|
||||
const array = new Uint8Array(buffer);
|
||||
|
||||
return ProvisionDefinitions.deserializeBinary(array).toObject();
|
||||
export function fetchProvisionDefinitions() {
|
||||
return fetchPB(asset('definitions/provisions.pb'), ProvisionDefinitions);
|
||||
}
|
||||
@@ -1,10 +1,7 @@
|
||||
import { Reviews } from '../protos';
|
||||
import { fetchPB } from '../types';
|
||||
import { asset } from './asset';
|
||||
|
||||
export async function fetchReviews() {
|
||||
const response = await fetch(asset('definitions/reviews.pb'));
|
||||
const buffer = await response.arrayBuffer();
|
||||
const array = new Uint8Array(buffer);
|
||||
|
||||
return Reviews.deserializeBinary(array).toObject();
|
||||
export function fetchReviews() {
|
||||
return fetchPB(asset('definitions/reviews.pb'), Reviews);
|
||||
}
|
||||
@@ -1,10 +1,7 @@
|
||||
import { SkillDefinitions } from '../protos';
|
||||
import { fetchPB } from '../types';
|
||||
import { asset } from './asset';
|
||||
|
||||
export async function fetchSkillDefinitions() {
|
||||
const response = await fetch(asset('definitions/skills.pb'));
|
||||
const buffer = await response.arrayBuffer();
|
||||
const array = new Uint8Array(buffer);
|
||||
|
||||
return SkillDefinitions.deserializeBinary(array).toObject();
|
||||
export function fetchSkillDefinitions() {
|
||||
return fetchPB(asset('definitions/skills.pb'), SkillDefinitions);
|
||||
}
|
||||
@@ -1,12 +1,9 @@
|
||||
import { TankDefinitions } from '../../protos';
|
||||
import { fetchPB } from '../../types';
|
||||
import { asset } from '../asset';
|
||||
|
||||
export async function fetchTankDefinitions() {
|
||||
const response = await fetch(asset('definitions/tanks.pb'));
|
||||
const buffer = await response.arrayBuffer();
|
||||
const array = new Uint8Array(buffer);
|
||||
|
||||
return TankDefinitions.deserializeBinary(array).toObject();
|
||||
export function fetchTankDefinitions() {
|
||||
return fetchPB(asset('definitions/tanks.pb'), TankDefinitions);
|
||||
}
|
||||
|
||||
export * from './constants';
|
||||
+10
-10
@@ -1,11 +1,11 @@
|
||||
// export * from './blitz';
|
||||
// export * from './blitzkit';
|
||||
export * from './blitz';
|
||||
export * from './blitzkit';
|
||||
export * from './databases';
|
||||
export * from './imgur';
|
||||
export * from './math';
|
||||
export * from './patreon';
|
||||
export * from './protobuf';
|
||||
export * from './protos';
|
||||
// export * from './blitzstars';
|
||||
// export * from './databases';
|
||||
// export * from './imgur';
|
||||
// export * from './math';
|
||||
// export * from './patreon';
|
||||
// export * from './statistics';
|
||||
// export * from './streams';
|
||||
// export * from './types';
|
||||
export * from './statistics';
|
||||
export * from './streams';
|
||||
export * from './types';
|
||||
@@ -0,0 +1,5 @@
|
||||
import { MessageFns } from '../protos';
|
||||
|
||||
export function encodePB64<Type>(message: MessageFns<Type>, data: Type) {
|
||||
return Buffer.from(message.encode(data).finish()).toString('base64');
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
import { MessageFns } from '../protos';
|
||||
|
||||
export async function fetchPB<Type>(url: string, message: MessageFns<Type>) {
|
||||
const response = await fetch(url);
|
||||
const buffer = await response.arrayBuffer();
|
||||
const array = new Uint8Array(buffer);
|
||||
return message.decode(array);
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
export * from './encodePB64';
|
||||
export * from './fetchPB';
|
||||
export * from './pbMap';
|
||||
File renamed without changes.
@@ -20,10 +20,10 @@ message Consumable {
|
||||
|
||||
message ConsumableTankFilter {
|
||||
oneof filter_type {
|
||||
ConsumableTankTierFilter tier = 1;
|
||||
ConsumableTankTierFilter tiers = 1;
|
||||
ConsumableTankIdsFilter ids = 2;
|
||||
ConsumableTankCategoryFilter category = 3;
|
||||
ConsumableTankNationFilter nation = 4;
|
||||
ConsumableTankCategoryFilter categories = 3;
|
||||
ConsumableTankNationFilter nations = 4;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,8 +41,7 @@ message ConsumableTankCategoryFilter {
|
||||
}
|
||||
|
||||
enum ConsumableTankCategoryFilterCategory {
|
||||
TANK_CATEGORY_UNSPECIFIED = 0;
|
||||
TANK_CATEGORY_CLIP = 1;
|
||||
TANK_CATEGORY_CLIP = 0;
|
||||
}
|
||||
|
||||
message ConsumableTankNationFilter {
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package blitzkit;
|
||||
|
||||
message MapDefinitions {
|
||||
map<int32, MapDefinition> maps = 1;
|
||||
}
|
||||
|
||||
message MapDefinition {
|
||||
uint32 id = 1;
|
||||
string name = 2;
|
||||
}
|
||||
@@ -41,9 +41,8 @@ message TankDefinition {
|
||||
}
|
||||
|
||||
enum TankPriceType {
|
||||
TANK_PRICE_TYPE_UNSPECIFIED = 0;
|
||||
TANK_PRICE_TYPE_CREDITS = 1;
|
||||
TANK_PRICE_TYPE_GOLD = 2;
|
||||
TANK_PRICE_TYPE_CREDITS = 0;
|
||||
TANK_PRICE_TYPE_GOLD = 1;
|
||||
}
|
||||
|
||||
message TankPrice {
|
||||
@@ -162,11 +161,10 @@ message ShellDefinition {
|
||||
}
|
||||
|
||||
enum ShellType {
|
||||
SHELL_TYPE_UNSPECIFIED = 0;
|
||||
SHELL_TYPE_AP = 1;
|
||||
SHELL_TYPE_APCR = 2;
|
||||
SHELL_TYPE_HEAT = 3;
|
||||
SHELL_TYPE_HE = 4;
|
||||
SHELL_TYPE_AP = 0;
|
||||
SHELL_TYPE_APCR = 1;
|
||||
SHELL_TYPE_HEAT = 2;
|
||||
SHELL_TYPE_HE = 3;
|
||||
}
|
||||
|
||||
message ShellPenetration {
|
||||
@@ -186,41 +184,37 @@ message UnlockCost {
|
||||
}
|
||||
|
||||
enum ModuleType {
|
||||
MODULE_TYPE_UNSPECIFIED = 0;
|
||||
MODULE_TYPE_VEHICLE = 1;
|
||||
MODULE_TYPE_ENGINE = 2;
|
||||
MODULE_TYPE_TRACKS = 3;
|
||||
MODULE_TYPE_TURRET = 4;
|
||||
MODULE_TYPE_GUN = 5;
|
||||
MODULE_TYPE_VEHICLE = 0;
|
||||
MODULE_TYPE_ENGINE = 1;
|
||||
MODULE_TYPE_TRACKS = 2;
|
||||
MODULE_TYPE_TURRET = 3;
|
||||
MODULE_TYPE_GUN = 4;
|
||||
}
|
||||
|
||||
enum TankClass {
|
||||
TANK_CLASS_UNSPECIFIED = 0;
|
||||
TANK_CLASS_LIGHT = 1;
|
||||
TANK_CLASS_MEDIUM = 2;
|
||||
TANK_CLASS_HEAVY = 3;
|
||||
TANK_CLASS_TANK_DESTROYER = 4;
|
||||
TANK_CLASS_LIGHT = 0;
|
||||
TANK_CLASS_MEDIUM = 1;
|
||||
TANK_CLASS_HEAVY = 2;
|
||||
TANK_CLASS_TANK_DESTROYER = 3;
|
||||
}
|
||||
|
||||
enum Tier {
|
||||
TIER_UNSPECIFIED = 0;
|
||||
TIER_I = 1;
|
||||
TIER_II = 2;
|
||||
TIER_III = 3;
|
||||
TIER_IV = 4;
|
||||
TIER_V = 5;
|
||||
TIER_VI = 6;
|
||||
TIER_VII = 7;
|
||||
TIER_VIII = 8;
|
||||
TIER_IX = 9;
|
||||
TIER_X = 10;
|
||||
TIER_I = 0;
|
||||
TIER_II = 1;
|
||||
TIER_III = 2;
|
||||
TIER_IV = 3;
|
||||
TIER_V = 4;
|
||||
TIER_VI = 5;
|
||||
TIER_VII = 6;
|
||||
TIER_VIII = 7;
|
||||
TIER_IX = 8;
|
||||
TIER_X = 9;
|
||||
}
|
||||
|
||||
enum TankType {
|
||||
TANK_TYPE_UNSPECIFIED = 0;
|
||||
TANK_TYPE_RESEARCHABLE = 1;
|
||||
TANK_TYPE_PREMIUM = 2;
|
||||
TANK_TYPE_COLLECTOR = 3;
|
||||
TANK_TYPE_RESEARCHABLE = 0;
|
||||
TANK_TYPE_PREMIUM = 1;
|
||||
TANK_TYPE_COLLECTOR = 2;
|
||||
}
|
||||
|
||||
message Crew {
|
||||
@@ -230,10 +224,9 @@ message Crew {
|
||||
}
|
||||
|
||||
enum CrewType {
|
||||
CREW_TYPE_UNSPECIFIED = 0;
|
||||
CREW_TYPE_COMMANDER = 1;
|
||||
CREW_TYPE_RADIOMAN = 2;
|
||||
CREW_TYPE_GUNNER = 3;
|
||||
CREW_TYPE_DRIVER = 4;
|
||||
CREW_TYPE_LOADER = 5;
|
||||
CREW_TYPE_COMMANDER = 0;
|
||||
CREW_TYPE_RADIOMAN = 1;
|
||||
CREW_TYPE_GUNNER = 2;
|
||||
CREW_TYPE_DRIVER = 3;
|
||||
CREW_TYPE_LOADER = 4;
|
||||
}
|
||||
@@ -1,2 +1 @@
|
||||
export * from './pbMap';
|
||||
export * from './tanksStats';
|
||||
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
Reference in new issue
Block a user