[Games] Update game definitions to match node-gamedig names (#100)

* [Games] Update game definitions to match node-gamedig names

* Update game file names to match definitions

* [Games] rename minecraft definitions to better match node

* [Games] Add test that all game files match definition name

* Update SteamApp to match node names

* [Games] Update the forest to match node-GameDig#367

* Clippy fix in games test

* [Docs] Update GAMES.md with new names

* [DOCS] Update changelog
This commit is contained in:
Tom 2023-09-22 21:20:01 +00:00 committed by GitHub
parent 14c3f4525b
commit 52750fba76
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
37 changed files with 319 additions and 281 deletions

View file

@ -28,6 +28,10 @@ Generics:
- Changed `players_maximum` and `players_online` (and their functions) types from `u64` to `u32`. - Changed `players_maximum` and `players_online` (and their functions) types from `u64` to `u32`.
- Changed `score` type (and the function) of player from `u32` to `i32`. - Changed `score` type (and the function) of player from `u32` to `i32`.
Games:
- Renamed game definitions to better match node-gamedig
- Renamed game implementations to match new definition names
Protocols: Protocols:
- Valve: - Valve:
1. Renamed `protocol` to `protocol_version`. 1. Renamed `protocol` to `protocol_version`.
@ -36,6 +40,7 @@ Protocols:
4. Fixed `player`'s `score` field being `u32` when it needed to be `i32`, as specified in the protocol. 4. Fixed `player`'s `score` field being `u32` when it needed to be `i32`, as specified in the protocol.
5. Added the field `check_app_id` to `GatherSettings` which controls if the app id specified to the request and 5. Added the field `check_app_id` to `GatherSettings` which controls if the app id specified to the request and
reported by the server are the same, errors if not, enabled by default. reported by the server are the same, errors if not, enabled by default.
6. Valve: Renamed SteamApp enum variants to match new definition names
- GameSpy (1, 2, 3): - GameSpy (1, 2, 3):
1. Renamed `version` to `game_version`. 1. Renamed `version` to `game_version`.

View file

@ -6,27 +6,27 @@ Beware of the `Notes` column, as it contains information about query port offset
| 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 | SHIP | 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. |
| Counter-Strike: Source | CSS | Valve | | | Counter-Strike: Source | CSS | Valve | |
| Day of Defeat: Source | DODS | Valve | | | Day of Defeat: Source | DODS | Valve | |
| Left 4 Dead | L4D | Valve | | | Left 4 Dead | LEFT4DEAD | Valve | |
| Left 4 Dead 2 | L4D2 | Valve | | | Left 4 Dead 2 | LEFT4DEAD2 | Valve | |
| Half-Life 2 Deathmatch | HL2DM | Valve | | | Half-Life 2 Deathmatch | HL2DM | Valve | |
| Alien Swarm | ALIENS | Valve | | | Alien Swarm | ALIENSWARM | Valve | |
| Alien Swarm: Reactive Drop | ASRD | Valve | | | Alien Swarm: Reactive Drop | ASRD | Valve | |
| Insurgency | INS | Valve | | | Insurgency | INSURGENCY | Valve | |
| Insurgency: Sandstorm | INSS | Valve | Query port offset: 1. | | Insurgency: Sandstorm | INSURGENCYSANDSTORM | Valve | Query port offset: 1. |
| Insurgency: Modern Infantry Combat | INSMIC | Valve | | | Insurgency: Modern Infantry Combat | INSURGENCYMIC | Valve | |
| Counter-Strike: Condition Zero | CSCZ | Valve GoldSrc | | | Counter-Strike: Condition Zero | CSCZ | Valve GoldSrc | |
| Day of Defeat | DOD | 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. | | Minecraft | MINECRAFT | 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 | | | 7 Days To Die | SD2D | Valve | |
| ARK: Survival Evolved | ASE | Valve | | | ARK: Survival Evolved | ARKSE | Valve | |
| Unturned | UNTURNED | Valve | | | Unturned | UNTURNED | Valve | |
| The Forest | TF | Valve GoldSrc | Query port offset: 1. | | The Forest | THEFOREST | Valve GoldSrc | Query port offset: 1. |
| Team Fortress Classic | TFC | Valve | | | Team Fortress Classic | TFC | Valve | |
| Sven Co-op | SC | Valve GoldSrc | | | Sven Co-op | SVENCOOP | Valve GoldSrc | |
| Rust | RUST | Valve | | | Rust | RUST | Valve | |
| Counter-Strike | CS | Valve GoldSrc | | | Counter-Strike | CS | Valve GoldSrc | |
| Arma 2: Operation Arrowhead | ARMA2OA | Valve | Query port offset: 1. | | Arma 2: Operation Arrowhead | ARMA2OA | Valve | Query port offset: 1. |
@ -34,32 +34,33 @@ Beware of the `Notes` column, as it contains information about query port offset
| Half-Life Deathmatch: Source | HLDMS | Valve | | | Half-Life Deathmatch: Source | HLDMS | Valve | |
| Risk of Rain 2 | ROR2 | Valve | Query port offset: 1. | | 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. | | 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 | | | Black Mesa | BLACKMESA | Valve | |
| Project Zomboid | PZ | Valve | | | Project Zomboid | PRZOMBOID | Valve | |
| Age of Chivalry | AOC | Valve | | | Age of Chivalry | AGEOFCHIVALRY | Valve | |
| Don't Starve Together | DST | Valve | Query port is 27016. | | Don't Starve Together | DST | Valve | Query port is 27016. |
| Colony Survival | COLU | Valve | | | Colony Survival | COLONYSURVIVAL | Valve | |
| Onset | ONSET | Valve | Query port is 7776. | | Onset | ONSET | Valve | Query port is 7776. |
| Codename CURE | CCURE | Valve | | | Codename CURE | CODENAMECURE | Valve | |
| Ballistic Overkill | BO | Valve | Query port is 27016. | | Ballistic Overkill | BALLISTICOVERKILL | Valve | Query port is 27016. |
| BrainBread 2 | BB2 | Valve | | | BrainBread 2 | BRAINBREAD2 | Valve | |
| Avorion | AVORION | Valve | Query port is 27020. | | Avorion | AVORION | Valve | Query port is 27020. |
| Operation: Harsh Doorstop | OHD | Valve | Query port is 27005. | | Operation: Harsh Doorstop | OHD | Valve | Query port is 27005. |
| V Rising | VR | Valve | Query port is 27016. | | V Rising | VRISING | Valve | Query port is 27016. |
| Unreal Tournament | UT | GameSpy 1 | Query Port offset: 1. | | Unreal Tournament | UT | GameSpy 1 | Query Port offset: 1. |
| Battlefield 1942 | BF1942 | GameSpy 1 | Query port is 23000. | | Battlefield 1942 | BF1942 | GameSpy 1 | Query port is 23000. |
| Serious Sam | SS | GameSpy 1 | Query Port offset: 1. | | Serious Sam | SS | GameSpy 1 | Query Port offset: 1. |
| Frontlines: Fuel of War | FFOW | Valve (*Altered) | Query Port offset: 2. | | Frontlines: Fuel of War | FFOW | Valve (*Altered) | Query Port offset: 2. |
| Crysis Wars | CW | GameSpy 3 | | | Crysis Wars | CRYSISWARS | GameSpy 3 | |
| Quake 2 | QUAKE2 | Quake 2 | | | Quake 2 | QUAKE2 | Quake 2 | |
| Quake 1 | QUAKE1 | Quake 1 | | | Quake 1 | QUAKE1 | Quake 1 | |
| Quake 3: Arena | QUAKE3A | Quake 3 | | | Quake 3: Arena | QUAKE3 | 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. | | 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 | | | Soldier of Fortune 2 | SOF2 | Quake 3 | |
| 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. | | Creativerse | CREATIVERSE | Valve | Query Port offset: 1. |
| Garry's Mod | GARRYSMOD | Valve |
## Planned to add support: ## Planned to add support:
_ _

View file

@ -82,13 +82,13 @@ mod test {
fn battlefield() { test_game("bf1942"); } fn battlefield() { test_game("bf1942"); }
#[test] #[test]
fn minecraft() { test_game("mc"); } fn minecraft() { test_game("minecraft"); }
#[test] #[test]
fn tf2() { test_game("tf2"); } fn tf2() { test_game("tf2"); }
#[test] #[test]
fn quake() { test_game("quake3a"); } fn quake() { test_game("quake3"); }
#[test] #[test]
fn all_games() { fn all_games() {

View file

@ -3,61 +3,61 @@ use gamedig::protocols::valve;
use gamedig::protocols::valve::Engine; use gamedig::protocols::valve::Engine;
use gamedig::protocols::{gamespy, quake}; use gamedig::protocols::{gamespy, quake};
use gamedig::{ use gamedig::{
aliens, ageofchivalry,
aoc, alienswarm,
arkse,
arma2oa, arma2oa,
ase,
asrd, asrd,
avorion, avorion,
ballisticoverkill,
bat1944, bat1944,
bb2,
bf1942, bf1942,
bm, blackmesa,
bo, brainbread2,
ccure, codenamecure,
cosu, colonysurvival,
creativerse, creativerse,
crysiswars,
cs, cs,
cscz, cscz,
csgo, csgo,
css, css,
cw,
dod, dod,
dods, dods,
doi, doi,
dst, dst,
ffow, ffow,
gm, garrysmod,
haloce, haloce,
hl2dm, hl2dm,
hldms, hldms,
hll, hll,
ins, insurgency,
insmic, insurgencymic,
inss, insurgencysandstorm,
jc2mp, jc2mp,
l4d, left4dead,
l4d2, left4dead2,
mc, mc,
ohd, ohd,
onset, onset,
pz, przomboid,
quake1, quake1,
quake2, quake2,
quake3a, quake3,
ror2, ror2,
rust, rust,
sc, sd2d,
sdtd, ship,
sof2, sof2,
ss, ss,
tf, svencoop,
tf2, tf2,
tfc, tfc,
ts, theforest,
unturned, unturned,
ut, ut,
vr, vrising,
warsow, warsow,
GDResult, GDResult,
}; };
@ -92,20 +92,20 @@ fn main() -> GDResult<()> {
let address = &SocketAddr::new(*ip, port.unwrap_or(0)); let address = &SocketAddr::new(*ip, port.unwrap_or(0));
match args[1].as_str() { match args[1].as_str() {
"aliens" => println!("{:#?}", aliens::query(ip, port)?), "alienswarm" => println!("{:#?}", alienswarm::query(ip, port)?),
"asrd" => println!("{:#?}", asrd::query(ip, port)?), "asrd" => println!("{:#?}", asrd::query(ip, port)?),
"csgo" => println!("{:#?}", csgo::query(ip, port)?), "csgo" => println!("{:#?}", csgo::query(ip, port)?),
"css" => println!("{:#?}", css::query(ip, port)?), "css" => println!("{:#?}", css::query(ip, port)?),
"dods" => println!("{:#?}", dods::query(ip, port)?), "dods" => println!("{:#?}", dods::query(ip, port)?),
"gm" => println!("{:#?}", gm::query(ip, port)?), "garrysmod" => println!("{:#?}", garrysmod::query(ip, port)?),
"hl2dm" => println!("{:#?}", hl2dm::query(ip, port)?), "hl2dm" => println!("{:#?}", hl2dm::query(ip, port)?),
"tf2" => println!("{:#?}", tf2::query(ip, port)?), "tf2" => println!("{:#?}", tf2::query(ip, port)?),
"insmic" => println!("{:#?}", insmic::query(ip, port)?), "insurgencymic" => println!("{:#?}", insurgencymic::query(ip, port)?),
"ins" => println!("{:#?}", ins::query(ip, port)?), "insurgency" => println!("{:#?}", insurgency::query(ip, port)?),
"inss" => println!("{:#?}", inss::query(ip, port)?), "insurgencysandstorm" => println!("{:#?}", insurgencysandstorm::query(ip, port)?),
"l4d" => println!("{:#?}", l4d::query(ip, port)?), "left4dead" => println!("{:#?}", left4dead::query(ip, port)?),
"l4d2" => println!("{:#?}", l4d2::query(ip, port)?), "left4dead2" => println!("{:#?}", left4dead2::query(ip, port)?),
"ts" => println!("{:#?}", ts::query(ip, port)?), "ship" => println!("{:#?}", ship::query(ip, port)?),
"cscz" => println!("{:#?}", cscz::query(ip, port)?), "cscz" => println!("{:#?}", cscz::query(ip, port)?),
"dod" => println!("{:#?}", dod::query(ip, port)?), "dod" => println!("{:#?}", dod::query(ip, port)?),
"_src" => { "_src" => {
@ -148,12 +148,12 @@ fn main() -> GDResult<()> {
mc::query_legacy_specific(LegacyGroup::V1_6, ip, port)? mc::query_legacy_specific(LegacyGroup::V1_6, ip, port)?
) )
} }
"7dtd" => println!("{:#?}", sdtd::query(ip, port)?), "7dtd" => println!("{:#?}", sd2d::query(ip, port)?),
"ase" => println!("{:#?}", ase::query(ip, port)?), "arkse" => println!("{:#?}", arkse::query(ip, port)?),
"unturned" => println!("{:#?}", unturned::query(ip, port)?), "unturned" => println!("{:#?}", unturned::query(ip, port)?),
"tf" => println!("{:#?}", tf::query(ip, port)?), "theforest" => println!("{:#?}", theforest::query(ip, port)?),
"tfc" => println!("{:#?}", tfc::query(ip, port)?), "tfc" => println!("{:#?}", tfc::query(ip, port)?),
"sc" => println!("{:#?}", sc::query(ip, port)?), "svencoop" => println!("{:#?}", svencoop::query(ip, port)?),
"rust" => println!("{:#?}", rust::query(ip, port)?), "rust" => println!("{:#?}", rust::query(ip, port)?),
"cs" => println!("{:#?}", cs::query(ip, port)?), "cs" => println!("{:#?}", cs::query(ip, port)?),
"arma2oa" => println!("{:#?}", arma2oa::query(ip, port)?), "arma2oa" => println!("{:#?}", arma2oa::query(ip, port)?),
@ -161,18 +161,18 @@ fn main() -> GDResult<()> {
"hldms" => println!("{:#?}", hldms::query(ip, port)?), "hldms" => println!("{:#?}", hldms::query(ip, port)?),
"ror2" => println!("{:#?}", ror2::query(ip, port)?), "ror2" => println!("{:#?}", ror2::query(ip, port)?),
"bat1944" => println!("{:#?}", bat1944::query(ip, port)?), "bat1944" => println!("{:#?}", bat1944::query(ip, port)?),
"bm" => println!("{:#?}", bm::query(ip, port)?), "blackmesa" => println!("{:#?}", blackmesa::query(ip, port)?),
"pz" => println!("{:#?}", pz::query(ip, port)?), "przomboid" => println!("{:#?}", przomboid::query(ip, port)?),
"aoc" => println!("{:#?}", aoc::query(ip, port)?), "ageofchivalry" => println!("{:#?}", ageofchivalry::query(ip, port)?),
"dst" => println!("{:#?}", dst::query(ip, port)?), "dst" => println!("{:#?}", dst::query(ip, port)?),
"cosu" => println!("{:#?}", cosu::query(ip, port)?), "colonysurvival" => println!("{:#?}", colonysurvival::query(ip, port)?),
"onset" => println!("{:#?}", onset::query(ip, port)?), "onset" => println!("{:#?}", onset::query(ip, port)?),
"ccure" => println!("{:#?}", ccure::query(ip, port)?), "codenamecure" => println!("{:#?}", codenamecure::query(ip, port)?),
"bo" => println!("{:#?}", bo::query(ip, port)?), "ballisticoverkill" => println!("{:#?}", ballisticoverkill::query(ip, port)?),
"bb2" => println!("{:#?}", bb2::query(ip, port)?), "brainbread2" => println!("{:#?}", brainbread2::query(ip, port)?),
"avorion" => println!("{:#?}", avorion::query(ip, port)?), "avorion" => println!("{:#?}", avorion::query(ip, port)?),
"ohd" => println!("{:#?}", ohd::query(ip, port)?), "ohd" => println!("{:#?}", ohd::query(ip, port)?),
"vr" => println!("{:#?}", vr::query(ip, port)?), "vrising" => println!("{:#?}", vrising::query(ip, port)?),
"_gamespy1" => println!("{:#?}", gamespy::one::query(address, None)), "_gamespy1" => println!("{:#?}", gamespy::one::query(address, None)),
"_gamespy1_vars" => println!("{:#?}", gamespy::one::query_vars(address, None)), "_gamespy1_vars" => println!("{:#?}", gamespy::one::query_vars(address, None)),
"ut" => println!("{:#?}", ut::query(ip, port)), "ut" => println!("{:#?}", ut::query(ip, port)),
@ -181,13 +181,13 @@ fn main() -> GDResult<()> {
"_gamespy3" => println!("{:#?}", gamespy::three::query(address, None)), "_gamespy3" => println!("{:#?}", gamespy::three::query(address, None)),
"_gamespy3_vars" => println!("{:#?}", gamespy::three::query_vars(address, None)), "_gamespy3_vars" => println!("{:#?}", gamespy::three::query_vars(address, None)),
"ffow" => println!("{:#?}", ffow::query(ip, port)), "ffow" => println!("{:#?}", ffow::query(ip, port)),
"cw" => println!("{:#?}", cw::query(ip, port)), "crysiswars" => println!("{:#?}", crysiswars::query(ip, port)),
"_quake1" => println!("{:#?}", quake::one::query(address, None)), "_quake1" => println!("{:#?}", quake::one::query(address, None)),
"_quake2" => println!("{:#?}", quake::two::query(address, None)), "_quake2" => println!("{:#?}", quake::two::query(address, None)),
"_quake3" => println!("{:#?}", quake::three::query(address, None)), "_quake3" => println!("{:#?}", quake::three::query(address, None)),
"quake2" => println!("{:#?}", quake2::query(ip, port)?), "quake2" => println!("{:#?}", quake2::query(ip, port)?),
"quake1" => println!("{:#?}", quake1::query(ip, port)?), "quake1" => println!("{:#?}", quake1::query(ip, port)?),
"quake3a" => println!("{:#?}", quake3a::query(ip, port)?), "quake3" => println!("{:#?}", quake3::query(ip, port)?),
"hll" => println!("{:#?}", hll::query(ip, port)?), "hll" => println!("{:#?}", hll::query(ip, port)?),
"sof2" => println!("{:#?}", sof2::query(ip, port)?), "sof2" => println!("{:#?}", sof2::query(ip, port)?),
"_gamespy2" => println!("{:#?}", gamespy::two::query(address, None)), "_gamespy2" => println!("{:#?}", gamespy::two::query(address, None)),

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(27015)),
SteamApp::AGEOFCHIVALRY.as_engine(),
None,
None,
)?;
Ok(game::Response::new_from_valve_response(valve_response))
}

View file

@ -7,7 +7,7 @@ use std::net::{IpAddr, SocketAddr};
pub fn query(address: &IpAddr, port: Option<u16>) -> GDResult<game::Response> { pub fn query(address: &IpAddr, port: Option<u16>) -> GDResult<game::Response> {
let valve_response = valve::query( let valve_response = valve::query(
&SocketAddr::new(*address, port.unwrap_or(27015)), &SocketAddr::new(*address, port.unwrap_or(27015)),
SteamApp::BB2.as_engine(), SteamApp::ALIENSWARM.as_engine(),
None, None,
None, None,
)?; )?;

View file

@ -7,7 +7,7 @@ use std::net::{IpAddr, SocketAddr};
pub fn query(address: &IpAddr, port: Option<u16>) -> GDResult<game::Response> { pub fn query(address: &IpAddr, port: Option<u16>) -> GDResult<game::Response> {
let valve_response = valve::query( let valve_response = valve::query(
&SocketAddr::new(*address, port.unwrap_or(27015)), &SocketAddr::new(*address, port.unwrap_or(27015)),
SteamApp::BM.as_engine(), SteamApp::ARKSE.as_engine(),
None, None,
None, None,
)?; )?;

View file

@ -7,7 +7,7 @@ use std::net::{IpAddr, SocketAddr};
pub fn query(address: &IpAddr, port: Option<u16>) -> GDResult<game::Response> { pub fn query(address: &IpAddr, port: Option<u16>) -> GDResult<game::Response> {
let valve_response = valve::query( let valve_response = valve::query(
&SocketAddr::new(*address, port.unwrap_or(27016)), &SocketAddr::new(*address, port.unwrap_or(27016)),
SteamApp::VR.as_engine(), SteamApp::BALLISTICOVERKILL.as_engine(),
None, None,
None, None,
)?; )?;

View file

@ -7,7 +7,7 @@ use std::net::{IpAddr, SocketAddr};
pub fn query(address: &IpAddr, port: Option<u16>) -> GDResult<game::Response> { pub fn query(address: &IpAddr, port: Option<u16>) -> GDResult<game::Response> {
let valve_response = valve::query( let valve_response = valve::query(
&SocketAddr::new(*address, port.unwrap_or(27015)), &SocketAddr::new(*address, port.unwrap_or(27015)),
SteamApp::ALIENS.as_engine(), SteamApp::BLACKMESA.as_engine(),
None, None,
None, None,
)?; )?;

16
src/games/brainbread2.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(27015)),
SteamApp::BRAINBREAD2.as_engine(),
None,
None,
)?;
Ok(game::Response::new_from_valve_response(valve_response))
}

View file

@ -1,16 +0,0 @@
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(27015)),
SteamApp::CCURE.as_engine(),
None,
None,
)?;
Ok(game::Response::new_from_valve_response(valve_response))
}

16
src/games/codenamecure.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(27015)),
SteamApp::CODENAMECURE.as_engine(),
None,
None,
)?;
Ok(game::Response::new_from_valve_response(valve_response))
}

View file

@ -7,7 +7,7 @@ use std::net::{IpAddr, SocketAddr};
pub fn query(address: &IpAddr, port: Option<u16>) -> GDResult<game::Response> { pub fn query(address: &IpAddr, port: Option<u16>) -> GDResult<game::Response> {
let valve_response = valve::query( let valve_response = valve::query(
&SocketAddr::new(*address, port.unwrap_or(27004)), &SocketAddr::new(*address, port.unwrap_or(27004)),
SteamApp::COSU.as_engine(), SteamApp::COLONYSURVIVAL.as_engine(),
None, None,
None, None,
)?; )?;

View file

@ -24,65 +24,97 @@ macro_rules! game {
/// Map of all currently supported games /// Map of all currently supported games
pub static GAMES: Map<&'static str, Game> = phf_map! { pub static GAMES: Map<&'static str, Game> = phf_map! {
"mc" => game!("Minecraft", 25565, Protocol::Minecraft(None)), // Query with all minecraft protocols node-gamedig: minecraft,minecraftping
"mc-java" => game!("Minecraft (java)", 25565, Protocol::Minecraft(Some(Server::Java))), "minecraft" => game!("Minecraft", 25565, Protocol::Minecraft(None)),
"mc-bedrock" => game!("Minecraft (bedrock)", 19132, Protocol::Minecraft(Some(Server::Bedrock))), "minecraftping" => game!("Minecraft", 25565, Protocol::Minecraft(None)),
"mc-legacy-1.6" => game!("Minecraft (legacy v1.6)", 25565, Protocol::Minecraft(Some(Server::Legacy(LegacyGroup::V1_6)))), // Query with specific minecraft protocols
"mc-legacy-1.4" => game!("Minecraft (legacy v1.4-1.5)", 25565, Protocol::Minecraft(Some(Server::Legacy(LegacyGroup::V1_4)))), "minecraftbe" => game!("Minecraft (bedrock)", 19132, Protocol::Minecraft(Some(Server::Bedrock))),
"mc-legacy-b1.8" => game!("Minecraft (legacy vB1.8-1.3)", 25565, Protocol::Minecraft(Some(Server::Legacy(LegacyGroup::VB1_8)))), "minecraftpe" => game!("Minecraft (bedrock/pocket edition)", 19132, Protocol::Minecraft(Some(Server::Bedrock))),
"aliens" => game!("Alien Swarm", 27015, Protocol::Valve(SteamApp::ALIENS)), "minecraftjava" => game!("Minecraft (java)", 25565, Protocol::Minecraft(Some(Server::Java))),
"aoc" => game!("Age of Chivalry", 27015, Protocol::Valve(SteamApp::AOC)), "minecraft-legacy-1.6" => game!("Minecraft (legacy v1.6)", 25565, Protocol::Minecraft(Some(Server::Legacy(LegacyGroup::V1_6)))),
"minecraft-legacy-1.4" => game!("Minecraft (legacy v1.4-1.5)", 25565, Protocol::Minecraft(Some(Server::Legacy(LegacyGroup::V1_4)))),
"minecraft-legacy-b1.8" => game!("Minecraft (legacy vB1.8-1.3)", 25565, Protocol::Minecraft(Some(Server::Legacy(LegacyGroup::VB1_8)))),
"alienswarm" => game!("Alien Swarm", 27015, Protocol::Valve(SteamApp::ALIENSWARM)),
"ageofchivalry" => game!("Age of Chivalry", 27015, Protocol::Valve(SteamApp::AGEOFCHIVALRY)),
"arma2oa" => game!("ARMA 2: Operation Arrowhead", 2304, Protocol::Valve(SteamApp::ARMA2OA)), "arma2oa" => game!("ARMA 2: Operation Arrowhead", 2304, Protocol::Valve(SteamApp::ARMA2OA)),
"ase" => game!("ARK: Survival Evolved", 27015, Protocol::Valve(SteamApp::ASE)), "arkse" => game!("ARK: Survival Evolved", 27015, Protocol::Valve(SteamApp::ARKSE)),
"asrd" => game!("Alien Swarm: Reactive Drop", 2304, Protocol::Valve(SteamApp::ASRD)), "asrd" => game!("Alien Swarm: Reactive Drop", 2304, Protocol::Valve(SteamApp::ASRD)),
"avorion" => game!("Avorion", 27020, Protocol::Valve(SteamApp::AVORION)), "avorion" => game!("Avorion", 27020, Protocol::Valve(SteamApp::AVORION)),
"bat1944" => game!("Battalion 1944", 7780, Protocol::Valve(SteamApp::BAT1944)), "bat1944" => game!("Battalion 1944", 7780, Protocol::Valve(SteamApp::BAT1944)),
"bb2" => game!("BrainBread 2", 27015, Protocol::Valve(SteamApp::BB2)), "brainbread2" => game!("BrainBread 2", 27015, Protocol::Valve(SteamApp::BRAINBREAD2)),
"bf1942" => game!("Battlefield 1942", 23000, Protocol::Gamespy(GameSpyVersion::One)), "bf1942" => game!("Battlefield 1942", 23000, Protocol::Gamespy(GameSpyVersion::One)),
"bm" => game!("Black Mesa", 27015, Protocol::Valve(SteamApp::BM)), "blackmesa" => game!("Black Mesa", 27015, Protocol::Valve(SteamApp::BLACKMESA)),
"bo" => game!("Ballistic Overkill", 27016, Protocol::Valve(SteamApp::BO)), "ballisticoverkill" => game!("Ballistic Overkill", 27016, Protocol::Valve(SteamApp::BALLISTICOVERKILL)),
"ccure" => game!("Codename CURE", 27015, Protocol::Valve(SteamApp::CCURE)), "codenamecure" => game!("Codename CURE", 27015, Protocol::Valve(SteamApp::CODENAMECURE)),
"cosu" => game!("Colony Survival", 27004, Protocol::Valve(SteamApp::COSU)), "colonysurvival" => game!("Colony Survival", 27004, Protocol::Valve(SteamApp::COLONYSURVIVAL)),
"cs" => game!("Counter-Strike", 27015, Protocol::Valve(SteamApp::CS)), "cs" => game!("Counter-Strike", 27015, Protocol::Valve(SteamApp::CS)),
"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)), "creativerse" => game!("Creativerse", 26901, Protocol::Valve(SteamApp::CREATIVERSE)),
"cw" => game!("Crysis Wars", 64100, Protocol::Gamespy(GameSpyVersion::Three)), "crysiswars" => 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)),
"doi" => game!("Day of Infamy", 27015, Protocol::Valve(SteamApp::DOI)), "doi" => game!("Day of Infamy", 27015, Protocol::Valve(SteamApp::DOI)),
"dst" => game!("Don't Starve Together", 27016, Protocol::Valve(SteamApp::DST)), "dst" => game!("Don't Starve Together", 27016, Protocol::Valve(SteamApp::DST)),
"ffow" => game!("Frontlines: Fuel of War", 5478, Protocol::PROPRIETARY(ProprietaryProtocol::FFOW)), "ffow" => game!("Frontlines: Fuel of War", 5478, Protocol::PROPRIETARY(ProprietaryProtocol::FFOW)),
"gm" => game!("Garry's Mod", 27016, Protocol::Valve(SteamApp::GM)), "garrysmod" => game!("Garry's Mod", 27016, Protocol::Valve(SteamApp::GARRYSMOD)),
"hl2dm" => game!("Half-Life 2 Deathmatch", 27015, Protocol::Valve(SteamApp::HL2DM)), "hl2dm" => game!("Half-Life 2 Deathmatch", 27015, Protocol::Valve(SteamApp::HL2DM)),
"haloce" => game!("Halo: Combat Evolved", 2302, Protocol::Gamespy(GameSpyVersion::Two)), "haloce" => game!("Halo: Combat Evolved", 2302, Protocol::Gamespy(GameSpyVersion::Two)),
"hldms" => game!("Half-Life Deathmatch: Source", 27015, Protocol::Valve(SteamApp::HLDMS)), "hldms" => game!("Half-Life Deathmatch: Source", 27015, Protocol::Valve(SteamApp::HLDMS)),
"hll" => game!("Hell Let Loose", 26420, Protocol::Valve(SteamApp::HLL)), "hll" => game!("Hell Let Loose", 26420, Protocol::Valve(SteamApp::HLL)),
"ins" => game!("Insurgency", 27015, Protocol::Valve(SteamApp::INS)), "insurgency" => game!("Insurgency", 27015, Protocol::Valve(SteamApp::INSURGENCY)),
"insmic" => game!("Insurgency: Modern Infantry Combat", 27015, Protocol::Valve(SteamApp::INSMIC)), "insurgencymic" => game!("Insurgency: Modern Infantry Combat", 27015, Protocol::Valve(SteamApp::INSURGENCYMIC)),
"inss" => game!("Insurgency: Sandstorm", 27131, Protocol::Valve(SteamApp::INSS)), "insurgencysandstorm" => game!("Insurgency: Sandstorm", 27131, Protocol::Valve(SteamApp::INSURGENCYSANDSTORM)),
"l4d" => game!("Left 4 Dead", 27015, Protocol::Valve(SteamApp::L4D)), "left4dead" => game!("Left 4 Dead", 27015, Protocol::Valve(SteamApp::LEFT4DEAD)),
"l4d2" => game!("Left 4 Dead 2", 27015, Protocol::Valve(SteamApp::L4D2)), "left4dead2" => game!("Left 4 Dead 2", 27015, Protocol::Valve(SteamApp::LEFT4DEAD2)),
"ohd" => game!("Operation: Harsh Doorstop", 27005, Protocol::Valve(SteamApp::OHD)), "ohd" => game!("Operation: Harsh Doorstop", 27005, Protocol::Valve(SteamApp::OHD)),
"onset" => game!("Onset", 7776, Protocol::Valve(SteamApp::ONSET)), "onset" => game!("Onset", 7776, Protocol::Valve(SteamApp::ONSET)),
"pz" => game!("Project Zomboid", 16261, Protocol::Valve(SteamApp::PZ)), "przomboid" => game!("Project Zomboid", 16261, Protocol::Valve(SteamApp::PRZOMBOID)),
"quake1" => game!("Quake 1", 27500, Protocol::Quake(QuakeVersion::One)), "quake1" => game!("Quake 1", 27500, Protocol::Quake(QuakeVersion::One)),
"quake2" => game!("Quake 2", 27910, Protocol::Quake(QuakeVersion::Two)), "quake2" => game!("Quake 2", 27910, Protocol::Quake(QuakeVersion::Two)),
"quake3a" => game!("Quake 3: Arena", 27960, Protocol::Quake(QuakeVersion::Three)), "quake3" => game!("Quake 3: Arena", 27960, Protocol::Quake(QuakeVersion::Three)),
"ror2" => game!("Risk of Rain 2", 27016, Protocol::Valve(SteamApp::ROR2)), "ror2" => game!("Risk of Rain 2", 27016, Protocol::Valve(SteamApp::ROR2)),
"rust" => game!("Rust", 27015, Protocol::Valve(SteamApp::RUST)), "rust" => game!("Rust", 27015, Protocol::Valve(SteamApp::RUST)),
"sc" => game!("Sven Co-op", 27015, Protocol::Valve(SteamApp::SC)), "svencoop" => game!("Sven Co-op", 27015, Protocol::Valve(SteamApp::SVEENCOOP)),
"sdtd" => game!("7 Days To Die", 26900, Protocol::Valve(SteamApp::SDTD)), "7d2d" => game!("7 Days To Die", 26900, Protocol::Valve(SteamApp::SD2D)),
"sof2" => game!("Soldier of Fortune 2", 20100, Protocol::Quake(QuakeVersion::Three)), "sof2" => game!("Soldier of Fortune 2", 20100, Protocol::Quake(QuakeVersion::Three)),
"ss" => game!("Serious Sam", 25601, Protocol::Gamespy(GameSpyVersion::One)), "ss" => game!("Serious Sam", 25601, Protocol::Gamespy(GameSpyVersion::One)),
"tf" => game!("The Forest", 27016, Protocol::Valve(SteamApp::TF)), "theforest" => game!("The Forest", 27016, Protocol::Valve(SteamApp::THEFOREST)),
"tf2" => game!("Team Fortress 2", 27015, Protocol::Valve(SteamApp::TF2)), "tf2" => game!("Team Fortress 2", 27015, Protocol::Valve(SteamApp::TF2)),
"tfc" => game!("Team Fortress Classic", 27015, Protocol::Valve(SteamApp::TFC)), "tfc" => game!("Team Fortress Classic", 27015, Protocol::Valve(SteamApp::TFC)),
"ts" => game!("The Ship", 27015, Protocol::PROPRIETARY(ProprietaryProtocol::TheShip)), "ship" => game!("The Ship", 27015, Protocol::PROPRIETARY(ProprietaryProtocol::TheShip)),
"unturned" => game!("Unturned", 27015, Protocol::Valve(SteamApp::UNTURNED)), "unturned" => game!("Unturned", 27015, Protocol::Valve(SteamApp::UNTURNED)),
"ut" => game!("Unreal Tournament", 7778, Protocol::Gamespy(GameSpyVersion::One)), "ut" => game!("Unreal Tournament", 7778, Protocol::Gamespy(GameSpyVersion::One)),
"vr" => game!("V Rising", 27016, Protocol::Valve(SteamApp::VR)), "vrising" => game!("V Rising", 27016, Protocol::Valve(SteamApp::VRISING)),
"jc2mp" => game!("Just Cause 2: Multiplayer", 7777, Protocol::PROPRIETARY(ProprietaryProtocol::JC2MP)), "jc2mp" => game!("Just Cause 2: Multiplayer", 7777, Protocol::PROPRIETARY(ProprietaryProtocol::JC2MP)),
"warsow" => game!("Warsow", 44400, Protocol::Quake(QuakeVersion::Three)), "warsow" => game!("Warsow", 44400, Protocol::Quake(QuakeVersion::Three)),
}; };
#[cfg(test)]
mod test {
use super::GAMES;
use std::fs;
#[test]
fn check_game_files_match_defs() {
let ignore = [
"mod", // Module file
"definitions", // This file
"mc", // Has various defs
"sd2d", // Module names cannot start with numbers
];
for file in fs::read_dir("./src/games/").unwrap() {
let file = file.unwrap();
let metadata = file.metadata().unwrap();
if metadata.is_file() {
if let Some(file_name) = file.file_name().into_string().unwrap().strip_suffix(".rs") {
if !ignore.contains(&file_name) && !GAMES.contains_key(file_name) {
panic!("Expected GAMES to contain a definition to match {file_name}");
}
}
}
}
}
}

View file

@ -7,7 +7,7 @@ use std::net::{IpAddr, SocketAddr};
pub fn query(address: &IpAddr, port: Option<u16>) -> GDResult<game::Response> { pub fn query(address: &IpAddr, port: Option<u16>) -> GDResult<game::Response> {
let valve_response = valve::query( let valve_response = valve::query(
&SocketAddr::new(*address, port.unwrap_or(27016)), &SocketAddr::new(*address, port.unwrap_or(27016)),
SteamApp::GM.as_engine(), SteamApp::GARRYSMOD.as_engine(),
None, None,
None, None,
)?; )?;

View file

@ -1,16 +0,0 @@
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(27015)),
SteamApp::INS.as_engine(),
None,
None,
)?;
Ok(game::Response::new_from_valve_response(valve_response))
}

View file

@ -1,16 +0,0 @@
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(27015)),
SteamApp::INSMIC.as_engine(),
None,
None,
)?;
Ok(game::Response::new_from_valve_response(valve_response))
}

