Add support for Slay the Spire 2 (#216)

This commit is contained in:
Eeshta
2026-04-18 10:39:51 +02:00
committed by GitHub
parent e293a98ab8
commit 3262f22ed8
2 changed files with 77 additions and 0 deletions
+1
View File
@@ -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) | <ul><li>mod data checker</li></ul> |
| 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) | <ul><li>mod data checker</li></ul> |
| 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> |
| 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> |
| 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> | |
+76
View File
@@ -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"),
]