IPluginGame

class mobase.IPluginGame

Bases: IPlugin

Base classes for game plugins.

Each game requires a specific game plugin. These plugins were initially designed for Bethesda games, so a lot of methods and attributes are irrelevant for other games. If you wish to write a plugin for a much simpler game, please consider the basic_games plugin: https://github.com/ModOrganizer2/modorganizer-basic_games

Methods Summary

CCPlugins()

rtype:

Sequence[str]

DLCPlugins()

rtype:

Sequence[str]

binaryName()

rtype:

str

dataDirectory()

rtype:

QDir

detectGame()

Detect the game.

documentsDirectory()

rtype:

QDir

enabledPlugins()

rtype:

Sequence[str]

executableForcedLoads()

rtype:

Sequence[ExecutableForcedLoadSetting]

executables()

rtype:

Sequence[ExecutableInfo]

feature(feature_type)

Retrieve a specified game feature from this plugin.

featureList()

Retrieve the list of game features implemented for this plugin.

gameDirectory()

rtype:

QDir

gameIcon()

rtype:

QIcon

gameName()

rtype:

str

gameNexusName()

rtype:

str

gameShortName()

rtype:

str

gameVariants()

Retrieve the list of variants for this game.

gameVersion()

rtype:

str

getLauncherName()

rtype:

str

getSupportURL()

rtype:

str

iniFiles()

rtype:

Sequence[str]

initializeProfile(directory, settings)

Initialize a profile for this game.

isInstalled()

rtype:

bool

listSaves(folder)

List saves in the given directory.

loadOrderMechanism()

rtype:

LoadOrderMechanism

looksValid(directory)

Check if the given directory looks like a valid game installation.

nexusGameID()

Retrieve the Nexus game ID for this game.

nexusModOrganizerID()

Retrieve the Nexus mod ID of Mod Organizer for this game.

primaryPlugins()

rtype:

Sequence[str]

primarySources()

Retrieve primary alternative 'short' names for this game.

savesDirectory()

rtype:

QDir

secondaryDataDirectories()

Retrieve the list of secondary data directories.

setGamePath(path)

Set the path to the managed game.

setGameVariant(variant)

Set the game variant.

sortMechanism()

rtype:

SortMechanism

steamAPPId()

Retrieve the Steam app ID for this game.

validShortNames()

Retrieve the valid 'short' names for this game.

Methods Documentation

CCPlugins()
Return type:

Sequence[str]

Returns:

The current list of active Creation Club plugins.

DLCPlugins()
Return type:

Sequence[str]

Returns:

The list of esp/esm files that are part of known DLCs.

abstract binaryName()
Return type:

str

Returns:

The name of the default executable to run (relative to the game folder).

abstract dataDirectory()
Return type:

QDir

Returns:

The path to the directory containing data (absolute path).

abstract detectGame()

Detect the game.

This method is the first called for game plugins (before init()). The following methods should work properly after the call to detectGame() (and before init()): :rtype: None

  • gameName()

  • isInstalled()

  • gameIcon()

  • gameDirectory()

  • dataDirectory()

  • gameVariants()

  • looksValid()

See IPlugin.init() for more.

abstract documentsDirectory()
Return type:

QDir

Returns:

The directory of the documents folder where configuration files and such for this game reside.

enabledPlugins()
Return type:

Sequence[str]

Returns:

A list of plugins enabled by the game but not in a strict load order.

abstract executableForcedLoads()
Return type:

Sequence[ExecutableForcedLoadSetting]

Returns:

A list of automatically discovered libraries that can be force loaded with executables.

executables()
Return type:

Sequence[ExecutableInfo]

Returns:

A list of automatically discovered executables of the game itself and tools surrounding it.

feature(feature_type)

Retrieve a specified game feature from this plugin.

Return type:

TypeVar(GameFeatureType)

Parameters:

feature_type – The class of feature to retrieve.

Returns:

The game feature corresponding to the given type, or None if the feature is

not implemented.

featureList()

Retrieve the list of game features implemented for this plugin.

Python plugin should not implement this method but _featureList().

Return type:

dict[Type[TypeVar(GameFeatureType)], TypeVar(GameFeatureType)]

Returns:

A mapping from feature type to actual game features.

abstract gameDirectory()
Return type:

QDir

Returns:

The directory containing the game installation.

abstract gameIcon()
Return type:

QIcon

Returns:

The icon representing the game.

abstract gameName()
Return type:

str

Returns:

The name of the game (as displayed to the user).

gameNexusName()
Return type:

str

Returns:

