From bbd2dd7d97ae594110320431795b0ab0388d892c Mon Sep 17 00:00:00 2001 From: CosminPerRam Date: Wed, 18 Jan 2023 17:57:19 +0200 Subject: [PATCH] Games: Don't Starve Together support. --- CHANGELOG.md | 8 ++++++++ GAMES.md | 1 + examples/master_querant.rs | 3 ++- src/games/dst.rs | 12 ++++++++++++ src/games/mod.rs | 2 ++ src/protocols/valve/types.rs | 2 ++ 6 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 src/games/dst.rs diff --git a/CHANGELOG.md b/CHANGELOG.md index 3bda8cc..f16e0ca 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,14 @@ Who knows what the future holds... +# 0.X.Y - DD/MM/2023 +### Changes: +Games: +- [Don't Starve Together](https://store.steampowered.com/app/322330/Dont_Starve_Together/) support. + +### Breaking: +Nothing. + # 0.1.0 - 17/01/2023 ### Changes: Games: diff --git a/GAMES.md b/GAMES.md index 6bcfb33..32e10f9 100644 --- a/GAMES.md +++ b/GAMES.md @@ -36,6 +36,7 @@ Beware of the `Notes` column, as it contains information about query port offset | Black Mesa | BM | Valve Protocol | | | Project Zomboid | PZ | Valve Protocol | | | Age of Chivalry | AOC | Valve Protocol | | +| Don't Starve Together | DST | Valve Protocol | Query port is 27016. | ## Planned to add support: _ diff --git a/examples/master_querant.rs b/examples/master_querant.rs index 6a1e4d4..1900616 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, 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::{aliens, aoc, arma2oa, ase, asrd, bat1944, bm, cs, cscz, csgo, css, dod, dods, doi, dst, 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; @@ -74,6 +74,7 @@ fn main() -> GDResult<()> { "bm" => println!("{:#?}", bm::query(ip, port)?), "pz" => println!("{:#?}", pz::query(ip, port)?), "aoc" => println!("{:#?}", aoc::query(ip, port)?), + "dst" => println!("{:#?}", dst::query(ip, port)?), _ => panic!("Undefined game: {}", args[1]) }; diff --git a/src/games/dst.rs b/src/games/dst.rs new file mode 100644 index 0000000..012f141 --- /dev/null +++ b/src/games/dst.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 => 27016, + Some(port) => port + }, SteamID::DST.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 6e59157..c2c17d9 100644 --- a/src/games/mod.rs +++ b/src/games/mod.rs @@ -67,3 +67,5 @@ pub mod bm; pub mod pz; /// Age of Chivalry pub mod aoc; +/// Don't Starve Together +pub mod dst; diff --git a/src/protocols/valve/types.rs b/src/protocols/valve/types.rs index fcb955f..04963b9 100644 --- a/src/protocols/valve/types.rs +++ b/src/protocols/valve/types.rs @@ -183,6 +183,8 @@ pub enum SteamID { SC = 225840, /// Rust RUST = 252490, + /// Don't Starve Together + DST = 322320, /// Black Mesa BM = 362890, /// Day of Infamy