mirror of
https://github.com/tribufu/rust-gamedig
synced 2026-06-01 09:42:41 +00:00
[Game] Add Creativerse support.
This commit is contained in:
parent
89d69c1176
commit
76a3ac2f78
7 changed files with 84 additions and 56 deletions
|
|
@ -3,6 +3,9 @@ Who knows what the future holds...
|
||||||
|
|
||||||
# 0.X.Y - DD/MM/2023
|
# 0.X.Y - DD/MM/2023
|
||||||
### Changes:
|
### Changes:
|
||||||
|
Games:
|
||||||
|
- [Creativerse](https://store.steampowered.com/app/280790/Creativerse/) support.
|
||||||
|
|
||||||
Protocols:
|
Protocols:
|
||||||
- Quake 2: Fixed a bug where the version tag wouldn't always be present.
|
- 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
|
- Valve: Added the field `check_app_id` to `GatherSettings` which controls if the app id specified to the request and
|
||||||
|
|
|
||||||
3
GAMES.md
3
GAMES.md
|
|
@ -4,7 +4,7 @@ Beware of the `Notes` column, as it contains information about query port offset
|
||||||
|
|
||||||
# Supported games:
|
# Supported games:
|
||||||
| Game | Use name | Protocol | Notes |
|
| Game | Use name | Protocol | Notes |
|
||||||
|------------------------------------|----------|----------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|------------------------------------|-------------|----------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||||
| Team Fortress 2 | TF2 | Valve | |
|
| Team Fortress 2 | TF2 | Valve | |
|
||||||
| The Ship | TS | Valve (*Altered) | |
|
| 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: Global Offensive | CSGO | Valve | The server must have the cvar `host_players_show` set to `2` to get the full player list. |
|
||||||
|
|
@ -59,6 +59,7 @@ Beware of the `Notes` column, as it contains information about query port offset
|
||||||
| Halo: Combat Evolved | HALOCE | GameSpy 2 | |
|
| Halo: Combat Evolved | HALOCE | GameSpy 2 | |
|
||||||
| Just Cause 2: Multiplayer | JC2MP | GameSpy 3 (*Altered) | |
|
| Just Cause 2: Multiplayer | JC2MP | GameSpy 3 (*Altered) | |
|
||||||
| Warsow | WARSOW | Quake 3 | |
|
| Warsow | WARSOW | Quake 3 | |
|
||||||
|
| Creativerse | CREATIVERSE | Valve | Query Port offset: 1. |
|
||||||
|
|
||||||
## Planned to add support:
|
## Planned to add support:
|
||||||
_
|
_
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,7 @@ use gamedig::{
|
||||||
bo,
|
bo,
|
||||||
ccure,
|
ccure,
|
||||||
cosu,
|
cosu,
|
||||||
|
creativerse,
|
||||||
cs,
|
cs,
|
||||||
cscz,
|
cscz,
|
||||||
csgo,
|
csgo,
|
||||||
|
|
@ -193,6 +194,7 @@ fn main() -> GDResult<()> {
|
||||||
"haloce" => println!("{:#?}", haloce::query(ip, port)?),
|
"haloce" => println!("{:#?}", haloce::query(ip, port)?),
|
||||||
"jc2mp" => println!("{:#?}", jc2mp::query(ip, port)?),
|
"jc2mp" => println!("{:#?}", jc2mp::query(ip, port)?),
|
||||||
"warsow" => println!("{:#?}", warsow::query(ip, port)?),
|
"warsow" => println!("{:#?}", warsow::query(ip, port)?),
|
||||||
|
"creativerse" => println!("{:#?}", creativerse::query(ip, port)?),
|
||||||
_ => panic!("Undefined game: {}", args[1]),
|
_ => panic!("Undefined game: {}", args[1]),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
16
src/games/creativerse.rs
Normal file
16
src/games/creativerse.rs
Normal 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))
|
||||||
|
}
|
||||||
|
|
@ -47,6 +47,7 @@ pub static GAMES: Map<&'static str, Game> = phf_map! {
|
||||||
"cscz" => game!("Counter Strike: Condition Zero", 27015, Protocol::Valve(SteamApp::CSCZ)),
|
"cscz" => game!("Counter Strike: Condition Zero", 27015, Protocol::Valve(SteamApp::CSCZ)),
|
||||||
"csgo" => game!("Counter-Strike: Global Offensive", 27015, Protocol::Valve(SteamApp::CSGO)),
|
"csgo" => game!("Counter-Strike: Global Offensive", 27015, Protocol::Valve(SteamApp::CSGO)),
|
||||||
"css" => game!("Counter-Strike: Source", 27015, Protocol::Valve(SteamApp::CSS)),
|
"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)),
|
"cw" => game!("Crysis Wars", 64100, Protocol::Gamespy(GameSpyVersion::Three)),
|
||||||
"dod" => game!("Day of Defeat", 27015, Protocol::Valve(SteamApp::DOD)),
|
"dod" => game!("Day of Defeat", 27015, Protocol::Valve(SteamApp::DOD)),
|
||||||
"dods" => game!("Day of Defeat: Source", 27015, Protocol::Valve(SteamApp::DODS)),
|
"dods" => game!("Day of Defeat: Source", 27015, Protocol::Valve(SteamApp::DODS)),
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,8 @@ pub mod bo;
|
||||||
pub mod ccure;
|
pub mod ccure;
|
||||||
/// Colony Survival
|
/// Colony Survival
|
||||||
pub mod cosu;
|
pub mod cosu;
|
||||||
|
/// Creativerse
|
||||||
|
pub mod creativerse;
|
||||||
/// Counter-Strike
|
/// Counter-Strike
|
||||||
pub mod cs;
|
pub mod cs;
|
||||||
/// Counter Strike: Condition Zero
|
/// Counter Strike: Condition Zero
|
||||||
|
|
|
||||||
|
|
@ -255,6 +255,8 @@ impl Request {
|
||||||
pub enum SteamApp {
|
pub enum SteamApp {
|
||||||
/// Counter-Strike
|
/// Counter-Strike
|
||||||
CS,
|
CS,
|
||||||
|
/// Creativerse
|
||||||
|
CREATIVERSE,
|
||||||
/// Team Fortress Classic
|
/// Team Fortress Classic
|
||||||
TFC,
|
TFC,
|
||||||
/// Day of Defeat
|
/// Day of Defeat
|
||||||
|
|
@ -361,6 +363,7 @@ impl SteamApp {
|
||||||
Self::INS => Engine::new_source(222_880),
|
Self::INS => Engine::new_source(222_880),
|
||||||
Self::SDTD => Engine::new_source(251_570),
|
Self::SDTD => Engine::new_source(251_570),
|
||||||
Self::RUST => Engine::new_source(252_490),
|
Self::RUST => Engine::new_source(252_490),
|
||||||
|
Self::CREATIVERSE => Engine::new_source(280_790),
|
||||||
Self::BO => Engine::new_source(296_300),
|
Self::BO => Engine::new_source(296_300),
|
||||||
Self::DST => Engine::new_source(322_320),
|
Self::DST => Engine::new_source(322_320),
|
||||||
Self::BB2 => Engine::new_source(346_330),
|
Self::BB2 => Engine::new_source(346_330),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue