mirror of
https://codeberg.org/icewind/tf-log-parser.git
synced 2026-11-30 12:50:49 +01:00
per-player data wip
This commit is contained in:
parent
cba5236496
commit
9da2d2230a
10 changed files with 341 additions and 127 deletions
|
|
@ -2,7 +2,7 @@ use crate::common::SubjectId;
|
|||
use crate::event::GameEvent;
|
||||
use crate::module::EventHandler;
|
||||
use crate::raw_event::RawEventType;
|
||||
use crate::SubjectMap;
|
||||
use crate::{SubjectData, SubjectMap};
|
||||
use chrono::{DateTime, FixedOffset, NaiveDateTime, TimeZone, Utc};
|
||||
use serde::{Serialize, Serializer};
|
||||
use std::num::ParseIntError;
|
||||
|
|
@ -197,13 +197,21 @@ impl LobbySettingsHandler {
|
|||
}
|
||||
|
||||
impl EventHandler for LobbySettingsHandler {
|
||||
type Output = Result<Option<Settings>, LobbySettingsError>;
|
||||
type GlobalOutput = Result<Option<Settings>, LobbySettingsError>;
|
||||
type PerSubjectData = ();
|
||||
type PerSubjectOutput = ();
|
||||
|
||||
fn does_handle(&self, ty: RawEventType) -> bool {
|
||||
matches!(ty, RawEventType::Say)
|
||||
}
|
||||
|
||||
fn handle(&mut self, _time: u32, subject: SubjectId, event: &GameEvent) {
|
||||
fn handle(
|
||||
&mut self,
|
||||
_time: u32,
|
||||
subject: SubjectId,
|
||||
_subject_data: &mut Self::PerSubjectData,
|
||||
event: &GameEvent,
|
||||
) {
|
||||
if !matches!(subject, SubjectId::Console) {
|
||||
return;
|
||||
}
|
||||
|
|
@ -214,13 +222,21 @@ impl EventHandler for LobbySettingsHandler {
|
|||
}
|
||||
}
|
||||
|
||||
fn finish(self, _subjects: &SubjectMap) -> Self::Output {
|
||||
fn finish_global(self, _subjects: &SubjectMap) -> Self::GlobalOutput {
|
||||
match self {
|
||||
LobbySettingsHandler::NotAvailable => Ok(None),
|
||||
LobbySettingsHandler::Active(settings) => Ok(Some(settings)),
|
||||
LobbySettingsHandler::Err(e) => Err(e),
|
||||
}
|
||||
}
|
||||
|
||||
fn finish_per_subject(
|
||||
&self,
|
||||
_subject: &SubjectData,
|
||||
data: Self::PerSubjectData,
|
||||
) -> Self::PerSubjectOutput {
|
||||
data
|
||||
}
|
||||
}
|
||||
|
||||
fn get_timezone(date: &str) -> Result<FixedOffset, LobbySettingsError> {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue