@cccode/fxr - v22.0.0

    Class FXR

    An effects resource (FXR, version 4 or 5) for FromSoftware's game engine. Used in Dark Souls III, Sekiro: Shadows Die Twice, Elden Ring, and Armored Core VI Fires of Rubicon.

    Index

    Constructors

    • Parameters

      • id: number

        Internal FXR ID. This ID is used to refer to the effect in other effects, or in params, TAE, and possibly other parts of the game.

        This ID must be between 1 and 999,999,999 (inclusive), and it must match the ID in the FXR's filename. If the internal ID does not match the filename, it may cause unexpected behavior.

      • terminate: boolean

        Controls whether or not to add a state that causes the effect to terminate when external value 0 becomes 1.

      • rootChildren: Node[]

        A list of nodes to add as direct children of the root node.

      Returns FXR

    • Parameters

      • id: number

        Internal FXR ID. This ID is used to refer to the effect in other effects, or in params, TAE, and possibly other parts of the game.

        This ID must be between 1 and 999,999,999 (inclusive), and it must match the ID in the FXR's filename. If the internal ID does not match the filename, it may cause unexpected behavior.

      • duration: number

        A duration for the effect. This is applied through a state with a condition that compares the state time to the duration value.

      • rootChildren: Node[]

        A list of nodes to add as direct children of the root node.

      Returns FXR

    • Parameters

      • id: number

        Internal FXR ID. This ID is used to refer to the effect in other effects, or in params, TAE, and possibly other parts of the game.

        This ID must be between 1 and 999,999,999 (inclusive), and it must match the ID in the FXR's filename. If the internal ID does not match the filename, it may cause unexpected behavior.

      • states: State[]

        A list of states for the effect.

      • rootChildren: Node[]

        A list of nodes to add as direct children of the root node.

      Returns FXR

    • Parameters

      • id: number

        Internal FXR ID. This ID is used to refer to the effect in other effects, or in params, TAE, and possibly other parts of the game.

        This ID must be between 1 and 999,999,999 (inclusive), and it must match the ID in the FXR's filename. If the internal ID does not match the filename, it may cause unexpected behavior.

      • terminate: boolean

        Controls whether or not to add a state that causes the effect to terminate when external value 0 becomes 1.

      • root: RootNode | GenericNode

        The root node of the effect.

      Returns FXR

    • Parameters

      • id: number

        Internal FXR ID. This ID is used to refer to the effect in other effects, or in params, TAE, and possibly other parts of the game.

        This ID must be between 1 and 999,999,999 (inclusive), and it must match the ID in the FXR's filename. If the internal ID does not match the filename, it may cause unexpected behavior.

      • duration: number

        A duration for the effect. This is applied through a state with a condition that compares the state time to the duration value.

      • root: RootNode | GenericNode

        The root node of the effect.

      Returns FXR

    • Parameters

      • id: number

        Internal FXR ID. This ID is used to refer to the effect in other effects, or in params, TAE, and possibly other parts of the game.

        This ID must be between 1 and 999,999,999 (inclusive), and it must match the ID in the FXR's filename. If the internal ID does not match the filename, it may cause unexpected behavior.

      • states: State[]

        A list of states for the effect.

      • root: RootNode | GenericNode

        The root node of the effect.

      Returns FXR

    Properties

    id: number
    states: State[]

    Accessors

    • get hasAppearance(): boolean

      True only if the effect contains an appearance action, and false otherwise. This may be useful for filtering FXR files that are "empty".

      Note that this does not check if any referenced FXR files have appearance actions, so an effect that only contains a proxy will return false.

      Returns boolean

    • get name(): string

      File name for this FXR.

      Note that this is not necessarily the name of the file that was parsed. It generates a new name based on the ID of the FXR. This follows the naming convention used by the games (f<0-padded ID>.fxr), so an FXR with 1 as the ID would be f000000001.fxr, for example.

      Returns string

    Methods

    • Finds and returns a value at a given path. If the path does not match anything, this returns null.

      For example, to get the appearance action in the second config in the first child node of the root node, you would use this path:

      fxr.find(['root', 'nodes', 0, 'configs', 1, 'appearance'])
      // Or in string form:
      fxr.find('root/nodes/0/configs/1/appearance')
      // Both are equivalent to this:
      fxr.root.nodes[0].configs[1].appearance

      Parameters

      • path: string | (string | number)[]

        The path to the value to look for.

      Returns any

    • Gets lists of various types of references in the FXR.

      Returns { externalValues1: number[]; externalValues2: number[]; sfx: number[] }

    • Lists all resources (textures, models, animations, sounds) used in the FXR. Useful for finding out what resources must exist for the effect to work correctly, which is often needed when converting from one game to another.

      Returns {
          anibnds: number[];
          models: number[];
          sounds: number[];
          textures: { resource: number; type: string }[];
      }

    • Creates a minified version of this FXR.

      The minified FXR might result in a smaller file size, but should be functionally identical to the FXR it was made from.

      Returns FXR

    • Saves the FXR to a file using the fs module from Node.js.

      Parameters

      • path: PathLike | FileHandle

        The path to the file.

      • game: Game

        The game to write this FXR for.

      Returns Promise<void>

    • Serialize to the FXR file format.

      Parameters

      • game: Game = Game.Heuristic

        The game to write this FXR for.

        Defaults to Game.Heuristic, which means it will use the game hint, unless the hint is also Game.Heuristic, in which case it will check if the FXR contains anything AC6-specific, and then use Game.ArmoredCore6 if it does, and otherwise throw an error, because the game is unknowable.

      Returns ArrayBuffer

      ArrayBuffer containing the contents of the FXR file.

    • Returns { id: number; root: any; states: (string | string[])[] }

    • Type Parameters

      • T extends typeof FXR

      Parameters

      • this: T
      • obj:
            | { id: number; root?: any; states?: (string | string[])[] }
            | { fxr: any; version: string }

      Returns InstanceType<T>

    • Parses an FXR file.

      This uses the fs module from Node.js to read the file. If you are targeting browers, pass an ArrayBuffer or ArrayBufferView of the contents of the file instead.

      Type Parameters

      • T extends typeof FXR

      Parameters

      • this: T
      • filePath: string

        A path to the FXR file to parse.

      • Optionalgame: Game

        The game the FXR file is for.

      • Optional__namedParameters: FXRReadOptions

      Returns Promise<InstanceType<T>>

    • Parses an FXR file.

      Type Parameters

      • T extends typeof FXR

      Parameters

      • this: T
      • buffer: ArrayBuffer | ArrayBufferView<ArrayBufferLike>

        ArrayBuffer or ArrayBufferView of the contents of the FXR file to parse.

      • Optionalgame: Game

        The game the FXR file is for. Defaults to Game.Heuristic, which will make the function try to figure out what it is for automatically.

        Accuracy of Game.Heuristic (with valid FXRs):

        • Dark Souls 3: Perfect, 100%
        • Sekiro: Perfect, 100%
        • Elden Ring: Low
        • Armored Core 6: Low

        For Elden Ring and Armored Core 6, it will still correctly parse the file, but gameHint will be very unreliable.

      • Optional__namedParameters: FXRReadOptions

      Returns InstanceType<T>

    MMNEPVFCICPMFPCPTTAAATR