diff --git a/CHANGELOG.md b/CHANGELOG.md index 2c48280..55ccafe 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ Games: - [Quake 1](https://store.steampowered.com/app/2310/Quake/) support. - [Quake 3: Arena](https://store.steampowered.com/app/2200/Quake_III_Arena/) support. - [Hell Let Loose](https://store.steampowered.com/app/686810/Hell_Let_Loose/) support. +- [Soldier of Fortune 2](https://www.gog.com/en/game/soldier_of_fortune_ii_double_helix_gold_edition) 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 9278b83..0b9adfa 100644 --- a/GAMES.md +++ b/GAMES.md @@ -54,6 +54,7 @@ Beware of the `Notes` column, as it contains information about query port offset | Quake 1 | QUAKE1 | Quake 1 | | | Quake 3: Arena | QUAKE3A | Quake 3 | | | Hell Let Loose | HLL | Valve Protocol | Query port is 26420. Note that on this port it might not send players data, as there might be another query port that does send players data. | +| Soldier of Fortune 2 | SOF2 | Quake 3 | | ## Planned to add support: _ diff --git a/examples/master_querant.rs b/examples/master_querant.rs index b5a1ae7..6815146 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, quake2, quake1, quake3a, hll}; +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, quake1, quake3a, hll, sof2}; use std::env; use std::net::IpAddr; @@ -130,6 +130,7 @@ fn main() -> GDResult<()> { "quake1" => println!("{:#?}", quake1::query(ip, port)?), "quake3a" => println!("{:#?}", quake3a::query(ip, port)?), "hll" => println!("{:#?}", hll::query(ip, port)?), + "sof2" => println!("{:#?}", sof2::query(ip, port)?), _ => panic!("Undefined game: {}", args[1]), }; diff --git a/src/games/mod.rs b/src/games/mod.rs index d2d9e1e..fb182b3 100644 --- a/src/games/mod.rs +++ b/src/games/mod.rs @@ -102,3 +102,5 @@ pub mod quake1; pub mod quake3a; /// Hell Let Loose pub mod hll; +/// Soldier of Fortune 2 +pub mod sof2; diff --git a/src/games/sof2.rs b/src/games/sof2.rs new file mode 100644 index 0000000..8beceea --- /dev/null +++ b/src/games/sof2.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::three::query(address, port.unwrap_or(20100), None) +}