IPluginGame

class mobase.IPluginGame

Bases: mobase.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()

returns

The current list of active Creation Club plugins.

DLCPlugins()

returns

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

binaryName()

returns

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

dataDirectory()

returns

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

detectGame()

Detect the game.

documentsDirectory()

returns

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

executableForcedLoads()

returns

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

executables()

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.

featureList()

Retrieve the list of game features implemented for this plugin.

gameDirectory()

returns

The directory containing the game installation.

gameIcon()

returns

The icon representing the game.

gameName()

returns

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

gameNexusName()

returns

The name of the game identifier for Nexus.

gameShortName()

returns

The short name of the game.

gameVariants()

Retrieve the list of variants for this game.

gameVersion()

returns

The version of the game.

getLauncherName()

returns

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

iniFiles()

returns

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

initializeProfile(directory, settings)

Initialize a profile for this game.

isInstalled()

returns

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

listSaves(folder)

List saves in the given directory.

loadOrderMechanism()

returns

The load order mechanism used by this game.

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()

returns

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

primarySources()

Retrieve primary alternative ‘short’ names for this game.

savesDirectory()

returns

The directory where save games are stored.

setGamePath(path)

Set the path to the managed game.

setGameVariant(variant)

Set the game variant.

sortMechanism()

returns

The sort mechanism for this game.

steamAPPId()

Retrieve the Steam app ID for this game.

validShortNames()

Retrieve the valid ‘short’ names for this game.

Methods Documentation

abstract CCPlugins()
Returns

The current list of active Creation Club plugins.

Return type

List[str]

abstract DLCPlugins()
Returns

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

Return type

List[str]

abstract binaryName()
Returns

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

Return type

str

abstract dataDirectory()
Returns

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

Return type

QDir

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()):

  • gameName()

  • isInstalled()

  • gameIcon()

  • gameDirectory()

  • dataDirectory()

  • gameVariants()

  • looksValid()

See IPlugin.init() for more.

abstract documentsDirectory()
Returns

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

Return type

QDir

abstract executableForcedLoads()
Returns

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

Return type

List[ExecutableForcedLoadSetting]

abstract executables()
Returns

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

Return type

List[ExecutableInfo]

feature(feature_type)

Retrieve a specified game feature from this plugin.

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.

Return type

~GameFeatureType

featureList()

Retrieve the list of game features implemented for this plugin.

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

Returns

A mapping from feature type to actual game features.

Return type

Dict[Type[~GameFeatureType], ~GameFeatureType]

abstract gameDirectory()
Returns

The directory containing the game installation.

Return type

QDir

abstract gameIcon()
Returns

The icon representing the game.

Return type

QIcon

abstract gameName()
Returns

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

Return type

str

abstract gameNexusName()
Returns

The name of the game identifier for Nexus.

Return type

str

abstract gameShortName()
Returns

The short name of the game.

Return type

str

abstract 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.

Returns

The list of variants of the game.

Return type

List[str]

abstract gameVersion()
Returns

The version of the game.

Return type

str

abstract getLauncherName()
Returns

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

empty string if there is no launcher.

Return type

str

abstract iniFiles()
Returns

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

‘main’ INI file.

Return type

List[str]

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.

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

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

abstract isInstalled()
Returns

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

Return type

bool

abstract listSaves(folder)

List saves in the given directory.

Parameters

folder – The folder to list saves from.

Returns

The list of game saves in the given folder.

Return type

List[ISaveGame]

abstract loadOrderMechanism()
Returns

The load order mechanism used by this game.

Return type

LoadOrderMechanism

abstract looksValid(directory)

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

Parameters

directory – Directory to check.

Returns

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

Return type

bool

abstract nexusGameID()

Retrieve the Nexus game ID for this game.

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

Returns

The Nexus game ID for this game.

Return type

int

abstract nexusModOrganizerID()

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

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.

Return type

int

abstract primaryPlugins()
Returns

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

Return type

List[str]

abstract 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.

Returns

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

Return type

List[str]

abstract savesDirectory()
Returns

The directory where save games are stored.

Return type

QDir

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.

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.

Parameters

variant – The game variant selected by the user.

abstract sortMechanism()
Returns

The sort mechanism for this game.

Return type

SortMechanism

abstract 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

Returns

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

Return type

str

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.

Returns

The list of valid short names for this game.

Return type

List[str]