From 247f6747494bf88eb3a4392151bf0a7c274c5f8c Mon Sep 17 00:00:00 2001 From: Fabian Dill Date: Fri, 17 Jun 2022 03:34:50 +0200 Subject: [PATCH] Network remove roominfo players (#661) --- CommonClient.py | 8 ++++---- MultiServer.py | 1 + docs/network protocol.md | 3 +-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/CommonClient.py b/CommonClient.py index ec774d09..7f13e3b4 100644 --- a/CommonClient.py +++ b/CommonClient.py @@ -540,14 +540,14 @@ async def process_server_cmd(ctx: CommonContext, args: dict): f" for each location checked. Use !hint for more information.") ctx.hint_cost = int(args['hint_cost']) ctx.check_points = int(args['location_check_points']) - - if len(args['players']) < 1: + players = args.get("players", []) + if len(players) < 1: logger.info('No player connected') else: - args['players'].sort() + players.sort() current_team = -1 logger.info('Connected Players:') - for network_player in args['players']: + for network_player in players: if network_player.team != current_team: logger.info(f' Team #{network_player.team + 1}') current_team = network_player.team diff --git a/MultiServer.py b/MultiServer.py index e1a46ace..033a2b34 100644 --- a/MultiServer.py +++ b/MultiServer.py @@ -630,6 +630,7 @@ async def on_client_connected(ctx: Context, client: Client): await ctx.send_msgs(client, [{ 'cmd': 'RoomInfo', 'password': bool(ctx.password), + # TODO remove around 0.4 'players': players, # TODO convert to list of games present in 0.4 'games': [ctx.games[x] for x in range(1, len(ctx.games) + 1)], diff --git a/docs/network protocol.md b/docs/network protocol.md index afc19a1f..b5553c37 100644 --- a/docs/network protocol.md +++ b/docs/network protocol.md @@ -63,7 +63,6 @@ Sent to clients when they connect to an Archipelago server. | permissions | dict\[str, [Permission](#Permission)\[int\]\] | Mapping of permission name to [Permission](#Permission), keys are: "forfeit", "collect" and "remaining". | | hint_cost | int | The amount of points it costs to receive a hint from the server. | | location_check_points | int | The amount of hint points you receive per item/location check completed. || -| players | list\[[NetworkPlayer](#NetworkPlayer)\] | Sent only if the client is properly authenticated (see [Archipelago Connection Handshake](#Archipelago-Connection-Handshake)). Information on the players currently connected to the server. | | games | list\[str\] | List of games present in this multiworld. | | datapackage_version | int | Sum of individual games' datapackage version. Deprecated. Use `datapackage_versions` instead. | | datapackage_versions | dict\[str, int\] | Data versions of the individual games' data packages the server will send. Used to decide which games' caches are outdated. See [Data Package Contents](#Data-Package-Contents). | @@ -146,7 +145,7 @@ The arguments for RoomUpdate are identical to [RoomInfo](#RoomInfo) barring: | Name | Type | Notes | | ---- | ---- | ----- | | hint_points | int | New argument. The client's current hint points. | -| players | list\[[NetworkPlayer](#NetworkPlayer)\] | Changed argument. Always sends all players, whether connected or not. | +| players | list\[[NetworkPlayer](#NetworkPlayer)\] | Send in the event of an alias rename. Always sends all players, whether connected or not. | | checked_locations | list\[int\] | May be a partial update, containing new locations that were checked, especially from a coop partner in the same slot. | | missing_locations | list\[int\] | Should never be sent as an update, if needed is the inverse of checked_locations. |