Skip to content

Commit 3262f22

Browse files
authored
Add support for Slay the Spire 2 (#216)
1 parent e293a98 commit 3262f22

2 files changed

Lines changed: 77 additions & 0 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/game_sts2.py

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
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.0"
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 savesDirectory(self) -> QDir:
50+
docs = QDir(self.documentsDirectory())
51+
steam_dir = Path(docs.absoluteFilePath("steam"))
52+
if steam_dir.exists():
53+
entries = [e for e in steam_dir.iterdir() if e.is_dir()]
54+
if entries:
55+
return QDir(str(entries[0]))
56+
return QDir(str(steam_dir))
57+
58+
def listSaves(self, folder: QDir) -> list[mobase.ISaveGame]:
59+
base = Path(folder.absolutePath())
60+
return [
61+
BasicGameSaveGame(save)
62+
for save in base.rglob("*")
63+
if save.is_file() and save.suffix in (".save", ".run")
64+
]
65+
66+
def executables(self):
67+
return [
68+
mobase.ExecutableInfo(
69+
"Slay the Spire 2",
70+
QFileInfo(self.gameDirectory().absoluteFilePath(self.binaryName())),
71+
),
72+
mobase.ExecutableInfo(
73+
"Slay the Spire 2 (OpenGL)",
74+
QFileInfo(self.gameDirectory().absoluteFilePath(self.binaryName())),
75+
).withArgument("--rendering-driver opengl3"),
76+
]

0 commit comments

Comments
 (0)