Games: Add Battalion 1944 support.

This commit is contained in:
CosminPerRam 2023-01-13 23:08:09 +02:00
parent 018935fd29
commit 9bcbfbc198
6 changed files with 24 additions and 5 deletions

View file

@ -5,6 +5,7 @@ Who knows what the future holds...
### Changes:
Games:
- [Risk of Rain 2](https://store.steampowered.com/app/632360/Risk_of_Rain_2/) support.
- [Battalion 1944](https://store.steampowered.com/app/489940/BATTALION_Legacy/) support.
Protocols:
- Valve: Players with no name are no more added to the `players_details` field.

View file

@ -14,7 +14,7 @@ A supported game is defined as a game that has been successfully tested, other g
| Alien Swarm | ALIENS | Valve Protocol | |
| Alien Swarm: Reactive Drop | ASRD | Valve Protocol | |
| Insurgency | INS | Valve Protocol | |
| Insurgency: Sandstorm | INSS | Valve Protocol | Use the query port. |
| Insurgency: Sandstorm | INSS | Valve Protocol | Query port offset: 1. |
| Insurgency: Modern Infantry Combat | INSMIC | Valve Protocol | |
| Counter-Strike: Condition Zero | CSCZ | Valve Protocol (GoldSrc) | |
| Day of Defeat | DOD | Valve Protocol (GoldSrc) | |
@ -22,15 +22,16 @@ A supported game is defined as a game that has been successfully tested, other g
| 7 Days To Die | SDTD | Valve Protocol | |
| ARK: Survival Evolved | ASE | Valve Protocol | |
| Unturned | UNTURNED | Valve Protocol | |
| The Forest | TF | Valve Protocol (GoldSrc) | Use the query port. |
| The Forest | TF | Valve Protocol (GoldSrc) | Query port offset: 1. |
| Team Fortress Classic | TFC | Valve Protocol | |
| Sven Co-op | SC | Valve Protocol (GoldSrc) | |
| Rust | RUST | Valve Protocol | |
| Counter-Strike | CS | Valve Protocol (GoldSrc) | |
| Arma 2: Operation Arrowhead | ARMA2OA | Valve Protocol | Use the query port. |
| Arma 2: Operation Arrowhead | ARMA2OA | Valve Protocol | Query port offset: 1. |
| Day of Infamy | DOI | Valve Protocol | |
| Half-Life Deathmatch: Source | HLDMS | Valve Protocol | |
| Risk of Rain 2 | ROR2 | Valve Protocol | Use the query port (by default its 27016 (the game connection port + 1)). |
| Risk of Rain 2 | ROR2 | Valve Protocol | Query port offset: 1. |
| Battalion 1944 | BAT1944 | Valve Protocol | Query port offset: 3. |
## Planned to add support:
_

View file

@ -1,6 +1,6 @@
use std::env;
use gamedig::{aliens, arma2oa, ase, asrd, cs, cscz, csgo, css, dod, dods, doi, GDResult, gm, hl2dm, hldms, ins, insmic, inss, l4d, l4d2, mc, ror2, rust, sc, sdtd, tf, tf2, tfc, ts, unturned};
use gamedig::{aliens, arma2oa, ase, asrd, bat1944, cs, cscz, csgo, css, dod, dods, doi, GDResult, gm, hl2dm, hldms, ins, insmic, inss, l4d, l4d2, mc, ror2, rust, sc, sdtd, tf, tf2, tfc, ts, unturned};
use gamedig::protocols::minecraft::LegacyGroup;
use gamedig::protocols::valve;
use gamedig::protocols::valve::App;
@ -70,6 +70,7 @@ fn main() -> GDResult<()> {
"doi" => println!("{:#?}", doi::query(ip, port)?),
"hldms" => println!("{:#?}", hldms::query(ip, port)?),
"ror2" => println!("{:#?}", ror2::query(ip, port)?),
"bat1944" => println!("{:?}", bat1944::query(ip, port)?),
_ => panic!("Undefined game: {}", args[1])
};

12
src/games/bat1944.rs Normal file
View file

@ -0,0 +1,12 @@
use crate::GDResult;
use crate::protocols::valve;
use crate::protocols::valve::{game, SteamID};
pub fn query(address: &str, port: Option<u16>) -> GDResult<game::Response> {
let valve_response = valve::query(address, match port {
None => 7780,
Some(port) => port
}, SteamID::BAT1944.as_app(), None, None)?;
Ok(game::Response::new_from_valve_response(valve_response))
}

View file

@ -59,3 +59,5 @@ pub mod doi;
pub mod hldms;
/// Risk of Rain 2
pub mod ror2;
/// Battalion 1944
pub mod bat1944;

View file

@ -189,6 +189,8 @@ pub enum SteamID {
UNTURNED = 304930,
/// ARK: Survival Evolved
ASE = 346110,
/// Battalion 1944
BAT1944 = 489940,
/// Insurgency: Sandstorm
INSS = 581320,
/// Alien Swarm: Reactive Drop