mirror of
https://github.com/eigenein/wotbreplay-parser.git
synced 2026-10-21 10:27:01 +02:00
Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
897f98c17c |
No files matched your search
@@ -22,8 +22,8 @@ pub struct BattleResults {
|
|||||||
#[prost(int64, tag = "2")]
|
#[prost(int64, tag = "2")]
|
||||||
pub timestamp: i64,
|
pub timestamp: i64,
|
||||||
|
|
||||||
#[prost(enumeration = "WinnerTeamNumber", tag = "3")]
|
#[prost(enumeration = "TeamNumber", optional, tag = "3")]
|
||||||
pub winner_team_number: i32,
|
pub winner_team_number: Option<i32>,
|
||||||
|
|
||||||
/// Replay's author results.
|
/// Replay's author results.
|
||||||
#[prost(message, required, tag = "8")]
|
#[prost(message, required, tag = "8")]
|
||||||
@@ -85,14 +85,6 @@ pub enum TeamNumber {
|
|||||||
Two = 2,
|
Two = 2,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, Enumeration, Serialize)]
|
|
||||||
#[repr(i32)]
|
|
||||||
pub enum WinnerTeamNumber {
|
|
||||||
Neither = 0,
|
|
||||||
One = 1,
|
|
||||||
Two = 2,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Player's battle results.
|
/// Player's battle results.
|
||||||
#[derive(Message, Serialize)]
|
#[derive(Message, Serialize)]
|
||||||
pub struct PlayerResults {
|
pub struct PlayerResults {
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ fn player_results_ok() -> Result<()> {
|
|||||||
assert_eq!(battle_results_dat.arena_unique_id, 1661909200500084);
|
assert_eq!(battle_results_dat.arena_unique_id, 1661909200500084);
|
||||||
let battle_results: BattleResults = battle_results_dat.try_into()?;
|
let battle_results: BattleResults = battle_results_dat.try_into()?;
|
||||||
|
|
||||||
assert_eq!(battle_results.winner_team_number, 2);
|
assert_eq!(battle_results.winner_team_number, Some(2));
|
||||||
|
|
||||||
assert_eq!(battle_results.author.team_number, 2);
|
assert_eq!(battle_results.author.team_number, 2);
|
||||||
assert_eq!(battle_results.author.credits_earned, 59518);
|
assert_eq!(battle_results.author.credits_earned, 59518);
|
||||||
@@ -122,6 +122,6 @@ fn victory_points_ok() -> Result<()> {
|
|||||||
fn draw_ok() -> Result<()> {
|
fn draw_ok() -> Result<()> {
|
||||||
let battle_results = Replay::open(File::open("tests/replays/20230503_0027__helaas_pindakaas_A140_ASTRON_REX_105_2319058483532631656.wotbreplay")?)?
|
let battle_results = Replay::open(File::open("tests/replays/20230503_0027__helaas_pindakaas_A140_ASTRON_REX_105_2319058483532631656.wotbreplay")?)?
|
||||||
.read_battle_results()?;
|
.read_battle_results()?;
|
||||||
assert_eq!(battle_results.winner_team_number, 0);
|
assert_eq!(battle_results.winner_team_number, None);
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user