Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LADX: more tracker support #4355

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions LinksAwakeningClient.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"]):
Expand Down Expand Up @@ -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
Expand Down
6 changes: 2 additions & 4 deletions worlds/ladx/Tracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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):
Expand Down
2 changes: 2 additions & 0 deletions worlds/ladx/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Loading