mirror of
https://github.com/tribufu/rust-gamedig
synced 2026-06-01 09:42:41 +00:00
[Games] Add Quake 3 support and change players frags from u16 to i16
This commit is contained in:
parent
af5e0d1fbf
commit
06a2ceeda9
6 changed files with 16 additions and 2 deletions
|
|
@ -10,6 +10,7 @@ Protocols:
|
||||||
Games:
|
Games:
|
||||||
- [Quake 2](https://store.steampowered.com/app/2320/Quake_II/) support.
|
- [Quake 2](https://store.steampowered.com/app/2320/Quake_II/) support.
|
||||||
- [Quake 1](https://store.steampowered.com/app/2310/Quake/) support.
|
- [Quake 1](https://store.steampowered.com/app/2310/Quake/) support.
|
||||||
|
- [Quake 3: Arena](https://store.steampowered.com/app/2200/Quake_III_Arena/) support.
|
||||||
|
|
||||||
### Breaking:
|
### Breaking:
|
||||||
- Every function that used `&str` for the address has been changed to `&IpAddr` (thanks [@Douile](https://github.com/Douile) for the re-re-write).
|
- Every function that used `&str` for the address has been changed to `&IpAddr` (thanks [@Douile](https://github.com/Douile) for the re-re-write).
|
||||||
|
|
|
||||||
1
GAMES.md
1
GAMES.md
|
|
@ -52,6 +52,7 @@ Beware of the `Notes` column, as it contains information about query port offset
|
||||||
| Crysis Wars | CW | GameSpy 3 | |
|
| Crysis Wars | CW | 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 | |
|
||||||
|
|
||||||
## Planned to add support:
|
## Planned to add support:
|
||||||
_
|
_
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ use gamedig::protocols::{gamespy, quake};
|
||||||
use gamedig::protocols::minecraft::LegacyGroup;
|
use gamedig::protocols::minecraft::LegacyGroup;
|
||||||
use gamedig::protocols::valve;
|
use gamedig::protocols::valve;
|
||||||
use gamedig::protocols::valve::Engine;
|
use gamedig::protocols::valve::Engine;
|
||||||
use gamedig::{aliens, aoc, arma2oa, ase, asrd, avorion, bat1944, bb2, bf1942, bm, bo, ccure, cosu, cs, cscz, csgo, css, dod, dods, doi, dst, ffow, gm, hl2dm, hldms, ins, insmic, inss, l4d, l4d2, mc, ohd, onset, pz, ror2, rust, sc, sdtd, ss, tf, tf2, tfc, ts, unturned, ut, vr, GDResult, cw, quake2, quake1};
|
use gamedig::{aliens, aoc, arma2oa, ase, asrd, avorion, bat1944, bb2, bf1942, bm, bo, ccure, cosu, cs, cscz, csgo, css, dod, dods, doi, dst, ffow, gm, hl2dm, hldms, ins, insmic, inss, l4d, l4d2, mc, ohd, onset, pz, ror2, rust, sc, sdtd, ss, tf, tf2, tfc, ts, unturned, ut, vr, GDResult, cw, quake2, quake1, quake3a};
|
||||||
use std::env;
|
use std::env;
|
||||||
use std::net::IpAddr;
|
use std::net::IpAddr;
|
||||||
|
|
||||||
|
|
@ -128,6 +128,7 @@ fn main() -> GDResult<()> {
|
||||||
"_quake3" => println!("{:#?}", quake::three::query(ip, port.unwrap(), None)),
|
"_quake3" => println!("{:#?}", quake::three::query(ip, port.unwrap(), 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)?),
|
||||||
_ => panic!("Undefined game: {}", args[1]),
|
_ => panic!("Undefined game: {}", args[1]),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -98,3 +98,5 @@ pub mod cw;
|
||||||
pub mod quake2;
|
pub mod quake2;
|
||||||
/// Quake 1
|
/// Quake 1
|
||||||
pub mod quake1;
|
pub mod quake1;
|
||||||
|
/// Quake 3: Arena
|
||||||
|
pub mod quake3a;
|
||||||
|
|
|
||||||
9
src/games/quake3a.rs
Normal file
9
src/games/quake3a.rs
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
use std::net::IpAddr;
|
||||||
|
use crate::GDResult;
|
||||||
|
use crate::protocols::quake;
|
||||||
|
use crate::protocols::quake::Response;
|
||||||
|
use crate::protocols::quake::two::Player;
|
||||||
|
|
||||||
|
pub fn query(address: &IpAddr, port: Option<u16>) -> GDResult<Response<Player>> {
|
||||||
|
quake::three::query(address, port.unwrap_or(27960), None)
|
||||||
|
}
|
||||||
|
|
@ -12,7 +12,7 @@ use serde::{Deserialize, Serialize};
|
||||||
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
||||||
#[derive(Debug, Clone, PartialEq, Eq, Hash, PartialOrd, Ord)]
|
#[derive(Debug, Clone, PartialEq, Eq, Hash, PartialOrd, Ord)]
|
||||||
pub struct Player {
|
pub struct Player {
|
||||||
pub frags: u16,
|
pub frags: i16,
|
||||||
pub ping: u16,
|
pub ping: u16,
|
||||||
pub name: String
|
pub name: String
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue