[Protocol] Valve: Reverse: No name players not being added to the list

This commit is contained in:
CosminPerRam 2023-02-19 16:43:55 +02:00
parent ab43675ae5
commit 99c87557c2
3 changed files with 21 additions and 26 deletions

View file

@ -7,6 +7,10 @@ Crate:
- Added feature `no_games` which disables the supported games (useful when you are only using
the protocols/services, also saves storage space).
Protocols:
- Valve:
1. Reversed (from `0.1.0`) "Players with no name are no more added to the `players_details` field.", also added a note in the [protocols](PROTOCOLS.md) file regarding this.
### Breaking:
None.

View file

@ -1,10 +1,10 @@
A protocol is defined as proprietary if it is being used only for a single scope (or series, like Minecraft).
# Supported protocols:
| Name | For | Proprietary? | Documentation reference | Notes |
|----------------|-------|--------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------|
| Valve Protocol | Games | No | [Server Queries](https://developer.valvesoftware.com/wiki/Server_queries) | Multi-packet decompression not tested. |
| Minecraft | Games | Yes | Java: [List Server Protocol](https://wiki.vg/Server_List_Ping) <br> Bedrock: [Node-GameDig Source](https://github.com/gamedig/node-gamedig/blob/master/protocols/minecraftbedrock.js) | |
| Name | For | Proprietary? | Documentation reference | Notes |
|----------------|-------|--------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------|
| Valve Protocol | Games | No | [Server Queries](https://developer.valvesoftware.com/wiki/Server_queries) | In some cases, the players details query might contain some 0-length named players. Multi-packet decompression not tested. |
| Minecraft | Games | Yes | Java: [List Server Protocol](https://wiki.vg/Server_List_Ping) <br> Bedrock: [Node-GameDig Source](https://github.com/gamedig/node-gamedig/blob/master/protocols/minecraftbedrock.js) | |
## Planned to add support:
_

View file

@ -375,28 +375,19 @@ impl ValveProtocol {
for _ in 0..count {
buffer.move_position_ahead(1); //skip the index byte
let name = buffer.get_string_utf8()?;
let score = buffer.get_u32()?;
let duration = buffer.get_f32()?;
let deaths = match *engine == SteamApp::TS.as_engine() {
false => None,
true => Some(buffer.get_u32()?)
};
let money = match *engine == SteamApp::TS.as_engine() {
false => None,
true => Some(buffer.get_u32()?)
};
if name.len() > 0 {
players.push(ServerPlayer {
name,
score,
duration,
deaths,
money
});
}
players.push(ServerPlayer {
name: buffer.get_string_utf8()?,
score: buffer.get_u32()?,
duration: buffer.get_f32()?,
deaths: match *engine == SteamApp::TS.as_engine() {
false => None,
true => Some(buffer.get_u32()?)
},
money: match *engine == SteamApp::TS.as_engine() {
false => None,
true => Some(buffer.get_u32()?)
},
});
}
Ok(players)