mirror of
https://github.com/eigenein/wotbreplay-parser.git
synced 2026-10-24 11:49:48 +02:00
New: initial author_results
This commit is contained in:
1 parent
93cea446f5
commit
d2fb61425a
3 files changed
+37
-2
No files matched your search
@@ -24,6 +24,14 @@ pub struct BattleResults {
|
|||||||
#[prost(enumeration = "TeamNumber", tag = "3")]
|
#[prost(enumeration = "TeamNumber", tag = "3")]
|
||||||
pub winning_team: i32,
|
pub winning_team: i32,
|
||||||
|
|
||||||
|
/// Replay's author results.
|
||||||
|
#[prost(message, required, tag = "8")]
|
||||||
|
pub author_results: AuthorResults,
|
||||||
|
|
||||||
|
/// Author's free XP, including premium.
|
||||||
|
#[prost(uint32, tag = "137")]
|
||||||
|
pub free_xp: u32,
|
||||||
|
|
||||||
/// 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>,
|
||||||
@@ -93,7 +101,7 @@ pub struct PlayerResults {
|
|||||||
pub struct PlayerResultsInfo {
|
pub struct PlayerResultsInfo {
|
||||||
/// Credits earned – without special awards and medals and premium account excluded.
|
/// Credits earned – without special awards and medals and premium account excluded.
|
||||||
#[prost(uint32, tag = "2")]
|
#[prost(uint32, tag = "2")]
|
||||||
pub credits: u32,
|
pub credits_earned: u32,
|
||||||
|
|
||||||
/// Base XP (the total without multipliers).
|
/// Base XP (the total without multipliers).
|
||||||
#[prost(uint32, tag = "3")]
|
#[prost(uint32, tag = "3")]
|
||||||
@@ -166,3 +174,17 @@ impl PlayerResultsInfo {
|
|||||||
.map(|mm_rating| (mm_rating * 10.0 + 3000.0) as u32)
|
.map(|mm_rating| (mm_rating * 10.0 + 3000.0) as u32)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Message, Serialize)]
|
||||||
|
pub struct AuthorResults {
|
||||||
|
/// Earned credits, including premium and special awards and medals.
|
||||||
|
#[prost(uint32, tag = "2")]
|
||||||
|
pub credits_earned: u32,
|
||||||
|
|
||||||
|
/// Combat XP, including premium.
|
||||||
|
#[prost(uint32, tag = "3")]
|
||||||
|
pub combat_xp: u32,
|
||||||
|
|
||||||
|
#[prost(uint32, tag = "8")]
|
||||||
|
pub damage_dealt: u32,
|
||||||
|
}
|
||||||
+14
-1
@@ -38,7 +38,7 @@ fn player_results_ok() -> Result<()> {
|
|||||||
assert_eq!(zeekrab_info.victory_points_earned, 40);
|
assert_eq!(zeekrab_info.victory_points_earned, 40);
|
||||||
assert_eq!(zeekrab_info.victory_points_seized, 40);
|
assert_eq!(zeekrab_info.victory_points_seized, 40);
|
||||||
assert_eq!(zeekrab_info.tank_id, 26657);
|
assert_eq!(zeekrab_info.tank_id, 26657);
|
||||||
assert_eq!(zeekrab_info.credits, 37679);
|
assert_eq!(zeekrab_info.credits_earned, 37679);
|
||||||
assert_eq!(zeekrab_info.n_enemies_damaged, 2);
|
assert_eq!(zeekrab_info.n_enemies_damaged, 2);
|
||||||
assert_eq!(zeekrab_info.n_enemies_destroyed, 1);
|
assert_eq!(zeekrab_info.n_enemies_destroyed, 1);
|
||||||
|
|
||||||
@@ -105,3 +105,16 @@ fn winning_team_ok() -> Result<()> {
|
|||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn author_results_ok() -> Result<()> {
|
||||||
|
let battle_results = Replay::open(File::open("tests/replays/author_results.wotbreplay")?)?
|
||||||
|
.read_battle_results()?;
|
||||||
|
|
||||||
|
assert_eq!(battle_results.author_results.credits_earned, 53623);
|
||||||
|
assert_eq!(battle_results.author_results.combat_xp, 2370);
|
||||||
|
assert_eq!(battle_results.author_results.damage_dealt, 1738);
|
||||||
|
assert_eq!(battle_results.free_xp, 116);
|
||||||
|
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
Generated
BIN
Binary file not shown.
Reference in new issue
Block a user