Skip to content

Commit

Permalink
handle empty nickname and discriminator values
Browse files Browse the repository at this point in the history
Also add some replays for custom games to test suite.
  • Loading branch information
termac committed Oct 20, 2024
1 parent 01adca9 commit 729fb43
Show file tree
Hide file tree
Showing 10 changed files with 8 additions and 2 deletions.
4 changes: 2 additions & 2 deletions shroudstone/replay/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,12 +240,12 @@ def process(self, chunk: pb.ReplayChunk):

elif isinstance(msg, pb.PlayerAlt):
client = self.clients[client_id]
if client.nickname is None:
if msg.name.nickname and client.nickname is None:
client.nickname = msg.name.nickname
logger.debug(
f"Filling in player {client_id} nickname: {client.nickname} {client.uuid}"
)
if client.discriminator is None:
if msg.name.discriminator and client.discriminator is None:
client.discriminator = msg.name.discriminator
logger.debug(
f"Filling in player {client_id} discriminator: {client.discriminator} {client.uuid}"
Expand Down
Binary file added tests/replays/CL75432-2024.10.05-11.38.SGReplay
Binary file not shown.
1 change: 1 addition & 0 deletions tests/replays/CL75432-2024.10.05-11.38.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"build_number": 75432, "map_name": "TitansCausewayV2", "players": [{"nickname": "[KeeN]VortiX", "nickname_discriminator": "7122", "uuid": "8caf1a70-95c4-4cc9-a062-2c8d1c522eaa", "faction": "Infernals", "is_ai": false, "disconnect_time": 652.1630859375, "leave_reason": "Leave"}, {"nickname": "Highdra", "nickname_discriminator": "5062", "uuid": "1fb7be1e-4147-460b-ab31-2d8f52aeb988", "faction": "Infernals", "is_ai": false, "disconnect_time": 652.0791015625, "leave_reason": "Surrender"}], "spectators": [{"nickname": "BeoMulf", "nickname_discriminator": "1519", "uuid": "dbfcfa94-c65e-477b-8285-df2214c686ac"}], "duration_seconds": 652.0791015625, "is_1v1_ladder_game": false}
1 change: 1 addition & 0 deletions tests/replays/CL75432-2024.10.05-11.38.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2024-10-05 01.38 10m52s [keen]vortix I, Highdra I - TitansCausewayV2.SGReplay
Binary file added tests/replays/CL75432-2024.10.05-11.51.SGReplay
Binary file not shown.
1 change: 1 addition & 0 deletions tests/replays/CL75432-2024.10.05-11.51.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"build_number": 75432, "map_name": "BrokenCrown", "players": [{"nickname": "Highdra", "nickname_discriminator": "5062", "uuid": "1fb7be1e-4147-460b-ab31-2d8f52aeb988", "faction": "Vanguard", "is_ai": false, "disconnect_time": 763.3681640625, "leave_reason": "Surrender"}, {"nickname": "[KeeN]VortiX", "nickname_discriminator": "7122", "uuid": "8caf1a70-95c4-4cc9-a062-2c8d1c522eaa", "faction": "Infernals", "is_ai": false, "disconnect_time": 763.435546875, "leave_reason": "Leave"}], "spectators": [{"nickname": "BeoMulf", "nickname_discriminator": "1519", "uuid": "dbfcfa94-c65e-477b-8285-df2214c686ac"}], "duration_seconds": 763.3681640625, "is_1v1_ladder_game": false}
1 change: 1 addition & 0 deletions tests/replays/CL75432-2024.10.05-11.51.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2024-10-05 01.51 12m43s Highdra V, [keen]vortix I - BrokenCrown.SGReplay
Binary file added tests/replays/CL75432-2024.10.05-12.08.SGReplay
Binary file not shown.
1 change: 1 addition & 0 deletions tests/replays/CL75432-2024.10.05-12.08.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"build_number": 75432, "map_name": "Boneyard", "players": [{"nickname": "LucifroN7", "nickname_discriminator": "7550", "uuid": "3736d635-81f0-4372-afb0-12e47c46a34d", "faction": "Vanguard", "is_ai": false, "disconnect_time": 579.3857421875, "leave_reason": "Surrender"}, {"nickname": "MaNa", "nickname_discriminator": "6780", "uuid": "7c15efa0-5422-430c-9ef2-a774e5325b44", "faction": "Vanguard", "is_ai": false, "disconnect_time": 579.5751953125, "leave_reason": "Leave"}], "spectators": [{"nickname": "BeoMulf", "nickname_discriminator": "1519", "uuid": "dbfcfa94-c65e-477b-8285-df2214c686ac"}], "duration_seconds": 579.3857421875, "is_1v1_ladder_game": false}
1 change: 1 addition & 0 deletions tests/replays/CL75432-2024.10.05-12.08.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2024-10-05 02.08 09m39s Lucifron7 V, Mana V - Boneyard.SGReplay

0 comments on commit 729fb43

Please sign in to comment.