From 2d8d6fa75fc4406e1d7c4b3991cc30e0ab088e2c Mon Sep 17 00:00:00 2001 From: Ottermandias Date: Sat, 24 Jan 2026 16:52:22 +0100 Subject: [PATCH] Switch services. --- Glamourer/Api/ApiHelpers.cs | 7 +- Glamourer/Api/DesignsApi.cs | 2 +- Glamourer/Api/GlamourerApi.cs | 2 +- Glamourer/Api/IpcProviders.cs | 2 +- Glamourer/Api/ItemsApi.cs | 26 +-- Glamourer/Api/StateApi.cs | 3 +- Glamourer/Designs/DesignStorage.cs | 2 +- Glamourer/Designs/History/EditorHistory.cs | 2 +- Glamourer/Designs/Links/DesignLinkLoader.cs | 5 +- Glamourer/Designs/Links/DesignLinkManager.cs | 2 +- Glamourer/Designs/Links/DesignMerger.cs | 31 ++- .../Designs/Special/QuickSelectedDesign.cs | 2 +- .../Designs/Special/RandomDesignGenerator.cs | 4 +- Glamourer/GameData/CustomizeManager.cs | 2 +- Glamourer/GameData/NpcCustomizeSet.cs | 2 +- Glamourer/Glamourer.cs | 6 +- .../Customization/CustomizeParameterDrawer.cs | 2 +- Glamourer/Gui/Equipment/ItemCopyService.cs | 3 +- Glamourer/Gui/MainWindow.cs | 6 +- Glamourer/Gui/Materials/AdvancedDyePopup.cs | 2 +- Glamourer/Gui/Materials/MaterialDrawer.cs | 35 ++- .../Tabs/AutomationTab/IdentifierDrawer.cs | 6 +- .../AutomationTab/RandomRestrictionDrawer.cs | 2 +- Glamourer/Gui/Tabs/AutomationTab/SetPanel.cs | 138 ++++++------ .../Gui/Tabs/DebugTab/ActiveStatePanel.cs | 17 +- .../DebugTab/AdvancedCustomizationDrawer.cs | 6 +- .../Gui/Tabs/DebugTab/AutoDesignPanel.cs | 8 +- .../DebugTab/CustomizationServicePanel.cs | 6 +- .../Tabs/DebugTab/CustomizationUnlockPanel.cs | 12 +- Glamourer/Gui/Tabs/DebugTab/DatFilePanel.cs | 12 +- Glamourer/Gui/Tabs/DebugTab/DebugTab.cs | 6 +- Glamourer/Gui/Tabs/DebugTab/DebugTabHeader.cs | 5 +- .../Gui/Tabs/DebugTab/DesignConverterPanel.cs | 8 +- .../Gui/Tabs/DebugTab/DesignManagerPanel.cs | 24 +- .../Gui/Tabs/DebugTab/DesignTesterPanel.cs | 8 +- Glamourer/Gui/Tabs/DebugTab/DynamisPanel.cs | 8 +- Glamourer/Gui/Tabs/DebugTab/FunPanel.cs | 24 +- .../Gui/Tabs/DebugTab/GlamourPlatePanel.cs | 7 +- Glamourer/Gui/Tabs/DebugTab/InventoryPanel.cs | 6 +- .../DebugTab/IpcTester/DesignIpcTester.cs | 2 +- .../Tabs/DebugTab/IpcTester/IpcTesterPanel.cs | 6 +- .../Tabs/DebugTab/IpcTester/ItemsIpcTester.cs | 7 +- .../Tabs/DebugTab/IpcTester/StateIpcTester.cs | 2 +- .../Gui/Tabs/DebugTab/ItemUnlockPanel.cs | 14 +- .../Gui/Tabs/DebugTab/ModelEvaluationPanel.cs | 54 ++--- .../Gui/Tabs/DebugTab/NpcAppearancePanel.cs | 6 +- .../Gui/Tabs/DebugTab/ObjectManagerPanel.cs | 30 +-- Glamourer/Gui/Tabs/DebugTab/PenumbraPanel.cs | 36 +-- .../Gui/Tabs/DebugTab/RetainedStatePanel.cs | 14 +- .../Gui/Tabs/DebugTab/UnlockableItemsPanel.cs | 14 +- .../Gui/Tabs/DesignTab/DesignLinkDrawer.cs | 52 ++--- Glamourer/Gui/Tabs/SettingsTab/CodeDrawer.cs | 4 +- .../Gui/Tabs/SettingsTab/CollectionCombo.cs | 4 +- .../SettingsTab/CollectionOverrideDrawer.cs | 2 +- Glamourer/Gui/Tabs/UnlocksTab/UnlockTable.cs | 4 +- Glamourer/Interop/InventoryService.cs | 3 +- Glamourer/Interop/Material/DirectXService.cs | 2 +- .../Material/LiveColorTablePreviewer.cs | 2 +- Glamourer/Interop/Material/MaterialManager.cs | 5 +- Glamourer/Interop/Material/PrepareColorSet.cs | 2 +- Glamourer/Interop/Material/UpdateColorSets.cs | 2 +- .../Interop/PalettePlus/PaletteImport.cs | 2 +- .../Interop/Penumbra/ModSettingApplier.cs | 2 +- .../Interop/Penumbra/ModUsageInformer.cs | 2 +- .../Interop/Penumbra/PenumbraAutoRedraw.cs | 5 +- .../Penumbra/PenumbraAutoRedrawSkip.cs | 3 +- Glamourer/Services/BackupService.cs | 6 +- .../Services/CollectionOverrideService.cs | 9 +- Glamourer/Services/CommandService.cs | 207 ++++++++---------- Glamourer/Services/CustomizeService.cs | 2 +- Glamourer/Services/DalamudServices.cs | 2 +- Glamourer/Services/DesignApplier.cs | 2 +- Glamourer/Services/DesignResolver.cs | 3 +- Glamourer/Services/HeightService.cs | 2 +- Glamourer/Services/PcpService.cs | 2 +- Glamourer/Services/ServiceManager.cs | 17 +- Glamourer/State/JobChangeState.cs | 2 +- Luna | 2 +- Penumbra.GameData | 2 +- 79 files changed, 487 insertions(+), 503 deletions(-) diff --git a/Glamourer/Api/ApiHelpers.cs b/Glamourer/Api/ApiHelpers.cs index 14cff3b..954d6d9 100644 --- a/Glamourer/Api/ApiHelpers.cs +++ b/Glamourer/Api/ApiHelpers.cs @@ -1,9 +1,9 @@ using Glamourer.Api.Enums; using Glamourer.Designs; using Glamourer.State; +using Luna; using OtterGui.Extensions; using OtterGui.Log; -using OtterGui.Services; using Penumbra.GameData.Actors; using Penumbra.GameData.Enums; using Penumbra.GameData.Interop; @@ -84,9 +84,8 @@ public class ApiHelpers(ActorObjectManager objects, StateManager stateManager, A return []; return stateManager.Values.Where(state => state.Identifier.Type is IdentifierType.Player && state.Identifier.PlayerName == byteString) - .Concat(objects - .Where(kvp => kvp.Key is { IsValid: true, Type: IdentifierType.Player } && kvp.Key.PlayerName == byteString) - .SelectWhere(kvp => + .Concat(ArrayExtensions.SelectWhere(objects + .Where(kvp => kvp.Key is { IsValid: true, Type: IdentifierType.Player } && kvp.Key.PlayerName == byteString), kvp => { if (stateManager.ContainsKey(kvp.Key)) return (false, null); diff --git a/Glamourer/Api/DesignsApi.cs b/Glamourer/Api/DesignsApi.cs index 9b48ade..896e9b8 100644 --- a/Glamourer/Api/DesignsApi.cs +++ b/Glamourer/Api/DesignsApi.cs @@ -2,8 +2,8 @@ using Glamourer.Api.Enums; using Glamourer.Designs; using Glamourer.State; +using Luna; using Newtonsoft.Json.Linq; -using OtterGui.Services; namespace Glamourer.Api; diff --git a/Glamourer/Api/GlamourerApi.cs b/Glamourer/Api/GlamourerApi.cs index 85f873a..e4ca224 100644 --- a/Glamourer/Api/GlamourerApi.cs +++ b/Glamourer/Api/GlamourerApi.cs @@ -1,5 +1,5 @@ using Glamourer.Api.Api; -using OtterGui.Services; +using Luna; namespace Glamourer.Api; diff --git a/Glamourer/Api/IpcProviders.cs b/Glamourer/Api/IpcProviders.cs index f120db3..b9991af 100644 --- a/Glamourer/Api/IpcProviders.cs +++ b/Glamourer/Api/IpcProviders.cs @@ -1,8 +1,8 @@ using Dalamud.Plugin; using Glamourer.Api.Api; using Glamourer.Api.Helpers; -using OtterGui.Services; using Glamourer.Api.Enums; +using Luna; namespace Glamourer.Api; diff --git a/Glamourer/Api/ItemsApi.cs b/Glamourer/Api/ItemsApi.cs index ac971c9..b135dbd 100644 --- a/Glamourer/Api/ItemsApi.cs +++ b/Glamourer/Api/ItemsApi.cs @@ -3,7 +3,7 @@ using Glamourer.Api.Enums; using Glamourer.Designs; using Glamourer.Services; using Glamourer.State; -using OtterGui.Services; +using Luna; using Penumbra.GameData.Enums; using Penumbra.GameData.Structs; @@ -67,7 +67,7 @@ public class ItemsApi(ApiHelpers helpers, ItemManager itemManager, StateManager return ApiHelpers.Return(GlamourerApiEc.InvalidKey, args); return ApiHelpers.Return(GlamourerApiEc.Success, args); - } + } public GlamourerApiEc SetBonusItem(int objectIndex, ApiBonusSlot slot, ulong bonusItemId, uint key, ApplyFlag flags) { @@ -125,8 +125,8 @@ public class ItemsApi(ApiHelpers helpers, ItemManager itemManager, StateManager return ApiHelpers.Return(GlamourerApiEc.InvalidKey, args); return ApiHelpers.Return(GlamourerApiEc.Success, args); - } - + } + public GlamourerApiEc SetMetaState(int objectIndex, MetaFlag types, bool newValue, uint key, ApplyFlag flags) { var args = ApiHelpers.Args("Index", objectIndex, "MetaTypes", types, "NewValue", newValue, "Key", key, "ApplyFlags", flags); @@ -144,10 +144,10 @@ public class ItemsApi(ApiHelpers helpers, ItemManager itemManager, StateManager // Grab MetaIndices from attached flags, and update the states. var indices = types.ToIndices(); - foreach (var index in indices) - { - stateManager.ChangeMetaState(state, index, newValue, ApplySettings.Manual); - ApiHelpers.Lock(state, key, flags); + foreach (var index in indices) + { + stateManager.ChangeMetaState(state, index, newValue, ApplySettings.Manual); + ApiHelpers.Lock(state, key, flags); } return GlamourerApiEc.Success; @@ -155,7 +155,7 @@ public class ItemsApi(ApiHelpers helpers, ItemManager itemManager, StateManager public GlamourerApiEc SetMetaStateName(string playerName, MetaFlag types, bool newValue, uint key, ApplyFlag flags) { - var args = ApiHelpers.Args("Name", playerName, "MetaTypes", 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); @@ -174,10 +174,10 @@ public class ItemsApi(ApiHelpers helpers, ItemManager itemManager, StateManager anyUnlocked = true; // update all MetaStates for this ActorState - foreach (var index in types.ToIndices()) - { - stateManager.ChangeMetaState(state, index, newValue, ApplySettings.Manual); - ApiHelpers.Lock(state, key, flags); + foreach (var index in types.ToIndices()) + { + stateManager.ChangeMetaState(state, index, newValue, ApplySettings.Manual); + ApiHelpers.Lock(state, key, flags); } } diff --git a/Glamourer/Api/StateApi.cs b/Glamourer/Api/StateApi.cs index 4ce9c01..f400aa8 100644 --- a/Glamourer/Api/StateApi.cs +++ b/Glamourer/Api/StateApi.cs @@ -5,10 +5,9 @@ using Glamourer.Designs; using Glamourer.Designs.History; using Glamourer.Events; using Glamourer.State; +using Luna; using Newtonsoft.Json.Linq; -using OtterGui.Services; using Penumbra.GameData.Interop; -using Penumbra.GameData.Structs; using StateChanged = Glamourer.Events.StateChanged; namespace Glamourer.Api; diff --git a/Glamourer/Designs/DesignStorage.cs b/Glamourer/Designs/DesignStorage.cs index a87415c..77ea89b 100644 --- a/Glamourer/Designs/DesignStorage.cs +++ b/Glamourer/Designs/DesignStorage.cs @@ -1,4 +1,4 @@ -using OtterGui.Services; +using Luna; namespace Glamourer.Designs; diff --git a/Glamourer/Designs/History/EditorHistory.cs b/Glamourer/Designs/History/EditorHistory.cs index caec151..2676a84 100644 --- a/Glamourer/Designs/History/EditorHistory.cs +++ b/Glamourer/Designs/History/EditorHistory.cs @@ -1,7 +1,7 @@ using Glamourer.Api.Enums; using Glamourer.Events; using Glamourer.State; -using OtterGui.Services; +using Luna; using Penumbra.GameData.Interop; namespace Glamourer.Designs.History; diff --git a/Glamourer/Designs/Links/DesignLinkLoader.cs b/Glamourer/Designs/Links/DesignLinkLoader.cs index 24138a8..aaa722f 100644 --- a/Glamourer/Designs/Links/DesignLinkLoader.cs +++ b/Glamourer/Designs/Links/DesignLinkLoader.cs @@ -1,7 +1,8 @@ using Dalamud.Interface.ImGuiNotification; +using Luna; using OtterGui.Classes; using OtterGui.Extensions; -using OtterGui.Services; +using MessageService = OtterGui.Classes.MessageService; using Notification = OtterGui.Classes.Notification; namespace Glamourer.Designs.Links; @@ -10,7 +11,7 @@ public sealed class DesignLinkLoader(DesignStorage designStorage, MessageService : DelayedReferenceLoader(messager), IService { protected override bool TryGetObject(LinkData data, [NotNullWhen(true)] out Design? obj) - => designStorage.FindFirst(d => d.Identifier == data.Identity, out obj); + => ArrayExtensions.FindFirst(designStorage, d => d.Identifier == data.Identity, out obj); protected override bool SetObject(Design parent, Design child, LinkData data, out string error) => LinkContainer.AddLink(parent, child, data.Type, data.Order, out error); diff --git a/Glamourer/Designs/Links/DesignLinkManager.cs b/Glamourer/Designs/Links/DesignLinkManager.cs index df1f147..efed8ab 100644 --- a/Glamourer/Designs/Links/DesignLinkManager.cs +++ b/Glamourer/Designs/Links/DesignLinkManager.cs @@ -2,7 +2,7 @@ using Glamourer.Designs.History; using Glamourer.Events; using Glamourer.Services; -using OtterGui.Services; +using Luna; namespace Glamourer.Designs.Links; diff --git a/Glamourer/Designs/Links/DesignMerger.cs b/Glamourer/Designs/Links/DesignMerger.cs index 847d5f1..a878c44 100644 --- a/Glamourer/Designs/Links/DesignMerger.cs +++ b/Glamourer/Designs/Links/DesignMerger.cs @@ -1,12 +1,11 @@ using Glamourer.Api.Enums; using Glamourer.Automation; -using Glamourer.Designs.Special; using Glamourer.GameData; using Glamourer.Interop.Material; using Glamourer.Services; using Glamourer.State; using Glamourer.Unlocks; -using OtterGui.Services; +using Luna; using Penumbra.GameData.Enums; using Penumbra.GameData.Structs; @@ -14,10 +13,10 @@ namespace Glamourer.Designs.Links; public class DesignMerger( DesignManager designManager, - CustomizeService _customize, - Configuration _config, - ItemUnlockManager _itemUnlocks, - CustomizeUnlockManager _customizeUnlocks) : IService + CustomizeService customizeService, + Configuration config, + ItemUnlockManager itemUnlocks, + CustomizeUnlockManager customizeUnlocks) : IService { public MergedDesign Merge(LinkContainer designs, in CustomizeArray currentCustomize, in DesignData baseRef, bool respectOwnership, bool modAssociations) @@ -28,10 +27,10 @@ public class DesignMerger( in DesignData baseRef, bool respectOwnership, bool modAssociations) { var ret = new MergedDesign(designManager); - ret.Design.SetCustomize(_customize, currentCustomize); + ret.Design.SetCustomize(customizeService, currentCustomize); var startBodyType = currentCustomize.BodyType; CustomizeFlag fixFlags = 0; - respectOwnership &= _config.UnlockedItemMode; + respectOwnership &= config.UnlockedItemMode; foreach (var (design, type, jobs) in designs) { if (type is 0) @@ -153,7 +152,7 @@ public class DesignMerger( if (equipFlags.HasFlag(flag)) { var item = design.Item(slot); - if (!respectOwnership || _itemUnlocks.IsUnlocked(item.Id, out _)) + if (!respectOwnership || itemUnlocks.IsUnlocked(item.Id, out _)) ret.Design.GetDesignDataRef().SetItem(slot, item); ret.Design.SetApplyEquip(slot, true); ret.Sources[slot, false] = source; @@ -203,7 +202,7 @@ public class DesignMerger( return; var weapon = design.Item(EquipSlot.MainHand); - if (respectOwnership && !_itemUnlocks.IsUnlocked(weapon.Id, out _)) + if (respectOwnership && !itemUnlocks.IsUnlocked(weapon.Id, out _)) return; if (!ret.Design.DoApplyEquip(EquipSlot.MainHand)) @@ -222,7 +221,7 @@ public class DesignMerger( return; var weapon = design.Item(EquipSlot.OffHand); - if (respectOwnership && !_itemUnlocks.IsUnlocked(weapon.Id, out _)) + if (respectOwnership && !itemUnlocks.IsUnlocked(weapon.Id, out _)) return; if (!ret.Design.DoApplyEquip(EquipSlot.OffHand)) @@ -252,7 +251,7 @@ public class DesignMerger( var customize = ret.Design.DesignData.Customize; if (customizeFlags.HasFlag(CustomizeFlag.Clan)) { - fixFlags |= _customize.ChangeClan(ref customize, design.Customize.Clan); + fixFlags |= customizeService.ChangeClan(ref customize, design.Customize.Clan); ret.Design.SetApplyCustomize(CustomizeIndex.Clan, true); ret.Design.SetApplyCustomize(CustomizeIndex.Race, true); customizeFlags &= ~(CustomizeFlag.Clan | CustomizeFlag.Race); @@ -262,7 +261,7 @@ public class DesignMerger( if (customizeFlags.HasFlag(CustomizeFlag.Gender)) { - fixFlags |= _customize.ChangeGender(ref customize, design.Customize.Gender); + fixFlags |= customizeService.ChangeGender(ref customize, design.Customize.Gender); ret.Design.SetApplyCustomize(CustomizeIndex.Gender, true); customizeFlags &= ~CustomizeFlag.Gender; ret.Sources[CustomizeIndex.Gender] = source; @@ -283,7 +282,7 @@ public class DesignMerger( ret.Sources[CustomizeIndex.BodyType] = source; } - var set = _customize.Manager.GetSet(customize.Clan, customize.Gender); + var set = customizeService.Manager.GetSet(customize.Clan, customize.Gender); var face = customize.Face; foreach (var index in Enum.GetValues()) { @@ -295,7 +294,7 @@ public class DesignMerger( if (!CustomizeService.IsCustomizationValid(set, face, index, value, out var data)) continue; - if (data.HasValue && respectOwnership && !_customizeUnlocks.IsUnlocked(data.Value, out _)) + if (data.HasValue && respectOwnership && !customizeUnlocks.IsUnlocked(data.Value, out _)) continue; customize[index] = data?.Value ?? value; @@ -304,7 +303,7 @@ public class DesignMerger( fixFlags &= ~flag; } - ret.Design.SetCustomize(_customize, customize); + ret.Design.SetCustomize(customizeService, customize); } private static void ApplyFixFlags(MergedDesign ret, CustomizeFlag fixFlags) diff --git a/Glamourer/Designs/Special/QuickSelectedDesign.cs b/Glamourer/Designs/Special/QuickSelectedDesign.cs index 740bb7f..b4b9832 100644 --- a/Glamourer/Designs/Special/QuickSelectedDesign.cs +++ b/Glamourer/Designs/Special/QuickSelectedDesign.cs @@ -2,8 +2,8 @@ using Glamourer.Gui; using Glamourer.Interop.Material; using Glamourer.State; +using Luna; using Newtonsoft.Json.Linq; -using OtterGui.Services; using Penumbra.GameData.Structs; namespace Glamourer.Designs.Special; diff --git a/Glamourer/Designs/Special/RandomDesignGenerator.cs b/Glamourer/Designs/Special/RandomDesignGenerator.cs index b1e1e7c..c5d9124 100644 --- a/Glamourer/Designs/Special/RandomDesignGenerator.cs +++ b/Glamourer/Designs/Special/RandomDesignGenerator.cs @@ -1,5 +1,5 @@ -using OtterGui; -using OtterGui.Services; + +using Luna; namespace Glamourer.Designs.Special; diff --git a/Glamourer/GameData/CustomizeManager.cs b/Glamourer/GameData/CustomizeManager.cs index 9e065b4..bb8120c 100644 --- a/Glamourer/GameData/CustomizeManager.cs +++ b/Glamourer/GameData/CustomizeManager.cs @@ -1,7 +1,7 @@ using Dalamud.Interface.Textures; using Dalamud.Plugin.Services; +using Luna; using OtterGui.Classes; -using OtterGui.Services; using Penumbra.GameData.Enums; using Race = Penumbra.GameData.Enums.Race; diff --git a/Glamourer/GameData/NpcCustomizeSet.cs b/Glamourer/GameData/NpcCustomizeSet.cs index 725f80f..24f1077 100644 --- a/Glamourer/GameData/NpcCustomizeSet.cs +++ b/Glamourer/GameData/NpcCustomizeSet.cs @@ -2,7 +2,7 @@ using Dalamud.Utility; using FFXIVClientStructs.FFXIV.Client.Game.Object; using Lumina.Excel.Sheets; -using OtterGui.Services; +using Luna; using Penumbra.GameData.Data; using Penumbra.GameData.DataContainers; using Penumbra.GameData.Enums; diff --git a/Glamourer/Glamourer.cs b/Glamourer/Glamourer.cs index 33c67d5..edeb3d8 100644 --- a/Glamourer/Glamourer.cs +++ b/Glamourer/Glamourer.cs @@ -6,10 +6,10 @@ using Glamourer.Gui; using Glamourer.Interop; using Glamourer.Services; using Glamourer.State; -using OtterGui.Classes; -using OtterGui.Log; -using OtterGui.Services; +using Luna; using Penumbra.GameData.Interop; +using Logger = OtterGui.Log.Logger; +using MessageService = OtterGui.Classes.MessageService; namespace Glamourer; diff --git a/Glamourer/Gui/Customization/CustomizeParameterDrawer.cs b/Glamourer/Gui/Customization/CustomizeParameterDrawer.cs index 4db6b14..a7ba056 100644 --- a/Glamourer/Gui/Customization/CustomizeParameterDrawer.cs +++ b/Glamourer/Gui/Customization/CustomizeParameterDrawer.cs @@ -4,9 +4,9 @@ using Glamourer.GameData; using Glamourer.Interop.PalettePlus; using Glamourer.State; using Dalamud.Bindings.ImGui; +using Luna; using OtterGui; using OtterGui.Raii; -using OtterGui.Services; namespace Glamourer.Gui.Customization; diff --git a/Glamourer/Gui/Equipment/ItemCopyService.cs b/Glamourer/Gui/Equipment/ItemCopyService.cs index 6912f1f..e380f52 100644 --- a/Glamourer/Gui/Equipment/ItemCopyService.cs +++ b/Glamourer/Gui/Equipment/ItemCopyService.cs @@ -1,13 +1,12 @@ using Glamourer.Services; using Dalamud.Bindings.ImGui; -using OtterGui.Services; using Penumbra.GameData.DataContainers; using Penumbra.GameData.Enums; using Penumbra.GameData.Structs; namespace Glamourer.Gui.Equipment; -public class ItemCopyService(ItemManager items, DictStain stainData) : IUiService +public class ItemCopyService(ItemManager items, DictStain stainData) : Luna.IUiService { public EquipItem? Item { get; private set; } public Stain? Stain { get; private set; } diff --git a/Glamourer/Gui/MainWindow.cs b/Glamourer/Gui/MainWindow.cs index abde603..118377f 100644 --- a/Glamourer/Gui/MainWindow.cs +++ b/Glamourer/Gui/MainWindow.cs @@ -1,5 +1,4 @@ using Dalamud.Interface.ImGuiNotification; -using Dalamud.Interface.Windowing; using Dalamud.Plugin; using Glamourer.Designs; using Glamourer.Events; @@ -13,13 +12,16 @@ using Glamourer.Gui.Tabs.SettingsTab; using Glamourer.Gui.Tabs.UnlocksTab; using Glamourer.Interop.Penumbra; using Dalamud.Bindings.ImGui; +using Luna; using OtterGui; using OtterGui.Classes; using OtterGui.Custom; using OtterGui.Raii; -using OtterGui.Services; using OtterGui.Text; using OtterGui.Widgets; +using Changelog = OtterGui.Widgets.Changelog; +using ITab = OtterGui.Widgets.ITab; +using Window = Dalamud.Interface.Windowing.Window; namespace Glamourer.Gui; diff --git a/Glamourer/Gui/Materials/AdvancedDyePopup.cs b/Glamourer/Gui/Materials/AdvancedDyePopup.cs index 4499107..cf54dd7 100644 --- a/Glamourer/Gui/Materials/AdvancedDyePopup.cs +++ b/Glamourer/Gui/Materials/AdvancedDyePopup.cs @@ -9,8 +9,8 @@ using Glamourer.Designs; using Glamourer.Interop.Material; using Glamourer.State; using Dalamud.Bindings.ImGui; +using Luna; using OtterGui.Raii; -using OtterGui.Services; using OtterGui.Text; using OtterGui.Widgets; using Penumbra.GameData.Enums; diff --git a/Glamourer/Gui/Materials/MaterialDrawer.cs b/Glamourer/Gui/Materials/MaterialDrawer.cs index 7c16372..ea31dfa 100644 --- a/Glamourer/Gui/Materials/MaterialDrawer.cs +++ b/Glamourer/Gui/Materials/MaterialDrawer.cs @@ -4,16 +4,15 @@ using Dalamud.Interface.Utility.Raii; using Glamourer.Designs; using Glamourer.Interop.Material; using Dalamud.Bindings.ImGui; +using Luna; using OtterGui; -using OtterGui.Services; using OtterGui.Text; using Penumbra.GameData.Enums; using Penumbra.GameData.Files.MaterialStructs; -using Penumbra.GameData.Gui; namespace Glamourer.Gui.Materials; -public class MaterialDrawer(DesignManager _designManager, Configuration _config) : IService +public class MaterialDrawer(DesignManager designManager, Configuration config) : IService { public const float GlossWidth = 100; public const float SpecularStrengthWidth = 125; @@ -48,34 +47,34 @@ public class MaterialDrawer(DesignManager _designManager, Configuration _config) private void DrawMultiButtons(Design design) { var any = design.Materials.Count > 0; - var disabled = !_config.DeleteDesignModifier.IsActive(); + var disabled = !config.DeleteDesignModifier.IsActive(); var size = new Vector2(200 * ImUtf8.GlobalScale, 0); if (ImUtf8.ButtonEx("Enable All Advanced Dyes"u8, any ? "Enable the application of all contained advanced dyes without deleting them."u8 : "This design does not contain any advanced dyes."u8, size, !any || disabled)) - _designManager.ChangeApplyMulti(design, null, null, null, null, null, null, true, null); + designManager.ChangeApplyMulti(design, null, null, null, null, null, null, true, null); ; if (disabled && any) - ImUtf8.HoverTooltip($"Hold {_config.DeleteDesignModifier} while clicking to enable."); + ImUtf8.HoverTooltip($"Hold {config.DeleteDesignModifier} while clicking to enable."); ImGui.SameLine(); if (ImUtf8.ButtonEx("Disable All Advanced Dyes"u8, any ? "Disable the application of all contained advanced dyes without deleting them."u8 : "This design does not contain any advanced dyes."u8, size, !any || disabled)) - _designManager.ChangeApplyMulti(design, null, null, null, null, null, null, false, null); + designManager.ChangeApplyMulti(design, null, null, null, null, null, null, false, null); if (disabled && any) - ImUtf8.HoverTooltip($"Hold {_config.DeleteDesignModifier} while clicking to disable."); + ImUtf8.HoverTooltip($"Hold {config.DeleteDesignModifier} while clicking to disable."); if (ImUtf8.ButtonEx("Delete All Advanced Dyes"u8, any ? ""u8 : "This design does not contain any advanced dyes."u8, size, !any || disabled)) while (design.Materials.Count > 0) - _designManager.ChangeMaterialValue(design, MaterialValueIndex.FromKey(design.Materials[0].Item1), null); + designManager.ChangeMaterialValue(design, MaterialValueIndex.FromKey(design.Materials[0].Item1), null); if (disabled && any) - ImUtf8.HoverTooltip($"Hold {_config.DeleteDesignModifier} while clicking to delete."); + ImUtf8.HoverTooltip($"Hold {config.DeleteDesignModifier} while clicking to delete."); } private void DrawName(MaterialValueIndex index) @@ -138,13 +137,13 @@ public class MaterialDrawer(DesignManager _designManager, Configuration _config) private void DeleteButton(Design design, MaterialValueIndex index, ref int idx) { - var deleteEnabled = _config.DeleteDesignModifier.IsActive(); + var deleteEnabled = config.DeleteDesignModifier.IsActive(); if (!ImUtf8.IconButton(FontAwesomeIcon.Trash, - $"Delete this color row.{(deleteEnabled ? string.Empty : $"\nHold {_config.DeleteDesignModifier} to delete.")}", disabled: + $"Delete this color row.{(deleteEnabled ? string.Empty : $"\nHold {config.DeleteDesignModifier} to delete.")}", disabled: !deleteEnabled || design.WriteProtected())) return; - _designManager.ChangeMaterialValue(design, index, null); + designManager.ChangeMaterialValue(design, index, null); --idx; } @@ -158,19 +157,19 @@ public class MaterialDrawer(DesignManager _designManager, Configuration _config) { if (ImUtf8.IconButton(FontAwesomeIcon.Paste, "Import an exported row from your clipboard onto this row."u8, disabled: !ColorRowClipboard.IsSet || design.WriteProtected())) - _designManager.ChangeMaterialValue(design, index, ColorRowClipboard.Row); + designManager.ChangeMaterialValue(design, index, ColorRowClipboard.Row); } private void EnabledToggle(Design design, MaterialValueIndex index, bool enabled) { if (ImUtf8.Checkbox("Enabled"u8, ref enabled)) - _designManager.ChangeApplyMaterialValue(design, index, enabled); + designManager.ChangeApplyMaterialValue(design, index, enabled); } private void RevertToggle(Design design, MaterialValueIndex index, bool revert) { if (ImUtf8.Checkbox("Revert"u8, ref revert)) - _designManager.ChangeMaterialRevert(design, index, revert); + designManager.ChangeMaterialRevert(design, index, revert); ImUtf8.HoverTooltip( "If this is checked, Glamourer will try to revert the advanced dye row to its game state instead of applying a specific row."u8); } @@ -222,7 +221,7 @@ public class MaterialDrawer(DesignManager _designManager, Configuration _config) if (ImUtf8.ButtonEx("Add New Row"u8, exists ? "The selected advanced dye row already exists."u8 : "Add the selected advanced dye row."u8, Vector2.Zero, exists || design.WriteProtected())) - _designManager.ChangeMaterialValue(design, _newKey, ColorRow.Empty); + designManager.ChangeMaterialValue(design, _newKey, ColorRow.Empty); } private void DrawMaterialIdxDrag() @@ -270,6 +269,6 @@ public class MaterialDrawer(DesignManager _designManager, Configuration _config) applied |= AdvancedDyePopup.DragSpecularStrength(ref tmp.SpecularStrength); ImUtf8.HoverTooltip("Change the specular strength for this row."u8); if (applied) - _designManager.ChangeMaterialValue(design, index, tmp); + designManager.ChangeMaterialValue(design, index, tmp); } } diff --git a/Glamourer/Gui/Tabs/AutomationTab/IdentifierDrawer.cs b/Glamourer/Gui/Tabs/AutomationTab/IdentifierDrawer.cs index ba2e424..69000ee 100644 --- a/Glamourer/Gui/Tabs/AutomationTab/IdentifierDrawer.cs +++ b/Glamourer/Gui/Tabs/AutomationTab/IdentifierDrawer.cs @@ -26,7 +26,7 @@ public class IdentifierDrawer HumanModelList humans) { _actors = actors; - _worldCombo = new WorldCombo(dictWorld, Glamourer.Log); + _worldCombo = new WorldCombo(dictWorld); _humanNpcCombo = new HumanNpcCombo("##npcs", dictModelChara, bNpcNames, bNpc, humans, Glamourer.Log); } @@ -68,12 +68,12 @@ public class IdentifierDrawer { if (ByteString.FromString(_characterName, out var byteName)) { - PlayerIdentifier = _actors.CreatePlayer(byteName, _worldCombo.CurrentSelection.Key); + PlayerIdentifier = _actors.CreatePlayer(byteName, _worldCombo.Selected.Key); RetainerIdentifier = _actors.CreateRetainer(byteName, ActorIdentifier.RetainerType.Bell); MannequinIdentifier = _actors.CreateRetainer(byteName, ActorIdentifier.RetainerType.Mannequin); if (_humanNpcCombo.CurrentSelection.Kind is ObjectKind.EventNpc or ObjectKind.BattleNpc) - OwnedIdentifier = _actors.CreateOwned(byteName, _worldCombo.CurrentSelection.Key, _humanNpcCombo.CurrentSelection.Kind, _humanNpcCombo.CurrentSelection.Ids[0]); + OwnedIdentifier = _actors.CreateOwned(byteName, _worldCombo.Selected.Key, _humanNpcCombo.CurrentSelection.Kind, _humanNpcCombo.CurrentSelection.Ids[0]); else OwnedIdentifier = ActorIdentifier.Invalid; } diff --git a/Glamourer/Gui/Tabs/AutomationTab/RandomRestrictionDrawer.cs b/Glamourer/Gui/Tabs/AutomationTab/RandomRestrictionDrawer.cs index 8eba59b..02d1bd0 100644 --- a/Glamourer/Gui/Tabs/AutomationTab/RandomRestrictionDrawer.cs +++ b/Glamourer/Gui/Tabs/AutomationTab/RandomRestrictionDrawer.cs @@ -5,9 +5,9 @@ using Glamourer.Designs; using Glamourer.Designs.Special; using Glamourer.Events; using Dalamud.Bindings.ImGui; +using Luna; using OtterGui; using OtterGui.Raii; -using OtterGui.Services; using OtterGui.Text; namespace Glamourer.Gui.Tabs.AutomationTab; diff --git a/Glamourer/Gui/Tabs/AutomationTab/SetPanel.cs b/Glamourer/Gui/Tabs/AutomationTab/SetPanel.cs index 8a85a45..06a35d6 100644 --- a/Glamourer/Gui/Tabs/AutomationTab/SetPanel.cs +++ b/Glamourer/Gui/Tabs/AutomationTab/SetPanel.cs @@ -20,26 +20,26 @@ using Action = System.Action; namespace Glamourer.Gui.Tabs.AutomationTab; public class SetPanel( - SetSelector _selector, - AutoDesignManager _manager, - JobService _jobs, - ItemUnlockManager _itemUnlocks, - SpecialDesignCombo _designCombo, - CustomizeUnlockManager _customizeUnlocks, - CustomizeService _customizations, - IdentifierDrawer _identifierDrawer, - Configuration _config, - RandomRestrictionDrawer _randomDrawer) + SetSelector selector, + AutoDesignManager manager, + JobService jobs, + ItemUnlockManager itemUnlocks, + SpecialDesignCombo designCombo, + CustomizeUnlockManager customizeUnlocks, + CustomizeService customizations, + IdentifierDrawer identifierDrawer, + Configuration config, + RandomRestrictionDrawer randomDrawer) { - private readonly JobGroupCombo _jobGroupCombo = new(_manager, _jobs, Glamourer.Log); - private readonly HeaderDrawer.Button[] _rightButtons = [new HeaderDrawer.IncognitoButton(_config)]; + private readonly JobGroupCombo _jobGroupCombo = new(manager, jobs, Glamourer.Log); + private readonly HeaderDrawer.Button[] _rightButtons = [new HeaderDrawer.IncognitoButton(config)]; private string? _tempName; private int _dragIndex = -1; private Action? _endAction; private AutoDesignSet Selection - => _selector.Selection!; + => selector.Selection!; public void Draw() { @@ -49,12 +49,12 @@ public class SetPanel( } private void DrawHeader() - => HeaderDrawer.Draw(_selector.SelectionName, 0, ImGui.GetColorU32(ImGuiCol.FrameBg), [], _rightButtons); + => HeaderDrawer.Draw(selector.SelectionName, 0, ImGui.GetColorU32(ImGuiCol.FrameBg), [], _rightButtons); private void DrawPanel() { using var child = ImUtf8.Child("##Panel"u8, -Vector2.One, true); - if (!child || !_selector.HasSelection) + if (!child || !selector.HasSelection) return; var spacing = ImGui.GetStyle().ItemInnerSpacing with { Y = ImGui.GetStyle().ItemSpacing.Y }; @@ -65,16 +65,16 @@ public class SetPanel( { var enabled = Selection.Enabled; if (ImUtf8.Checkbox("##Enabled"u8, ref enabled)) - _manager.SetState(_selector.SelectionIndex, enabled); + manager.SetState(selector.SelectionIndex, enabled); ImUtf8.LabeledHelpMarker("Enabled"u8, "Whether the designs in this set should be applied at all. Only one set can be enabled for a character at the same time."u8); } using (ImRaii.PushStyle(ImGuiStyleVar.ItemSpacing, spacing)) { - var useGame = _selector.Selection!.BaseState is AutoDesignSet.Base.Game; + var useGame = selector.Selection!.BaseState is AutoDesignSet.Base.Game; if (ImUtf8.Checkbox("##gameState"u8, ref useGame)) - _manager.ChangeBaseState(_selector.SelectionIndex, useGame ? AutoDesignSet.Base.Game : AutoDesignSet.Base.Current); + manager.ChangeBaseState(selector.SelectionIndex, useGame ? AutoDesignSet.Base.Game : AutoDesignSet.Base.Current); ImUtf8.LabeledHelpMarker("Use Game State as Base"u8, "When this is enabled, the designs matching conditions will be applied successively on top of what your character is supposed to look like for the game. "u8 + "Otherwise, they will be applied on top of the characters actual current look using Glamourer."u8); @@ -86,11 +86,11 @@ public class SetPanel( { using (ImRaii.PushStyle(ImGuiStyleVar.ItemSpacing, spacing)) { - var editing = _config.ShowAutomationSetEditing; + var editing = config.ShowAutomationSetEditing; if (ImUtf8.Checkbox("##Show Editing"u8, ref editing)) { - _config.ShowAutomationSetEditing = editing; - _config.Save(); + config.ShowAutomationSetEditing = editing; + config.Save(); } ImUtf8.LabeledHelpMarker("Show Editing"u8, @@ -99,47 +99,47 @@ public class SetPanel( using (ImRaii.PushStyle(ImGuiStyleVar.ItemSpacing, spacing)) { - var resetSettings = _selector.Selection!.ResetTemporarySettings; + var resetSettings = selector.Selection!.ResetTemporarySettings; if (ImGui.Checkbox("##resetSettings", ref resetSettings)) - _manager.ChangeResetSettings(_selector.SelectionIndex, resetSettings); + manager.ChangeResetSettings(selector.SelectionIndex, resetSettings); ImUtf8.LabeledHelpMarker("Reset Temporary Settings"u8, "Always reset all temporary settings applied by Glamourer when this automation set is applied, regardless of active designs."u8); } } - if (_config.ShowAutomationSetEditing) + if (config.ShowAutomationSetEditing) { ImGui.Dummy(Vector2.Zero); ImGui.Separator(); ImGui.Dummy(Vector2.Zero); var name = _tempName ?? Selection.Name; - var flags = _selector.IncognitoMode ? ImGuiInputTextFlags.ReadOnly | ImGuiInputTextFlags.Password : ImGuiInputTextFlags.None; + var flags = selector.IncognitoMode ? ImGuiInputTextFlags.ReadOnly | ImGuiInputTextFlags.Password : ImGuiInputTextFlags.None; ImGui.SetNextItemWidth(330 * ImGuiHelpers.GlobalScale); if (ImGui.InputText("Rename Set##Name", ref name, 128, flags)) _tempName = name; if (ImGui.IsItemDeactivated()) { - _manager.Rename(_selector.SelectionIndex, name); + manager.Rename(selector.SelectionIndex, name); _tempName = null; } - DrawIdentifierSelection(_selector.SelectionIndex); + DrawIdentifierSelection(selector.SelectionIndex); } ImGui.Dummy(Vector2.Zero); ImGui.Separator(); ImGui.Dummy(Vector2.Zero); DrawDesignTable(); - _randomDrawer.Draw(); + randomDrawer.Draw(); } private void DrawDesignTable() { - var (numCheckboxes, numSpacing) = (_config.ShowAllAutomatedApplicationRules, _config.ShowUnlockedItemWarnings) switch + var (numCheckboxes, numSpacing) = (config.ShowAllAutomatedApplicationRules, config.ShowUnlockedItemWarnings) switch { (true, true) => (9, 14), (true, false) => (7, 10), @@ -153,7 +153,7 @@ public class SetPanel( + 150 * ImGuiHelpers.GlobalScale; var singleRow = ImGui.GetContentRegionAvail().X >= requiredSizeOneLine || numSpacing == 0; - var numRows = (singleRow, _config.ShowUnlockedItemWarnings) switch + var numRows = (singleRow, config.ShowUnlockedItemWarnings) switch { (true, true) => 6, (true, false) => 5, @@ -171,7 +171,7 @@ public class SetPanel( if (singleRow) { ImUtf8.TableSetupColumn("Design"u8, ImGuiTableColumnFlags.WidthFixed, 220 * ImGuiHelpers.GlobalScale); - if (_config.ShowAllAutomatedApplicationRules) + if (config.ShowAllAutomatedApplicationRules) ImUtf8.TableSetupColumn("Application"u8, ImGuiTableColumnFlags.WidthFixed, 6 * ImGui.GetFrameHeight() + 10 * ImGuiHelpers.GlobalScale); else @@ -181,7 +181,7 @@ public class SetPanel( { ImUtf8.TableSetupColumn("Design / Job Restrictions"u8, ImGuiTableColumnFlags.WidthFixed, 250 * ImGuiHelpers.GlobalScale - (ImGui.GetScrollMaxY() > 0 ? ImGui.GetStyle().ScrollbarSize : 0)); - if (_config.ShowAllAutomatedApplicationRules) + if (config.ShowAllAutomatedApplicationRules) ImUtf8.TableSetupColumn("Application"u8, ImGuiTableColumnFlags.WidthFixed, 3 * ImGui.GetFrameHeight() + 4 * ImGuiHelpers.GlobalScale); else @@ -191,7 +191,7 @@ public class SetPanel( if (singleRow) ImUtf8.TableSetupColumn("Job Restrictions"u8, ImGuiTableColumnFlags.WidthStretch); - if (_config.ShowUnlockedItemWarnings) + if (config.ShowUnlockedItemWarnings) ImUtf8.TableSetupColumn(""u8, ImGuiTableColumnFlags.WidthFixed, 2 * ImGui.GetFrameHeight() + 4 * ImGuiHelpers.GlobalScale); ImGui.TableHeadersRow(); @@ -199,19 +199,19 @@ public class SetPanel( { using var id = ImUtf8.PushId(idx); ImGui.TableNextColumn(); - var keyValid = _config.DeleteDesignModifier.IsActive(); + var keyValid = config.DeleteDesignModifier.IsActive(); var tt = keyValid ? "Remove this design from the set." - : $"Remove this design from the set.\nHold {_config.DeleteDesignModifier} to remove."; + : $"Remove this design from the set.\nHold {config.DeleteDesignModifier} to remove."; if (ImGuiUtil.DrawDisabledButton(FontAwesomeIcon.Trash.ToIconString(), new Vector2(ImGui.GetFrameHeight()), tt, !keyValid, true)) - _endAction = () => _manager.DeleteDesign(Selection, idx); + _endAction = () => manager.DeleteDesign(Selection, idx); ImGui.TableNextColumn(); DrawSelectable(idx, design.Design); ImGui.TableNextColumn(); DrawRandomEditing(Selection, design, idx); - _designCombo.Draw(Selection, design, idx); + designCombo.Draw(Selection, design, idx); DrawDragDrop(Selection, idx); if (singleRow) { @@ -227,7 +227,7 @@ public class SetPanel( DrawApplicationTypeBoxes(Selection, design, idx, singleRow); } - if (_config.ShowUnlockedItemWarnings) + if (config.ShowUnlockedItemWarnings) { ImGui.TableNextColumn(); DrawWarnings(design); @@ -238,7 +238,7 @@ public class SetPanel( ImGui.TableNextColumn(); ImUtf8.TextFrameAligned("New"u8); ImGui.TableNextColumn(); - _designCombo.Draw(Selection, null, -1); + designCombo.Draw(Selection, null, -1); ImGui.TableNextRow(); _endAction?.Invoke(); @@ -292,7 +292,7 @@ public class SetPanel( if (ImUtf8.Button($"{(usingGearset ? "Gearset:" : "Jobs:")}##usingGearset")) { usingGearset = !usingGearset; - _manager.ChangeGearsetCondition(Selection, idx, (short)(usingGearset ? 0 : -1)); + manager.ChangeGearsetCondition(Selection, idx, (short)(usingGearset ? 0 : -1)); } ImUtf8.HoverTooltip("Click to switch between Job and Gearset restrictions."u8); @@ -310,7 +310,7 @@ public class SetPanel( if (ImGui.IsItemDeactivatedAfterEdit()) { - _manager.ChangeGearsetCondition(Selection, idx, (short)(_tmpGearset - 1)); + manager.ChangeGearsetCondition(Selection, idx, (short)(_tmpGearset - 1)); _tmpGearset = int.MaxValue; _whichIndex = -1; } @@ -326,7 +326,7 @@ public class SetPanel( if (design.Design is not RandomDesign) return; - _randomDrawer.DrawButton(set, designIdx); + randomDrawer.DrawButton(set, designIdx); ImGui.SameLine(0, ImGui.GetStyle().ItemInnerSpacing.X); } @@ -348,16 +348,16 @@ public class SetPanel( continue; var item = designData.Item(slot); - if (!_itemUnlocks.IsUnlocked(item.Id, out _)) + if (!itemUnlocks.IsUnlocked(item.Id, out _)) sb.AppendLine($"{item.Name} in {slot.ToName()} slot is not unlocked. Consider obtaining it via gameplay means!"); } using var style = ImRaii.PushStyle(ImGuiStyleVar.ItemSpacing, new Vector2(2 * ImGuiHelpers.GlobalScale, 0)); - var tt = _config.UnlockedItemMode + var tt = config.UnlockedItemMode ? "\nThese items will be skipped when applied automatically.\n\nTo change this, disable the Obtained Item Mode setting." : string.Empty; - DrawWarning(sb, _config.UnlockedItemMode ? 0xA03030F0 : 0x0, size, tt, "All equipment to be applied is unlocked."); + DrawWarning(sb, config.UnlockedItemMode ? 0xA03030F0 : 0x0, size, tt, "All equipment to be applied is unlocked."); sb.Clear(); var sb2 = new StringBuilder(); @@ -365,7 +365,7 @@ public class SetPanel( if (!designData.IsHuman) sb.AppendLine("The base model id can not be changed automatically to something non-human."); - var set = _customizations.Manager.GetSet(customize.Clan, customize.Gender); + var set = customizations.Manager.GetSet(customize.Clan, customize.Gender); foreach (var type in CustomizationExtensions.All) { var flag = type.ToFlag(); @@ -376,16 +376,16 @@ public class SetPanel( sb.AppendLine($"{type.ToDefaultName()} Customization should not be changed automatically."); else if (type is CustomizeIndex.Hairstyle or CustomizeIndex.FacePaint && set.DataByValue(type, customize[type], out var data, customize.Face) >= 0 - && !_customizeUnlocks.IsUnlocked(data!.Value, out _)) + && !customizeUnlocks.IsUnlocked(data!.Value, out _)) sb2.AppendLine( - $"{type.ToDefaultName()} Customization {_customizeUnlocks.Unlockable[data.Value].Name} is not unlocked but should be applied."); + $"{type.ToDefaultName()} Customization {customizeUnlocks.Unlockable[data.Value].Name} is not unlocked but should be applied."); } ImGui.SameLine(); - tt = _config.UnlockedItemMode + tt = config.UnlockedItemMode ? "\nThese customizations will be skipped when applied automatically.\n\nTo change this, disable the Obtained Item Mode setting." : string.Empty; - DrawWarning(sb2, _config.UnlockedItemMode ? 0xA03030F0 : 0x0, size, tt, "All customizations to be applied are unlocked."); + DrawWarning(sb2, config.UnlockedItemMode ? 0xA03030F0 : 0x0, size, tt, "All customizations to be applied are unlocked."); ImGui.SameLine(); return; @@ -420,7 +420,7 @@ public class SetPanel( if (_dragIndex >= 0) { var idx = _dragIndex; - _endAction = () => _manager.MoveDesign(set, idx, index); + _endAction = () => manager.MoveDesign(set, idx, index); } _dragIndex = -1; @@ -435,7 +435,7 @@ public class SetPanel( if (ImGui.SetDragDropPayload(dragDropLabel, null, 0)) { _dragIndex = index; - _selector.DragDesignIndex = index; + selector.DragDesignIndex = index; } } } @@ -455,7 +455,7 @@ public class SetPanel( style.Pop(); ImUtf8.HoverTooltip("Toggle all application modes at once."u8); - if (_config.ShowAllAutomatedApplicationRules) + if (config.ShowAllAutomatedApplicationRules) { void Box(int idx) { @@ -480,31 +480,31 @@ public class SetPanel( Box(4); } - _manager.ChangeApplicationType(set, autoDesignIndex, newType); + manager.ChangeApplicationType(set, autoDesignIndex, newType); } private void DrawIdentifierSelection(int setIndex) { using var id = ImUtf8.PushId("Identifiers"u8); - _identifierDrawer.DrawWorld(130); + identifierDrawer.DrawWorld(130); ImGui.SameLine(); - _identifierDrawer.DrawName(200 - ImGui.GetStyle().ItemSpacing.X); - _identifierDrawer.DrawNpcs(330); + identifierDrawer.DrawName(200 - ImGui.GetStyle().ItemSpacing.X); + identifierDrawer.DrawNpcs(330); var buttonWidth = new Vector2(165 * ImGuiHelpers.GlobalScale - ImGui.GetStyle().ItemSpacing.X / 2, 0); - if (ImUtf8.ButtonEx("Set to Character"u8, string.Empty, buttonWidth, !_identifierDrawer.CanSetPlayer)) - _manager.ChangeIdentifier(setIndex, _identifierDrawer.PlayerIdentifier); + if (ImUtf8.ButtonEx("Set to Character"u8, string.Empty, buttonWidth, !identifierDrawer.CanSetPlayer)) + manager.ChangeIdentifier(setIndex, identifierDrawer.PlayerIdentifier); ImGui.SameLine(); - if (ImUtf8.ButtonEx("Set to NPC"u8, string.Empty, buttonWidth, !_identifierDrawer.CanSetNpc)) - _manager.ChangeIdentifier(setIndex, _identifierDrawer.NpcIdentifier); + if (ImUtf8.ButtonEx("Set to NPC"u8, string.Empty, buttonWidth, !identifierDrawer.CanSetNpc)) + manager.ChangeIdentifier(setIndex, identifierDrawer.NpcIdentifier); - if (ImUtf8.ButtonEx("Set to Retainer"u8, string.Empty, buttonWidth, !_identifierDrawer.CanSetRetainer)) - _manager.ChangeIdentifier(setIndex, _identifierDrawer.RetainerIdentifier); + if (ImUtf8.ButtonEx("Set to Retainer"u8, string.Empty, buttonWidth, !identifierDrawer.CanSetRetainer)) + manager.ChangeIdentifier(setIndex, identifierDrawer.RetainerIdentifier); ImGui.SameLine(); - if (ImUtf8.ButtonEx("Set to Mannequin"u8, string.Empty, buttonWidth, !_identifierDrawer.CanSetRetainer)) - _manager.ChangeIdentifier(setIndex, _identifierDrawer.MannequinIdentifier); + if (ImUtf8.ButtonEx("Set to Mannequin"u8, string.Empty, buttonWidth, !identifierDrawer.CanSetRetainer)) + manager.ChangeIdentifier(setIndex, identifierDrawer.MannequinIdentifier); - if (ImUtf8.ButtonEx("Set to Owned NPC"u8, string.Empty, buttonWidth, !_identifierDrawer.CanSetOwned)) - _manager.ChangeIdentifier(setIndex, _identifierDrawer.OwnedIdentifier); + if (ImUtf8.ButtonEx("Set to Owned NPC"u8, string.Empty, buttonWidth, !identifierDrawer.CanSetOwned)) + manager.ChangeIdentifier(setIndex, identifierDrawer.OwnedIdentifier); } private sealed class JobGroupCombo(AutoDesignManager manager, JobService jobs, Logger log) @@ -514,7 +514,7 @@ public class SetPanel( { CurrentSelection = design.Jobs; CurrentSelectionIdx = jobs.JobGroups.Values.IndexOf(j => j.Id == design.Jobs.Id); - if (Draw("##JobGroups", design.Jobs.Name, + if (Draw("##JobGroups", design.Jobs.Name.ToString(), "Select for which job groups this design should be applied.\nControl + Right-Click to set to all classes.", ImGui.GetContentRegionAvail().X, ImGui.GetTextLineHeightWithSpacing()) && CurrentSelectionIdx >= 0) @@ -524,6 +524,6 @@ public class SetPanel( } protected override string ToString(JobGroup obj) - => obj.Name; + => obj.Name.ToString(); } } diff --git a/Glamourer/Gui/Tabs/DebugTab/ActiveStatePanel.cs b/Glamourer/Gui/Tabs/DebugTab/ActiveStatePanel.cs index 35642a7..02ca42d 100644 --- a/Glamourer/Gui/Tabs/DebugTab/ActiveStatePanel.cs +++ b/Glamourer/Gui/Tabs/DebugTab/ActiveStatePanel.cs @@ -3,6 +3,7 @@ using Glamourer.GameData; using Glamourer.Designs; using Glamourer.State; using Dalamud.Bindings.ImGui; +using ImSharp; using OtterGui; using OtterGui.Raii; using Penumbra.GameData.Enums; @@ -11,29 +12,29 @@ using Penumbra.GameData.Interop; namespace Glamourer.Gui.Tabs.DebugTab; -public class ActiveStatePanel(StateManager _stateManager, ActorObjectManager _objectManager) : IGameDataDrawer +public sealed class ActiveStatePanel(StateManager stateManager, ActorObjectManager objectManager) : IGameDataDrawer { - public string Label - => $"Active Actors ({_stateManager.Count})###Active Actors"; + public ReadOnlySpan Label + => new StringU8($"Active Actors ({stateManager.Count})###Active Actors"); public bool Disabled => false; public void Draw() { - foreach (var (identifier, actors) in _objectManager) + foreach (var (identifier, actors) in objectManager) { if (ImGuiUtil.DrawDisabledButton($"{FontAwesomeIcon.Trash.ToIconString()}##{actors.Label}", new Vector2(ImGui.GetFrameHeight()), - string.Empty, !_stateManager.ContainsKey(identifier), true)) - _stateManager.DeleteState(identifier); + string.Empty, !stateManager.ContainsKey(identifier), true)) + stateManager.DeleteState(identifier); ImGui.SameLine(); using var t = ImRaii.TreeNode(actors.Label); if (!t) continue; - if (_stateManager.GetOrCreate(identifier, actors.Objects[0], out var state)) - DrawState(_stateManager, actors, state); + if (stateManager.GetOrCreate(identifier, actors.Objects[0], out var state)) + DrawState(stateManager, actors, state); else ImGui.TextUnformatted("Invalid actor."); } diff --git a/Glamourer/Gui/Tabs/DebugTab/AdvancedCustomizationDrawer.cs b/Glamourer/Gui/Tabs/DebugTab/AdvancedCustomizationDrawer.cs index 2202ceb..3abb071 100644 --- a/Glamourer/Gui/Tabs/DebugTab/AdvancedCustomizationDrawer.cs +++ b/Glamourer/Gui/Tabs/DebugTab/AdvancedCustomizationDrawer.cs @@ -7,10 +7,10 @@ using Penumbra.GameData.Interop; namespace Glamourer.Gui.Tabs.DebugTab; -public unsafe class AdvancedCustomizationDrawer(ActorObjectManager objects) : IGameDataDrawer +public sealed unsafe class AdvancedCustomizationDrawer(ActorObjectManager objects) : IGameDataDrawer { - public string Label - => "Advanced Customizations"; + public ReadOnlySpan Label + => "Advanced Customizations"u8; public bool Disabled => false; diff --git a/Glamourer/Gui/Tabs/DebugTab/AutoDesignPanel.cs b/Glamourer/Gui/Tabs/DebugTab/AutoDesignPanel.cs index aee59b6..f87907e 100644 --- a/Glamourer/Gui/Tabs/DebugTab/AutoDesignPanel.cs +++ b/Glamourer/Gui/Tabs/DebugTab/AutoDesignPanel.cs @@ -7,17 +7,17 @@ using Penumbra.GameData.Gui.Debug; namespace Glamourer.Gui.Tabs.DebugTab; -public class AutoDesignPanel(AutoDesignManager _autoDesignManager) : IGameDataDrawer +public sealed class AutoDesignPanel(AutoDesignManager autoDesignManager) : IGameDataDrawer { - public string Label - => "Auto Designs"; + public ReadOnlySpan Label + => "Auto Designs"u8; public bool Disabled => false; public void Draw() { - foreach (var (set, idx) in _autoDesignManager.WithIndex()) + foreach (var (set, idx) in autoDesignManager.WithIndex()) { using var id = ImRaii.PushId(idx); using var tree = ImRaii.TreeNode(set.Name); diff --git a/Glamourer/Gui/Tabs/DebugTab/CustomizationServicePanel.cs b/Glamourer/Gui/Tabs/DebugTab/CustomizationServicePanel.cs index 6c0995c..66b5f32 100644 --- a/Glamourer/Gui/Tabs/DebugTab/CustomizationServicePanel.cs +++ b/Glamourer/Gui/Tabs/DebugTab/CustomizationServicePanel.cs @@ -11,10 +11,10 @@ using Penumbra.GameData.Structs; namespace Glamourer.Gui.Tabs.DebugTab; -public class CustomizationServicePanel(CustomizeService customize) : IGameDataDrawer +public sealed class CustomizationServicePanel(CustomizeService customize) : IGameDataDrawer { - public string Label - => "Customization Service"; + public ReadOnlySpan Label + => "Customization Service"u8; public bool Disabled => !customize.Finished; diff --git a/Glamourer/Gui/Tabs/DebugTab/CustomizationUnlockPanel.cs b/Glamourer/Gui/Tabs/DebugTab/CustomizationUnlockPanel.cs index 4bf7d7b..6e0933c 100644 --- a/Glamourer/Gui/Tabs/DebugTab/CustomizationUnlockPanel.cs +++ b/Glamourer/Gui/Tabs/DebugTab/CustomizationUnlockPanel.cs @@ -7,10 +7,10 @@ using Penumbra.GameData.Gui.Debug; namespace Glamourer.Gui.Tabs.DebugTab; -public class CustomizationUnlockPanel(CustomizeUnlockManager _customizeUnlocks) : IGameDataDrawer +public sealed class CustomizationUnlockPanel(CustomizeUnlockManager customizeUnlocks) : IGameDataDrawer { - public string Label - => "Customizations"; + public ReadOnlySpan Label + => "Customizations"u8; public bool Disabled => false; @@ -26,19 +26,19 @@ public class CustomizationUnlockPanel(CustomizeUnlockManager _customizeUnlocks) ImGui.TableNextColumn(); var skips = ImGuiClip.GetNecessarySkips(ImGui.GetTextLineHeightWithSpacing()); ImGui.TableNextRow(); - var remainder = ImGuiClip.ClippedDraw(_customizeUnlocks.Unlockable, skips, t => + var remainder = ImGuiClip.ClippedDraw(customizeUnlocks.Unlockable, skips, t => { ImGuiUtil.DrawTableColumn(t.Key.Index.ToDefaultName()); ImGuiUtil.DrawTableColumn(t.Key.CustomizeId.ToString()); ImGuiUtil.DrawTableColumn(t.Key.Value.Value.ToString()); ImGuiUtil.DrawTableColumn(t.Value.Data.ToString()); ImGuiUtil.DrawTableColumn(t.Value.Name); - ImGuiUtil.DrawTableColumn(_customizeUnlocks.IsUnlocked(t.Key, out var time) + ImGuiUtil.DrawTableColumn(customizeUnlocks.IsUnlocked(t.Key, out var time) ? time == DateTimeOffset.MinValue ? "Always" : time.LocalDateTime.ToString("g") : "Never"); - }, _customizeUnlocks.Unlockable.Count); + }, customizeUnlocks.Unlockable.Count); ImGuiClip.DrawEndDummy(remainder, ImGui.GetTextLineHeight()); } } diff --git a/Glamourer/Gui/Tabs/DebugTab/DatFilePanel.cs b/Glamourer/Gui/Tabs/DebugTab/DatFilePanel.cs index 7c61392..852a47d 100644 --- a/Glamourer/Gui/Tabs/DebugTab/DatFilePanel.cs +++ b/Glamourer/Gui/Tabs/DebugTab/DatFilePanel.cs @@ -6,26 +6,26 @@ using Penumbra.GameData.Gui.Debug; namespace Glamourer.Gui.Tabs.DebugTab; -public class DatFilePanel(ImportService _importService) : IGameDataDrawer +public sealed class DatFilePanel(ImportService importService) : IGameDataDrawer { - public string Label - => "Character Dat File"; + public ReadOnlySpan Label + => "Character Dat File"u8; public bool Disabled => false; private string _datFilePath = string.Empty; - private DatCharacterFile? _datFile = null; + private DatCharacterFile? _datFile; public void Draw() { ImGui.InputTextWithHint("##datFilePath", "Dat File Path...", ref _datFilePath, 256); var exists = _datFilePath.Length > 0 && File.Exists(_datFilePath); if (ImGuiUtil.DrawDisabledButton("Load##Dat", Vector2.Zero, string.Empty, !exists)) - _datFile = _importService.LoadDat(_datFilePath, out var tmp) ? tmp : null; + _datFile = importService.LoadDat(_datFilePath, out var tmp) ? tmp : null; if (ImGuiUtil.DrawDisabledButton("Save##Dat", Vector2.Zero, string.Empty, _datFilePath.Length == 0 || _datFile == null)) - _importService.SaveDesignAsDat(_datFilePath, _datFile!.Value.Customize, _datFile!.Value.Description); + importService.SaveDesignAsDat(_datFilePath, _datFile!.Value.Customize, _datFile!.Value.Description); if (_datFile != null) { diff --git a/Glamourer/Gui/Tabs/DebugTab/DebugTab.cs b/Glamourer/Gui/Tabs/DebugTab/DebugTab.cs index b760221..3162759 100644 --- a/Glamourer/Gui/Tabs/DebugTab/DebugTab.cs +++ b/Glamourer/Gui/Tabs/DebugTab/DebugTab.cs @@ -1,7 +1,7 @@ using Dalamud.Bindings.ImGui; +using Luna; using OtterGui.Raii; -using OtterGui.Services; -using OtterGui.Widgets; +using ITab = OtterGui.Widgets.ITab; namespace Glamourer.Gui.Tabs.DebugTab; @@ -32,7 +32,7 @@ public unsafe class DebugTab(ServiceManager manager) : ITab if (ImGui.CollapsingHeader("General")) { - manager.Timers.Draw("Timers"); + StartTimeTracker.Draw("Timers"u8); } foreach (var header in _headers) diff --git a/Glamourer/Gui/Tabs/DebugTab/DebugTabHeader.cs b/Glamourer/Gui/Tabs/DebugTab/DebugTabHeader.cs index 3df425f..d6f2369 100644 --- a/Glamourer/Gui/Tabs/DebugTab/DebugTabHeader.cs +++ b/Glamourer/Gui/Tabs/DebugTab/DebugTabHeader.cs @@ -1,4 +1,5 @@ using Glamourer.Gui.Tabs.DebugTab.IpcTester; +using ImSharp; using Microsoft.Extensions.DependencyInjection; using OtterGui.Raii; using Penumbra.GameData.Gui.Debug; @@ -18,8 +19,8 @@ public class DebugTabHeader(string label, params IGameDataDrawer[] subTrees) foreach (var subTree in SubTrees) { - using var disabled = ImRaii.Disabled(subTree.Disabled); - using var tree = ImRaii.TreeNode(subTree.Label); + var disabled = Im.Disabled(subTree.Disabled); + using var tree = Im.Tree.Node(subTree.Label); if (tree) { disabled.Dispose(); diff --git a/Glamourer/Gui/Tabs/DebugTab/DesignConverterPanel.cs b/Glamourer/Gui/Tabs/DebugTab/DesignConverterPanel.cs index 287d373..e5c436b 100644 --- a/Glamourer/Gui/Tabs/DebugTab/DesignConverterPanel.cs +++ b/Glamourer/Gui/Tabs/DebugTab/DesignConverterPanel.cs @@ -9,10 +9,10 @@ using Penumbra.GameData.Gui.Debug; namespace Glamourer.Gui.Tabs.DebugTab; -public class DesignConverterPanel(DesignConverter _designConverter) : IGameDataDrawer +public sealed class DesignConverterPanel(DesignConverter designConverter) : IGameDataDrawer { - public string Label - => "Design Converter"; + public ReadOnlySpan Label + => "Design Converter"u8; public bool Disabled => false; @@ -48,7 +48,7 @@ public class DesignConverterPanel(DesignConverter _designConverter) : IGameDataD _version = _clipboardData.Decompress(out _dataUncompressed); _textUncompressed = Encoding.UTF8.GetString(_dataUncompressed); _json = JObject.Parse(_textUncompressed); - _tmpDesign = _designConverter.FromBase64(_clipboardText, true, true, out _); + _tmpDesign = designConverter.FromBase64(_clipboardText, true, true, out _); } catch (Exception ex) { diff --git a/Glamourer/Gui/Tabs/DebugTab/DesignManagerPanel.cs b/Glamourer/Gui/Tabs/DebugTab/DesignManagerPanel.cs index 7c60dda..fbcab76 100644 --- a/Glamourer/Gui/Tabs/DebugTab/DesignManagerPanel.cs +++ b/Glamourer/Gui/Tabs/DebugTab/DesignManagerPanel.cs @@ -1,9 +1,9 @@ using Dalamud.Interface; using Glamourer.Designs; using Dalamud.Bindings.ImGui; +using ImSharp; using OtterGui; using OtterGui.Extensions; -using OtterGui.Filesystem; using OtterGui.Raii; using OtterGui.Text; using Penumbra.GameData.Enums; @@ -11,10 +11,10 @@ using Penumbra.GameData.Gui.Debug; namespace Glamourer.Gui.Tabs.DebugTab; -public class DesignManagerPanel(DesignManager _designManager, DesignFileSystem _designFileSystem) : IGameDataDrawer +public sealed class DesignManagerPanel(DesignManager designManager, DesignFileSystem designFileSystem) : IGameDataDrawer { - public string Label - => $"Design Manager ({_designManager.Designs.Count} Designs)###Design Manager"; + public ReadOnlySpan Label + => new StringU8($"Design Manager ({designManager.Designs.Count} Designs)###Design Manager"); public bool Disabled => false; @@ -22,13 +22,13 @@ public class DesignManagerPanel(DesignManager _designManager, DesignFileSystem _ public void Draw() { DrawButtons(); - foreach (var (design, idx) in _designManager.Designs.WithIndex()) + foreach (var (design, idx) in designManager.Designs.WithIndex()) { using var t = ImRaii.TreeNode($"{design.Name}##{idx}"); if (!t) continue; - DrawDesign(design, _designFileSystem); + DrawDesign(design, designFileSystem); var base64 = DesignBase64Migration.CreateOldBase64(design.DesignData, design.Application.Equip, design.Application.Customize, design.Application.Meta, design.WriteProtected()); @@ -44,18 +44,18 @@ public class DesignManagerPanel(DesignManager _designManager, DesignFileSystem _ if (ImUtf8.Button("Generate 500 Test Designs"u8)) for (var i = 0; i < 500; ++i) { - var design = _designManager.CreateEmpty($"Test Designs/Test Design {i}", true); - _designManager.AddTag(design, "_DebugTest"); + var design = designManager.CreateEmpty($"Test Designs/Test Design {i}", true); + designManager.AddTag(design, "_DebugTest"); } ImUtf8.SameLineInner(); if (ImUtf8.Button("Remove All Test Designs"u8)) { - var designs = _designManager.Designs.Where(d => d.Tags.Contains("_DebugTest")).ToArray(); + var designs = designManager.Designs.Where(d => d.Tags.Contains("_DebugTest")).ToArray(); foreach (var design in designs) - _designManager.Delete(design); - if (_designFileSystem.Find("Test Designs", out var path) && path is DesignFileSystem.Folder { TotalChildren: 0 }) - _designFileSystem.Delete(path); + designManager.Delete(design); + if (designFileSystem.Find("Test Designs", out var path) && path is DesignFileSystem.Folder { TotalChildren: 0 }) + designFileSystem.Delete(path); } } diff --git a/Glamourer/Gui/Tabs/DebugTab/DesignTesterPanel.cs b/Glamourer/Gui/Tabs/DebugTab/DesignTesterPanel.cs index cf45077..60b06ab 100644 --- a/Glamourer/Gui/Tabs/DebugTab/DesignTesterPanel.cs +++ b/Glamourer/Gui/Tabs/DebugTab/DesignTesterPanel.cs @@ -11,10 +11,10 @@ using Penumbra.GameData.Gui.Debug; namespace Glamourer.Gui.Tabs.DebugTab; -public class DesignTesterPanel(ItemManager _items, HumanModelList _humans) : IGameDataDrawer +public sealed class DesignTesterPanel(ItemManager items, HumanModelList humans) : IGameDataDrawer { - public string Label - => "Base64 Design Tester"; + public ReadOnlySpan Label + => "Base64 Design Tester"u8; public bool Disabled => false; @@ -56,7 +56,7 @@ public class DesignTesterPanel(ItemManager _items, HumanModelList _humans) : IGa try { - _parse64 = DesignBase64Migration.MigrateBase64(_items, _humans, _base64, out var ef, out var cf, out var wp, out var meta); + _parse64 = DesignBase64Migration.MigrateBase64(items, humans, _base64, out var ef, out var cf, out var wp, out var meta); _restore = DesignBase64Migration.CreateOldBase64(in _parse64, ef, cf, meta, wp); _restoreBytes = Convert.FromBase64String(_restore); } diff --git a/Glamourer/Gui/Tabs/DebugTab/DynamisPanel.cs b/Glamourer/Gui/Tabs/DebugTab/DynamisPanel.cs index 92cd777..0d7e97c 100644 --- a/Glamourer/Gui/Tabs/DebugTab/DynamisPanel.cs +++ b/Glamourer/Gui/Tabs/DebugTab/DynamisPanel.cs @@ -1,12 +1,12 @@ -using OtterGui.Services; +using Luna; using Penumbra.GameData.Gui.Debug; namespace Glamourer.Gui.Tabs.DebugTab; -public class DynamisPanel(DynamisIpc dynamis) : IGameDataDrawer +public sealed class DynamisPanel(DynamisIpc dynamis) : IGameDataDrawer { - public string Label - => "Dynamis Interop"; + public ReadOnlySpan Label + => "Dynamis Interop"u8; public void Draw() => dynamis.DrawDebugInfo(); diff --git a/Glamourer/Gui/Tabs/DebugTab/FunPanel.cs b/Glamourer/Gui/Tabs/DebugTab/FunPanel.cs index 370c4e5..db4b266 100644 --- a/Glamourer/Gui/Tabs/DebugTab/FunPanel.cs +++ b/Glamourer/Gui/Tabs/DebugTab/FunPanel.cs @@ -4,33 +4,33 @@ using Penumbra.GameData.Gui.Debug; namespace Glamourer.Gui.Tabs.DebugTab; -public class FunPanel(FunModule _funModule, Configuration _config) : IGameDataDrawer +public sealed class FunPanel(FunModule funModule, Configuration config) : IGameDataDrawer { - public string Label - => "Fun Module"; + public ReadOnlySpan Label + => "Fun Module"u8; public bool Disabled => false; public void Draw() { - ImGui.TextUnformatted($"Current Festival: {_funModule.CurrentFestival}"); - ImGui.TextUnformatted($"Festivals Enabled: {_config.DisableFestivals switch { 1 => "Undecided", 0 => "Enabled", _ => "Disabled" }}"); + ImGui.TextUnformatted($"Current Festival: {funModule.CurrentFestival}"); + ImGui.TextUnformatted($"Festivals Enabled: {config.DisableFestivals switch { 1 => "Undecided", 0 => "Enabled", _ => "Disabled" }}"); ImGui.TextUnformatted($"Popup Open: {ImGui.IsPopupOpen("FestivalPopup", ImGuiPopupFlags.AnyPopup)}"); if (ImGui.Button("Force Christmas")) - _funModule.ForceFestival(FunModule.FestivalType.Christmas); + funModule.ForceFestival(FunModule.FestivalType.Christmas); if (ImGui.Button("Force Halloween")) - _funModule.ForceFestival(FunModule.FestivalType.Halloween); + funModule.ForceFestival(FunModule.FestivalType.Halloween); if (ImGui.Button("Force April First")) - _funModule.ForceFestival(FunModule.FestivalType.AprilFirst); + funModule.ForceFestival(FunModule.FestivalType.AprilFirst); if (ImGui.Button("Force None")) - _funModule.ForceFestival(FunModule.FestivalType.None); + funModule.ForceFestival(FunModule.FestivalType.None); if (ImGui.Button("Revert")) - _funModule.ResetFestival(); + funModule.ResetFestival(); if (ImGui.Button("Reset Popup")) { - _config.DisableFestivals = 1; - _config.Save(); + config.DisableFestivals = 1; + config.Save(); } } } diff --git a/Glamourer/Gui/Tabs/DebugTab/GlamourPlatePanel.cs b/Glamourer/Gui/Tabs/DebugTab/GlamourPlatePanel.cs index f480f6d..9fcf33c 100644 --- a/Glamourer/Gui/Tabs/DebugTab/GlamourPlatePanel.cs +++ b/Glamourer/Gui/Tabs/DebugTab/GlamourPlatePanel.cs @@ -6,7 +6,6 @@ using Glamourer.Designs; using Glamourer.Services; using Glamourer.State; using Dalamud.Bindings.ImGui; -using OtterGui; using OtterGui.Extensions; using OtterGui.Text; using Penumbra.GameData; @@ -17,15 +16,15 @@ using Penumbra.GameData.Structs; namespace Glamourer.Gui.Tabs.DebugTab; -public unsafe class GlamourPlatePanel : IGameDataDrawer +public sealed unsafe class GlamourPlatePanel : IGameDataDrawer { private readonly DesignManager _design; private readonly ItemManager _items; private readonly StateManager _state; private readonly ActorObjectManager _objects; - public string Label - => "Glamour Plates"; + public ReadOnlySpan Label + => "Glamour Plates"u8; public bool Disabled => false; diff --git a/Glamourer/Gui/Tabs/DebugTab/InventoryPanel.cs b/Glamourer/Gui/Tabs/DebugTab/InventoryPanel.cs index ca9ff7b..01617ee 100644 --- a/Glamourer/Gui/Tabs/DebugTab/InventoryPanel.cs +++ b/Glamourer/Gui/Tabs/DebugTab/InventoryPanel.cs @@ -6,10 +6,10 @@ using Penumbra.GameData.Gui.Debug; namespace Glamourer.Gui.Tabs.DebugTab; -public unsafe class InventoryPanel : IGameDataDrawer +public sealed unsafe class InventoryPanel : IGameDataDrawer { - public string Label - => "Inventory"; + public ReadOnlySpan Label + => "Inventory"u8; public bool Disabled => false; diff --git a/Glamourer/Gui/Tabs/DebugTab/IpcTester/DesignIpcTester.cs b/Glamourer/Gui/Tabs/DebugTab/IpcTester/DesignIpcTester.cs index 8cbf57a..fbf3247 100644 --- a/Glamourer/Gui/Tabs/DebugTab/IpcTester/DesignIpcTester.cs +++ b/Glamourer/Gui/Tabs/DebugTab/IpcTester/DesignIpcTester.cs @@ -4,9 +4,9 @@ using Dalamud.Plugin; using Glamourer.Api.Enums; using Glamourer.Api.IpcSubscribers; using Dalamud.Bindings.ImGui; +using Luna; using OtterGui; using OtterGui.Raii; -using OtterGui.Services; using OtterGui.Text; namespace Glamourer.Gui.Tabs.DebugTab.IpcTester; diff --git a/Glamourer/Gui/Tabs/DebugTab/IpcTester/IpcTesterPanel.cs b/Glamourer/Gui/Tabs/DebugTab/IpcTester/IpcTesterPanel.cs index 22c7597..9210c38 100644 --- a/Glamourer/Gui/Tabs/DebugTab/IpcTester/IpcTesterPanel.cs +++ b/Glamourer/Gui/Tabs/DebugTab/IpcTester/IpcTesterPanel.cs @@ -6,15 +6,15 @@ using Penumbra.GameData.Gui.Debug; namespace Glamourer.Gui.Tabs.DebugTab.IpcTester; -public class IpcTesterPanel( +public sealed class IpcTesterPanel( IDalamudPluginInterface pluginInterface, DesignIpcTester designs, ItemsIpcTester items, StateIpcTester state, IFramework framework) : IGameDataDrawer { - public string Label - => "IPC Tester"; + public ReadOnlySpan Label + => "IPC Tester"u8; public bool Disabled => false; diff --git a/Glamourer/Gui/Tabs/DebugTab/IpcTester/ItemsIpcTester.cs b/Glamourer/Gui/Tabs/DebugTab/IpcTester/ItemsIpcTester.cs index ea95a9d..2400fb7 100644 --- a/Glamourer/Gui/Tabs/DebugTab/IpcTester/ItemsIpcTester.cs +++ b/Glamourer/Gui/Tabs/DebugTab/IpcTester/ItemsIpcTester.cs @@ -2,9 +2,10 @@ using Glamourer.Api.Enums; using Glamourer.Api.IpcSubscribers; using Dalamud.Bindings.ImGui; +using ImSharp; +using Luna; using OtterGui; using OtterGui.Raii; -using OtterGui.Services; using Penumbra.GameData.Enums; using Penumbra.GameData.Gui; using Penumbra.GameData.Structs; @@ -67,8 +68,8 @@ public class ItemsIpcTester(IDalamudPluginInterface pluginInterface) : IUiServic ImGui.SetNextItemWidth(width); if (ImGuiUtil.InputUlong("Custom Item ID", ref tmp)) _customItemId = tmp; - EquipSlotCombo.Draw("Equip Slot", string.Empty, ref _slot, width); - BonusSlotCombo.Draw("Bonus Slot", string.Empty, ref _bonusSlot, width); + EquipSlotCombo.Draw("Equip Slot"u8, StringU8.Empty, ref _slot, width); + BonusSlotCombo.Draw("Bonus Slot"u8, StringU8.Empty, ref _bonusSlot, width); var value = (int)_stainId.Id; ImGui.SetNextItemWidth(width); if (ImGui.InputInt("Stain ID", ref value, 1, 3)) diff --git a/Glamourer/Gui/Tabs/DebugTab/IpcTester/StateIpcTester.cs b/Glamourer/Gui/Tabs/DebugTab/IpcTester/StateIpcTester.cs index 6fb9d68..519bfdf 100644 --- a/Glamourer/Gui/Tabs/DebugTab/IpcTester/StateIpcTester.cs +++ b/Glamourer/Gui/Tabs/DebugTab/IpcTester/StateIpcTester.cs @@ -6,11 +6,11 @@ using Glamourer.Api.Enums; using Glamourer.Api.Helpers; using Glamourer.Api.IpcSubscribers; using Glamourer.Designs; +using Luna; using Newtonsoft.Json; using Newtonsoft.Json.Linq; using OtterGui; using OtterGui.Raii; -using OtterGui.Services; using OtterGui.Text; using Penumbra.GameData.Interop; using Penumbra.String; diff --git a/Glamourer/Gui/Tabs/DebugTab/ItemUnlockPanel.cs b/Glamourer/Gui/Tabs/DebugTab/ItemUnlockPanel.cs index f82bfb3..72ed68f 100644 --- a/Glamourer/Gui/Tabs/DebugTab/ItemUnlockPanel.cs +++ b/Glamourer/Gui/Tabs/DebugTab/ItemUnlockPanel.cs @@ -10,10 +10,10 @@ using ImGuiClip = OtterGui.ImGuiClip; namespace Glamourer.Gui.Tabs.DebugTab; -public class ItemUnlockPanel(ItemUnlockManager _itemUnlocks, ItemManager _items) : IGameDataDrawer +public sealed class ItemUnlockPanel(ItemUnlockManager itemUnlocks, ItemManager items) : IGameDataDrawer { - public string Label - => "Unlocked Items"; + public ReadOnlySpan Label + => "Unlocked Items"u8; public bool Disabled => false; @@ -35,10 +35,10 @@ public class ItemUnlockPanel(ItemUnlockManager _itemUnlocks, ItemManager _items) ImGui.TableNextColumn(); var skips = ImGuiClip.GetNecessarySkips(ImGui.GetTextLineHeightWithSpacing()); ImGui.TableNextRow(); - var remainder = ImGuiClip.ClippedDraw(_itemUnlocks, skips, t => + var remainder = ImGuiClip.ClippedDraw(itemUnlocks, skips, t => { ImGuiUtil.DrawTableColumn(t.Key.ToString()); - if (_items.ItemData.TryGetValue(t.Key, EquipSlot.MainHand, out var equip)) + if (items.ItemData.TryGetValue(t.Key, EquipSlot.MainHand, out var equip)) { ImGuiUtil.DrawTableColumn(equip.Name); ImGuiUtil.DrawTableColumn(equip.Type.ToName()); @@ -51,12 +51,12 @@ public class ItemUnlockPanel(ItemUnlockManager _itemUnlocks, ItemManager _items) ImGui.TableNextColumn(); } - ImGuiUtil.DrawTableColumn(_itemUnlocks.IsUnlocked(t.Key, out var time) + ImGuiUtil.DrawTableColumn(itemUnlocks.IsUnlocked(t.Key, out var time) ? time == DateTimeOffset.MinValue ? "Always" : time.LocalDateTime.ToString("g") : "Never"); - }, _itemUnlocks.Count); + }, itemUnlocks.Count); ImGuiClip.DrawEndDummy(remainder, ImGui.GetTextLineHeight()); } } diff --git a/Glamourer/Gui/Tabs/DebugTab/ModelEvaluationPanel.cs b/Glamourer/Gui/Tabs/DebugTab/ModelEvaluationPanel.cs index 185e19b..2a8d585 100644 --- a/Glamourer/Gui/Tabs/DebugTab/ModelEvaluationPanel.cs +++ b/Glamourer/Gui/Tabs/DebugTab/ModelEvaluationPanel.cs @@ -14,17 +14,17 @@ using Penumbra.GameData.Structs; namespace Glamourer.Gui.Tabs.DebugTab; -public unsafe class ModelEvaluationPanel( - ActorObjectManager _objectManager, - VisorService _visorService, - VieraEarService _vieraEarService, - UpdateSlotService _updateSlotService, - ChangeCustomizeService _changeCustomizeService, - CrestService _crestService, +public sealed unsafe class ModelEvaluationPanel( + ActorObjectManager objectManager, + VisorService visorService, + VieraEarService vieraEarService, + UpdateSlotService updateSlotService, + ChangeCustomizeService changeCustomizeService, + CrestService crestService, DictBonusItems bonusItems) : IGameDataDrawer { - public string Label - => "Model Evaluation"; + public ReadOnlySpan Label + => "Model Evaluation"u8; public bool Disabled => false; @@ -34,7 +34,7 @@ public unsafe class ModelEvaluationPanel( public void Draw() { ImGui.InputInt("Game Object Index", ref _gameObjectIndex, 0, 0); - var actor = _objectManager.Objects[_gameObjectIndex]; + var actor = objectManager.Objects[_gameObjectIndex]; var model = actor.Model; using var table = ImRaii.Table("##evaluationTable", 4, ImGuiTableFlags.SizingFixedFit | ImGuiTableFlags.RowBg); ImGui.TableNextColumn(); @@ -128,13 +128,13 @@ public unsafe class ModelEvaluationPanel( return; if (ImGui.SmallButton("Set True")) - _visorService.SetVisorState(model, true); + visorService.SetVisorState(model, true); ImGui.SameLine(); if (ImGui.SmallButton("Set False")) - _visorService.SetVisorState(model, false); + visorService.SetVisorState(model, false); ImGui.SameLine(); if (ImGui.SmallButton("Toggle")) - _visorService.SetVisorState(model, !VisorService.GetVisorState(model)); + visorService.SetVisorState(model, !VisorService.GetVisorState(model)); } private void DrawVieraEars(Actor actor, Model model) @@ -148,13 +148,13 @@ public unsafe class ModelEvaluationPanel( return; if (ImGui.SmallButton("Set True")) - _vieraEarService.SetVieraEarState(model, true); + vieraEarService.SetVieraEarState(model, true); ImGui.SameLine(); if (ImGui.SmallButton("Set False")) - _vieraEarService.SetVieraEarState(model, false); + vieraEarService.SetVieraEarState(model, false); ImGui.SameLine(); if (ImGui.SmallButton("Toggle")) - _vieraEarService.SetVieraEarState(model, !model.VieraEarsVisible); + vieraEarService.SetVieraEarState(model, !model.VieraEarsVisible); } private void DrawHatState(Actor actor, Model model) @@ -172,13 +172,13 @@ public unsafe class ModelEvaluationPanel( return; if (ImGui.SmallButton("Hide")) - _updateSlotService.UpdateEquipSlot(model, EquipSlot.Head, CharacterArmor.Empty); + updateSlotService.UpdateEquipSlot(model, EquipSlot.Head, CharacterArmor.Empty); ImGui.SameLine(); if (ImGui.SmallButton("Show")) - _updateSlotService.UpdateEquipSlot(model, EquipSlot.Head, actor.GetArmor(EquipSlot.Head)); + updateSlotService.UpdateEquipSlot(model, EquipSlot.Head, actor.GetArmor(EquipSlot.Head)); ImGui.SameLine(); if (ImGui.SmallButton("Toggle")) - _updateSlotService.UpdateEquipSlot(model, EquipSlot.Head, + updateSlotService.UpdateEquipSlot(model, EquipSlot.Head, model.AsHuman->Head.Value == 0 ? actor.GetArmor(EquipSlot.Head) : CharacterArmor.Empty); } @@ -248,14 +248,14 @@ public unsafe class ModelEvaluationPanel( continue; if (ImGui.SmallButton("Change Piece")) - _updateSlotService.UpdateArmor(model, slot, + updateSlotService.UpdateArmor(model, slot, new CharacterArmor((PrimaryId)(slot == EquipSlot.Hands ? 6064 : slot == EquipSlot.Head ? 6072 : 1), 1, StainIds.None)); ImGui.SameLine(); if (ImGui.SmallButton("Change Stain")) - _updateSlotService.UpdateStain(model, slot, new StainIds(5, 7)); + updateSlotService.UpdateStain(model, slot, new StainIds(5, 7)); ImGui.SameLine(); if (ImGui.SmallButton("Reset")) - _updateSlotService.UpdateEquipSlot(model, slot, actor.GetArmor(slot)); + updateSlotService.UpdateEquipSlot(model, slot, actor.GetArmor(slot)); } foreach (var slot in BonusExtensions.AllFlags) @@ -280,7 +280,7 @@ public unsafe class ModelEvaluationPanel( if (ImUtf8.SmallButton("Change Piece"u8)) { var data = model.GetBonus(slot); - _updateSlotService.UpdateBonusSlot(model, slot, data with { Variant = (Variant)((data.Variant.Id + 1) % 12) }); + updateSlotService.UpdateBonusSlot(model, slot, data with { Variant = (Variant)((data.Variant.Id + 1) % 12) }); } } } @@ -311,7 +311,7 @@ public unsafe class ModelEvaluationPanel( var shift = BitOperations.TrailingZeroCount(mask); var newValue = value + (1 << shift); modelCustomize.Set(type, (CustomizeValue)newValue); - _changeCustomizeService.UpdateCustomize(model, modelCustomize); + changeCustomizeService.UpdateCustomize(model, modelCustomize); } ImGui.SameLine(); @@ -322,14 +322,14 @@ public unsafe class ModelEvaluationPanel( var shift = BitOperations.TrailingZeroCount(mask); var newValue = value - (1 << shift); modelCustomize.Set(type, (CustomizeValue)newValue); - _changeCustomizeService.UpdateCustomize(model, modelCustomize); + changeCustomizeService.UpdateCustomize(model, modelCustomize); } ImGui.SameLine(); if (ImGui.SmallButton("Reset")) { modelCustomize.Set(type, actorCustomize[type]); - _changeCustomizeService.UpdateCustomize(model, modelCustomize); + changeCustomizeService.UpdateCustomize(model, modelCustomize); } } } @@ -357,6 +357,6 @@ public unsafe class ModelEvaluationPanel( } if (whichToggle != 0) - _crestService.UpdateCrests(actor, totalModelFlags ^ whichToggle); + crestService.UpdateCrests(actor, totalModelFlags ^ whichToggle); } } diff --git a/Glamourer/Gui/Tabs/DebugTab/NpcAppearancePanel.cs b/Glamourer/Gui/Tabs/DebugTab/NpcAppearancePanel.cs index 0d93bb8..0087094 100644 --- a/Glamourer/Gui/Tabs/DebugTab/NpcAppearancePanel.cs +++ b/Glamourer/Gui/Tabs/DebugTab/NpcAppearancePanel.cs @@ -14,11 +14,11 @@ using ImGuiClip = OtterGui.ImGuiClip; namespace Glamourer.Gui.Tabs.DebugTab; -public class NpcAppearancePanel(NpcCombo npcCombo, StateManager stateManager, ActorObjectManager objectManager, DesignConverter designConverter) +public sealed class NpcAppearancePanel(NpcCombo npcCombo, StateManager stateManager, ActorObjectManager objectManager, DesignConverter designConverter) : IGameDataDrawer { - public string Label - => "NPC Appearance"; + public ReadOnlySpan Label + => "NPC Appearance"u8; public bool Disabled => false; diff --git a/Glamourer/Gui/Tabs/DebugTab/ObjectManagerPanel.cs b/Glamourer/Gui/Tabs/DebugTab/ObjectManagerPanel.cs index 97847ae..412ad49 100644 --- a/Glamourer/Gui/Tabs/DebugTab/ObjectManagerPanel.cs +++ b/Glamourer/Gui/Tabs/DebugTab/ObjectManagerPanel.cs @@ -7,10 +7,10 @@ using Penumbra.GameData.Interop; namespace Glamourer.Gui.Tabs.DebugTab; -public class ObjectManagerPanel(ActorObjectManager _objectManager, ActorManager _actors) : IGameDataDrawer +public sealed class ObjectManagerPanel(ActorObjectManager objectManager, ActorManager actors) : IGameDataDrawer { - public string Label - => "Object Manager"; + public ReadOnlySpan Label + => "Object Manager"u8; public bool Disabled => false; @@ -19,7 +19,7 @@ public class ObjectManagerPanel(ActorObjectManager _objectManager, ActorManager public void Draw() { - _objectManager.Objects.DrawDebug(); + objectManager.Objects.DrawDebug(); using (var table = ImUtf8.Table("##data"u8, 3, ImGuiTableFlags.RowBg | ImGuiTableFlags.SizingFixedFit)) { @@ -27,32 +27,32 @@ public class ObjectManagerPanel(ActorObjectManager _objectManager, ActorManager return; ImUtf8.DrawTableColumn("World"u8); - ImUtf8.DrawTableColumn(_actors.Finished ? _actors.Data.ToWorldName(_objectManager.World) : "Service Missing"); - ImUtf8.DrawTableColumn(_objectManager.World.ToString()); + ImUtf8.DrawTableColumn(actors.Finished ? actors.Data.ToWorldName(objectManager.World) : "Service Missing"); + ImUtf8.DrawTableColumn(objectManager.World.ToString()); ImUtf8.DrawTableColumn("Player Character"u8); - ImUtf8.DrawTableColumn($"{_objectManager.Player.Utf8Name} ({_objectManager.Player.Index})"); + ImUtf8.DrawTableColumn($"{objectManager.Player.Utf8Name} ({objectManager.Player.Index})"); ImGui.TableNextColumn(); - ImUtf8.CopyOnClickSelectable(_objectManager.Player.ToString()); + ImUtf8.CopyOnClickSelectable(objectManager.Player.ToString()); ImUtf8.DrawTableColumn("In GPose"u8); - ImUtf8.DrawTableColumn(_objectManager.IsInGPose.ToString()); + ImUtf8.DrawTableColumn(objectManager.IsInGPose.ToString()); ImGui.TableNextColumn(); ImUtf8.DrawTableColumn("In Lobby"u8); - ImUtf8.DrawTableColumn(_objectManager.IsInLobby.ToString()); + ImUtf8.DrawTableColumn(objectManager.IsInLobby.ToString()); ImGui.TableNextColumn(); - if (_objectManager.IsInGPose) + if (objectManager.IsInGPose) { ImUtf8.DrawTableColumn("GPose Player"u8); - ImUtf8.DrawTableColumn($"{_objectManager.GPosePlayer.Utf8Name} ({_objectManager.GPosePlayer.Index})"); + ImUtf8.DrawTableColumn($"{objectManager.GPosePlayer.Utf8Name} ({objectManager.GPosePlayer.Index})"); ImGui.TableNextColumn(); - ImUtf8.CopyOnClickSelectable(_objectManager.GPosePlayer.ToString()); + ImUtf8.CopyOnClickSelectable(objectManager.GPosePlayer.ToString()); } ImUtf8.DrawTableColumn("Number of Players"u8); - ImUtf8.DrawTableColumn(_objectManager.Count.ToString()); + ImUtf8.DrawTableColumn(objectManager.Count.ToString()); ImGui.TableNextColumn(); } @@ -70,7 +70,7 @@ public class ObjectManagerPanel(ActorObjectManager _objectManager, ActorManager var skips = ImGuiClip.GetNecessarySkips(ImGui.GetTextLineHeightWithSpacing()); ImGui.TableNextRow(); - var remainder = ImGuiClip.FilteredClippedDraw(_objectManager, skips, + var remainder = ImGuiClip.FilteredClippedDraw(objectManager, skips, p => p.Value.Label.Contains(_objectFilter, StringComparison.OrdinalIgnoreCase), p => { diff --git a/Glamourer/Gui/Tabs/DebugTab/PenumbraPanel.cs b/Glamourer/Gui/Tabs/DebugTab/PenumbraPanel.cs index 833ebe4..030b7f4 100644 --- a/Glamourer/Gui/Tabs/DebugTab/PenumbraPanel.cs +++ b/Glamourer/Gui/Tabs/DebugTab/PenumbraPanel.cs @@ -11,10 +11,10 @@ using Penumbra.GameData.Structs; namespace Glamourer.Gui.Tabs.DebugTab; -public unsafe class PenumbraPanel(PenumbraService _penumbra, PenumbraChangedItemTooltip _penumbraTooltip) : IGameDataDrawer +public sealed class PenumbraPanel(PenumbraService penumbra, PenumbraChangedItemTooltip penumbraTooltip) : IGameDataDrawer { - public string Label - => "Penumbra Interop"; + public ReadOnlySpan Label + => "Penumbra Interop"u8; public bool Disabled => false; @@ -29,20 +29,20 @@ public unsafe class PenumbraPanel(PenumbraService _penumbra, PenumbraChangedItem return; ImGuiUtil.DrawTableColumn("Available"); - ImGuiUtil.DrawTableColumn(_penumbra.Available.ToString()); + ImGuiUtil.DrawTableColumn(penumbra.Available.ToString()); ImGui.TableNextColumn(); if (ImGui.SmallButton("Unattach")) - _penumbra.Unattach(); + penumbra.Unattach(); ImGui.SameLine(); if (ImGui.SmallButton("Reattach")) - _penumbra.Reattach(); + penumbra.Reattach(); ImGuiUtil.DrawTableColumn("Version"); - ImGuiUtil.DrawTableColumn($"{_penumbra.CurrentMajor}.{_penumbra.CurrentMinor}"); + ImGuiUtil.DrawTableColumn($"{penumbra.CurrentMajor}.{penumbra.CurrentMinor}"); ImGui.TableNextColumn(); ImGuiUtil.DrawTableColumn("Attached When"); - ImGuiUtil.DrawTableColumn(_penumbra.AttachTime.ToLocalTime().ToLongTimeString()); + ImGuiUtil.DrawTableColumn(penumbra.AttachTime.ToLocalTime().ToLongTimeString()); ImGui.TableNextColumn(); ImGuiUtil.DrawTableColumn("Draw Object"); @@ -52,16 +52,16 @@ public unsafe class PenumbraPanel(PenumbraService _penumbra, PenumbraChangedItem if (ImGui.InputScalar("##drawObjectPtr", ImGuiDataType.U64, ref address, nint.Zero, nint.Zero, "%llx", ImGuiInputTextFlags.CharsHexadecimal)) _drawObject = address; - ImGuiUtil.DrawTableColumn(_penumbra.Available - ? $"0x{_penumbra.GameObjectFromDrawObject(_drawObject).Address:X}" + ImGuiUtil.DrawTableColumn(penumbra.Available + ? $"0x{penumbra.GameObjectFromDrawObject(_drawObject).Address:X}" : "Penumbra Unavailable"); ImGuiUtil.DrawTableColumn("Cutscene Object"); ImGui.TableNextColumn(); ImGui.SetNextItemWidth(200 * ImGuiHelpers.GlobalScale); ImGui.InputInt("##CutsceneIndex", ref _gameObjectIndex, 0, 0); - ImGuiUtil.DrawTableColumn(_penumbra.Available - ? _penumbra.CutsceneParent((ushort)_gameObjectIndex).ToString() + ImGuiUtil.DrawTableColumn(penumbra.Available + ? penumbra.CutsceneParent((ushort)_gameObjectIndex).ToString() : "Penumbra Unavailable"); ImGuiUtil.DrawTableColumn("Redraw Object"); @@ -69,25 +69,25 @@ public unsafe class PenumbraPanel(PenumbraService _penumbra, PenumbraChangedItem ImGui.SetNextItemWidth(200 * ImGuiHelpers.GlobalScale); ImGui.InputInt("##redrawObject", ref _gameObjectIndex, 0, 0); ImGui.TableNextColumn(); - using (_ = ImRaii.Disabled(!_penumbra.Available)) + using (_ = ImRaii.Disabled(!penumbra.Available)) { if (ImGui.SmallButton("Redraw")) - _penumbra.RedrawObject((ObjectIndex)_gameObjectIndex, RedrawType.Redraw); + penumbra.RedrawObject((ObjectIndex)_gameObjectIndex, RedrawType.Redraw); } ImGuiUtil.DrawTableColumn("Last Tooltip Date"); - ImGuiUtil.DrawTableColumn(_penumbraTooltip.LastTooltip > DateTime.MinValue - ? $"{_penumbraTooltip.LastTooltip.ToLongTimeString()} ({_penumbraTooltip.LastType} {_penumbraTooltip.LastId})" + ImGuiUtil.DrawTableColumn(penumbraTooltip.LastTooltip > DateTime.MinValue + ? $"{penumbraTooltip.LastTooltip.ToLongTimeString()} ({penumbraTooltip.LastType} {penumbraTooltip.LastId})" : "Never"); ImGui.TableNextColumn(); ImGuiUtil.DrawTableColumn("Last Click Date"); - ImGuiUtil.DrawTableColumn(_penumbraTooltip.LastClick > DateTime.MinValue ? _penumbraTooltip.LastClick.ToLongTimeString() : "Never"); + ImGuiUtil.DrawTableColumn(penumbraTooltip.LastClick > DateTime.MinValue ? penumbraTooltip.LastClick.ToLongTimeString() : "Never"); ImGui.TableNextColumn(); ImGui.Separator(); ImGui.Separator(); - foreach (var (slot, item) in _penumbraTooltip.LastItems) + foreach (var (slot, item) in penumbraTooltip.LastItems) { switch (slot) { diff --git a/Glamourer/Gui/Tabs/DebugTab/RetainedStatePanel.cs b/Glamourer/Gui/Tabs/DebugTab/RetainedStatePanel.cs index 21f0c50..40a73d1 100644 --- a/Glamourer/Gui/Tabs/DebugTab/RetainedStatePanel.cs +++ b/Glamourer/Gui/Tabs/DebugTab/RetainedStatePanel.cs @@ -1,27 +1,25 @@ -using Glamourer.Interop; -using Glamourer.Interop.Structs; -using Glamourer.State; +using Glamourer.State; using OtterGui.Raii; using Penumbra.GameData.Gui.Debug; using Penumbra.GameData.Interop; namespace Glamourer.Gui.Tabs.DebugTab; -public class RetainedStatePanel(StateManager _stateManager, ActorObjectManager _objectManager) : IGameDataDrawer +public sealed class RetainedStatePanel(StateManager stateManager, ActorObjectManager objectManager) : IGameDataDrawer { - public string Label - => "Retained States (Inactive Actors)"; + public ReadOnlySpan Label + => "Retained States (Inactive Actors)"u8; public bool Disabled => false; public void Draw() { - foreach (var (identifier, state) in _stateManager.Where(kvp => !_objectManager.ContainsKey(kvp.Key))) + foreach (var (identifier, state) in stateManager.Where(kvp => !objectManager.ContainsKey(kvp.Key))) { using var t = ImRaii.TreeNode(identifier.ToString()); if (t) - ActiveStatePanel.DrawState(_stateManager, ActorData.Invalid, state); + ActiveStatePanel.DrawState(stateManager, ActorData.Invalid, state); } } } diff --git a/Glamourer/Gui/Tabs/DebugTab/UnlockableItemsPanel.cs b/Glamourer/Gui/Tabs/DebugTab/UnlockableItemsPanel.cs index b22008d..dc77a36 100644 --- a/Glamourer/Gui/Tabs/DebugTab/UnlockableItemsPanel.cs +++ b/Glamourer/Gui/Tabs/DebugTab/UnlockableItemsPanel.cs @@ -10,10 +10,10 @@ using ImGuiClip = OtterGui.ImGuiClip; namespace Glamourer.Gui.Tabs.DebugTab; -public class UnlockableItemsPanel(ItemUnlockManager _itemUnlocks, ItemManager _items) : IGameDataDrawer +public sealed class UnlockableItemsPanel(ItemUnlockManager itemUnlocks, ItemManager items) : IGameDataDrawer { - public string Label - => "Unlockable Items"; + public ReadOnlySpan Label + => "Unlockable Items"u8; public bool Disabled => false; @@ -36,10 +36,10 @@ public class UnlockableItemsPanel(ItemUnlockManager _itemUnlocks, ItemManager _i ImGui.TableNextColumn(); var skips = ImGuiClip.GetNecessarySkips(ImGui.GetTextLineHeightWithSpacing()); ImGui.TableNextRow(); - var remainder = ImGuiClip.ClippedDraw(_itemUnlocks.Unlockable, skips, t => + var remainder = ImGuiClip.ClippedDraw(itemUnlocks.Unlockable, skips, t => { ImGuiUtil.DrawTableColumn(t.Key.ToString()); - if (_items.ItemData.TryGetValue(t.Key, EquipSlot.MainHand, out var equip)) + if (items.ItemData.TryGetValue(t.Key, EquipSlot.MainHand, out var equip)) { ImGuiUtil.DrawTableColumn(equip.Name); ImGuiUtil.DrawTableColumn(equip.Type.ToName()); @@ -52,13 +52,13 @@ public class UnlockableItemsPanel(ItemUnlockManager _itemUnlocks, ItemManager _i ImGui.TableNextColumn(); } - ImGuiUtil.DrawTableColumn(_itemUnlocks.IsUnlocked(t.Key, out var time) + ImGuiUtil.DrawTableColumn(itemUnlocks.IsUnlocked(t.Key, out var time) ? time == DateTimeOffset.MinValue ? "Always" : time.LocalDateTime.ToString("g") : "Never"); ImGuiUtil.DrawTableColumn(t.Value.ToString()); - }, _itemUnlocks.Unlockable.Count); + }, itemUnlocks.Unlockable.Count); ImGuiClip.DrawEndDummy(remainder, ImGui.GetTextLineHeight()); } } diff --git a/Glamourer/Gui/Tabs/DesignTab/DesignLinkDrawer.cs b/Glamourer/Gui/Tabs/DesignTab/DesignLinkDrawer.cs index d9517c8..fe4b5d9 100644 --- a/Glamourer/Gui/Tabs/DesignTab/DesignLinkDrawer.cs +++ b/Glamourer/Gui/Tabs/DesignTab/DesignLinkDrawer.cs @@ -4,17 +4,17 @@ using Glamourer.Automation; using Glamourer.Designs; using Glamourer.Designs.Links; using Dalamud.Bindings.ImGui; +using Luna; using OtterGui; using OtterGui.Raii; -using OtterGui.Services; namespace Glamourer.Gui.Tabs.DesignTab; public class DesignLinkDrawer( - DesignLinkManager _linkManager, - DesignFileSystemSelector _selector, - LinkDesignCombo _combo, - DesignColors _colorManager, + DesignLinkManager linkManager, + DesignFileSystemSelector selector, + LinkDesignCombo combo, + DesignColors colorManager, Configuration config) : IUiService { private int _dragDropIndex = -1; @@ -47,23 +47,23 @@ public class DesignLinkDrawer( switch (_dragDropTargetOrder) { case LinkOrder.Before: - for (var i = _selector.Selected!.Links.Before.Count - 1; i >= _dragDropTargetIndex; --i) - _linkManager.MoveDesignLink(_selector.Selected!, i, LinkOrder.Before, 0, LinkOrder.After); + for (var i = selector.Selected!.Links.Before.Count - 1; i >= _dragDropTargetIndex; --i) + linkManager.MoveDesignLink(selector.Selected!, i, LinkOrder.Before, 0, LinkOrder.After); break; case LinkOrder.After: for (var i = 0; i <= _dragDropTargetIndex; ++i) { - _linkManager.MoveDesignLink(_selector.Selected!, 0, LinkOrder.After, _selector.Selected!.Links.Before.Count, + linkManager.MoveDesignLink(selector.Selected!, 0, LinkOrder.After, selector.Selected!.Links.Before.Count, LinkOrder.Before); } break; } else if (_dragDropTargetOrder is LinkOrder.Self) - _linkManager.MoveDesignLink(_selector.Selected!, _dragDropIndex, _dragDropOrder, _selector.Selected!.Links.Before.Count, + linkManager.MoveDesignLink(selector.Selected!, _dragDropIndex, _dragDropOrder, selector.Selected!.Links.Before.Count, LinkOrder.Before); else - _linkManager.MoveDesignLink(_selector.Selected!, _dragDropIndex, _dragDropOrder, _dragDropTargetIndex, _dragDropTargetOrder); + linkManager.MoveDesignLink(selector.Selected!, _dragDropIndex, _dragDropOrder, _dragDropTargetIndex, _dragDropTargetOrder); _dragDropIndex = -1; _dragDropTargetIndex = -1; @@ -83,9 +83,9 @@ public class DesignLinkDrawer( 6 * ImGui.GetFrameHeight() + 5 * ImGui.GetStyle().ItemInnerSpacing.X); using var style = ImRaii.PushStyle(ImGuiStyleVar.ItemSpacing, ImGui.GetStyle().ItemInnerSpacing); - DrawSubList(_selector.Selected!.Links.Before, LinkOrder.Before); + DrawSubList(selector.Selected!.Links.Before, LinkOrder.Before); DrawSelf(); - DrawSubList(_selector.Selected!.Links.After, LinkOrder.After); + DrawSubList(selector.Selected!.Links.After, LinkOrder.After); DrawNew(); MoveLink(); } @@ -94,7 +94,7 @@ public class DesignLinkDrawer( { using var id = ImRaii.PushId((int)LinkOrder.Self); ImGui.TableNextColumn(); - var color = _colorManager.GetColor(_selector.Selected!); + var color = colorManager.GetColor(selector.Selected!); using (ImRaii.PushFont(UiBuilder.IconFont)) { using var c = ImRaii.PushColor(ImGuiCol.Text, color); @@ -106,11 +106,11 @@ public class DesignLinkDrawer( using (ImRaii.PushColor(ImGuiCol.Text, color)) { ImGui.AlignTextToFramePadding(); - ImGui.Selectable(_selector.IncognitoMode ? _selector.Selected!.Incognito : _selector.Selected!.Name.Text); + ImGui.Selectable(selector.IncognitoMode ? selector.Selected!.Incognito : selector.Selected!.Name.Text); } ImGuiUtil.HoverTooltip("Current Design"); - DrawDragDrop(_selector.Selected!, LinkOrder.Self, 0); + DrawDragDrop(selector.Selected!, LinkOrder.Self, 0); ImGui.TableNextColumn(); using (ImRaii.PushFont(UiBuilder.IconFont)) { @@ -134,10 +134,10 @@ public class DesignLinkDrawer( var (design, flags) = list[i]; ImGui.TableNextColumn(); - using (ImRaii.PushColor(ImGuiCol.Text, _colorManager.GetColor(design))) + using (ImRaii.PushColor(ImGuiCol.Text, colorManager.GetColor(design))) { ImGui.AlignTextToFramePadding(); - ImGui.Selectable(_selector.IncognitoMode ? design.Incognito : design.Name.Text); + ImGui.Selectable(selector.IncognitoMode ? design.Incognito : design.Name.Text); } DrawDragDrop(design, order, i); @@ -147,7 +147,7 @@ public class DesignLinkDrawer( DrawApplicationBoxes(i, order, flags); if (delete) - _linkManager.RemoveDesignLink(_selector.Selected!, i--, order); + linkManager.RemoveDesignLink(selector.Selected!, i--, order); } } @@ -156,11 +156,11 @@ public class DesignLinkDrawer( var buttonSize = new Vector2(ImGui.GetFrameHeight()); ImGui.TableNextColumn(); ImGui.TableNextColumn(); - _combo.Draw(ImGui.GetContentRegionAvail().X); + combo.Draw(ImGui.GetContentRegionAvail().X); ImGui.TableNextColumn(); string ttBefore, ttAfter; bool canAddBefore, canAddAfter; - var design = _combo.Design as Design; + var design = combo.Design as Design; if (design == null) { ttAfter = ttBefore = "Select a design first."; @@ -168,11 +168,11 @@ public class DesignLinkDrawer( } else { - canAddBefore = LinkContainer.CanAddLink(_selector.Selected!, design, LinkOrder.Before, out var error); + canAddBefore = LinkContainer.CanAddLink(selector.Selected!, design, LinkOrder.Before, out var error); ttBefore = canAddBefore ? $"Add a link at the top of the list to {design.Name}." : $"Can not add a link to {design.Name}:\n{error}"; - canAddAfter = LinkContainer.CanAddLink(_selector.Selected!, design, LinkOrder.After, out error); + canAddAfter = LinkContainer.CanAddLink(selector.Selected!, design, LinkOrder.After, out error); ttAfter = canAddAfter ? $"Add a link at the bottom of the list to {design.Name}." : $"Can not add a link to {design.Name}:\n{error}"; @@ -180,13 +180,13 @@ public class DesignLinkDrawer( if (ImGuiUtil.DrawDisabledButton(FontAwesomeIcon.ArrowCircleUp.ToIconString(), buttonSize, ttBefore, !canAddBefore, true)) { - _linkManager.AddDesignLink(_selector.Selected!, design!, LinkOrder.Before); - _linkManager.MoveDesignLink(_selector.Selected!, _selector.Selected!.Links.Before.Count - 1, LinkOrder.Before, 0, LinkOrder.Before); + linkManager.AddDesignLink(selector.Selected!, design!, LinkOrder.Before); + linkManager.MoveDesignLink(selector.Selected!, selector.Selected!.Links.Before.Count - 1, LinkOrder.Before, 0, LinkOrder.Before); } ImGui.SameLine(); if (ImGuiUtil.DrawDisabledButton(FontAwesomeIcon.ArrowCircleDown.ToIconString(), buttonSize, ttAfter, !canAddAfter, true)) - _linkManager.AddDesignLink(_selector.Selected!, design!, LinkOrder.After); + linkManager.AddDesignLink(selector.Selected!, design!, LinkOrder.After); } private void DrawDragDrop(Design design, LinkOrder order, int index) @@ -238,7 +238,7 @@ public class DesignLinkDrawer( ImGui.SameLine(); Box(4); if (newType != current) - _linkManager.ChangeApplicationType(_selector.Selected!, idx, order, newType); + linkManager.ChangeApplicationType(selector.Selected!, idx, order, newType); return; void Box(int i) diff --git a/Glamourer/Gui/Tabs/SettingsTab/CodeDrawer.cs b/Glamourer/Gui/Tabs/SettingsTab/CodeDrawer.cs index 1dc9331..6c23da5 100644 --- a/Glamourer/Gui/Tabs/SettingsTab/CodeDrawer.cs +++ b/Glamourer/Gui/Tabs/SettingsTab/CodeDrawer.cs @@ -2,9 +2,9 @@ using Glamourer.Services; using Glamourer.State; using Dalamud.Bindings.ImGui; +using Luna; using OtterGui.Filesystem; using OtterGui.Raii; -using OtterGui.Services; using OtterGui.Text; using OtterGui.Text.EndObjects; @@ -134,7 +134,7 @@ public class CodeDrawer(Configuration config, CodeService codeService, FunModule if (!target.IsDropping(DragDropLabel) || _dragCodeIdx == -1) return; - if (config.Codes.Move(_dragCodeIdx, idx)) + if (Extensions.Move(config.Codes, _dragCodeIdx, idx)) codeService.SaveState(); _dragCodeIdx = -1; } diff --git a/Glamourer/Gui/Tabs/SettingsTab/CollectionCombo.cs b/Glamourer/Gui/Tabs/SettingsTab/CollectionCombo.cs index 7080b4d..25dab34 100644 --- a/Glamourer/Gui/Tabs/SettingsTab/CollectionCombo.cs +++ b/Glamourer/Gui/Tabs/SettingsTab/CollectionCombo.cs @@ -1,11 +1,11 @@ using Dalamud.Interface; using Glamourer.Interop.Penumbra; using Dalamud.Bindings.ImGui; +using Luna; using OtterGui; -using OtterGui.Log; using OtterGui.Raii; -using OtterGui.Services; using OtterGui.Widgets; +using Logger = OtterGui.Log.Logger; namespace Glamourer.Gui.Tabs.SettingsTab; diff --git a/Glamourer/Gui/Tabs/SettingsTab/CollectionOverrideDrawer.cs b/Glamourer/Gui/Tabs/SettingsTab/CollectionOverrideDrawer.cs index 5c4fec3..0ea9212 100644 --- a/Glamourer/Gui/Tabs/SettingsTab/CollectionOverrideDrawer.cs +++ b/Glamourer/Gui/Tabs/SettingsTab/CollectionOverrideDrawer.cs @@ -2,9 +2,9 @@ using Glamourer.Interop.Penumbra; using Glamourer.Services; using Dalamud.Bindings.ImGui; +using Luna; using OtterGui; using OtterGui.Raii; -using OtterGui.Services; using Penumbra.GameData.Actors; using Penumbra.GameData.Interop; diff --git a/Glamourer/Gui/Tabs/UnlocksTab/UnlockTable.cs b/Glamourer/Gui/Tabs/UnlocksTab/UnlockTable.cs index d2297ca..ea3f2e0 100644 --- a/Glamourer/Gui/Tabs/UnlocksTab/UnlockTable.cs +++ b/Glamourer/Gui/Tabs/UnlocksTab/UnlockTable.cs @@ -426,7 +426,7 @@ public class UnlockTable : Table, IDisposable { _jobs = jobs; _values = _jobs.Jobs.Ordered.Select(j => j.Flag).ToArray(); - _names = _jobs.Jobs.Ordered.Select(j => j.Abbreviation).ToArray(); + _names = _jobs.Jobs.Ordered.Select(j => j.Abbreviation.ToString()).ToArray(); AllFlags = _values.Aggregate((l, r) => l | r); _filterValue = AllFlags; Flags &= ~ImGuiTableColumnFlags.NoResize; @@ -498,7 +498,7 @@ public class UnlockTable : Table, IDisposable { var group = _jobs.AllJobGroups[Math.Max((int)item.JobRestrictions.Id, 1)]; if (group.Name.Length > 0) - text = group.Name; + text = group.Name.ToString(); } ImGui.TextUnformatted(text); diff --git a/Glamourer/Interop/InventoryService.cs b/Glamourer/Interop/InventoryService.cs index c30ae06..886fb58 100644 --- a/Glamourer/Interop/InventoryService.cs +++ b/Glamourer/Interop/InventoryService.cs @@ -1,10 +1,9 @@ using Dalamud.Hooking; using Dalamud.Plugin.Services; -using Dalamud.Utility.Signatures; using FFXIVClientStructs.FFXIV.Client.Game; using FFXIVClientStructs.FFXIV.Client.UI.Misc; using Glamourer.Events; -using OtterGui.Services; +using Luna; using Penumbra.GameData.Enums; using Penumbra.GameData.Structs; using Penumbra.String; diff --git a/Glamourer/Interop/Material/DirectXService.cs b/Glamourer/Interop/Material/DirectXService.cs index 8006a2f..352b034 100644 --- a/Glamourer/Interop/Material/DirectXService.cs +++ b/Glamourer/Interop/Material/DirectXService.cs @@ -1,5 +1,5 @@ using Dalamud.Plugin.Services; -using OtterGui.Services; +using Luna; using Penumbra.GameData.Files.MaterialStructs; using Penumbra.String.Functions; using SharpGen.Runtime; diff --git a/Glamourer/Interop/Material/LiveColorTablePreviewer.cs b/Glamourer/Interop/Material/LiveColorTablePreviewer.cs index 3b9edb7..53a8c97 100644 --- a/Glamourer/Interop/Material/LiveColorTablePreviewer.cs +++ b/Glamourer/Interop/Material/LiveColorTablePreviewer.cs @@ -1,6 +1,6 @@ using Dalamud.Plugin.Services; using Dalamud.Bindings.ImGui; -using OtterGui.Services; +using Luna; using Penumbra.GameData.Files.MaterialStructs; using Penumbra.GameData.Structs; diff --git a/Glamourer/Interop/Material/MaterialManager.cs b/Glamourer/Interop/Material/MaterialManager.cs index 43e500b..3b99e2c 100644 --- a/Glamourer/Interop/Material/MaterialManager.cs +++ b/Glamourer/Interop/Material/MaterialManager.cs @@ -1,10 +1,9 @@ using FFXIVClientStructs.FFXIV.Client.Graphics.Scene; using FFXIVClientStructs.FFXIV.Client.System.Resource.Handle; -using FFXIVClientStructs.Havok.Animation.Rig; using Glamourer.Designs; using Glamourer.Interop.Penumbra; using Glamourer.State; -using OtterGui.Services; +using Luna; using Penumbra.GameData.Actors; using Penumbra.GameData.Enums; using Penumbra.GameData.Files.MaterialStructs; @@ -19,7 +18,6 @@ public sealed unsafe class MaterialManager : IRequiredService, IDisposable private readonly StateManager _stateManager; private readonly PenumbraService _penumbra; private readonly ActorManager _actors; - private readonly Configuration _config; private int _lastSlot; @@ -31,7 +29,6 @@ public sealed unsafe class MaterialManager : IRequiredService, IDisposable _stateManager = stateManager; _actors = actors; _penumbra = penumbra; - _config = config; _event = prepareColorSet; _event.Subscribe(OnPrepareColorSet, PrepareColorSet.Priority.MaterialManager); } diff --git a/Glamourer/Interop/Material/PrepareColorSet.cs b/Glamourer/Interop/Material/PrepareColorSet.cs index 821a152..ab1cb12 100644 --- a/Glamourer/Interop/Material/PrepareColorSet.cs +++ b/Glamourer/Interop/Material/PrepareColorSet.cs @@ -2,8 +2,8 @@ using FFXIVClientStructs.FFXIV.Client.Graphics.Kernel; using FFXIVClientStructs.FFXIV.Client.Graphics.Scene; using FFXIVClientStructs.FFXIV.Client.System.Resource.Handle; +using Luna; using OtterGui.Classes; -using OtterGui.Services; using Penumbra.GameData; using Penumbra.GameData.Enums; using Penumbra.GameData.Files.MaterialStructs; diff --git a/Glamourer/Interop/Material/UpdateColorSets.cs b/Glamourer/Interop/Material/UpdateColorSets.cs index e503bc6..459353b 100644 --- a/Glamourer/Interop/Material/UpdateColorSets.cs +++ b/Glamourer/Interop/Material/UpdateColorSets.cs @@ -1,4 +1,4 @@ -using OtterGui.Services; +using Luna; using Penumbra.GameData; using Penumbra.GameData.Interop; diff --git a/Glamourer/Interop/PalettePlus/PaletteImport.cs b/Glamourer/Interop/PalettePlus/PaletteImport.cs index 4887255..9894f89 100644 --- a/Glamourer/Interop/PalettePlus/PaletteImport.cs +++ b/Glamourer/Interop/PalettePlus/PaletteImport.cs @@ -1,8 +1,8 @@ using Dalamud.Plugin; using Glamourer.Designs; using Glamourer.GameData; +using Luna; using Newtonsoft.Json.Linq; -using OtterGui.Services; namespace Glamourer.Interop.PalettePlus; diff --git a/Glamourer/Interop/Penumbra/ModSettingApplier.cs b/Glamourer/Interop/Penumbra/ModSettingApplier.cs index b94be09..c8c40db 100644 --- a/Glamourer/Interop/Penumbra/ModSettingApplier.cs +++ b/Glamourer/Interop/Penumbra/ModSettingApplier.cs @@ -1,7 +1,7 @@ using Glamourer.Designs.Links; using Glamourer.Services; using Glamourer.State; -using OtterGui.Services; +using Luna; using Penumbra.GameData.Interop; using Penumbra.GameData.Structs; diff --git a/Glamourer/Interop/Penumbra/ModUsageInformer.cs b/Glamourer/Interop/Penumbra/ModUsageInformer.cs index f6d992e..ffeddf7 100644 --- a/Glamourer/Interop/Penumbra/ModUsageInformer.cs +++ b/Glamourer/Interop/Penumbra/ModUsageInformer.cs @@ -1,6 +1,6 @@ using Glamourer.Automation; using Glamourer.Designs; -using OtterGui.Services; +using Luna; namespace Glamourer.Interop.Penumbra; diff --git a/Glamourer/Interop/Penumbra/PenumbraAutoRedraw.cs b/Glamourer/Interop/Penumbra/PenumbraAutoRedraw.cs index 4e3c8e3..c480249 100644 --- a/Glamourer/Interop/Penumbra/PenumbraAutoRedraw.cs +++ b/Glamourer/Interop/Penumbra/PenumbraAutoRedraw.cs @@ -3,8 +3,7 @@ using Glamourer.Api.Enums; using Glamourer.Designs.History; using Glamourer.Events; using Glamourer.State; -using OtterGui.Classes; -using OtterGui.Services; +using Luna; using Penumbra.Api.Enums; using Penumbra.GameData.Interop; @@ -46,7 +45,7 @@ public class PenumbraAutoRedraw : IDisposable, IRequiredService } private readonly ConcurrentQueue<(ActorState, Action, int)> _actions = []; - private readonly ConcurrentSet _skips = []; + private readonly OtterGui.Classes.ConcurrentSet _skips = []; private DateTime _frame; private void OnStateChanged(StateChangeType type, StateSource source, ActorState state, ActorData _1, ITransaction? _2) diff --git a/Glamourer/Interop/Penumbra/PenumbraAutoRedrawSkip.cs b/Glamourer/Interop/Penumbra/PenumbraAutoRedrawSkip.cs index 8ef522c..2d8a479 100644 --- a/Glamourer/Interop/Penumbra/PenumbraAutoRedrawSkip.cs +++ b/Glamourer/Interop/Penumbra/PenumbraAutoRedrawSkip.cs @@ -1,5 +1,4 @@ -using OtterGui.Classes; -using OtterGui.Services; +using Luna; namespace Glamourer.Interop.Penumbra; diff --git a/Glamourer/Services/BackupService.cs b/Glamourer/Services/BackupService.cs index 511cca6..e9b8d9d 100644 --- a/Glamourer/Services/BackupService.cs +++ b/Glamourer/Services/BackupService.cs @@ -1,6 +1,6 @@ -using OtterGui.Classes; -using OtterGui.Log; -using OtterGui.Services; +using Luna; +using Backup = OtterGui.Classes.Backup; +using Logger = OtterGui.Log.Logger; namespace Glamourer.Services; diff --git a/Glamourer/Services/CollectionOverrideService.cs b/Glamourer/Services/CollectionOverrideService.cs index 99635d8..84d17d8 100644 --- a/Glamourer/Services/CollectionOverrideService.cs +++ b/Glamourer/Services/CollectionOverrideService.cs @@ -1,13 +1,12 @@ using Dalamud.Interface.ImGuiNotification; using Glamourer.Interop.Penumbra; +using Luna; using Newtonsoft.Json; using Newtonsoft.Json.Linq; -using OtterGui; using OtterGui.Extensions; -using OtterGui.Filesystem; -using OtterGui.Services; using Penumbra.GameData.Actors; using Penumbra.GameData.Interop; +using Extensions = OtterGui.Filesystem.Extensions; using Notification = OtterGui.Classes.Notification; namespace Glamourer.Services; @@ -32,7 +31,7 @@ public sealed class CollectionOverrideService : IService, ISavable if (!identifier.IsValid) identifier = _actors.FromObject(actor.AsObject, out _, true, true, true); - return _overrides.FindFirst(p => p.Actor.Matches(identifier), out var ret) + return ArrayExtensions.FindFirst(_overrides, p => p.Actor.Matches(identifier), out var ret) ? (ret.CollectionId, ret.DisplayName, true) : (_penumbra.GetActorCollection(actor, out var name), name, false); } @@ -107,7 +106,7 @@ public sealed class CollectionOverrideService : IService, ISavable public void MoveOverride(int idxFrom, int idxTo) { - if (!_overrides.Move(idxFrom, idxTo)) + if (!Extensions.Move(_overrides, idxFrom, idxTo)) return; Glamourer.Log.Debug($"Moved collection override {idxFrom + 1} to {idxTo + 1}."); diff --git a/Glamourer/Services/CommandService.cs b/Glamourer/Services/CommandService.cs index d2feac0..d48111a 100644 --- a/Glamourer/Services/CommandService.cs +++ b/Glamourer/Services/CommandService.cs @@ -10,14 +10,13 @@ using Glamourer.Gui.Tabs.DesignTab; using Glamourer.Interop.Penumbra; using Glamourer.State; using Dalamud.Bindings.ImGui; -using OtterGui; -using OtterGui.Classes; +using Luna; using OtterGui.Extensions; -using OtterGui.Services; using Penumbra.GameData.Actors; using Penumbra.GameData.Enums; using Penumbra.GameData.Interop; using Penumbra.GameData.Structs; +using SeStringBuilderExtensions = OtterGui.Classes.SeStringBuilderExtensions; namespace Glamourer.Services; @@ -104,10 +103,10 @@ public class CommandService : IDisposable, IApiService return; default: _chat.Print("Use without argument to toggle the main window."); - _chat.Print(new SeStringBuilder().AddText("Use ").AddPurple("/glamour").AddText(" instead of ").AddRed("/glamourer") + _chat.Print(SeStringBuilderExtensions.AddRed(new SeStringBuilder().AddText("Use ").AddPurple("/glamour").AddText(" instead of "), "/glamourer") .AddText(" for application commands.").BuiltString); - _chat.Print(new SeStringBuilder().AddCommand("qdb", "Toggles the quick design bar on or off.").BuiltString); - _chat.Print(new SeStringBuilder().AddCommand("lock", "Toggles the lock of the main window on or off.").BuiltString); + _chat.Print(SeStringBuilderExtensions.AddCommand(new SeStringBuilder(), "qdb", "Toggles the quick design bar on or off.").BuiltString); + _chat.Print(SeStringBuilderExtensions.AddCommand(new SeStringBuilder(), "lock", "Toggles the lock of the main window on or off.").BuiltString); return; } @@ -146,35 +145,28 @@ public class CommandService : IDisposable, IApiService private bool PrintHelp(string argument) { if (!string.Equals(argument, "help", StringComparison.OrdinalIgnoreCase) && argument != "?") - _chat.Print(new SeStringBuilder().AddText("The given argument ").AddRed(argument, true) + _chat.Print(SeStringBuilderExtensions.AddRed(new SeStringBuilder().AddText("The given argument "), argument, true) .AddText(" is not valid. Valid arguments are:").BuiltString); else _chat.Print("Valid arguments for /glamour are:"); - _chat.Print(new SeStringBuilder().AddCommand("apply", "Applies a given design to a given character. Use without arguments for help.") + _chat.Print(SeStringBuilderExtensions.AddCommand(new SeStringBuilder(), "apply", "Applies a given design to a given character. Use without arguments for help.") .BuiltString); - _chat.Print(new SeStringBuilder() - .AddCommand("reapply", "Re-applies the current supposed state of a given character. Use without arguments for help.").BuiltString); - _chat.Print(new SeStringBuilder().AddCommand("revert", "Reverts a given character to its game state. Use without arguments for help.") + _chat.Print(SeStringBuilderExtensions.AddCommand(new SeStringBuilder(), "reapply", "Re-applies the current supposed state of a given character. Use without arguments for help.").BuiltString); + _chat.Print(SeStringBuilderExtensions.AddCommand(new SeStringBuilder(), "revert", "Reverts a given character to its game state. Use without arguments for help.") .BuiltString); - _chat.Print(new SeStringBuilder().AddCommand("reapplyautomation", + _chat.Print(SeStringBuilderExtensions.AddCommand(new SeStringBuilder(), "reapplyautomation", "Reapplies the current automation state on top of the characters current state.. Use without arguments for help.").BuiltString); - _chat.Print(new SeStringBuilder().AddCommand("reverttoautomation", + _chat.Print(SeStringBuilderExtensions.AddCommand(new SeStringBuilder(), "reverttoautomation", "Reverts a given character to its supposed state using automated designs. Use without arguments for help.").BuiltString); - _chat.Print(new SeStringBuilder().AddCommand("resetdesign", + _chat.Print(SeStringBuilderExtensions.AddCommand(new SeStringBuilder(), "resetdesign", "Reapplies the current automation and resets the random design. Use without arguments for help.").BuiltString); - _chat.Print(new SeStringBuilder() - .AddCommand("clearsettings", "Clears all temporary settings applied by Glamourer. Use without arguments for help.").BuiltString); - _chat.Print(new SeStringBuilder() - .AddCommand("copy", "Copy the current state of a character to clipboard. Use without arguments for help.").BuiltString); - _chat.Print(new SeStringBuilder() - .AddCommand("save", "Save the current state of a character to a named design. Use without arguments for help.").BuiltString); - _chat.Print(new SeStringBuilder() - .AddCommand("automation", "Change the state of automated design sets. Use without arguments for help.").BuiltString); - _chat.Print(new SeStringBuilder() - .AddCommand("applyitem", "Apply a specific item to a character. Use without arguments for help.").BuiltString); - _chat.Print(new SeStringBuilder() - .AddCommand("applycustomization", "Apply a specific customization value to a character. Use without arguments for help.") + _chat.Print(SeStringBuilderExtensions.AddCommand(new SeStringBuilder(), "clearsettings", "Clears all temporary settings applied by Glamourer. Use without arguments for help.").BuiltString); + _chat.Print(SeStringBuilderExtensions.AddCommand(new SeStringBuilder(), "copy", "Copy the current state of a character to clipboard. Use without arguments for help.").BuiltString); + _chat.Print(SeStringBuilderExtensions.AddCommand(new SeStringBuilder(), "save", "Save the current state of a character to a named design. Use without arguments for help.").BuiltString); + _chat.Print(SeStringBuilderExtensions.AddCommand(new SeStringBuilder(), "automation", "Change the state of automated design sets. Use without arguments for help.").BuiltString); + _chat.Print(SeStringBuilderExtensions.AddCommand(new SeStringBuilder(), "applyitem", "Apply a specific item to a character. Use without arguments for help.").BuiltString); + _chat.Print(SeStringBuilderExtensions.AddCommand(new SeStringBuilder(), "applycustomization", "Apply a specific customization value to a character. Use without arguments for help.") .BuiltString); return true; } @@ -184,15 +176,15 @@ public class CommandService : IDisposable, IApiService var argumentList = argument.Split('|', StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries); if (argumentList.Length < 1) { - _chat.Print(new SeStringBuilder().AddText("Use with /glamour clearsettings ").AddGreen("[Character Identifier]").AddText(" | ") - .AddPurple("").AddText(" | ").AddBlue("").BuiltString); + _chat.Print(SeStringBuilderExtensions.AddBlue(new SeStringBuilder().AddText("Use with /glamour clearsettings ").AddGreen("[Character Identifier]").AddText(" | ") + .AddPurple("").AddText(" | "), "").BuiltString); PlayerIdentifierHelp(false, true); - _chat.Print(new SeStringBuilder() - .AddText(" 》 The character identifier specifies the collection to clear settings from. It also accepts '").AddGreen("all") + _chat.Print(SeStringBuilderExtensions.AddGreen(new SeStringBuilder() + .AddText(" 》 The character identifier specifies the collection to clear settings from. It also accepts '"), "all") .AddText("' to clear all collections.").BuiltString); - _chat.Print(new SeStringBuilder().AddText(" 》 The booleans are optional and default to 'true', the ").AddPurple("first") - .AddText(" determines whether ").AddPurple("manually").AddText(" applied settings are cleared, the ").AddBlue("second") - .AddText(" determines whether ").AddBlue("automatically").AddText(" applied settings are cleared.").BuiltString); + _chat.Print(SeStringBuilderExtensions.AddBlue(new SeStringBuilder().AddText(" 》 The booleans are optional and default to 'true', the ").AddPurple("first") + .AddText(" determines whether ").AddPurple("manually").AddText(" applied settings are cleared, the ").AddBlue("second") + .AddText(" determines whether "), "automatically").AddText(" applied settings are cleared.").BuiltString); return false; } @@ -242,25 +234,24 @@ public class CommandService : IDisposable, IApiService var argumentList = arguments.Split(' ', 2, StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries); if (argumentList.Length != 2) { - _chat.Print(new SeStringBuilder().AddText("Use with /glamour automation ").AddBlue("enable, disable or application", true) - .AddText(" ") - .AddRed("Automated Design Set Index or Name", true).AddText(" | ").AddYellow("").AddText(" ") - .AddPurple("") + _chat.Print(SeStringBuilderExtensions.AddPurple(new SeStringBuilder().AddText("Use with /glamour automation ").AddBlue("enable, disable or application", true) + .AddText(" ") + .AddRed("Automated Design Set Index or Name", true).AddText(" | ").AddYellow("").AddText(" "), "") .BuiltString); _chat.Print( " 》 If the design set name is a valid natural number it will be used as a index. Design names that are such numbers can not be dealt with."); _chat.Print(" 》 If multiple design sets have the same name, the first one will be changed."); _chat.Print(" 》 The name is case-insensitive."); - _chat.Print(new SeStringBuilder().AddText(" 》 If the command is ").AddBlue("application") - .AddText(" the ").AddYellow("design index").AddText(" and ").AddPurple("flags").AddText(" are required.").BuiltString); - _chat.Print(new SeStringBuilder().AddText(" 》 The ").AddYellow("design index") + _chat.Print(SeStringBuilderExtensions.AddPurple(new SeStringBuilder().AddText(" 》 If the command is ").AddBlue("application") + .AddText(" the ").AddYellow("design index").AddText(" and "), "flags").AddText(" are required.").BuiltString); + _chat.Print(SeStringBuilderExtensions.AddYellow(new SeStringBuilder().AddText(" 》 The "), "design index") .AddText(" is the number in front of the relevant design in the automated design set.").BuiltString); - _chat.Print(new SeStringBuilder().AddText(" 》 The ").AddPurple("Application Flags").AddText(" are a combination of the letters ") - .AddInitialPurple("Customizations, ") - .AddInitialPurple("Equipment, ") - .AddInitialPurple("Accessories, ") - .AddInitialPurple("Dyes & Crests and ") - .AddInitialPurple("Weapons, where ").AddPurple("CEADW") + _chat.Print(SeStringBuilderExtensions.AddPurple(new SeStringBuilder().AddText(" 》 The ").AddPurple("Application Flags").AddText(" are a combination of the letters ") + .AddInitialPurple("Customizations, ") + .AddInitialPurple("Equipment, ") + .AddInitialPurple("Accessories, ") + .AddInitialPurple("Dyes & Crests and ") + .AddInitialPurple("Weapons, where "), "CEADW") .AddText(" means everything should be toggled on, and no value means nothing should be toggled on.") .BuiltString); return false; @@ -286,9 +277,9 @@ public class CommandService : IDisposable, IApiService break; case "application": return HandleApplication(argumentList[1]); default: - _chat.Print(new SeStringBuilder().AddText("The command ") - .AddBlue(argumentList[0], true).AddText(" is unknown. Currently only ").AddBlue("enable").AddText(", ").AddBlue("disable") - .AddText(" or ").AddBlue("application") + _chat.Print(SeStringBuilderExtensions.AddBlue(new SeStringBuilder().AddText("The command ") + .AddBlue(argumentList[0], true).AddText(" is unknown. Currently only ").AddBlue("enable").AddText(", ").AddBlue("disable") + .AddText(" or "), "application") .AddText(" are supported.").BuiltString); return false; } @@ -310,8 +301,7 @@ public class CommandService : IDisposable, IApiService if (idx >= 0) return true; - _chat.Print(new SeStringBuilder().AddText("Could not change state of automated design set ") - .AddRed(name, true).AddText(" No automated design set of that name or index exists.").BuiltString); + _chat.Print(SeStringBuilderExtensions.AddRed(new SeStringBuilder().AddText("Could not change state of automated design set "), name, true).AddText(" No automated design set of that name or index exists.").BuiltString); return false; } @@ -320,7 +310,7 @@ public class CommandService : IDisposable, IApiService var split = argument.Split('|', StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries); if (split.Length != 2) { - _chat.Print(new SeStringBuilder().AddText("The command ").AddBlue("automation") + _chat.Print(SeStringBuilderExtensions.AddBlue(new SeStringBuilder().AddText("The command "), "automation") .AddText(" requires a design index and application flags.").BuiltString); return false; } @@ -334,7 +324,7 @@ public class CommandService : IDisposable, IApiService var split2 = split[1].Split(' ', StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries); if (!int.TryParse(split2[0], out var designIdx) || designIdx <= 0) { - _chat.Print(new SeStringBuilder().AddText("The value ").AddYellow(split2[0], true) + _chat.Print(SeStringBuilderExtensions.AddYellow(new SeStringBuilder().AddText("The value "), split2[0], true) .AddText(" is not a valid design index.").BuiltString); return false; } @@ -358,7 +348,7 @@ public class CommandService : IDisposable, IApiService case 'd': applicationFlags |= ApplicationType.GearCustomization; break; case 'w': applicationFlags |= ApplicationType.Weapons; break; default: - _chat.Print(new SeStringBuilder().AddText("The value ").AddPurple(split2[1], true) + _chat.Print(SeStringBuilderExtensions.AddPurple(new SeStringBuilder().AddText("The value "), split2[1], true) .AddText(" is not a valid set of application flags.").BuiltString); return false; } @@ -372,7 +362,7 @@ public class CommandService : IDisposable, IApiService { if (argument.Length == 0) { - _chat.Print(new SeStringBuilder().AddText($"Use with /glamour {command} ").AddGreen("[Character Identifier]").BuiltString); + _chat.Print(SeStringBuilderExtensions.AddGreen(new SeStringBuilder().AddText($"Use with /glamour {command} "), "[Character Identifier]").BuiltString); PlayerIdentifierHelp(false, true); return true; } @@ -402,7 +392,7 @@ public class CommandService : IDisposable, IApiService { if (argument.Length == 0) { - _chat.Print(new SeStringBuilder().AddText("Use with /glamour revert ").AddGreen("[Character Identifier]").BuiltString); + _chat.Print(SeStringBuilderExtensions.AddGreen(new SeStringBuilder().AddText("Use with /glamour revert "), "[Character Identifier]").BuiltString); PlayerIdentifierHelp(false, true); return true; } @@ -424,7 +414,7 @@ public class CommandService : IDisposable, IApiService { if (argument.Length == 0) { - _chat.Print(new SeStringBuilder().AddText("Use with /glamour revert ").AddGreen("[Character Identifier]").BuiltString); + _chat.Print(SeStringBuilderExtensions.AddGreen(new SeStringBuilder().AddText("Use with /glamour revert "), "[Character Identifier]").BuiltString); PlayerIdentifierHelp(false, true); return true; } @@ -450,9 +440,8 @@ public class CommandService : IDisposable, IApiService var split = arguments.Split('|', 2, StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries); if (split.Length is not 2) { - _chat.Print(new SeStringBuilder().AddText("Use with /glamour applyitem ").AddYellow("[Item ID or Item Name]") - .AddText(" | ") - .AddGreen("[Character Identifier]") + _chat.Print(SeStringBuilderExtensions.AddGreen(new SeStringBuilder().AddText("Use with /glamour applyitem ").AddYellow("[Item ID or Item Name]") + .AddText(" | "), "[Character Identifier]") .BuiltString); _chat.Print(new SeStringBuilder() .AddText( @@ -468,7 +457,7 @@ public class CommandService : IDisposable, IApiService if (_items.ItemData.Primary.TryGetValue(id, out var main)) items[0] = main; } - else if (_items.ItemData.Primary.FindFirst(pair => string.Equals(pair.Value.Name, split[0], StringComparison.OrdinalIgnoreCase), + else if (ArrayExtensions.FindFirst(_items.ItemData.Primary, pair => string.Equals(pair.Value.Name, split[0], StringComparison.OrdinalIgnoreCase), out var i)) { items[0] = i.Value; @@ -476,7 +465,7 @@ public class CommandService : IDisposable, IApiService if (!items[0].Valid) { - _chat.Print(new SeStringBuilder().AddText("The item ").AddYellow(split[0], true) + _chat.Print(SeStringBuilderExtensions.AddYellow(new SeStringBuilder().AddText("The item "), split[0], true) .AddText(" could not be identified as a valid item.").BuiltString); return false; } @@ -534,7 +523,7 @@ public class CommandService : IDisposable, IApiService || customizeInt < 0 || customizeInt >= CustomizationExtensions.AllBasic.Length) { - _chat.Print(new SeStringBuilder().AddText("The customization type ").AddYellow(customizationSplit[0], true) + _chat.Print(SeStringBuilderExtensions.AddYellow(new SeStringBuilder().AddText("The customization type "), customizationSplit[0], true) .AddText(" could not be identified as a valid type.").BuiltString); return false; } @@ -560,7 +549,7 @@ public class CommandService : IDisposable, IApiService } else { - _chat.Print(new SeStringBuilder().AddText("The customization value ").AddPurple(valueString, true) + _chat.Print(SeStringBuilderExtensions.AddPurple(new SeStringBuilder().AddText("The customization value "), valueString, true) .AddText(" could not be parsed.") .BuiltString); return false; @@ -634,26 +623,24 @@ public class CommandService : IDisposable, IApiService bool PrintCustomizationHelp() { - _chat.Print(new SeStringBuilder().AddText("Use with /glamour applycustomization ").AddYellow("[Customization Type]") - .AddPurple(" [Value, Next, Previous, Minus, or Plus] ") - .AddBlue("") - .AddText(" | ") - .AddGreen("[Character Identifier]") + _chat.Print(SeStringBuilderExtensions.AddGreen(new SeStringBuilder().AddText("Use with /glamour applycustomization ").AddYellow("[Customization Type]") + .AddPurple(" [Value, Next, Previous, Minus, or Plus] ") + .AddBlue("") + .AddText(" | "), "[Character Identifier]") .BuiltString); - _chat.Print(new SeStringBuilder().AddText(" 》 Valid ").AddPurple("values") + _chat.Print(SeStringBuilderExtensions.AddPurple(new SeStringBuilder().AddText(" 》 Valid "), "values") .AddText(" depend on the the character's gender, clan, and the customization type.").BuiltString); - _chat.Print(new SeStringBuilder().AddText(" 》 ").AddPurple("Plus").AddText(" and ").AddPurple("Minus") - .AddText(" are the same as pressing the + and - buttons in the UI, times the optional ").AddBlue(" amount").AddText(".") + _chat.Print(SeStringBuilderExtensions.AddBlue(new SeStringBuilder().AddText(" 》 ").AddPurple("Plus").AddText(" and ").AddPurple("Minus") + .AddText(" are the same as pressing the + and - buttons in the UI, times the optional "), " amount").AddText(".") .BuiltString); - _chat.Print(new SeStringBuilder().AddText(" 》 ").AddPurple("Next").AddText(" and ").AddPurple("Previous") + _chat.Print(SeStringBuilderExtensions.AddPurple(new SeStringBuilder().AddText(" 》 ").AddPurple("Next").AddText(" and "), "Previous") .AddText(" is similar to Plus and Minus, but with wrap-around on reaching the end.").BuiltString); - var builder = new SeStringBuilder().AddText(" 》 Available ").AddYellow("Customization Types") - .AddText(" are either a number in ") - .AddYellow($"[0, {CustomizationExtensions.AllBasic.Length}]") + var builder = SeStringBuilderExtensions.AddYellow(new SeStringBuilder().AddText(" 》 Available ").AddYellow("Customization Types") + .AddText(" are either a number in "), $"[0, {CustomizationExtensions.AllBasic.Length}]") .AddText(" or one of "); foreach (var index in CustomizationExtensions.AllBasic.SkipLast(1)) - builder.AddYellow(index.ToString()).AddText(", "); - _chat.Print(builder.AddYellow(CustomizationExtensions.AllBasic[^1].ToString()).AddText(".").BuiltString); + SeStringBuilderExtensions.AddYellow(builder, index.ToString()).AddText(", "); + _chat.Print(SeStringBuilderExtensions.AddYellow(builder, CustomizationExtensions.AllBasic[^1].ToString()).AddText(".").BuiltString); _chat.Print(new SeStringBuilder() .AddText(" 》 The item name is case-insensitive. Numeric IDs are preferred before item names.") .BuiltString); @@ -667,12 +654,11 @@ public class CommandService : IDisposable, IApiService var split = arguments.Split('|', 2, StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries); if (split.Length is not 2) { - _chat.Print(new SeStringBuilder().AddText("Use with /glamour apply ") - .AddYellow("[Design Name, Path or Identifier, Quick, Selection, Random, or Clipboard]") - .AddText(" | ") - .AddGreen("[Character Identifier]") - .AddText("; ") - .AddBlue("") + _chat.Print(SeStringBuilderExtensions.AddBlue(new SeStringBuilder().AddText("Use with /glamour apply ") + .AddYellow("[Design Name, Path or Identifier, Quick, Selection, Random, or Clipboard]") + .AddText(" | ") + .AddGreen("[Character Identifier]") + .AddText("; "), "") .BuiltString); _chat.Print(new SeStringBuilder() .AddText( @@ -691,15 +677,15 @@ public class CommandService : IDisposable, IApiService .AddText(" 》 Selection will use the design currently selected in the main interfaces Designs tab, if any.").BuiltString); _chat.Print(new SeStringBuilder() .AddText(" 》 Clipboard as a single word will try to apply a design string currently in your clipboard.").BuiltString); - _chat.Print(new SeStringBuilder() - .AddText(" 》 ").AddYellow("Random") + _chat.Print(SeStringBuilderExtensions.AddYellow(new SeStringBuilder() + .AddText(" 》 "), "Random") .AddText( " supports many restrictions, see the Restriction Builder when adding a Random design to Automations for valid strings.") .BuiltString); - _chat.Print(new SeStringBuilder() - .AddText(" 》 ").AddBlue("").AddText(" is optional and can be omitted (together with the ;), ").AddBlue("true") - .AddText(" or ").AddBlue("false").AddText(".").BuiltString); - _chat.Print(new SeStringBuilder().AddText("If ").AddBlue("true") + _chat.Print(SeStringBuilderExtensions.AddBlue(new SeStringBuilder() + .AddText(" 》 ").AddBlue("").AddText(" is optional and can be omitted (together with the ;), ").AddBlue("true") + .AddText(" or "), "false").AddText(".").BuiltString); + _chat.Print(SeStringBuilderExtensions.AddBlue(new SeStringBuilder().AddText("If "), "true") .AddText(", it will try to apply mod associations to the collection assigned to the identified character.").BuiltString); PlayerIdentifierHelp(false, true); return true; @@ -763,7 +749,7 @@ public class CommandService : IDisposable, IApiService { if (argument.Length == 0) { - _chat.Print(new SeStringBuilder().AddText("Use with /glamour delete ").AddYellow("[Design Name, Path or Identifier]").BuiltString); + _chat.Print(SeStringBuilderExtensions.AddYellow(new SeStringBuilder().AddText("Use with /glamour delete "), "[Design Name, Path or Identifier]").BuiltString); _chat.Print(new SeStringBuilder() .AddText( " 》 The design name is case-insensitive. If multiple designs of that name up to case exist, the first one is chosen.") @@ -790,7 +776,7 @@ public class CommandService : IDisposable, IApiService { if (argument.Length == 0) { - _chat.Print(new SeStringBuilder().AddText("Use with /glamour copy ").AddGreen("[Character Identifier]").BuiltString); + _chat.Print(SeStringBuilderExtensions.AddGreen(new SeStringBuilder().AddText("Use with /glamour copy "), "[Character Identifier]").BuiltString); PlayerIdentifierHelp(false, true); } @@ -829,8 +815,7 @@ public class CommandService : IDisposable, IApiService var split = arguments.Split('|', 2, StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries); if (split.Length != 2) { - _chat.Print(new SeStringBuilder().AddText("Use with /glamour save ").AddYellow("[New Design Name]").AddText(" | ") - .AddGreen("[Character Identifier]").BuiltString); + _chat.Print(SeStringBuilderExtensions.AddGreen(new SeStringBuilder().AddText("Use with /glamour save ").AddYellow("[New Design Name]").AddText(" | "), "[Character Identifier]").BuiltString); PlayerIdentifierHelp(false, true); } @@ -850,7 +835,7 @@ public class CommandService : IDisposable, IApiService return true; } - _chat.Print(new SeStringBuilder().AddText("Could not save state to design ").AddYellow(split[0], true) + _chat.Print(SeStringBuilderExtensions.AddYellow(new SeStringBuilder().AddText("Could not save state to design "), split[0], true) .AddText(": No identified object is available or has stored state.").BuiltString); return false; } @@ -864,7 +849,7 @@ public class CommandService : IDisposable, IApiService var identifier = _actors.FromObject(obj.AsObject, out _, true, true, true); if (!identifier.IsValid) { - _chat.Print(new SeStringBuilder().AddText("The placeholder ").AddGreen(argument) + _chat.Print(SeStringBuilderExtensions.AddGreen(new SeStringBuilder().AddText("The placeholder "), argument) .AddText(" did not resolve to a game object with a valid identifier.").BuiltString); identifiers = []; return false; @@ -884,7 +869,7 @@ public class CommandService : IDisposable, IApiService && identifiers[0].Type is IdentifierType.Player or IdentifierType.Owned && identifiers[0].HomeWorld == ushort.MaxValue) { - _chat.Print(new SeStringBuilder().AddText("The argument ").AddRed(argument, true) + _chat.Print(SeStringBuilderExtensions.AddRed(new SeStringBuilder().AddText("The argument "), argument, true) .AddText(" did not specify a world.").BuiltString); return false; } @@ -894,7 +879,7 @@ public class CommandService : IDisposable, IApiService } catch (ActorIdentifierFactory.IdentifierParseError e) { - _chat.Print(new SeStringBuilder().AddText("The argument ").AddRed(argument, true) + _chat.Print(SeStringBuilderExtensions.AddRed(new SeStringBuilder().AddText("The argument "), argument, true) .AddText($" could not be converted to an identifier. {e.Message}") .BuiltString); identifiers = []; @@ -904,27 +889,27 @@ public class CommandService : IDisposable, IApiService private void PlayerIdentifierHelp(bool allowAnyWorld, bool allowIndex) { - var npcGuide = new SeStringBuilder().AddText(" 》》》").AddGreen("n").AddText(" | ").AddPurple("[NPC Type]").AddText(" : ") - .AddRed("[NPC Name]").AddBlue(allowIndex ? "@" : string.Empty).AddText(", where NPC Type can be ") - .AddInitialPurple("Mount") - .AddInitialPurple("Companion") - .AddInitialPurple("Accessory").AddInitialPurple("Event NPC").AddText("or ").AddInitialPurple("Battle NPC", false); + var npcGuide = SeStringBuilderExtensions.AddInitialPurple(new SeStringBuilder().AddText(" 》》》").AddGreen("n").AddText(" | ").AddPurple("[NPC Type]").AddText(" : ") + .AddRed("[NPC Name]").AddBlue(allowIndex ? "@" : string.Empty).AddText(", where NPC Type can be ") + .AddInitialPurple("Mount") + .AddInitialPurple("Companion") + .AddInitialPurple("Accessory").AddInitialPurple("Event NPC").AddText("or "), "Battle NPC", false); if (allowIndex) - npcGuide = npcGuide.AddText(", and the ").AddBlue("index").AddText(" is an optional non-negative number in the object table."); + npcGuide = SeStringBuilderExtensions.AddBlue(npcGuide.AddText(", and the "), "index").AddText(" is an optional non-negative number in the object table."); else npcGuide = npcGuide.AddText("."); _chat.Print(new SeStringBuilder().AddText(" 》 Valid Character Identifiers have the form:").BuiltString); - _chat.Print(new SeStringBuilder().AddText(" 》》》").AddGreen("").AddText(" or ").AddGreen("").AddText(" or ").AddGreen("") - .AddText(" or ").AddGreen("") + _chat.Print(SeStringBuilderExtensions.AddGreen(new SeStringBuilder().AddText(" 》》》").AddGreen("").AddText(" or ").AddGreen("").AddText(" or ").AddGreen("") + .AddText(" or "), "") .AddText(" as placeholders for your character, your target, your mouseover or your focus, if they exist.").BuiltString); - _chat.Print(new SeStringBuilder().AddText(" 》》》").AddGreen("p").AddText(" | ").AddWhite("[Player Name]@[World Name]") + _chat.Print(SeStringBuilderExtensions.AddWhite(new SeStringBuilder().AddText(" 》》》").AddGreen("p").AddText(" | "), "[Player Name]@[World Name]") .AddText(allowAnyWorld ? ", if no @ is provided, Any World is used." : ".") .BuiltString); - _chat.Print(new SeStringBuilder().AddText(" 》》》").AddGreen("r").AddText(" | ").AddWhite("[Retainer Name]").AddText(".").BuiltString); + _chat.Print(SeStringBuilderExtensions.AddWhite(new SeStringBuilder().AddText(" 》》》").AddGreen("r").AddText(" | "), "[Retainer Name]").AddText(".").BuiltString); _chat.Print(npcGuide.BuiltString); - _chat.Print(new SeStringBuilder().AddText(" 》》》 ").AddGreen("o").AddText(" | ").AddPurple("[NPC Type]") - .AddText(" : ") - .AddRed("[NPC Name]").AddText(" | ").AddWhite("[Player Name]@").AddText(".").BuiltString); + _chat.Print(SeStringBuilderExtensions.AddWhite(new SeStringBuilder().AddText(" 》》》 ").AddGreen("o").AddText(" | ").AddPurple("[NPC Type]") + .AddText(" : ") + .AddRed("[NPC Name]").AddText(" | "), "[Player Name]@").AddText(".").BuiltString); } } diff --git a/Glamourer/Services/CustomizeService.cs b/Glamourer/Services/CustomizeService.cs index 74f0b5b..6b1a143 100644 --- a/Glamourer/Services/CustomizeService.cs +++ b/Glamourer/Services/CustomizeService.cs @@ -1,5 +1,5 @@ using Glamourer.GameData; -using OtterGui.Services; +using Luna; using Penumbra.GameData.DataContainers; using Penumbra.GameData.Enums; using Penumbra.GameData.Structs; diff --git a/Glamourer/Services/DalamudServices.cs b/Glamourer/Services/DalamudServices.cs index e8a9f55..a6f0a3c 100644 --- a/Glamourer/Services/DalamudServices.cs +++ b/Glamourer/Services/DalamudServices.cs @@ -1,7 +1,7 @@ using Dalamud.Interface.DragDrop; using Dalamud.Plugin; using Dalamud.Plugin.Services; -using OtterGui.Services; +using Luna; namespace Glamourer.Services; diff --git a/Glamourer/Services/DesignApplier.cs b/Glamourer/Services/DesignApplier.cs index f0a9ba4..36c18ce 100644 --- a/Glamourer/Services/DesignApplier.cs +++ b/Glamourer/Services/DesignApplier.cs @@ -1,6 +1,6 @@ using Glamourer.Designs; using Glamourer.State; -using OtterGui.Services; +using Luna; using Penumbra.GameData.Actors; using Penumbra.GameData.Interop; diff --git a/Glamourer/Services/DesignResolver.cs b/Glamourer/Services/DesignResolver.cs index 8bb5cd2..f7259f3 100644 --- a/Glamourer/Services/DesignResolver.cs +++ b/Glamourer/Services/DesignResolver.cs @@ -5,8 +5,7 @@ using Glamourer.Designs.Special; using Glamourer.Gui; using Glamourer.Gui.Tabs.DesignTab; using Dalamud.Bindings.ImGui; -using OtterGui.Services; -using OtterGui.Classes; +using Luna; namespace Glamourer.Services; diff --git a/Glamourer/Services/HeightService.cs b/Glamourer/Services/HeightService.cs index 0a6c7bb..556e47b 100644 --- a/Glamourer/Services/HeightService.cs +++ b/Glamourer/Services/HeightService.cs @@ -1,7 +1,7 @@ using Dalamud.Plugin.Services; using Dalamud.Utility.Signatures; using FFXIVClientStructs.FFXIV.Client.Graphics.Scene; -using OtterGui.Services; +using Luna; using Penumbra.GameData; using Penumbra.GameData.Enums; using Penumbra.GameData.Structs; diff --git a/Glamourer/Services/PcpService.cs b/Glamourer/Services/PcpService.cs index 3363172..6711ce3 100644 --- a/Glamourer/Services/PcpService.cs +++ b/Glamourer/Services/PcpService.cs @@ -1,8 +1,8 @@ using Glamourer.Designs; using Glamourer.Interop.Penumbra; using Glamourer.State; +using Luna; using Newtonsoft.Json.Linq; -using OtterGui.Services; using Penumbra.GameData.Actors; using Penumbra.GameData.Interop; diff --git a/Glamourer/Services/ServiceManager.cs b/Glamourer/Services/ServiceManager.cs index 6cfb4b6..b07f2a3 100644 --- a/Glamourer/Services/ServiceManager.cs +++ b/Glamourer/Services/ServiceManager.cs @@ -19,16 +19,18 @@ using Glamourer.Interop; using Glamourer.Interop.Penumbra; using Glamourer.State; using Glamourer.Unlocks; +using Luna; using Microsoft.Extensions.DependencyInjection; using OtterGui.Classes; -using OtterGui.Log; using OtterGui.Raii; -using OtterGui.Services; using Penumbra.GameData.Actors; using Penumbra.GameData.Data; using Penumbra.GameData.DataContainers; using Penumbra.GameData.Interop; using Penumbra.GameData.Structs; +using FrameworkManager = OtterGui.Classes.FrameworkManager; +using Logger = OtterGui.Log.Logger; +using MessageService = OtterGui.Classes.MessageService; namespace Glamourer.Services; @@ -37,7 +39,7 @@ public static class StaticServiceManager public static ServiceManager CreateProvider(IDalamudPluginInterface pi, Logger log, Glamourer glamourer) { EventWrapperBase.ChangeLogger(log); - var services = new ServiceManager(log) + var services = new ServiceManager(new Luna.Logger("Glamourer")) .AddExistingService(log) .AddMeta() .AddInterop() @@ -51,8 +53,15 @@ public static class StaticServiceManager services.AddIServices(typeof(EquipItem).Assembly); services.AddIServices(typeof(Glamourer).Assembly); services.AddIServices(typeof(ImRaii).Assembly); + services.AddIServices(typeof(ServiceManager).Assembly); + services.AddIServices(typeof(Glamourer).Assembly); + + services.AddSingleton(); + services.AddSingleton(); + services.AddSingleton(); + services.AddSingleton(); services.AddSingleton(p => p.GetRequiredService()); - services.CreateProvider(); + services.BuildProvider(); return services; } diff --git a/Glamourer/State/JobChangeState.cs b/Glamourer/State/JobChangeState.cs index d568375..729a4d2 100644 --- a/Glamourer/State/JobChangeState.cs +++ b/Glamourer/State/JobChangeState.cs @@ -1,5 +1,5 @@ using Glamourer.Designs.Links; -using OtterGui.Services; +using Luna; using Penumbra.GameData.Actors; using Penumbra.GameData.Enums; using Penumbra.GameData.Structs; diff --git a/Luna b/Luna index 2487453..1887502 160000 --- a/Luna +++ b/Luna @@ -1 +1 @@ -Subproject commit 2487453cfa4e95b9dbc661ed6e7298655df3b055 +Subproject commit 1887502aa892743e9db84c9adc084d748219f1f3 diff --git a/Penumbra.GameData b/Penumbra.GameData index be7792e..de0c19f 160000 --- a/Penumbra.GameData +++ b/Penumbra.GameData @@ -1 +1 @@ -Subproject commit be7792ea33ae0b91109fcb95360cf4f382e9bc99 +Subproject commit de0c19f712c75efe05aef7ff614b2ead0f10e534