16
src/games/insurgency.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(27015)),
SteamApp::INSURGENCY.as_engine(),
None,
None,
)?;
Ok(game::Response::new_from_valve_response(valve_response))
}

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(27015)),
SteamApp::INSURGENCYMIC.as_engine(),
None,
None,
)?;
Ok(game::Response::new_from_valve_response(valve_response))
}

View file

@ -7,7 +7,7 @@ use std::net::{IpAddr, SocketAddr};
pub fn query(address: &IpAddr, port: Option<u16>) -> GDResult<game::Response> { pub fn query(address: &IpAddr, port: Option<u16>) -> GDResult<game::Response> {
let valve_response = valve::query( let valve_response = valve::query(
&SocketAddr::new(*address, port.unwrap_or(27131)), &SocketAddr::new(*address, port.unwrap_or(27131)),
SteamApp::INSS.as_engine(), SteamApp::INSURGENCYSANDSTORM.as_engine(),
None, None,
None, None,
)?; )?;

View file

@ -1,16 +0,0 @@
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(27015)),
SteamApp::L4D.as_engine(),
None,
None,
)?;
Ok(game::Response::new_from_valve_response(valve_response))
}

View file

@ -1,16 +0,0 @@
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(27015)),
SteamApp::L4D2.as_engine(),
None,
None,
)?;
Ok(game::Response::new_from_valve_response(valve_response))
}

