mirror of
https://github.com/Ottermandias/Glamourer.git
synced 2026-02-20 06:27:43 +01:00
.
This commit is contained in:
parent
63e82d19dc
commit
e57538561f
34 changed files with 2428 additions and 720 deletions
|
|
@ -24,20 +24,18 @@ public partial class CustomizationDrawer
|
|||
|
||||
private void DrawGenderSelector()
|
||||
{
|
||||
using var font = ImRaii.PushFont(UiBuilder.IconFont);
|
||||
var icon = _customize.Gender switch
|
||||
{
|
||||
Gender.Male when _customize.Race is Race.Hrothgar => FontAwesomeIcon.MarsDouble,
|
||||
Gender.Male => FontAwesomeIcon.Mars,
|
||||
Gender.Female => FontAwesomeIcon.Venus,
|
||||
|
||||
_ => throw new Exception($"Gender value {_customize.Gender} is not a valid gender for a design."),
|
||||
_ => FontAwesomeIcon.Question,
|
||||
};
|
||||
|
||||
if (!ImGuiUtil.DrawDisabledButton(icon.ToIconString(), _framedIconSize, string.Empty, icon == FontAwesomeIcon.MarsDouble, true))
|
||||
if (!ImGuiUtil.DrawDisabledButton(icon.ToIconString(), _framedIconSize, string.Empty, icon is not FontAwesomeIcon.Mars and not FontAwesomeIcon.Venus, true))
|
||||
return;
|
||||
|
||||
_service.ChangeGender(ref _customize, _customize.Gender is Gender.Male ? Gender.Female : Gender.Male);
|
||||
Changed |= _service.ChangeGender(ref _customize, icon is FontAwesomeIcon.Mars ? Gender.Female : Gender.Male);
|
||||
}
|
||||
|
||||
private void DrawRaceCombo()
|
||||
|
|
@ -50,7 +48,7 @@ public partial class CustomizationDrawer
|
|||
foreach (var subRace in Enum.GetValues<SubRace>().Skip(1)) // Skip Unknown
|
||||
{
|
||||
if (ImGui.Selectable(_service.ClanName(subRace, _customize.Gender), subRace == _customize.Clan))
|
||||
_service.ChangeClan(ref _customize, subRace);
|
||||
Changed |= _service.ChangeClan(ref _customize, subRace);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,7 +20,8 @@ public partial class CustomizationDrawer : IDisposable
|
|||
private Customize _customize;
|
||||
private CustomizationSet _set = null!;
|
||||
|
||||
public Customize Customize;
|
||||
public Customize Customize
|
||||
=> _customize;
|
||||
|
||||
public CustomizeFlag CurrentFlag { get; private set; }
|
||||
public CustomizeFlag Changed { get; private set; }
|
||||
|
|
@ -41,7 +42,7 @@ public partial class CustomizationDrawer : IDisposable
|
|||
{
|
||||
_service = service;
|
||||
_legacyTattoo = GetLegacyTattooIcon(pi);
|
||||
Customize = Customize.Default;
|
||||
_customize = Customize.Default;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
|
|
|
|||
163
Glamourer/Gui/Equipment/EquipmentDrawer.cs
Normal file
163
Glamourer/Gui/Equipment/EquipmentDrawer.cs
Normal file
|
|
@ -0,0 +1,163 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using Dalamud.Data;
|
||||
using Dalamud.Interface;
|
||||
using Glamourer.Designs;
|
||||
using Glamourer.Services;
|
||||
using ImGuiNET;
|
||||
using OtterGui;
|
||||
using OtterGui.Widgets;
|
||||
using Penumbra.GameData.Data;
|
||||
using Penumbra.GameData.Enums;
|
||||
using Penumbra.GameData.Structs;
|
||||
|
||||
namespace Glamourer.Gui.Equipment;
|
||||
|
||||
public class EquipmentDrawer
|
||||
{
|
||||
private readonly ItemManager _items;
|
||||
private readonly FilterComboColors _stainCombo;
|
||||
private readonly StainData _stainData;
|
||||
private readonly ItemCombo[] _itemCombo;
|
||||
private readonly Dictionary<FullEquipType, WeaponCombo> _weaponCombo;
|
||||
|
||||
public EquipmentDrawer(DataManager gameData, ItemManager items)
|
||||
{
|
||||
_items = items;
|
||||
_stainData = items.Stains;
|
||||
_stainCombo = new FilterComboColors(140,
|
||||
_stainData.Data.Prepend(new KeyValuePair<byte, (string Name, uint Dye, bool Gloss)>(0, ("None", 0, false))));
|
||||
_itemCombo = EquipSlotExtensions.EqdpSlots.Select(e => new ItemCombo(gameData, items, e)).ToArray();
|
||||
_weaponCombo = new Dictionary<FullEquipType, WeaponCombo>(FullEquipTypeExtensions.WeaponTypes.Count * 2);
|
||||
foreach (var type in Enum.GetValues<FullEquipType>())
|
||||
{
|
||||
if (type.ToSlot() is EquipSlot.MainHand)
|
||||
_weaponCombo.TryAdd(type, new WeaponCombo(items, type));
|
||||
else if (type.ToSlot() is EquipSlot.OffHand)
|
||||
_weaponCombo.TryAdd(type, new WeaponCombo(items, type));
|
||||
}
|
||||
|
||||
_weaponCombo.Add(FullEquipType.Unknown, new WeaponCombo(items, FullEquipType.Unknown));
|
||||
}
|
||||
|
||||
private string VerifyRestrictedGear(EquipItem gear, EquipSlot slot, Gender gender, Race race)
|
||||
{
|
||||
if (slot.IsAccessory())
|
||||
return gear.Name;
|
||||
|
||||
var (changed, _) = _items.ResolveRestrictedGear(gear.Armor(), slot, race, gender);
|
||||
if (changed)
|
||||
return gear.Name + " (Restricted)";
|
||||
|
||||
return gear.Name;
|
||||
}
|
||||
|
||||
public bool DrawArmor(EquipItem current, EquipSlot slot, out EquipItem armor, Gender gender = Gender.Unknown, Race race = Race.Unknown)
|
||||
{
|
||||
Debug.Assert(slot.IsEquipment() || slot.IsAccessory(), $"Called {nameof(DrawArmor)} on {slot}.");
|
||||
var combo = _itemCombo[slot.ToIndex()];
|
||||
armor = current;
|
||||
var change = combo.Draw(VerifyRestrictedGear(armor, slot, gender, race), armor.Id, 320 * ImGuiHelpers.GlobalScale);
|
||||
if (armor.ModelId.Value != 0)
|
||||
{
|
||||
ImGuiUtil.HoverTooltip("Right-click to clear.");
|
||||
if (ImGui.IsItemClicked(ImGuiMouseButton.Right))
|
||||
{
|
||||
change = true;
|
||||
armor = ItemManager.NothingItem(slot);
|
||||
}
|
||||
else if (change)
|
||||
{
|
||||
armor = combo.CurrentSelection;
|
||||
}
|
||||
}
|
||||
else if (change)
|
||||
{
|
||||
armor = combo.CurrentSelection;
|
||||
}
|
||||
|
||||
return change;
|
||||
}
|
||||
|
||||
public bool DrawStain(StainId current, EquipSlot slot, out Stain stain)
|
||||
{
|
||||
var found = _stainData.TryGetValue(current, out stain);
|
||||
var change = _stainCombo.Draw($"##stain{slot}", stain.RgbaColor, stain.Name, found);
|
||||
ImGuiUtil.HoverTooltip("Right-click to clear.");
|
||||
if (ImGui.IsItemClicked(ImGuiMouseButton.Right))
|
||||
{
|
||||
stain = Stain.None;
|
||||
return true;
|
||||
}
|
||||
|
||||
return change && _stainData.TryGetValue(_stainCombo.CurrentSelection.Key, out stain);
|
||||
}
|
||||
|
||||
public bool DrawMainhand(EquipItem current, bool drawAll, out EquipItem weapon)
|
||||
{
|
||||
weapon = current;
|
||||
if (!_weaponCombo.TryGetValue(drawAll ? FullEquipType.Unknown : current.Type, out var combo))
|
||||
return false;
|
||||
|
||||
if (!combo.Draw(weapon.Name, weapon.Id, 320 * ImGuiHelpers.GlobalScale))
|
||||
return false;
|
||||
|
||||
weapon = combo.CurrentSelection;
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool DrawOffhand(EquipItem current, FullEquipType mainType, out EquipItem weapon)
|
||||
{
|
||||
weapon = current;
|
||||
var offType = mainType.Offhand();
|
||||
if (offType == FullEquipType.Unknown)
|
||||
return false;
|
||||
|
||||
if (!_weaponCombo.TryGetValue(offType, out var combo))
|
||||
return false;
|
||||
|
||||
var change = combo.Draw(weapon.Name, weapon.Id, 320 * ImGuiHelpers.GlobalScale);
|
||||
if (!offType.IsOffhandType() && weapon.ModelId.Value != 0)
|
||||
{
|
||||
ImGuiUtil.HoverTooltip("Right-click to clear.");
|
||||
if (ImGui.IsItemClicked(ImGuiMouseButton.Right))
|
||||
{
|
||||
change = true;
|
||||
weapon = ItemManager.NothingItem(offType);
|
||||
}
|
||||
}
|
||||
else if (change)
|
||||
{
|
||||
weapon = combo.CurrentSelection;
|
||||
}
|
||||
|
||||
return change;
|
||||
}
|
||||
|
||||
public bool DrawApply(Design design, EquipSlot slot, out bool enabled)
|
||||
=> DrawCheckbox($"##apply{slot}", design.DoApplyEquip(slot), out enabled);
|
||||
|
||||
public bool DrawApplyStain(Design design, EquipSlot slot, out bool enabled)
|
||||
=> DrawCheckbox($"##applyStain{slot}", design.DoApplyStain(slot), out enabled);
|
||||
|
||||
private static bool DrawCheckbox(string label, bool value, out bool on)
|
||||
{
|
||||
var ret = ImGuiUtil.Checkbox(label, string.Empty, value, v => value = v);
|
||||
on = value;
|
||||
return ret;
|
||||
}
|
||||
|
||||
public bool DrawVisor(bool current, out bool on)
|
||||
=> DrawCheckbox("##visorToggled", current, out on);
|
||||
|
||||
public bool DrawHat(bool current, out bool on)
|
||||
=> DrawCheckbox("##hatVisible", current, out on);
|
||||
|
||||
public bool DrawWeapon(bool current, out bool on)
|
||||
=> DrawCheckbox("##weaponVisible", current, out on);
|
||||
|
||||
public bool DrawWetness(bool current, out bool on)
|
||||
=> DrawCheckbox("##wetness", current, out on);
|
||||
}
|
||||
103
Glamourer/Gui/Equipment/ItemCombo.cs
Normal file
103
Glamourer/Gui/Equipment/ItemCombo.cs
Normal file
|
|
@ -0,0 +1,103 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Dalamud.Data;
|
||||
using Glamourer.Services;
|
||||
using ImGuiNET;
|
||||
using Lumina.Excel.GeneratedSheets;
|
||||
using OtterGui;
|
||||
using OtterGui.Classes;
|
||||
using OtterGui.Raii;
|
||||
using OtterGui.Widgets;
|
||||
using Penumbra.GameData.Enums;
|
||||
using Penumbra.GameData.Structs;
|
||||
|
||||
namespace Glamourer.Gui.Equipment;
|
||||
|
||||
public sealed class ItemCombo : FilterComboCache<EquipItem>
|
||||
{
|
||||
public readonly string Label;
|
||||
private uint _currentItem;
|
||||
|
||||
public ItemCombo(DataManager gameData, ItemManager items, EquipSlot slot)
|
||||
: base(() => GetItems(items, slot))
|
||||
{
|
||||
Label = GetLabel(gameData, slot);
|
||||
_currentItem = ItemManager.NothingId(slot);
|
||||
}
|
||||
|
||||
protected override void DrawList(float width, float itemHeight)
|
||||
{
|
||||
base.DrawList(width, itemHeight);
|
||||
if (NewSelection != null && Items.Count > NewSelection.Value)
|
||||
CurrentSelection = Items[NewSelection.Value];
|
||||
}
|
||||
|
||||
protected override int UpdateCurrentSelected(int currentSelected)
|
||||
{
|
||||
if (CurrentSelection.Id == _currentItem)
|
||||
return currentSelected;
|
||||
|
||||
CurrentSelectionIdx = Items.IndexOf(i => i.Id == _currentItem);
|
||||
CurrentSelection = CurrentSelectionIdx >= 0 ? Items[CurrentSelectionIdx] : default;
|
||||
return base.UpdateCurrentSelected(CurrentSelectionIdx);
|
||||
|
||||
}
|
||||
|
||||
public bool Draw(string previewName, uint previewIdx, float width)
|
||||
{
|
||||
_currentItem = previewIdx;
|
||||
return Draw(Label, previewName, string.Empty, width, ImGui.GetTextLineHeightWithSpacing());
|
||||
}
|
||||
|
||||
protected override bool DrawSelectable(int globalIdx, bool selected)
|
||||
{
|
||||
var obj = Items[globalIdx];
|
||||
var name = ToString(obj);
|
||||
var ret = ImGui.Selectable(name, selected);
|
||||
ImGui.SameLine();
|
||||
using var color = ImRaii.PushColor(ImGuiCol.Text, 0xFF808080);
|
||||
ImGuiUtil.RightAlign($"({obj.ModelId.Value}-{obj.Variant})");
|
||||
return ret;
|
||||
}
|
||||
|
||||
protected override bool IsVisible(int globalIndex, LowerString filter)
|
||||
=> base.IsVisible(globalIndex, filter) || filter.IsContained(Items[globalIndex].ModelId.Value.ToString());
|
||||
|
||||
protected override string ToString(EquipItem obj)
|
||||
=> obj.Name;
|
||||
|
||||
private static string GetLabel(DataManager gameData, EquipSlot slot)
|
||||
{
|
||||
var sheet = gameData.GetExcelSheet<Addon>()!;
|
||||
|
||||
return slot switch
|
||||
{
|
||||
EquipSlot.Head => sheet.GetRow(740)?.Text.ToString() ?? "Head",
|
||||
EquipSlot.Body => sheet.GetRow(741)?.Text.ToString() ?? "Body",
|
||||
EquipSlot.Hands => sheet.GetRow(742)?.Text.ToString() ?? "Hands",
|
||||
EquipSlot.Legs => sheet.GetRow(744)?.Text.ToString() ?? "Legs",
|
||||
EquipSlot.Feet => sheet.GetRow(745)?.Text.ToString() ?? "Feet",
|
||||
EquipSlot.Ears => sheet.GetRow(746)?.Text.ToString() ?? "Ears",
|
||||
EquipSlot.Neck => sheet.GetRow(747)?.Text.ToString() ?? "Neck",
|
||||
EquipSlot.Wrists => sheet.GetRow(748)?.Text.ToString() ?? "Wrists",
|
||||
EquipSlot.RFinger => sheet.GetRow(749)?.Text.ToString() ?? "Right Ring",
|
||||
EquipSlot.LFinger => sheet.GetRow(750)?.Text.ToString() ?? "Left Ring",
|
||||
_ => string.Empty,
|
||||
};
|
||||
}
|
||||
|
||||
private static IReadOnlyList<EquipItem> GetItems(ItemManager items, EquipSlot slot)
|
||||
{
|
||||
var nothing = ItemManager.NothingItem(slot);
|
||||
if (!items.ItemService.AwaitedService.TryGetValue(slot.ToEquipType(), out var list))
|
||||
return new[]
|
||||
{
|
||||
nothing,
|
||||
};
|
||||
|
||||
var enumerable = list.AsEnumerable();
|
||||
if (slot.IsEquipment())
|
||||
enumerable = enumerable.Append(ItemManager.SmallClothesItem(slot));
|
||||
return enumerable.OrderBy(i => i.Name).Prepend(nothing).ToList();
|
||||
}
|
||||
}
|
||||
89
Glamourer/Gui/Equipment/WeaponCombo.cs
Normal file
89
Glamourer/Gui/Equipment/WeaponCombo.cs
Normal file
|
|
@ -0,0 +1,89 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Glamourer.Services;
|
||||
using ImGuiNET;
|
||||
using OtterGui;
|
||||
using OtterGui.Classes;
|
||||
using OtterGui.Raii;
|
||||
using OtterGui.Widgets;
|
||||
using Penumbra.GameData.Enums;
|
||||
using Penumbra.GameData.Structs;
|
||||
|
||||
namespace Glamourer.Gui.Equipment;
|
||||
|
||||
public sealed class WeaponCombo : FilterComboCache<EquipItem>
|
||||
{
|
||||
public readonly string Label;
|
||||
private uint _currentItemId;
|
||||
|
||||
public WeaponCombo(ItemManager items, FullEquipType type)
|
||||
: base(() => GetWeapons(items, type))
|
||||
=> Label = GetLabel(type);
|
||||
|
||||
protected override void DrawList(float width, float itemHeight)
|
||||
{
|
||||
base.DrawList(width, itemHeight);
|
||||
if (NewSelection != null && Items.Count > NewSelection.Value)
|
||||
CurrentSelection = Items[NewSelection.Value];
|
||||
}
|
||||
|
||||
protected override int UpdateCurrentSelected(int currentSelected)
|
||||
{
|
||||
if (CurrentSelection.Id == _currentItemId)
|
||||
return currentSelected;
|
||||
|
||||
CurrentSelectionIdx = Items.IndexOf(i => i.Id == _currentItemId);
|
||||
CurrentSelection = CurrentSelectionIdx >= 0 ? Items[CurrentSelectionIdx] : default;
|
||||
return base.UpdateCurrentSelected(CurrentSelectionIdx);
|
||||
}
|
||||
|
||||
public bool Draw(string previewName, uint previewId, float width)
|
||||
{
|
||||
_currentItemId = previewId;
|
||||
return Draw(Label, previewName, string.Empty, width, ImGui.GetTextLineHeightWithSpacing());
|
||||
}
|
||||
|
||||
protected override bool DrawSelectable(int globalIdx, bool selected)
|
||||
{
|
||||
var obj = Items[globalIdx];
|
||||
var name = ToString(obj);
|
||||
var ret = ImGui.Selectable(name, selected);
|
||||
ImGui.SameLine();
|
||||
using var color = ImRaii.PushColor(ImGuiCol.Text, 0xFF808080);
|
||||
ImGuiUtil.RightAlign($"({obj.ModelId.Value}-{obj.WeaponType.Value}-{obj.Variant})");
|
||||
return ret;
|
||||
}
|
||||
|
||||
protected override bool IsVisible(int globalIndex, LowerString filter)
|
||||
=> base.IsVisible(globalIndex, filter) || filter.IsContained(Items[globalIndex].ModelId.Value.ToString());
|
||||
|
||||
protected override string ToString(EquipItem obj)
|
||||
=> obj.Name;
|
||||
|
||||
private static string GetLabel(FullEquipType type)
|
||||
=> type is FullEquipType.Unknown ? "Mainhand" : type.ToName();
|
||||
|
||||
private static IReadOnlyList<EquipItem> GetWeapons(ItemManager items, FullEquipType type)
|
||||
{
|
||||
if (type is FullEquipType.Unknown)
|
||||
{
|
||||
var enumerable = Array.Empty<EquipItem>().AsEnumerable();
|
||||
foreach (var t in Enum.GetValues<FullEquipType>().Where(e => e.ToSlot() is EquipSlot.MainHand))
|
||||
{
|
||||
if (items.ItemService.AwaitedService.TryGetValue(t, out var l))
|
||||
enumerable = enumerable.Concat(l);
|
||||
}
|
||||
|
||||
return enumerable.OrderBy(e => e.Name).ToList();
|
||||
}
|
||||
|
||||
if (!items.ItemService.AwaitedService.TryGetValue(type, out var list))
|
||||
return Array.Empty<EquipItem>();
|
||||
|
||||
if (type.ToSlot() is EquipSlot.OffHand && !type.IsOffhandType())
|
||||
return list.OrderBy(e => e.Name).Prepend(ItemManager.NothingItem(type)).ToList();
|
||||
|
||||
return list.OrderBy(e => e.Name).ToList();
|
||||
}
|
||||
}
|
||||
|
|
@ -1,5 +1,8 @@
|
|||
using System.Numerics;
|
||||
using Glamourer.Customization;
|
||||
using Glamourer.Events;
|
||||
using Glamourer.Gui.Customization;
|
||||
using Glamourer.Gui.Equipment;
|
||||
using Glamourer.Interop.Structs;
|
||||
using Glamourer.State;
|
||||
using ImGuiNET;
|
||||
|
|
@ -14,6 +17,7 @@ public class ActorPanel
|
|||
private readonly ActorSelector _selector;
|
||||
private readonly StateManager _stateManager;
|
||||
private readonly CustomizationDrawer _customizationDrawer;
|
||||
private readonly EquipmentDrawer _equipmentDrawer;
|
||||
|
||||
private ActorIdentifier _identifier;
|
||||
private string _actorName = string.Empty;
|
||||
|
|
@ -21,11 +25,13 @@ public class ActorPanel
|
|||
private ActorData _data;
|
||||
private ActorState? _state;
|
||||
|
||||
public ActorPanel(ActorSelector selector, StateManager stateManager, CustomizationDrawer customizationDrawer)
|
||||
public ActorPanel(ActorSelector selector, StateManager stateManager, CustomizationDrawer customizationDrawer,
|
||||
EquipmentDrawer equipmentDrawer)
|
||||
{
|
||||
_selector = selector;
|
||||
_stateManager = stateManager;
|
||||
_customizationDrawer = customizationDrawer;
|
||||
_equipmentDrawer = equipmentDrawer;
|
||||
}
|
||||
|
||||
public void Draw()
|
||||
|
|
@ -76,46 +82,40 @@ public class ActorPanel
|
|||
return;
|
||||
|
||||
if (_customizationDrawer.Draw(_state.ModelData.Customize, false))
|
||||
_stateManager.ChangeCustomize(_state, _customizationDrawer.Customize, _customizationDrawer.Changed, StateChanged.Source.Manual);
|
||||
|
||||
foreach (var slot in EquipSlotExtensions.EqdpSlots)
|
||||
{
|
||||
var stain = _state.ModelData.Stain(slot);
|
||||
if (_equipmentDrawer.DrawStain(stain, slot, out var newStain))
|
||||
_stateManager.ChangeStain(_state, slot, newStain.RowIndex, StateChanged.Source.Manual);
|
||||
|
||||
ImGui.SameLine();
|
||||
var armor = _state.ModelData.Item(slot);
|
||||
if (_equipmentDrawer.DrawArmor(armor, slot, out var newArmor, _state.ModelData.Customize.Gender, _state.ModelData.Customize.Race))
|
||||
_stateManager.ChangeEquip(_state, slot, newArmor, newStain.RowIndex, StateChanged.Source.Manual);
|
||||
}
|
||||
|
||||
var mhStain = _state.ModelData.Stain(EquipSlot.MainHand);
|
||||
if (_equipmentDrawer.DrawStain(mhStain, EquipSlot.MainHand, out var newMhStain))
|
||||
_stateManager.ChangeStain(_state, EquipSlot.MainHand, newMhStain.RowIndex, StateChanged.Source.Manual);
|
||||
|
||||
ImGui.SameLine();
|
||||
var mh = _state.ModelData.Item(EquipSlot.MainHand);
|
||||
if (_equipmentDrawer.DrawMainhand(mh, false, out var newMh))
|
||||
_stateManager.ChangeEquip(_state, EquipSlot.MainHand, newMh, newMhStain.RowIndex, StateChanged.Source.Manual);
|
||||
|
||||
if (newMh.Type.Offhand() is not FullEquipType.Unknown)
|
||||
{
|
||||
var ohStain = _state.ModelData.Stain(EquipSlot.OffHand);
|
||||
if (_equipmentDrawer.DrawStain(ohStain, EquipSlot.OffHand, out var newOhStain))
|
||||
_stateManager.ChangeStain(_state, EquipSlot.OffHand, newOhStain.RowIndex, StateChanged.Source.Manual);
|
||||
|
||||
ImGui.SameLine();
|
||||
var oh = _state.ModelData.Item(EquipSlot.OffHand);
|
||||
if (_equipmentDrawer.DrawMainhand(oh, false, out var newOh))
|
||||
_stateManager.ChangeEquip(_state, EquipSlot.OffHand, newOh, newOhStain.RowIndex, StateChanged.Source.Manual);
|
||||
}
|
||||
// if (_currentData.Valid)
|
||||
// _currentSave.Initialize(_items, _currentData.Objects[0]);
|
||||
//
|
||||
// RevertButton();
|
||||
// ActorDebug.Draw(_currentSave.ModelData);
|
||||
// return;
|
||||
//
|
||||
// if (_main._customizationDrawer.Draw(_currentSave.ModelData.Customize, _identifier.Type == IdentifierType.Special))
|
||||
// _activeDesigns.ChangeCustomize(_currentSave, _main._customizationDrawer.Changed, _main._customizationDrawer.Customize.Data,
|
||||
// false);
|
||||
//
|
||||
// foreach (var slot in EquipSlotExtensions.EqdpSlots)
|
||||
// {
|
||||
// var current = _currentSave.Armor(slot);
|
||||
// if (_main._equipmentDrawer.DrawStain(current.Stain, slot, out var stain))
|
||||
// _activeDesigns.ChangeStain(_currentSave, slot, stain.RowIndex, false);
|
||||
// ImGui.SameLine();
|
||||
// if (_main._equipmentDrawer.DrawArmor(current, slot, out var armor, _currentSave.ModelData.Customize.Gender,
|
||||
// _currentSave.ModelData.Customize.Race))
|
||||
// _activeDesigns.ChangeEquipment(_currentSave, slot, armor, false);
|
||||
// }
|
||||
//
|
||||
// var currentMain = _currentSave.WeaponMain;
|
||||
// if (_main._equipmentDrawer.DrawStain(currentMain.Stain, EquipSlot.MainHand, out var stainMain))
|
||||
// _activeDesigns.ChangeStain(_currentSave, EquipSlot.MainHand, stainMain.RowIndex, false);
|
||||
// ImGui.SameLine();
|
||||
// _main._equipmentDrawer.DrawMainhand(currentMain, true, out var main);
|
||||
// if (currentMain.Type.Offhand() != FullEquipType.Unknown)
|
||||
// {
|
||||
// var currentOff = _currentSave.WeaponOff;
|
||||
// if (_main._equipmentDrawer.DrawStain(currentOff.Stain, EquipSlot.OffHand, out var stainOff))
|
||||
// _activeDesigns.ChangeStain(_currentSave, EquipSlot.OffHand, stainOff.RowIndex, false);
|
||||
// ImGui.SameLine();
|
||||
// _main._equipmentDrawer.DrawOffhand(currentOff, main.Type, out var off);
|
||||
// }
|
||||
//
|
||||
// if (_main._equipmentDrawer.DrawVisor(_currentSave, out var value))
|
||||
// _activeDesigns.ChangeVisor(_currentSave, value, false);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ using Dalamud.Interface;
|
|||
using Dalamud.Plugin;
|
||||
using FFXIVClientStructs.FFXIV.Client.Graphics.Scene;
|
||||
using Glamourer.Api;
|
||||
using Glamourer.Automation;
|
||||
using Glamourer.Customization;
|
||||
using Glamourer.Designs;
|
||||
using Glamourer.Events;
|
||||
|
|
@ -40,13 +41,16 @@ public unsafe class DebugTab : ITab
|
|||
private readonly ObjectTable _objects;
|
||||
private readonly ObjectManager _objectManager;
|
||||
private readonly GlamourerIpc _ipc;
|
||||
private readonly PhrasingService _phrasing;
|
||||
|
||||
private readonly ItemManager _items;
|
||||
private readonly ActorService _actors;
|
||||
private readonly CustomizationService _customization;
|
||||
private readonly JobService _jobs;
|
||||
|
||||
private readonly DesignManager _designManager;
|
||||
private readonly DesignFileSystem _designFileSystem;
|
||||
private readonly DesignManager _designManager;
|
||||
private readonly DesignFileSystem _designFileSystem;
|
||||
private readonly AutoDesignManager _autoDesignManager;
|
||||
|
||||
private readonly PenumbraChangedItemTooltip _penumbraTooltip;
|
||||
|
||||
|
|
@ -61,7 +65,8 @@ public unsafe class DebugTab : ITab
|
|||
UpdateSlotService updateSlotService, WeaponService weaponService, PenumbraService penumbra,
|
||||
ActorService actors, ItemManager items, CustomizationService customization, ObjectManager objectManager,
|
||||
DesignFileSystem designFileSystem, DesignManager designManager, StateManager state, Configuration config,
|
||||
PenumbraChangedItemTooltip penumbraTooltip, MetaService metaService, GlamourerIpc ipc, DalamudPluginInterface pluginInterface)
|
||||
PenumbraChangedItemTooltip penumbraTooltip, MetaService metaService, GlamourerIpc ipc, DalamudPluginInterface pluginInterface,
|
||||
AutoDesignManager autoDesignManager, JobService jobs, PhrasingService phrasing)
|
||||
{
|
||||
_changeCustomizeService = changeCustomizeService;
|
||||
_visorService = visorService;
|
||||
|
|
@ -81,6 +86,9 @@ public unsafe class DebugTab : ITab
|
|||
_metaService = metaService;
|
||||
_ipc = ipc;
|
||||
_pluginInterface = pluginInterface;
|
||||
_autoDesignManager = autoDesignManager;
|
||||
_jobs = jobs;
|
||||
_phrasing = phrasing;
|
||||
}
|
||||
|
||||
public ReadOnlySpan<byte> Label
|
||||
|
|
@ -97,6 +105,7 @@ public unsafe class DebugTab : ITab
|
|||
DrawPenumbraHeader();
|
||||
DrawDesigns();
|
||||
DrawState();
|
||||
DrawAutoDesigns();
|
||||
DrawIpc();
|
||||
}
|
||||
|
||||
|
|
@ -376,14 +385,22 @@ public unsafe class DebugTab : ITab
|
|||
|
||||
if (ImGui.SmallButton("++"))
|
||||
{
|
||||
modelCustomize.Set(type, (CustomizeValue)(modelCustomize[type].Value + 1));
|
||||
var value = modelCustomize[type].Value;
|
||||
var (_, mask) = type.ToByteAndMask();
|
||||
var shift = BitOperations.TrailingZeroCount(mask);
|
||||
var newValue = value + (1 << shift);
|
||||
modelCustomize.Set(type, (CustomizeValue)newValue);
|
||||
_changeCustomizeService.UpdateCustomize(model, modelCustomize.Data);
|
||||
}
|
||||
|
||||
ImGui.SameLine();
|
||||
if (ImGui.SmallButton("--"))
|
||||
{
|
||||
modelCustomize.Set(type, (CustomizeValue)(modelCustomize[type].Value - 1));
|
||||
var value = modelCustomize[type].Value;
|
||||
var (_, mask) = type.ToByteAndMask();
|
||||
var shift = BitOperations.TrailingZeroCount(mask);
|
||||
var newValue = value - (1 << shift);
|
||||
modelCustomize.Set(type, (CustomizeValue)newValue);
|
||||
_changeCustomizeService.UpdateCustomize(model, modelCustomize.Data);
|
||||
}
|
||||
|
||||
|
|
@ -483,6 +500,44 @@ public unsafe class DebugTab : ITab
|
|||
DrawItemService();
|
||||
DrawStainService();
|
||||
DrawCustomizationService();
|
||||
DrawJobService();
|
||||
}
|
||||
|
||||
private void DrawJobService()
|
||||
{
|
||||
using var tree = ImRaii.TreeNode("Job Service");
|
||||
if (!tree)
|
||||
return;
|
||||
|
||||
using (var t = ImRaii.TreeNode("Jobs"))
|
||||
{
|
||||
if (t)
|
||||
{
|
||||
using var table = ImRaii.Table("##jobs", 3, ImGuiTableFlags.SizingFixedFit | ImGuiTableFlags.RowBg);
|
||||
if (table)
|
||||
foreach (var (id, job) in _jobs.Jobs)
|
||||
{
|
||||
ImGuiUtil.DrawTableColumn(id.ToString("D2"));
|
||||
ImGuiUtil.DrawTableColumn(job.Name);
|
||||
ImGuiUtil.DrawTableColumn(job.Abbreviation);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
using (var t = ImRaii.TreeNode("Job Groups"))
|
||||
{
|
||||
if (t)
|
||||
{
|
||||
using var table = ImRaii.Table("##groups", 3, ImGuiTableFlags.SizingFixedFit | ImGuiTableFlags.RowBg);
|
||||
if (table)
|
||||
foreach (var (id, group) in _jobs.JobGroups)
|
||||
{
|
||||
ImGuiUtil.DrawTableColumn(id.ToString("D2"));
|
||||
ImGuiUtil.DrawTableColumn(group.Name);
|
||||
ImGuiUtil.DrawTableColumn(group.Count.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private string _gamePath = string.Empty;
|
||||
|
|
@ -1116,6 +1171,66 @@ public unsafe class DebugTab : ITab
|
|||
|
||||
#endregion
|
||||
|
||||
#region Auto Designs
|
||||
|
||||
private void DrawAutoDesigns()
|
||||
{
|
||||
if (!ImGui.CollapsingHeader("Auto Designs"))
|
||||
return;
|
||||
|
||||
DrawPhrasingService();
|
||||
|
||||
foreach (var (set, idx) in _autoDesignManager.WithIndex())
|
||||
{
|
||||
using var id = ImRaii.PushId(idx);
|
||||
using var tree = ImRaii.TreeNode(set.Name);
|
||||
if (!tree)
|
||||
continue;
|
||||
|
||||
using var table = ImRaii.Table("##autoDesign", 2, ImGuiTableFlags.SizingFixedFit | ImGuiTableFlags.RowBg);
|
||||
if (!table)
|
||||
continue;
|
||||
|
||||
ImGuiUtil.DrawTableColumn("Name");
|
||||
ImGuiUtil.DrawTableColumn(set.Name);
|
||||
|
||||
ImGuiUtil.DrawTableColumn("Index");
|
||||
ImGuiUtil.DrawTableColumn(idx.ToString());
|
||||
|
||||
ImGuiUtil.DrawTableColumn("Enabled");
|
||||
ImGuiUtil.DrawTableColumn(set.Enabled.ToString());
|
||||
|
||||
ImGuiUtil.DrawTableColumn("Actor");
|
||||
ImGuiUtil.DrawTableColumn(set.Identifier.ToString());
|
||||
|
||||
foreach (var (design, designIdx) in set.Designs.WithIndex())
|
||||
{
|
||||
ImGuiUtil.DrawTableColumn($"{design.Design.Name} ({designIdx})");
|
||||
ImGuiUtil.DrawTableColumn($"{design.ApplicationType} {design.Jobs.Name}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void DrawPhrasingService()
|
||||
{
|
||||
using var tree = ImRaii.TreeNode("Phrasing");
|
||||
if (!tree)
|
||||
return;
|
||||
|
||||
using var table = ImRaii.Table("phrasing", 3, ImGuiTableFlags.SizingFixedFit);
|
||||
if (!table)
|
||||
return;
|
||||
|
||||
ImGuiUtil.DrawTableColumn("Phrasing 1");
|
||||
ImGuiUtil.DrawTableColumn(_config.Phrasing1);
|
||||
ImGuiUtil.DrawTableColumn(_phrasing.Phrasing1.ToString());
|
||||
ImGuiUtil.DrawTableColumn("Phrasing 2");
|
||||
ImGuiUtil.DrawTableColumn(_config.Phrasing2);
|
||||
ImGuiUtil.DrawTableColumn(_phrasing.Phrasing2.ToString());
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IPC
|
||||
|
||||
private string _gameObjectName = string.Empty;
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
using Glamourer.Customization;
|
||||
using Glamourer.Designs;
|
||||
using Glamourer.Gui.Customization;
|
||||
using Glamourer.Gui.Equipment;
|
||||
using Glamourer.Interop;
|
||||
using Glamourer.Interop.Penumbra;
|
||||
using Glamourer.State;
|
||||
|
|
@ -21,24 +22,17 @@ public class DesignPanel
|
|||
private readonly DesignManager _manager;
|
||||
private readonly CustomizationDrawer _customizationDrawer;
|
||||
private readonly StateManager _state;
|
||||
private readonly PenumbraService _penumbra;
|
||||
private readonly UpdateSlotService _updateSlot;
|
||||
private readonly WeaponService _weaponService;
|
||||
private readonly ChangeCustomizeService _changeCustomizeService;
|
||||
private readonly EquipmentDrawer _equipmentDrawer;
|
||||
|
||||
public DesignPanel(DesignFileSystemSelector selector, CustomizationDrawer customizationDrawer, DesignManager manager, ObjectManager objects,
|
||||
StateManager state, PenumbraService penumbra, ChangeCustomizeService changeCustomizeService, WeaponService weaponService,
|
||||
UpdateSlotService updateSlot)
|
||||
StateManager state, EquipmentDrawer equipmentDrawer)
|
||||
{
|
||||
_selector = selector;
|
||||
_customizationDrawer = customizationDrawer;
|
||||
_manager = manager;
|
||||
_objects = objects;
|
||||
_state = state;
|
||||
_penumbra = penumbra;
|
||||
_changeCustomizeService = changeCustomizeService;
|
||||
_weaponService = weaponService;
|
||||
_updateSlot = updateSlot;
|
||||
_selector = selector;
|
||||
_customizationDrawer = customizationDrawer;
|
||||
_manager = manager;
|
||||
_objects = objects;
|
||||
_state = state;
|
||||
_equipmentDrawer = equipmentDrawer;
|
||||
}
|
||||
|
||||
public void Draw()
|
||||
|
|
@ -60,5 +54,38 @@ public class DesignPanel
|
|||
}
|
||||
|
||||
_customizationDrawer.Draw(design.DesignData.Customize, design.WriteProtected());
|
||||
|
||||
foreach (var slot in EquipSlotExtensions.EqdpSlots)
|
||||
{
|
||||
var stain = design.DesignData.Stain(slot);
|
||||
if (_equipmentDrawer.DrawStain(stain, slot, out var newStain))
|
||||
_manager.ChangeStain(design, slot, newStain.RowIndex);
|
||||
|
||||
ImGui.SameLine();
|
||||
var armor = design.DesignData.Item(slot);
|
||||
if (_equipmentDrawer.DrawArmor(armor, slot, out var newArmor, design.DesignData.Customize.Gender, design.DesignData.Customize.Race))
|
||||
_manager.ChangeEquip(design, slot, newArmor);
|
||||
}
|
||||
|
||||
var mhStain = design.DesignData.Stain(EquipSlot.MainHand);
|
||||
if (_equipmentDrawer.DrawStain(mhStain, EquipSlot.MainHand, out var newMhStain))
|
||||
_manager.ChangeStain(design, EquipSlot.MainHand, newMhStain.RowIndex);
|
||||
|
||||
ImGui.SameLine();
|
||||
var mh = design.DesignData.Item(EquipSlot.MainHand);
|
||||
if (_equipmentDrawer.DrawMainhand(mh, true, out var newMh))
|
||||
_manager.ChangeWeapon(design, EquipSlot.MainHand, newMh);
|
||||
|
||||
if (newMh.Type.Offhand() is not FullEquipType.Unknown)
|
||||
{
|
||||
var ohStain = design.DesignData.Stain(EquipSlot.OffHand);
|
||||
if (_equipmentDrawer.DrawStain(ohStain, EquipSlot.OffHand, out var newOhStain))
|
||||
_manager.ChangeStain(design, EquipSlot.OffHand, newOhStain.RowIndex);
|
||||
|
||||
ImGui.SameLine();
|
||||
var oh = design.DesignData.Item(EquipSlot.OffHand);
|
||||
if (_equipmentDrawer.DrawMainhand(oh, false, out var newOh))
|
||||
_manager.ChangeWeapon(design, EquipSlot.OffHand, newOh);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ using System.Runtime.CompilerServices;
|
|||
using Dalamud.Interface;
|
||||
using Glamourer.Gui.Tabs.DesignTab;
|
||||
using Glamourer.Interop.Penumbra;
|
||||
using Glamourer.Services;
|
||||
using Glamourer.State;
|
||||
using ImGuiNET;
|
||||
using OtterGui;
|
||||
|
|
@ -16,19 +17,25 @@ public class SettingsTab : ITab
|
|||
private readonly Configuration _config;
|
||||
private readonly DesignFileSystemSelector _selector;
|
||||
private readonly StateListener _stateListener;
|
||||
private readonly PhrasingService _phrasingService;
|
||||
private readonly PenumbraAutoRedraw _autoRedraw;
|
||||
|
||||
public SettingsTab(Configuration config, DesignFileSystemSelector selector, StateListener stateListener, PenumbraAutoRedraw autoRedraw)
|
||||
public SettingsTab(Configuration config, DesignFileSystemSelector selector, StateListener stateListener,
|
||||
PhrasingService phrasingService, PenumbraAutoRedraw autoRedraw)
|
||||
{
|
||||
_config = config;
|
||||
_selector = selector;
|
||||
_stateListener = stateListener;
|
||||
_autoRedraw = autoRedraw;
|
||||
_config = config;
|
||||
_selector = selector;
|
||||
_stateListener = stateListener;
|
||||
_phrasingService = phrasingService;
|
||||
_autoRedraw = autoRedraw;
|
||||
}
|
||||
|
||||
public ReadOnlySpan<byte> Label
|
||||
=> "Settings"u8;
|
||||
|
||||
private string? _tmpPhrasing1 = null;
|
||||
private string? _tmpPhrasing2 = null;
|
||||
|
||||
public void DrawContent()
|
||||
{
|
||||
using var child = ImRaii.Child("MainWindowChild");
|
||||
|
|
@ -36,6 +43,8 @@ public class SettingsTab : ITab
|
|||
return;
|
||||
|
||||
Checkbox("Enabled", "Enable main functionality of keeping and applying state.", _stateListener.Enabled, _stateListener.Enable);
|
||||
Checkbox("Enable Auto Designs", "Enable the application of designs associated to characters to be applied automatically.",
|
||||
_config.EnableAutoDesigns, v => _config.EnableAutoDesigns = v);
|
||||
Checkbox("Restricted Gear Protection",
|
||||
"Use gender- and race-appropriate models when detecting certain items not available for a characters current gender and race.",
|
||||
_config.UseRestrictedGearProtection, v => _config.UseRestrictedGearProtection = v);
|
||||
|
|
@ -53,6 +62,24 @@ public class SettingsTab : ITab
|
|||
Checkbox("Debug Mode", "Show the debug tab. Only useful for debugging or advanced use.", _config.DebugMode, v => _config.DebugMode = v);
|
||||
DrawColorSettings();
|
||||
|
||||
_tmpPhrasing1 ??= _config.Phrasing1;
|
||||
ImGui.InputText("Phrasing 1", ref _tmpPhrasing1, 512);
|
||||
|
||||
if (ImGui.IsItemDeactivatedAfterEdit())
|
||||
{
|
||||
_phrasingService.SetPhrasing1(_tmpPhrasing1);
|
||||
_tmpPhrasing1 = null;
|
||||
}
|
||||
|
||||
_tmpPhrasing2 ??= _config.Phrasing2;
|
||||
ImGui.InputText("Phrasing 2", ref _tmpPhrasing2, 512);
|
||||
|
||||
if (ImGui.IsItemDeactivatedAfterEdit())
|
||||
{
|
||||
_phrasingService.SetPhrasing2(_tmpPhrasing2);
|
||||
_tmpPhrasing2 = null;
|
||||
}
|
||||
|
||||
MainWindow.DrawSupportButtons();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue