using Penumbra.Api.Enums; namespace Penumbra.Api.Api; /// API methods pertaining to the management of temporary collections and mods. public interface IPenumbraApiTemporary { /// Temporarily set the settings of a mod in a collection to given values. /// The collection to manipulate. /// Specify the mod via its directory name. /// Specify the mod via its (non-unique) display name. /// Whether the mod should be forced to inherit from parent collections (if this is true, the other settings do not matter). /// Whether the mod should be enabled or disabled. /// The desired priority for the mod. /// The new settings for the mod, as a map of Group Name -> All enabled Options (should be only one for single select groups). /// A string to describe the source of those temporary settings. This is displayed to the user. /// An optional lock to prevent other plugins and the user from changing these settings. Changes in mod structure will still remove the settings. Use 0 for no lock, or negative numbers for an identification lock that does not prevent the user from editing the temporary settings, but allows you to use with the same key to only remove your settings. /// Success, CollectionMissing if the collection does not exist, TemporarySettingImpossible if the collection can not have settings, ModMissing if the mod can not be identified, TemporarySettingDisallowed if there is already a temporary setting with a different key, OptionGroupMissing if a group can not be found, OptionMissing if an option can not be found. /// If not all groups are set in , they will be set to their default settings. public PenumbraApiEc SetTemporaryModSettings(Guid collectionId, string modDirectory, string modName, bool inherit, bool enabled, int priority, IReadOnlyDictionary> options, string source, int key); /// Temporarily set the settings of a mod in a collection to given values. /// The game object index of the object whose collection you want to change. /// Specify the mod via its directory name. /// Specify the mod via its (non-unique) display name. /// Whether the mod should be forced to inherit from parent collections (if this is true, the other settings do not matter). /// Whether the mod should be enabled or disabled. /// The desired priority for the mod. /// The new settings for the mod, as a map of Group Name -> All enabled Options (should be only one for single select groups). /// A string to describe the source of those temporary settings. This is displayed to the user. /// An optional lock to prevent other plugins and the user from changing these settings. Changes in mod structure will still remove the settings. Use 0 for no lock. /// Success, InvalidArgument if the game object does not exist, TemporarySettingImpossible if the collection can not have settings, ModMissing if the mod can not be identified, TemporarySettingDisallowed if there is already a temporary setting with a different key, OptionGroupMissing if a group can not be found, OptionMissing if an option can not be found. /// If not all groups are set in , they will be set to their default settings. public PenumbraApiEc SetTemporaryModSettingsPlayer(int objectIndex, string modDirectory, string modName, bool inherit, bool enabled, int priority, IReadOnlyDictionary> options, string source, int key); /// Temporarily set the settings of a mod in a collection to given values. /// The collection to manipulate. /// Specify the mod via its directory name. /// Specify the mod via its (non-unique) display name. /// An optional key to a potential lock applied to those settings. /// Success, NothingDone if no temporary settings could be removed with this key, CollectionMissing if the collection does not exist, TemporarySettingDisallowed if the key did not correspond to the lock. public PenumbraApiEc RemoveTemporaryModSettings(Guid collectionId, string modDirectory, string modName, int key); /// Temporarily set the settings of a mod in a collection to given values. /// The game object index of the object whose collection you want to change. /// Specify the mod via its directory name. /// Specify the mod via its (non-unique) display name. /// An optional key to a potential lock applied to those settings. /// Success, NothingDone if the mod did not have temporary settings in this collection, InvalidArgument if the game object does not exist, TemporarySettingDisallowed if the key did not correspond to the lock. public PenumbraApiEc RemoveTemporaryModSettingsPlayer(int objectIndex, string modDirectory, string modName, int key); /// Temporarily set the settings of a mod in a collection to given values. /// The collection to manipulate. /// An optional key to a lock applied to those settings. All settings that use this key will be removed, all others ignored. /// Success, NothingDone if no temporary settings could be removed with this key, CollectionMissing if the collection does not exist. public PenumbraApiEc RemoveAllTemporaryModSettings(Guid collectionId, int key); /// Temporarily set the settings of a mod in a collection to given values. /// The game object index of the object whose collection you want to change. /// An optional key to a lock applied to those settings. All settings that can be removed with this key will be removed, all others ignored. /// Success, NothingDone if no temporary settings could be removed with this key, InvalidArgument if the game object does not exist. public PenumbraApiEc RemoveAllTemporaryModSettingsPlayer(int objectIndex, int key); /// Create a temporary collection. /// The name for the collection. Arbitrary and only used internally for debugging. /// The GUID of the created temporary collection. public Guid CreateTemporaryCollection(string name); /// Remove the temporary collection of the given name. /// The chosen temporary collection to remove. /// NothingChanged or Success. public PenumbraApiEc DeleteTemporaryCollection(Guid collectionId); /// /// Assign an existing temporary collection to an actor that currently occupies a specific slot. /// /// The chosen collection assigned to the actor. /// The current object table index of the actor. /// Whether to assign even if the actor is already assigned either a temporary or a permanent collection. /// Success, InvalidArgument if the actor can not be identified, CollectionMissing if the collection does not exist, CharacterCollectionExists if is false and the actor is already assigned a collection, and AssignmentDeletionFailed if is true and the existing temporary assignment could not be deleted. public PenumbraApiEc AssignTemporaryCollection(Guid collectionId, int actorIndex, bool forceAssignment); /// /// Set a temporary mod with the given paths, manipulations and priority and the name tag to all regular and temporary collections. /// /// Custom name for the temporary mod. /// List of redirections (can be swaps or redirections). /// Zipped Base64 string of meta manipulations. /// Desired priority. /// InvalidGamePath, InvalidManipulation or Success. public PenumbraApiEc AddTemporaryModAll(string tag, Dictionary paths, string manipString, int priority); /// Set a temporary mod with the given paths, manipulations and priority and the name tag to a specific collection. /// /// Custom name for the temporary mod. /// GUID of the collection the mod should apply to. Can be a temporary collection. /// List of redirections (can be swaps or redirections). /// Zipped Base64 string of meta manipulations. /// Desired priority. /// CollectionMissing, InvalidGamePath, InvalidManipulation, InvalidArgument (GUID is nil) or Success. public PenumbraApiEc AddTemporaryMod(string tag, Guid collectionId, Dictionary paths, string manipString, int priority); /// /// Remove the temporary mod with the given tag and priority from the temporary mods applying to all collections, if it exists. /// /// The tag to look for. /// The initially provided priority. /// NothingDone or Success. public PenumbraApiEc RemoveTemporaryModAll(string tag, int priority); /// /// Remove the temporary mod with the given tag and priority from the temporary mods applying to a specific collection, if it exists. /// /// The tag to look for. /// GUID of the collection the mod should apply to. Can be a temporary collection. /// The initially provided priority. /// CollectionMissing, NothingDone or Success. public PenumbraApiEc RemoveTemporaryMod(string tag, Guid collectionId, int priority); /// Get the current temporary settings of a mod in the given collection. /// The collection to query. /// Specify the mod via its directory name. /// Specify the mod via its (non-unique) display name. /// The key for the settings lock. /// /// The settings as (ForceInherit, Enabled, Priority, Settings) or null if none are registered, /// the registered source for the temporary settings or empty, /// and Success, CollectionMissing, ModMissing or TemporarySettingDisallowed if the used key was > 0 and different from the provided key. /// public (PenumbraApiEc ErrorCode, (bool, bool, int, Dictionary>)?, string) QueryTemporaryModSettings(Guid collectionId, string modDirectory, string modName, int key); /// Get the current temporary settings of a mod in the collection assigned to a given game object. /// The game object index of the object whose collection you want to change. /// Specify the mod via its directory name. /// Specify the mod via its (non-unique) display name. /// The key for the settings lock. /// /// The settings as (ForceInherit, Enabled, Priority, Settings) or null if none are registered, /// the registered source for the temporary settings or empty, /// and Success, InvalidArgument if the game object does not exist, ModMissing, or TemporarySettingDisallowed if the used key was > 0 and different from the provided key. /// public (PenumbraApiEc ErrorCode, (bool, bool, int, Dictionary>)? Settings, string Source) QueryTemporaryModSettingsPlayer(int objectIndex, string modDirectory, string modName, int key); }