#演示 #quake #解析器 #quakeworld #演示 #mvd

mvdparser

从QuakeWorld MVD演示中提取信息

30个版本 (14个破坏性)

0.15.4 2024年6月28日
0.14.0 2024年6月10日

#501解析器实现

Download history 837/week @ 2024-04-27 440/week @ 2024-05-04 123/week @ 2024-05-11 31/week @ 2024-05-18 304/week @ 2024-05-25 211/week @ 2024-06-01 898/week @ 2024-06-08 233/week @ 2024-06-15 233/week @ 2024-06-22 106/week @ 2024-06-29 64/week @ 2024-07-06 82/week @ 2024-07-27

每月下载量152

MIT许可证

150KB
4K SLoC

mvdparser 测试 crates docs.rs

从QuakeWorld MVD演示中提取信息

函数

持续时间

mvdparser::countdown_duration(&data) // Option<Duration>
mvdparser::match_duration(&data)     // Option<Duration>
mvdparser::demo_duration(&data)      // Option<Duration>

时间戳

从服务器信息中的epoch获取时间戳(首选)matchdate打印中获取。

mvdparser::timestamp(&data) // Option<DateTime<Utc>>

客户端

mvdparser::clients(&data) // Result<Vec<Client>>

struct Client {
    pub number: u8,
    pub name: String,
    pub team: String,
    pub color: [u8; 2],
    pub is_spectator: bool,
    pub is_bot: bool,
}

玩家

mvdparser::players(&data) // Result<Vec<Player>>

struct Player {
    pub name: String,
    pub team: String,
    pub color: [u8; 2],
    pub frags: i32,
    pub ping: u32,
    pub is_bot: bool,
}

团队

mvdparser::teams(&data) // Result<Vec<Team>>

struct Team {
    pub name: String,
    pub color: [u8; 2],
    pub frags: i32,
    pub ping: u32,
    pub players: Vec<Player>,
}

打印

mvdparser::prints(&data) // Vec<Print>

struct Print {
    pub id: PrintId,
    pub content: Vec<u8>,
}

ktxstats

有关完整定义,请参阅ktxstats

mvdparser::ktxstats_v3(&data)     // Option<KtxstatsV3>

pub struct KtxstatsV3 {
    pub version: i32,
    pub date: DateTime<Utc>,
    pub map: String,
    pub hostname: String,
    pub ip: String,
    pub port: i32,
    pub mode: String,
    pub tl: i32,
    pub dm: i32,
    pub tp: i32,
    pub duration: i32,
    pub demo: String,
    pub teams: Vec<String>,
    pub players: Vec<Player>,
}

服务器信息

有关更多信息,请参阅quake_serverinfo

mvdparser::serverinfo(&data)        // Option<Serverinfo>

struct Serverinfo {
    pub admin: Option<String>,
    pub deathmatch: Option<i32>,
    pub epoch: Option<i32>,
    pub fpd: Option<i32>,
    pub fraglimit: Option<i32>,
    pub gamedir: Option<String>,
    pub hostname: Option<String>,
    pub ktxmode: Option<String>,
    pub ktxver: Option<String>,
    pub map: Option<String>,
    pub matchtag: Option<String>,
    pub maxclients: Option<i32>,
    pub maxfps: Option<i32>,
    pub maxspectators: Option<i32>,
    pub mode: Option<String>,
    pub needpass: Option<i32>,
    pub pm_ktjump: Option<i32>,
    pub progs: Option<String>,
    pub qvm: Option<String>,
    pub status: Option<String>,
    pub serverdemo: Option<String>,
    pub sv_antilag: Option<i32>,
    pub teamplay: Option<i32>,
    pub timelimit: Option<i32>,
    pub version: Option<String>,
    pub z_ext: Option<i32>,
}

依赖项

~2.2–3.5MB
~61K SLoC