record-daemon: refactor to record raw league data
This commit is contained in:
@@ -4,18 +4,16 @@ mod mapper;
|
||||
mod store;
|
||||
|
||||
pub use mapper::EventMapper;
|
||||
pub use store::{
|
||||
GameFinalStats, MetadataUpdate, PlayerIdentityInfo, RecordingMetadata, TimelineStore,
|
||||
TimestampedEvent,
|
||||
};
|
||||
pub use store::{MetadataUpdate, RecordingMetadata, TimelineStore, TimestampedEvent};
|
||||
|
||||
use chrono::{DateTime, Duration, Utc};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use uuid::Uuid;
|
||||
|
||||
use crate::lqp::{GameEvent, RunePage, SummonerSpells};
|
||||
use crate::lqp::GameEvent;
|
||||
|
||||
/// A timeline of events for a recording.
|
||||
/// Stores raw API responses for maximum flexibility and future-proofing.
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct Timeline {
|
||||
/// Recording ID.
|
||||
@@ -28,51 +26,27 @@ pub struct Timeline {
|
||||
pub duration_secs: i64,
|
||||
/// Events in the timeline.
|
||||
pub events: Vec<TimestampedEvent>,
|
||||
/// Champion played.
|
||||
/// Game ID if available.
|
||||
#[serde(default)]
|
||||
pub champion: Option<String>,
|
||||
/// Skin name.
|
||||
pub game_id: Option<u64>,
|
||||
/// Raw session data from `/lol-gameflow/v1/session`.
|
||||
#[serde(default)]
|
||||
pub skin_name: Option<String>,
|
||||
/// Queue type.
|
||||
pub raw_session: Option<serde_json::Value>,
|
||||
/// Raw summoner data from `/lol-summoner/v1/current-summoner`.
|
||||
#[serde(default)]
|
||||
pub queue_type: Option<String>,
|
||||
/// Queue ID.
|
||||
pub raw_summoner: Option<serde_json::Value>,
|
||||
/// Raw champion select data from `/lol-champ-select/v1/session`.
|
||||
#[serde(default)]
|
||||
pub queue_id: Option<u32>,
|
||||
/// Game mode.
|
||||
pub raw_champion_select: Option<serde_json::Value>,
|
||||
/// Raw rune page data from `/lol-perks/v1/currentpage`.
|
||||
#[serde(default)]
|
||||
pub game_mode: Option<String>,
|
||||
/// Map name.
|
||||
pub raw_rune_page: Option<serde_json::Value>,
|
||||
/// Raw live client data from `/liveclientdata/allgamedata`.
|
||||
#[serde(default)]
|
||||
pub map_name: Option<String>,
|
||||
/// Summoner name.
|
||||
#[serde(default)]
|
||||
pub summoner_name: Option<String>,
|
||||
/// Player's PUUID.
|
||||
#[serde(default)]
|
||||
pub puuid: 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>,
|
||||
/// Rune page at game start.
|
||||
#[serde(default)]
|
||||
pub runes: Option<RunePage>,
|
||||
/// Summoner spells.
|
||||
#[serde(default)]
|
||||
pub summoner_spells: Option<SummonerSpells>,
|
||||
/// Raw end-of-game stats JSON from the API.
|
||||
pub raw_live_client_data: Option<serde_json::Value>,
|
||||
/// Raw end-of-game stats from `/lol-end-of-game/v1/eog-stats-block`.
|
||||
#[serde(default)]
|
||||
pub raw_end_game_stats: Option<serde_json::Value>,
|
||||
/// All players in the game (puuid to summoner name mapping).
|
||||
#[serde(default)]
|
||||
pub all_players: Vec<PlayerIdentityInfo>,
|
||||
}
|
||||
|
||||
impl Timeline {
|
||||
@@ -91,21 +65,13 @@ 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,
|
||||
puuid: None,
|
||||
team: None,
|
||||
victory: None,
|
||||
final_stats: None,
|
||||
runes: None,
|
||||
summoner_spells: None,
|
||||
game_id: None,
|
||||
raw_session: None,
|
||||
raw_summoner: None,
|
||||
raw_champion_select: None,
|
||||
raw_rune_page: None,
|
||||
raw_live_client_data: None,
|
||||
raw_end_game_stats: None,
|
||||
all_players: Vec::new(),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user