[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

@ -1,10 +1,10 @@
A protocol is defined as proprietary if it is being used only for a single scope (or series, like Minecraft). A protocol is defined as proprietary if it is being used only for a single scope (or series, like Minecraft).
# 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,28 +375,19 @@ 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()?; players.push(ServerPlayer {
let score = buffer.get_u32()?; name: buffer.get_string_utf8()?,
let duration = buffer.get_f32()?; score: buffer.get_u32()?,
duration: buffer.get_f32()?,
let deaths = match *engine == SteamApp::TS.as_engine() { deaths: match *engine == SteamApp::TS.as_engine() {
false => None, false => None,
true => Some(buffer.get_u32()?) true => Some(buffer.get_u32()?)
}; },
let money = match *engine == SteamApp::TS.as_engine() { money: match *engine == SteamApp::TS.as_engine() {
false => None, false => None,
true => Some(buffer.get_u32()?) true => Some(buffer.get_u32()?)
}; },
});
if name.len() > 0 {
players.push(ServerPlayer {
name,
score,
duration,
deaths,
money
});
}
} }
Ok(players) Ok(players)