mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-21 10:47:04 +02:00
feat: some unfinished ideas
This commit is contained in:
1 parent
5346ab576f
commit
2c105d7a89
5 files changed
+154
No files matched your search
@@ -0,0 +1,36 @@
|
||||
import AdmZip from 'adm-zip';
|
||||
import { readFile } from 'fs/promises';
|
||||
import { BattleResultsReadStream } from '../src/core/streams/battleResults';
|
||||
|
||||
interface WoTBReplayMeta {
|
||||
version: string;
|
||||
title: string;
|
||||
dbid: string;
|
||||
playerName: string;
|
||||
battleStartTime: string;
|
||||
playerVehicleName: string;
|
||||
mapName: string;
|
||||
arenaUniqueId: string;
|
||||
battleDuration: number;
|
||||
vehicleCompDescriptor: number;
|
||||
camouflageId: number;
|
||||
mapId: number;
|
||||
arenaBonusType: number;
|
||||
}
|
||||
|
||||
const file = await readFile('temp/test.wotbreplay');
|
||||
const zip = new AdmZip(file);
|
||||
const entries = zip.getEntries();
|
||||
|
||||
const metaRaw = entries.find((entry) => entry.name === 'meta.json');
|
||||
const battleResultsRaw = entries.find(
|
||||
(entry) => entry.name === 'battle_results.dat',
|
||||
);
|
||||
|
||||
if (!metaRaw) throw new Error('No meta.json found');
|
||||
if (!battleResultsRaw) throw new Error('No battle_results.dat found');
|
||||
|
||||
const meta = JSON.parse(metaRaw.getData().toString()) as WoTBReplayMeta;
|
||||
const battleResults = new BattleResultsReadStream(
|
||||
battleResultsRaw.getData().buffer,
|
||||
).battleResults();
|
||||
Reference in new issue
Block a user