Add glasses to advanced dye slot combo.

This commit is contained in:
Ottermandias 2025-08-16 11:58:41 +02:00
parent e854386b23
commit bb2ba0cf11
3 changed files with 54 additions and 8 deletions

View file

@ -18,7 +18,6 @@ public class MaterialDrawer(DesignManager _designManager, Configuration _config)
public const float GlossWidth = 100;
public const float SpecularStrengthWidth = 125;
private EquipSlot _newSlot = EquipSlot.Head;
private int _newMaterialIdx;
private int _newRowIdx;
private MaterialValueIndex _newKey = MaterialValueIndex.FromSlot(EquipSlot.Head);
@ -178,14 +177,42 @@ public class MaterialDrawer(DesignManager _designManager, Configuration _config)
public sealed class MaterialSlotCombo;
public void DrawNew(Design design)
private void DrawSlotCombo()
{
if (EquipSlotCombo.Draw("##slot", "Choose a slot for an advanced dye row.", ref _newSlot))
_newKey = MaterialValueIndex.FromSlot(_newSlot) with
var width = ImUtf8.CalcTextSize(EquipSlot.OffHand.ToName()).X + ImGui.GetFrameHeightWithSpacing();
ImGui.SetNextItemWidth(width);
using var combo = ImUtf8.Combo("##slot"u8, _newKey.SlotName());
if (combo)
{
var currentSlot = _newKey.ToEquipSlot();
foreach (var tmpSlot in EquipSlotExtensions.FullSlots)
{
if (ImUtf8.Selectable(tmpSlot.ToName(), tmpSlot == currentSlot) && currentSlot != tmpSlot)
_newKey = MaterialValueIndex.FromSlot(tmpSlot) with
{
MaterialIndex = (byte)_newMaterialIdx,
RowIndex = (byte)_newRowIdx,
};
}
var currentBonus = _newKey.ToBonusSlot();
foreach (var bonusSlot in BonusExtensions.AllFlags)
{
if (ImUtf8.Selectable(bonusSlot.ToName(), bonusSlot == currentBonus) && bonusSlot != currentBonus)
_newKey = MaterialValueIndex.FromSlot(bonusSlot) with
{
MaterialIndex = (byte)_newMaterialIdx,
RowIndex = (byte)_newRowIdx,
};
}
}
ImUtf8.HoverTooltip("Choose a slot for an advanced dye row."u8);
}
public void DrawNew(Design design)
{
DrawSlotCombo();
ImUtf8.SameLineInner();
DrawMaterialIdxDrag();
ImUtf8.SameLineInner();

View file

@ -2,11 +2,11 @@
using Dalamud.Utility;
using Dalamud.Bindings.ImGui;
using OtterGui;
using OtterGui.Custom;
using OtterGui.Extensions;
using OtterGui.Log;
using OtterGui.Widgets;
using Penumbra.GameData.DataContainers;
using OtterGui.Custom;
namespace Glamourer.Gui.Tabs.AutomationTab;

View file

@ -50,6 +50,18 @@ public readonly record struct MaterialValueIndex(
return idx > 2 ? Invalid : new MaterialValueIndex(DrawObjectType.Human, (byte)(idx + 16), 0, 0);
}
public string SlotName()
{
var slot = ToEquipSlot();
if (slot is not EquipSlot.Unknown)
return slot.ToName();
if (DrawObject is DrawObjectType.Human && SlotIndex is 16)
return BonusItemFlag.Glasses.ToString();
return EquipSlot.Unknown.ToName();
}
public EquipSlot ToEquipSlot()
=> DrawObject switch
{
@ -59,6 +71,13 @@ public readonly record struct MaterialValueIndex(
_ => EquipSlot.Unknown,
};
public BonusItemFlag ToBonusSlot()
=> DrawObject switch
{
DrawObjectType.Human when SlotIndex > 15 => ((uint)SlotIndex - 16).ToBonusSlot(),
_ => BonusItemFlag.Unknown,
};
public unsafe bool TryGetModel(Actor actor, out Model model)
{
if (!actor.Valid)