SC2Client: Changes to /download_data and feedback (#1347)

* SC2Client: Added feedback for users who have map files, but no version #.

* SC2Client: Fixed a missing space.

* SC2Client: /download_data now always forces a download.
This commit is contained in:
SoldierofOrder 2023-01-23 21:44:12 -05:00 committed by GitHub
parent 51574959ec
commit 1d1693df62
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 4 deletions

View File

@ -120,9 +120,9 @@ class StarcraftClientProcessor(ClientCommandProcessor):
sc2_logger.warning("When using set_path, you must type the path to your SC2 install directory.") sc2_logger.warning("When using set_path, you must type the path to your SC2 install directory.")
return False return False
def _cmd_download_data(self, force: bool = False) -> bool: def _cmd_download_data(self) -> bool:
"""Download the most recent release of the necessary files for playing SC2 with """Download the most recent release of the necessary files for playing SC2 with
Archipelago. force should be True or False. force=True will overwrite your files.""" Archipelago. Will overwrite existing files."""
if "SC2PATH" not in os.environ: if "SC2PATH" not in os.environ:
check_game_install_path() check_game_install_path()
@ -132,7 +132,8 @@ class StarcraftClientProcessor(ClientCommandProcessor):
else: else:
current_ver = None current_ver = None
tempzip, version = download_latest_release_zip('TheCondor07', 'Starcraft2ArchipelagoData', current_version=current_ver, force_download=force) tempzip, version = download_latest_release_zip('TheCondor07', 'Starcraft2ArchipelagoData',
current_version=current_ver, force_download=True)
if tempzip != '': if tempzip != '':
try: try:
@ -195,12 +196,16 @@ class SC2Context(CommonContext):
self.build_location_to_mission_mapping() self.build_location_to_mission_mapping()
# Looks for the required maps and mods for SC2. Runs check_game_install_path. # Looks for the required maps and mods for SC2. Runs check_game_install_path.
is_mod_installed_correctly() maps_present = is_mod_installed_correctly()
if os.path.exists(os.environ["SC2PATH"] + "ArchipelagoSC2Version.txt"): if os.path.exists(os.environ["SC2PATH"] + "ArchipelagoSC2Version.txt"):
with open(os.environ["SC2PATH"] + "ArchipelagoSC2Version.txt", "r") as f: with open(os.environ["SC2PATH"] + "ArchipelagoSC2Version.txt", "r") as f:
current_ver = f.read() current_ver = f.read()
if is_mod_update_available("TheCondor07", "Starcraft2ArchipelagoData", current_ver): if is_mod_update_available("TheCondor07", "Starcraft2ArchipelagoData", current_ver):
sc2_logger.info("NOTICE: Update for required files found. Run /download_data to install.") sc2_logger.info("NOTICE: Update for required files found. Run /download_data to install.")
elif maps_present:
sc2_logger.info("NOTICE: Your map files may be outdated (version number not found). Run /download_data "
"to update them.")
def on_print_json(self, args: dict): def on_print_json(self, args: dict):
# goes to this world # goes to this world