[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 - Added feature `no_games` which disables the supported games (useful when you are only using
the protocols/services, also saves storage space). 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: ### Breaking:
None. None.

View file

@ -2,8 +2,8 @@ A protocol is defined as proprietary if it is being used only for a single scope
# Supported protocols: # Supported protocols:
| Name | For | Proprietary? | Documentation reference | Notes | | Name | For | Proprietary? | Documentation reference | Notes |
|----------------|-------|--------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------| |----------------|-------|--------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------|
| Valve Protocol | Games | No | [Server Queries](https://developer.valvesoftware.com/wiki/Server_queries) | Multi-packet decompression not tested. | | 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) | | | 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: ## Planned to add support:

View file

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