diff --git a/LinksAwakeningClient.py b/LinksAwakeningClient.py index 298788098d9e..f624f4168c85 100644 --- a/LinksAwakeningClient.py +++ b/LinksAwakeningClient.py @@ -567,7 +567,12 @@ def on_package(self, cmd: str, args: dict): if cmd == "Connected": self.game = self.slot_info[self.slot].game self.slot_data = args.get("slot_data", {}) - + self.slot_data.update({ + "server_address": self.server_address, + "slot_name": self.player_names[self.slot], + "password": self.password, + }) + # TODO - use watcher_event if cmd == "ReceivedItems": for index, item in enumerate(args["items"], start=args["index"]): @@ -632,7 +637,8 @@ async def deathlink(): self.magpie.set_checks(self.client.tracker.all_checks) await self.magpie.set_item_tracker(self.client.item_tracker) await self.magpie.send_gps(self.client.gps_tracker) - self.magpie.slot_data = self.slot_data + if self.slot_data and "slot_data" in self.magpie.features and not self.magpie.has_sent_slot_data: + await self.magpie.send_slot_data(self.slot_data) except Exception: # Don't let magpie errors take out the client pass diff --git a/worlds/ladx/Tracker.py b/worlds/ladx/Tracker.py index 5f48b64c4f5e..919214349847 100644 --- a/worlds/ladx/Tracker.py +++ b/worlds/ladx/Tracker.py @@ -149,7 +149,7 @@ class MagpieBridge: item_tracker = None ws = None features = [] - slot_data = {} + has_sent_slot_data = False async def handler(self, websocket): self.ws = websocket @@ -165,8 +165,6 @@ async def handler(self, websocket): await self.send_all_inventory() if "checks" in self.features: await self.send_all_checks() - if "slot_data" in self.features: - await self.send_slot_data(self.slot_data) # Translate renamed IDs back to LADXR IDs @staticmethod @@ -236,8 +234,8 @@ async def send_slot_data(self, slot_data): "type": "slot_data", "slot_data": slot_data } - await self.ws.send(json.dumps(message)) + self.has_sent_slot_data = True async def serve(self): async with websockets.serve(lambda w: self.handler(w), "", 17026, logger=logger): diff --git a/worlds/ladx/__init__.py b/worlds/ladx/__init__.py index 7499aca8c404..574b46149185 100644 --- a/worlds/ladx/__init__.py +++ b/worlds/ladx/__init__.py @@ -550,4 +550,6 @@ def fill_slot_data(self): for option, value in dataclasses.asdict(self.options).items() if option in slot_options_display_name }) + slot_data.update({"entrance_mapping": self.ladxr_logic.world_setup.entrance_mapping}) + return slot_data