From 6636569f94e1d7bdc7fba4a571bf0e0082dfc42a Mon Sep 17 00:00:00 2001 From: AmeliaCute <48628282+AmeliaCute@users.noreply.github.com> Date: Sat, 19 Jul 2025 20:02:35 +0100 Subject: [PATCH 1/9] WIP do not work --- games/game_fantasylifei.py | 48 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 games/game_fantasylifei.py diff --git a/games/game_fantasylifei.py b/games/game_fantasylifei.py new file mode 100644 index 0000000..2041e2d --- /dev/null +++ b/games/game_fantasylifei.py @@ -0,0 +1,48 @@ + +from PyQt6.QtCore import QFileInfo +import mobase +from ..basic_game import BasicGame + +class FLiMLModContentChecker(modbase.ModDataChecker): + def __init__(self): + super().__init__() + + def dataLooksValid( + self, filetree: mobase.IFileTree + ) -> mobase.ModDataChecker.CheckReturn: + for e in filetree: + if isinstance(e, mobase.IFileTree) and e.exists( + "mod.json", mobase.IFileTree.FILE + ): + return mobase.ModDataChecker.VALID + + return mobase.ModDataChecker.INVALID + +class FantasyLifeI(BasicGame): + Name = "Fantasy Life I Support Plugin" + Author = "AmeliaCute" + Version = "0.2.0" + + GameName = "Fantasy Life i: The Girl who Steals Time" + GameShortName = "fantasylifei" + GameNexusName = "fantasylifeithegirlwhostealstime" + GameValidShortNames = ["fli"] + + GameBinary = "Game/Binaries/Win64/NFL1-Win64-Shipping.exe" + GameLauncher = "NFL1.exe" + + GameSteamId = 2993780 + GameDataPath = "Mods" + + def init(self, organizer: mobase.IOrganizer): + super().init(organizer) + self._register_feature(FLiMLModContentChecker) + return True + + def executables(self): + return [ + mobase.ExecutableInfo( + "Fantasy Life i", QFileInfo(self.gameDirectory(), "Game/Binaries/Win64/NFL1-Win64-Shipping.exe") + ), + ] + From cff1ca65b2959351367683770791cf586329a8e8 Mon Sep 17 00:00:00 2001 From: AmeliaCute <48628282+AmeliaCute@users.noreply.github.com> Date: Wed, 23 Jul 2025 05:25:02 +0100 Subject: [PATCH 2/9] WIP --- games/game_fantasylifei.py | 134 +++++++++++++++++++++++++++++++------ 1 file changed, 112 insertions(+), 22 deletions(-) diff --git a/games/game_fantasylifei.py b/games/game_fantasylifei.py index 2041e2d..692f843 100644 --- a/games/game_fantasylifei.py +++ b/games/game_fantasylifei.py @@ -1,48 +1,138 @@ -from PyQt6.QtCore import QFileInfo +from PyQt6.QtCore import QDir import mobase + +from pathlib import Path +from ..basic_features.basic_save_game_info import BasicGameSaveGame +from ..basic_features.basic_local_savegames import BasicLocalSavegames +from ..steam_utils import find_steam_path from ..basic_game import BasicGame -class FLiMLModContentChecker(modbase.ModDataChecker): - def __init__(self): +class FantasyLifeIModDataChecker(mobase.ModDataChecker): + def __init__(self: mobase.ModDataChecker) -> None: super().__init__() - def dataLooksValid( - self, filetree: mobase.IFileTree - ) -> mobase.ModDataChecker.CheckReturn: - for e in filetree: - if isinstance(e, mobase.IFileTree) and e.exists( - "mod.json", mobase.IFileTree.FILE - ): - return mobase.ModDataChecker.VALID - + def dataLooksValid(self: mobase.ModDataChecker, filetree: mobase.IFileTree) -> mobase.ModDataChecker.CheckReturn: + if filetree.exists("Game", mobase.IFileTree.DIRECTORY): + return mobase.ModDataChecker.INVALID + + if filetree.exists("Mods", mobase.IFileTree.DIRECTORY) or filetree.exists("Paks", mobase.IFileTree.DIRECTORY): + return mobase.ModDataChecker.VALID + return mobase.ModDataChecker.INVALID -class FantasyLifeI(BasicGame): + +class FantasyLifeI(BasicGame, + mobase.IPluginFileMapper, + mobase.IPluginInstallerSimple + ): + Name = "Fantasy Life I Support Plugin" Author = "AmeliaCute" - Version = "0.2.0" + Version = "0.2.1" - GameName = "Fantasy Life i: The Girl who Steals Time" + GameName = "FANTASY LIFE i" GameShortName = "fantasylifei" GameNexusName = "fantasylifeithegirlwhostealstime" GameValidShortNames = ["fli"] - + + GameDataPath = "Game/Content/" GameBinary = "Game/Binaries/Win64/NFL1-Win64-Shipping.exe" - GameLauncher = "NFL1.exe" - GameSteamId = 2993780 - GameDataPath = "Mods" + + GameSupportURL = ( + r"https://github.com/ModOrganizer2/modorganizer-basic_games/wiki/" + "Game:-Fantasy-Life-I:-The-Girl-Who-Steals-Time" + ) + + def __init__(self): + BasicGame.__init__(self) + mobase.IPluginFileMapper.__init__(self) + mobase.IPluginInstallerSimple.__init__(self) - def init(self, organizer: mobase.IOrganizer): + def init(self, organizer: mobase.IOrganizer) -> bool: super().init(organizer) - self._register_feature(FLiMLModContentChecker) + self._register_feature(FantasyLifeIModDataChecker()) + self._register_feature(BasicLocalSavegames(self.savesDirectory())) return True def executables(self): return [ mobase.ExecutableInfo( - "Fantasy Life i", QFileInfo(self.gameDirectory(), "Game/Binaries/Win64/NFL1-Win64-Shipping.exe") + "Fantasy Life i", self.GameBinary ), ] + ## SAVE + + # credit to game.darkestdungeon.py + @staticmethod + def getCloudSaveDirectory() -> str | None: + steamPath = find_steam_path() + if steamPath is None: + return None + + userData = steamPath.joinpath("userdata") + for child in userData.iterdir(): + name = child.name + try: + int(name) + except ValueError: + continue + + cloudSaves = child.joinpath("2993780/remote") + if cloudSaves.exists() and cloudSaves.is_dir(): + return str(cloudSaves) + return None + + def savesDirectory(self) -> QDir: + return QDir(self.getCloudSaveDirectory()) + + def listSaves(self, folder: QDir) -> list[mobase.ISaveGame]: + saves: list[Path] = [] + for path in Path(folder.absolutePath()).glob("*.bin"): + saves.append(path) + + ##TODO: need a proper implementation + return [BasicGameSaveGame(path) for path in saves] + + ## MAPPING + + def exeDirectory(self) -> QDir: return QDir(QDir(self.gameDirectory()).filePath("Game/Binaries/Win64")) + + def mappings(self) -> list[mobase.Mapping]: + return [ + mobase.Mapping("*.dll", self.exeDirectory().absolutePath(), False, True), + ] + + ## INSTALLER + + _PAK_EXTENSIONS = ('.pak', '.ucas', '.utoc') + + def priority(self) -> int: + return 150 + + def isArchiveSupported(self, tree: mobase.IFileTree) -> bool: + for entry in tree: + if entry.name().lower().endswith(self._PAK_EXTENSIONS): return True + + if tree.exists("Mod.json", mobase.IFileTree.FILE): return True + return False + + def install(self, name: mobase.GuessedString, tree: mobase.IFileTree, version: str, nexus_id: int) -> mobase.InstallResult: + + for entry in list(tree): + if entry.name().lower().endswith(self._PAK_EXTENSIONS): + paks_dir = QDir(".").filePath("Paks") + target_dir = QDir(paks_dir).filePath("~mods/") + QDir().mkpath(target_dir) + tree.move(entry, target_dir) + + if tree.exists("Mod.json", mobase.IFileTree.FILE): + mods_dir = QDir(".").filePath("Mods") + target_dir = QDir(mods_dir).filePath(f"{name.__str__()}/") + QDir().mkpath(target_dir) + + for entry in list(tree): tree.move(entry, target_dir) + + return mobase.InstallResult.SUCCESS \ No newline at end of file From 684bbec8b39bfc4b73f8cc93d77ea2011802aa44 Mon Sep 17 00:00:00 2001 From: AmeliaCute <48628282+AmeliaCute@users.noreply.github.com> Date: Wed, 23 Jul 2025 05:50:25 +0100 Subject: [PATCH 3/9] Lil tweaks --- games/game_fantasylifei.py | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/games/game_fantasylifei.py b/games/game_fantasylifei.py index 692f843..721a095 100644 --- a/games/game_fantasylifei.py +++ b/games/game_fantasylifei.py @@ -59,7 +59,7 @@ def init(self, organizer: mobase.IOrganizer) -> bool: def executables(self): return [ mobase.ExecutableInfo( - "Fantasy Life i", self.GameBinary + "Fantasy Life I", self.GameBinary ), ] @@ -120,19 +120,14 @@ def isArchiveSupported(self, tree: mobase.IFileTree) -> bool: return False def install(self, name: mobase.GuessedString, tree: mobase.IFileTree, version: str, nexus_id: int) -> mobase.InstallResult: - + paks_dir = QDir(".").filePath("Paks/~mods/") + mods_dir = QDir(".").filePath(f"Mods/{name.__str__()}/") + for entry in list(tree): if entry.name().lower().endswith(self._PAK_EXTENSIONS): - paks_dir = QDir(".").filePath("Paks") - target_dir = QDir(paks_dir).filePath("~mods/") - QDir().mkpath(target_dir) - tree.move(entry, target_dir) + tree.move(entry, paks_dir) if tree.exists("Mod.json", mobase.IFileTree.FILE): - mods_dir = QDir(".").filePath("Mods") - target_dir = QDir(mods_dir).filePath(f"{name.__str__()}/") - QDir().mkpath(target_dir) - - for entry in list(tree): tree.move(entry, target_dir) + for entry in list(tree): tree.move(entry, mods_dir) return mobase.InstallResult.SUCCESS \ No newline at end of file From 4ca49789632c043005a2a40dfec17059a0b40cff Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 23 Jul 2025 05:20:09 +0000 Subject: [PATCH 4/9] [pre-commit.ci] Auto fixes from pre-commit.com hooks. --- games/game_fantasylifei.py | 70 ++++++++++++++++++++++---------------- 1 file changed, 40 insertions(+), 30 deletions(-) diff --git a/games/game_fantasylifei.py b/games/game_fantasylifei.py index 721a095..2539a0b 100644 --- a/games/game_fantasylifei.py +++ b/games/game_fantasylifei.py @@ -1,32 +1,34 @@ +from pathlib import Path from PyQt6.QtCore import QDir + import mobase -from pathlib import Path -from ..basic_features.basic_save_game_info import BasicGameSaveGame from ..basic_features.basic_local_savegames import BasicLocalSavegames -from ..steam_utils import find_steam_path +from ..basic_features.basic_save_game_info import BasicGameSaveGame from ..basic_game import BasicGame +from ..steam_utils import find_steam_path + class FantasyLifeIModDataChecker(mobase.ModDataChecker): def __init__(self: mobase.ModDataChecker) -> None: super().__init__() - def dataLooksValid(self: mobase.ModDataChecker, filetree: mobase.IFileTree) -> mobase.ModDataChecker.CheckReturn: + def dataLooksValid( + self: mobase.ModDataChecker, filetree: mobase.IFileTree + ) -> mobase.ModDataChecker.CheckReturn: if filetree.exists("Game", mobase.IFileTree.DIRECTORY): return mobase.ModDataChecker.INVALID - - if filetree.exists("Mods", mobase.IFileTree.DIRECTORY) or filetree.exists("Paks", mobase.IFileTree.DIRECTORY): + + if filetree.exists("Mods", mobase.IFileTree.DIRECTORY) or filetree.exists( + "Paks", mobase.IFileTree.DIRECTORY + ): return mobase.ModDataChecker.VALID - + return mobase.ModDataChecker.INVALID -class FantasyLifeI(BasicGame, - mobase.IPluginFileMapper, - mobase.IPluginInstallerSimple - ): - +class FantasyLifeI(BasicGame, mobase.IPluginFileMapper, mobase.IPluginInstallerSimple): Name = "Fantasy Life I Support Plugin" Author = "AmeliaCute" Version = "0.2.1" @@ -35,11 +37,11 @@ class FantasyLifeI(BasicGame, GameShortName = "fantasylifei" GameNexusName = "fantasylifeithegirlwhostealstime" GameValidShortNames = ["fli"] - + GameDataPath = "Game/Content/" GameBinary = "Game/Binaries/Win64/NFL1-Win64-Shipping.exe" GameSteamId = 2993780 - + GameSupportURL = ( r"https://github.com/ModOrganizer2/modorganizer-basic_games/wiki/" "Game:-Fantasy-Life-I:-The-Girl-Who-Steals-Time" @@ -55,12 +57,10 @@ def init(self, organizer: mobase.IOrganizer) -> bool: self._register_feature(FantasyLifeIModDataChecker()) self._register_feature(BasicLocalSavegames(self.savesDirectory())) return True - + def executables(self): return [ - mobase.ExecutableInfo( - "Fantasy Life I", self.GameBinary - ), + mobase.ExecutableInfo("Fantasy Life I", self.GameBinary), ] ## SAVE @@ -71,7 +71,7 @@ def getCloudSaveDirectory() -> str | None: steamPath = find_steam_path() if steamPath is None: return None - + userData = steamPath.joinpath("userdata") for child in userData.iterdir(): name = child.name @@ -98,7 +98,8 @@ def listSaves(self, folder: QDir) -> list[mobase.ISaveGame]: ## MAPPING - def exeDirectory(self) -> QDir: return QDir(QDir(self.gameDirectory()).filePath("Game/Binaries/Win64")) + def exeDirectory(self) -> QDir: + return QDir(QDir(self.gameDirectory()).filePath("Game/Binaries/Win64")) def mappings(self) -> list[mobase.Mapping]: return [ @@ -107,27 +108,36 @@ def mappings(self) -> list[mobase.Mapping]: ## INSTALLER - _PAK_EXTENSIONS = ('.pak', '.ucas', '.utoc') + _PAK_EXTENSIONS = (".pak", ".ucas", ".utoc") def priority(self) -> int: return 150 def isArchiveSupported(self, tree: mobase.IFileTree) -> bool: for entry in tree: - if entry.name().lower().endswith(self._PAK_EXTENSIONS): return True - - if tree.exists("Mod.json", mobase.IFileTree.FILE): return True + if entry.name().lower().endswith(self._PAK_EXTENSIONS): + return True + + if tree.exists("Mod.json", mobase.IFileTree.FILE): + return True return False - def install(self, name: mobase.GuessedString, tree: mobase.IFileTree, version: str, nexus_id: int) -> mobase.InstallResult: + def install( + self, + name: mobase.GuessedString, + tree: mobase.IFileTree, + version: str, + nexus_id: int, + ) -> mobase.InstallResult: paks_dir = QDir(".").filePath("Paks/~mods/") mods_dir = QDir(".").filePath(f"Mods/{name.__str__()}/") - + for entry in list(tree): if entry.name().lower().endswith(self._PAK_EXTENSIONS): tree.move(entry, paks_dir) - + if tree.exists("Mod.json", mobase.IFileTree.FILE): - for entry in list(tree): tree.move(entry, mods_dir) - - return mobase.InstallResult.SUCCESS \ No newline at end of file + for entry in list(tree): + tree.move(entry, mods_dir) + + return mobase.InstallResult.SUCCESS From e368934b9c486638e703887ce29321db211036b5 Mon Sep 17 00:00:00 2001 From: AmeliaCute <48628282+AmeliaCute@users.noreply.github.com> Date: Wed, 27 Aug 2025 17:28:56 +0100 Subject: [PATCH 5/9] Removing IPluginInstallerSimple --- games/game_fantasylifei.py | 97 ++++++++++++++++++-------------------- 1 file changed, 46 insertions(+), 51 deletions(-) diff --git a/games/game_fantasylifei.py b/games/game_fantasylifei.py index 2539a0b..16f8912 100644 --- a/games/game_fantasylifei.py +++ b/games/game_fantasylifei.py @@ -9,29 +9,62 @@ from ..basic_game import BasicGame from ..steam_utils import find_steam_path - class FantasyLifeIModDataChecker(mobase.ModDataChecker): def __init__(self: mobase.ModDataChecker) -> None: super().__init__() - def dataLooksValid( - self: mobase.ModDataChecker, filetree: mobase.IFileTree - ) -> mobase.ModDataChecker.CheckReturn: + _PAK_MOD_EXTENSIONS = (".pak", ".ucas", ".utoc") + + def _api_mod(self, tree: mobase.IFileTree, mods_path: str) -> bool: + if not tree.exists(mods_path, mobase.IFileTree.DIRECTORY): + return False + + try: + for mod_folder in tree.find(mods_path, mobase.IFileTree.DIRECTORY): + folder_name = mod_folder.name(); + + for subentry in mod_folder: + subname = subentry.name(); + + if subname.lower() == "mod.json" or subname.lower().endswith('.mod'): + return True + + except Exception: + return False + return False + + def _pak_mod(self, tree: mobase.IFileTree, paks_path: str) -> bool: + if not tree.exists(paks_path, mobase.IFileTree.DIRECTORY): + return False + + try: + for entry in tree.find(paks_path, mobase.IFileTree.DIRECTORY): + for subentry in entry: + if subentry.name().lower().endswith(self._PAK_MOD_EXTENSIONS): + return True + + except Exception: + return False + return False + + def dataLooksValid(self, filetree: mobase.IFileTree) -> mobase.ModDataChecker.CheckReturn: if filetree.exists("Game", mobase.IFileTree.DIRECTORY): - return mobase.ModDataChecker.INVALID + pass - if filetree.exists("Mods", mobase.IFileTree.DIRECTORY) or filetree.exists( - "Paks", mobase.IFileTree.DIRECTORY - ): - return mobase.ModDataChecker.VALID + for mods_path in ["Mods"]: + if self._api_mod(filetree, mods_path): + return mobase.ModDataChecker.VALID - return mobase.ModDataChecker.INVALID + for paks_path in ["Paks"]: + if self._pak_mod(filetree, paks_path): + return mobase.ModDataChecker.VALID + return mobase.ModDataChecker.INVALID -class FantasyLifeI(BasicGame, mobase.IPluginFileMapper, mobase.IPluginInstallerSimple): +class FantasyLifeI(BasicGame, mobase.IPluginFileMapper): Name = "Fantasy Life I Support Plugin" Author = "AmeliaCute" - Version = "0.2.1" + Version = "0.2.2" GameName = "FANTASY LIFE i" GameShortName = "fantasylifei" @@ -50,7 +83,6 @@ class FantasyLifeI(BasicGame, mobase.IPluginFileMapper, mobase.IPluginInstallerS def __init__(self): BasicGame.__init__(self) mobase.IPluginFileMapper.__init__(self) - mobase.IPluginInstallerSimple.__init__(self) def init(self, organizer: mobase.IOrganizer) -> bool: super().init(organizer) @@ -64,7 +96,6 @@ def executables(self): ] ## SAVE - # credit to game.darkestdungeon.py @staticmethod def getCloudSaveDirectory() -> str | None: @@ -104,40 +135,4 @@ def exeDirectory(self) -> QDir: def mappings(self) -> list[mobase.Mapping]: return [ mobase.Mapping("*.dll", self.exeDirectory().absolutePath(), False, True), - ] - - ## INSTALLER - - _PAK_EXTENSIONS = (".pak", ".ucas", ".utoc") - - def priority(self) -> int: - return 150 - - def isArchiveSupported(self, tree: mobase.IFileTree) -> bool: - for entry in tree: - if entry.name().lower().endswith(self._PAK_EXTENSIONS): - return True - - if tree.exists("Mod.json", mobase.IFileTree.FILE): - return True - return False - - def install( - self, - name: mobase.GuessedString, - tree: mobase.IFileTree, - version: str, - nexus_id: int, - ) -> mobase.InstallResult: - paks_dir = QDir(".").filePath("Paks/~mods/") - mods_dir = QDir(".").filePath(f"Mods/{name.__str__()}/") - - for entry in list(tree): - if entry.name().lower().endswith(self._PAK_EXTENSIONS): - tree.move(entry, paks_dir) - - if tree.exists("Mod.json", mobase.IFileTree.FILE): - for entry in list(tree): - tree.move(entry, mods_dir) - - return mobase.InstallResult.SUCCESS + ] \ No newline at end of file From 1a52db6a812fe15e567252a07de42bcebe7bcea1 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 27 Aug 2025 16:30:02 +0000 Subject: [PATCH 6/9] [pre-commit.ci] Auto fixes from pre-commit.com hooks. --- games/game_fantasylifei.py | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/games/game_fantasylifei.py b/games/game_fantasylifei.py index 16f8912..88a53d0 100644 --- a/games/game_fantasylifei.py +++ b/games/game_fantasylifei.py @@ -9,6 +9,7 @@ from ..basic_game import BasicGame from ..steam_utils import find_steam_path + class FantasyLifeIModDataChecker(mobase.ModDataChecker): def __init__(self: mobase.ModDataChecker) -> None: super().__init__() @@ -18,15 +19,17 @@ def __init__(self: mobase.ModDataChecker) -> None: def _api_mod(self, tree: mobase.IFileTree, mods_path: str) -> bool: if not tree.exists(mods_path, mobase.IFileTree.DIRECTORY): return False - + try: for mod_folder in tree.find(mods_path, mobase.IFileTree.DIRECTORY): - folder_name = mod_folder.name(); + folder_name = mod_folder.name() for subentry in mod_folder: - subname = subentry.name(); + subname = subentry.name() - if subname.lower() == "mod.json" or subname.lower().endswith('.mod'): + if subname.lower() == "mod.json" or subname.lower().endswith( + ".mod" + ): return True except Exception: @@ -47,7 +50,9 @@ def _pak_mod(self, tree: mobase.IFileTree, paks_path: str) -> bool: return False return False - def dataLooksValid(self, filetree: mobase.IFileTree) -> mobase.ModDataChecker.CheckReturn: + def dataLooksValid( + self, filetree: mobase.IFileTree + ) -> mobase.ModDataChecker.CheckReturn: if filetree.exists("Game", mobase.IFileTree.DIRECTORY): pass @@ -61,6 +66,7 @@ def dataLooksValid(self, filetree: mobase.IFileTree) -> mobase.ModDataChecker.Ch return mobase.ModDataChecker.INVALID + class FantasyLifeI(BasicGame, mobase.IPluginFileMapper): Name = "Fantasy Life I Support Plugin" Author = "AmeliaCute" @@ -135,4 +141,4 @@ def exeDirectory(self) -> QDir: def mappings(self) -> list[mobase.Mapping]: return [ mobase.Mapping("*.dll", self.exeDirectory().absolutePath(), False, True), - ] \ No newline at end of file + ] From 5841233e126186b3a956cd445ff9caa98e3a4f7c Mon Sep 17 00:00:00 2001 From: AmeliaCute <48628282+AmeliaCute@users.noreply.github.com> Date: Wed, 27 Aug 2025 17:39:37 +0100 Subject: [PATCH 7/9] Remove unused variable assignment in mod folder iteration --- games/game_fantasylifei.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/games/game_fantasylifei.py b/games/game_fantasylifei.py index 88a53d0..15b2959 100644 --- a/games/game_fantasylifei.py +++ b/games/game_fantasylifei.py @@ -22,8 +22,6 @@ def _api_mod(self, tree: mobase.IFileTree, mods_path: str) -> bool: try: for mod_folder in tree.find(mods_path, mobase.IFileTree.DIRECTORY): - folder_name = mod_folder.name() - for subentry in mod_folder: subname = subentry.name() From 03260a9518e6a40b1283f02b0bb9fcafc347f275 Mon Sep 17 00:00:00 2001 From: AmeliaCute <48628282+AmeliaCute@users.noreply.github.com> Date: Thu, 4 Sep 2025 03:40:49 +0100 Subject: [PATCH 8/9] Just BasicModDataChecker --- games/game_fantasylifei.py | 77 +++++++++++--------------------------- 1 file changed, 21 insertions(+), 56 deletions(-) diff --git a/games/game_fantasylifei.py b/games/game_fantasylifei.py index 15b2959..b8afe5b 100644 --- a/games/game_fantasylifei.py +++ b/games/game_fantasylifei.py @@ -4,66 +4,31 @@ import mobase -from ..basic_features.basic_local_savegames import BasicLocalSavegames +from ..basic_features import BasicLocalSavegames, BasicModDataChecker, GlobPatterns from ..basic_features.basic_save_game_info import BasicGameSaveGame from ..basic_game import BasicGame from ..steam_utils import find_steam_path - -class FantasyLifeIModDataChecker(mobase.ModDataChecker): - def __init__(self: mobase.ModDataChecker) -> None: - super().__init__() - - _PAK_MOD_EXTENSIONS = (".pak", ".ucas", ".utoc") - - def _api_mod(self, tree: mobase.IFileTree, mods_path: str) -> bool: - if not tree.exists(mods_path, mobase.IFileTree.DIRECTORY): - return False - - try: - for mod_folder in tree.find(mods_path, mobase.IFileTree.DIRECTORY): - for subentry in mod_folder: - subname = subentry.name() - - if subname.lower() == "mod.json" or subname.lower().endswith( - ".mod" - ): - return True - - except Exception: - return False - return False - - def _pak_mod(self, tree: mobase.IFileTree, paks_path: str) -> bool: - if not tree.exists(paks_path, mobase.IFileTree.DIRECTORY): - return False - - try: - for entry in tree.find(paks_path, mobase.IFileTree.DIRECTORY): - for subentry in entry: - if subentry.name().lower().endswith(self._PAK_MOD_EXTENSIONS): - return True - - except Exception: - return False - return False - - def dataLooksValid( - self, filetree: mobase.IFileTree - ) -> mobase.ModDataChecker.CheckReturn: - if filetree.exists("Game", mobase.IFileTree.DIRECTORY): - pass - - for mods_path in ["Mods"]: - if self._api_mod(filetree, mods_path): - return mobase.ModDataChecker.VALID - - for paks_path in ["Paks"]: - if self._pak_mod(filetree, paks_path): - return mobase.ModDataChecker.VALID - - return mobase.ModDataChecker.INVALID - +class FantasyLifeIModDataChecker(BasicModDataChecker): + def __init__(self): + super().__init__( + GlobPatterns( + move= + { + "*.fliarchive": "Mods/", + "*.pak": "Paks/~mods/", + "*.ucas": "Paks/~mods/", + "*.utoc": "Paks/~mods/", + }, + valid= + [ + "L10N", + "sound", + "Mods", + "Paks" + ] + ) + ) class FantasyLifeI(BasicGame, mobase.IPluginFileMapper): Name = "Fantasy Life I Support Plugin" From 715d3837fadd2a32cb51d0a24a181b443a865de1 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu, 4 Sep 2025 02:41:15 +0000 Subject: [PATCH 9/9] [pre-commit.ci] Auto fixes from pre-commit.com hooks. --- games/game_fantasylifei.py | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/games/game_fantasylifei.py b/games/game_fantasylifei.py index b8afe5b..15e565b 100644 --- a/games/game_fantasylifei.py +++ b/games/game_fantasylifei.py @@ -9,27 +9,22 @@ from ..basic_game import BasicGame from ..steam_utils import find_steam_path + class FantasyLifeIModDataChecker(BasicModDataChecker): def __init__(self): super().__init__( GlobPatterns( - move= - { + move={ "*.fliarchive": "Mods/", - "*.pak": "Paks/~mods/", - "*.ucas": "Paks/~mods/", - "*.utoc": "Paks/~mods/", + "*.pak": "Paks/~mods/", + "*.ucas": "Paks/~mods/", + "*.utoc": "Paks/~mods/", }, - valid= - [ - "L10N", - "sound", - "Mods", - "Paks" - ] + valid=["L10N", "sound", "Mods", "Paks"], ) ) + class FantasyLifeI(BasicGame, mobase.IPluginFileMapper): Name = "Fantasy Life I Support Plugin" Author = "AmeliaCute"