Skip to content

Commit d3c9758

Browse files
authored
Merge branch 'ModOrganizer2:master' into master
2 parents 5602c2a + 45359c5 commit d3c9758

5 files changed

Lines changed: 89 additions & 14 deletions

File tree

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ You can rename `modorganizer-basic_games-xxx` to whatever you want (e.g., `basic
6363
| Mount & Blade II: Bannerlord — [GOG](https://www.gog.com/game/mount_blade_ii_bannerlord) / [STEAM](https://store.steampowered.com/app/261550/Mount__Blade_II_Bannerlord/) | [Holt59](https://github.com/holt59/) | [game_mountandblade2.py](games/game_mountandblade2.py) | <ul><li>mod data checker</li></ul> |
6464
| Need for Speed: High Stakes | [uwx](https://github.com/uwx) | [game_nfshs.py](games/game_nfshs.py) | |
6565
| No Man's Sky - [GOG](https://www.gog.com/game/no_mans_sky) / [Steam](https://store.steampowered.com/app/275850/No_Mans_Sky/)|[EzioTheDeadPoet](https://eziothedeadpoet.github.io/AboutMe/)|[game_nomanssky.py](games/game_nomanssky.py)| |
66+
| Slay the Spire 2 — [STEAM](s.team/a/2868840) | [Azlle](https://github.com/Azlle) | [game_sts2.py](games/game_sts2.py) | <ul><li>mod data checker</li></ul> |
6667
| S.T.A.L.K.E.R. Anomaly — [MOD](https://www.stalker-anomaly.com/) | [Qudix](https://github.com/Qudix) | [game_stalkeranomaly.py](games/game_stalkeranomaly.py) | <ul><li>mod data checker</li></ul> |
6768
| Stardew Valley — [GOG](https://www.gog.com/game/stardew_valley) / [STEAM](https://store.steampowered.com/app/413150/Stardew_Valley/) | [Syer10](https://github.com/Syer10), [Holt59](https://github.com/holt59/) | [game_stardewvalley.py](games/game_stardewvalley.py) | <ul><li>mod data checker</li></ul> |
6869
| STAR WARS™ Empire at War: Gold Pack - [GOG](https://www.gog.com/game/star_wars_empire_at_war_gold_pack) / [STEAM](https://store.steampowered.com/app/32470/) | [erri120](https://github.com/erri120) | <ul><li>Empire at War: [game_starwars-empire-at-war.py](games/game_starwars-empire-at-war.py)</li><li>Force of Corruption: [game_starwars-empire-at-war-foc.py](games/game_starwars-empire-at-war-foc.py)</li></ul> | |

games/baldursgate3/bg3_utils.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,8 @@ def retrieve_mod_metadata_in_new_thread(mod: mobase.IModInterface):
250250
if mod.name() in metadata
251251
)
252252
+ self._mod_settings_xml_end
253-
)
253+
),
254+
encoding="utf-8",
254255
)
255256
qInfo(
256257
f"backing up generated file {self.modsettings_path} to {self.modsettings_backup}, "

games/game_baldursgate3.py

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -190,9 +190,7 @@ def _on_finished_run(self, exec_path: str, exit_code: int):
190190
moved: dict[str, str] = {}
191191
for path in self.utils.overwrite_path.rglob("*.log"):
192192
try:
193-
moved[str(path.relative_to(Path.home()))] = str(
194-
(self.utils.log_dir / path.name).relative_to(Path.home())
195-
)
193+
moved[str(path)] = str((self.utils.log_dir / path.name))
196194
path.replace(self.utils.log_dir / path.name)
197195
except PermissionError as e:
198196
qDebug(str(e))
@@ -201,9 +199,7 @@ def _on_finished_run(self, exec_path: str, exit_code: int):
201199
if path.name == "log.txt":
202200
dest = self.utils.log_dir / f"{path.parent.name}-{path.name}"
203201
try:
204-
moved[str(path.relative_to(Path.home()))] = str(
205-
dest.relative_to(Path.home())
206-
)
202+
moved[str(path)] = str(dest)
207203
path.replace(dest)
208204
except PermissionError as e:
209205
qDebug(str(e))
@@ -230,10 +226,8 @@ def _on_finished_run(self, exec_path: str, exit_code: int):
230226
for folder in sorted(list(fdir.walk(top_down=False)))[:-1]:
231227
try:
232228
folder[0].rmdir()
233-
removed.add(folder[0].relative_to(Path.home()))
229+
removed.add(folder[0])
234230
except OSError:
235231
pass
236232
if cat is not None and cat.isDebugEnabled() and len(removed) > 0:
237-
qDebug(
238-
f"cleaned empty dirs from {fdir.relative_to(Path.home())} {removed}"
239-
)
233+
qDebug(f"cleaned empty dirs from {fdir} {removed}")

games/game_divinityoriginalsin.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,6 @@ class DivinityOriginalSinGame(BasicGame):
3232
def init(self, organizer: mobase.IOrganizer):
3333
super().init(organizer)
3434
self._register_feature(
35-
BasicGameSaveGameInfo(
36-
lambda s: s.with_suffix(".png") # Not confirmed
37-
)
35+
BasicGameSaveGameInfo(lambda s: s.with_suffix(".png")) # Not confirmed
3836
)
3937
return True

games/game_sts2.py

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
from pathlib import Path
2+
3+
from PyQt6.QtCore import QDir, QFileInfo
4+
5+
import mobase
6+
7+
from ..basic_features import BasicModDataChecker, GlobPatterns
8+
from ..basic_features.basic_save_game_info import BasicGameSaveGame
9+
from ..basic_game import BasicGame
10+
11+
12+
class SlayTheSpire2ModDataChecker(BasicModDataChecker):
13+
def __init__(self):
14+
super().__init__(
15+
GlobPatterns(
16+
valid=[
17+
"*.pck",
18+
"*.dll",
19+
"*.json",
20+
],
21+
move={
22+
"*/*.pck": "",
23+
"*/*.dll": "",
24+
"*/*.json": "",
25+
},
26+
)
27+
)
28+
29+
30+
class SlayTheSpire2Game(BasicGame):
31+
Name = "Slay the Spire 2 Support Plugin"
32+
Author = "Azlle"
33+
Version = "1.0.1"
34+
35+
GameName = "Slay the Spire 2"
36+
GameShortName = "slaythespire2"
37+
GameNexusName = "slaythespire2"
38+
GameNexusId = 8916
39+
GameSteamId = 2868840
40+
GameBinary = "SlayTheSpire2.exe"
41+
GameDataPath = "mods"
42+
GameDocumentsDirectory = "%USERPROFILE%/AppData/Roaming/SlayTheSpire2"
43+
44+
def init(self, organizer: mobase.IOrganizer) -> bool:
45+
super().init(organizer)
46+
self._register_feature(SlayTheSpire2ModDataChecker())
47+
return True
48+
49+
def initializeProfile(self, directory: QDir, settings: mobase.ProfileSetting):
50+
mods_path = Path(self.dataDirectory().absolutePath())
51+
mods_path.mkdir(exist_ok=True)
52+
super().initializeProfile(directory, settings)
53+
54+
def savesDirectory(self) -> QDir:
55+
docs = QDir(self.documentsDirectory())
56+
steam_dir = Path(docs.absoluteFilePath("steam"))
57+
if steam_dir.exists():
58+
entries = [e for e in steam_dir.iterdir() if e.is_dir()]
59+
if entries:
60+
return QDir(str(entries[0]))
61+
return QDir(str(steam_dir))
62+
63+
def listSaves(self, folder: QDir) -> list[mobase.ISaveGame]:
64+
base = Path(folder.absolutePath())
65+
return [
66+
BasicGameSaveGame(save)
67+
for save in base.rglob("*")
68+
if save.is_file() and save.suffix in (".save", ".run")
69+
]
70+
71+
def executables(self):
72+
return [
73+
mobase.ExecutableInfo(
74+
"Slay the Spire 2",
75+
QFileInfo(self.gameDirectory().absoluteFilePath(self.binaryName())),
76+
),
77+
mobase.ExecutableInfo(
78+
"Slay the Spire 2 (OpenGL)",
79+
QFileInfo(self.gameDirectory().absoluteFilePath(self.binaryName())),
80+
).withArgument("--rendering-driver opengl3"),
81+
]

0 commit comments

Comments
 (0)