mirror of
https://github.com/tribufu/rust-gamedig
synced 2026-06-01 09:42:41 +00:00
feat(protocols): Add more control over gathering additional information (#180)
* protocols: Add more control over gathering additional information Adds GatherToggle which allows choosing the behaviour for how the query handles fetching additional information. The choices are: - DontGather - Don't attempt to fetch information - AttemptGather - Try to fetch the information but ignore errors - Required - Try to fetch information and fail if it errors A handy macro was also added to utils to dispatch additional queries based on a GatherToggle value. * Add/Update badge * protocols: Improve GatherToggle enum names Co-Authored-By: Cain <75994858+cainthebest@users.noreply.github.com> Co-Authored-By: CosminPerRam <cosmin.p@live.com> * Add/Update badge --------- Co-authored-by: GitHub Action <action@github.com> Co-authored-by: Cain <75994858+cainthebest@users.noreply.github.com> Co-authored-by: CosminPerRam <cosmin.p@live.com>
This commit is contained in:
parent
6d0c25d6ea
commit
89ed19f089
10 changed files with 195 additions and 64 deletions
|
|
@ -4,7 +4,7 @@ use crate::games::minecraft::types::{LegacyGroup, Server};
|
|||
use crate::protocols::{gamespy::GameSpyVersion, quake::QuakeVersion, valve::Engine, Protocol};
|
||||
use crate::Game;
|
||||
|
||||
use crate::protocols::types::ProprietaryProtocol;
|
||||
use crate::protocols::types::{GatherToggle, ProprietaryProtocol};
|
||||
use crate::protocols::valve::GatheringSettings;
|
||||
use phf::{phf_map, Map};
|
||||
|
||||
|
|
@ -40,8 +40,8 @@ pub static GAMES: Map<&'static str, Game> = phf_map! {
|
|||
"minecraftlegacy14" => game!("Minecraft (legacy 1.4)", 25565, Protocol::PROPRIETARY(ProprietaryProtocol::Minecraft(Some(Server::Legacy(LegacyGroup::V1_4))))),
|
||||
"minecraftlegacyb18" => game!("Minecraft (legacy b1.8)", 25565, Protocol::PROPRIETARY(ProprietaryProtocol::Minecraft(Some(Server::Legacy(LegacyGroup::VB1_8))))),
|
||||
"aapg" => game!("America's Army: Proving Grounds", 27020, Protocol::Valve(Engine::new(203_290)), GatheringSettings {
|
||||
players: true,
|
||||
rules: false,
|
||||
players: GatherToggle::Enforce,
|
||||
rules: GatherToggle::Skip,
|
||||
check_app_id: true,
|
||||
}.into_extra()),
|
||||
"alienswarm" => game!("Alien Swarm", 27015, Protocol::Valve(Engine::new(630))),
|
||||
|
|
@ -53,8 +53,8 @@ pub static GAMES: Map<&'static str, Game> = phf_map! {
|
|||
"avorion" => game!("Avorion", 27020, Protocol::Valve(Engine::new(445_220))),
|
||||
"barotrauma" => game!("Barotrauma", 27016, Protocol::Valve(Engine::new(602_960))),
|
||||
"basedefense" => game!("Base Defense", 27015, Protocol::Valve(Engine::new(632_730)), GatheringSettings {
|
||||
players: true,
|
||||
rules: false,
|
||||
players: GatherToggle::Enforce,
|
||||
rules: GatherToggle::Skip,
|
||||
check_app_id: true,
|
||||
}.into_extra()),
|
||||
"battalion1944" => game!("Battalion 1944", 7780, Protocol::Valve(Engine::new(489_940))),
|
||||
|
|
@ -65,8 +65,8 @@ pub static GAMES: Map<&'static str, Game> = phf_map! {
|
|||
"codenamecure" => game!("Codename CURE", 27015, Protocol::Valve(Engine::new(355_180))),
|
||||
"colonysurvival" => game!("Colony Survival", 27004, Protocol::Valve(Engine::new(366_090))),
|
||||
"conanexiles" => game!("Conan Exiles", 27015, Protocol::Valve(Engine::new(440_900)), GatheringSettings {
|
||||
players: false,
|
||||
rules: true,
|
||||
players: GatherToggle::Skip,
|
||||
rules: GatherToggle::Enforce,
|
||||
check_app_id: true,
|
||||
}.into_extra()),
|
||||
"counterstrike" => game!("Counter-Strike", 27015, Protocol::Valve(Engine::new_gold_src(false))),
|
||||
|
|
@ -98,8 +98,8 @@ pub static GAMES: Map<&'static str, Game> = phf_map! {
|
|||
"quake2" => game!("Quake 2", 27910, Protocol::Quake(QuakeVersion::Two)),
|
||||
"q3a" => game!("Quake 3 Arena", 27960, Protocol::Quake(QuakeVersion::Three)),
|
||||
"risingworld" => game!("Rising World", 4254, Protocol::Valve(Engine::new(324_080)), GatheringSettings {
|
||||
players: true,
|
||||
rules: false,
|
||||
players: GatherToggle::Enforce,
|
||||
rules: GatherToggle::Skip,
|
||||
check_app_id: true,
|
||||
}.into_extra()),
|
||||
"ror2" => game!("Risk of Rain 2", 27016, Protocol::Valve(Engine::new(632_360))),
|
||||
|
|
@ -118,8 +118,8 @@ pub static GAMES: Map<&'static str, Game> = phf_map! {
|
|||
"unturned" => game!("Unturned", 27015, Protocol::Valve(Engine::new(304_930))),
|
||||
"unrealtournament" => game!("Unreal Tournament", 7778, Protocol::Gamespy(GameSpyVersion::One)),
|
||||
"valheim" => game!("Valheim", 2457, Protocol::Valve(Engine::new(892_970)), GatheringSettings {
|
||||
players: true,
|
||||
rules: false,
|
||||
players: GatherToggle::Enforce,
|
||||
rules: GatherToggle::Skip,
|
||||
check_app_id: true,
|
||||
}.into_extra()),
|
||||
"vrising" => game!("V Rising", 27016, Protocol::Valve(Engine::new(1_604_030))),
|
||||
|
|
|
|||
|
|
@ -17,8 +17,8 @@ game_query_mod!(
|
|||
Engine::new(203_290),
|
||||
27020,
|
||||
GatheringSettings {
|
||||
players: true,
|
||||
rules: false,
|
||||
players: GatherToggle::Enforce,
|
||||
rules: GatherToggle::Skip,
|
||||
check_app_id: true,
|
||||
}
|
||||
);
|
||||
|
|
@ -53,8 +53,8 @@ game_query_mod!(
|
|||
Engine::new(440_900),
|
||||
27015,
|
||||
GatheringSettings {
|
||||
players: false,
|
||||
rules: true,
|
||||
players: GatherToggle::Skip,
|
||||
rules: GatherToggle::Enforce,
|
||||
check_app_id: true,
|
||||
}
|
||||
);
|
||||
|
|
@ -142,8 +142,8 @@ game_query_mod!(
|
|||
Engine::new(892_970),
|
||||
2457,
|
||||
GatheringSettings {
|
||||
players: true,
|
||||
rules: false,
|
||||
players: GatherToggle::Enforce,
|
||||
rules: GatherToggle::Skip,
|
||||
check_app_id: true,
|
||||
}
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue