SC2: send ItemLink messages to ingame as well

This commit is contained in:
Fabian Dill 2022-05-30 23:02:40 +02:00 committed by Fabian Dill
parent ee65d7e5fa
commit 8b1baafddf
2 changed files with 11 additions and 5 deletions

View File

@ -299,6 +299,13 @@ class CommonContext:
await self.disconnect()
self.server_task = asyncio.create_task(server_loop(self, address), name="server loop")
def slot_concerns_self(self, slot) -> bool:
if slot == self.slot:
return True
if slot in self.slot_info:
return self.slot in self.slot_info[slot].group_members
return False
def on_print(self, args: dict):
logger.info(args["text"])

View File

@ -115,13 +115,12 @@ class SC2Context(CommonContext):
self.mission_req_table[mission] = MissionInfo(**slot_req_table[mission])
if cmd in {"PrintJSON"}:
noted = False
if "receiving" in args:
if args["receiving"] == self.slot:
if self.slot_concerns_self(args["receiving"]):
self.announcements.append(args["data"])
noted = True
if not noted and "item" in args:
if args["item"].player == self.slot:
return
if "item" in args:
if self.slot_concerns_self(args["item"].player):
self.announcements.append(args["data"])
def run_gui(self):