View file

@ -7,7 +7,7 @@ use std::net::{IpAddr, SocketAddr};
pub fn query(address: &IpAddr, port: Option<u16>) -> GDResult<game::Response> { pub fn query(address: &IpAddr, port: Option<u16>) -> GDResult<game::Response> {
let valve_response = valve::query( let valve_response = valve::query(
&SocketAddr::new(*address, port.unwrap_or(27015)), &SocketAddr::new(*address, port.unwrap_or(27015)),
SteamApp::AOC.as_engine(), SteamApp::LEFT4DEAD.as_engine(),
None, None,
None, None,
)?; )?;

16
src/games/left4dead2.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(27015)),
SteamApp::LEFT4DEAD2.as_engine(),
None,
None,
)?;
Ok(game::Response::new_from_valve_response(valve_response))
}

View file

@ -3,34 +3,36 @@
#[cfg(feature = "serde")] #[cfg(feature = "serde")]
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
/// Alien Swarm
pub mod aliens;
/// Age of Chivalry /// Age of Chivalry
pub mod aoc; pub mod ageofchivalry;
/// Alien Swarm
pub mod alienswarm;
/// ARK: Survival Evolved
pub mod arkse;
/// ARMA 2: Operation Arrowhead /// ARMA 2: Operation Arrowhead
pub mod arma2oa; pub mod arma2oa;
/// ARK: Survival Evolved
pub mod ase;
/// Alien Swarm: Reactive Drop /// Alien Swarm: Reactive Drop
pub mod asrd; pub mod asrd;
/// Avorion /// Avorion
pub mod avorion; pub mod avorion;
/// Ballistic Overkill
pub mod ballisticoverkill;
/// Battalion 1944 /// Battalion 1944
pub mod bat1944; pub mod bat1944;
/// BrainBread 2
pub mod bb2;
/// Battlefield 1942 /// Battlefield 1942
pub mod bf1942; pub mod bf1942;
/// Black Mesa /// Black Mesa
pub mod bm; pub mod blackmesa;
/// Ballistic Overkill /// BrainBread 2
pub mod bo; pub mod brainbread2;
/// Codename CURE /// Codename CURE
pub mod ccure; pub mod codenamecure;
/// Colony Survival /// Colony Survival
pub mod cosu; pub mod colonysurvival;
/// Creativerse /// Creativerse
pub mod creativerse; pub mod creativerse;
/// Crysis Wars
pub mod crysiswars;
/// Counter-Strike /// Counter-Strike
pub mod cs; pub mod cs;
/// Counter Strike: Condition Zero /// Counter Strike: Condition Zero
@ -39,8 +41,6 @@ pub mod cscz;
pub mod csgo; pub mod csgo;
/// Counter-Strike: Source /// Counter-Strike: Source
pub mod css; pub mod css;
/// Crysis Wars
pub mod cw;
/// Day of Defeat /// Day of Defeat
pub mod dod; pub mod dod;
/// Day of Defeat: Source /// Day of Defeat: Source
@ -52,7 +52,7 @@ pub mod dst;
/// Frontlines: Fuel of War /// Frontlines: Fuel of War
pub mod ffow; pub mod ffow;
/// Garry's Mod /// Garry's Mod
pub mod gm; pub mod garrysmod;
/// Halo: Combat Evolved /// Halo: Combat Evolved
pub mod haloce; pub mod haloce;
/// Half-Life 2 Deathmatch /// Half-Life 2 Deathmatch
@ -62,17 +62,17 @@ pub mod hldms;
/// Hell Let Loose /// Hell Let Loose
pub mod hll; pub mod hll;
/// Insurgency /// Insurgency
pub mod ins; pub mod insurgency;
/// Insurgency: Modern Infantry Combat /// Insurgency: Modern Infantry Combat
pub mod insmic; pub mod insurgencymic;
/// Insurgency: Sandstorm /// Insurgency: Sandstorm
pub mod inss; pub mod insurgencysandstorm;
/// Just Cause 2: Multiplayer /// Just Cause 2: Multiplayer
pub mod jc2mp; pub mod jc2mp;
/// Left 4 Dead /// Left 4 Dead
pub mod l4d; pub mod left4dead;
/// Left 4 Dead 2 /// Left 4 Dead 2
pub mod l4d2; pub mod left4dead2;
/// Minecraft /// Minecraft
pub mod mc; pub mod mc;
/// Operation: Harsh Doorstop /// Operation: Harsh Doorstop
@ -80,39 +80,39 @@ pub mod ohd;
/// Onset /// Onset
pub mod onset; pub mod onset;
/// Project Zomboid /// Project Zomboid
pub mod pz; pub mod przomboid;
/// Quake 1 /// Quake 1
pub mod quake1; pub mod quake1;
/// Quake 2 /// Quake 2
pub mod quake2; pub mod quake2;
/// Quake 3: Arena /// Quake 3: Arena
pub mod quake3a; pub mod quake3;
/// Risk of Rain 2 /// Risk of Rain 2
pub mod ror2; pub mod ror2;
/// Rust /// Rust
pub mod rust; pub mod rust;
/// Sven Co-op
pub mod sc;
/// 7 Days To Die /// 7 Days To Die
pub mod sdtd; pub mod sd2d;
/// The Ship
pub mod ship;
/// Soldier of Fortune 2 /// Soldier of Fortune 2
pub mod sof2; pub mod sof2;
/// Serious Sam /// Serious Sam
pub mod ss; pub mod ss;
/// The Forest /// Sven Co-op
pub mod tf; pub mod svencoop;
/// Team Fortress 2 /// Team Fortress 2
pub mod tf2; pub mod tf2;
/// Team Fortress Classic /// Team Fortress Classic
pub mod tfc; pub mod tfc;
/// The Ship /// The Forest
pub mod ts; pub mod theforest;
/// Unturned /// Unturned
pub mod unturned; pub mod unturned;
/// Unreal Tournament /// Unreal Tournament
pub mod ut; pub mod ut;
/// V Rising /// V Rising
pub mod vr; pub mod vrising;
/// Warsow /// Warsow
pub mod warsow; pub mod warsow;
@ -222,7 +222,7 @@ pub fn query_with_timeout_and_extra_settings(
Protocol::PROPRIETARY(protocol) => { Protocol::PROPRIETARY(protocol) => {
match protocol { match protocol {
ProprietaryProtocol::TheShip => { ProprietaryProtocol::TheShip => {
ts::query_with_timeout(address, port, timeout_settings).map(Box::new)? ship::query_with_timeout(address, port, timeout_settings).map(Box::new)?
} }
ProprietaryProtocol::FFOW => ffow::query_with_timeout(address, port, timeout_settings).map(Box::new)?, ProprietaryProtocol::FFOW => ffow::query_with_timeout(address, port, timeout_settings).map(Box::new)?,
ProprietaryProtocol::JC2MP => { ProprietaryProtocol::JC2MP => {

View file

@ -7,7 +7,7 @@ use std::net::{IpAddr, SocketAddr};
pub fn query(address: &IpAddr, port: Option<u16>) -> GDResult<game::Response> { pub fn query(address: &IpAddr, port: Option<u16>) -> GDResult<game::Response> {
let valve_response = valve::query( let valve_response = valve::query(
&SocketAddr::new(*address, port.unwrap_or(16261)), &SocketAddr::new(*address, port.unwrap_or(16261)),
SteamApp::PZ.as_engine(), SteamApp::PRZOMBOID.as_engine(),
None, None,
None, None,
)?; )?;

View file

@ -1,16 +0,0 @@
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(27015)),
SteamApp::SC.as_engine(),
None,
None,
)?;
Ok(game::Response::new_from_valve_response(valve_response))
}

View file

@ -7,7 +7,7 @@ use std::net::{IpAddr, SocketAddr};
pub fn query(address: &IpAddr, port: Option<u16>) -> GDResult<game::Response> { pub fn query(address: &IpAddr, port: Option<u16>) -> GDResult<game::Response> {
let valve_response = valve::query( let valve_response = valve::query(
&SocketAddr::new(*address, port.unwrap_or(26900)), &SocketAddr::new(*address, port.unwrap_or(26900)),
SteamApp::SDTD.as_engine(), SteamApp::SD2D.as_engine(),
None, None,
None, None,
)?; )?;

View file

@ -136,7 +136,7 @@ pub fn query_with_timeout(
) -> GDResult<Response> { ) -> GDResult<Response> {
let valve_response = valve::query( let valve_response = valve::query(
&SocketAddr::new(*address, port.unwrap_or(27015)), &SocketAddr::new(*address, port.unwrap_or(27015)),
SteamApp::TS.as_engine(), SteamApp::SHIP.as_engine(),
None, None,
timeout_settings, timeout_settings,
)?; )?;

View file

@ -7,7 +7,7 @@ use std::net::{IpAddr, SocketAddr};
pub fn query(address: &IpAddr, port: Option<u16>) -> GDResult<game::Response> { pub fn query(address: &IpAddr, port: Option<u16>) -> GDResult<game::Response> {
let valve_response = valve::query( let valve_response = valve::query(
&SocketAddr::new(*address, port.unwrap_or(27015)), &SocketAddr::new(*address, port.unwrap_or(27015)),
SteamApp::ASE.as_engine(), SteamApp::SVEENCOOP.as_engine(),
None, None,
None, None,
)?; )?;

View file

@ -7,7 +7,7 @@ use std::net::{IpAddr, SocketAddr};
pub fn query(address: &IpAddr, port: Option<u16>) -> GDResult<game::Response> { pub fn query(address: &IpAddr, port: Option<u16>) -> GDResult<game::Response> {
let valve_response = valve::query( let valve_response = valve::query(
&SocketAddr::new(*address, port.unwrap_or(27016)), &SocketAddr::new(*address, port.unwrap_or(27016)),
SteamApp::TF.as_engine(), SteamApp::THEFOREST.as_engine(),
None, None,
None, None,
)?; )?;

View file

@ -7,7 +7,7 @@ use std::net::{IpAddr, SocketAddr};
pub fn query(address: &IpAddr, port: Option<u16>) -> GDResult<game::Response> { pub fn query(address: &IpAddr, port: Option<u16>) -> GDResult<game::Response> {
let valve_response = valve::query( let valve_response = valve::query(
&SocketAddr::new(*address, port.unwrap_or(27016)), &SocketAddr::new(*address, port.unwrap_or(27016)),
SteamApp::BO.as_engine(), SteamApp::VRISING.as_engine(),
None, None,
None, None,
)?; )?;

View file

@ -36,7 +36,7 @@ pub enum GenericResponse<'a> {
Quake(quake::VersionedResponse<'a>), Quake(quake::VersionedResponse<'a>),
Valve(&'a valve::Response), Valve(&'a valve::Response),
#[cfg(feature = "games")] #[cfg(feature = "games")]
TheShip(&'a crate::games::ts::Response), TheShip(&'a crate::games::ship::Response),
#[cfg(feature = "games")] #[cfg(feature = "games")]
FFOW(&'a crate::games::ffow::Response), FFOW(&'a crate::games::ffow::Response),
#[cfg(feature = "games")] #[cfg(feature = "games")]
@ -52,7 +52,7 @@ pub enum GenericPlayer<'a> {
Minecraft(&'a minecraft::Player), Minecraft(&'a minecraft::Player),
Gamespy(gamespy::VersionedPlayer<'a>), Gamespy(gamespy::VersionedPlayer<'a>),
#[cfg(feature = "games")] #[cfg(feature = "games")]
TheShip(&'a crate::games::ts::TheShipPlayer), TheShip(&'a crate::games::ship::TheShipPlayer),
#[cfg(feature = "games")] #[cfg(feature = "games")]
JCMP2(&'a crate::games::jc2mp::Player), JCMP2(&'a crate::games::jc2mp::Player),
} }

View file

@ -282,7 +282,7 @@ impl ValveProtocol {
let environment_type = Environment::from_gldsrc(buffer.read()?)?; let environment_type = Environment::from_gldsrc(buffer.read()?)?;
let has_password = buffer.read::<u8>()? == 1; let has_password = buffer.read::<u8>()? == 1;
let vac_secured = buffer.read::<u8>()? == 1; let vac_secured = buffer.read::<u8>()? == 1;
let the_ship = match *engine == SteamApp::TS.as_engine() { let the_ship = match *engine == SteamApp::SHIP.as_engine() {
false => None, false => None,
true => { true => {
Some(TheShip { Some(TheShip {
@ -367,11 +367,11 @@ impl ValveProtocol {
name: buffer.read_string::<Utf8Decoder>(None)?, name: buffer.read_string::<Utf8Decoder>(None)?,
score: buffer.read()?, score: buffer.read()?,
duration: buffer.read()?, duration: buffer.read()?,
deaths: match *engine == SteamApp::TS.as_engine() { deaths: match *engine == SteamApp::SHIP.as_engine() {
false => None, false => None,
true => Some(buffer.read()?), true => Some(buffer.read()?),
}, },
money: match *engine == SteamApp::TS.as_engine() { money: match *engine == SteamApp::SHIP.as_engine() {
false => None, false => None,
true => Some(buffer.read()?), true => Some(buffer.read()?),
}, },

View file

@ -274,59 +274,59 @@ pub enum SteamApp {
/// Team Fortress 2 /// Team Fortress 2
TF2, TF2,
/// Left 4 Dead /// Left 4 Dead
L4D, LEFT4DEAD,
/// Left 4 Dead /// Left 4 Dead
L4D2, LEFT4DEAD2,
/// Alien Swarm /// Alien Swarm
ALIENS, ALIENSWARM,
/// Counter-Strike: Global Offensive /// Counter-Strike: Global Offensive
CSGO, CSGO,
/// The Ship /// The Ship
TS, SHIP,
/// Garry's Mod /// Garry's Mod
GM, GARRYSMOD,
/// Age of Chivalry /// Age of Chivalry
AOC, AGEOFCHIVALRY,
/// Insurgency: Modern Infantry Combat /// Insurgency: Modern Infantry Combat
INSMIC, INSURGENCYMIC,
/// ARMA 2: Operation Arrowhead /// ARMA 2: Operation Arrowhead
ARMA2OA, ARMA2OA,
/// Project Zomboid /// Project Zomboid
PZ, PRZOMBOID,
/// Insurgency /// Insurgency
INS, INSURGENCY,
/// Sven Co-op /// Sven Co-op
SC, SVEENCOOP,
/// 7 Days To Die /// 7 Days To Die
SDTD, SD2D,
/// Rust /// Rust
RUST, RUST,
/// Vallistic Overkill /// Vallistic Overkill
BO, BALLISTICOVERKILL,
/// Don't Starve Together /// Don't Starve Together
DST, DST,
/// BrainBread 2 /// BrainBread 2
BB2, BRAINBREAD2,
/// Codename CURE /// Codename CURE
CCURE, CODENAMECURE,
/// Black Mesa /// Black Mesa
BM, BLACKMESA,
/// Colony Survival /// Colony Survival
COSU, COLONYSURVIVAL,
/// Avorion /// Avorion
AVORION, AVORION,
/// Day of Infamy /// Day of Infamy
DOI, DOI,
/// The Forest /// The Forest
TF, THEFOREST,
/// Unturned /// Unturned
UNTURNED, UNTURNED,
/// ARK: Survival Evolved /// ARK: Survival Evolved
ASE, ARKSE,
/// Battalion 1944 /// Battalion 1944
BAT1944, BAT1944,
/// Insurgency: Sandstorm /// Insurgency: Sandstorm
INSS, INSURGENCYSANDSTORM,
/// Alien Swarm: Reactive Drop /// Alien Swarm: Reactive Drop
ASRD, ASRD,
/// Risk of Rain 2 /// Risk of Rain 2
@ -336,7 +336,7 @@ pub enum SteamApp {
/// Onset /// Onset
ONSET, ONSET,
/// V Rising /// V Rising
VR, VRISING,
/// Hell Let Loose /// Hell Let Loose
HLL, HLL,
} }
@ -350,38 +350,38 @@ impl SteamApp {
Self::HL2DM => Engine::new_source(320), Self::HL2DM => Engine::new_source(320),
Self::HLDMS => Engine::new_source(360), Self::HLDMS => Engine::new_source(360),
Self::TF2 => Engine::new_source(440), Self::TF2 => Engine::new_source(440),
Self::L4D => Engine::new_source(500), Self::LEFT4DEAD => Engine::new_source(500),
Self::L4D2 => Engine::new_source(550), Self::LEFT4DEAD2 => Engine::new_source(550),
Self::ALIENS => Engine::new_source(630), Self::ALIENSWARM => Engine::new_source(630),
Self::CSGO => Engine::new_source(730), Self::CSGO => Engine::new_source(730),
Self::TS => Engine::new_source(2400), Self::SHIP => Engine::new_source(2400),
Self::GM => Engine::new_source(4000), Self::GARRYSMOD => Engine::new_source(4000),
Self::AOC => Engine::new_source(17510), Self::AGEOFCHIVALRY => Engine::new_source(17510),
Self::INSMIC => Engine::new_source(17700), Self::INSURGENCYMIC => Engine::new_source(17700),
Self::ARMA2OA => Engine::new_source(33930), Self::ARMA2OA => Engine::new_source(33930),
Self::PZ => Engine::new_source(108_600), Self::PRZOMBOID => Engine::new_source(108_600),
Self::INS => Engine::new_source(222_880), Self::INSURGENCY => Engine::new_source(222_880),
Self::SDTD => Engine::new_source(251_570), Self::SD2D => 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::CREATIVERSE => Engine::new_source(280_790),
Self::BO => Engine::new_source(296_300), Self::BALLISTICOVERKILL => 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::BRAINBREAD2 => Engine::new_source(346_330),
Self::CCURE => Engine::new_source(355_180), Self::CODENAMECURE => Engine::new_source(355_180),
Self::BM => Engine::new_source(362_890), Self::BLACKMESA => Engine::new_source(362_890),
Self::COSU => Engine::new_source(366_090), Self::COLONYSURVIVAL => Engine::new_source(366_090),
Self::AVORION => Engine::new_source(445_220), Self::AVORION => Engine::new_source(445_220),
Self::DOI => Engine::new_source(447_820), Self::DOI => Engine::new_source(447_820),
Self::TF => Engine::new_source(556_450), Self::THEFOREST => Engine::new_source(556_450),
Self::UNTURNED => Engine::new_source(304_930), Self::UNTURNED => Engine::new_source(304_930),
Self::ASE => Engine::new_source(346_110), Self::ARKSE => Engine::new_source(346_110),
Self::BAT1944 => Engine::new_source(489_940), Self::BAT1944 => Engine::new_source(489_940),
Self::INSS => Engine::new_source(581_320), Self::INSURGENCYSANDSTORM => Engine::new_source(581_320),
Self::ASRD => Engine::new_source(563_560), Self::ASRD => Engine::new_source(563_560),
Self::ROR2 => Engine::new_source(632_360), Self::ROR2 => Engine::new_source(632_360),
Self::OHD => Engine::new_source_with_dedicated(736_590, 950_900), Self::OHD => Engine::new_source_with_dedicated(736_590, 950_900),
Self::ONSET => Engine::new_source(1_105_810), Self::ONSET => Engine::new_source(1_105_810),
Self::VR => Engine::new_source(1_604_030), Self::VRISING => Engine::new_source(1_604_030),
Self::HLL => Engine::new_source(686_810), Self::HLL => Engine::new_source(686_810),
_ => Engine::GoldSrc(false), // CS - 10, TFC - 20, DOD - 30, CSCZ - 80, SC - 225840 _ => Engine::GoldSrc(false), // CS - 10, TFC - 20, DOD - 30, CSCZ - 80, SC - 225840
} }