2022-12-02 22:56:01 +01:00
|
|
|
# `wotbreplay-parser`
|
2022-12-02 22:55:22 +01:00
|
|
|
|
|
|
|
|
World of Tanks Blitz replay parser in Rust.
|
|
|
|
|
|
2022-12-02 23:57:34 +01:00
|
|
|
[](https://crates.io/crates/wotbreplay-parser)
|
2022-12-02 22:55:22 +01:00
|
|
|
[](https://github.com/eigenein/wotbreplay-parser/commits/main)
|
2022-12-02 23:57:34 +01:00
|
|
|
[](https://github.com/eigenein/wotbreplay-parser/actions)
|
|
|
|
|

|
2022-12-03 00:01:45 +01:00
|
|
|
[](https://docs.rs/wotbreplay-parser)
|
2022-12-02 22:55:22 +01:00
|
|
|
|
2022-12-03 20:52:51 +01:00
|
|
|
## Quickstart
|
|
|
|
|
|
|
|
|
|
```rust
|
|
|
|
|
use std::fs::File;
|
|
|
|
|
|
|
|
|
|
use anyhow::Result;
|
2022-12-07 15:21:21 +01:00
|
|
|
use wotbreplay_parser::prelude::*;
|
2022-12-03 20:52:51 +01:00
|
|
|
|
|
|
|
|
fn main() -> Result<()> {
|
2022-12-03 21:05:52 +01:00
|
|
|
let battle_results = Replay::open(File::open("tests/replays/battle_results.wotbreplay")?)?
|
2022-12-03 20:52:51 +01:00
|
|
|
.read_battle_results()?;
|
|
|
|
|
|
|
|
|
|
assert_eq!(battle_results.timestamp, 1670018359);
|
|
|
|
|
assert_eq!(battle_results.players.len(), 14);
|
|
|
|
|
|
|
|
|
|
assert_eq!(battle_results.players[0].account_id, 520886428);
|
|
|
|
|
assert_eq!(battle_results.players[0].info.nickname, "77mmmr");
|
2022-12-06 19:08:56 +01:00
|
|
|
assert_eq!(battle_results.players[0].info.team(), TeamNumber::Two);
|
2022-12-03 20:52:51 +01:00
|
|
|
assert_eq!(battle_results.players[0].info.platoon_id, None);
|
|
|
|
|
|
|
|
|
|
assert_eq!(battle_results.players[1].info.nickname, "SNAK_THE_RIPPER");
|
2022-12-06 19:08:56 +01:00
|
|
|
assert_eq!(battle_results.players[1].info.team(), TeamNumber::One);
|
2022-12-03 20:52:51 +01:00
|
|
|
assert_eq!(battle_results.players[1].info.platoon_id, Some(547466834));
|
|
|
|
|
|
|
|
|
|
Ok(())
|
|
|
|
|
}
|
|
|
|
|
```
|
|
|
|
|
|
2022-12-02 22:53:39 +01:00
|
|
|
## Replay structure
|
|
|
|
|
|
|
|
|
|
`*.wotbreplay` is a ZIP-archive containing:
|
|
|
|
|
- `battle_results.dat`
|
|
|
|
|
- `meta.json`
|
|
|
|
|
- `data.wotreplay`
|
|
|
|
|
|
|
|
|
|
### `battle_results.dat`
|
|
|
|
|
|
|
|
|
|
This is a [pickled](https://docs.python.org/3/library/pickle.html) 2-tuple:
|
|
|
|
|
- Some big number
|
|
|
|
|
- Battle results serialized with [Protocol Buffers](https://developers.google.com/protocol-buffers)
|
|
|
|
|
|
2022-12-02 22:58:01 +01:00
|
|
|
#### Useful tools
|
|
|
|
|
|
|
|
|
|
- [Protobuf Decoder](https://protobuf-decoder.netlify.app/)
|
|
|
|
|
- [`protobuf-inspector`](https://github.com/mildsunrise/protobuf-inspector)
|
|
|
|
|
- [Hex Fiend](https://hexfiend.com/)
|
|
|
|
|
|
2022-12-02 22:53:39 +01:00
|
|
|
### `meta.json`
|
|
|
|
|
|
|
|
|
|
### `data.wotreplay`
|