Break: rename author_results into author and add author.account_id

This commit is contained in:
eigenein committed 2022-12-07 14:17:23 +01:00
1 parent d2fb61425a
commit e1d9c27bda
2 files changed
+9 -5

No files matched your search

+5 -2
View File
@@ -26,7 +26,7 @@ pub struct BattleResults {
/// Replay's author results. /// Replay's author results.
#[prost(message, required, tag = "8")] #[prost(message, required, tag = "8")]
pub author_results: AuthorResults, pub author: Author,
/// Author's free XP, including premium. /// Author's free XP, including premium.
#[prost(uint32, tag = "137")] #[prost(uint32, tag = "137")]
@@ -176,7 +176,7 @@ impl PlayerResultsInfo {
} }
#[derive(Message, Serialize)] #[derive(Message, Serialize)]
pub struct AuthorResults { pub struct Author {
/// Earned credits, including premium and special awards and medals. /// Earned credits, including premium and special awards and medals.
#[prost(uint32, tag = "2")] #[prost(uint32, tag = "2")]
pub credits_earned: u32, pub credits_earned: u32,
@@ -187,4 +187,7 @@ pub struct AuthorResults {
#[prost(uint32, tag = "8")] #[prost(uint32, tag = "8")]
pub damage_dealt: u32, pub damage_dealt: u32,
#[prost(uint32, tag = "101")]
pub account_id: u32,
} }
+4 -3
View File
@@ -111,9 +111,10 @@ fn author_results_ok() -> Result<()> {
let battle_results = Replay::open(File::open("tests/replays/author_results.wotbreplay")?)? let battle_results = Replay::open(File::open("tests/replays/author_results.wotbreplay")?)?
.read_battle_results()?; .read_battle_results()?;
assert_eq!(battle_results.author_results.credits_earned, 53623); assert_eq!(battle_results.author.credits_earned, 53623);
assert_eq!(battle_results.author_results.combat_xp, 2370); assert_eq!(battle_results.author.combat_xp, 2370);
assert_eq!(battle_results.author_results.damage_dealt, 1738); assert_eq!(battle_results.author.damage_dealt, 1738);
assert_eq!(battle_results.author.account_id, 594778041);
assert_eq!(battle_results.free_xp, 116); assert_eq!(battle_results.free_xp, 116);
Ok(()) Ok(())