diff --git a/MultiMystery.py b/MultiMystery.py index e51ba534..5600cf93 100644 --- a/MultiMystery.py +++ b/MultiMystery.py @@ -46,6 +46,7 @@ if __name__ == "__main__": output_path = options["general_options"]["output_path"] enemizer_path = multi_mystery_options["enemizer_path"] player_files_path = multi_mystery_options["player_files_path"] + target_player_count = multi_mystery_options.get("players", 0) race = multi_mystery_options["race"] create_spoiler = multi_mystery_options["create_spoiler"] zip_roms = multi_mystery_options["zip_roms"] @@ -56,6 +57,7 @@ if __name__ == "__main__": #zip_password = multi_mystery_options["zip_password"] not at this time player_name = multi_mystery_options["player_name"] meta_file_path = multi_mystery_options["meta_file_path"] + weights_file_path = multi_mystery_options.get("weights_file_path", "weights.yaml") teams = multi_mystery_options["teams"] rom_file = options["general_options"]["rom_file"] host = options["server_options"]["host"] @@ -72,14 +74,9 @@ if __name__ == "__main__": os.makedirs(player_files_path, exist_ok=True) for file in os.listdir(player_files_path): lfile = file.lower() - if lfile.endswith(".yaml") and lfile != meta_file_path.lower(): + if lfile.endswith(".yaml") and lfile != meta_file_path.lower() and lfile != weights_file_path.lower(): player_files.append(file) print(f"Found player's file {file}.") - player_count = len(player_files) - if player_count == 0: - feedback(f"No player files found. Please put them in a {player_files_path} folder.") - else: - print(player_count, "Players found.") player_string = "" for i, file in enumerate(player_files, 1): @@ -93,7 +90,20 @@ if __name__ == "__main__": else: basemysterycommand = f"py -{py_version} Mystery.py" # source - command = f"{basemysterycommand} --multi {len(player_files)} {player_string} " \ + + weights_file_path = os.path.join(player_files_path, weights_file_path) + if os.path.exists(weights_file_path): + target_player_count = max(len(player_files), target_player_count) + else: + target_player_count = len(player_files) + + + if target_player_count == 0: + feedback(f"No player files found. Please put them in a {player_files_path} folder.") + else: + print(target_player_count, "Players found.") + + command = f"{basemysterycommand} --multi {target_player_count} {player_string} " \ f"--rom \"{rom_file}\" --enemizercli \"{enemizer_path}\" " \ f"--outputpath \"{output_path}\" --teams {teams}" @@ -107,6 +117,8 @@ if __name__ == "__main__": command += " --race" if os.path.exists(os.path.join(player_files_path, meta_file_path)): command += f" --meta {os.path.join(player_files_path, meta_file_path)}" + if os.path.exists(weights_file_path): + command += f" --weights {weights_file_path}" print(command) import time diff --git a/host.yaml b/host.yaml index 4cdc5174..a8a09847 100644 --- a/host.yaml +++ b/host.yaml @@ -61,6 +61,11 @@ multi_mystery_options: enemizer_path: "EnemizerCLI/EnemizerCLI.Core.exe" # Folder from which the player yaml files are pulled from player_files_path: "Players" + #amount of players, 0 to infer from player files + players: 0 + # general weights file, within the stated player_files_path location + # gets used if players is higher than the amount of per-player files found to fill remaining slots + weights_file_path: "weights.yaml" # Meta file name, within the stated player_files_path location meta_file_path: "meta.yaml" # Automatically launches {player_name}.yaml's ROM file using the OS's default program once generation completes. (likely your emulator) @@ -94,5 +99,5 @@ multi_mystery_options: # 2 -> 7z is recommended for roms. All of them get the job done. # 3 -> bz2 zip_format: 1 - # Create roms flagged as race roms + # Create encrypted race roms race: 0