using Dalamud.Plugin; using Penumbra.Api.Api; using Penumbra.Api.Enums; using Penumbra.Api.Helpers; namespace Penumbra.Api.IpcSubscribers; /// public sealed class GetCollections(IDalamudPluginInterface pi) : FuncSubscriber>(pi, Label) { /// The label. public const string Label = $"Penumbra.{nameof(GetCollections)}.V5"; /// public new Dictionary Invoke() => base.Invoke(); /// Create a provider. public static FuncProvider> Provider(IDalamudPluginInterface pi, IPenumbraApiCollection api) => new(pi, Label, api.GetCollections); } /// public sealed class GetCollectionsByIdentifier(IDalamudPluginInterface pi) : FuncSubscriber>(pi, Label) { /// The label. public const string Label = $"Penumbra.{nameof(GetCollectionsByIdentifier)}"; /// public new List<(Guid Id, string Name)> Invoke(string name) => base.Invoke(name); /// Create a provider. public static FuncProvider> Provider(IDalamudPluginInterface pi, IPenumbraApiCollection api) => new(pi, Label, api.GetCollectionsByIdentifier); } /// public sealed class GetChangedItemsForCollection(IDalamudPluginInterface pi) : FuncSubscriber>(pi, Label) { /// The label. public const string Label = $"Penumbra.{nameof(GetChangedItemsForCollection)}"; /// public new Dictionary Invoke(Guid collectionId) => base.Invoke(collectionId); /// Create a provider. public static FuncProvider> Provider(IDalamudPluginInterface pi, IPenumbraApiCollection api) => new(pi, Label, api.GetChangedItemsForCollection); } /// public sealed class GetCollection(IDalamudPluginInterface pi) : FuncSubscriber(pi, Label) { /// The label. public const string Label = $"Penumbra.{nameof(GetCollection)}"; /// public (Guid Id, string Name)? Invoke(ApiCollectionType type) => Invoke((byte)type); /// Create a provider. public static FuncProvider Provider(IDalamudPluginInterface pi, IPenumbraApiCollection api) => new(pi, Label, b => api.GetCollection((ApiCollectionType)b)); } /// public sealed class GetCollectionForObject(IDalamudPluginInterface pi) : FuncSubscriber(pi, Label) { /// The label. public const string Label = $"Penumbra.{nameof(GetCollectionForObject)}.V5"; /// public new (bool ObjectValid, bool IndividualSet, (Guid Id, string Name) EffectiveCollection) Invoke(int gameObjectIdx) => base.Invoke(gameObjectIdx); /// Create a provider. public static FuncProvider Provider(IDalamudPluginInterface pi, IPenumbraApiCollection api) => new(pi, Label, api.GetCollectionForObject); } /// public sealed class SetCollection(IDalamudPluginInterface pi) : FuncSubscriber(pi, Label) { /// The label. public const string Label = $"Penumbra.{nameof(SetCollection)}"; /// public (PenumbraApiEc, (Guid Id, string Name)? OldCollection) Invoke(ApiCollectionType type, Guid? collectionId, bool allowCreateNew = true, bool allowDelete = true) { var (ec, pair) = Invoke((byte)type, collectionId, allowCreateNew, allowDelete); return ((PenumbraApiEc)ec, pair); } /// Create a provider. public static FuncProvider Provider(IDalamudPluginInterface pi, IPenumbraApiCollection api) => new(pi, Label, (t, g, a, b) => { var (ret, collection) = api.SetCollection((ApiCollectionType)t, g, a, b); return ((int)ret, collection); }); } /// public sealed class SetCollectionForObject(IDalamudPluginInterface pi) : FuncSubscriber(pi, Label) { /// The label. public const string Label = $"Penumbra.{nameof(SetCollectionForObject)}.V5"; /// public new (PenumbraApiEc, (Guid Id, string Name)? OldCollection) Invoke(int gameObjectIdx, Guid? collectionId, bool allowCreateNew = true, bool allowDelete = true) { var (ec, pair) = base.Invoke(gameObjectIdx, collectionId, allowCreateNew, allowDelete); return ((PenumbraApiEc)ec, pair); } /// Create a provider. public static FuncProvider Provider(IDalamudPluginInterface pi, IPenumbraApiCollection api) => new(pi, Label, (i, g, a, b) => { var (ret, collection) = api.SetCollectionForObject(i, g, a, b); return ((int)ret, collection); }); } /// public sealed class CheckCurrentChangedItemFunc(IDalamudPluginInterface pi) : FuncSubscriber>(pi, Label) { /// The label. public const string Label = $"Penumbra.{nameof(CheckCurrentChangedItemFunc)}"; /// public new Func Invoke() => base.Invoke(); /// Create a provider. public static FuncProvider> Provider(IDalamudPluginInterface pi, IPenumbraApiCollection api) => new(pi, Label, api.CheckCurrentChangedItemFunc); }