[Game] Add Creativerse support.

This commit is contained in:
CosminPerRam 2023-09-03 12:12:14 +03:00
parent 89d69c1176
commit 76a3ac2f78
7 changed files with 84 additions and 56 deletions

16
src/games/creativerse.rs Normal file
View file

@ -0,0 +1,16 @@
use crate::{
protocols::valve::{self, game, SteamApp},
GDResult,
};
use std::net::{IpAddr, SocketAddr};
pub fn query(address: &IpAddr, port: Option<u16>) -> GDResult<game::Response> {
let valve_response = valve::query(
&SocketAddr::new(*address, port.unwrap_or(26901)),
SteamApp::CREATIVERSE.as_engine(),
None,
None,
)?;
Ok(game::Response::new_from_valve_response(valve_response))
}

View file

@ -47,6 +47,7 @@ pub static GAMES: Map<&'static str, Game> = phf_map! {
"cscz" => game!("Counter Strike: Condition Zero", 27015, Protocol::Valve(SteamApp::CSCZ)),
"csgo" => game!("Counter-Strike: Global Offensive", 27015, Protocol::Valve(SteamApp::CSGO)),
"css" => game!("Counter-Strike: Source", 27015, Protocol::Valve(SteamApp::CSS)),
"creativerse" => game!("Creativerse", 26901, Protocol::Valve(SteamApp::CREATIVERSE)),
"cw" => game!("Crysis Wars", 64100, Protocol::Gamespy(GameSpyVersion::Three)),
"dod" => game!("Day of Defeat", 27015, Protocol::Valve(SteamApp::DOD)),
"dods" => game!("Day of Defeat: Source", 27015, Protocol::Valve(SteamApp::DODS)),

View file

@ -29,6 +29,8 @@ pub mod bo;
pub mod ccure;
/// Colony Survival
pub mod cosu;
/// Creativerse
pub mod creativerse;
/// Counter-Strike
pub mod cs;
/// Counter Strike: Condition Zero

View file

@ -255,6 +255,8 @@ impl Request {
pub enum SteamApp {
/// Counter-Strike
CS,
/// Creativerse
CREATIVERSE,
/// Team Fortress Classic
TFC,
/// Day of Defeat
@ -361,6 +363,7 @@ impl SteamApp {
Self::INS => Engine::new_source(222_880),
Self::SDTD => Engine::new_source(251_570),
Self::RUST => Engine::new_source(252_490),
Self::CREATIVERSE => Engine::new_source(280_790),
Self::BO => Engine::new_source(296_300),
Self::DST => Engine::new_source(322_320),
Self::BB2 => Engine::new_source(346_330),