[Game] Apply new id naming (#114)

* Apply new id naming

* Fix failing CI on all features

* Update changelog

* Rename tf2 example to teamfortress2

* Fix typo in steamapp game names

* Rename minecraft legacy versions

* Apply CI node badge fix by Douile

* Add/Update badge

---------

Co-authored-by: GitHub Action <action@github.com>
This commit is contained in:
CosminPerRam 2023-10-06 17:20:30 +03:00 committed by GitHub
parent b4c61781fb
commit 5280ecb3c6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
38 changed files with 231 additions and 232 deletions

View file

@ -1,5 +1,5 @@
<svg width="163.6" height="20" viewBox="0 0 1636 200" xmlns="http://www.w3.org/2000/svg" role="img" aria-label="Node game coverage: 17%"> <svg width="163.6" height="20" viewBox="0 0 1636 200" xmlns="http://www.w3.org/2000/svg" role="img" aria-label="Node game coverage: 12%">
<title>Node game coverage: 17%</title> <title>Node game coverage: 12%</title>
<linearGradient id="a" x2="0" y2="100%"> <linearGradient id="a" x2="0" y2="100%">
<stop offset="0" stop-opacity=".1" stop-color="#EEE"/> <stop offset="0" stop-opacity=".1" stop-color="#EEE"/>
<stop offset="1" stop-opacity=".1"/> <stop offset="1" stop-opacity=".1"/>
@ -13,8 +13,8 @@
<g aria-hidden="true" fill="#fff" text-anchor="start" font-family="Verdana,DejaVu Sans,sans-serif" font-size="110"> <g aria-hidden="true" fill="#fff" text-anchor="start" font-family="Verdana,DejaVu Sans,sans-serif" font-size="110">
<text x="60" y="148" textLength="1176" fill="#000" opacity="0.25">Node game coverage</text> <text x="60" y="148" textLength="1176" fill="#000" opacity="0.25">Node game coverage</text>
<text x="50" y="138" textLength="1176">Node game coverage</text> <text x="50" y="138" textLength="1176">Node game coverage</text>
<text x="1331" y="148" textLength="260" fill="#000" opacity="0.25">17%</text> <text x="1331" y="148" textLength="260" fill="#000" opacity="0.25">12%</text>
<text x="1321" y="138" textLength="260">17%</text> <text x="1321" y="138" textLength="260">12%</text>
</g> </g>
</svg> </svg>

Before

Width:  |  Height:  |  Size: 1 KiB

After

Width:  |  Height:  |  Size: 1 KiB

Before After
Before After

View file

@ -33,8 +33,7 @@ Generics:
- 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: Games:
- Renamed game definitions to better match node-gamedig (subject to change again in the next release). (by @Douile) - Rename some game definitions and implementations to follow a stable ID naming system.
- Renamed game implementations to match new definition names. (by @Douile)
Protocols: Protocols:
- Valve: - Valve:
@ -64,6 +63,8 @@ reported by the server are the same, errors if not, enabled by default. (by @Dou
3. Renamed `players_sample` to `players`. 3. Renamed `players_sample` to `players`.
4. Added an optional parameter, `RequestSettings`, which contains fields that are used when creating the handshake 4. Added an optional parameter, `RequestSettings`, which contains fields that are used when creating the handshake
packet (this solves some servers not responding to the query). (by @Douile) packet (this solves some servers not responding to the query). (by @Douile)
5. Legacy versions naming has been changed to represent up to what version they can query, `LegacyBV1_8` (Beta 1.8 to
1.3) -> `LegacyV1_3` and `LegacyV1_4` (1.4 to 1.5) -> `LegacyV1_5` (and their enums accordingly).
- Minecraft Bedrock - Minecraft Bedrock
1. Renamed `version_protocol` to `protocol_version`. 1. Renamed `version_protocol` to `protocol_version`.

View file

@ -4,39 +4,39 @@ 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 | TEAMFORTRESS2 | Valve | |
| The Ship | SHIP | Valve (*Altered) | | | The Ship | THESHIP | 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 | LEFT4DEAD | Valve | | | Left 4 Dead | LEFT4DEAD | Valve | |
| Left 4 Dead 2 | LEFT4DEAD2 | Valve | | | Left 4 Dead 2 | LEFT4DEAD2 | Valve | |
| Half-Life 2 Deathmatch | HL2DM | Valve | | | Half-Life 2 Deathmatch | HL2D | Valve | |
| Alien Swarm | ALIENSWARM | Valve | | | Alien Swarm | ALIENSWARM | Valve | |
| Alien Swarm: Reactive Drop | ASRD | Valve | | | Alien Swarm: Reactive Drop | ASRD | Valve | |
| Insurgency | INSURGENCY | Valve | | | Insurgency | INSURGENCY | Valve | |
| Insurgency: Sandstorm | INSURGENCYSANDSTORM | Valve | Query port offset: 1. | | Insurgency: Sandstorm | INSURGENCYSANDSTORM | Valve | Query port offset: 1. |
| Insurgency: Modern Infantry Combat | INSURGENCYMIC | Valve | | | Insurgency: Modern Infantry Combat | IMIC | 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 | 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. | | 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 | SD2D | Valve | | | 7 Days To Die | SD2D | Valve | |
| ARK: Survival Evolved | ARKSE | Valve | | | ARK: Survival Evolved | ASE | Valve | |
| Unturned | UNTURNED | Valve | | | Unturned | UNTURNED | Valve | |
| The Forest | THEFOREST | 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 | SVENCOOP | Valve GoldSrc | | | Sven Co-op | SCO | Valve GoldSrc | |
| Rust | RUST | Valve | | | Rust | RUST | Valve | |
| Counter-Strike | CS | Valve GoldSrc | | | Counter-Strike | COUNTERSTRIKE | Valve GoldSrc | |
| Arma 2: Operation Arrowhead | ARMA2OA | Valve | Query port offset: 1. | | Arma 2: Operation Arrowhead | A2OA | Valve | Query port offset: 1. |
| Day of Infamy | DOI | Valve | | | Day of Infamy | DOI | Valve | |
| Half-Life Deathmatch: Source | HLDMS | Valve | | | Half-Life Deathmatch: Source | HLDS | 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 | BATTALION1944 | Valve | Query port offset: 3. It is strongly recommended to also query the rules, as it sends basic server info in them. |
| Black Mesa | BLACKMESA | Valve | | | Black Mesa | BLACKMESA | Valve | |
| Project Zomboid | PRZOMBOID | Valve | | | Project Zomboid | PROJECTZOMBOID | Valve | |
| Age of Chivalry | AGEOFCHIVALRY | Valve | | | Age of Chivalry | AOC | Valve | |
| Don't Starve Together | DST | Valve | Query port is 27016. | | Don't Starve Together | DST | Valve | Query port is 27016. |
| Colony Survival | COLONYSURVIVAL | Valve | | | Colony Survival | COLONYSURVIVAL | Valve | |
| Onset | ONSET | Valve | Query port is 7776. | | Onset | ONSET | Valve | Query port is 7776. |
@ -46,9 +46,9 @@ Beware of the `Notes` column, as it contains information about query port offset
| 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 | VRISING | Valve | Query port is 27016. | | V Rising | VRISING | Valve | Query port is 27016. |
| Unreal Tournament | UT | GameSpy 1 | Query Port offset: 1. | | Unreal Tournament | UNREALTOURNAMENT | GameSpy 1 | Query Port offset: 1. |
| Battlefield 1942 | BF1942 | GameSpy 1 | Query port is 23000. | | Battlefield 1942 | B1942 | GameSpy 1 | Query port is 23000. |
| Serious Sam | SS | GameSpy 1 | Query Port offset: 1. | | Serious Sam | SERIOUSSAM | 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 | CRYSISWARS | GameSpy 3 | | | Crysis Wars | CRYSISWARS | GameSpy 3 | |
| Quake 2 | QUAKE2 | Quake 2 | | | Quake 2 | QUAKE2 | Quake 2 | |
@ -56,11 +56,11 @@ Beware of the `Notes` column, as it contains information about query port offset
| Quake 3: Arena | QUAKE3 | 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 | HCE | GameSpy 2 | |
| Just Cause 2: Multiplayer | JC2MP | GameSpy 3 (*Altered) | | | Just Cause 2: Multiplayer | JC2M | 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 | | Garry's Mod | GARRYSMOD | Valve | |
## Planned to add support: ## Planned to add support:
_ _

View file

@ -40,10 +40,10 @@ Pick a game/service/protocol (check the [GAMES](GAMES.md), [SERVICES](SERVICES.m
[Team Fortress 2](https://store.steampowered.com/app/440/Team_Fortress_2/) query example: [Team Fortress 2](https://store.steampowered.com/app/440/Team_Fortress_2/) query example:
```rust ```rust
use gamedig::games::tf2; use gamedig::games::teamfortress2;
fn main() { fn main() {
let response = tf2::query(&"127.0.0.1".parse().unwrap(), None); let response = teamfortress2::query(&"127.0.0.1".parse().unwrap(), None);
// None is the default port (which is 27015), could also be Some(27015) // None is the default port (which is 27015), could also be Some(27015)
match response { // Result type, must check what it is... match response { // Result type, must check what it is...

View file

@ -99,13 +99,13 @@ mod test {
} }
#[test] #[test]
fn battlefield() { test_game("bf1942"); } fn battlefield1942() { test_game("battlefield1942"); }
#[test] #[test]
fn minecraft() { test_game("minecraft"); } fn minecraft() { test_game("minecraft"); }
#[test] #[test]
fn tf2() { test_game("tf2"); } fn teamfortress2() { test_game("teamfortress2"); }
#[test] #[test]
fn quake() { test_game("quake3"); } fn quake() { test_game("quake3"); }

View file

@ -1,10 +1,10 @@
use gamedig::games::mc; use gamedig::games::minecraft;
use gamedig::protocols::minecraft::RequestSettings; use gamedig::protocols::minecraft::RequestSettings;
fn main() { fn main() {
// or Some(<port>), None is the default protocol port (which is 25565 for java // or Some(<port>), None is the default protocol port (which is 25565 for java
// and 19132 for bedrock) // and 19132 for bedrock)
let response = mc::query(&"127.0.0.1".parse().unwrap(), None); let response = minecraft::query(&"127.0.0.1".parse().unwrap(), None);
// This will fail if no server is available locally! // This will fail if no server is available locally!
match response { match response {
@ -15,7 +15,7 @@ fn main() {
// This is an example to query a server with a hostname to be specified in the // This is an example to query a server with a hostname to be specified in the
// packet. Passing -1 on the protocol_version means anything, note that // packet. Passing -1 on the protocol_version means anything, note that
// an invalid value here might result in server not responding. // an invalid value here might result in server not responding.
let response = mc::query_java( let response = minecraft::query_java(
&"209.222.114.62".parse().unwrap(), &"209.222.114.62".parse().unwrap(),
Some(25565), Some(25565),
Some(RequestSettings { Some(RequestSettings {

View file

@ -1,7 +1,7 @@
use gamedig::games::tf2; use gamedig::games::teamfortress2;
fn main() { fn main() {
let response = tf2::query(&"127.0.0.1".parse().unwrap(), None); let response = teamfortress2::query(&"127.0.0.1".parse().unwrap(), None);
// or Some(27015), None is the default protocol port (which is 27015) // or Some(27015), None is the default protocol port (which is 27015)
match response { match 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(2304)), &SocketAddr::new(*address, port.unwrap_or(2304)),
SteamApp::ARMA2OA.as_engine(), SteamApp::A2OA.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::CS.as_engine(), SteamApp::AOC.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::TF2.as_engine(), SteamApp::ASE.as_engine(),
None, None,
None, None,
)?; )?;

View file

@ -8,7 +8,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 mut valve_response = valve::query( let mut valve_response = valve::query(
&SocketAddr::new(*address, port.unwrap_or(7780)), &SocketAddr::new(*address, port.unwrap_or(7780)),
SteamApp::BAT1944.as_engine(), SteamApp::BATTALION1944.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::AGEOFCHIVALRY.as_engine(), SteamApp::COUNTERSTRIKE.as_engine(),
None, None,
None, None,
)?; )?;

View file

@ -28,26 +28,26 @@ pub static GAMES: Map<&'static str, Game> = phf_map! {
"minecraft" => game!("Minecraft", 25565, Protocol::Minecraft(None)), "minecraft" => game!("Minecraft", 25565, Protocol::Minecraft(None)),
"minecraftping" => game!("Minecraft", 25565, Protocol::Minecraft(None)), "minecraftping" => game!("Minecraft", 25565, Protocol::Minecraft(None)),
// Query with specific minecraft protocols // Query with specific minecraft protocols
"minecraftbe" => game!("Minecraft (bedrock)", 19132, Protocol::Minecraft(Some(Server::Bedrock))), "minecraftbedrock" => game!("Minecraft (bedrock)", 19132, Protocol::Minecraft(Some(Server::Bedrock))),
"minecraftpe" => game!("Minecraft (bedrock/pocket edition)", 19132, Protocol::Minecraft(Some(Server::Bedrock))), "minecraftpocket" => game!("Minecraft (bedrock/pocket edition)", 19132, Protocol::Minecraft(Some(Server::Bedrock))),
"minecraftjava" => game!("Minecraft (java)", 25565, Protocol::Minecraft(Some(Server::Java))), "minecraftjava" => game!("Minecraft (java)", 25565, Protocol::Minecraft(Some(Server::Java))),
"minecraft-legacy-1.6" => game!("Minecraft (legacy v1.6)", 25565, Protocol::Minecraft(Some(Server::Legacy(LegacyGroup::V1_6)))), "minecraftlegacy16" => 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)))), "minecraftlegacy15" => game!("Minecraft (legacy v1.4-1.5)", 25565, Protocol::Minecraft(Some(Server::Legacy(LegacyGroup::V1_5)))),
"minecraft-legacy-b1.8" => game!("Minecraft (legacy vB1.8-1.3)", 25565, Protocol::Minecraft(Some(Server::Legacy(LegacyGroup::VB1_8)))), "minecraftlegacy13" => game!("Minecraft (legacy vB1.8-1.3)", 25565, Protocol::Minecraft(Some(Server::Legacy(LegacyGroup::V1_3)))),
"alienswarm" => game!("Alien Swarm", 27015, Protocol::Valve(SteamApp::ALIENSWARM)), "alienswarm" => game!("Alien Swarm", 27015, Protocol::Valve(SteamApp::ALIENSWARM)),
"ageofchivalry" => game!("Age of Chivalry", 27015, Protocol::Valve(SteamApp::AGEOFCHIVALRY)), "aoc" => game!("Age of Chivalry", 27015, Protocol::Valve(SteamApp::AOC)),
"arma2oa" => game!("ARMA 2: Operation Arrowhead", 2304, Protocol::Valve(SteamApp::ARMA2OA)), "a2oa" => game!("ARMA 2: Operation Arrowhead", 2304, Protocol::Valve(SteamApp::A2OA)),
"arkse" => game!("ARK: Survival Evolved", 27015, Protocol::Valve(SteamApp::ARKSE)), "ase" => game!("ARK: Survival Evolved", 27015, Protocol::Valve(SteamApp::ASE)),
"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)), "battalion1944" => game!("Battalion 1944", 7780, Protocol::Valve(SteamApp::BATTALION1944)),
"brainbread2" => game!("BrainBread 2", 27015, Protocol::Valve(SteamApp::BRAINBREAD2)), "brainbread2" => game!("BrainBread 2", 27015, Protocol::Valve(SteamApp::BRAINBREAD2)),
"bf1942" => game!("Battlefield 1942", 23000, Protocol::Gamespy(GameSpyVersion::One)), "battlefield1942" => game!("Battlefield 1942", 23000, Protocol::Gamespy(GameSpyVersion::One)),
"blackmesa" => game!("Black Mesa", 27015, Protocol::Valve(SteamApp::BLACKMESA)), "blackmesa" => game!("Black Mesa", 27015, Protocol::Valve(SteamApp::BLACKMESA)),
"ballisticoverkill" => game!("Ballistic Overkill", 27016, Protocol::Valve(SteamApp::BALLISTICOVERKILL)), "ballisticoverkill" => game!("Ballistic Overkill", 27016, Protocol::Valve(SteamApp::BALLISTICOVERKILL)),
"codenamecure" => game!("Codename CURE", 27015, Protocol::Valve(SteamApp::CODENAMECURE)), "codenamecure" => game!("Codename CURE", 27015, Protocol::Valve(SteamApp::CODENAMECURE)),
"colonysurvival" => game!("Colony Survival", 27004, Protocol::Valve(SteamApp::COLONYSURVIVAL)), "colonysurvival" => game!("Colony Survival", 27004, Protocol::Valve(SteamApp::COLONYSURVIVAL)),
"cs" => game!("Counter-Strike", 27015, Protocol::Valve(SteamApp::CS)), "counterstrike" => game!("Counter-Strike", 27015, Protocol::Valve(SteamApp::COUNTERSTRIKE)),
"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)),
@ -59,35 +59,35 @@ pub static GAMES: Map<&'static str, Game> = phf_map! {
"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)),
"garrysmod" => game!("Garry's Mod", 27016, Protocol::Valve(SteamApp::GARRYSMOD)), "garrysmod" => game!("Garry's Mod", 27016, Protocol::Valve(SteamApp::GARRYSMOD)),
"hl2dm" => game!("Half-Life 2 Deathmatch", 27015, Protocol::Valve(SteamApp::HL2DM)), "hl2d" => game!("Half-Life 2 Deathmatch", 27015, Protocol::Valve(SteamApp::HL2D)),
"haloce" => game!("Halo: Combat Evolved", 2302, Protocol::Gamespy(GameSpyVersion::Two)), "hce" => game!("Halo: Combat Evolved", 2302, Protocol::Gamespy(GameSpyVersion::Two)),
"hldms" => game!("Half-Life Deathmatch: Source", 27015, Protocol::Valve(SteamApp::HLDMS)), "hlds" => game!("Half-Life Deathmatch: Source", 27015, Protocol::Valve(SteamApp::HLDS)),
"hll" => game!("Hell Let Loose", 26420, Protocol::Valve(SteamApp::HLL)), "hll" => game!("Hell Let Loose", 26420, Protocol::Valve(SteamApp::HLL)),
"insurgency" => game!("Insurgency", 27015, Protocol::Valve(SteamApp::INSURGENCY)), "insurgency" => game!("Insurgency", 27015, Protocol::Valve(SteamApp::INSURGENCY)),
"insurgencymic" => game!("Insurgency: Modern Infantry Combat", 27015, Protocol::Valve(SteamApp::INSURGENCYMIC)), "imic" => game!("Insurgency: Modern Infantry Combat", 27015, Protocol::Valve(SteamApp::IMIC)),
"insurgencysandstorm" => game!("Insurgency: Sandstorm", 27131, Protocol::Valve(SteamApp::INSURGENCYSANDSTORM)), "insurgencysandstorm" => game!("Insurgency: Sandstorm", 27131, Protocol::Valve(SteamApp::INSURGENCYSANDSTORM)),
"left4dead" => game!("Left 4 Dead", 27015, Protocol::Valve(SteamApp::LEFT4DEAD)), "left4dead" => game!("Left 4 Dead", 27015, Protocol::Valve(SteamApp::LEFT4DEAD)),
"left4dead2" => game!("Left 4 Dead 2", 27015, Protocol::Valve(SteamApp::LEFT4DEAD2)), "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)),
"przomboid" => game!("Project Zomboid", 16261, Protocol::Valve(SteamApp::PRZOMBOID)), "projectzomboid" => game!("Project Zomboid", 16261, Protocol::Valve(SteamApp::PROJECTZOMBOID)),
"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)),
"quake3" => 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)),
"svencoop" => game!("Sven Co-op", 27015, Protocol::Valve(SteamApp::SVEENCOOP)), "sco" => game!("Sven Co-op", 27015, Protocol::Valve(SteamApp::SCO)),
"7d2d" => game!("7 Days To Die", 26900, Protocol::Valve(SteamApp::SD2D)), "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)), "serioussam" => game!("Serious Sam", 25601, Protocol::Gamespy(GameSpyVersion::One)),
"theforest" => game!("The Forest", 27016, Protocol::Valve(SteamApp::THEFOREST)), "theforest" => game!("The Forest", 27016, Protocol::Valve(SteamApp::THEFOREST)),
"tf2" => game!("Team Fortress 2", 27015, Protocol::Valve(SteamApp::TF2)), "teamfortress2" => game!("Team Fortress 2", 27015, Protocol::Valve(SteamApp::TEAMFORTRESS2)),
"tfc" => game!("Team Fortress Classic", 27015, Protocol::Valve(SteamApp::TFC)), "tfc" => game!("Team Fortress Classic", 27015, Protocol::Valve(SteamApp::TFC)),
"ship" => game!("The Ship", 27015, Protocol::PROPRIETARY(ProprietaryProtocol::TheShip)), "theship" => 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)), "unrealtournament" => game!("Unreal Tournament", 7778, Protocol::Gamespy(GameSpyVersion::One)),
"vrising" => game!("V Rising", 27016, Protocol::Valve(SteamApp::VRISING)), "vrising" => game!("V Rising", 27016, Protocol::Valve(SteamApp::VRISING)),
"jc2mp" => game!("Just Cause 2: Multiplayer", 7777, Protocol::PROPRIETARY(ProprietaryProtocol::JC2MP)), "jc2m" => game!("Just Cause 2: Multiplayer", 7777, Protocol::PROPRIETARY(ProprietaryProtocol::JC2M)),
"warsow" => game!("Warsow", 44400, Protocol::Quake(QuakeVersion::Three)), "warsow" => game!("Warsow", 44400, Protocol::Quake(QuakeVersion::Three)),
}; };
@ -101,7 +101,7 @@ mod test {
let ignore = [ let ignore = [
"mod", // Module file "mod", // Module file
"definitions", // This file "definitions", // This file
"mc", // Has various defs "minecraft", // Has various defs
"sd2d", // Module names cannot start with numbers "sd2d", // Module names cannot start with numbers
]; ];

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::ARKSE.as_engine(), SteamApp::HL2D.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::HLDMS.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::HL2DM.as_engine(), SteamApp::HLDS.as_engine(),
None, None,
None, None,
)?; )?;

16
src/games/imic.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::IMIC.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::INSURGENCYMIC.as_engine(),
None,
None,
)?;
Ok(game::Response::new_from_valve_response(valve_response))
}

View file

@ -37,7 +37,7 @@ pub struct Response {
} }
impl CommonResponse for Response { impl CommonResponse for Response {
fn as_original(&self) -> GenericResponse { GenericResponse::JC2MP(self) } fn as_original(&self) -> GenericResponse { GenericResponse::JC2M(self) }
fn game_version(&self) -> Option<&str> { Some(&self.game_version) } fn game_version(&self) -> Option<&str> { Some(&self.game_version) }
fn description(&self) -> Option<&str> { Some(&self.description) } fn description(&self) -> Option<&str> { Some(&self.description) }

View file

@ -3,14 +3,14 @@
#[cfg(feature = "serde")] #[cfg(feature = "serde")]
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
/// Age of Chivalry /// ARMA 2: Operation Arrowhead
pub mod ageofchivalry; pub mod a2oa;
/// Alien Swarm /// Alien Swarm
pub mod alienswarm; pub mod alienswarm;
/// Age of Chivalry
pub mod aoc;
/// ARK: Survival Evolved /// ARK: Survival Evolved
pub mod arkse; pub mod ase;
/// ARMA 2: Operation Arrowhead
pub mod arma2oa;
/// Alien Swarm: Reactive Drop /// Alien Swarm: Reactive Drop
pub mod asrd; pub mod asrd;
/// Avorion /// Avorion
@ -18,9 +18,9 @@ pub mod avorion;
/// Ballistic Overkill /// Ballistic Overkill
pub mod ballisticoverkill; pub mod ballisticoverkill;
/// Battalion 1944 /// Battalion 1944
pub mod bat1944; pub mod battalion1944;
/// Battlefield 1942 /// Battlefield 1942
pub mod bf1942; pub mod battlefield1942;
/// Black Mesa /// Black Mesa
pub mod blackmesa; pub mod blackmesa;
/// BrainBread 2 /// BrainBread 2
@ -29,12 +29,12 @@ pub mod brainbread2;
pub mod codenamecure; pub mod codenamecure;
/// Colony Survival /// Colony Survival
pub mod colonysurvival; pub mod colonysurvival;
/// Counter-Strike
pub mod counterstrike;
/// Creativerse /// Creativerse
pub mod creativerse; pub mod creativerse;
/// Crysis Wars /// Crysis Wars
pub mod crysiswars; pub mod crysiswars;
/// Counter-Strike
pub mod cs;
/// Counter Strike: Condition Zero /// Counter Strike: Condition Zero
pub mod cscz; pub mod cscz;
/// Counter-Strike: Global Offensive /// Counter-Strike: Global Offensive
@ -54,33 +54,33 @@ pub mod ffow;
/// Garry's Mod /// Garry's Mod
pub mod garrysmod; pub mod garrysmod;
/// Halo: Combat Evolved /// Halo: Combat Evolved
pub mod haloce; pub mod hce;
/// Half-Life 2 Deathmatch /// Half-Life 2 Deathmatch
pub mod hl2dm; pub mod hl2d;
/// Half-Life Deathmatch: Source /// Half-Life Deathmatch: Source
pub mod hldms; pub mod hlds;
/// Hell Let Loose /// Hell Let Loose
pub mod hll; pub mod hll;
/// Insurgency: Modern Infantry Combat
pub mod imic;
/// Insurgency /// Insurgency
pub mod insurgency; pub mod insurgency;
/// Insurgency: Modern Infantry Combat
pub mod insurgencymic;
/// Insurgency: Sandstorm /// Insurgency: Sandstorm
pub mod insurgencysandstorm; pub mod insurgencysandstorm;
/// Just Cause 2: Multiplayer /// Just Cause 2: Multiplayer
pub mod jc2mp; pub mod jc2m;
/// Left 4 Dead /// Left 4 Dead
pub mod left4dead; pub mod left4dead;
/// Left 4 Dead 2 /// Left 4 Dead 2
pub mod left4dead2; pub mod left4dead2;
/// Minecraft /// Minecraft
pub mod mc; pub mod minecraft;
/// Operation: Harsh Doorstop /// Operation: Harsh Doorstop
pub mod ohd; pub mod ohd;
/// Onset /// Onset
pub mod onset; pub mod onset;
/// Project Zomboid /// Project Zomboid
pub mod przomboid; pub mod projectzomboid;
/// Quake 1 /// Quake 1
pub mod quake1; pub mod quake1;
/// Quake 2 /// Quake 2
@ -91,26 +91,26 @@ pub mod quake3;
pub mod ror2; pub mod ror2;
/// Rust /// Rust
pub mod rust; pub mod rust;
/// Sven Co-op
pub mod sco;
/// 7 Days To Die /// 7 Days To Die
pub mod sd2d; pub mod sd2d;
/// The Ship /// Serious Sam
pub mod ship; pub mod serioussam;
/// Soldier of Fortune 2 /// Soldier of Fortune 2
pub mod sof2; pub mod sof2;
/// Serious Sam
pub mod ss;
/// Sven Co-op
pub mod svencoop;
/// Team Fortress 2 /// Team Fortress 2
pub mod tf2; pub mod teamfortress2;
/// Team Fortress Classic /// Team Fortress Classic
pub mod tfc; pub mod tfc;
/// The Forest /// The Forest
pub mod theforest; pub mod theforest;
/// The Ship
pub mod theship;
/// Unreal Tournament
pub mod unrealtournament;
/// Unturned /// Unturned
pub mod unturned; pub mod unturned;
/// Unreal Tournament
pub mod ut;
/// V Rising /// V Rising
pub mod vrising; pub mod vrising;
/// Warsow /// Warsow
@ -222,12 +222,10 @@ pub fn query_with_timeout_and_extra_settings(
Protocol::PROPRIETARY(protocol) => { Protocol::PROPRIETARY(protocol) => {
match protocol { match protocol {
ProprietaryProtocol::TheShip => { ProprietaryProtocol::TheShip => {
ship::query_with_timeout(address, port, timeout_settings).map(Box::new)? theship::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::JC2M => jc2m::query_with_timeout(address, port, timeout_settings).map(Box::new)?,
jc2mp::query_with_timeout(address, port, timeout_settings).map(Box::new)?
}
} }
} }
}) })

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::PRZOMBOID.as_engine(), SteamApp::PROJECTZOMBOID.as_engine(),
None, None,
None, None,
)?; )?;

16
src/games/sco.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::SCO.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::SVEENCOOP.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::TEAMFORTRESS2.as_engine(),
None,
None,
)?;
Ok(game::Response::new_from_valve_response(valve_response))
}

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::SHIP.as_engine(), SteamApp::THESHIP.as_engine(),
None, None,
timeout_settings, timeout_settings,
)?; )?;

