def main(*, game_name, game_path, mod_type, mod_options=[], is_steam=True): sys.stdout = logger.Logger(common.Globals.LOG_FILE_PATH) logger.setGlobalLogger(sys.stdout) sys.stderr = logger.StdErrRedirector(sys.stdout) common.Globals.scanForExecutables() gui_main.check07thModServerConnection() modList = gui_main.getModList() subModList = gui_main.getSubModConfigList(modList) print("\n") suitableSubMods = [ x for x in subModList if all(y in x.modName.lower().split() for y in game_name.lower().split("-")) and x.subModName == mod_type ] if len(suitableSubMods) != 1: print(f'Could not find a mod matching "{game_name}"') return neededSubMod = suitableSubMods[0] neededModOptions = [] for i in mod_options: neededModOption = [ x for x in neededSubMod.modOptions if all(y in x.id.lower().split() for y in i.lower().split("-")) ] if len(neededModOption) == 1: neededModOptions += neededModOption if len(neededModOptions) != len(mod_options): print("Couldn't find specified mod options.") return for i in neededSubMod.modOptions: if i.id in [x.id for x in neededModOptions]: i.value = True install_config = installConfiguration.FullInstallConfiguration( neededSubMod, game_path, is_steam ) if neededSubMod.family == "umineko": uminekoInstaller.mainUmineko(install_config) elif neededSubMod.family == "umineko_nscripter": uminekoNScripterInstaller.main(install_config) elif neededSubMod.family == "higurashi": higurashiInstaller.main(install_config) else: print( f"Submod family is not recognised, the script may be out of date." "Please ask us to update it." )
def customFormatter(option): return "[{}]:\n{}\n".format(option.name, option.description) for (optionGroupName, optionList) in radioOptions.items(): chosenRadioOption = userPickFromList(optionList, "Please choose [{}]".format(optionGroupName), customFormatter=customFormatter) chosenRadioOption.value = True if __name__ == "__main__": sys.stdout = logger.Logger(common.Globals.LOG_FILE_PATH) logger.setGlobalLogger(sys.stdout) sys.stderr = logger.StdErrRedirector(sys.stdout) gui_main.check07thModServerConnection() common.Globals.scanForExecutables() modList = gui_main.getModList() subModList = gui_main.getSubModConfigList(modList) #type: List[SubModConfig] # Get a list of unique game names uniqueGameNames = [] seenGameNames = set() for subMod in subModList: if subMod.modName not in seenGameNames: seenGameNames.add(subMod.modName) uniqueGameNames.append(subMod.modName) # Ask the user which game they want to install gameName = userPickFromList(uniqueGameNames, "Please choose the game you want to mod") # Get a list of variants with that name modVariants = [subMod for subMod in subModList if subMod.modName == gameName] #type: List[SubModConfig]