mirror of
https://github.com/Ottermandias/Glamourer.git
synced 2026-01-03 14:23:43 +01:00
Add some support for NPC customizations.
This commit is contained in:
parent
38527f4320
commit
56ad7dc968
6 changed files with 197 additions and 11 deletions
|
|
@ -23,7 +23,6 @@ public class Glamourer : IDalamudPlugin
|
|||
public static readonly Logger Log = new();
|
||||
public static ChatService Chat { get; private set; } = null!;
|
||||
|
||||
|
||||
private readonly ServiceProvider _services;
|
||||
|
||||
public Glamourer(DalamudPluginInterface pluginInterface)
|
||||
|
|
@ -45,7 +44,5 @@ public class Glamourer : IDalamudPlugin
|
|||
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
_services?.Dispose();
|
||||
}
|
||||
=> _services?.Dispose();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -822,7 +822,11 @@ public unsafe class DebugTab : ITab
|
|||
foreach (var clan in _customization.AwaitedService.Clans)
|
||||
{
|
||||
foreach (var gender in _customization.AwaitedService.Genders)
|
||||
DrawCustomizationInfo(_customization.AwaitedService.GetList(clan, gender));
|
||||
{
|
||||
var set = _customization.AwaitedService.GetList(clan, gender);
|
||||
DrawCustomizationInfo(set);
|
||||
DrawNpcCustomizationInfo(set);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -846,6 +850,23 @@ public unsafe class DebugTab : ITab
|
|||
}
|
||||
}
|
||||
|
||||
private void DrawNpcCustomizationInfo(CustomizationSet set)
|
||||
{
|
||||
using var tree = ImRaii.TreeNode($"{_customization.ClanName(set.Clan, set.Gender)} {set.Gender} (NPC Options)");
|
||||
if (!tree)
|
||||
return;
|
||||
|
||||
using var table = ImRaii.Table("npc", 2, ImGuiTableFlags.SizingFixedFit | ImGuiTableFlags.RowBg);
|
||||
if (!table)
|
||||
return;
|
||||
|
||||
foreach(var (index, value) in set.NpcOptions)
|
||||
{
|
||||
ImGuiUtil.DrawTableColumn(index.ToString());
|
||||
ImGuiUtil.DrawTableColumn(value.Value.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Designs
|
||||
|
|
|
|||
|
|
@ -122,12 +122,12 @@ public sealed class CustomizationService : AsyncServiceWrapper<ICustomizationMan
|
|||
[MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)]
|
||||
public static bool IsCustomizationValid(CustomizationSet set, CustomizeValue face, CustomizeIndex type, CustomizeValue value,
|
||||
[NotNullWhen(true)] out CustomizeData? data)
|
||||
=> set.DataByValue(type, value, out data, face) >= 0 || !set.IsAvailable(type) && value.Value == 0;
|
||||
=> set.Validate(type, value, out data, face);
|
||||
|
||||
/// <summary> Returns whether a customization value is valid for a given clan, gender and face. </summary>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)]
|
||||
public bool IsCustomizationValid(SubRace race, Gender gender, CustomizeValue face, CustomizeIndex type, CustomizeValue value)
|
||||
=> AwaitedService.GetList(race, gender).DataByValue(type, value, out _, face) >= 0;
|
||||
=> IsCustomizationValid(AwaitedService.GetList(race, gender), face, type, value);
|
||||
|
||||
/// <summary>
|
||||
/// Check that the given race and clan are valid.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue