mirror of
https://github.com/Ottermandias/Glamourer.git
synced 2025-12-12 10:17:23 +01:00
Extract API to own project.
This commit is contained in:
parent
0268546f63
commit
21aa3e8efc
18 changed files with 28 additions and 505 deletions
1
Glamourer.Api
Submodule
1
Glamourer.Api
Submodule
|
|
@ -0,0 +1 @@
|
|||
Subproject commit 0c8578cfa12bf0591ed204fd89b30b66719f678f
|
||||
|
|
@ -19,6 +19,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Penumbra.String", "Penumbra
|
|||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OtterGui", "OtterGui\OtterGui.csproj", "{EF233CE2-F243-449E-BE05-72B9D110E419}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Glamourer.Api", "Glamourer.Api\Glamourer.Api.csproj", "{9B46691B-FAB2-4CC3-9B89-C8B91A590F47}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
|
|
@ -45,6 +47,10 @@ Global
|
|||
{EF233CE2-F243-449E-BE05-72B9D110E419}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{EF233CE2-F243-449E-BE05-72B9D110E419}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{EF233CE2-F243-449E-BE05-72B9D110E419}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{9B46691B-FAB2-4CC3-9B89-C8B91A590F47}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{9B46691B-FAB2-4CC3-9B89-C8B91A590F47}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{9B46691B-FAB2-4CC3-9B89-C8B91A590F47}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{9B46691B-FAB2-4CC3-9B89-C8B91A590F47}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
|
|
|||
|
|
@ -1,8 +0,0 @@
|
|||
namespace Glamourer.Api.Api;
|
||||
|
||||
public interface IGlamourerApi : IGlamourerApiBase
|
||||
{
|
||||
public IGlamourerApiDesigns Designs { get; }
|
||||
public IGlamourerApiItems Items { get; }
|
||||
public IGlamourerApiState State { get; }
|
||||
}
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
namespace Glamourer.Api.Api;
|
||||
|
||||
public interface IGlamourerApiBase
|
||||
{
|
||||
public (int Major, int Minor) ApiVersion { get; }
|
||||
}
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
using Glamourer.Api.Enums;
|
||||
|
||||
namespace Glamourer.Api.Api;
|
||||
|
||||
public interface IGlamourerApiDesigns
|
||||
{
|
||||
public Dictionary<Guid, string> GetDesignList();
|
||||
|
||||
public GlamourerApiEc ApplyDesign(Guid designId, int objectIndex, uint key, ApplyFlag flags);
|
||||
|
||||
public GlamourerApiEc ApplyDesignName(Guid designId, string objectName, uint key, ApplyFlag flags);
|
||||
}
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
using Glamourer.Api.Enums;
|
||||
|
||||
namespace Glamourer.Api.Api;
|
||||
|
||||
public interface IGlamourerApiItems
|
||||
{
|
||||
public GlamourerApiEc SetItem(int objectIndex, ApiEquipSlot apiSlot, ulong itemId, byte stain, uint key, ApplyFlag flags);
|
||||
public GlamourerApiEc SetItemName(string objectName, ApiEquipSlot slot, ulong itemId, byte stain, uint key, ApplyFlag flags);
|
||||
}
|
||||
|
|
@ -1,28 +0,0 @@
|
|||
using Glamourer.Api.Enums;
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
namespace Glamourer.Api.Api;
|
||||
|
||||
public interface IGlamourerApiState
|
||||
{
|
||||
public (GlamourerApiEc, JObject?) GetState(int objectIndex, uint key);
|
||||
public (GlamourerApiEc, JObject?) GetStateName(string objectName, uint key);
|
||||
|
||||
public GlamourerApiEc ApplyState(object applyState, int objectIndex, uint key, ApplyFlag flags);
|
||||
|
||||
public GlamourerApiEc ApplyStateName(object state, string objectName, uint key, ApplyFlag flags);
|
||||
|
||||
public GlamourerApiEc RevertState(int objectIndex, uint key, ApplyFlag flags);
|
||||
public GlamourerApiEc RevertStateName(string objectName, uint key, ApplyFlag flags);
|
||||
|
||||
public GlamourerApiEc UnlockState(int objectIndex, uint key);
|
||||
public GlamourerApiEc UnlockStateName(string objectName, uint key);
|
||||
public int UnlockAll(uint key);
|
||||
|
||||
public GlamourerApiEc RevertToAutomation(int objectIndex, uint key, ApplyFlag flags);
|
||||
public GlamourerApiEc RevertToAutomationName(string objectName, uint key, ApplyFlag flags);
|
||||
|
||||
public event Action<nint>? StateChanged;
|
||||
|
||||
public event Action<bool>? GPoseChanged;
|
||||
}
|
||||
|
|
@ -1,34 +0,0 @@
|
|||
namespace Glamourer.Api.Enums;
|
||||
|
||||
[Flags]
|
||||
public enum ApplyFlag : ulong
|
||||
{
|
||||
Once = 0x01,
|
||||
Equipment = 0x02,
|
||||
Customization = 0x04,
|
||||
Lock = 0x08,
|
||||
}
|
||||
|
||||
public static class ApplyFlagEx
|
||||
{
|
||||
public const ApplyFlag DesignDefault = ApplyFlag.Once | ApplyFlag.Equipment | ApplyFlag.Customization;
|
||||
public const ApplyFlag StateDefault = ApplyFlag.Equipment | ApplyFlag.Customization | ApplyFlag.Lock;
|
||||
public const ApplyFlag RevertDefault = ApplyFlag.Equipment | ApplyFlag.Customization;
|
||||
}
|
||||
|
||||
public enum ApiEquipSlot : byte
|
||||
{
|
||||
Unknown = 0,
|
||||
MainHand = 1,
|
||||
OffHand = 2,
|
||||
Head = 3,
|
||||
Body = 4,
|
||||
Hands = 5,
|
||||
Legs = 7,
|
||||
Feet = 8,
|
||||
Ears = 9,
|
||||
Neck = 10,
|
||||
Wrists = 11,
|
||||
RFinger = 12,
|
||||
LFinger = 14, // Not officially existing, means "weapon could be equipped in either hand" for the game.
|
||||
}
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
namespace Glamourer.Api.Enums;
|
||||
|
||||
public enum GlamourerApiEc
|
||||
{
|
||||
Success,
|
||||
ActorNotFound,
|
||||
ActorNotHuman,
|
||||
DesignNotFound,
|
||||
ItemInvalid,
|
||||
InvalidKey,
|
||||
InvalidState,
|
||||
NothingDone,
|
||||
}
|
||||
|
|
@ -1,8 +1,8 @@
|
|||
using Glamourer.Api.Api;
|
||||
using OtterGui.Services;
|
||||
|
||||
namespace Glamourer.Api;
|
||||
|
||||
using Glamourer.Api.Api;
|
||||
using OtterGui.Services;
|
||||
|
||||
namespace Glamourer.Api;
|
||||
|
||||
public class GlamourerApi(DesignsApi designs, StateApi state, ItemsApi items) : IGlamourerApi, IApiService
|
||||
{
|
||||
public const int CurrentApiVersionMajor = 1;
|
||||
|
|
@ -19,4 +19,4 @@ public class GlamourerApi(DesignsApi designs, StateApi state, ItemsApi items) :
|
|||
|
||||
public IGlamourerApiState State
|
||||
=> state;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
using Dalamud.Plugin;
|
||||
using Glamourer.Api.Api;
|
||||
using Glamourer.Api.Helpers;
|
||||
using OtterGui.Services;
|
||||
using Penumbra.Api.Helpers;
|
||||
|
||||
namespace Glamourer.Api;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,52 +0,0 @@
|
|||
using Dalamud.Plugin;
|
||||
using Glamourer.Api.Api;
|
||||
using Glamourer.Api.Enums;
|
||||
using Penumbra.Api.Helpers;
|
||||
|
||||
namespace Glamourer.Api.IpcSubscribers;
|
||||
|
||||
/// <inheritdoc cref="IGlamourerApiDesigns.GetDesignList"/>
|
||||
public sealed class GetDesignList(DalamudPluginInterface pi)
|
||||
: FuncSubscriber<Dictionary<Guid, string>>(pi, Label)
|
||||
{
|
||||
/// <summary> The label. </summary>
|
||||
public const string Label = $"Glamourer.{nameof(GetDesignList)}";
|
||||
|
||||
/// <inheritdoc cref="IGlamourerApiDesigns.GetDesignList"/>
|
||||
public new Dictionary<Guid, string> Invoke()
|
||||
=> base.Invoke();
|
||||
|
||||
/// <summary> Create a provider. </summary>
|
||||
public static FuncProvider<Dictionary<Guid, string>> Provider(DalamudPluginInterface pi, IGlamourerApiDesigns api)
|
||||
=> new(pi, Label, api.GetDesignList);
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="IGlamourerApiDesigns.ApplyDesign"/>
|
||||
public sealed class ApplyDesign(DalamudPluginInterface pi) : FuncSubscriber<Guid, int, uint, ulong, int>(pi, Label)
|
||||
{
|
||||
/// <summary> The label. </summary>
|
||||
public const string Label = $"Glamourer.{nameof(ApplyDesign)}";
|
||||
|
||||
/// <inheritdoc cref="IGlamourerApiDesigns.ApplyDesign"/>
|
||||
public GlamourerApiEc Invoke(Guid designId, int objectIndex, uint key = 0, ApplyFlag flags = ApplyFlagEx.DesignDefault)
|
||||
=> (GlamourerApiEc)Invoke(designId, objectIndex, key, (ulong)flags);
|
||||
|
||||
/// <summary> Create a provider. </summary>
|
||||
public static FuncProvider<Guid, int, uint, ulong, int> Provider(DalamudPluginInterface pi, IGlamourerApiDesigns api)
|
||||
=> new(pi, Label, (a, b, c, d) => (int)api.ApplyDesign(a, b, c, (ApplyFlag)d));
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="IGlamourerApiDesigns.ApplyDesignName"/>
|
||||
public sealed class ApplyDesignName(DalamudPluginInterface pi) : FuncSubscriber<Guid, string, uint, ulong, int>(pi, Label)
|
||||
{
|
||||
/// <summary> The label. </summary>
|
||||
public const string Label = $"Glamourer.{nameof(ApplyDesignName)}";
|
||||
|
||||
/// <inheritdoc cref="IGlamourerApiDesigns.ApplyDesignName"/>
|
||||
public GlamourerApiEc Invoke(Guid designId, string objectName, uint key = 0, ApplyFlag flags = ApplyFlagEx.DesignDefault)
|
||||
=> (GlamourerApiEc)Invoke(designId, objectName, key, (ulong)flags);
|
||||
|
||||
/// <summary> Create a provider. </summary>
|
||||
public static FuncProvider<Guid, string, uint, ulong, int> Provider(DalamudPluginInterface pi, IGlamourerApiDesigns api)
|
||||
=> new(pi, Label, (a, b, c, d) => (int)api.ApplyDesignName(a, b, c, (ApplyFlag)d));
|
||||
}
|
||||
|
|
@ -1,39 +0,0 @@
|
|||
using Dalamud.Plugin;
|
||||
using Glamourer.Api.Api;
|
||||
using Glamourer.Api.Enums;
|
||||
using Penumbra.Api.Helpers;
|
||||
using Penumbra.GameData.Enums;
|
||||
|
||||
namespace Glamourer.Api.IpcSubscribers;
|
||||
|
||||
/// <inheritdoc cref="IGlamourerApiItems.SetItem"/>
|
||||
public sealed class SetItem(DalamudPluginInterface pi)
|
||||
: FuncSubscriber<int, byte, ulong, byte, uint, ulong, int>(pi, Label)
|
||||
{
|
||||
/// <summary> The label. </summary>
|
||||
public const string Label = $"Glamourer.{nameof(SetItem)}";
|
||||
|
||||
/// <inheritdoc cref="IGlamourerApiItems.SetItem"/>
|
||||
public GlamourerApiEc Invoke(int objectIndex, EquipSlot slot, ulong itemId, byte stain, uint key = 0, ApplyFlag flags = ApplyFlag.Once)
|
||||
=> (GlamourerApiEc)Invoke(objectIndex, (byte)slot, itemId, stain, key, (ulong)flags);
|
||||
|
||||
/// <summary> Create a provider. </summary>
|
||||
public static FuncProvider<int, byte, ulong, byte, uint, ulong, int> Provider(DalamudPluginInterface pi, IGlamourerApiItems api)
|
||||
=> new(pi, Label, (a, b, c, d, e, f) => (int)api.SetItem(a, (ApiEquipSlot)b, c, d, e, (ApplyFlag)f));
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="IGlamourerApiItems.SetItemName"/>
|
||||
public sealed class SetItemName(DalamudPluginInterface pi)
|
||||
: FuncSubscriber<string, byte, ulong, byte, uint, ulong, int>(pi, Label)
|
||||
{
|
||||
/// <summary> The label. </summary>
|
||||
public const string Label = $"Glamourer.{nameof(SetItemName)}";
|
||||
|
||||
/// <inheritdoc cref="IGlamourerApiItems.SetItem"/>
|
||||
public GlamourerApiEc Invoke(string objectName, EquipSlot slot, ulong itemId, byte stain, uint key = 0, ApplyFlag flags = ApplyFlag.Once)
|
||||
=> (GlamourerApiEc)Invoke(objectName, (byte)slot, itemId, stain, key, (ulong)flags);
|
||||
|
||||
/// <summary> Create a provider. </summary>
|
||||
public static FuncProvider<string, byte, ulong, byte, uint, ulong, int> Provider(DalamudPluginInterface pi, IGlamourerApiItems api)
|
||||
=> new(pi, Label, (a, b, c, d, e, f) => (int)api.SetItemName(a, (ApiEquipSlot)b, c, d, e, (ApplyFlag)f));
|
||||
}
|
||||
|
|
@ -1,51 +0,0 @@
|
|||
using Dalamud.Plugin;
|
||||
using Glamourer.Api.Api;
|
||||
using Penumbra.Api.Helpers;
|
||||
|
||||
namespace Glamourer.Api.IpcSubscribers;
|
||||
|
||||
/// <inheritdoc cref="IGlamourerApiBase.ApiVersion"/>
|
||||
public sealed class ApiVersion(DalamudPluginInterface pi)
|
||||
: FuncSubscriber<(int, int)>(pi, Label)
|
||||
{
|
||||
/// <summary> The label. </summary>
|
||||
public const string Label = $"Glamourer.{nameof(ApiVersion)}";
|
||||
|
||||
/// <inheritdoc cref="IGlamourerApiBase.ApiVersion"/>
|
||||
public new (int Major, int Minor) Invoke()
|
||||
=> base.Invoke();
|
||||
|
||||
/// <summary> Create a provider. </summary>
|
||||
public static FuncProvider<(int, int)> Provider(DalamudPluginInterface pi, IGlamourerApiBase api)
|
||||
=> new(pi, Label, () => api.ApiVersion);
|
||||
}
|
||||
|
||||
/// <summary> Triggered when the Glamourer API is initialized and ready. </summary>
|
||||
public static class Initialized
|
||||
{
|
||||
/// <summary> The label. </summary>
|
||||
public const string Label = $"Glamourer.{nameof(Initialized)}";
|
||||
|
||||
/// <summary> Create a new event subscriber. </summary>
|
||||
public static EventSubscriber Subscriber(DalamudPluginInterface pi, params Action[] actions)
|
||||
=> new(pi, Label, actions);
|
||||
|
||||
/// <summary> Create a provider. </summary>
|
||||
public static EventProvider Provider(DalamudPluginInterface pi)
|
||||
=> new(pi, Label);
|
||||
}
|
||||
|
||||
/// <summary> Triggered when the Glamourer API is fully disposed and unavailable. </summary>
|
||||
public static class Disposed
|
||||
{
|
||||
/// <summary> The label. </summary>
|
||||
public const string Label = $"Glamourer.{nameof(Disposed)}";
|
||||
|
||||
/// <summary> Create a new event subscriber. </summary>
|
||||
public static EventSubscriber Subscriber(DalamudPluginInterface pi, params Action[] actions)
|
||||
=> new(pi, Label, actions);
|
||||
|
||||
/// <summary> Create a provider. </summary>
|
||||
public static EventProvider Provider(DalamudPluginInterface pi)
|
||||
=> new(pi, Label);
|
||||
}
|
||||
|
|
@ -1,235 +0,0 @@
|
|||
using Dalamud.Plugin;
|
||||
using Glamourer.Api.Api;
|
||||
using Glamourer.Api.Enums;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using Penumbra.Api.Helpers;
|
||||
|
||||
namespace Glamourer.Api.IpcSubscribers;
|
||||
|
||||
/// <inheritdoc cref="IGlamourerApiState.GetState"/>
|
||||
public sealed class GetState(DalamudPluginInterface pi)
|
||||
: FuncSubscriber<int, uint, (int, JObject?)>(pi, Label)
|
||||
{
|
||||
/// <summary> The label. </summary>
|
||||
public const string Label = $"Glamourer.{nameof(GetState)}";
|
||||
|
||||
/// <inheritdoc cref="IGlamourerApiState.GetState"/>
|
||||
public new (GlamourerApiEc, JObject?) Invoke(int objectIndex, uint key = 0)
|
||||
{
|
||||
var (ec, data) = base.Invoke(objectIndex, key);
|
||||
return ((GlamourerApiEc)ec, data);
|
||||
}
|
||||
|
||||
/// <summary> Create a provider. </summary>
|
||||
public static FuncProvider<int, uint, (int, JObject?)> Provider(DalamudPluginInterface pi, IGlamourerApiState api)
|
||||
=> new(pi, Label, (a, b) =>
|
||||
{
|
||||
var (ec, data) = api.GetState(a, b);
|
||||
return ((int)ec, data);
|
||||
});
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="IGlamourerApiState.GetStateName"/>
|
||||
public sealed class GetStateName(DalamudPluginInterface pi)
|
||||
: FuncSubscriber<string, uint, (int, JObject?)>(pi, Label)
|
||||
{
|
||||
/// <summary> The label. </summary>
|
||||
public const string Label = $"Glamourer.{nameof(GetStateName)}";
|
||||
|
||||
/// <inheritdoc cref="IGlamourerApiState.GetStateName"/>
|
||||
public new (GlamourerApiEc, JObject?) Invoke(string objectName, uint key = 0)
|
||||
{
|
||||
var (ec, data) = base.Invoke(objectName, key);
|
||||
return ((GlamourerApiEc)ec, data);
|
||||
}
|
||||
|
||||
/// <summary> Create a provider. </summary>
|
||||
public static FuncProvider<string, uint, (int, JObject?)> Provider(DalamudPluginInterface pi, IGlamourerApiState api)
|
||||
=> new(pi, Label, (i, k) =>
|
||||
{
|
||||
var (ec, data) = api.GetStateName(i, k);
|
||||
return ((int)ec, data);
|
||||
});
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="IGlamourerApiState.ApplyState"/>
|
||||
public sealed class ApplyState(DalamudPluginInterface pi)
|
||||
: FuncSubscriber<object, int, uint, ulong, int>(pi, Label)
|
||||
{
|
||||
/// <summary> The label. </summary>
|
||||
public const string Label = $"Glamourer.{nameof(ApplyState)}";
|
||||
|
||||
/// <inheritdoc cref="IGlamourerApiState.ApplyState"/>
|
||||
public GlamourerApiEc Invoke(JObject state, int objectIndex, uint key = 0, ApplyFlag flags = ApplyFlagEx.StateDefault)
|
||||
=> (GlamourerApiEc)Invoke(state, objectIndex, key, (ulong)flags);
|
||||
|
||||
/// <inheritdoc cref="IGlamourerApiState.ApplyState"/>
|
||||
public GlamourerApiEc Invoke(string base64State, int objectIndex, uint key = 0, ApplyFlag flags = ApplyFlagEx.StateDefault)
|
||||
=> (GlamourerApiEc)Invoke(base64State, objectIndex, key, (ulong)flags);
|
||||
|
||||
/// <summary> Create a provider. </summary>
|
||||
public static FuncProvider<object, int, uint, ulong, int> Provider(DalamudPluginInterface pi, IGlamourerApiState api)
|
||||
=> new(pi, Label, (a, b, c, d) => (int)api.ApplyState(a, b, c, (ApplyFlag)d));
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="IGlamourerApiState.ApplyStateName"/>
|
||||
public sealed class ApplyStateName(DalamudPluginInterface pi)
|
||||
: FuncSubscriber<object, string, uint, ulong, int>(pi, Label)
|
||||
{
|
||||
/// <summary> The label. </summary>
|
||||
public const string Label = $"Glamourer.{nameof(ApplyStateName)}";
|
||||
|
||||
/// <inheritdoc cref="IGlamourerApiState.ApplyState"/>
|
||||
public GlamourerApiEc Invoke(JObject state, string objectName, uint key = 0, ApplyFlag flags = ApplyFlagEx.StateDefault)
|
||||
=> (GlamourerApiEc)Invoke(state, objectName, key, (ulong)flags);
|
||||
|
||||
/// <inheritdoc cref="IGlamourerApiState.ApplyState"/>
|
||||
public GlamourerApiEc Invoke(string base64State, string objectName, uint key = 0, ApplyFlag flags = ApplyFlagEx.StateDefault)
|
||||
=> (GlamourerApiEc)Invoke(base64State, objectName, key, (ulong)flags);
|
||||
|
||||
/// <summary> Create a provider. </summary>
|
||||
public static FuncProvider<object, string, uint, ulong, int> Provider(DalamudPluginInterface pi, IGlamourerApiState api)
|
||||
=> new(pi, Label, (a, b, c, d) => (int)api.ApplyStateName(a, b, c, (ApplyFlag)d));
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="IGlamourerApiState.RevertState"/>
|
||||
public sealed class RevertState(DalamudPluginInterface pi)
|
||||
: FuncSubscriber<int, uint, ulong, int>(pi, Label)
|
||||
{
|
||||
/// <summary> The label. </summary>
|
||||
public const string Label = $"Glamourer.{nameof(RevertState)}";
|
||||
|
||||
/// <inheritdoc cref="IGlamourerApiState.RevertState"/>
|
||||
public GlamourerApiEc Invoke(int objectIndex, uint key = 0, ApplyFlag flags = ApplyFlagEx.RevertDefault)
|
||||
=> (GlamourerApiEc)Invoke(objectIndex, key, (ulong)flags);
|
||||
|
||||
/// <summary> Create a provider. </summary>
|
||||
public static FuncProvider<int, uint, ulong, int> Provider(DalamudPluginInterface pi, IGlamourerApiState api)
|
||||
=> new(pi, Label, (a, b, c) => (int)api.RevertState(a, b, (ApplyFlag)c));
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="IGlamourerApiState.RevertStateName"/>
|
||||
public sealed class RevertStateName(DalamudPluginInterface pi)
|
||||
: FuncSubscriber<string, uint, ulong, int>(pi, Label)
|
||||
{
|
||||
/// <summary> The label. </summary>
|
||||
public const string Label = $"Glamourer.{nameof(RevertStateName)}";
|
||||
|
||||
/// <inheritdoc cref="IGlamourerApiState.RevertStateName"/>
|
||||
public GlamourerApiEc Invoke(string objectName, uint key = 0, ApplyFlag flags = ApplyFlagEx.RevertDefault)
|
||||
=> (GlamourerApiEc)Invoke(objectName, key, (ulong)flags);
|
||||
|
||||
/// <summary> Create a provider. </summary>
|
||||
public static FuncProvider<string, uint, ulong, int> Provider(DalamudPluginInterface pi, IGlamourerApiState api)
|
||||
=> new(pi, Label, (a, b, c) => (int)api.RevertStateName(a, b, (ApplyFlag)c));
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="IGlamourerApiState.UnlockState"/>
|
||||
public sealed class UnlockState(DalamudPluginInterface pi)
|
||||
: FuncSubscriber<int, uint, int>(pi, Label)
|
||||
{
|
||||
/// <summary> The label. </summary>
|
||||
public const string Label = $"Glamourer.{nameof(UnlockState)}";
|
||||
|
||||
/// <inheritdoc cref="IGlamourerApiState.UnlockState"/>
|
||||
public new GlamourerApiEc Invoke(int objectIndex, uint key = 0)
|
||||
=> (GlamourerApiEc)base.Invoke(objectIndex, key);
|
||||
|
||||
/// <summary> Create a provider. </summary>
|
||||
public static FuncProvider<int, uint, int> Provider(DalamudPluginInterface pi, IGlamourerApiState api)
|
||||
=> new(pi, Label, (a, b) => (int)api.UnlockState(a, b));
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="IGlamourerApiState.UnlockStateName"/>
|
||||
public sealed class UnlockStateName(DalamudPluginInterface pi)
|
||||
: FuncSubscriber<string, uint, int>(pi, Label)
|
||||
{
|
||||
/// <summary> The label. </summary>
|
||||
public const string Label = $"Glamourer.{nameof(UnlockStateName)}";
|
||||
|
||||
/// <inheritdoc cref="IGlamourerApiState.UnlockStateName"/>
|
||||
public new GlamourerApiEc Invoke(string objectName, uint key = 0)
|
||||
=> (GlamourerApiEc)base.Invoke(objectName, key);
|
||||
|
||||
/// <summary> Create a provider. </summary>
|
||||
public static FuncProvider<string, uint, int> Provider(DalamudPluginInterface pi, IGlamourerApiState api)
|
||||
=> new(pi, Label, (a, b) => (int)api.UnlockStateName(a, b));
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="IGlamourerApiState.UnlockAll"/>
|
||||
public sealed class UnlockAll(DalamudPluginInterface pi)
|
||||
: FuncSubscriber<uint, int>(pi, Label)
|
||||
{
|
||||
/// <summary> The label. </summary>
|
||||
public const string Label = $"Glamourer.{nameof(UnlockAll)}";
|
||||
|
||||
/// <inheritdoc cref="IGlamourerApiState.UnlockAll"/>
|
||||
public new int Invoke(uint key)
|
||||
=> base.Invoke(key);
|
||||
|
||||
/// <summary> Create a provider. </summary>
|
||||
public static FuncProvider<uint, int> Provider(DalamudPluginInterface pi, IGlamourerApiState api)
|
||||
=> new(pi, Label, api.UnlockAll);
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="IGlamourerApiState.RevertToAutomation"/>
|
||||
public sealed class RevertToAutomation(DalamudPluginInterface pi)
|
||||
: FuncSubscriber<int, uint, ulong, int>(pi, Label)
|
||||
{
|
||||
/// <summary> The label. </summary>
|
||||
public const string Label = $"Glamourer.{nameof(RevertToAutomation)}";
|
||||
|
||||
/// <inheritdoc cref="IGlamourerApiState.RevertToAutomation"/>
|
||||
public GlamourerApiEc Invoke(int objectIndex, uint key = 0, ApplyFlag flags = ApplyFlagEx.RevertDefault)
|
||||
=> (GlamourerApiEc)Invoke(objectIndex, key, (ulong)flags);
|
||||
|
||||
/// <summary> Create a provider. </summary>
|
||||
public static FuncProvider<int, uint, ulong, int> Provider(DalamudPluginInterface pi, IGlamourerApiState api)
|
||||
=> new(pi, Label, (a, b, c) => (int)api.RevertToAutomation(a, b, (ApplyFlag)c));
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="IGlamourerApiState.RevertToAutomationName"/>
|
||||
public sealed class RevertToAutomationName(DalamudPluginInterface pi)
|
||||
: FuncSubscriber<string, uint, ulong, int>(pi, Label)
|
||||
{
|
||||
/// <summary> The label. </summary>
|
||||
public const string Label = $"Glamourer.{nameof(RevertToAutomationName)}";
|
||||
|
||||
/// <inheritdoc cref="IGlamourerApiState.RevertToAutomationName"/>
|
||||
public GlamourerApiEc Invoke(string objectName, uint key = 0, ApplyFlag flags = ApplyFlagEx.RevertDefault)
|
||||
=> (GlamourerApiEc)Invoke(objectName, key, (ulong)flags);
|
||||
|
||||
/// <summary> Create a provider. </summary>
|
||||
public static FuncProvider<string, uint, ulong, int> Provider(DalamudPluginInterface pi, IGlamourerApiState api)
|
||||
=> new(pi, Label, (a, b, c) => (int)api.RevertToAutomationName(a, b, (ApplyFlag)c));
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="IGlamourerApiState.StateChanged" />
|
||||
public static class StateChanged
|
||||
{
|
||||
/// <summary> The label. </summary>
|
||||
public const string Label = $"Penumbra.{nameof(StateChanged)}";
|
||||
|
||||
/// <summary> Create a new event subscriber. </summary>
|
||||
public static EventSubscriber<nint> Subscriber(DalamudPluginInterface pi, params Action<nint>[] actions)
|
||||
=> new(pi, Label, actions);
|
||||
|
||||
/// <summary> Create a provider. </summary>
|
||||
public static EventProvider<nint> Provider(DalamudPluginInterface pi, IGlamourerApiState api)
|
||||
=> new(pi, Label, (t => api.StateChanged += t, t => api.StateChanged -= t));
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="IGlamourerApiState.GPoseChanged" />
|
||||
public static class GPoseChanged
|
||||
{
|
||||
/// <summary> The label. </summary>
|
||||
public const string Label = $"Penumbra.{nameof(GPoseChanged)}";
|
||||
|
||||
/// <summary> Create a new event subscriber. </summary>
|
||||
public static EventSubscriber<bool> Subscriber(DalamudPluginInterface pi, params Action<bool>[] actions)
|
||||
=> new(pi, Label, actions);
|
||||
|
||||
/// <summary> Create a provider. </summary>
|
||||
public static EventProvider<bool> Provider(DalamudPluginInterface pi, IGlamourerApiState api)
|
||||
=> new(pi, Label, (t => api.GPoseChanged += t, t => api.GPoseChanged -= t));
|
||||
}
|
||||
|
|
@ -83,6 +83,7 @@
|
|||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Glamourer.Api\Glamourer.Api.csproj" />
|
||||
<ProjectReference Include="..\OtterGui\OtterGui.csproj" />
|
||||
<ProjectReference Include="..\Penumbra.Api\Penumbra.Api.csproj" />
|
||||
<ProjectReference Include="..\Penumbra.String\Penumbra.string.csproj" />
|
||||
|
|
|
|||
|
|
@ -13,14 +13,14 @@ namespace Glamourer.Gui.Tabs.DebugTab.IpcTester;
|
|||
|
||||
public class ItemsIpcTester(DalamudPluginInterface pluginInterface) : IUiService
|
||||
{
|
||||
private int _gameObjectIndex;
|
||||
private string _gameObjectName = string.Empty;
|
||||
private uint _key;
|
||||
private ApplyFlag _flags = ApplyFlagEx.DesignDefault;
|
||||
private CustomItemId _customItemId;
|
||||
private StainId _stainId;
|
||||
private EquipSlot _slot = EquipSlot.Head;
|
||||
private GlamourerApiEc _lastError;
|
||||
private int _gameObjectIndex;
|
||||
private string _gameObjectName = string.Empty;
|
||||
private uint _key;
|
||||
private ApplyFlag _flags = ApplyFlagEx.DesignDefault;
|
||||
private CustomItemId _customItemId;
|
||||
private StainId _stainId;
|
||||
private EquipSlot _slot = EquipSlot.Head;
|
||||
private GlamourerApiEc _lastError;
|
||||
|
||||
public void Draw()
|
||||
{
|
||||
|
|
@ -40,11 +40,13 @@ public class ItemsIpcTester(DalamudPluginInterface pluginInterface) : IUiService
|
|||
|
||||
IpcTesterHelpers.DrawIntro(SetItem.Label);
|
||||
if (ImGui.Button("Set##Idx"))
|
||||
_lastError = new SetItem(pluginInterface).Invoke(_gameObjectIndex, _slot, _customItemId.Id, _stainId.Id, _key, _flags);
|
||||
_lastError = new SetItem(pluginInterface).Invoke(_gameObjectIndex, (ApiEquipSlot)_slot, _customItemId.Id, _stainId.Id, _key,
|
||||
_flags);
|
||||
|
||||
IpcTesterHelpers.DrawIntro(SetItemName.Label);
|
||||
if (ImGui.Button("Set##Name"))
|
||||
_lastError = new SetItemName(pluginInterface).Invoke(_gameObjectName, _slot, _customItemId.Id, _stainId.Id, _key, _flags);
|
||||
_lastError = new SetItemName(pluginInterface).Invoke(_gameObjectName, (ApiEquipSlot)_slot, _customItemId.Id, _stainId.Id, _key,
|
||||
_flags);
|
||||
}
|
||||
|
||||
private void DrawItemInput()
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
using Dalamud.Interface.Utility;
|
||||
using Dalamud.Plugin;
|
||||
using Glamourer.Api.Enums;
|
||||
using Glamourer.Api.Helpers;
|
||||
using Glamourer.Api.IpcSubscribers;
|
||||
using Glamourer.Designs;
|
||||
using ImGuiNET;
|
||||
|
|
@ -10,7 +11,6 @@ using Newtonsoft.Json.Linq;
|
|||
using OtterGui;
|
||||
using OtterGui.Raii;
|
||||
using OtterGui.Services;
|
||||
using Penumbra.Api.Helpers;
|
||||
using Penumbra.GameData.Interop;
|
||||
using Penumbra.String;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue