mirror of
https://github.com/eigenein/wotbreplay-parser.git
synced 2026-10-21 02:17:02 +02:00
59353a9acae6fec64fa201a61debf9db43e52b84
wotbreplay-parser
World of Tanks Blitz replay parser in Rust.
Quickstart
use std::fs::File;
use anyhow::Result;
use wotbreplay_parser::models::battle_results::TeamNumber;
use wotbreplay_parser::replay::Replay;
fn main() -> Result<()> {
let battle_results = Replay::open(File::open("tests/replays/player_results.wotbreplay")?)?
.read_battle_results()?;
assert_eq!(battle_results.timestamp, 1670083956);
assert_eq!(battle_results.players.len(), 14);
assert_eq!(battle_results.players[0].account_id, 595693744);
assert_eq!(battle_results.players[0].info.nickname, "yuranhik_hustriy26");
assert_eq!(battle_results.players[0].info.team(), TeamNumber::One);
assert_eq!(battle_results.players[0].info.platoon_id, Some(545104609));
assert_eq!(battle_results.players[1].info.nickname, "SNAK_THE_RIPPER");
assert_eq!(battle_results.players[1].info.team(), TeamNumber::Two);
assert_eq!(battle_results.players[1].info.platoon_id, Some(273692628));
Ok(())
}
Replay structure
*.wotbreplay is a ZIP-archive containing:
battle_results.datmeta.jsondata.wotreplay
battle_results.dat
This is a pickled 2-tuple:
- Some big number
- Battle results serialized with Protocol Buffers
Useful tools
meta.json
data.wotreplay
Languages
Rust
100%