diff --git a/Glamourer.Api b/Glamourer.Api index 4ac38fb..8de6fa7 160000 --- a/Glamourer.Api +++ b/Glamourer.Api @@ -1 +1 @@ -Subproject commit 4ac38fbed6fb0f31c0b75de26950ab82d3bee258 +Subproject commit 8de6fa7246a403de50b3be4e17bb5f188717b279 diff --git a/Glamourer/Api/ItemsApi.cs b/Glamourer/Api/ItemsApi.cs index b27264d..ac971c9 100644 --- a/Glamourer/Api/ItemsApi.cs +++ b/Glamourer/Api/ItemsApi.cs @@ -127,9 +127,9 @@ public class ItemsApi(ApiHelpers helpers, ItemManager itemManager, StateManager return ApiHelpers.Return(GlamourerApiEc.Success, args); } - public GlamourerApiEc SetMeta(int objectIndex, SetMetaFlag types, bool newValue, uint key, ApplyFlag flags) + public GlamourerApiEc SetMetaState(int objectIndex, MetaFlag types, bool newValue, uint key, ApplyFlag flags) { - var args = ApiHelpers.Args("Index", objectIndex, "Meta Types", types, "NewValue", newValue, "Key", key, "ApplyFlags", flags); + var args = ApiHelpers.Args("Index", objectIndex, "MetaTypes", types, "NewValue", newValue, "Key", key, "ApplyFlags", flags); if (types == 0) return ApiHelpers.Return(GlamourerApiEc.InvalidState, args); @@ -153,13 +153,12 @@ public class ItemsApi(ApiHelpers helpers, ItemManager itemManager, StateManager return GlamourerApiEc.Success; } - public GlamourerApiEc SetMetaState(string playerName, SetMetaFlag types, bool newValue, uint key, ApplyFlag flags) + public GlamourerApiEc SetMetaStateName(string playerName, MetaFlag types, bool newValue, uint key, ApplyFlag flags) { - var args = ApiHelpers.Args("Name", playerName, "Meta Types", types, "NewValue", newValue, "Key", key, "ApplyFlags", flags); + var args = ApiHelpers.Args("Name", playerName, "MetaTypes", types, "NewValue", newValue, "Key", key, "ApplyFlags", flags); if (types == 0) return ApiHelpers.Return(GlamourerApiEc.ItemInvalid, args); - var indices = types.ToIndices(); var anyHuman = false; var anyFound = false; var anyUnlocked = false; @@ -175,7 +174,7 @@ public class ItemsApi(ApiHelpers helpers, ItemManager itemManager, StateManager anyUnlocked = true; // update all MetaStates for this ActorState - foreach (var index in indices) + foreach (var index in types.ToIndices()) { stateManager.ChangeMetaState(state, index, newValue, ApplySettings.Manual); ApiHelpers.Lock(state, key, flags); diff --git a/Glamourer/Automation/ApplicationType.cs b/Glamourer/Automation/ApplicationType.cs index 3d409cb..8871a0e 100644 --- a/Glamourer/Automation/ApplicationType.cs +++ b/Glamourer/Automation/ApplicationType.cs @@ -1,4 +1,5 @@ -using Glamourer.Designs; +using Glamourer.Api.Enums; +using Glamourer.Designs; using Glamourer.GameData; using Penumbra.GameData.Enums; diff --git a/Glamourer/Designs/ApplicationCollection.cs b/Glamourer/Designs/ApplicationCollection.cs index 0fd18f0..13813a3 100644 --- a/Glamourer/Designs/ApplicationCollection.cs +++ b/Glamourer/Designs/ApplicationCollection.cs @@ -1,3 +1,4 @@ +using Glamourer.Api.Enums; using Glamourer.GameData; using ImGuiNET; using Penumbra.GameData.Enums; diff --git a/Glamourer/Designs/ApplicationRules.cs b/Glamourer/Designs/ApplicationRules.cs index 3c5fed2..703a3ae 100644 --- a/Glamourer/Designs/ApplicationRules.cs +++ b/Glamourer/Designs/ApplicationRules.cs @@ -1,4 +1,5 @@ -using Glamourer.GameData; +using Glamourer.Api.Enums; +using Glamourer.GameData; using Glamourer.State; using ImGuiNET; using Penumbra.GameData.Enums; diff --git a/Glamourer/Designs/DesignBase64Migration.cs b/Glamourer/Designs/DesignBase64Migration.cs index a60c527..cab9e27 100644 --- a/Glamourer/Designs/DesignBase64Migration.cs +++ b/Glamourer/Designs/DesignBase64Migration.cs @@ -1,4 +1,5 @@ -using Glamourer.Services; +using Glamourer.Api.Enums; +using Glamourer.Services; using OtterGui; using Penumbra.GameData.DataContainers; using Penumbra.GameData.Enums; diff --git a/Glamourer/Designs/Links/DesignMerger.cs b/Glamourer/Designs/Links/DesignMerger.cs index 0284322..847d5f1 100644 --- a/Glamourer/Designs/Links/DesignMerger.cs +++ b/Glamourer/Designs/Links/DesignMerger.cs @@ -1,4 +1,5 @@ -using Glamourer.Automation; +using Glamourer.Api.Enums; +using Glamourer.Automation; using Glamourer.Designs.Special; using Glamourer.GameData; using Glamourer.Interop.Material; diff --git a/Glamourer/Designs/MetaIndex.cs b/Glamourer/Designs/MetaIndex.cs index 9552e5a..3fc4655 100644 --- a/Glamourer/Designs/MetaIndex.cs +++ b/Glamourer/Designs/MetaIndex.cs @@ -12,15 +12,6 @@ public enum MetaIndex ModelId = StateIndex.MetaModelId, } -[Flags] -public enum MetaFlag : byte -{ - Wetness = 0x01, - HatState = 0x02, - VisorState = 0x04, - WeaponState = 0x08, -} - public static class MetaExtensions { public static readonly IReadOnlyList AllRelevant = @@ -38,29 +29,6 @@ public static class MetaExtensions _ => (MetaFlag)byte.MaxValue, }; - public static MetaIndex ToIndex(this SetMetaFlag index) - => index switch - { - SetMetaFlag.Wetness => MetaIndex.Wetness, - SetMetaFlag.HatState => MetaIndex.HatState, - SetMetaFlag.VisorState => MetaIndex.VisorState, - SetMetaFlag.WeaponState => MetaIndex.WeaponState, - _ => (MetaIndex)byte.MaxValue, - }; - - public static IEnumerable ToIndices(this SetMetaFlag index) - { - if (index.HasFlag(SetMetaFlag.Wetness)) - yield return MetaIndex.Wetness; - if (index.HasFlag(SetMetaFlag.HatState)) - yield return MetaIndex.HatState; - if (index.HasFlag(SetMetaFlag.VisorState)) - yield return MetaIndex.VisorState; - if (index.HasFlag(SetMetaFlag.WeaponState)) - yield return MetaIndex.WeaponState; - } - - public static MetaIndex ToIndex(this MetaFlag index) => index switch { @@ -68,9 +36,21 @@ public static class MetaExtensions MetaFlag.HatState => MetaIndex.HatState, MetaFlag.VisorState => MetaIndex.VisorState, MetaFlag.WeaponState => MetaIndex.WeaponState, - _ => (MetaIndex)byte.MaxValue, + _ => (MetaIndex)byte.MaxValue, }; + public static IEnumerable ToIndices(this MetaFlag index) + { + if (index.HasFlag(MetaFlag.Wetness)) + yield return MetaIndex.Wetness; + if (index.HasFlag(MetaFlag.HatState)) + yield return MetaIndex.HatState; + if (index.HasFlag(MetaFlag.VisorState)) + yield return MetaIndex.VisorState; + if (index.HasFlag(MetaFlag.WeaponState)) + yield return MetaIndex.WeaponState; + } + public static string ToName(this MetaIndex index) => index switch { diff --git a/Glamourer/Gui/Tabs/DesignTab/DesignPanel.cs b/Glamourer/Gui/Tabs/DesignTab/DesignPanel.cs index 42eb8e9..dbe106b 100644 --- a/Glamourer/Gui/Tabs/DesignTab/DesignPanel.cs +++ b/Glamourer/Gui/Tabs/DesignTab/DesignPanel.cs @@ -2,6 +2,7 @@ using Dalamud.Interface.ImGuiFileDialog; using Dalamud.Interface.ImGuiNotification; using FFXIVClientStructs.FFXIV.Client.System.Framework; +using Glamourer.Api.Enums; using Glamourer.Automation; using Glamourer.Designs; using Glamourer.Designs.History; diff --git a/Glamourer/Gui/ToggleDrawData.cs b/Glamourer/Gui/ToggleDrawData.cs index 75edc72..28afc2c 100644 --- a/Glamourer/Gui/ToggleDrawData.cs +++ b/Glamourer/Gui/ToggleDrawData.cs @@ -1,4 +1,5 @@ -using Glamourer.Designs; +using Glamourer.Api.Enums; +using Glamourer.Designs; using Glamourer.State; using Penumbra.GameData.Enums; diff --git a/Glamourer/State/StateIndex.cs b/Glamourer/State/StateIndex.cs index 0ac52ec..e3f1863 100644 --- a/Glamourer/State/StateIndex.cs +++ b/Glamourer/State/StateIndex.cs @@ -1,4 +1,5 @@ -using Glamourer.Designs; +using Glamourer.Api.Enums; +using Glamourer.Designs; using Glamourer.GameData; using Penumbra.GameData.Enums;