[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

View file

@ -3,6 +3,9 @@ Who knows what the future holds...
# 0.X.Y - DD/MM/2023
### Changes:
Games:
- [Creativerse](https://store.steampowered.com/app/280790/Creativerse/) support.
Protocols:
- Quake 2: Fixed a bug where the version tag wouldn't always be present.
- Valve: Added the field `check_app_id` to `GatherSettings` which controls if the app id specified to the request and

113
GAMES.md
View file

@ -3,62 +3,63 @@ one of the implemented protocols might work too, but that isn't guaranteed.
Beware of the `Notes` column, as it contains information about query port offsets or other query requirements/information.
# Supported games:
| Game | Use name | Protocol | Notes |
|------------------------------------|----------|----------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| Team Fortress 2 | TF2 | Valve | |
| The Ship | TS | Valve (*Altered) | |
| Counter-Strike: Global Offensive | CSGO | Valve | The server must have the cvar `host_players_show` set to `2` to get the full player list. |
| Counter-Strike: Source | CSS | Valve | |
| Day of Defeat: Source | DODS | Valve | |
| Left 4 Dead | L4D | Valve | |
| Left 4 Dead 2 | L4D2 | Valve | |
| Half-Life 2 Deathmatch | HL2DM | Valve | |
| Alien Swarm | ALIENS | Valve | |
| Alien Swarm: Reactive Drop | ASRD | Valve | |
| Insurgency | INS | Valve | |
| Insurgency: Sandstorm | INSS | Valve | Query port offset: 1. |
| Insurgency: Modern Infantry Combat | INSMIC | Valve | |
| Counter-Strike: Condition Zero | CSCZ | Valve GoldSrc | |
| Day of Defeat | DOD | Valve GoldSrc | |
| Minecraft | MC | Proprietary | Bedrock edition provides a different response compared to the Java edition, query specifically for bedrock to get them, otherwise, only matching fields will be provided. |
| 7 Days To Die | SDTD | Valve | |
| ARK: Survival Evolved | ASE | Valve | |
| Unturned | UNTURNED | Valve | |
| The Forest | TF | Valve GoldSrc | Query port offset: 1. |
| Team Fortress Classic | TFC | Valve | |
| Sven Co-op | SC | Valve GoldSrc | |
| Rust | RUST | Valve | |
| Counter-Strike | CS | Valve GoldSrc | |
| Arma 2: Operation Arrowhead | ARMA2OA | Valve | Query port offset: 1. |
| Day of Infamy | DOI | Valve | |
| Half-Life Deathmatch: Source | HLDMS | Valve | |
| Risk of Rain 2 | ROR2 | Valve | Query port offset: 1. |
| Battalion 1944 | BAT1944 | Valve | Query port offset: 3. It is strongly recommended to also query the rules, as it sends basic server info in them. |
| Black Mesa | BM | Valve | |
| Project Zomboid | PZ | Valve | |
| Age of Chivalry | AOC | Valve | |
| Don't Starve Together | DST | Valve | Query port is 27016. |
| Colony Survival | COLU | Valve | |
| Onset | ONSET | Valve | Query port is 7776. |
| Codename CURE | CCURE | Valve | |
| Ballistic Overkill | BO | Valve | Query port is 27016. |
| BrainBread 2 | BB2 | Valve | |
| Avorion | AVORION | Valve | Query port is 27020. |
| Operation: Harsh Doorstop | OHD | Valve | Query port is 27005. |
| V Rising | VR | Valve | Query port is 27016. |
| Unreal Tournament | UT | GameSpy 1 | Query Port offset: 1. |
| Battlefield 1942 | BF1942 | GameSpy 1 | Query port is 23000. |
| Serious Sam | SS | GameSpy 1 | Query Port offset: 1. |
| Frontlines: Fuel of War | FFOW | Valve (*Altered) | Query Port offset: 2. |
| Crysis Wars | CW | GameSpy 3 | |
| Quake 2 | QUAKE2 | Quake 2 | |
| Quake 1 | QUAKE1 | Quake 1 | |
| Quake 3: Arena | QUAKE3A | Quake 3 | |
| Hell Let Loose | HLL | Valve Protocol | Query port is 26420. Note that on this port it might not send players data, as there might be another query port that does send players data. |
| Soldier of Fortune 2 | SOF2 | Quake 3 | |
| Halo: Combat Evolved | HALOCE | GameSpy 2 | |
| Just Cause 2: Multiplayer | JC2MP | GameSpy 3 (*Altered) | |
| Warsow | WARSOW | Quake 3 | |
| Game | Use name | Protocol | Notes |
|------------------------------------|-------------|----------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| Team Fortress 2 | TF2 | Valve | |
| The Ship | TS | Valve (*Altered) | |
| Counter-Strike: Global Offensive | CSGO | Valve | The server must have the cvar `host_players_show` set to `2` to get the full player list. |
| Counter-Strike: Source | CSS | Valve | |
| Day of Defeat: Source | DODS | Valve | |
| Left 4 Dead | L4D | Valve | |
| Left 4 Dead 2 | L4D2 | Valve | |
| Half-Life 2 Deathmatch | HL2DM | Valve | |
| Alien Swarm | ALIENS | Valve | |
| Alien Swarm: Reactive Drop | ASRD | Valve | |
| Insurgency | INS | Valve | |
| Insurgency: Sandstorm | INSS | Valve | Query port offset: 1. |
| Insurgency: Modern Infantry Combat | INSMIC | Valve | |
| Counter-Strike: Condition Zero | CSCZ | Valve GoldSrc | |
| Day of Defeat | DOD | Valve GoldSrc | |
| Minecraft | MC | Proprietary | Bedrock edition provides a different response compared to the Java edition, query specifically for bedrock to get them, otherwise, only matching fields will be provided. |
| 7 Days To Die | SDTD | Valve | |
| ARK: Survival Evolved | ASE | Valve | |
| Unturned | UNTURNED | Valve | |
| The Forest | TF | Valve GoldSrc | Query port offset: 1. |
| Team Fortress Classic | TFC | Valve | |
| Sven Co-op | SC | Valve GoldSrc | |
| Rust | RUST | Valve | |
| Counter-Strike | CS | Valve GoldSrc | |
| Arma 2: Operation Arrowhead | ARMA2OA | Valve | Query port offset: 1. |
| Day of Infamy | DOI | Valve | |
| Half-Life Deathmatch: Source | HLDMS | Valve | |
| Risk of Rain 2 | ROR2 | Valve | Query port offset: 1. |
| Battalion 1944 | BAT1944 | Valve | Query port offset: 3. It is strongly recommended to also query the rules, as it sends basic server info in them. |
| Black Mesa | BM | Valve | |
| Project Zomboid | PZ | Valve | |
| Age of Chivalry | AOC | Valve | |
| Don't Starve Together | DST | Valve | Query port is 27016. |
| Colony Survival | COLU | Valve | |
| Onset | ONSET | Valve | Query port is 7776. |
| Codename CURE | CCURE | Valve | |
| Ballistic Overkill | BO | Valve | Query port is 27016. |
| BrainBread 2 | BB2 | Valve | |
| Avorion | AVORION | Valve | Query port is 27020. |
| Operation: Harsh Doorstop | OHD | Valve | Query port is 27005. |
| V Rising | VR | Valve | Query port is 27016. |
| Unreal Tournament | UT | GameSpy 1 | Query Port offset: 1. |
| Battlefield 1942 | BF1942 | GameSpy 1 | Query port is 23000. |
| Serious Sam | SS | GameSpy 1 | Query Port offset: 1. |
| Frontlines: Fuel of War | FFOW | Valve (*Altered) | Query Port offset: 2. |
| Crysis Wars | CW | GameSpy 3 | |
| Quake 2 | QUAKE2 | Quake 2 | |
| Quake 1 | QUAKE1 | Quake 1 | |
| Quake 3: Arena | QUAKE3A | Quake 3 | |
| Hell Let Loose | HLL | Valve Protocol | Query port is 26420. Note that on this port it might not send players data, as there might be another query port that does send players data. |
| Soldier of Fortune 2 | SOF2 | Quake 3 | |
| Halo: Combat Evolved | HALOCE | GameSpy 2 | |
| Just Cause 2: Multiplayer | JC2MP | GameSpy 3 (*Altered) | |
| Warsow | WARSOW | Quake 3 | |
| Creativerse | CREATIVERSE | Valve | Query Port offset: 1. |
## Planned to add support:
_

View file

@ -16,6 +16,7 @@ use gamedig::{
bo,
ccure,
cosu,
creativerse,
cs,
cscz,
csgo,
@ -193,6 +194,7 @@ fn main() -> GDResult<()> {
"haloce" => println!("{:#?}", haloce::query(ip, port)?),
"jc2mp" => println!("{:#?}", jc2mp::query(ip, port)?),
"warsow" => println!("{:#?}", warsow::query(ip, port)?),
"creativerse" => println!("{:#?}", creativerse::query(ip, port)?),
_ => panic!("Undefined game: {}", args[1]),
};

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),