diff --git a/Glamourer.GameData/GameData.cs b/Glamourer.GameData/GameData.cs index 06a5128..4028c08 100644 --- a/Glamourer.GameData/GameData.cs +++ b/Glamourer.GameData/GameData.cs @@ -49,19 +49,22 @@ namespace Glamourer Item EmptySlot(EquipSlot slot) => new(sheet.First(), "Nothing", slot); + static Item EmptyNpc(EquipSlot slot) + => new(new Lumina.Excel.GeneratedSheets.Item() { ModelMain = 9903 }, "Smallclothes (NPC)", slot); + _itemsBySlot = new Dictionary>() { - [EquipSlot.Head] = new(200) { EmptySlot(EquipSlot.Head) }, - [EquipSlot.Body] = new(200) { EmptySlot(EquipSlot.Body) }, - [EquipSlot.Hands] = new(200) { EmptySlot(EquipSlot.Hands) }, - [EquipSlot.Legs] = new(200) { EmptySlot(EquipSlot.Legs) }, - [EquipSlot.Feet] = new(200) { EmptySlot(EquipSlot.Feet) }, - [EquipSlot.RFinger] = new(200) { EmptySlot(EquipSlot.RFinger) }, - [EquipSlot.Neck] = new(200) { EmptySlot(EquipSlot.Neck) }, + [EquipSlot.Head] = new(200) { EmptySlot(EquipSlot.Head), EmptyNpc(EquipSlot.Head) }, + [EquipSlot.Body] = new(200) { EmptySlot(EquipSlot.Body), EmptyNpc(EquipSlot.Body) }, + [EquipSlot.Hands] = new(200) { EmptySlot(EquipSlot.Hands), EmptyNpc(EquipSlot.Hands) }, + [EquipSlot.Legs] = new(200) { EmptySlot(EquipSlot.Legs), EmptyNpc(EquipSlot.Legs) }, + [EquipSlot.Feet] = new(200) { EmptySlot(EquipSlot.Feet), EmptyNpc(EquipSlot.Feet) }, + [EquipSlot.RFinger] = new(200) { EmptySlot(EquipSlot.RFinger), EmptyNpc(EquipSlot.RFinger) }, + [EquipSlot.Neck] = new(200) { EmptySlot(EquipSlot.Neck), EmptyNpc(EquipSlot.Neck) }, [EquipSlot.MainHand] = new(1000) { EmptySlot(EquipSlot.MainHand) }, [EquipSlot.OffHand] = new(200) { EmptySlot(EquipSlot.OffHand) }, - [EquipSlot.Wrists] = new(200) { EmptySlot(EquipSlot.Wrists) }, - [EquipSlot.Ears] = new(200) { EmptySlot(EquipSlot.Ears) }, + [EquipSlot.Wrists] = new(200) { EmptySlot(EquipSlot.Wrists), EmptyNpc(EquipSlot.Wrists) }, + [EquipSlot.Ears] = new(200) { EmptySlot(EquipSlot.Ears), EmptyNpc(EquipSlot.Ears) }, }; foreach (var item in sheet) diff --git a/Glamourer/Gui/InterfaceEquipment.cs b/Glamourer/Gui/InterfaceEquipment.cs index d7524fe..c7ffc33 100644 --- a/Glamourer/Gui/InterfaceEquipment.cs +++ b/Glamourer/Gui/InterfaceEquipment.cs @@ -1,5 +1,6 @@ using Dalamud.Interface; using ImGuiNET; +using Lumina.Text; using Penumbra.GameData.Enums; using Penumbra.GameData.Structs; @@ -39,11 +40,11 @@ namespace Glamourer.Gui } - private bool DrawItemSelector(ComboWithFilter equipCombo, Lumina.Excel.GeneratedSheets.Item? item, EquipSlot slot = EquipSlot.Unknown) + private bool DrawItemSelector(ComboWithFilter equipCombo, Lumina.Excel.GeneratedSheets.Item item, EquipSlot slot = EquipSlot.Unknown) { - var currentName = item?.Name.ToString() ?? Item.Nothing(slot).Name; - var change = equipCombo.Draw(currentName, out var newItem, _itemComboWidth) && newItem.Base.RowId != item?.RowId; - if (!change && item != null) + var currentName = item.Name.ToString(); + var change = equipCombo.Draw(currentName, out var newItem, _itemComboWidth) && newItem.Base.RowId != item.RowId; + if (!change && !ReferenceEquals(item, SmallClothes)) { ImGuiCustom.HoverTooltip("Right-click to clear."); if (ImGui.IsItemClicked(ImGuiMouseButton.Right)) @@ -80,13 +81,27 @@ namespace Glamourer.Gui return ret; } + private static readonly Lumina.Excel.GeneratedSheets.Item SmallClothes = new(){ Name = new SeString("Nothing"), RowId = 0 }; + private static readonly Lumina.Excel.GeneratedSheets.Item SmallClothesNpc = new(){ Name = new SeString("Smallclothes (NPC)"), RowId = 1 }; + private static readonly Lumina.Excel.GeneratedSheets.Item Unknown = new(){ Name = new SeString("Unknown"), RowId = 2 }; + + private Lumina.Excel.GeneratedSheets.Item Identify(SetId set, WeaponType weapon, ushort variant, EquipSlot slot) + { + return (uint) set switch + { + 0 => SmallClothes, + 9903 => SmallClothesNpc, + _ => _identifier.Identify(set, weapon, variant, slot) ?? Unknown, + }; + } + private bool DrawEquipSlot(EquipSlot slot, CharacterArmor equip) { var (equipCombo, stainCombo) = _combos[slot]; var ret = DrawStainSelector(stainCombo, slot, equip.Stain); ImGui.SameLine(); - var item = _identifier.Identify(equip.Set, new WeaponType(), equip.Variant, slot); + var item = Identify(equip.Set, new WeaponType(), equip.Variant, slot); ret |= DrawItemSelector(equipCombo, item, slot); return ret; @@ -106,7 +121,7 @@ namespace Glamourer.Gui var ret = DrawStainSelector(stainCombo, slot, weapon.Stain); ImGui.SameLine(); - var item = _identifier.Identify(weapon.Set, weapon.Type, weapon.Variant, slot); + var item = Identify(weapon.Set, weapon.Type, weapon.Variant, slot); ret |= DrawItemSelector(equipCombo, item, slot); return ret; diff --git a/Glamourer/Gui/InterfaceInitialization.cs b/Glamourer/Gui/InterfaceInitialization.cs index 1e4e1d5..2e76c95 100644 --- a/Glamourer/Gui/InterfaceInitialization.cs +++ b/Glamourer/Gui/InterfaceInitialization.cs @@ -11,7 +11,9 @@ namespace Glamourer.Gui { private const float ColorButtonWidth = 22.5f; private const float ColorComboWidth = 140f; - private const float ItemComboWidth = 300f; + private const float ItemComboWidth = 350f; + + private static readonly Vector4 GreyVector = new(0.5f, 0.5f, 0.5f, 1); private static ComboWithFilter CreateDefaultStainCombo(IReadOnlyList stains) => new("##StainCombo", ColorComboWidth, ColorButtonWidth, stains, @@ -40,6 +42,15 @@ namespace Glamourer.Gui => new($"{_equipSlotNames[slot]}##Equip", ItemComboWidth, ItemComboWidth, items, i => i.Name) { Flags = ImGuiComboFlags.HeightLarge, + CreateSelectable = i => + { + var ret = ImGui.Selectable(i.Name); + var setId = $"({(int) i.MainModel.id})"; + var size = ImGui.CalcTextSize(setId).X; + ImGui.SameLine(ImGui.GetWindowContentRegionWidth() - size - ImGui.GetStyle().ItemInnerSpacing.X); + ImGui.TextColored(GreyVector, setId); + return ret; + }, }; private (ComboWithFilter, ComboWithFilter) CreateCombos(EquipSlot slot, IReadOnlyList items,