Options
All
  • Public
  • Public/Protected
  • All
Menu

Module index

A collection of utility functions, objects and types for simplifying common logic in Vortex extensions.

Note that this default module only includes common utility components and some generic types. Check the other modules included in the package for more specialized components.

Import types from this module using

import { } from "vortex-ext-common";

Index

Functions

getCategoryName

  • getCategoryName(category: string, state: IState): string | undefined
  • Returns the actual name of a category with a given ID (such as from a mod's attributes).

    Parameters

    • category: string

      The category ID/attribute.

    • state: IState

      Application state.

    Returns string | undefined

    The name of the given category, or undefined if not found.

getDiscoveryPath

  • getDiscoveryPath(gameId: string, state: IState, extraRelPath?: string): string
  • Returns the current discoverd location for a given game.

    remarks

    This returns the actual game installation folder, not the staging folder.

    Parameters

    • gameId: string
    • state: IState

      The app state

    • Optional extraRelPath: string

      An additional relative path to append to the discovered path.

    Returns string

    The requested game (or executable) path if available, or undefined.

getGamePath

  • getGamePath(game: IGame, state?: IState, preferExecutablePath?: boolean): string
  • Returns the current installation path for a given game.

    remarks

    This returns the actual game installation folder, not the staging folder.

    Parameters

    • game: IGame

      The game object to retrieve the path for.

    • Optional state: IState

      The app state

    • Optional preferExecutablePath: boolean

      Whether to prefer the path to the game executable, or just the game directory.

    Returns string

    The requested game (or executable) path if available, or undefined.

getModName

  • getModName(mod: IMod, nameFallback?: string): string
  • getModName(destinationPath: string): string
  • Gets a user-friendly name for a given mod object, or installation path.

    Parameters

    • mod: IMod

      The mod object to retrieve the name of.

    • Optional nameFallback: string

    Returns string

  • Gets the mod name from an installation path.

    Parameters

    • destinationPath: string

      The destination path from an installer function

    Returns string

getModType

  • getModType(mod: IMod): string
  • Returns the mod type for the given mod (name if available, otherwise id)

    Parameters

    • mod: IMod

      The mod

    Returns string

    The mod type's name if available, otherwise the mod type's ID, otherwise 'default'.

isActiveGame

  • isActiveGame(api: IExtensionApi, gameId: string): boolean
  • isActiveGame(context: IExtensionContext, gameId: string): boolean
  • isActiveGame(store: ThunkStore<any>, gameId: string): boolean
  • Checks whether a given game is the currently managed game.

    Parameters

    • api: IExtensionApi

      The extension API object.

    • gameId: string

      The game ID to check.

    Returns boolean

  • Parameters

    • context: IExtensionContext
    • gameId: string

    Returns boolean

  • Parameters

    • store: ThunkStore<any>
    • gameId: string

    Returns boolean

isGameManaged

  • isGameManaged(api: IExtensionApi, gameId: string): boolean
  • Checks whether a given game ID has been managed with Vortex regardless of any mods being installed for it.

    Parameters

    • api: IExtensionApi

      The extension API.

    • gameId: string

      The game ID.

    Returns boolean

    Whether the given game is managed.

isGameProfile

  • isGameProfile(api: IExtensionApi, profileId: string, gameId: string): boolean
  • isGameProfile(store: ThunkStore<any>, profileId: string, gameId: string): boolean
  • isGameProfile(state: IState, profileId: string, gameId: string): boolean
  • Checks if the given profile is a profile for the given game ID.

    Parameters

    • api: IExtensionApi

      The extension API.

    • profileId: string

      The ID of the profile to check.

    • gameId: string

      The game ID to check against.

    Returns boolean

  • Parameters

    • store: ThunkStore<any>
    • profileId: string
    • gameId: string

    Returns boolean

  • Parameters

    • state: IState
    • profileId: string
    • gameId: string

    Returns boolean

isNexusMod

  • isNexusMod(api: IExtensionApi, modId: string): boolean
  • Checks if the given mod ID corresponds to a Nexus Mods-sourced mod.

    Parameters

    • api: IExtensionApi

      The extension API.

    • modId: string

      The mod ID.

    Returns boolean

    'true' if the mod is a Nexus-sourced mod, otherwise false.

loadLanguageContent

  • loadLanguageContent(api: IExtensionApi, ns: string, language?: string, fileName?: string): void
  • Parameters

    • api: IExtensionApi
    • ns: string
    • Optional language: string
    • Optional fileName: string

    Returns void

mergeStateArray

  • mergeStateArray<T>(state: IState, statePath: string[], payload: T[]): IState
  • Type parameters

    • T

    Parameters

    • state: IState
    • statePath: string[]
    • payload: T[]

    Returns IState

toAttributeInstructions

  • toAttributeInstructions(attributes: {}): IInstruction[]
  • Convenience function to convert an object of attributes (i.e. {"attributeName": "value"}) into install instructions.

    Parameters

    • attributes: {}

      Dictionary of mod attributes to map.

      • [key: string]: any

    Returns IInstruction[]

    Set of install instructions to set the required attributes.

Generated using TypeDoc