From df9005cc9f57d9ffc0b21b86968290d627c89f47 Mon Sep 17 00:00:00 2001 From: CosminPerRam Date: Sat, 18 Feb 2023 18:09:20 +0200 Subject: [PATCH] Games: Codename CURE support. --- CHANGELOG.md | 3 ++- GAMES.md | 1 + examples/master_querant.rs | 3 ++- src/games/ccure.rs | 12 ++++++++++++ src/games/mod.rs | 2 ++ src/protocols/valve/types.rs | 2 ++ 6 files changed, 21 insertions(+), 2 deletions(-) create mode 100644 src/games/ccure.rs diff --git a/CHANGELOG.md b/CHANGELOG.md index cae349d..8349d34 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,12 +1,13 @@ Who knows what the future holds... -# 0.X.Y - DD/MM/2023 +# 0.1.Y - DD/MM/2023 ### Changes: Games: - [Don't Starve Together](https://store.steampowered.com/app/322330/Dont_Starve_Together/) support. - [Colony Survival](https://store.steampowered.com/app/366090/Colony_Survival/) support. - [Onset](https://store.steampowered.com/app/1105810/Onset/) support. +- [Codename CURE](https://store.steampowered.com/app/355180/Codename_CURE/) support. ### Breaking: Nothing. diff --git a/GAMES.md b/GAMES.md index b3ce845..941fbc6 100644 --- a/GAMES.md +++ b/GAMES.md @@ -39,6 +39,7 @@ Beware of the `Notes` column, as it contains information about query port offset | Don't Starve Together | DST | Valve Protocol | Query port is 27016. | | Colony Survival | COLU | Valve Protocol | | | Onset | ONSET | Valve Protocol | Query port is 7776. | +| Codename CURE | CCURE | Valve Protocol | | ## Planned to add support: _ diff --git a/examples/master_querant.rs b/examples/master_querant.rs index f0f39da..03112f1 100644 --- a/examples/master_querant.rs +++ b/examples/master_querant.rs @@ -1,6 +1,6 @@ use std::env; -use gamedig::{aliens, aoc, arma2oa, ase, asrd, bat1944, bm, cosu, cs, cscz, csgo, css, dod, dods, doi, dst, GDResult, gm, hl2dm, hldms, ins, insmic, inss, l4d, l4d2, mc, onset, pz, ror2, rust, sc, sdtd, tf, tf2, tfc, ts, unturned}; +use gamedig::{aliens, aoc, arma2oa, ase, asrd, bat1944, bm, ccure, cosu, cs, cscz, csgo, css, dod, dods, doi, dst, GDResult, gm, hl2dm, hldms, ins, insmic, inss, l4d, l4d2, mc, onset, pz, ror2, rust, sc, sdtd, tf, tf2, tfc, ts, unturned}; use gamedig::protocols::minecraft::LegacyGroup; use gamedig::protocols::valve; use gamedig::protocols::valve::App; @@ -77,6 +77,7 @@ fn main() -> GDResult<()> { "dst" => println!("{:#?}", dst::query(ip, port)?), "cosu" => println!("{:#?}", cosu::query(ip, port)?), "onset" => println!("{:#?}", onset::query(ip, port)?), + "ccure" => println!("{:#?}", ccure::query(ip, port)?), _ => panic!("Undefined game: {}", args[1]) }; diff --git a/src/games/ccure.rs b/src/games/ccure.rs new file mode 100644 index 0000000..062b32f --- /dev/null +++ b/src/games/ccure.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 => 27015, + Some(port) => port + }, SteamID::CCURE.as_app(), None, None)?; + + Ok(game::Response::new_from_valve_response(valve_response)) +} diff --git a/src/games/mod.rs b/src/games/mod.rs index fcff5f3..2038c42 100644 --- a/src/games/mod.rs +++ b/src/games/mod.rs @@ -73,3 +73,5 @@ pub mod dst; pub mod cosu; /// Onset pub mod onset; +/// Codename CURE +pub mod ccure; diff --git a/src/protocols/valve/types.rs b/src/protocols/valve/types.rs index 5f0c1cc..c11049a 100644 --- a/src/protocols/valve/types.rs +++ b/src/protocols/valve/types.rs @@ -187,6 +187,8 @@ pub enum SteamID { RUST = 252490, /// Don't Starve Together DST = 322320, + /// Codename CURE + CCURE = 355180, /// Black Mesa BM = 362890, /// Colony Survival