mirror of
https://github.com/Ottermandias/Glamourer.git
synced 2025-12-13 12:14:18 +01:00
Improve bodytype stuff.
This commit is contained in:
parent
a900219ede
commit
1fa9afb9c6
7 changed files with 40 additions and 88 deletions
|
|
@ -33,26 +33,26 @@ public class DesignBase
|
|||
|
||||
internal DesignBase(CustomizeService customize, in DesignData designData, EquipFlag equipFlags, CustomizeFlag customizeFlags)
|
||||
{
|
||||
_designData = designData;
|
||||
ApplyCustomize = customizeFlags & CustomizeFlagExtensions.AllRelevant;
|
||||
ApplyEquip = equipFlags & EquipFlagExtensions.All;
|
||||
_designFlags = 0;
|
||||
CustomizeSet = SetCustomizationSet(customize);
|
||||
_designData = designData;
|
||||
ApplyCustomize = customizeFlags & CustomizeFlagExtensions.AllRelevant;
|
||||
ApplyEquip = equipFlags & EquipFlagExtensions.All;
|
||||
_designFlags = 0;
|
||||
CustomizeSet = SetCustomizationSet(customize);
|
||||
}
|
||||
|
||||
internal DesignBase(DesignBase clone)
|
||||
{
|
||||
_designData = clone._designData;
|
||||
CustomizeSet = clone.CustomizeSet;
|
||||
ApplyCustomize = clone.ApplyCustomizeRaw;
|
||||
ApplyEquip = clone.ApplyEquip & EquipFlagExtensions.All;
|
||||
_designFlags = clone._designFlags & (DesignFlags)0x0F;
|
||||
_designData = clone._designData;
|
||||
CustomizeSet = clone.CustomizeSet;
|
||||
ApplyCustomize = clone.ApplyCustomizeRaw;
|
||||
ApplyEquip = clone.ApplyEquip & EquipFlagExtensions.All;
|
||||
_designFlags = clone._designFlags & (DesignFlags)0x0F;
|
||||
}
|
||||
|
||||
/// <summary> Ensure that the customization set is updated when the design data changes. </summary>
|
||||
internal void SetDesignData(CustomizeService customize, in DesignData other)
|
||||
{
|
||||
_designData = other;
|
||||
_designData = other;
|
||||
CustomizeSet = SetCustomizationSet(customize);
|
||||
}
|
||||
|
||||
|
|
@ -68,8 +68,8 @@ public class DesignBase
|
|||
WriteProtected = 0x10,
|
||||
}
|
||||
|
||||
private CustomizeFlag _applyCustomize = CustomizeFlagExtensions.AllRelevant;
|
||||
public CustomizeSet CustomizeSet { get; private set; }
|
||||
private CustomizeFlag _applyCustomize = CustomizeFlagExtensions.AllRelevant;
|
||||
public CustomizeSet CustomizeSet { get; private set; }
|
||||
|
||||
internal CustomizeFlag ApplyCustomize
|
||||
{
|
||||
|
|
@ -90,7 +90,7 @@ public class DesignBase
|
|||
return false;
|
||||
|
||||
_designData.Customize = customize;
|
||||
CustomizeSet = customizeService.Manager.GetSet(customize.Clan, customize.Gender);
|
||||
CustomizeSet = customizeService.Manager.GetSet(customize.Clan, customize.Gender);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -485,7 +485,7 @@ public class DesignBase
|
|||
design._designData.Customize.Race = race;
|
||||
design._designData.Customize.Clan = clan;
|
||||
design._designData.Customize.Gender = gender;
|
||||
design.CustomizeSet = design.SetCustomizationSet(customizations);
|
||||
design.CustomizeSet = design.SetCustomizationSet(customizations);
|
||||
design.SetApplyCustomize(CustomizeIndex.Race, json[CustomizeIndex.Race.ToString()]?["Apply"]?.ToObject<bool>() ?? false);
|
||||
design.SetApplyCustomize(CustomizeIndex.Clan, json[CustomizeIndex.Clan.ToString()]?["Apply"]?.ToObject<bool>() ?? false);
|
||||
design.SetApplyCustomize(CustomizeIndex.Gender, json[CustomizeIndex.Gender.ToString()]?["Apply"]?.ToObject<bool>() ?? false);
|
||||
|
|
@ -495,7 +495,7 @@ public class DesignBase
|
|||
{
|
||||
var tok = json[idx.ToString()];
|
||||
var data = (CustomizeValue)(tok?["Value"]?.ToObject<byte>() ?? 0);
|
||||
if (set.IsAvailable(idx))
|
||||
if (set.IsAvailable(idx) && design._designData.Customize.BodyType == 1)
|
||||
PrintWarning(CustomizeService.ValidateCustomizeValue(set, design._designData.Customize.Face, idx, data, out data,
|
||||
allowUnknown));
|
||||
var apply = tok?["Apply"]?.ToObject<bool>() ?? false;
|
||||
|
|
|
|||
|
|
@ -297,5 +297,5 @@ public static class CustomizationSetExtensions
|
|||
{
|
||||
/// <summary> Return only the available customizations in this set and Clan or Gender. </summary>
|
||||
public static CustomizeFlag FixApplication(this CustomizeFlag flag, CustomizeSet set)
|
||||
=> flag & (set.SettingAvailable | CustomizeFlag.Clan | CustomizeFlag.Gender);
|
||||
=> flag & (set.SettingAvailable | CustomizeFlag.Clan | CustomizeFlag.Gender | CustomizeFlag.BodyType);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@ internal class CustomizeSetFactory(
|
|||
|
||||
var npcCustomizations = new HashSet<(CustomizeIndex, CustomizeValue)>();
|
||||
_npcCustomizeSet.Awaiter.Wait();
|
||||
foreach (var customize in _npcCustomizeSet.Select(s => s.Customize).Where(c => c.Clan == race && c.Gender == gender))
|
||||
foreach (var customize in _npcCustomizeSet.Select(s => s.Customize).Where(c => c.Clan == race && c.Gender == gender && c.BodyType.Value == 1))
|
||||
{
|
||||
foreach (var customizeIndex in customizeIndices)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -256,8 +256,7 @@ public class NpcCustomizeSet : IAsyncDataContainer, IReadOnlyList<NpcData>
|
|||
customize.SetByIndex(24, (CustomizeValue)bnpcCustomize.FacePaint);
|
||||
customize.SetByIndex(25, (CustomizeValue)bnpcCustomize.FacePaintColor);
|
||||
|
||||
if (customize.BodyType.Value != 1
|
||||
|| !CustomizeManager.Races.Contains(customize.Race)
|
||||
if (!CustomizeManager.Races.Contains(customize.Race)
|
||||
|| !CustomizeManager.Clans.Contains(customize.Clan)
|
||||
|| !CustomizeManager.Genders.Contains(customize.Gender))
|
||||
return (false, CustomizeArray.Default);
|
||||
|
|
@ -299,8 +298,7 @@ public class NpcCustomizeSet : IAsyncDataContainer, IReadOnlyList<NpcData>
|
|||
customize.SetByIndex(24, (CustomizeValue)enpcBase.FacePaint);
|
||||
customize.SetByIndex(25, (CustomizeValue)enpcBase.FacePaintColor);
|
||||
|
||||
if (customize.BodyType.Value != 1
|
||||
|| !CustomizeManager.Races.Contains(customize.Race)
|
||||
if (!CustomizeManager.Races.Contains(customize.Race)
|
||||
|| !CustomizeManager.Clans.Contains(customize.Clan)
|
||||
|| !CustomizeManager.Genders.Contains(customize.Gender))
|
||||
return (false, CustomizeArray.Default);
|
||||
|
|
|
|||
|
|
@ -1,20 +1,14 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Numerics;
|
||||
using Dalamud.Interface.Utility;
|
||||
using ImGuiNET;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using OtterGui;
|
||||
using OtterGui.Raii;
|
||||
using OtterGui.Services;
|
||||
using OtterGui.Widgets;
|
||||
using ImGuiClip = Dalamud.Interface.Utility.ImGuiClip;
|
||||
|
||||
namespace Glamourer.Gui.Tabs.DebugTab;
|
||||
|
||||
public unsafe class DebugTab(IServiceProvider _provider) : ITab
|
||||
public unsafe class DebugTab(ServiceManager manager) : ITab
|
||||
{
|
||||
private readonly Configuration _config = _provider.GetRequiredService<Configuration>();
|
||||
private readonly Configuration _config = manager.GetService<Configuration>();
|
||||
|
||||
public bool IsVisible
|
||||
=> _config.DebugMode;
|
||||
|
|
@ -24,11 +18,11 @@ public unsafe class DebugTab(IServiceProvider _provider) : ITab
|
|||
|
||||
private readonly DebugTabHeader[] _headers =
|
||||
[
|
||||
DebugTabHeader.CreateInterop(_provider),
|
||||
DebugTabHeader.CreateGameData(_provider),
|
||||
DebugTabHeader.CreateDesigns(_provider),
|
||||
DebugTabHeader.CreateState(_provider),
|
||||
DebugTabHeader.CreateUnlocks(_provider),
|
||||
DebugTabHeader.CreateInterop(manager.Provider!),
|
||||
DebugTabHeader.CreateGameData(manager.Provider!),
|
||||
DebugTabHeader.CreateDesigns(manager.Provider!),
|
||||
DebugTabHeader.CreateState(manager.Provider!),
|
||||
DebugTabHeader.CreateUnlocks(manager.Provider!),
|
||||
];
|
||||
|
||||
public void DrawContent()
|
||||
|
|
@ -37,55 +31,12 @@ public unsafe class DebugTab(IServiceProvider _provider) : ITab
|
|||
if (!child)
|
||||
return;
|
||||
|
||||
if (ImGui.CollapsingHeader("General"))
|
||||
{
|
||||
manager.Timers.Draw("Timers");
|
||||
}
|
||||
|
||||
foreach (var header in _headers)
|
||||
header.Draw();
|
||||
}
|
||||
|
||||
public static void DrawInputModelSet(bool withWeapon, ref int setId, ref int secondaryId, ref int variant)
|
||||
{
|
||||
ImGui.SetNextItemWidth(100 * ImGuiHelpers.GlobalScale);
|
||||
ImGui.InputInt("##SetId", ref setId, 0, 0);
|
||||
if (withWeapon)
|
||||
{
|
||||
ImGui.SameLine();
|
||||
ImGui.SetNextItemWidth(100 * ImGuiHelpers.GlobalScale);
|
||||
ImGui.InputInt("##TypeId", ref secondaryId, 0, 0);
|
||||
}
|
||||
|
||||
ImGui.SameLine();
|
||||
ImGui.SetNextItemWidth(100 * ImGuiHelpers.GlobalScale);
|
||||
ImGui.InputInt("##Variant", ref variant, 0, 0);
|
||||
}
|
||||
|
||||
public static void DrawNameTable(string label, ref string filter, IEnumerable<(uint, string)> names)
|
||||
{
|
||||
using var _ = ImRaii.PushId(label);
|
||||
using var tree = ImRaii.TreeNode(label);
|
||||
if (!tree)
|
||||
return;
|
||||
|
||||
var resetScroll = ImGui.InputTextWithHint("##filter", "Filter...", ref filter, 256);
|
||||
var height = ImGui.GetTextLineHeightWithSpacing() + 2 * ImGui.GetStyle().CellPadding.Y;
|
||||
using var table = ImRaii.Table("##table", 2, ImGuiTableFlags.RowBg | ImGuiTableFlags.ScrollY | ImGuiTableFlags.BordersOuter,
|
||||
new Vector2(-1, 10 * height));
|
||||
if (!table)
|
||||
return;
|
||||
|
||||
if (resetScroll)
|
||||
ImGui.SetScrollY(0);
|
||||
ImGui.TableSetupColumn("1", ImGuiTableColumnFlags.WidthFixed, 50 * ImGuiHelpers.GlobalScale);
|
||||
ImGui.TableSetupColumn("2", ImGuiTableColumnFlags.WidthStretch);
|
||||
ImGui.TableNextColumn();
|
||||
var skips = ImGuiClip.GetNecessarySkips(height);
|
||||
ImGui.TableNextColumn();
|
||||
var f = filter;
|
||||
var remainder = ImGuiClip.FilteredClippedDraw(names.Select(p => (p.Item1.ToString("D5"), p.Item2)), skips,
|
||||
p => p.Item1.Contains(f) || p.Item2.Contains(f, StringComparison.OrdinalIgnoreCase),
|
||||
p =>
|
||||
{
|
||||
ImGuiUtil.DrawTableColumn(p.Item1);
|
||||
ImGuiUtil.DrawTableColumn(p.Item2);
|
||||
});
|
||||
ImGuiClip.DrawEndDummy(remainder, height);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@ using System.Collections.Generic;
|
|||
using ImGuiNET;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using OtterGui.Raii;
|
||||
using OtterGui.Services;
|
||||
using Penumbra.GameData.Gui.Debug;
|
||||
|
||||
namespace Glamourer.Gui.Tabs.DebugTab;
|
||||
|
|
|
|||
|
|
@ -17,7 +17,8 @@ using ImGuiClip = OtterGui.ImGuiClip;
|
|||
|
||||
namespace Glamourer.Gui.Tabs.DebugTab;
|
||||
|
||||
public class NpcAppearancePanel(NpcCombo _npcCombo, StateManager _state, ObjectManager _objectManager, DesignConverter _designConverter) : IGameDataDrawer
|
||||
public class NpcAppearancePanel(NpcCombo _npcCombo, StateManager _state, ObjectManager _objectManager, DesignConverter _designConverter)
|
||||
: IGameDataDrawer
|
||||
{
|
||||
public string Label
|
||||
=> "NPC Appearance";
|
||||
|
|
@ -25,20 +26,23 @@ public class NpcAppearancePanel(NpcCombo _npcCombo, StateManager _state, ObjectM
|
|||
public bool Disabled
|
||||
=> false;
|
||||
|
||||
private string _npcFilter = string.Empty;
|
||||
private string _npcFilter = string.Empty;
|
||||
private bool _customizeOrGear;
|
||||
|
||||
public void Draw()
|
||||
{
|
||||
ImGui.Checkbox("Compare Customize (or Gear)", ref _customizeOrGear);
|
||||
ImGui.SetNextItemWidth(ImGui.GetContentRegionAvail().X);
|
||||
ImGui.InputTextWithHint("##npcFilter", "Filter...", ref _npcFilter, 64);
|
||||
var resetScroll = ImGui.InputTextWithHint("##npcFilter", "Filter...", ref _npcFilter, 64);
|
||||
|
||||
using var table = ImRaii.Table("npcs", 5, ImGuiTableFlags.RowBg | ImGuiTableFlags.ScrollY | ImGuiTableFlags.SizingFixedFit,
|
||||
new Vector2(-1, 400 * ImGuiHelpers.GlobalScale));
|
||||
if (!table)
|
||||
return;
|
||||
|
||||
if (resetScroll)
|
||||
ImGui.SetScrollY(0);
|
||||
|
||||
ImGui.TableSetupColumn("Button", ImGuiTableColumnFlags.WidthFixed);
|
||||
ImGui.TableSetupColumn("Name", ImGuiTableColumnFlags.WidthFixed, ImGuiHelpers.GlobalScale * 300);
|
||||
ImGui.TableSetupColumn("Kind", ImGuiTableColumnFlags.WidthFixed);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue