Files

37 lines
1.6 KiB
Markdown
Raw Permalink Normal View History

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
[![Crates.io](https://img.shields.io/crates/v/wotbreplay-parser)](https://crates.io/crates/wotbreplay-parser)
2022-12-02 22:55:22 +01:00
[![Last commit](https://img.shields.io/github/last-commit/eigenein/wotbreplay-parser)](https://github.com/eigenein/wotbreplay-parser/commits/main)
2023-04-17 00:11:52 +02:00
[![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/eigenein/wotbreplay-parser/check.yaml)](https://github.com/eigenein/wotbreplay-parser/actions)
2022-12-02 23:57:34 +01:00
![License: MIT](https://img.shields.io/crates/l/wotbreplay-parser)
2022-12-03 00:01:45 +01:00
[![docs.rs](https://img.shields.io/docsrs/wotbreplay-parser)](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;
2023-04-29 22:20:46 +02:00
use wotbreplay_parser::models::battle_results::TeamNumber;
use wotbreplay_parser::replay::Replay;
2022-12-03 20:52:51 +01:00
fn main() -> Result<()> {
2023-05-08 22:43:28 +02:00
let battle_results = Replay::open(File::open("replays/20221203_player_results.wotbreplay")?)?.read_battle_results()?;
2022-12-03 20:52:51 +01:00
2023-05-08 23:39:52 +02:00
assert_eq!(battle_results.timestamp_secs, 1670083956);
2022-12-03 20:52:51 +01:00
assert_eq!(battle_results.players.len(), 14);
2023-04-29 22:52:24 +02:00
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));
2022-12-03 20:52:51 +01:00
assert_eq!(battle_results.players[1].info.nickname, "SNAK_THE_RIPPER");
2023-04-29 22:52:24 +02:00
assert_eq!(battle_results.players[1].info.team(), TeamNumber::Two);
assert_eq!(battle_results.players[1].info.platoon_id, Some(273692628));
2022-12-03 20:52:51 +01:00
Ok(())
}
```