mirror of
https://github.com/MarioSpore/Grinch-AP.git
synced 2025-10-21 20:21:32 -06:00
@@ -638,6 +638,12 @@ class LinksAwakeningContext(CommonContext):
|
||||
if cmd == "Connected":
|
||||
self.game = self.slot_info[self.slot].game
|
||||
self.slot_data = args.get("slot_data", {})
|
||||
# This is sent to magpie over local websocket to make its own connection
|
||||
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":
|
||||
@@ -722,7 +728,9 @@ class LinksAwakeningContext(CommonContext):
|
||||
try:
|
||||
self.magpie.set_checks(self.client.tracker.all_checks)
|
||||
await self.magpie.set_item_tracker(self.client.item_tracker)
|
||||
if self.slot_data and "slot_data" in self.magpie.features and not self.magpie.has_sent_slot_data:
|
||||
self.magpie.slot_data = self.slot_data
|
||||
await self.magpie.send_slot_data()
|
||||
|
||||
if self.client.gps_tracker.needs_found_entrances:
|
||||
await self.request_found_entrances()
|
||||
|
@@ -184,6 +184,7 @@ class MagpieBridge:
|
||||
ws = None
|
||||
features = []
|
||||
slot_data = {}
|
||||
has_sent_slot_data = False
|
||||
|
||||
def use_entrance_tracker(self):
|
||||
return "entrances" in self.features \
|
||||
@@ -207,8 +208,6 @@ class MagpieBridge:
|
||||
await self.send_all_inventory()
|
||||
if "checks" in self.features:
|
||||
await self.send_all_checks()
|
||||
if "slot_data" in self.features and self.slot_data:
|
||||
await self.send_slot_data(self.slot_data)
|
||||
if self.use_entrance_tracker():
|
||||
await self.send_gps(diff=False)
|
||||
|
||||
@@ -288,17 +287,17 @@ class MagpieBridge:
|
||||
|
||||
return await self.gps_tracker.send_entrances(self.ws, diff)
|
||||
|
||||
async def send_slot_data(self, slot_data):
|
||||
async def send_slot_data(self):
|
||||
if not self.ws:
|
||||
return
|
||||
|
||||
logger.debug("Sending slot_data to magpie.")
|
||||
message = {
|
||||
"type": "slot_data",
|
||||
"slot_data": slot_data
|
||||
"slot_data": self.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):
|
||||
|
@@ -589,4 +589,6 @@ class LinksAwakeningWorld(World):
|
||||
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
|
||||
|
Reference in New Issue
Block a user