Move more DebugUi to GameData.

This commit is contained in:
Ottermandias 2023-12-24 12:36:11 +01:00
parent ab76d3508b
commit 4531cdadbe
33 changed files with 76 additions and 399 deletions

View file

@ -30,7 +30,7 @@ public class CustomizeManager : IAsyncService
/// <summary> Every tribe and gender has a separate set of available customizations. </summary> /// <summary> Every tribe and gender has a separate set of available customizations. </summary>
public CustomizeSet GetSet(SubRace race, Gender gender) public CustomizeSet GetSet(SubRace race, Gender gender)
{ {
if (!Awaiter.IsCompletedSuccessfully) if (!Finished)
Awaiter.Wait(); Awaiter.Wait();
return _customizationSets[ToIndex(race, gender)]; return _customizationSets[ToIndex(race, gender)];
} }
@ -61,6 +61,10 @@ public class CustomizeManager : IAsyncService
/// <inheritdoc/> /// <inheritdoc/>
public Task Awaiter { get; } public Task Awaiter { get; }
/// <inheritdoc/>
public bool Finished
=> Awaiter.IsCompletedSuccessfully;
private readonly IconStorage _icons; private readonly IconStorage _icons;
private static readonly int ListSize = Clans.Count * Genders.Count; private static readonly int ListSize = Clans.Count * Genders.Count;
private readonly CustomizeSet[] _customizationSets = new CustomizeSet[ListSize]; private readonly CustomizeSet[] _customizationSets = new CustomizeSet[ListSize];

View file

@ -33,6 +33,10 @@ public class NpcCustomizeSet : IAsyncDataContainer, IReadOnlyList<NpcData>
/// <inheritdoc/> /// <inheritdoc/>
public Task Awaiter { get; } public Task Awaiter { get; }
/// <inheritdoc/>
public bool Finished
=> Awaiter.IsCompletedSuccessfully;
/// <summary> The list of data. </summary> /// <summary> The list of data. </summary>
private readonly List<NpcData> _data = []; private readonly List<NpcData> _data = [];

View file

@ -24,7 +24,7 @@ public class EquipmentDrawer
private readonly ItemManager _items; private readonly ItemManager _items;
private readonly GlamourerColorCombo _stainCombo; private readonly GlamourerColorCombo _stainCombo;
private readonly DictStains _stainData; private readonly DictStain _stainData;
private readonly ItemCombo[] _itemCombo; private readonly ItemCombo[] _itemCombo;
private readonly Dictionary<FullEquipType, WeaponCombo> _weaponCombo; private readonly Dictionary<FullEquipType, WeaponCombo> _weaponCombo;
private readonly CodeService _codes; private readonly CodeService _codes;

View file

