From c61fa78defdd0902f3e551b4ac8c896e2c7d016d Mon Sep 17 00:00:00 2001 From: alwaysintreble Date: Mon, 30 Sep 2024 18:12:34 -0500 Subject: [PATCH] have commonclient check race mode on connect and add it to the tooltip ui --- CommonClient.py | 2 ++ kvui.py | 2 ++ 2 files changed, 4 insertions(+) diff --git a/CommonClient.py b/CommonClient.py index 1aedd518b4f8..8325227d5e5c 100644 --- a/CommonClient.py +++ b/CommonClient.py @@ -325,6 +325,7 @@ def __init__(self, server_address: typing.Optional[str] = None, password: typing "collect": "disabled", "remaining": "disabled", } + self.race_mode: int = 0 # own state self.finished_game = False @@ -454,6 +455,7 @@ async def send_connect(self, **kwargs: typing.Any) -> None: if kwargs: payload.update(kwargs) await self.send_msgs([payload]) + await self.send_msgs([{"cmd": "Get", "keys": ["race_mode"]}]) async def console_input(self) -> str: if self.ui: diff --git a/kvui.py b/kvui.py index 536dce12208e..d58af3ed0e78 100644 --- a/kvui.py +++ b/kvui.py @@ -243,6 +243,8 @@ def get_text(self): f"\nYou currently have {ctx.hint_points} points." elif ctx.hint_cost == 0: text += "\n!hint is free to use." + if ctx.stored_data and "race_mode" in ctx.stored_data: + text += "\nRace mode is enabled." if ctx.stored_data["race_mode"] else "\nRace mode is disabled." else: text += f"\nYou are not authenticated yet."