Skip to content

Commit 03260a9

Browse files
committed
Just BasicModDataChecker
1 parent 5841233 commit 03260a9

1 file changed

Lines changed: 21 additions & 56 deletions

File tree

games/game_fantasylifei.py

Lines changed: 21 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -4,66 +4,31 @@
44

55
import mobase
66

7-
from ..basic_features.basic_local_savegames import BasicLocalSavegames
7+
from ..basic_features import BasicLocalSavegames, BasicModDataChecker, GlobPatterns
88
from ..basic_features.basic_save_game_info import BasicGameSaveGame
99
from ..basic_game import BasicGame
1010
from ..steam_utils import find_steam_path
1111

12-
13-
class FantasyLifeIModDataChecker(mobase.ModDataChecker):
14-
def __init__(self: mobase.ModDataChecker) -> None:
15-
super().__init__()
16-
17-
_PAK_MOD_EXTENSIONS = (".pak", ".ucas", ".utoc")
18-
19-
def _api_mod(self, tree: mobase.IFileTree, mods_path: str) -> bool:
20-
if not tree.exists(mods_path, mobase.IFileTree.DIRECTORY):
21-
return False
22-
23-
try:
24-
for mod_folder in tree.find(mods_path, mobase.IFileTree.DIRECTORY):
25-
for subentry in mod_folder:
26-
subname = subentry.name()
27-
28-
if subname.lower() == "mod.json" or subname.lower().endswith(
29-
".mod"
30-
):
31-
return True
32-
33-
except Exception:
34-
return False
35-
return False
36-
37-
def _pak_mod(self, tree: mobase.IFileTree, paks_path: str) -> bool:
38-
if not tree.exists(paks_path, mobase.IFileTree.DIRECTORY):
39-
return False
40-
41-
try:
42-
for entry in tree.find(paks_path, mobase.IFileTree.DIRECTORY):
43-
for subentry in entry:
44-
if subentry.name().lower().endswith(self._PAK_MOD_EXTENSIONS):
45-
return True
46-
47-
except Exception:
48-
return False
49-
return False
50-
51-
def dataLooksValid(
52-
self, filetree: mobase.IFileTree
53-
) -> mobase.ModDataChecker.CheckReturn:
54-
if filetree.exists("Game", mobase.IFileTree.DIRECTORY):
55-
pass
56-
57-
for mods_path in ["Mods"]:
58-
if self._api_mod(filetree, mods_path):
59-
return mobase.ModDataChecker.VALID
60-
61-
for paks_path in ["Paks"]:
62-
if self._pak_mod(filetree, paks_path):
63-
return mobase.ModDataChecker.VALID
64-
65-
return mobase.ModDataChecker.INVALID
66-
12+
class FantasyLifeIModDataChecker(BasicModDataChecker):
13+
def __init__(self):
14+
super().__init__(
15+
GlobPatterns(
16+
move=
17+
{
18+
"*.fliarchive": "Mods/",
19+
"*.pak": "Paks/~mods/",
20+
"*.ucas": "Paks/~mods/",
21+
"*.utoc": "Paks/~mods/",
22+
},
23+
valid=
24+
[
25+
"L10N",
26+
"sound",
27+
"Mods",
28+
"Paks"
29+
]
30+
)
31+
)
6732

6833
class FantasyLifeI(BasicGame, mobase.IPluginFileMapper):
6934
Name = "Fantasy Life I Support Plugin"

0 commit comments

Comments
 (0)