View file

@ -4,9 +4,9 @@
//! //!
//! ## For a specific game //! ## For a specific game
//! ``` //! ```
//! use gamedig::games::tf2; //! use gamedig::games::teamfortress2;
//! //!
//! let response = tf2::query(&"127.0.0.1".parse().unwrap(), None); // None is the default port (which is 27015), could also be Some(27015) //! let response = teamfortress2::query(&"127.0.0.1".parse().unwrap(), None); // None is the default port (which is 27015), could also be Some(27015)
//! match response { // Result type, must check what it is... //! match response { // Result type, must check what it is...
//! Err(error) => println!("Couldn't query, error: {}", error), //! Err(error) => println!("Couldn't query, error: {}", error),
//! Ok(r) => println!("{:#?}", r) //! Ok(r) => println!("{:#?}", r)
@ -17,7 +17,7 @@
//! ``` //! ```
//! use gamedig::games::{GAMES, query}; //! use gamedig::games::{GAMES, query};
//! //!
//! let game = GAMES.get("tf2").unwrap(); // Get a game definition, the full list can be found in src/games/mod.rs //! let game = GAMES.get("teamfortress2").unwrap(); // Get a game definition, the full list can be found in src/games/mod.rs
//! let response = query(game, &"127.0.0.1".parse().unwrap(), None); // None will use the default port //! let response = query(game, &"127.0.0.1".parse().unwrap(), None); // None will use the default port
//! match response { //! match response {
//! Err(error) => println!("Couldn't query, error: {}", error), //! Err(error) => println!("Couldn't query, error: {}", error),

