mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-21 10:47:04 +02:00
feat: better lib
This commit is contained in:
1 parent
57170469f2
commit
3e18d5a8db
7 files changed
+52
-20
No files matched your search
+1
-1
@@ -42,7 +42,7 @@
|
||||
"esbuild": "^0.19.12",
|
||||
"prettier": "^3.3.3",
|
||||
"prisma": "^5.19.1",
|
||||
"ts-protoc-gen": "^0.15.0",
|
||||
"ts-proto": "^2.2.1",
|
||||
"typescript": "^5.5.4"
|
||||
}
|
||||
}
|
||||
@@ -2,12 +2,12 @@ import { existsSync } from 'fs';
|
||||
import sharp from 'sharp';
|
||||
import { readDVPLFile } from '../../src/core/blitz/readDVPLFile';
|
||||
import { readStringDVPL } from '../../src/core/blitz/readStringDVPL';
|
||||
import { DATA } from './constants';
|
||||
import { ConsumablesCommon, ProvisionsCommon } from './definitions';
|
||||
import { readXMLDVPL } from '../core/blitz/readXMLDVPL';
|
||||
import { readYAMLDVPL } from '../core/blitz/readYAMLDVPL';
|
||||
import { commitAssets } from '../core/github/commitAssets';
|
||||
import { FileChange } from '../core/github/commitMultipleFiles';
|
||||
import { DATA } from './constants';
|
||||
import { ConsumablesCommon, ProvisionsCommon } from './definitions';
|
||||
|
||||
interface Mappings {
|
||||
Header: { version: number };
|
||||
|
||||
@@ -1,18 +1,52 @@
|
||||
import { TankDefinition, TankDefinitions } from '@blitzkit/core';
|
||||
import { TankClass, TankDefinitions, TankPriceType } from '@blitzkit/core';
|
||||
|
||||
export async function definitions() {
|
||||
console.log('Building definitions...');
|
||||
|
||||
const tankDefinitions = new TankDefinitions();
|
||||
const tanks = tankDefinitions.getTanksMap();
|
||||
const buffer = TankDefinitions.encode({
|
||||
tanks: {
|
||||
1: {
|
||||
name: 'asd',
|
||||
ancestors: [],
|
||||
camouflageMoving: 1,
|
||||
camouflageOnFire: 1,
|
||||
camouflages: [],
|
||||
camouflageStill: 1,
|
||||
class: TankClass.TANK_CLASS_HEAVY,
|
||||
description: 'asd',
|
||||
crew: [],
|
||||
deprecated: false,
|
||||
engines: [],
|
||||
equipmentPreset: '',
|
||||
fixedCamouflage: false,
|
||||
health: 1,
|
||||
id: 1,
|
||||
maxConsumables: 1,
|
||||
maxProvisions: 1,
|
||||
nation: 'usa',
|
||||
price: {
|
||||
type: TankPriceType.TANK_PRICE_TYPE_CREDITS,
|
||||
value: 1,
|
||||
},
|
||||
roles: {},
|
||||
speedBackwards: 1,
|
||||
speedForwards: 1,
|
||||
successors: [],
|
||||
testing: false,
|
||||
tier: 1,
|
||||
tracks: [],
|
||||
turrets: [],
|
||||
type: 1,
|
||||
xp: 1,
|
||||
nameFull: '',
|
||||
weight: 1,
|
||||
},
|
||||
},
|
||||
}).finish();
|
||||
|
||||
const testTank = new TankDefinition();
|
||||
console.log(buffer.length);
|
||||
|
||||
testTank.setName('asd');
|
||||
|
||||
tanks.set(1, testTank);
|
||||
|
||||
console.log(JSON.stringify(tankDefinitions.toObject(), null, 2));
|
||||
console.log(TankDefinitions.decode(buffer));
|
||||
}
|
||||
|
||||
definitions();
|
||||
@@ -13,7 +13,7 @@ import { boosterIcons } from './boosterIcons';
|
||||
import { camouflageIcons } from './camouflageIcons';
|
||||
import { consumableProvisionIcons } from './consumableProvisionIcons';
|
||||
import { currencies } from './currencies';
|
||||
import { definitions } from './definitions';
|
||||
import { tankDefinitions } from './definitions';
|
||||
import { equipmentIcons } from './equipmentIcons';
|
||||
import { flags } from './flags';
|
||||
import { gameModeBanners } from './gameModeBanners';
|
||||
@@ -30,7 +30,7 @@ const methods = [
|
||||
tankModels,
|
||||
tankArmors,
|
||||
gameModeBanners,
|
||||
definitions,
|
||||
tankDefinitions,
|
||||
tankIcons,
|
||||
currencies,
|
||||
skillIcons,
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { toUniqueId } from '@blitzkit/core';
|
||||
import { NodeIO } from '@gltf-transform/core';
|
||||
import { readdir } from 'fs/promises';
|
||||
import { extractArmor } from '../core/blitz/extractArmor';
|
||||
@@ -6,7 +7,6 @@ import { commitAssets } from '../core/github/commitAssets';
|
||||
import { FileChange } from '../core/github/commitMultipleFiles';
|
||||
import { DATA } from './constants';
|
||||
import { VehicleDefinitionList } from './definitions';
|
||||
import { toUniqueId } from '@blitzkit/core';
|
||||
|
||||
export async function tankArmors() {
|
||||
console.log('Building tank armors...');
|
||||
|
||||
@@ -26,10 +26,8 @@ await Promise.all(
|
||||
|
||||
const files = filesRaw.filter((file) => file.endsWith('.proto'));
|
||||
const args = [
|
||||
`--plugin="protoc-gen-ts=./node_modules/.bin/protoc-gen-ts${executableFileExtension}"`,
|
||||
'--ts_opt=esModuleInterop=true',
|
||||
`--js_out="import_style=commonjs,binary:."`,
|
||||
`--ts_out="."`,
|
||||
`--plugin=./node_modules/.bin/protoc-gen-ts_proto${executableFileExtension}`,
|
||||
'--ts_proto_out=.',
|
||||
...files.map((file) => `${ROOT}/${file}`),
|
||||
];
|
||||
|
||||
@@ -38,6 +36,6 @@ await writeFile(
|
||||
`${ROOT}/index.ts`,
|
||||
files
|
||||
.map((file) => file.replace('.proto', ''))
|
||||
.map((file) => `export * from './${file}_pb';`)
|
||||
.map((file) => `export * from './${file}.ts';`)
|
||||
.join('\n'),
|
||||
);
|
||||
Reference in new issue
Block a user