diff --git a/CHANGELOG.md b/CHANGELOG.md index 83965ea..df88d9f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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. diff --git a/PROTOCOLS.md b/PROTOCOLS.md index 0422ebd..35b8a0f 100644 --- a/PROTOCOLS.md +++ b/PROTOCOLS.md @@ -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)
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)
Bedrock: [Node-GameDig Source](https://github.com/gamedig/node-gamedig/blob/master/protocols/minecraftbedrock.js) | | ## Planned to add support: _ diff --git a/src/protocols/valve/protocol.rs b/src/protocols/valve/protocol.rs index 258be29..4a8caa7 100644 --- a/src/protocols/valve/protocol.rs +++ b/src/protocols/valve/protocol.rs @@ -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)