From aea33ae2aae52ae49a1dab8744b8b8d9c2fd9366 Mon Sep 17 00:00:00 2001 From: alwaysintreble Date: Thu, 25 Jul 2024 14:00:11 -0500 Subject: [PATCH] support for messenger since it was basically already done --- worlds/messenger/__init__.py | 2 +- worlds/messenger/client_setup.py | 15 ++++++++++----- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/worlds/messenger/__init__.py b/worlds/messenger/__init__.py index a03c33c2f7b6..1bca3a37ad71 100644 --- a/worlds/messenger/__init__.py +++ b/worlds/messenger/__init__.py @@ -19,7 +19,7 @@ from .subclasses import MessengerEntrance, MessengerItem, MessengerRegion, MessengerShopLocation components.append( - Component("The Messenger", component_type=Type.CLIENT, func=launch_game)#, game_name="The Messenger", supports_uri=True) + Component("The Messenger", component_type=Type.CLIENT, func=launch_game, game_name="The Messenger", supports_uri=True) ) diff --git a/worlds/messenger/client_setup.py b/worlds/messenger/client_setup.py index 9fd08e52d899..b86ff4c7f4a6 100644 --- a/worlds/messenger/client_setup.py +++ b/worlds/messenger/client_setup.py @@ -1,3 +1,4 @@ +import argparse import io import logging import os.path @@ -17,7 +18,7 @@ MOD_URL = "https://api.github.com/repos/alwaysintreble/TheMessengerRandomizerModAP/releases/latest" -def launch_game(url: Optional[str] = None) -> None: +def launch_game() -> None: """Check the game installation, then launch it""" def courier_installed() -> bool: """Check if Courier is installed""" @@ -150,15 +151,19 @@ def available_mod_update(latest_version: str) -> bool: install_mod() elif should_update is None: return + + parser = argparse.ArgumentParser(description="Messenger Client Launcher") + parser.add_argument("url", type=str, nargs="?", help="Archipelago Webhost uri to auto connect to.") + args = parser.parse_args() if not is_windows: - if url: - open_file(f"steam://rungameid/764790//{url}/") + if args.url: + open_file(f"steam://rungameid/764790//{args.url}/") else: open_file("steam://rungameid/764790") else: os.chdir(game_folder) - if url: - subprocess.Popen([MessengerWorld.settings.game_path, str(url)]) + if args.url: + subprocess.Popen([MessengerWorld.settings.game_path, str(args.url)]) else: subprocess.Popen(MessengerWorld.settings.game_path) os.chdir(working_directory)