diff --git a/replays/20230802_2133__helaas_pindakaas_S31_Strv_K_15193856522497923.wotbreplay b/replays/20230802_2133__helaas_pindakaas_S31_Strv_K_15193856522497923.wotbreplay new file mode 100644 index 0000000..1cae04f Binary files /dev/null and b/replays/20230802_2133__helaas_pindakaas_S31_Strv_K_15193856522497923.wotbreplay differ diff --git a/replays/20230802_2136__helaas_pindakaas_Oth38_50TP_Tyszkiewicza_S1_15188303129784363.wotbreplay b/replays/20230802_2136__helaas_pindakaas_Oth38_50TP_Tyszkiewicza_S1_15188303129784363.wotbreplay new file mode 100644 index 0000000..5562dc2 Binary files /dev/null and b/replays/20230802_2136__helaas_pindakaas_Oth38_50TP_Tyszkiewicza_S1_15188303129784363.wotbreplay differ diff --git a/src/models/battle_results.rs b/src/models/battle_results.rs index 043242e..c4b0042 100644 --- a/src/models/battle_results.rs +++ b/src/models/battle_results.rs @@ -93,6 +93,9 @@ pub struct PlayerInfo { #[prost(message, required, tag = "7")] pub avatar: Avatar, + + #[prost(uint32, optional, tag = "9")] + pub rank: Option, } #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, Enumeration, Serialize)] diff --git a/tests/battle_results.rs b/tests/battle_results.rs index e304813..6d7a1a2 100644 --- a/tests/battle_results.rs +++ b/tests/battle_results.rs @@ -139,3 +139,25 @@ fn room_type_ok() -> Result<()> { assert_eq!(battle_results.room_type(), RoomType::MadGames); Ok(()) } + +/// Training room on Strv K with a rank. +#[test] +fn rank_ok() -> Result<()> { + let battle_results = Replay::open(File::open( + "replays/20230802_2133__helaas_pindakaas_S31_Strv_K_15193856522497923.wotbreplay", + )?)? + .read_battle_results()?; + assert_eq!(battle_results.players[0].info.rank, Some(12)); + Ok(()) +} + +/// Training room on Regressor with no rank. +#[test] +fn no_rank_ok() -> Result<()> { + let battle_results = Replay::open(File::open( + "replays/20230802_2136__helaas_pindakaas_Oth38_50TP_Tyszkiewicza_S1_15188303129784363.wotbreplay", + )?)? + .read_battle_results()?; + assert_eq!(battle_results.players[0].info.rank, None); + Ok(()) +}