This commit is contained in:
TrèsAbhi committed 2024-10-02 10:21:16 -05:00
1 parent 61fe8c7e7c
commit 78dce028d9
26 files changed
+135 -101

No files matched your search

+6 -4
View File
@@ -1,12 +1,14 @@
import { TankClass } from '../protos';
import { BlitzStats } from '../statistics';
export const TREE_TYPES = ['researchable', 'premium', 'collector'] as const;
export const TANK_CLASSES = [
'lightTank',
'mediumTank',
'heavyTank',
'AT-SPG',
TankClass.TANK_CLASS_LIGHT,
TankClass.TANK_CLASS_MEDIUM,
TankClass.TANK_CLASS_HEAVY,
TankClass.TANK_CLASS_TANK_DESTROYER,
TankClass.UNRECOGNIZED,
] as const;
export const emptyAllStats: BlitzStats = {
@@ -1,5 +1,5 @@
import { fetchPB } from '../../protobuf';
import { AverageDefinitions } from '../../protos';
import { fetchPB } from '../../types';
import { asset } from '../asset';
export interface AverageDefinitionsManifest {
@@ -1,5 +1,5 @@
import { fetchPB } from '../protobuf';
import { CamouflageDefinitions } from '../protos';
import { fetchPB } from '../types';
import { asset } from './asset';
export function fetchCamouflageDefinitions() {
@@ -1,5 +1,5 @@
import { fetchPB } from '../protobuf';
import { ConsumableDefinitions } from '../protos';
import { fetchPB } from '../types';
import { asset } from './asset';
export function fetchConsumableDefinitions() {
@@ -1,5 +1,5 @@
import { fetchPB } from '../protobuf';
import { EquipmentDefinitions } from '../protos';
import { fetchPB } from '../types';
import { asset } from './asset';
export function fetchEquipmentDefinitions() {
@@ -1,5 +1,5 @@
import { fetchPB } from '../protobuf';
import { GameDefinitions } from '../protos';
import { fetchPB } from '../types';
import { asset } from './asset';
export function fetchGameDefinitions() {
+2 -1
View File
@@ -13,6 +13,7 @@ export * from './degressiveStat';
// export * from './emblemURL';
export * from './equipmentDefinitions';
export * from './eventManager';
export * from './resolveGun';
// export * from './flagUserActivity';
export * from './gameDefinitions';
// export * from './getArchivedLatestSeasonNumber';
@@ -40,7 +41,7 @@ export * from './tankIcon';
export * from './tankNames';
export * from './unionBoundingBox';
export * from './uniqueGuns';
// export * from './unwrapBlitzkitResponse';
export * from './unwrapBlitzkitResponse';
export * from './votes';
// export * from './withCORSProxy';
export * from './youtubers';
+1 -1
View File
@@ -1,5 +1,5 @@
import { fetchPB } from '../protobuf';
import { MapDefinitions } from '../protos';
import { fetchPB } from '../types';
import { asset } from './asset';
export function fetchMapDefinitions() {
@@ -1,5 +1,5 @@
import { fetchPB } from '../protobuf';
import { ModelDefinitions } from '../protos';
import { fetchPB } from '../types';
import { asset } from './asset';
export function fetchModelDefinitions() {
@@ -1,5 +1,5 @@
import { fetchPB } from '../protobuf';
import { ProvisionDefinitions } from '../protos';
import { fetchPB } from '../types';
import { asset } from './asset';
export function fetchProvisionDefinitions() {
+9
View File
@@ -0,0 +1,9 @@
import { GunDefinition } from '../protos';
export function resolveGun(gun: GunDefinition) {
if (gun.regular) return gun.regular;
else if (gun.autoLoader) return gun.autoLoader;
else if (gun.autoReloader) return gun.autoReloader;
throw new Error('Could not resolve gun');
}
+1 -1
View File
@@ -1,5 +1,5 @@
import { fetchPB } from '../protobuf';
import { Reviews } from '../protos';
import { fetchPB } from '../types';
import { asset } from './asset';
export function fetchReviews() {
@@ -1,5 +1,5 @@
import { fetchPB } from '../protobuf';
import { SkillDefinitions } from '../protos';
import { fetchPB } from '../types';
import { asset } from './asset';
export function fetchSkillDefinitions() {
@@ -1,5 +1,5 @@
import { fetchPB } from '../../protobuf';
import { TankDefinitions } from '../../protos';
import { fetchPB } from '../../types';
import { asset } from '../asset';
export function fetchTankDefinitions() {
+16 -13
View File
@@ -1,14 +1,17 @@
import { deburr } from 'lodash-es';
import { tankDefinitionsArray } from '.';
import { camouflageDefinitions } from './camouflageDefinitions';
import { fetchCamouflageDefinitions } from './camouflageDefinitions';
import { fetchTankDefinitions } from './tankDefinitions';
export const tankNames = Promise.all([
tankDefinitionsArray,
camouflageDefinitions,
]).then(([tanks, camouflages]) =>
Promise.all(
tanks.map(async (tank, index) => {
const { id } = (await tankDefinitionsArray)[index];
export async function fetchTankNames() {
const [tankDefinitions, camouflageDefinitions] = await Promise.all([
fetchTankDefinitions(),
fetchCamouflageDefinitions(),
]);
const tankDefinitionsArray = Object.values(tankDefinitions.tanks);
return await Promise.all(
tankDefinitionsArray.map(async (tank, index) => {
const { id } = tankDefinitionsArray[index];
return {
id,
@@ -17,10 +20,10 @@ export const tankNames = Promise.all([
searchableName: tank.nameFull ?? tank.name,
searchableNameDeburr: deburr(tank.nameFull ?? tank.name),
camouflages: tank.camouflages
?.map((id) => camouflages[id].name)
?.map((id) => camouflageDefinitions.camouflages[id].name)
.join(' '),
treeType: tank.treeType,
treeType: tank.type,
};
}),
),
);
);
}
@@ -1,9 +1,13 @@
import { BoundingBox } from '@blitzkit/core';
import { Vector3Tuple } from 'three';
export function unionBoundingBox(a: BoundingBox, b: BoundingBox) {
return {
min: a.min.map((a, index) => Math.min(a, b.min[index])) as Vector3Tuple,
max: a.max.map((a, index) => Math.max(a, b.max[index])) as Vector3Tuple,
// min: a.min.map((a, index) => Math.min(a, b.min[index])) as Vector3Tuple,
// max: a.max.map((a, index) => Math.max(a, b.max[index])) as Vector3Tuple,
min: {
x: Math.min(a.min.x, b.min.x),
y: Math.min(a.min.y, b.min.y),
z: Math.min(a.min.z, b.min.z),
},
} satisfies BoundingBox;
}
@@ -1,4 +1,3 @@
export function unwrapBlitzkitResponse<Data>(response: BlitzkitResponse<Data>) {
if (response.status === 'error') {
throw new Error(response.error, { cause: response.message });
@@ -41,7 +41,7 @@ message ConsumableTankCategoryFilter {
}
enum ConsumableTankCategoryFilterCategory {
TANK_CATEGORY_CLIP = 0;
CONSUMABLE_TANK_CATEGORY_FILTER_CATEGORY_CLIP = 0;
}
message ConsumableTankNationFilter {
+10
View File
@@ -0,0 +1,10 @@
syntax = "proto3";
message Test {
Child child_b = 1;
uint32 child_a = 2;
}
message Child {
string value = 1;
}