mirror of
https://github.com/eigenein/wotbreplay-parser.git
synced 2026-10-21 10:27:01 +02:00
✨ Add MapId
This commit is contained in:
1 parent
c986abca5d
commit
1313bc82f7
5 files changed
+46
-1
No files matched your search
@@ -1,4 +1,5 @@
|
||||
pub mod battle_results;
|
||||
pub mod battle_results_dat;
|
||||
pub mod data;
|
||||
pub mod map_id;
|
||||
pub mod meta;
|
||||
@@ -21,6 +21,15 @@ impl BattleResults {
|
||||
/// TODO: 150[0].21[0].8[0].801[0].unsigned is arena end time.
|
||||
#[derive(Message, Serialize)]
|
||||
pub struct BattleResults {
|
||||
/// The two least-significant bytes is map ID.
|
||||
///
|
||||
/// The 3rd byte is probably a game mode:
|
||||
///
|
||||
/// - `0x0xxxx` is «encounter»
|
||||
/// - `0x1xxxx` flag is «supremacy»
|
||||
#[prost(uint32, tag = "1")]
|
||||
pub mode_map_id: u32,
|
||||
|
||||
/// Battle timestamp.
|
||||
#[prost(int64, tag = "2")]
|
||||
pub timestamp_secs: i64,
|
||||
@@ -83,7 +92,6 @@ pub struct PlayerInfo {
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, Enumeration, Serialize)]
|
||||
#[repr(i32)]
|
||||
pub enum TeamNumber {
|
||||
One = 1,
|
||||
Two = 2,
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
use prost::Enumeration;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde_with::rust::deserialize_ignore_any;
|
||||
|
||||
#[derive(Debug, Deserialize, Serialize, Enumeration)]
|
||||
#[serde(untagged)]
|
||||
pub enum MapId {
|
||||
DesertSands = 2,
|
||||
Middleburg = 3,
|
||||
Copperfield = 4,
|
||||
Mines = 6,
|
||||
DeadRail = 7,
|
||||
FortDespair = 8,
|
||||
Himmelsdorf = 9,
|
||||
OasisPalms = 11,
|
||||
Molendijk = 14,
|
||||
PortBay = 15,
|
||||
Castilla = 20,
|
||||
Canal = 21,
|
||||
YamatoHarbor = 25,
|
||||
Canyon = 27,
|
||||
MayanRuins = 30,
|
||||
NavalFrontier = 35,
|
||||
Alpenstadt = 38,
|
||||
NewBay = 40,
|
||||
Normandy = 42,
|
||||
|
||||
/// Default value for Protocol Buffers and fallback value for Serde.
|
||||
#[serde(deserialize_with = "deserialize_ignore_any")]
|
||||
Undefined = 0,
|
||||
}
|
||||
@@ -5,6 +5,7 @@ use std::io::Read;
|
||||
|
||||
use serde::Deserialize;
|
||||
|
||||
use crate::models::map_id::MapId;
|
||||
use crate::result::Result;
|
||||
|
||||
/// The model for `meta.json`.
|
||||
@@ -21,6 +22,9 @@ pub struct Meta {
|
||||
|
||||
#[serde(rename = "vehicleCompDescriptor")]
|
||||
pub tank_id: u16,
|
||||
|
||||
#[serde(rename = "mapId")]
|
||||
pub map_id: MapId,
|
||||
}
|
||||
|
||||
impl Meta {
|
||||
|
||||
Reference in new issue
Block a user