diff --git a/Glamourer.Api b/Glamourer.Api index a20d4ab..4aaece3 160000 --- a/Glamourer.Api +++ b/Glamourer.Api @@ -1 +1 @@ -Subproject commit a20d4ab1811a7f66918afab9b41ec723f75054f5 +Subproject commit 4aaece34289d64363bc32aaa8fe52c8e7d3dce32 diff --git a/Glamourer/Api/IpcProviders.cs b/Glamourer/Api/IpcProviders.cs index 638d228..efbc368 100644 --- a/Glamourer/Api/IpcProviders.cs +++ b/Glamourer/Api/IpcProviders.cs @@ -2,6 +2,8 @@ using Dalamud.Plugin; using Glamourer.Api.Api; using Glamourer.Api.Helpers; using OtterGui.Services; +using System.Reflection.Emit; +using Glamourer.Api.Enums; namespace Glamourer.Api; @@ -12,7 +14,7 @@ public sealed class IpcProviders : IDisposable, IApiService private readonly EventProvider _disposedProvider; private readonly EventProvider _initializedProvider; - public IpcProviders(DalamudPluginInterface pi, IGlamourerApi api) + public IpcProviders(IDalamudPluginInterface pi, IGlamourerApi api) { _disposedProvider = IpcSubscribers.Disposed.Provider(pi); _initializedProvider = IpcSubscribers.Initialized.Provider(pi); @@ -28,6 +30,11 @@ public sealed class IpcProviders : IDisposable, IApiService IpcSubscribers.SetItem.Provider(pi, api.Items), IpcSubscribers.SetItemName.Provider(pi, api.Items), + // backward compatibility + new FuncProvider(pi, IpcSubscribers.Legacy.SetItemV2.Label, + (a, b, c, d, e, f) => (int)api.Items.SetItem(a, (ApiEquipSlot)b, c, [d], e, (ApplyFlag)f)), + new FuncProvider(pi, IpcSubscribers.Legacy.SetItemName.Label, + (a, b, c, d, e, f) => (int)api.Items.SetItemName(a, (ApiEquipSlot)b, c, [d], e, (ApplyFlag)f)), IpcSubscribers.GetState.Provider(pi, api.State), IpcSubscribers.GetStateName.Provider(pi, api.State), diff --git a/Glamourer/Api/ItemsApi.cs b/Glamourer/Api/ItemsApi.cs index cda1980..a2e3533 100644 --- a/Glamourer/Api/ItemsApi.cs +++ b/Glamourer/Api/ItemsApi.cs @@ -11,9 +11,9 @@ namespace Glamourer.Api; public class ItemsApi(ApiHelpers helpers, ItemManager itemManager, StateManager stateManager) : IGlamourerApiItems, IApiService { - public GlamourerApiEc SetItem(int objectIndex, ApiEquipSlot slot, ulong itemId, byte stain, uint key, ApplyFlag flags) + public GlamourerApiEc SetItem(int objectIndex, ApiEquipSlot slot, ulong itemId, IReadOnlyList stains, uint key, ApplyFlag flags) { - var args = ApiHelpers.Args("Index", objectIndex, "Slot", slot, "ID", itemId, "Stain", stain, "Key", key, "Flags", flags); + var args = ApiHelpers.Args("Index", objectIndex, "Slot", slot, "ID", itemId, "Stains", stains, "Key", key, "Flags", flags); if (!ResolveItem(slot, itemId, out var item)) return ApiHelpers.Return(GlamourerApiEc.ItemInvalid, args); @@ -27,14 +27,14 @@ public class ItemsApi(ApiHelpers helpers, ItemManager itemManager, StateManager return ApiHelpers.Return(GlamourerApiEc.InvalidKey, args); var settings = new ApplySettings(Source: flags.HasFlag(ApplyFlag.Once) ? StateSource.IpcManual : StateSource.IpcFixed, Key: key); - stateManager.ChangeEquip(state, (EquipSlot)slot, item, stain, settings); + stateManager.ChangeEquip(state, (EquipSlot)slot, item, new StainIds(stains), settings); ApiHelpers.Lock(state, key, flags); return GlamourerApiEc.Success; } - public GlamourerApiEc SetItemName(string playerName, ApiEquipSlot slot, ulong itemId, byte stain, uint key, ApplyFlag flags) + public GlamourerApiEc SetItemName(string playerName, ApiEquipSlot slot, ulong itemId, IReadOnlyList stains, uint key, ApplyFlag flags) { - var args = ApiHelpers.Args("Name", playerName, "Slot", slot, "ID", itemId, "Stain", stain, "Key", key, "Flags", flags); + var args = ApiHelpers.Args("Name", playerName, "Slot", slot, "ID", itemId, "Stains", stains, "Key", key, "Flags", flags); if (!ResolveItem(slot, itemId, out var item)) return ApiHelpers.Return(GlamourerApiEc.ItemInvalid, args); @@ -53,7 +53,7 @@ public class ItemsApi(ApiHelpers helpers, ItemManager itemManager, StateManager continue; anyUnlocked = true; - stateManager.ChangeEquip(state, (EquipSlot)slot, item, stain, settings); + stateManager.ChangeEquip(state, (EquipSlot)slot, item, new StainIds(stains), settings); ApiHelpers.Lock(state, key, flags); } diff --git a/Penumbra.Api b/Penumbra.Api index f1e4e52..f4c6144 160000 --- a/Penumbra.Api +++ b/Penumbra.Api @@ -1 +1 @@ -Subproject commit f1e4e520daaa8f23e5c8b71d55e5992b8f6768e2 +Subproject commit f4c6144ca2012b279e6d8aa52b2bef6cc2ba32d9