mirror of
https://github.com/eigenein/wotbreplay-parser.git
synced 2026-10-21 02:17:02 +02:00
New: add winning_team
This commit is contained in:
1 parent
8d45bb28ed
commit
93cea446f5
4 files changed
+17
-4
No files matched your search
@@ -26,11 +26,11 @@ fn main() -> Result<()> {
|
|||||||
|
|
||||||
assert_eq!(battle_results.players[0].account_id, 520886428);
|
assert_eq!(battle_results.players[0].account_id, 520886428);
|
||||||
assert_eq!(battle_results.players[0].info.nickname, "77mmmr");
|
assert_eq!(battle_results.players[0].info.nickname, "77mmmr");
|
||||||
assert_eq!(battle_results.players[0].info.team_number(), TeamNumber::Two);
|
assert_eq!(battle_results.players[0].info.team(), TeamNumber::Two);
|
||||||
assert_eq!(battle_results.players[0].info.platoon_id, None);
|
assert_eq!(battle_results.players[0].info.platoon_id, None);
|
||||||
|
|
||||||
assert_eq!(battle_results.players[1].info.nickname, "SNAK_THE_RIPPER");
|
assert_eq!(battle_results.players[1].info.nickname, "SNAK_THE_RIPPER");
|
||||||
assert_eq!(battle_results.players[1].info.team_number(), TeamNumber::One);
|
assert_eq!(battle_results.players[1].info.team(), TeamNumber::One);
|
||||||
assert_eq!(battle_results.players[1].info.platoon_id, Some(547466834));
|
assert_eq!(battle_results.players[1].info.platoon_id, Some(547466834));
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|||||||
@@ -21,7 +21,9 @@ pub struct BattleResults {
|
|||||||
#[prost(int64, tag = "2")]
|
#[prost(int64, tag = "2")]
|
||||||
pub timestamp: i64,
|
pub timestamp: i64,
|
||||||
|
|
||||||
// TODO: tag 3 – winning team number?
|
#[prost(enumeration = "TeamNumber", tag = "3")]
|
||||||
|
pub winning_team: i32,
|
||||||
|
|
||||||
/// Players in the battle.
|
/// Players in the battle.
|
||||||
#[prost(message, repeated, tag = "201")]
|
#[prost(message, repeated, tag = "201")]
|
||||||
pub players: Vec<Player>,
|
pub players: Vec<Player>,
|
||||||
@@ -58,7 +60,7 @@ pub struct PlayerInfo {
|
|||||||
|
|
||||||
/// Player's team assignment.
|
/// Player's team assignment.
|
||||||
#[prost(enumeration = "TeamNumber", tag = "3")]
|
#[prost(enumeration = "TeamNumber", tag = "3")]
|
||||||
pub team_number: i32,
|
pub team: i32,
|
||||||
|
|
||||||
#[prost(string, optional, tag = "5")]
|
#[prost(string, optional, tag = "5")]
|
||||||
pub clan_tag: Option<String>,
|
pub clan_tag: Option<String>,
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
use std::fs::File;
|
use std::fs::File;
|
||||||
|
|
||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
|
use wotbreplay_parser::models::TeamNumber;
|
||||||
use wotbreplay_parser::Replay;
|
use wotbreplay_parser::Replay;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@@ -94,3 +95,13 @@ fn victory_points_ok() -> Result<()> {
|
|||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn winning_team_ok() -> Result<()> {
|
||||||
|
let battle_results = Replay::open(File::open("tests/replays/winning_team.wotbreplay")?)?
|
||||||
|
.read_battle_results()?;
|
||||||
|
|
||||||
|
assert_eq!(battle_results.winning_team(), TeamNumber::One);
|
||||||
|
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
Generated
BIN
Binary file not shown.
Reference in new issue
Block a user