diff --git a/CHANGELOG.md b/CHANGELOG.md index a238bf0..ea515cd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ Who knows what the future holds... [Unturned](https://store.steampowered.com/app/304930/Unturned/) support. [The Forest](https://store.steampowered.com/app/242760/The_Forest/) support. [Team Fortress Classic](https://store.steampowered.com/app/20/Team_Fortress_Classic/) support. +[Sven Co-op](https://store.steampowered.com/app/225840/Sven_Coop/) support. # 0.0.5 - 15/11/2022 Added `SocketBind` error, regarding failing to bind a socket. diff --git a/GAMES.md b/GAMES.md index 52cfdb4..648796f 100644 --- a/GAMES.md +++ b/GAMES.md @@ -23,6 +23,7 @@ | UNTURNED | Unturned | Valve Protocol | | | TF | The Forest | Valve Protocol | Use the query port. | | TFC | Team Fortress Classic | Valve Protocol | | +| SC | Sven Co-op | Valve Protocol | | ## Planned to add support: _ diff --git a/examples/master_querant.rs b/examples/master_querant.rs index c1a5c9d..d230e69 100644 --- a/examples/master_querant.rs +++ b/examples/master_querant.rs @@ -1,6 +1,6 @@ use std::env; -use gamedig::{aliens, ase, asrd, cscz, csgo, css, dod, dods, GDResult, gm, hl2dm, ins, insmic, inss, l4d, l4d2, mc, sdtd, tf, tf2, tfc, ts, unturned}; +use gamedig::{aliens, ase, asrd, cscz, csgo, css, dod, dods, GDResult, gm, hl2dm, ins, insmic, inss, l4d, l4d2, mc, sc, sdtd, tf, tf2, tfc, ts, unturned}; use gamedig::protocols::minecraft::{LegacyGroup, Server}; use gamedig::protocols::valve; use gamedig::protocols::valve::App; @@ -52,6 +52,7 @@ fn main() -> GDResult<()> { "unturned" => println!("{:#?}", unturned::query(ip, port)?), "tf" => println!("{:#?}", tf::query(ip, port)?), "tfc" => println!("{:#?}", tfc::query(ip, port)?), + "sc" => println!("{:#?}", sc::query(ip, port)?), "_src" => println!("{:#?}", valve::query(ip, 27015, App::Source(None), None, None)?), "_gld" => println!("{:#?}", valve::query(ip, 27015, App::GoldSrc(false), None, None)?), "_gld_f" => println!("{:#?}", valve::query(ip, 27015, App::GoldSrc(true), None, None)?), diff --git a/src/games/mod.rs b/src/games/mod.rs index 3e41830..9023672 100644 --- a/src/games/mod.rs +++ b/src/games/mod.rs @@ -45,3 +45,5 @@ pub mod unturned; pub mod tf; /// Team Fortress Classic pub mod tfc; +/// Sven Co-op +pub mod sc; diff --git a/src/games/sc.rs b/src/games/sc.rs new file mode 100644 index 0000000..7ab933d --- /dev/null +++ b/src/games/sc.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::SC.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 4757fbb..cb55026 100644 --- a/src/protocols/valve/types.rs +++ b/src/protocols/valve/types.rs @@ -175,6 +175,8 @@ pub enum SteamID { INSMIC = 17700, /// Insurgency INS = 222880, + /// Sven Co-op + SC = 225840, /// The Forrest TF = 556450, //this is the id for the dedicated server, for the game its 242760 /// 7 Days To Die @@ -193,7 +195,7 @@ impl SteamID { /// Get ID as App (the engine is specified). pub fn as_app(&self) -> App { match self { - SteamID::TFC | SteamID::DOD | SteamID::CSCZ => App::GoldSrc(false), + SteamID::TFC | SteamID::DOD | SteamID::CSCZ | SteamID::SC => App::GoldSrc(false), x => App::Source(Some(x.clone() as u32)) } }