From ededf93b38ad91634a1cc928121e98fa44e4f18c Mon Sep 17 00:00:00 2001 From: CosminPerRam Date: Mon, 9 Jan 2023 19:02:31 +0200 Subject: [PATCH] Add Risk of Rain 2 support. --- CHANGELOG.md | 7 +++++++ GAMES.md | 1 + examples/master_querant.rs | 3 ++- src/games/mod.rs | 2 ++ src/games/ror2.rs | 12 ++++++++++++ src/protocols/valve/types.rs | 2 ++ 6 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 src/games/ror2.rs diff --git a/CHANGELOG.md b/CHANGELOG.md index 17836f4..365e5dc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,13 @@ Who knows what the future holds... +# X - DD/MM/YYYY +### Changes: +[Risk of Rain 2](https://store.steampowered.com/app/632360/Risk_of_Rain_2/) support. + +### Breaking: +Nothing (yet). + # 0.0.7 - 03/01/2023 ### Changes: [Minecraft](https://www.minecraft.com) bedrock edition support. diff --git a/GAMES.md b/GAMES.md index 712cd02..e018df9 100644 --- a/GAMES.md +++ b/GAMES.md @@ -30,6 +30,7 @@ A supported game is defined as a game that has been successfully tested, other g | Arma 2: Operation Arrowhead | ARMA2OA | Valve Protocol | Use the query port. | | Day of Infamy | DOI | Valve Protocol | | | Half-Life Deathmatch: Source | HLDMS | Valve Protocol | | +| Risk of Rain 2 | ROR2 | Valve Protocol | Use the query port (by default its 27016 (the game connection port + 1)). | ## Planned to add support: _ diff --git a/examples/master_querant.rs b/examples/master_querant.rs index dd181ba..48a7562 100644 --- a/examples/master_querant.rs +++ b/examples/master_querant.rs @@ -1,6 +1,6 @@ use std::env; -use gamedig::{aliens, arma2oa, ase, asrd, cs, cscz, csgo, css, dod, dods, doi, GDResult, gm, hl2dm, hldms, ins, insmic, inss, l4d, l4d2, mc, rust, sc, sdtd, tf, tf2, tfc, ts, unturned}; +use gamedig::{aliens, arma2oa, ase, asrd, cs, cscz, csgo, css, dod, dods, doi, GDResult, gm, hl2dm, hldms, ins, insmic, inss, l4d, l4d2, mc, ror2, rust, sc, sdtd, tf, tf2, tfc, ts, unturned}; use gamedig::protocols::minecraft::LegacyGroup; use gamedig::protocols::valve; use gamedig::protocols::valve::App; @@ -69,6 +69,7 @@ fn main() -> GDResult<()> { "arma2oa" => println!("{:#?}", arma2oa::query(ip, port)?), "doi" => println!("{:#?}", doi::query(ip, port)?), "hldms" => println!("{:#?}", hldms::query(ip, port)?), + "ror2" => println!("{:#?}", ror2::query(ip, port)?), _ => panic!("Undefined game: {}", args[1]) }; diff --git a/src/games/mod.rs b/src/games/mod.rs index 18ca089..6511bbc 100644 --- a/src/games/mod.rs +++ b/src/games/mod.rs @@ -57,3 +57,5 @@ pub mod arma2oa; pub mod doi; /// Half-Life Deathmatch: Source pub mod hldms; +/// Risk of Rain 2 +pub mod ror2; diff --git a/src/games/ror2.rs b/src/games/ror2.rs new file mode 100644 index 0000000..9bb5e0d --- /dev/null +++ b/src/games/ror2.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::ROR2.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 5797f45..1e54a0e 100644 --- a/src/protocols/valve/types.rs +++ b/src/protocols/valve/types.rs @@ -199,6 +199,8 @@ pub enum SteamID { INSS = 581320, /// Alien Swarm: Reactive Drop ASRD = 563560, + /// Risk of Rain 2 + ROR2 = 632360, } impl SteamID {