diff --git a/basic_game.py b/basic_game.py index 9be478d..7bbd785 100644 --- a/basic_game.py +++ b/basic_game.py @@ -20,6 +20,11 @@ def replace_variables(value: str, game: "BasicGame") -> str: "%DOCUMENTS%", QStandardPaths.writableLocation(QStandardPaths.DocumentsLocation), ) + if value.find("%USERPROFILE%") != -1: + value = value.replace( + "%USERPROFILE%", + QStandardPaths.writableLocation(QStandardPaths.HomeLocation), + ) if value.find("%GAME_DOCUMENTS%") != -1: value = value.replace( "%GAME_DOCUMENTS%", game.documentsDirectory().absolutePath() @@ -349,7 +354,11 @@ def version(self) -> mobase.VersionInfo: return self._mappings.version.get() def isActive(self) -> bool: - return True + if not self._organizer.managedGame(): + return False + + # Note: self is self._organizer.managedGame() does not work: + return self.name() == self._organizer.managedGame().name() def settings(self) -> List[mobase.PluginSetting]: return [] diff --git a/games/game_darkestdungeon.py b/games/game_darkestdungeon.py index 406c2e0..f0c3e59 100644 --- a/games/game_darkestdungeon.py +++ b/games/game_darkestdungeon.py @@ -10,22 +10,23 @@ class DarkestDungeonGame(BasicGame): Name = "DarkestDungeon" Author = "erri120" - Version = "0.1.0" + Version = "0.1.1" GameName = "Darkest Dungeon" GameShortName = "darkestdungeon" GameNexusName = "darkestdungeon" GameNexusId = 804 GameSteamId = 262060 - GameBinary = "_windows//darkest.exe" + GameGogId = 1719198803 + GameBinary = "_windowsnosteam//darkest.exe" GameDataPath = "" def executables(self): + path = QFileInfo(self.gameDirectory(), "_windows/darkest.exe") + if not path.exists(): + path = QFileInfo(self.gameDirectory(), "_windowsnosteam/darkest.exe") return [ - mobase.ExecutableInfo( - "Darkest Dungeon", - QFileInfo(self.gameDirectory(), "_windows//darkest.exe"), - ), + mobase.ExecutableInfo("Darkest Dungeon", path), ] def savesDirectory(self): diff --git a/games/game_kingdomcomedeliverance.py b/games/game_kingdomcomedeliverance.py new file mode 100644 index 0000000..3d0a493 --- /dev/null +++ b/games/game_kingdomcomedeliverance.py @@ -0,0 +1,42 @@ +# -*- encoding: utf-8 -*- + +from ..basic_game import BasicGame + +import os +from PyQt5.QtCore import QDir + + +class KingdomComeDeliveranceGame(BasicGame): + Name = "Kingdom Come Deliverance Support Plugin" + Author = "Silencer711" + Version = "1.0.0" + + GameName = "Kingdom Come: Deliverance" + GameShortName = "kingdomcomedeliverance" + GameNexusName = "kingdomcomedeliverance" + GameNexusId = 2298 + GameSteamId = [379430] + GameGogId = [1719198803] + GameBinary = "bin/Win64/KingdomCome.exe" + GameDataPath = "mods" + GameSaveExtension = "whs" + GameDocumentsDirectory = "%GAME_PATH%" + GameSavesDirectory = "%USERPROFILE%/Saved Games/kingdomcome/saves" + + def iniFiles(self): + return ["custom.cfg", "system.cfg", "user.cfg"] + + def initializeProfile(self, path: QDir, settings: int): + # Create .cfg files if they don't exist + for iniFile in self.iniFiles(): + iniPath = self.documentsDirectory().absoluteFilePath(iniFile) + if not os.path.exists(iniPath): + with open(iniPath, "w") as _: + pass + + # Create the mods directory if it doesn't exist + modsPath = self.dataDirectory().absolutePath() + if not os.path.exists(modsPath): + os.mkdir(modsPath) + + super().initializeProfile(path, settings) diff --git a/games/game_nomanssky.py b/games/game_nomanssky.py new file mode 100644 index 0000000..cf6baba --- /dev/null +++ b/games/game_nomanssky.py @@ -0,0 +1,18 @@ +# -*- encoding: utf-8 -*- + +from ..basic_game import BasicGame + + +class NoMansSkyGame(BasicGame): + + Name = "Mo Man's Sky Support Plugin" + Author = "Luca/EzioTheDeadPoet" + Version = "1.0.0" + + GameName = "Mo Man's Sky" + GameShortName = "nomanssky" + GaneNexusHame = "nomanssky" + GameSteamId = 275850 + GameGogId = 1446213994 + GameBinary = "Binaries/NMS.exe" + GameDataPath = "GAMEDATA/PCBANKS/MODS"