mirror of
https://codeberg.org/icewind/tf-log-parser.git
synced 2026-11-30 04:40:47 +01:00
151 lines
3.5 KiB
Rust
151 lines
3.5 KiB
Rust
use crate::common::{Class, Team};
|
|
use crate::event::{param_parse_with, parse_field, quoted, ParamIter};
|
|
use crate::raw_event::{subject_parser, RawSubject};
|
|
use crate::{Error, Event, Result};
|
|
use std::net::SocketAddr;
|
|
|
|
#[derive(Debug, Event, Clone)]
|
|
pub struct ShotFiredEvent<'a> {
|
|
pub weapon: Option<&'a str>,
|
|
}
|
|
|
|
#[derive(Debug, Event, Clone)]
|
|
pub struct ShotHitEvent<'a> {
|
|
pub weapon: Option<&'a str>,
|
|
}
|
|
|
|
#[derive(Debug, Event, Clone)]
|
|
pub struct DamageEvent<'a> {
|
|
#[event(name = "against")]
|
|
#[event(default)]
|
|
pub target: RawSubject<'a>,
|
|
pub damage: Option<i64>,
|
|
#[event(name = "realdamage")]
|
|
pub real_damage: Option<i64>,
|
|
pub weapon: Option<&'a str>,
|
|
}
|
|
|
|
#[derive(Debug, Event, Clone)]
|
|
pub struct KillEvent<'a> {
|
|
#[event(unnamed)]
|
|
#[event(subject)]
|
|
pub target: RawSubject<'a>,
|
|
#[event(name = "with")]
|
|
pub weapon: &'a str,
|
|
#[event(name = "customkill")]
|
|
pub custom_kill: Option<&'a str>,
|
|
pub attacker_position: Option<(i32, i32, i32)>,
|
|
pub victim_position: Option<(i32, i32, i32)>,
|
|
}
|
|
|
|
#[derive(Debug, Event, Clone)]
|
|
pub struct KillAssistEvent<'a> {
|
|
#[event(name = "against")]
|
|
pub target: RawSubject<'a>,
|
|
pub assister_position: Option<(i32, i32, i32)>,
|
|
pub victim_position: Option<(i32, i32, i32)>,
|
|
}
|
|
|
|
#[derive(Debug, Event, Clone)]
|
|
pub struct SpawnEvent {
|
|
#[event(name = "as")]
|
|
pub class: Option<Class>,
|
|
}
|
|
|
|
#[derive(Debug, Event, Clone)]
|
|
pub struct RoleChangeEvent {
|
|
#[event(name = "to")]
|
|
pub class: Option<Class>,
|
|
}
|
|
|
|
#[derive(Debug, Event, Clone)]
|
|
pub struct ConnectedEvent {
|
|
#[event(name = "address")]
|
|
pub address: SocketAddr,
|
|
}
|
|
|
|
#[derive(Debug, Event, Clone)]
|
|
pub struct JoinedTeamEvent {
|
|
pub team: Team,
|
|
}
|
|
|
|
#[derive(Debug, Event, Clone)]
|
|
pub struct CommittedSuicideEvent<'a> {
|
|
#[event(name = "with")]
|
|
pub weapon: &'a str,
|
|
pub attacker_position: Option<(i32, i32, i32)>,
|
|
}
|
|
|
|
#[derive(Debug, Event, Clone)]
|
|
pub struct PickedUpEvent<'a> {
|
|
pub item: &'a str,
|
|
}
|
|
|
|
#[derive(Debug, Event, Clone)]
|
|
pub struct DominationEvent<'a> {
|
|
pub against: RawSubject<'a>,
|
|
}
|
|
|
|
#[derive(Debug, Event, Clone)]
|
|
pub struct RevengeEvent<'a> {
|
|
pub against: RawSubject<'a>,
|
|
}
|
|
|
|
#[derive(Debug, Event, Clone)]
|
|
pub struct DisconnectEvent<'a> {
|
|
pub reason: Option<&'a str>,
|
|
}
|
|
|
|
#[derive(Debug, Event, Clone)]
|
|
pub struct BuiltObjectEvent<'a> {
|
|
pub object: Option<&'a str>,
|
|
pub position: Option<(i32, i32, i32)>,
|
|
}
|
|
|
|
#[derive(Debug, Event, Clone)]
|
|
pub struct BuiltCarryEvent<'a> {
|
|
pub object: Option<&'a str>,
|
|
pub position: Option<(i32, i32, i32)>,
|
|
}
|
|
|
|
#[derive(Debug, Event, Clone)]
|
|
pub struct DropObjectEvent<'a> {
|
|
pub object: Option<&'a str>,
|
|
pub position: Option<(i32, i32, i32)>,
|
|
}
|
|
|
|
#[derive(Debug, Event, Clone)]
|
|
pub struct KilledObjectEvent<'a> {
|
|
pub object: Option<&'a str>,
|
|
pub weapon: Option<&'a str>,
|
|
#[event(name = "objectowner")]
|
|
pub object_owner: Option<RawSubject<'a>>,
|
|
pub attacker_position: Option<(i32, i32, i32)>,
|
|
}
|
|
|
|
#[derive(Debug, Event, Clone)]
|
|
pub struct ObjectDetonatedEvent<'a> {
|
|
pub object: Option<&'a str>,
|
|
#[event(name = "attacker_position")]
|
|
pub position: Option<(i32, i32, i32)>,
|
|
}
|
|
|
|
#[derive(Debug, Event, Clone)]
|
|
pub struct ExtinguishedEvent<'a> {
|
|
pub against: RawSubject<'a>,
|
|
pub with: &'a str,
|
|
pub attacker_position: Option<(i32, i32, i32)>,
|
|
pub victim_position: Option<(i32, i32, i32)>,
|
|
}
|
|
|
|
#[derive(Debug, Event, Clone)]
|
|
pub struct SayEvent<'a> {
|
|
#[event(unnamed)]
|
|
pub text: &'a str,
|
|
}
|
|
|
|
#[derive(Debug, Event, Clone)]
|
|
pub struct SayTeamEvent<'a> {
|
|
#[event(unnamed)]
|
|
pub text: &'a str,
|
|
}
|