Core: add race mode to multidata and datastore (#4017)

* add race mode to multidata and datastore

* have commonclient check race mode on connect and add it to the tooltip ui
This commit is contained in:
Aaron Wagener 2024-10-01 14:08:13 -05:00 committed by GitHub
parent 8193fa12b2
commit 67f6b458d7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 7 additions and 0 deletions

View File

@ -325,6 +325,7 @@ class CommonContext:
"collect": "disabled",
"remaining": "disabled",
}
self.race_mode: int = 0
# own state
self.finished_game = False
@ -454,6 +455,7 @@ class CommonContext:
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:

View File

@ -338,6 +338,7 @@ def main(args, seed=None, baked_server_options: Optional[Dict[str, object]] = No
"seed_name": multiworld.seed_name,
"spheres": spheres,
"datapackage": data_package,
"race_mode": int(multiworld.is_race),
}
AutoWorld.call_all(multiworld, "modify_multidata", multidata)

View File

@ -427,6 +427,8 @@ class Context:
use_embedded_server_options: bool):
self.read_data = {}
# there might be a better place to put this.
self.stored_data["race_mode"] = decoded_obj.get("race_mode", 0)
mdata_ver = decoded_obj["minimum_versions"]["server"]
if mdata_ver > version_tuple:
raise RuntimeError(f"Supplied Multidata (.archipelago) requires a server of at least version {mdata_ver},"

View File

@ -243,6 +243,8 @@ class ServerLabel(HovererableLabel):
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."