diff --git a/CHANGELOG.md b/CHANGELOG.md index d04b2f3..258323c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,9 @@ Protocols: 1. Added standard and serde derives to `GatheringSettings`. - Quake 1, 2 and 3 support. +Games: +- [Quake 2](https://store.steampowered.com/app/2320/Quake_II/) support. + ### Breaking: - Every function that used `&str` for the address has been changed to `&IpAddr` (thanks [@Douile](https://github.com/Douile) for the re-re-write). diff --git a/GAMES.md b/GAMES.md index 8ed4f73..dee2d3e 100644 --- a/GAMES.md +++ b/GAMES.md @@ -50,6 +50,7 @@ Beware of the `Notes` column, as it contains information about query port offset | Serious Sam | SS | GameSpy 1 | Query Port offset: 1. | | Frontlines: Fuel of War | FFOW | Valve Protocol (Proprietary) | Query Port offset: 2. | | Crysis Wars | CW | GameSpy 3 | | +| Quake 2 | QUAKE2 | Quake 2 | | ## Planned to add support: _ diff --git a/examples/master_querant.rs b/examples/master_querant.rs index 3c6f8fb..d5b8672 100644 --- a/examples/master_querant.rs +++ b/examples/master_querant.rs @@ -2,7 +2,7 @@ use gamedig::protocols::{gamespy, quake}; use gamedig::protocols::minecraft::LegacyGroup; use gamedig::protocols::valve; use gamedig::protocols::valve::Engine; -use gamedig::{aliens, aoc, arma2oa, ase, asrd, avorion, bat1944, bb2, bf1942, bm, bo, ccure, cosu, cs, cscz, csgo, css, dod, dods, doi, dst, ffow, gm, hl2dm, hldms, ins, insmic, inss, l4d, l4d2, mc, ohd, onset, pz, ror2, rust, sc, sdtd, ss, tf, tf2, tfc, ts, unturned, ut, vr, GDResult, cw}; +use gamedig::{aliens, aoc, arma2oa, ase, asrd, avorion, bat1944, bb2, bf1942, bm, bo, ccure, cosu, cs, cscz, csgo, css, dod, dods, doi, dst, ffow, gm, hl2dm, hldms, ins, insmic, inss, l4d, l4d2, mc, ohd, onset, pz, ror2, rust, sc, sdtd, ss, tf, tf2, tfc, ts, unturned, ut, vr, GDResult, cw, quake2}; use std::env; use std::net::IpAddr; @@ -126,6 +126,7 @@ fn main() -> GDResult<()> { "_quake1" => println!("{:#?}", quake::one::query(ip, port.unwrap(), None)), "_quake2" => println!("{:#?}", quake::two::query(ip, port.unwrap(), None)), "_quake3" => println!("{:#?}", quake::three::query(ip, port.unwrap(), None)), + "quake2" => println!("{:#?}", quake2::query(ip, port)?), _ => panic!("Undefined game: {}", args[1]), }; diff --git a/src/games/mod.rs b/src/games/mod.rs index 66ace49..1f821ed 100644 --- a/src/games/mod.rs +++ b/src/games/mod.rs @@ -94,3 +94,5 @@ pub mod ut; pub mod vr; /// Crysis Wars pub mod cw; +/// Quake 2 +pub mod quake2; diff --git a/src/games/quake2.rs b/src/games/quake2.rs new file mode 100644 index 0000000..4d83e90 --- /dev/null +++ b/src/games/quake2.rs @@ -0,0 +1,9 @@ +use std::net::IpAddr; +use crate::GDResult; +use crate::protocols::quake; +use crate::protocols::quake::Response; +use crate::protocols::quake::two::Player; + +pub fn query(address: &IpAddr, port: Option) -> GDResult> { + quake::two::query(address, port.unwrap_or(27910), None) +}