@ -13,7 +13,7 @@ using Penumbra.GameData.Structs;
namespace Glamourer.Gui.Equipment; namespace Glamourer.Gui.Equipment;
public sealed class GlamourerColorCombo(float _comboWidth, DictStains _stains, FavoriteManager _favorites) public sealed class GlamourerColorCombo(float _comboWidth, DictStain _stains, FavoriteManager _favorites)
: FilterComboColors(_comboWidth, CreateFunc(_stains, _favorites), Glamourer.Log) : FilterComboColors(_comboWidth, CreateFunc(_stains, _favorites), Glamourer.Log)
{ {
protected override bool DrawSelectable(int globalIdx, bool selected) protected override bool DrawSelectable(int globalIdx, bool selected)
@ -40,7 +40,7 @@ public sealed class GlamourerColorCombo(float _comboWidth, DictStains _stains, F
return base.DrawSelectable(globalIdx, selected); return base.DrawSelectable(globalIdx, selected);
} }
private static Func<IReadOnlyList<KeyValuePair<byte, (string Name, uint Color, bool Gloss)>>> CreateFunc(DictStains stains, private static Func<IReadOnlyList<KeyValuePair<byte, (string Name, uint Color, bool Gloss)>>> CreateFunc(DictStain stains,
FavoriteManager favorites) FavoriteManager favorites)
=> () => stains.Select(kvp => (kvp, favorites.Contains(kvp.Key))).OrderBy(p => !p.Item2).Select(p => p.kvp) => () => stains.Select(kvp => (kvp, favorites.Contains(kvp.Key))).OrderBy(p => !p.Item2).Select(p => p.kvp)
.Prepend(new KeyValuePair<StainId, Stain>(Stain.None.RowIndex, Stain.None)).Select(kvp .Prepend(new KeyValuePair<StainId, Stain>(Stain.None.RowIndex, Stain.None)).Select(kvp

View file

@ -12,10 +12,11 @@ using ImGuiNET;
using OtterGui; using OtterGui;
using OtterGui.Raii; using OtterGui.Raii;
using Penumbra.GameData.Enums; using Penumbra.GameData.Enums;
using Penumbra.GameData.Gui.Debug;
namespace Glamourer.Gui.Tabs.DebugTab; namespace Glamourer.Gui.Tabs.DebugTab;
public class ActiveStatePanel(StateManager _stateManager, ObjectManager _objectManager) : IDebugTabTree public class ActiveStatePanel(StateManager _stateManager, ObjectManager _objectManager) : IGameDataDrawer
{ {
public string Label public string Label
=> $"Active Actors ({_stateManager.Count})###Active Actors"; => $"Active Actors ({_stateManager.Count})###Active Actors";

View file

@ -1,73 +0,0 @@
using System;
using System.Linq;
using System.Numerics;
using Dalamud.Interface.Utility;
using ImGuiNET;
using OtterGui;
using OtterGui.Raii;
using Penumbra.GameData.Actors;
using Penumbra.GameData.DataContainers;
using ImGuiClip = OtterGui.ImGuiClip;
namespace Glamourer.Gui.Tabs.DebugTab;
public class ActorManagerPanel(ActorManager _actors, DictBNpcNames _bNpcNames) : IDebugTabTree
{
public string Label
=> "Actor Service";
public bool Disabled
=> !_actors.Awaiter.IsCompletedSuccessfully;
private string _bnpcFilter = string.Empty;
private string _enpcFilter = string.Empty;
private string _companionFilter = string.Empty;
private string _mountFilter = string.Empty;
private string _ornamentFilter = string.Empty;
private string _worldFilter = string.Empty;
public void Draw()
{
DrawBnpcTable();
DebugTab.DrawNameTable("ENPCs", ref _enpcFilter, _actors.Data.ENpcs.Select(kvp => (kvp.Key.Id, kvp.Value)));
DebugTab.DrawNameTable("Companions", ref _companionFilter, _actors.Data.Companions.Select(kvp => (kvp.Key.Id, kvp.Value)));
DebugTab.DrawNameTable("Mounts", ref _mountFilter, _actors.Data.Mounts.Select(kvp => (kvp.Key.Id, kvp.Value)));
DebugTab.DrawNameTable("Ornaments", ref _ornamentFilter, _actors.Data.Ornaments.Select(kvp => (kvp.Key.Id, kvp.Value)));
DebugTab.DrawNameTable("Worlds", ref _worldFilter, _actors.Data.Worlds.Select(kvp => ((uint)kvp.Key.Id, kvp.Value)));
}
private void DrawBnpcTable()
{
using var _ = ImRaii.PushId(1);
using var tree = ImRaii.TreeNode("BNPCs");
if (!tree)
return;
var resetScroll = ImGui.InputTextWithHint("##filter", "Filter...", ref _bnpcFilter, 256);
var height = ImGui.GetTextLineHeightWithSpacing() + 2 * ImGui.GetStyle().CellPadding.Y;
using var table = ImRaii.Table("##table", 3, 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.TableSetupColumn("3", ImGuiTableColumnFlags.WidthStretch);
ImGui.TableNextColumn();
var skips = ImGuiClip.GetNecessarySkips(height);
ImGui.TableNextRow();
var data = _actors.Data.BNpcs.Select(kvp => (kvp.Key, kvp.Key.Id.ToString("D5"), kvp.Value));
var remainder = ImGuiClip.FilteredClippedDraw(data, skips,
p => p.Item2.Contains(_bnpcFilter) || p.Value.Contains(_bnpcFilter, StringComparison.OrdinalIgnoreCase),
p =>
{
ImGuiUtil.DrawTableColumn(p.Item2);
ImGuiUtil.DrawTableColumn(p.Value);
var bNpcs = _bNpcNames.GetBNpcsFromName(p.Key.BNpcNameId);
ImGuiUtil.DrawTableColumn(string.Join(", ", bNpcs.Select(b => b.Id.ToString())));
});
ImGuiClip.DrawEndDummy(remainder, height);
}
}

View file

@ -2,10 +2,11 @@
using ImGuiNET; using ImGuiNET;
using OtterGui; using OtterGui;
using OtterGui.Raii; using OtterGui.Raii;
using Penumbra.GameData.Gui.Debug;
namespace Glamourer.Gui.Tabs.DebugTab; namespace Glamourer.Gui.Tabs.DebugTab;
public class AutoDesignPanel(AutoDesignManager _autoDesignManager) : IDebugTabTree public class AutoDesignPanel(AutoDesignManager _autoDesignManager) : IGameDataDrawer
{ {
public string Label public string Label
=> "Auto Designs"; => "Auto Designs";

View file

@ -5,16 +5,17 @@ using ImGuiNET;
using OtterGui; using OtterGui;
using OtterGui.Raii; using OtterGui.Raii;
using Penumbra.GameData.Enums; using Penumbra.GameData.Enums;
using Penumbra.GameData.Gui.Debug;
namespace Glamourer.Gui.Tabs.DebugTab; namespace Glamourer.Gui.Tabs.DebugTab;
public class CustomizationServicePanel(CustomizeService customize) : IDebugTabTree public class CustomizationServicePanel(CustomizeService customize) : IGameDataDrawer
{ {
public string Label public string Label
=> "Customization Service"; => "Customization Service";
public bool Disabled public bool Disabled
=> !customize.Awaiter.IsCompletedSuccessfully; => !customize.Finished;
public void Draw() public void Draw()
{ {

View file

@ -5,10 +5,11 @@ using ImGuiNET;
using OtterGui; using OtterGui;
using OtterGui.Raii; using OtterGui.Raii;
using Penumbra.GameData.Enums; using Penumbra.GameData.Enums;
using Penumbra.GameData.Gui.Debug;
namespace Glamourer.Gui.Tabs.DebugTab; namespace Glamourer.Gui.Tabs.DebugTab;
public class CustomizationUnlockPanel(CustomizeUnlockManager _customizeUnlocks) : IDebugTabTree public class CustomizationUnlockPanel(CustomizeUnlockManager _customizeUnlocks) : IGameDataDrawer
{ {
public string Label public string Label
=> "Customizations"; => "Customizations";

View file

@ -4,10 +4,11 @@ using Glamourer.Interop;
using ImGuiNET; using ImGuiNET;
using OtterGui; using OtterGui;
using Penumbra.GameData.Files; using Penumbra.GameData.Files;
using Penumbra.GameData.Gui.Debug;
namespace Glamourer.Gui.Tabs.DebugTab; namespace Glamourer.Gui.Tabs.DebugTab;
public class DatFilePanel(ImportService _importService) : IDebugTabTree public class DatFilePanel(ImportService _importService) : IGameDataDrawer
{ {
public string Label public string Label
=> "Character Dat File"; => "Character Dat File";

View file

@ -4,21 +4,14 @@ using ImGuiNET;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using OtterGui.Raii; using OtterGui.Raii;
using OtterGui.Services; using OtterGui.Services;
using Penumbra.GameData.Gui.Debug;
namespace Glamourer.Gui.Tabs.DebugTab; namespace Glamourer.Gui.Tabs.DebugTab;
public interface IDebugTabTree : IService public class DebugTabHeader(string label, params IGameDataDrawer[] subTrees)
{ {
public string Label { get; } public string Label { get; } = label;
public void Draw(); public IReadOnlyList<IGameDataDrawer> SubTrees { get; } = subTrees;
public bool Disabled { get; }
}
public class DebugTabHeader(string label, params IDebugTabTree[] subTrees)
{
public string Label { get; } = label;
public IReadOnlyList<IDebugTabTree> SubTrees { get; } = subTrees;
public void Draw() public void Draw()
{ {
@ -27,14 +20,13 @@ public class DebugTabHeader(string label, params IDebugTabTree[] subTrees)
foreach (var subTree in SubTrees) foreach (var subTree in SubTrees)
{ {
using (var disabled = ImRaii.Disabled(subTree.Disabled)) using var disabled = ImRaii.Disabled(subTree.Disabled);
using var tree = ImRaii.TreeNode(subTree.Label);
if (tree)
{ {
using var tree = ImRaii.TreeNode(subTree.Label); disabled.Dispose();
if (!tree) subTree.Draw();
continue;
} }
subTree.Draw();
} }
} }
@ -53,13 +45,14 @@ public class DebugTabHeader(string label, params IDebugTabTree[] subTrees)
=> new => new
( (
"Game Data", "Game Data",
provider.GetRequiredService<IdentifierPanel>(), provider.GetRequiredService<IdentificationDrawer>(),
provider.GetRequiredService<RestrictedGearPanel>(), provider.GetRequiredService<RestrictedGearDrawer>(),
provider.GetRequiredService<ActorManagerPanel>(), provider.GetRequiredService<ActorDataDrawer>(),
provider.GetRequiredService<ItemManagerPanel>(), provider.GetRequiredService<ItemDataDrawer>(),
provider.GetRequiredService<StainPanel>(), provider.GetRequiredService<DictStainDrawer>(),
provider.GetRequiredService<CustomizationServicePanel>(), provider.GetRequiredService<CustomizationServicePanel>(),
provider.GetRequiredService<JobPanel>(), provider.GetRequiredService<DictJobDrawer>(),
provider.GetRequiredService<DictJobGroupDrawer>(),
provider.GetRequiredService<NpcAppearancePanel>() provider.GetRequiredService<NpcAppearancePanel>()
); );

View file

@ -8,10 +8,11 @@ using ImGuiNET;
using Newtonsoft.Json.Linq; using Newtonsoft.Json.Linq;
using OtterGui; using OtterGui;
using OtterGui.Raii; using OtterGui.Raii;
using Penumbra.GameData.Gui.Debug;
namespace Glamourer.Gui.Tabs.DebugTab; namespace Glamourer.Gui.Tabs.DebugTab;
public class DesignConverterPanel(DesignConverter _designConverter) : IDebugTabTree public class DesignConverterPanel(DesignConverter _designConverter) : IGameDataDrawer
{ {
public string Label public string Label
=> "Design Converter"; => "Design Converter";

View file

@ -6,10 +6,11 @@ using ImGuiNET;
using OtterGui; using OtterGui;
using OtterGui.Raii; using OtterGui.Raii;
using Penumbra.GameData.Enums; using Penumbra.GameData.Enums;
using Penumbra.GameData.Gui.Debug;
namespace Glamourer.Gui.Tabs.DebugTab; namespace Glamourer.Gui.Tabs.DebugTab;
public class DesignManagerPanel(DesignManager _designManager, DesignFileSystem _designFileSystem) : IDebugTabTree public class DesignManagerPanel(DesignManager _designManager, DesignFileSystem _designFileSystem) : IGameDataDrawer
{ {
public string Label public string Label
=> $"Design Manager ({_designManager.Designs.Count} Designs)###Design Manager"; => $"Design Manager ({_designManager.Designs.Count} Designs)###Design Manager";

View file

@ -8,10 +8,11 @@ using OtterGui;
using OtterGui.Raii; using OtterGui.Raii;
using Penumbra.GameData.DataContainers; using Penumbra.GameData.DataContainers;
using Penumbra.GameData.Enums; using Penumbra.GameData.Enums;
using Penumbra.GameData.Gui.Debug;
namespace Glamourer.Gui.Tabs.DebugTab; namespace Glamourer.Gui.Tabs.DebugTab;
public class DesignTesterPanel(ItemManager _items, HumanModelList _humans) : IDebugTabTree public class DesignTesterPanel(ItemManager _items, HumanModelList _humans) : IGameDataDrawer
{ {
public string Label public string Label
=> "Base64 Design Tester"; => "Base64 Design Tester";

View file

@ -1,9 +1,10 @@
using Glamourer.State; using Glamourer.State;
using ImGuiNET; using ImGuiNET;
using Penumbra.GameData.Gui.Debug;
namespace Glamourer.Gui.Tabs.DebugTab; namespace Glamourer.Gui.Tabs.DebugTab;
public class FunPanel(FunModule _funModule, Configuration _config) : IDebugTabTree public class FunPanel(FunModule _funModule, Configuration _config) : IGameDataDrawer
{ {
public string Label public string Label
=> "Fun Module"; => "Fun Module";

View file

@ -1,62 +0,0 @@
using System.Linq;
using Dalamud.Interface.Utility;
using Glamourer.Services;
using ImGuiNET;
using OtterGui;
using Penumbra.GameData.Data;
using Penumbra.GameData.Enums;
using Penumbra.GameData.Structs;
namespace Glamourer.Gui.Tabs.DebugTab;
public class IdentifierPanel(ItemManager _items, GamePathParser _gamePathParser) : IDebugTabTree
{
public string Label
=> "Identifier Service";
public bool Disabled
=> !_items.ObjectIdentification.Awaiter.IsCompletedSuccessfully;
private string _gamePath = string.Empty;
private int _setId;
private int _secondaryId;
private int _variant;
public void Draw()
{
static void Text(string text)
{
if (text.Length > 0)
ImGui.TextUnformatted(text);
}
ImGui.TextUnformatted("Parse Game Path");
ImGui.SameLine();
ImGui.SetNextItemWidth(300 * ImGuiHelpers.GlobalScale);
ImGui.InputTextWithHint("##gamePath", "Enter game path...", ref _gamePath, 256);
var fileInfo = _gamePathParser.GetFileInfo(_gamePath);
ImGui.TextUnformatted(
$"{fileInfo.ObjectType} {fileInfo.EquipSlot} {fileInfo.PrimaryId} {fileInfo.SecondaryId} {fileInfo.Variant} {fileInfo.BodySlot} {fileInfo.CustomizationType}");
Text(string.Join("\n", _items.ObjectIdentification.Identify(_gamePath).Keys));
ImGui.Separator();
ImGui.AlignTextToFramePadding();
ImGui.TextUnformatted("Identify Model");
ImGui.SameLine();
DebugTab.DrawInputModelSet(true, ref _setId, ref _secondaryId, ref _variant);
foreach (var slot in EquipSlotExtensions.EqdpSlots)
{
var identified = _items.Identify(slot, (PrimaryId)_setId, 0, (Variant)_variant);
Text(identified.Name);
ImGuiUtil.HoverTooltip(string.Join("\n",
_items.ObjectIdentification.Identify((PrimaryId)_setId, 0, (Variant)_variant, slot)
.Select(i => $"{i.Name} {i.Id} {i.ItemId} {i.IconId}")));
}
var weapon = _items.Identify(EquipSlot.MainHand, (PrimaryId)_setId, (SecondaryId)_secondaryId, (Variant)_variant);
Text(weapon.Name);
ImGuiUtil.HoverTooltip(string.Join("\n",
_items.ObjectIdentification.Identify((PrimaryId)_setId, (SecondaryId)_secondaryId, (Variant)_variant, EquipSlot.MainHand)));
}
}

View file

@ -2,10 +2,11 @@
using ImGuiNET; using ImGuiNET;
using OtterGui; using OtterGui;
using OtterGui.Raii; using OtterGui.Raii;
using Penumbra.GameData.Gui.Debug;
namespace Glamourer.Gui.Tabs.DebugTab; namespace Glamourer.Gui.Tabs.DebugTab;
public unsafe class InventoryPanel : IDebugTabTree public unsafe class InventoryPanel : IGameDataDrawer
{ {
public string Label public string Label
=> "Inventory"; => "Inventory";

View file

@ -8,11 +8,12 @@ using OtterGui;
using OtterGui.Raii; using OtterGui.Raii;
using Penumbra.GameData.Enums; using Penumbra.GameData.Enums;
using Penumbra.GameData.Gui; using Penumbra.GameData.Gui;
using Penumbra.GameData.Gui.Debug;
using Penumbra.GameData.Structs; using Penumbra.GameData.Structs;
namespace Glamourer.Gui.Tabs.DebugTab; namespace Glamourer.Gui.Tabs.DebugTab;
public class IpcTesterPanel(DalamudPluginInterface _pluginInterface, ObjectManager _objectManager) : IDebugTabTree public class IpcTesterPanel(DalamudPluginInterface _pluginInterface, ObjectManager _objectManager) : IGameDataDrawer
{ {
public string Label public string Label
=> "IPC Tester"; => "IPC Tester";
@ -137,12 +138,12 @@ public class IpcTesterPanel(DalamudPluginInterface _pluginInterface, ObjectManag
} }
} }
private unsafe void DrawItemIdInput() private void DrawItemIdInput()
{ {
var tmp = _customItemId.Id; var tmp = _customItemId.Id;
if (ImGui.InputScalar("Custom Item ID", ImGuiDataType.U64, (nint)(&tmp), nint.Zero, nint.Zero)) if (ImGuiUtil.InputUlong("Custom Item ID", ref tmp))
_customItemId = (CustomItemId)tmp; _customItemId = (CustomItemId)tmp;
ImGui.SameLine(); ImGui.SameLine();
EquipSlotCombo.Draw("Equip Slot", string.Empty, 200 * ImGuiHelpers.GlobalScale, ref _slot); EquipSlotCombo.Draw("Equip Slot", string.Empty, ref _slot);
} }
} }

View file

@ -1,39 +0,0 @@
using System;
using System.Linq;
using Glamourer.Services;
using ImGuiNET;
using OtterGui.Raii;
using Penumbra.GameData.Enums;
namespace Glamourer.Gui.Tabs.DebugTab;
public class ItemManagerPanel(ItemManager _items) : IDebugTabTree
{
public string Label
=> "Item Manager";
public bool Disabled
=> !_items.ItemData.Awaiter.IsCompletedSuccessfully;
private string _itemFilter = string.Empty;
public void Draw()
{
ImRaii.TreeNode($"Default Sword: {_items.DefaultSword.Name} ({_items.DefaultSword.ItemId}) ({_items.DefaultSword.Weapon()})",
ImGuiTreeNodeFlags.Leaf).Dispose();
DebugTab.DrawNameTable("All Items (Main)", ref _itemFilter,
_items.ItemData.AllItems(true).Select(p => (p.Item1.Id,
$"{p.Item2.Name} ({(p.Item2.SecondaryId == 0 ? p.Item2.Armor().ToString() : p.Item2.Weapon().ToString())})"))
.OrderBy(p => p.Item1));
DebugTab.DrawNameTable("All Items (Off)", ref _itemFilter,
_items.ItemData.AllItems(false).Select(p => (p.Item1.Id,
$"{p.Item2.Name} ({(p.Item2.SecondaryId == 0 ? p.Item2.Armor().ToString() : p.Item2.Weapon().ToString())})"))
.OrderBy(p => p.Item1));
foreach (var type in Enum.GetValues<FullEquipType>().Skip(1))
{
DebugTab.DrawNameTable(type.ToName(), ref _itemFilter,
_items.ItemData.ByType[type]
.Select(p => (p.ItemId.Id, $"{p.Name} ({(p.SecondaryId.Id == 0 ? p.Armor().ToString() : p.Weapon().ToString())})")));
}
}
}

View file

@ -7,11 +7,12 @@ using ImGuiNET;
using OtterGui; using OtterGui;
using OtterGui.Raii; using OtterGui.Raii;
using Penumbra.GameData.Enums; using Penumbra.GameData.Enums;
using Penumbra.GameData.Gui.Debug;
using ImGuiClip = OtterGui.ImGuiClip; using ImGuiClip = OtterGui.ImGuiClip;
namespace Glamourer.Gui.Tabs.DebugTab; namespace Glamourer.Gui.Tabs.DebugTab;
public class ItemUnlockPanel(ItemUnlockManager _itemUnlocks, ItemManager _items) : IDebugTabTree public class ItemUnlockPanel(ItemUnlockManager _itemUnlocks, ItemManager _items) : IGameDataDrawer
{ {
public string Label public string Label
=> "Unlocked Items"; => "Unlocked Items";

View file

@ -1,76 +0,0 @@
using Glamourer.Interop;
using ImGuiNET;
using OtterGui;
using OtterGui.Raii;
namespace Glamourer.Gui.Tabs.DebugTab;
public class JobPanel(JobService _jobs) : IDebugTabTree
{
public string Label
=> "Job Service";
public bool Disabled
=> false;
public void Draw()
{
DrawJobs();
DrawJobGroups();
DrawValidJobGroups();
}
private void DrawJobs()
{
using var t = ImRaii.TreeNode("Jobs");
if (!t)
return;
using var table = ImRaii.Table("##jobs", 3, ImGuiTableFlags.SizingFixedFit | ImGuiTableFlags.RowBg);
if (!table)
return;
foreach (var (id, job) in _jobs.Jobs)
{
ImGuiUtil.DrawTableColumn(id.Id.ToString("D3"));
ImGuiUtil.DrawTableColumn(job.Name);
ImGuiUtil.DrawTableColumn(job.Abbreviation);
}
}
private void DrawJobGroups()
{
using var t = ImRaii.TreeNode("All Job Groups");
if (!t)
return;
using var table = ImRaii.Table("##groups", 3, ImGuiTableFlags.SizingFixedFit | ImGuiTableFlags.RowBg);
if (!table)
return;
foreach (var (group, idx) in _jobs.AllJobGroups.WithIndex())
{
ImGuiUtil.DrawTableColumn(idx.ToString("D3"));
ImGuiUtil.DrawTableColumn(group.Name);
ImGuiUtil.DrawTableColumn(group.Count.ToString());
}
}
private void DrawValidJobGroups()
{
using var t = ImRaii.TreeNode("Valid Job Groups");
if (!t)
return;
using var table = ImRaii.Table("##groups", 3, ImGuiTableFlags.SizingFixedFit | ImGuiTableFlags.RowBg);
if (!table)
return;
foreach (var (id, group) in _jobs.JobGroups)
{
ImGuiUtil.DrawTableColumn(id.Id.ToString("D3"));
ImGuiUtil.DrawTableColumn(group.Name);
ImGuiUtil.DrawTableColumn(group.Count.ToString());
}
}
}

View file

@ -7,6 +7,7 @@ using ImGuiNET;
using OtterGui; using OtterGui;
using OtterGui.Raii; using OtterGui.Raii;
using Penumbra.GameData.Enums; using Penumbra.GameData.Enums;
using Penumbra.GameData.Gui.Debug;
using Penumbra.GameData.Structs; using Penumbra.GameData.Structs;
namespace Glamourer.Gui.Tabs.DebugTab; namespace Glamourer.Gui.Tabs.DebugTab;
@ -16,7 +17,7 @@ public unsafe class ModelEvaluationPanel(
VisorService _visorService, VisorService _visorService,
UpdateSlotService _updateSlotService, UpdateSlotService _updateSlotService,
ChangeCustomizeService _changeCustomizeService, ChangeCustomizeService _changeCustomizeService,
CrestService _crestService) : IDebugTabTree CrestService _crestService) : IGameDataDrawer
{ {
public string Label public string Label
=> "Model Evaluation"; => "Model Evaluation";

View file

@ -12,11 +12,12 @@ using ImGuiNET;
using OtterGui; using OtterGui;
using OtterGui.Raii; using OtterGui.Raii;
using Penumbra.GameData.Enums; using Penumbra.GameData.Enums;
using Penumbra.GameData.Gui.Debug;
using ImGuiClip = OtterGui.ImGuiClip; using ImGuiClip = OtterGui.ImGuiClip;
namespace Glamourer.Gui.Tabs.DebugTab; namespace Glamourer.Gui.Tabs.DebugTab;
public class NpcAppearancePanel(NpcCombo _npcCombo, StateManager _state, ObjectManager _objectManager, DesignConverter _designConverter) : IDebugTabTree public class NpcAppearancePanel(NpcCombo _npcCombo, StateManager _state, ObjectManager _objectManager, DesignConverter _designConverter) : IGameDataDrawer
{ {
public string Label public string Label
=> "NPC Appearance"; => "NPC Appearance";

View file

@ -7,10 +7,11 @@ using ImGuiNET;
using OtterGui; using OtterGui;
using OtterGui.Raii; using OtterGui.Raii;
using Penumbra.GameData.Actors; using Penumbra.GameData.Actors;
using Penumbra.GameData.Gui.Debug;
namespace Glamourer.Gui.Tabs.DebugTab; namespace Glamourer.Gui.Tabs.DebugTab;
public class ObjectManagerPanel(ObjectManager _objectManager, ActorManager _actors) : IDebugTabTree public class ObjectManagerPanel(ObjectManager _objectManager, ActorManager _actors) : IGameDataDrawer
{ {
public string Label public string Label
=> "Object Manager"; => "Object Manager";
@ -33,7 +34,7 @@ public class ObjectManagerPanel(ObjectManager _objectManager, ActorManager _acto
ImGui.TableNextColumn(); ImGui.TableNextColumn();
ImGuiUtil.DrawTableColumn("World"); ImGuiUtil.DrawTableColumn("World");
ImGuiUtil.DrawTableColumn(_actors.Awaiter.IsCompletedSuccessfully ? _actors.Data.ToWorldName(_objectManager.World) : "Service Missing"); ImGuiUtil.DrawTableColumn(_actors.Finished ? _actors.Data.ToWorldName(_objectManager.World) : "Service Missing");
ImGuiUtil.DrawTableColumn(_objectManager.World.ToString()); ImGuiUtil.DrawTableColumn(_objectManager.World.ToString());
ImGuiUtil.DrawTableColumn("Player Character"); ImGuiUtil.DrawTableColumn("Player Character");

View file

@ -10,11 +10,12 @@ using OtterGui;
using OtterGui.Raii; using OtterGui.Raii;
using Penumbra.Api.Enums; using Penumbra.Api.Enums;
using Penumbra.GameData.Enums; using Penumbra.GameData.Enums;
using Penumbra.GameData.Gui.Debug;
using Penumbra.GameData.Structs; using Penumbra.GameData.Structs;
namespace Glamourer.Gui.Tabs.DebugTab; namespace Glamourer.Gui.Tabs.DebugTab;
public unsafe class PenumbraPanel(PenumbraService _penumbra, PenumbraChangedItemTooltip _penumbraTooltip) : IDebugTabTree public unsafe class PenumbraPanel(PenumbraService _penumbra, PenumbraChangedItemTooltip _penumbraTooltip) : IGameDataDrawer
{ {
public string Label public string Label
=> "Penumbra Interop"; => "Penumbra Interop";

View file

@ -1,42 +0,0 @@
using System;
using System.Linq;
using Glamourer.Services;
using ImGuiNET;
using Penumbra.GameData.Enums;
using Penumbra.GameData.Structs;
namespace Glamourer.Gui.Tabs.DebugTab;
public class RestrictedGearPanel(ItemManager _items) : IDebugTabTree
{
public string Label
=> "Restricted Gear Service";
public bool Disabled
=> false;
private int _setId;
private int _secondaryId;
private int _variant;
public void Draw()
{
ImGui.AlignTextToFramePadding();
ImGui.TextUnformatted("Resolve Model");
DebugTab.DrawInputModelSet(false, ref _setId, ref _secondaryId, ref _variant);
foreach (var race in Enum.GetValues<Race>().Skip(1))
{
ReadOnlySpan<Gender> genders = [Gender.Male, Gender.Female];
foreach (var gender in genders)
{
foreach (var slot in EquipSlotExtensions.EqdpSlots)
{
var (replaced, model) =
_items.RestrictedGear.ResolveRestricted(new CharacterArmor((PrimaryId)_setId, (Variant)_variant, 0), slot, race, gender);
if (replaced)
ImGui.TextUnformatted($"{race.ToName()} - {gender} - {slot.ToName()} resolves to {model}.");
}
}
}
}
}

View file

@ -3,10 +3,11 @@ using Glamourer.Interop;
using Glamourer.Interop.Structs; using Glamourer.Interop.Structs;
using Glamourer.State; using Glamourer.State;
using OtterGui.Raii; using OtterGui.Raii;
using Penumbra.GameData.Gui.Debug;
namespace Glamourer.Gui.Tabs.DebugTab; namespace Glamourer.Gui.Tabs.DebugTab;
public class RetainedStatePanel(StateManager _stateManager, ObjectManager _objectManager) : IDebugTabTree public class RetainedStatePanel(StateManager _stateManager, ObjectManager _objectManager) : IGameDataDrawer
{ {
public string Label public string Label
=> "Retained States (Inactive Actors)"; => "Retained States (Inactive Actors)";

View file

@ -1,53 +0,0 @@
using System;
using System.Numerics;
using Dalamud.Interface.Utility;
using Glamourer.Services;
using ImGuiNET;
using OtterGui;
using OtterGui.Raii;
using ImGuiClip = OtterGui.ImGuiClip;
namespace Glamourer.Gui.Tabs.DebugTab;
public class StainPanel(ItemManager _items) : IDebugTabTree
{
public string Label
=> "Stain Service";
public bool Disabled
=> false;
private string _stainFilter = string.Empty;
public void Draw()
{
var resetScroll = ImGui.InputTextWithHint("##filter", "Filter...", ref _stainFilter, 256);
var height = ImGui.GetTextLineHeightWithSpacing() + 2 * ImGui.GetStyle().CellPadding.Y;
using var table = ImRaii.Table("##table", 4,
ImGuiTableFlags.RowBg | ImGuiTableFlags.ScrollY | ImGuiTableFlags.BordersOuter | ImGuiTableFlags.SizingFixedFit,
new Vector2(-1, 10 * height));
if (!table)
return;
if (resetScroll)
ImGui.SetScrollY(0);
ImGui.TableNextColumn();
var skips = ImGuiClip.GetNecessarySkips(height);
ImGui.TableNextRow();
var remainder = ImGuiClip.FilteredClippedDraw(_items.Stains, skips,
p => p.Key.Id.ToString().Contains(_stainFilter) || p.Value.Name.Contains(_stainFilter, StringComparison.OrdinalIgnoreCase),
p =>
{
ImGuiUtil.DrawTableColumn(p.Key.Id.ToString("D3"));
ImGui.TableNextColumn();
ImGui.GetWindowDrawList().AddRectFilled(ImGui.GetCursorScreenPos(),
ImGui.GetCursorScreenPos() + new Vector2(ImGui.GetTextLineHeight()),
p.Value.RgbaColor, 5 * ImGuiHelpers.GlobalScale);
ImGui.Dummy(new Vector2(ImGui.GetTextLineHeight()));
ImGuiUtil.DrawTableColumn(p.Value.Name);
ImGuiUtil.DrawTableColumn($"#{p.Value.R:X2}{p.Value.G:X2}{p.Value.B:X2}{(p.Value.Gloss ? ", Glossy" : string.Empty)}");
});
ImGuiClip.DrawEndDummy(remainder, height);
}
}

View file

@ -7,11 +7,12 @@ using ImGuiNET;
using OtterGui; using OtterGui;
using OtterGui.Raii; using OtterGui.Raii;
using Penumbra.GameData.Enums; using Penumbra.GameData.Enums;
using Penumbra.GameData.Gui.Debug;
using ImGuiClip = OtterGui.ImGuiClip; using ImGuiClip = OtterGui.ImGuiClip;
namespace Glamourer.Gui.Tabs.DebugTab; namespace Glamourer.Gui.Tabs.DebugTab;
public class UnlockableItemsPanel(ItemUnlockManager _itemUnlocks, ItemManager _items) : IDebugTabTree public class UnlockableItemsPanel(ItemUnlockManager _itemUnlocks, ItemManager _items) : IGameDataDrawer
{ {
public string Label public string Label
=> "Unlockable Items"; => "Unlockable Items";

View file

@ -22,6 +22,9 @@ public sealed class CustomizeService(
public Task Awaiter { get; } public Task Awaiter { get; }
= Task.WhenAll(humanModels.Awaiter, manager.Awaiter, npcCustomizeSet.Awaiter); = Task.WhenAll(humanModels.Awaiter, manager.Awaiter, npcCustomizeSet.Awaiter);
public bool Finished
=> Awaiter.IsCompletedSuccessfully;
public (CustomizeArray NewValue, CustomizeFlag Applied, CustomizeFlag Changed) Combine(CustomizeArray oldValues, CustomizeArray newValues, public (CustomizeArray NewValue, CustomizeFlag Applied, CustomizeFlag Changed) Combine(CustomizeArray oldValues, CustomizeArray newValues,
CustomizeFlag applyWhich, bool allowUnknown) CustomizeFlag applyWhich, bool allowUnknown)
{ {

View file

@ -21,14 +21,14 @@ public class ItemManager
public readonly ObjectIdentification ObjectIdentification; public readonly ObjectIdentification ObjectIdentification;
public readonly ExcelSheet<Lumina.Excel.GeneratedSheets.Item> ItemSheet; public readonly ExcelSheet<Lumina.Excel.GeneratedSheets.Item> ItemSheet;
public readonly DictStains Stains; public readonly DictStain Stains;
public readonly ItemData ItemData; public readonly ItemData ItemData;
public readonly RestrictedGear RestrictedGear; public readonly RestrictedGear RestrictedGear;
public readonly EquipItem DefaultSword; public readonly EquipItem DefaultSword;
public ItemManager(Configuration config, IDataManager gameData, ObjectIdentification objectIdentification, public ItemManager(Configuration config, IDataManager gameData, ObjectIdentification objectIdentification,
ItemData itemData, DictStains stains, RestrictedGear restrictedGear) ItemData itemData, DictStain stains, RestrictedGear restrictedGear)
{ {
_config = config; _config = config;
ItemSheet = gameData.GetExcelSheet<Lumina.Excel.GeneratedSheets.Item>()!; ItemSheet = gameData.GetExcelSheet<Lumina.Excel.GeneratedSheets.Item>()!;

@ -1 +1 @@
Subproject commit 4404d62b7442daa7e3436dc417364905e3d5cd2f Subproject commit bdf053ea9e7ac7b96dcd6aceadff8d92c3050b34

@ -1 +1 @@
Subproject commit 4af8775f0925ff89e6900c8816b03e0ffeb73f6d Subproject commit a7d2d73217113eadf02e21865a82deb92ea9eb53