Add Risk of Rain 2 support.

This commit is contained in:
CosminPerRam 2023-01-09 19:02:31 +02:00
parent 1e99aebbac
commit ededf93b38
6 changed files with 26 additions and 1 deletions

View file

@ -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.

View file

@ -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:
_

View file

@ -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])
};

View file

@ -57,3 +57,5 @@ pub mod arma2oa;
pub mod doi;
/// Half-Life Deathmatch: Source
pub mod hldms;
/// Risk of Rain 2
pub mod ror2;

12
src/games/ror2.rs Normal file
View file

@ -0,0 +1,12 @@
use crate::GDResult;
use crate::protocols::valve;
use crate::protocols::valve::{game, SteamID};
pub fn query(address: &str, port: Option<u16>) -> GDResult<game::Response> {
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))
}

View file

@ -199,6 +199,8 @@ pub enum SteamID {
INSS = 581320,
/// Alien Swarm: Reactive Drop
ASRD = 563560,
/// Risk of Rain 2
ROR2 = 632360,
}
impl SteamID {