diff --git a/README.md b/README.md index 2c0e98b..9a63b38 100644 --- a/README.md +++ b/README.md @@ -63,6 +63,7 @@ You can rename `modorganizer-basic_games-xxx` to whatever you want (e.g., `basic | 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) | | | Need for Speed: High Stakes | [uwx](https://github.com/uwx) | [game_nfshs.py](games/game_nfshs.py) | | | 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)| | +| Slay the Spire 2 — [STEAM](s.team/a/2868840) | [Azlle](https://github.com/Azlle) | [game_sts2.py](games/game_sts2.py) | | | 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) | | | 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) | | | 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) | | | diff --git a/games/game_sts2.py b/games/game_sts2.py new file mode 100644 index 0000000..4d1fe3a --- /dev/null +++ b/games/game_sts2.py @@ -0,0 +1,76 @@ +from pathlib import Path + +from PyQt6.QtCore import QDir, QFileInfo + +import mobase + +from ..basic_features import BasicModDataChecker, GlobPatterns +from ..basic_features.basic_save_game_info import BasicGameSaveGame +from ..basic_game import BasicGame + + +class SlayTheSpire2ModDataChecker(BasicModDataChecker): + def __init__(self): + super().__init__( + GlobPatterns( + valid=[ + "*.pck", + "*.dll", + "*.json", + ], + move={ + "*/*.pck": "", + "*/*.dll": "", + "*/*.json": "", + }, + ) + ) + + +class SlayTheSpire2Game(BasicGame): + Name = "Slay the Spire 2 Support Plugin" + Author = "Azlle" + Version = "1.0.0" + + GameName = "Slay the Spire 2" + GameShortName = "slaythespire2" + GameNexusName = "slaythespire2" + GameNexusId = 8916 + GameSteamId = 2868840 + GameBinary = "SlayTheSpire2.exe" + GameDataPath = "mods" + GameDocumentsDirectory = "%USERPROFILE%/AppData/Roaming/SlayTheSpire2" + + def init(self, organizer: mobase.IOrganizer) -> bool: + super().init(organizer) + self._register_feature(SlayTheSpire2ModDataChecker()) + return True + + def savesDirectory(self) -> QDir: + docs = QDir(self.documentsDirectory()) + steam_dir = Path(docs.absoluteFilePath("steam")) + if steam_dir.exists(): + entries = [e for e in steam_dir.iterdir() if e.is_dir()] + if entries: + return QDir(str(entries[0])) + return QDir(str(steam_dir)) + + def listSaves(self, folder: QDir) -> list[mobase.ISaveGame]: + base = Path(folder.absolutePath()) + return [ + BasicGameSaveGame(save) + for save in base.rglob("*") + if save.is_file() and save.suffix in (".save", ".run") + ] + + def executables(self): + return [ + mobase.ExecutableInfo( + "Slay the Spire 2", + QFileInfo(self.gameDirectory().absoluteFilePath(self.binaryName())), + ), + mobase.ExecutableInfo( + "Slay the Spire 2 (OpenGL)", + QFileInfo(self.gameDirectory().absoluteFilePath(self.binaryName())), + ).withArgument("--rendering-driver opengl3"), + ]