View file

@ -14,12 +14,12 @@ use std::net::SocketAddr;
use byteorder::BigEndian; use byteorder::BigEndian;
pub struct LegacyBV1_8 { pub struct LegacyV1_3 {
socket: TcpSocket, socket: TcpSocket,
retry_count: usize, retry_count: usize,
} }
impl LegacyBV1_8 { impl LegacyV1_3 {
fn new(address: &SocketAddr, timeout_settings: Option<TimeoutSettings>) -> GDResult<Self> { fn new(address: &SocketAddr, timeout_settings: Option<TimeoutSettings>) -> GDResult<Self> {
let socket = TcpSocket::new(address)?; let socket = TcpSocket::new(address)?;
socket.apply_timeout(&timeout_settings)?; socket.apply_timeout(&timeout_settings)?;
@ -72,7 +72,7 @@ impl LegacyBV1_8 {
favicon: None, favicon: None,
previews_chat: None, previews_chat: None,
enforces_secure_chat: None, enforces_secure_chat: None,
server_type: Server::Legacy(LegacyGroup::VB1_8), server_type: Server::Legacy(LegacyGroup::V1_3),
}) })
} }

View file

@ -13,12 +13,12 @@ use crate::{
}; };
use std::net::SocketAddr; use std::net::SocketAddr;
pub struct LegacyV1_4 { pub struct LegacyV1_5 {
socket: TcpSocket, socket: TcpSocket,
retry_count: usize, retry_count: usize,
} }
impl LegacyV1_4 { impl LegacyV1_5 {
fn new(address: &SocketAddr, timeout_settings: Option<TimeoutSettings>) -> GDResult<Self> { fn new(address: &SocketAddr, timeout_settings: Option<TimeoutSettings>) -> GDResult<Self> {
let socket = TcpSocket::new(address)?; let socket = TcpSocket::new(address)?;
socket.apply_timeout(&timeout_settings)?; socket.apply_timeout(&timeout_settings)?;
@ -75,7 +75,7 @@ impl LegacyV1_4 {
favicon: None, favicon: None,
previews_chat: None, previews_chat: None,
enforces_secure_chat: None, enforces_secure_chat: None,
server_type: Server::Legacy(LegacyGroup::V1_4), server_type: Server::Legacy(LegacyGroup::V1_5),
}) })
} }

