From c87885bd3ba703144f9dd34bb7f937c9f4aa6f14 Mon Sep 17 00:00:00 2001 From: Ottermandias Date: Fri, 12 Jan 2024 23:35:41 +0100 Subject: [PATCH] Store Model ID for NPCs, fix issue with applying NPC data setting extended colors. --- Glamourer/GameData/NpcCustomizeSet.cs | 2 ++ Glamourer/GameData/NpcData.cs | 6 ++++++ Glamourer/Gui/Tabs/DebugTab/NpcAppearancePanel.cs | 7 ++++++- Glamourer/Gui/Tabs/NpcTab/NpcPanel.cs | 9 ++++++--- 4 files changed, 20 insertions(+), 4 deletions(-) diff --git a/Glamourer/GameData/NpcCustomizeSet.cs b/Glamourer/GameData/NpcCustomizeSet.cs index 302f1ce..d9d8f27 100644 --- a/Glamourer/GameData/NpcCustomizeSet.cs +++ b/Glamourer/GameData/NpcCustomizeSet.cs @@ -72,6 +72,7 @@ public class NpcCustomizeSet : IAsyncDataContainer, IReadOnlyList { Name = name, Customize = customize, + ModelId = row.ModelChara.Row, Id = id, Kind = ObjectKind.EventNpc, }; @@ -132,6 +133,7 @@ public class NpcCustomizeSet : IAsyncDataContainer, IReadOnlyList var ret = new NpcData { Customize = customize, + ModelId = baseRow.ModelChara.Row, Id = baseRow.RowId, Kind = ObjectKind.BattleNpc, }; diff --git a/Glamourer/GameData/NpcData.cs b/Glamourer/GameData/NpcData.cs index 860f80a..6b5f2bd 100644 --- a/Glamourer/GameData/NpcData.cs +++ b/Glamourer/GameData/NpcData.cs @@ -24,6 +24,9 @@ public unsafe struct NpcData /// The data ID of the NPC, either event NPC or battle NPC name. public NpcId Id; + /// The Model ID of the NPC. + public uint ModelId; + /// Whether the NPCs visor is toggled. public bool VisorToggled; @@ -87,6 +90,9 @@ public unsafe struct NpcData /// Check if the appearance data, excluding ID and Name, of two NpcData is equal. public bool DataEquals(in NpcData other) { + if (ModelId != other.ModelId) + return false; + if (VisorToggled != other.VisorToggled) return false; diff --git a/Glamourer/Gui/Tabs/DebugTab/NpcAppearancePanel.cs b/Glamourer/Gui/Tabs/DebugTab/NpcAppearancePanel.cs index 1ff78cb..505ed62 100644 --- a/Glamourer/Gui/Tabs/DebugTab/NpcAppearancePanel.cs +++ b/Glamourer/Gui/Tabs/DebugTab/NpcAppearancePanel.cs @@ -33,7 +33,7 @@ public class NpcAppearancePanel(NpcCombo _npcCombo, StateManager _state, ObjectM ImGui.SetNextItemWidth(ImGui.GetContentRegionAvail().X); var resetScroll = ImGui.InputTextWithHint("##npcFilter", "Filter...", ref _npcFilter, 64); - using var table = ImRaii.Table("npcs", 6, ImGuiTableFlags.RowBg | ImGuiTableFlags.ScrollY | ImGuiTableFlags.SizingFixedFit, + using var table = ImRaii.Table("npcs", 7, ImGuiTableFlags.RowBg | ImGuiTableFlags.ScrollY | ImGuiTableFlags.SizingFixedFit, new Vector2(-1, 400 * ImGuiHelpers.GlobalScale)); if (!table) return; @@ -45,6 +45,7 @@ public class NpcAppearancePanel(NpcCombo _npcCombo, StateManager _state, ObjectM ImGui.TableSetupColumn("Name", ImGuiTableColumnFlags.WidthFixed, ImGuiHelpers.GlobalScale * 300); ImGui.TableSetupColumn("Kind", ImGuiTableColumnFlags.WidthFixed); ImGui.TableSetupColumn("Id", ImGuiTableColumnFlags.WidthFixed); + ImGui.TableSetupColumn("Model", ImGuiTableColumnFlags.WidthFixed); ImGui.TableSetupColumn("Visor", ImGuiTableColumnFlags.WidthFixed); ImGui.TableSetupColumn("Compare", ImGuiTableColumnFlags.WidthStretch); @@ -83,6 +84,10 @@ public class NpcAppearancePanel(NpcCombo _npcCombo, StateManager _state, ObjectM ImGui.AlignTextToFramePadding(); ImGui.TextUnformatted(data.Id.Id.ToString()); + ImGui.TableNextColumn(); + ImGui.AlignTextToFramePadding(); + ImGui.TextUnformatted(data.ModelId.ToString()); + using (_ = ImRaii.PushFont(UiBuilder.IconFont)) { ImGui.TableNextColumn(); diff --git a/Glamourer/Gui/Tabs/NpcTab/NpcPanel.cs b/Glamourer/Gui/Tabs/NpcTab/NpcPanel.cs index c6d5be4..2852128 100644 --- a/Glamourer/Gui/Tabs/NpcTab/NpcPanel.cs +++ b/Glamourer/Gui/Tabs/NpcTab/NpcPanel.cs @@ -141,7 +141,10 @@ public class NpcPanel( private void DrawCustomization() { - using var h = ImRaii.CollapsingHeader("Customization"); + var header = _selector.Selection.ModelId == 0 + ? "Customization" + : $"Customization (Model Id #{_selector.Selection.ModelId})###Customization"; + using var h = ImRaii.CollapsingHeader(header); if (!h) return; @@ -197,8 +200,8 @@ public class NpcPanel( if (_state.GetOrCreate(id, data.Objects[0], out var state)) { - var (applyGear, applyCustomize, applyCrest, applyParameters) = UiHelpers.ConvertKeysToFlags(); - var design = _converter.Convert(ToDesignData(), applyGear, applyCustomize, applyCrest, applyParameters); + var (applyGear, applyCustomize, _, _) = UiHelpers.ConvertKeysToFlags(); + var design = _converter.Convert(ToDesignData(), applyGear, applyCustomize, 0, 0); _state.ApplyDesign(design, state, StateChanged.Source.Manual); } }