From 423653faf2df5bf49fd3b09447a95d0b09282feb Mon Sep 17 00:00:00 2001 From: ciphered2k Date: Sun, 9 Oct 2022 13:27:23 -0400 Subject: [PATCH] Add options to apply dye color to all slots Adds an additional stain combo box above the equipment list that allows a dye color to be selected and applied to all equipment slots simultaneously. --- Glamourer/Gui/Interface.cs | 2 ++ Glamourer/Gui/InterfaceEquipment.cs | 38 +++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+) diff --git a/Glamourer/Gui/Interface.cs b/Glamourer/Gui/Interface.cs index b9ac6bb..c452fe0 100644 --- a/Glamourer/Gui/Interface.cs +++ b/Glamourer/Gui/Interface.cs @@ -22,6 +22,7 @@ namespace Glamourer.Gui private readonly IReadOnlyDictionary _models; private readonly IObjectIdentifier _identifier; private readonly Dictionary, ComboWithFilter)> _combos; + private readonly ComboWithFilter _globalStainCombo; private readonly ImGuiScene.TextureWrap? _legacyTattooIcon; private readonly Dictionary _equipSlotNames; private readonly DesignManager _designs; @@ -52,6 +53,7 @@ namespace Glamourer.Gui var equip = GameData.ItemsBySlot(Dalamud.GameData); _combos = equip.ToDictionary(kvp => kvp.Key, kvp => CreateCombos(kvp.Key, kvp.Value, stainCombo)); + _globalStainCombo = new ComboWithFilter("Dye All Slots", stainCombo); _legacyTattooIcon = GetLegacyTattooIcon(); } diff --git a/Glamourer/Gui/InterfaceEquipment.cs b/Glamourer/Gui/InterfaceEquipment.cs index 22cd084..52339c6 100644 --- a/Glamourer/Gui/InterfaceEquipment.cs +++ b/Glamourer/Gui/InterfaceEquipment.cs @@ -41,6 +41,42 @@ namespace Glamourer.Gui } + private bool DrawGlobalStainSelector(ComboWithFilter stainCombo) + { + stainCombo.PostPreview = null; + + var change = stainCombo.Draw(string.Empty, out var newStain); + if (!change) + { + ImGuiCustom.HoverTooltip("Right-click to clear."); + if (ImGui.IsItemClicked(ImGuiMouseButton.Right)) + { + change = true; + newStain = Stain.None; + } + } + + if (!change) + return false; + + if (_player == null) + { + foreach (var key in GetEquipSlotNames().Keys) + { + _selection?.Data.WriteStain(key, newStain.RowIndex); + } + return _inDesignMode; + } + + Glamourer.RevertableDesigns.Add(_player); + foreach (var key in GetEquipSlotNames().Keys) + { + newStain.Write(_player.Address, key); + } + + return true; + } + private bool DrawItemSelector(ComboWithFilter equipCombo, Lumina.Excel.GeneratedSheets.Item item, EquipSlot slot = EquipSlot.Unknown) { var currentName = item.Name.ToString(); @@ -142,6 +178,7 @@ namespace Glamourer.Gui var ret = false; if (ImGui.CollapsingHeader("Character Equipment")) { + ret |= DrawGlobalStainSelector(_globalStainCombo); ret |= DrawWeapon(EquipSlot.MainHand, equip.MainHand); ret |= DrawWeapon(EquipSlot.OffHand, equip.OffHand); ret |= DrawEquipSlot(EquipSlot.Head, equip.Head); @@ -164,6 +201,7 @@ namespace Glamourer.Gui var ret = false; if (ImGui.CollapsingHeader("Character Equipment")) { + ret |= DrawGlobalStainSelector(_globalStainCombo); ret |= DrawWeaponWithCheck(EquipSlot.MainHand, equip.MainHand, CharacterEquipMask.MainHand, ref mask); ret |= DrawWeaponWithCheck(EquipSlot.OffHand, equip.OffHand, CharacterEquipMask.OffHand, ref mask); ret |= DrawEquipSlotWithCheck(EquipSlot.Head, equip.Head, CharacterEquipMask.Head, ref mask);