Repository navigation
Expand file tree
/
Copy pathgame_witcher3.py
More file actions
63 lines (50 loc) · 2.03 KB
/
Copy pathgame_witcher3.py
File metadata and controls
63 lines (50 loc) · 2.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
from pathlib import Path
from typing import List
from PyQt6.QtCore import QDir
import mobase
from ..basic_features import BasicGameSaveGameInfo
from ..basic_features.basic_save_game_info import BasicGameSaveGame
from ..basic_game import BasicGame
class Witcher3SaveGame(BasicGameSaveGame):
def allFiles(self):
return [self._filepath.name, self._filepath.name.replace(".sav", ".png")]
class Witcher3Game(BasicGame):
Name = "Witcher 3 Support Plugin"
Author = "Holt59"
Version = "1.0.0a"
GameName = "The Witcher 3: Wild Hunt"
GameShortName = "witcher3"
GaneNexusHame = "witcher3"
GameNexusId = 952
GameSteamId = [499450, 292030]
GameGogId = [1640424747, 1495134320, 1207664663, 1207664643]
GameBinary = "bin/x64/witcher3.exe"
# Next-gen installs may ship only the DX12 build (no bin/x64).
_DX12_BINARY = "bin/x64_dx12/witcher3.exe"
GameDataPath = "Mods"
GameSaveExtension = "sav"
GameDocumentsDirectory = "%DOCUMENTS%/The Witcher 3"
GameSavesDirectory = "%GAME_DOCUMENTS%/gamesaves"
GameSupportURL = (
r"https://github.com/ModOrganizer2/modorganizer-basic_games/wiki/"
"Game:-The-Witcher-3"
)
def init(self, organizer: mobase.IOrganizer):
super().init(organizer)
self._register_feature(BasicGameSaveGameInfo(lambda s: s.with_suffix(".png")))
return True
def binaryName(self) -> str:
game_dir = self.gameDirectory()
if not game_dir.exists(self.GameBinary) and game_dir.exists(self._DX12_BINARY):
return self._DX12_BINARY
return super().binaryName()
def looksValid(self, directory: QDir):
return directory.exists(self.GameBinary) or directory.exists(self._DX12_BINARY)
def iniFiles(self):
return ["user.settings", "input.settings"]
def listSaves(self, folder: QDir) -> List[mobase.ISaveGame]:
ext = self._mappings.savegameExtension.get()
return [
Witcher3SaveGame(path)
for path in Path(folder.absolutePath()).glob(f"*.{ext}")
]