View file

@ -4,8 +4,8 @@ use crate::{
protocol::{ protocol::{
bedrock::Bedrock, bedrock::Bedrock,
java::Java, java::Java,
legacy_bv1_8::LegacyBV1_8, legacy_v1_3::LegacyV1_3,
legacy_v1_4::LegacyV1_4, legacy_v1_5::LegacyV1_5,
legacy_v1_6::LegacyV1_6, legacy_v1_6::LegacyV1_6,
}, },
BedrockResponse, BedrockResponse,
@ -20,8 +20,8 @@ use std::net::SocketAddr;
mod bedrock; mod bedrock;
mod java; mod java;
mod legacy_bv1_8; mod legacy_v1_3;
mod legacy_v1_4; mod legacy_v1_5;
mod legacy_v1_6; mod legacy_v1_6;
/// Queries a Minecraft server with all the protocol variants one by one (Java /// Queries a Minecraft server with all the protocol variants one by one (Java
@ -61,11 +61,11 @@ pub fn query_legacy(address: &SocketAddr, timeout_settings: Option<TimeoutSettin
return Ok(response); return Ok(response);
} }
if let Ok(response) = query_legacy_specific(LegacyGroup::V1_4, address, timeout_settings.clone()) { if let Ok(response) = query_legacy_specific(LegacyGroup::V1_5, address, timeout_settings.clone()) {
return Ok(response); return Ok(response);
} }
if let Ok(response) = query_legacy_specific(LegacyGroup::VB1_8, address, timeout_settings) { if let Ok(response) = query_legacy_specific(LegacyGroup::V1_3, address, timeout_settings) {
return Ok(response); return Ok(response);
} }
@ -80,8 +80,8 @@ pub fn query_legacy_specific(
) -> GDResult<JavaResponse> { ) -> GDResult<JavaResponse> {
match group { match group {
LegacyGroup::V1_6 => LegacyV1_6::query(address, timeout_settings), LegacyGroup::V1_6 => LegacyV1_6::query(address, timeout_settings),
LegacyGroup::V1_4 => LegacyV1_4::query(address, timeout_settings), LegacyGroup::V1_5 => LegacyV1_5::query(address, timeout_settings),
LegacyGroup::VB1_8 => LegacyBV1_8::query(address, timeout_settings), LegacyGroup::V1_3 => LegacyV1_3::query(address, timeout_settings),
} }
} }