The name of the game identifier for Nexus.

abstract gameShortName()
Return type:

str

Returns:

The short name of the game.

gameVariants()

Retrieve the list of variants for this game.

If there are multiple variants of a game (and the variants make a difference to the plugin), like a regular one and a GOTY-edition, the plugin can return a list of them and the user gets to chose which one he owns.

Return type:

Sequence[str]

Returns:

The list of variants of the game.

abstract gameVersion()
Return type:

str

Returns:

The version of the game.

abstract getLauncherName()
Return type:

str

Returns:

The name of the launcher executable to run (relative to the game folder), or an

empty string if there is no launcher.

abstract getSupportURL()
Return type:

str

Returns:

An URL for the support page of this game.

iniFiles()
Return type:

Sequence[str]

Returns:

The list of INI files this game uses. The first file in the list should be the

‘main’ INI file.

abstract initializeProfile(directory, settings)

Initialize a profile for this game.

The MO app does not yet support virtualizing only specific aspects but plugins should be written with this future functionality in mind.

This function will be used to initially create a profile, potentially to repair it or upgrade/downgrade it so the implementations have to gracefully handle the case that the directory already contains files.

Return type:

None

Parameters:
  • directory – The directory where the profile is to be initialized.

  • settings – The parameters for how the profile should be initialized.

abstract isInstalled()
Return type:

bool

Returns:

True if this game has been discovered as installed, False otherwise.

abstract listSaves(folder)

List saves in the given directory.

Return type:

List[ISaveGame]

Parameters:

folder – The folder to list saves from.

Returns:

The list of game saves in the given folder.

loadOrderMechanism()
Return type:

LoadOrderMechanism

Returns:

The load order mechanism used by this game.

abstract looksValid(directory)

Check if the given directory looks like a valid game installation.

Return type:

bool

Parameters:

directory – Directory to check.

Returns:

True if the directory looks like a valid installation of this game, False otherwise.

abstract nexusGameID()

Retrieve the Nexus game ID for this game.

Example: For Skyrim, the Nexus game ID is 110.

Return type:

int

Returns:

The Nexus game ID for this game.

nexusModOrganizerID()

Retrieve the Nexus mod ID of Mod Organizer for this game.

Return type:

int

Example: For Skyrim SE, the mod ID of MO2 is 6194. You can find the mod ID in the URL:

https://www.nexusmods.com/skyrimspecialedition/mods/6194

Returns:

The Nexus mod ID of Mod Organizer for this game.

primaryPlugins()
Return type:

Sequence[str]

Returns:

The list of plugins that are part of the game and not considered optional.

primarySources()

Retrieve primary alternative ‘short’ names for this game.

This is used to determine if a Nexus (or other) download source should be considered as a primary source for the game so that it is not flagged as an alternative one.

Return type:

Sequence[str]

Returns:

The list of primary alternative ‘short’ names for this game, or an empty list.

abstract savesDirectory()
Return type:

QDir

Returns:

The directory where save games are stored.

secondaryDataDirectories()

Retrieve the list of secondary data directories. Each directories should be assigned a unique name that differs from “data” which is the name of the main data directory returned by dataDirectory().

Return type:

Dict[str, QDir]

Returns:

A mapping from unique name to secondary data directories.

abstract setGamePath(path)

Set the path to the managed game.

This is called during instance creation if the game is not auto-detected and the user has to specify the installation location. This is not called if the game has been auto-detected, so isInstalled() should call this.

Return type:

None

Parameters:

path – Path to the game installation.

abstract setGameVariant(variant)

Set the game variant.

If there are multiple variants of game (as returned by gameVariants()), this will be called on start with the user-selected game variant.

Return type:

None

Parameters:

variant – The game variant selected by the user.

sortMechanism()
Return type:

SortMechanism

Returns:

The sort mechanism for this game.

steamAPPId()

Retrieve the Steam app ID for this game.

If the game is not available on Steam, this should return an empty string.

If a game is available in multiple versions, those might have different app ids. The plugin should try to return the right one

Return type:

str

Returns:

The Steam app ID for this game. Should be empty for games not available on steam.

abstract validShortNames()

Retrieve the valid ‘short’ names for this game.

This is used to determine if a Nexus download is valid for the current game since not all game variants have their own nexus pages and others can handle downloads from other nexus game pages and should be allowed to do so (e.g., you can install some Skyrim LE mod even when using Skyrim SE).

The short name should be considered the primary handler for a directly supported game for purposes of auto-launching an instance.

Return type:

Sequence[str]

Returns:

The list of valid short names for this game.