[Games] Add Warsow support.

This commit is contained in:
CosminPerRam 2023-06-27 01:15:04 +03:00
parent 58f7ff8aab
commit 0f9a10f2fb
6 changed files with 16 additions and 0 deletions

View file

@ -14,6 +14,7 @@ Generic query:
Games:
- [Halo: Combat Evolved](https://en.wikipedia.org/wiki/Halo:_Combat_Evolved) support.
- [Just Cause 2: Multiplayer](https://store.steampowered.com/app/259080/Just_Cause_2_Multiplayer_Mod/) support.
- [Warsow](https://warsow.net/) support.
### Breaking...
Protocols:

View file

@ -58,6 +58,7 @@ Beware of the `Notes` column, as it contains information about query port offset
| Soldier of Fortune 2 | SOF2 | Quake 3 | |
| Halo: Combat Evolved | HALOCE | GameSpy 2 | |
| Just Cause 2: Multiplayer | JC2MP | GameSpy 3 (*Altered) | |
| Warsow | WARSOW | Quake 3 | |
## Planned to add support:
_

View file

@ -57,6 +57,7 @@ use gamedig::{
unturned,
ut,
vr,
warsow,
GDResult,
};
use std::env;
@ -191,6 +192,7 @@ fn main() -> GDResult<()> {
"_gamespy2" => println!("{:#?}", gamespy::two::query(address, None)),
"haloce" => println!("{:#?}", haloce::query(ip, port)?),
"jc2mp" => println!("{:#?}", jc2mp::query(ip, port)?),
"warsow" => println!("{:#?}", warsow::query(ip, port)?),
_ => panic!("Undefined game: {}", args[1]),
};

View file

@ -83,4 +83,5 @@ pub static GAMES: Map<&'static str, Game> = phf_map! {
"ut" => game!("Unreal Tournament", 7778, Protocol::Gamespy(GameSpyVersion::One)),
"vr" => game!("V Rising", 27016, Protocol::Valve(SteamApp::VR)),
"jc2mp" => game!("Just Cause 2: Multiplayer", 7777, Protocol::PROPRIETARY(ProprietaryProtocol::JC2MP)),
"warsow" => game!("Warsow", 44400, Protocol::Quake(QuakeVersion::Three)),
};

View file

@ -111,6 +111,8 @@ pub mod unturned;
pub mod ut;
/// V Rising
pub mod vr;
/// Warsow
pub mod warsow;
use crate::protocols::gamespy::GameSpyVersion;
use crate::protocols::quake::QuakeVersion;

9
src/games/warsow.rs Normal file
View file

@ -0,0 +1,9 @@
use crate::protocols::quake;
use crate::protocols::quake::two::Player;
use crate::protocols::quake::Response;
use crate::GDResult;
use std::net::{IpAddr, SocketAddr};
pub fn query(address: &IpAddr, port: Option<u16>) -> GDResult<Response<Player>> {
quake::three::query(&SocketAddr::new(*address, port.unwrap_or(44400)), None)
}