Implement Team display in perround overview

Now tracks the scores of the teams and displays them on the homepage.
Also now displays the team numbers next to the overview of rounds won to know which team won which round
This commit is contained in:
Lol3rrr
2024-10-15 22:02:19 +02:00
parent a2be4c2167
commit 5cb9094f76
11 changed files with 263 additions and 253 deletions

View File

@@ -0,0 +1,73 @@
#[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
pub struct ScoreBoard {
pub teams: Vec<(u32, Vec<ScoreBoardPlayer>)>
}
#[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
pub struct ScoreBoardPlayer {
pub name: String,
pub kills: usize,
pub deaths: usize,
pub damage: usize,
pub assists: usize,
}
#[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
pub struct PlayerHeatmap {
pub name: String,
pub team: String,
pub png_data: String,
}
#[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
pub struct PerRoundResult {
pub teams: Vec<PerRoundTeam>,
pub rounds: Vec<DemoRound>,
}
#[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
pub struct PerRoundTeam {
pub name: String,
pub number: u32,
}
#[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
pub struct DemoRound {
pub reason: RoundWinReason,
pub events: Vec<RoundEvent>
}
#[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
pub enum RoundWinReason {
StillInProgress,
BombExploded,
VipEscaped,
VipKilled,
TSaved,
CtStoppedEscape,
RoundEndReasonTerroristsStopped,
BombDefused,
TKilled,
CTKilled,
Draw,
HostageRescued,
TimeRanOut,
RoundEndReasonHostagesNotRescued,
TerroristsNotEscaped,
VipNotEscaped,
GameStart,
TSurrender,
CTSurrender,
TPlanted,
CTReachedHostage,
}
#[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
pub enum RoundEvent {
BombPlanted,
BombDefused,
Killed {
attacker: String,
died: String,
},
}

View File

@@ -18,67 +18,4 @@ pub struct DemoInfo {
pub map: String,
}
pub mod demo_analysis {
#[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
pub struct ScoreBoard {
pub team1: Vec<ScoreBoardPlayer>,
pub team2: Vec<ScoreBoardPlayer>,
}
#[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
pub struct ScoreBoardPlayer {
pub name: String,
pub kills: usize,
pub deaths: usize,
pub damage: usize,
pub assists: usize,
}
#[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
pub struct PlayerHeatmap {
pub name: String,
pub team: String,
pub png_data: String,
}
#[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
pub struct DemoRound {
pub reason: RoundWinReason,
pub events: Vec<RoundEvent>
}
#[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
pub enum RoundWinReason {
StillInProgress,
BombExploded,
VipEscaped,
VipKilled,
TSaved,
CtStoppedEscape,
RoundEndReasonTerroristsStopped,
BombDefused,
TKilled,
CTKilled,
Draw,
HostageRescued,
TimeRanOut,
RoundEndReasonHostagesNotRescued,
TerroristsNotEscaped,
VipNotEscaped,
GameStart,
TSurrender,
CTSurrender,
TPlanted,
CTReachedHostage,
}
#[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
pub enum RoundEvent {
BombPlanted,
BombDefused,
Killed {
attacker: String,
died: String,
},
}
}
pub mod demo_analysis;