diff --git a/CHANGELOG.md b/CHANGELOG.md index 0292f6b..7b10b67 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ Games: - [Risk of Rain 2](https://store.steampowered.com/app/632360/Risk_of_Rain_2/) support. - [Battalion 1944](https://store.steampowered.com/app/489940/BATTALION_Legacy/) support. - [Black Mesa](https://store.steampowered.com/app/362890/Black_Mesa/) support. +- [Project Zomboid](https://store.steampowered.com/app/108600/Project_Zomboid/) support. Protocols: - Valve: Players with no name are no more added to the `players_details` field. diff --git a/GAMES.md b/GAMES.md index 6e0c4c2..05fa2dd 100644 --- a/GAMES.md +++ b/GAMES.md @@ -33,6 +33,7 @@ A supported game is defined as a game that has been successfully tested, other g | Risk of Rain 2 | ROR2 | Valve Protocol | Query port offset: 1. | | Battalion 1944 | BAT1944 | Valve Protocol | Query port offset: 3. It is strongly recommended to also query the rules, as the game sends server information's in them. | | Black Mesa | BM | Valve Protocol | | +| Project Zomboid | PZ | Valve Protocol | | ## Planned to add support: _ diff --git a/examples/master_querant.rs b/examples/master_querant.rs index aa912c3..2ea2b79 100644 --- a/examples/master_querant.rs +++ b/examples/master_querant.rs @@ -1,6 +1,6 @@ use std::env; -use gamedig::{aliens, arma2oa, ase, asrd, bat1944, bm, cs, cscz, csgo, css, dod, dods, doi, GDResult, gm, hl2dm, hldms, ins, insmic, inss, l4d, l4d2, mc, ror2, rust, sc, sdtd, tf, tf2, tfc, ts, unturned}; +use gamedig::{aliens, arma2oa, ase, asrd, bat1944, bm, cs, cscz, csgo, css, dod, dods, doi, GDResult, gm, hl2dm, hldms, ins, insmic, inss, l4d, l4d2, mc, pz, ror2, rust, sc, sdtd, tf, tf2, tfc, ts, unturned}; use gamedig::protocols::minecraft::LegacyGroup; use gamedig::protocols::valve; use gamedig::protocols::valve::App; @@ -72,6 +72,7 @@ fn main() -> GDResult<()> { "ror2" => println!("{:#?}", ror2::query(ip, port)?), "bat1944" => println!("{:#?}", bat1944::query(ip, port)?), "bm" => println!("{:#?}", bm::query(ip, port)?), + "pz" => println!("{:#?}", pz::query(ip, port)?), _ => panic!("Undefined game: {}", args[1]) }; diff --git a/src/games/mod.rs b/src/games/mod.rs index e038862..033ed38 100644 --- a/src/games/mod.rs +++ b/src/games/mod.rs @@ -63,3 +63,5 @@ pub mod ror2; pub mod bat1944; /// Black Mesa pub mod bm; +/// Project Zomboid +pub mod pz; diff --git a/src/games/pz.rs b/src/games/pz.rs new file mode 100644 index 0000000..2188145 --- /dev/null +++ b/src/games/pz.rs @@ -0,0 +1,12 @@ +use crate::GDResult; +use crate::protocols::valve; +use crate::protocols::valve::{game, SteamID}; + +pub fn query(address: &str, port: Option) -> GDResult { + let valve_response = valve::query(address, match port { + None => 16261, + Some(port) => port + }, SteamID::PZ.as_app(), None, None)?; + + Ok(game::Response::new_from_valve_response(valve_response)) +} diff --git a/src/protocols/valve/types.rs b/src/protocols/valve/types.rs index 4e9ad6a..d8e4585 100644 --- a/src/protocols/valve/types.rs +++ b/src/protocols/valve/types.rs @@ -173,6 +173,8 @@ pub enum SteamID { INSMIC = 17700, /// ARMA 2: Operation Arrowhead ARMA2OA = 33930, + /// Project Zomboid + PZ = 108600, /// Insurgency INS = 222880, /// Sven Co-op