View file

@ -35,9 +35,9 @@ pub enum LegacyGroup {
/// 1.6 /// 1.6
V1_6, V1_6,
/// 1.4 - 1.5 /// 1.4 - 1.5
V1_4, V1_5,
/// Beta 1.8 - 1.3 /// Beta 1.8 - 1.3
VB1_8, V1_3,
} }
/// Information about a player. /// Information about a player.

View file

@ -13,7 +13,7 @@ use serde::{Deserialize, Serialize};
pub enum ProprietaryProtocol { pub enum ProprietaryProtocol {
TheShip, TheShip,
FFOW, FFOW,
JC2MP, JC2M,
} }
/// Enumeration of all valid protocol types /// Enumeration of all valid protocol types
@ -36,11 +36,11 @@ 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::ship::Response), TheShip(&'a crate::games::theship::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")]
JC2MP(&'a crate::games::jc2mp::Response), JC2M(&'a crate::games::jc2m::Response),
} }
/// All player types /// All player types
@ -52,9 +52,9 @@ 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::ship::TheShipPlayer), TheShip(&'a crate::games::theship::TheShipPlayer),
#[cfg(feature = "games")] #[cfg(feature = "games")]
JCMP2(&'a crate::games::jc2mp::Player), JCMP2(&'a crate::games::jc2m::Player),
} }
pub trait CommonResponse { pub trait CommonResponse {

View file

@ -304,7 +304,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::SHIP.as_engine() { let the_ship = match *engine == SteamApp::THESHIP.as_engine() {
false => None, false => None,
true => { true => {
Some(TheShip { Some(TheShip {
@ -389,11 +389,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::SHIP.as_engine() { deaths: match *engine == SteamApp::THESHIP.as_engine() {
false => None, false => None,
true => Some(buffer.read()?), true => Some(buffer.read()?),
}, },
money: match *engine == SteamApp::SHIP.as_engine() { money: match *engine == SteamApp::THESHIP.as_engine() {
false => None, false => None,
true => Some(buffer.read()?), true => Some(buffer.read()?),
}, },

View file

@ -254,7 +254,7 @@ impl Request {
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord)] #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub enum SteamApp { pub enum SteamApp {
/// Counter-Strike /// Counter-Strike
CS, COUNTERSTRIKE,
/// Creativerse /// Creativerse
CREATIVERSE, CREATIVERSE,
/// Team Fortress Classic /// Team Fortress Classic
@ -268,11 +268,11 @@ pub enum SteamApp {
/// Day of Defeat: Source /// Day of Defeat: Source
DODS, DODS,
/// Half-Life 2 Deathmatch /// Half-Life 2 Deathmatch
HL2DM, HL2D,
/// Half-Life Deathmatch: Source /// Half-Life Deathmatch: Source
HLDMS, HLDS,
/// Team Fortress 2 /// Team Fortress 2
TF2, TEAMFORTRESS2,
/// Left 4 Dead /// Left 4 Dead
LEFT4DEAD, LEFT4DEAD,
/// Left 4 Dead /// Left 4 Dead
@ -282,26 +282,26 @@ pub enum SteamApp {
/// Counter-Strike: Global Offensive /// Counter-Strike: Global Offensive
CSGO, CSGO,
/// The Ship /// The Ship
SHIP, THESHIP,
/// Garry's Mod /// Garry's Mod
GARRYSMOD, GARRYSMOD,
/// Age of Chivalry /// Age of Chivalry
AGEOFCHIVALRY, AOC,
/// Insurgency: Modern Infantry Combat /// Insurgency: Modern Infantry Combat
INSURGENCYMIC, IMIC,
/// ARMA 2: Operation Arrowhead /// ARMA 2: Operation Arrowhead
ARMA2OA, A2OA,
/// Project Zomboid /// Project Zomboid
PRZOMBOID, PROJECTZOMBOID,
/// Insurgency /// Insurgency
INSURGENCY, INSURGENCY,
/// Sven Co-op /// Sven Co-op
SVEENCOOP, SCO,
/// 7 Days To Die /// 7 Days To Die
SD2D, SD2D,
/// Rust /// Rust
RUST, RUST,
/// Vallistic Overkill /// Ballistic Overkill
BALLISTICOVERKILL, BALLISTICOVERKILL,
/// Don't Starve Together /// Don't Starve Together
DST, DST,
@ -322,9 +322,9 @@ pub enum SteamApp {
/// Unturned /// Unturned
UNTURNED, UNTURNED,
/// ARK: Survival Evolved /// ARK: Survival Evolved
ARKSE, ASE,
/// Battalion 1944 /// Battalion 1944
BAT1944, BATTALION1944,
/// Insurgency: Sandstorm /// Insurgency: Sandstorm
INSURGENCYSANDSTORM, INSURGENCYSANDSTORM,
/// Alien Swarm: Reactive Drop /// Alien Swarm: Reactive Drop
@ -347,19 +347,19 @@ impl SteamApp {
match self { match self {
Self::CSS => Engine::new_source(240), Self::CSS => Engine::new_source(240),
Self::DODS => Engine::new_source(300), Self::DODS => Engine::new_source(300),
Self::HL2DM => Engine::new_source(320), Self::HL2D => Engine::new_source(320),
Self::HLDMS => Engine::new_source(360), Self::HLDS => Engine::new_source(360),
Self::TF2 => Engine::new_source(440), Self::TEAMFORTRESS2 => Engine::new_source(440),
Self::LEFT4DEAD => Engine::new_source(500), Self::LEFT4DEAD => Engine::new_source(500),
Self::LEFT4DEAD2 => Engine::new_source(550), Self::LEFT4DEAD2 => Engine::new_source(550),
Self::ALIENSWARM => Engine::new_source(630), Self::ALIENSWARM => Engine::new_source(630),
Self::CSGO => Engine::new_source(730), Self::CSGO => Engine::new_source(730),
Self::SHIP => Engine::new_source(2400), Self::THESHIP => Engine::new_source(2400),
Self::GARRYSMOD => Engine::new_source(4000), Self::GARRYSMOD => Engine::new_source(4000),
Self::AGEOFCHIVALRY => Engine::new_source(17510), Self::AOC => Engine::new_source(17510),
Self::INSURGENCYMIC => Engine::new_source(17700), Self::IMIC => Engine::new_source(17700),
Self::ARMA2OA => Engine::new_source(33930), Self::A2OA => Engine::new_source(33930),
Self::PRZOMBOID => Engine::new_source(108_600), Self::PROJECTZOMBOID => Engine::new_source(108_600),
Self::INSURGENCY => Engine::new_source(222_880), Self::INSURGENCY => Engine::new_source(222_880),
Self::SD2D => 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),
@ -374,8 +374,8 @@ impl SteamApp {
Self::DOI => Engine::new_source(447_820), Self::DOI => Engine::new_source(447_820),
Self::THEFOREST => 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::ARKSE => Engine::new_source(346_110), Self::ASE => Engine::new_source(346_110),
Self::BAT1944 => Engine::new_source(489_940), Self::BATTALION1944 => Engine::new_source(489_940),
Self::INSURGENCYSANDSTORM => 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),