record-daemon: add game start and end metadata
All checks were successful
record-daemon / Build, check and test (push) Successful in 2m9s
All checks were successful
record-daemon / Build, check and test (push) Successful in 2m9s
This commit is contained in:
@@ -4,7 +4,9 @@ mod mapper;
|
||||
mod store;
|
||||
|
||||
pub use mapper::EventMapper;
|
||||
pub use store::{RecordingMetadata, TimelineStore, TimestampedEvent};
|
||||
pub use store::{
|
||||
GameFinalStats, MetadataUpdate, RecordingMetadata, TimelineStore, TimestampedEvent,
|
||||
};
|
||||
|
||||
use chrono::{DateTime, Duration, Utc};
|
||||
use serde::{Deserialize, Serialize};
|
||||
@@ -25,6 +27,36 @@ pub struct Timeline {
|
||||
pub duration_secs: i64,
|
||||
/// Events in the timeline.
|
||||
pub events: Vec<TimestampedEvent>,
|
||||
/// Champion played.
|
||||
#[serde(default)]
|
||||
pub champion: Option<String>,
|
||||
/// Skin name.
|
||||
#[serde(default)]
|
||||
pub skin_name: Option<String>,
|
||||
/// Queue type.
|
||||
#[serde(default)]
|
||||
pub queue_type: Option<String>,
|
||||
/// Queue ID.
|
||||
#[serde(default)]
|
||||
pub queue_id: Option<u32>,
|
||||
/// Game mode.
|
||||
#[serde(default)]
|
||||
pub game_mode: Option<String>,
|
||||
/// Map name.
|
||||
#[serde(default)]
|
||||
pub map_name: Option<String>,
|
||||
/// Summoner name.
|
||||
#[serde(default)]
|
||||
pub summoner_name: Option<String>,
|
||||
/// Team (100 = blue, 200 = red).
|
||||
#[serde(default)]
|
||||
pub team: Option<u32>,
|
||||
/// Whether the game was won.
|
||||
#[serde(default)]
|
||||
pub victory: Option<bool>,
|
||||
/// Final player stats.
|
||||
#[serde(default)]
|
||||
pub final_stats: Option<GameFinalStats>,
|
||||
}
|
||||
|
||||
impl Timeline {
|
||||
@@ -43,6 +75,16 @@ impl Timeline {
|
||||
end_time: None,
|
||||
duration_secs: 0,
|
||||
events: Vec::new(),
|
||||
champion: None,
|
||||
skin_name: None,
|
||||
queue_type: None,
|
||||
queue_id: None,
|
||||
game_mode: None,
|
||||
map_name: None,
|
||||
summoner_name: None,
|
||||
team: None,
|
||||
victory: None,
|
||||
final_stats: None,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -138,10 +180,13 @@ fn format_timestamp(duration: Duration) -> String {
|
||||
fn event_type_name(event: &GameEvent) -> String {
|
||||
match event {
|
||||
GameEvent::MatchFound(_) => "match_found",
|
||||
GameEvent::ChampSelectStart(_) => "champ_select_start",
|
||||
GameEvent::ChampionPick(_) => "champion_pick",
|
||||
GameEvent::GameStart(_) => "game_start",
|
||||
GameEvent::Kill(_) => "kill",
|
||||
GameEvent::Death(_) => "death",
|
||||
GameEvent::Objective(_) => "objective",
|
||||
GameEvent::StatsUpdate(_) => "stats_update",
|
||||
GameEvent::GameEnd(_) => "game_end",
|
||||
GameEvent::PhaseChange(_) => "phase_change",
|
||||
GameEvent::Unknown => "unknown",
|
||||
|
||||
Reference in New Issue
Block a user