mirror of
https://github.com/Ottermandias/Glamourer.git
synced 2026-02-21 06:57:44 +01:00
deadsa
This commit is contained in:
parent
33c2ed7903
commit
e27a194cc6
47 changed files with 2037 additions and 1167 deletions
|
|
@ -1,6 +1,4 @@
|
|||
using System;
|
||||
using System.Linq;
|
||||
using System.Security.AccessControl;
|
||||
using Glamourer.Customization;
|
||||
using ImGuiNET;
|
||||
using OtterGui;
|
||||
|
|
|
|||
39
Glamourer/Gui/Designs/DesignFileSystemSelector.cs
Normal file
39
Glamourer/Gui/Designs/DesignFileSystemSelector.cs
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
using Glamourer.Designs;
|
||||
using OtterGui.FileSystem.Selector;
|
||||
|
||||
namespace Glamourer.Gui.Designs;
|
||||
|
||||
public sealed class DesignFileSystemSelector : FileSystemSelector<Design, DesignFileSystemSelector.DesignState>
|
||||
{
|
||||
private readonly Design.Manager _manager;
|
||||
|
||||
public struct DesignState
|
||||
{ }
|
||||
|
||||
public DesignFileSystemSelector(Design.Manager manager, DesignFileSystem fileSystem)
|
||||
: base(fileSystem, Dalamud.KeyState)
|
||||
{
|
||||
_manager = manager;
|
||||
_manager.DesignChange += OnDesignChange;
|
||||
}
|
||||
|
||||
public override void Dispose()
|
||||
{
|
||||
base.Dispose();
|
||||
_manager.DesignChange -= OnDesignChange;
|
||||
}
|
||||
|
||||
private void OnDesignChange(Design.Manager.DesignChangeType type, Design design, object? oldData)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case Design.Manager.DesignChangeType.ReloadedAll:
|
||||
case Design.Manager.DesignChangeType.Renamed:
|
||||
case Design.Manager.DesignChangeType.AddedTag:
|
||||
case Design.Manager.DesignChangeType.ChangedTag:
|
||||
case Design.Manager.DesignChangeType.RemovedTag:
|
||||
SetFilterDirty();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,6 +1,9 @@
|
|||
namespace Glamourer.Gui.Designs;
|
||||
|
||||
using Dalamud.Game.ClientState.Keys;
|
||||
using Glamourer.Designs;
|
||||
using OtterGui.Filesystem;
|
||||
using OtterGui.FileSystem.Selector;
|
||||
|
||||
namespace Glamourer.Gui.Designs;
|
||||
|
||||
//internal partial class Interface
|
||||
//{
|
||||
|
|
|
|||
|
|
@ -2,17 +2,16 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Dalamud.Interface;
|
||||
using Glamourer.Structs;
|
||||
using ImGuiNET;
|
||||
using Lumina.Excel.GeneratedSheets;
|
||||
using Lumina.Text;
|
||||
using OtterGui;
|
||||
using OtterGui.Classes;
|
||||
using OtterGui.Raii;
|
||||
using OtterGui.Widgets;
|
||||
using Penumbra.GameData;
|
||||
using Penumbra.GameData.Enums;
|
||||
using Penumbra.GameData.Structs;
|
||||
using Item = Glamourer.Structs.Item;
|
||||
|
||||
namespace Glamourer.Gui.Equipment;
|
||||
|
||||
|
|
@ -20,15 +19,15 @@ public partial class EquipmentDrawer
|
|||
{
|
||||
public const int ItemComboWidth = 320;
|
||||
|
||||
private sealed class ItemCombo : FilterComboBase<Item>
|
||||
private sealed class ItemCombo : FilterComboBase<Item2>
|
||||
{
|
||||
public readonly string Label;
|
||||
public readonly EquipSlot Slot;
|
||||
|
||||
public Lumina.Excel.GeneratedSheets.Item? LastItem;
|
||||
private CharacterArmor _lastArmor;
|
||||
private string _lastPreview = string.Empty;
|
||||
private int _lastIndex;
|
||||
public Item? LastItem;
|
||||
private CharacterArmor _lastArmor;
|
||||
private string _lastPreview = string.Empty;
|
||||
private int _lastIndex;
|
||||
|
||||
public ItemCombo(EquipSlot slot)
|
||||
: base(GetItems(slot), false)
|
||||
|
|
@ -37,7 +36,7 @@ public partial class EquipmentDrawer
|
|||
Slot = slot;
|
||||
}
|
||||
|
||||
protected override string ToString(Item obj)
|
||||
protected override string ToString(Item2 obj)
|
||||
=> obj.Name;
|
||||
|
||||
private static string GetLabel(EquipSlot slot)
|
||||
|
|
@ -78,21 +77,21 @@ public partial class EquipmentDrawer
|
|||
_lastPreview = _lastIndex >= 0 ? Items[_lastIndex].Name : LastItem.Name.ToString();
|
||||
}
|
||||
|
||||
private static IReadOnlyList<Item> GetItems(EquipSlot slot)
|
||||
=> GameData.ItemsBySlot(Dalamud.GameData).TryGetValue(slot, out var list) ? list : Array.Empty<Item>();
|
||||
private static IReadOnlyList<Item2> GetItems(EquipSlot slot)
|
||||
=> GameData.ItemsBySlot(Dalamud.GameData).TryGetValue(slot, out var list) ? list : Array.Empty<Item2>();
|
||||
}
|
||||
|
||||
private sealed class WeaponCombo : FilterComboBase<Item>
|
||||
private sealed class WeaponCombo : FilterComboBase<Item2>
|
||||
{
|
||||
public readonly string Label;
|
||||
public readonly EquipSlot Slot;
|
||||
|
||||
public Lumina.Excel.GeneratedSheets.Item? LastItem;
|
||||
private CharacterWeapon _lastWeapon = new(ulong.MaxValue);
|
||||
private string _lastPreview = string.Empty;
|
||||
private int _lastIndex;
|
||||
public FullEquipType LastCategory { get; private set; }
|
||||
private bool _drawAll;
|
||||
public Item? LastItem;
|
||||
private CharacterWeapon _lastWeapon = new(ulong.MaxValue);
|
||||
private string _lastPreview = string.Empty;
|
||||
private int _lastIndex;
|
||||
public FullEquipType LastCategory { get; private set; }
|
||||
private bool _drawAll;
|
||||
|
||||
public WeaponCombo(EquipSlot slot)
|
||||
: base(GetItems(slot), false)
|
||||
|
|
@ -101,7 +100,7 @@ public partial class EquipmentDrawer
|
|||
Slot = slot;
|
||||
}
|
||||
|
||||
protected override string ToString(Item obj)
|
||||
protected override string ToString(Item2 obj)
|
||||
=> obj.Name;
|
||||
|
||||
private static string GetLabel(EquipSlot slot)
|
||||
|
|
@ -124,7 +123,7 @@ public partial class EquipmentDrawer
|
|||
}
|
||||
|
||||
UpdateItem(weapon);
|
||||
UpdateCategory(((WeaponCategory) (LastItem!.ItemUICategory?.Row ?? 0)).ToEquipType());
|
||||
UpdateCategory(((WeaponCategory)(LastItem!.ItemUICategory?.Row ?? 0)).ToEquipType());
|
||||
newIdx = _lastIndex;
|
||||
return Draw(Label, _lastPreview, ref newIdx, ItemComboWidth * ImGuiHelpers.GlobalScale, ImGui.GetTextLineHeight());
|
||||
}
|
||||
|
|
@ -175,8 +174,8 @@ public partial class EquipmentDrawer
|
|||
ResetFilter();
|
||||
}
|
||||
|
||||
private static IReadOnlyList<Item> GetItems(EquipSlot slot)
|
||||
=> GameData.ItemsBySlot(Dalamud.GameData).TryGetValue(EquipSlot.MainHand, out var list) ? list : Array.Empty<Item>();
|
||||
private static IReadOnlyList<Item2> GetItems(EquipSlot slot)
|
||||
=> GameData.ItemsBySlot(Dalamud.GameData).TryGetValue(EquipSlot.MainHand, out var list) ? list : Array.Empty<Item2>();
|
||||
}
|
||||
|
||||
private static readonly IObjectIdentifier Identifier;
|
||||
|
|
@ -203,15 +202,15 @@ public partial class EquipmentDrawer
|
|||
UpdateActors();
|
||||
}
|
||||
|
||||
private static CharacterArmor ToArmor(Item item, StainId stain)
|
||||
private static CharacterArmor ToArmor(Item2 item2, StainId stain)
|
||||
{
|
||||
var (id, _, variant) = item.MainModel;
|
||||
var (id, _, variant) = item2.MainModel;
|
||||
return new CharacterArmor(id, (byte)variant, stain);
|
||||
}
|
||||
|
||||
private static CharacterWeapon ToWeapon(Item item, StainId stain)
|
||||
private static CharacterWeapon ToWeapon(Item2 item2, StainId stain)
|
||||
{
|
||||
var (id, type, variant) = item.MainModel;
|
||||
var (id, type, variant) = item2.MainModel;
|
||||
return new CharacterWeapon(id, type, variant, stain);
|
||||
}
|
||||
|
||||
|
|
@ -331,31 +330,31 @@ public partial class EquipmentDrawer
|
|||
//
|
||||
|
||||
|
||||
private static readonly Lumina.Excel.GeneratedSheets.Item SmallClothes = new()
|
||||
private static readonly Item SmallClothes = new()
|
||||
{
|
||||
Name = new SeString("Nothing"),
|
||||
RowId = 0,
|
||||
};
|
||||
|
||||
private static readonly Lumina.Excel.GeneratedSheets.Item SmallClothesNpc = new()
|
||||
private static readonly Item SmallClothesNpc = new()
|
||||
{
|
||||
Name = new SeString("Smallclothes (NPC)"),
|
||||
RowId = 1,
|
||||
};
|
||||
|
||||
private static readonly Lumina.Excel.GeneratedSheets.Item Unknown = new()
|
||||
private static readonly Item Unknown = new()
|
||||
{
|
||||
Name = new SeString("Unknown"),
|
||||
RowId = 2,
|
||||
};
|
||||
|
||||
private static Lumina.Excel.GeneratedSheets.Item Identify(SetId set, WeaponType weapon, ushort variant, EquipSlot slot)
|
||||
private static Item Identify(SetId set, WeaponType weapon, ushort variant, EquipSlot slot)
|
||||
{
|
||||
return (uint)set switch
|
||||
{
|
||||
0 => SmallClothes,
|
||||
9903 => SmallClothesNpc,
|
||||
_ => Identifier.Identify(set, weapon, variant, slot).FirstOrDefault(Unknown),
|
||||
_ => Identifier.Identify(set, weapon, variant, slot.ToSlot()).FirstOrDefault(Unknown),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,8 +17,8 @@ public enum ApplicationFlags
|
|||
|
||||
public partial class EquipmentDrawer
|
||||
{
|
||||
private static readonly FilterComboColors _stainCombo;
|
||||
private static readonly StainData _stainData;
|
||||
private static readonly FilterComboColors StainCombo;
|
||||
private static readonly StainData StainData;
|
||||
|
||||
private Race _race;
|
||||
private Gender _gender;
|
||||
|
|
@ -31,10 +31,10 @@ public partial class EquipmentDrawer
|
|||
|
||||
static EquipmentDrawer()
|
||||
{
|
||||
_stainData = new StainData(Dalamud.PluginInterface, Dalamud.GameData, Dalamud.GameData.Language);
|
||||
_stainCombo = new FilterComboColors(140,
|
||||
_stainData.Data.Prepend(new KeyValuePair<byte, (string Name, uint Dye, bool Gloss)>(0, ("None", 0, false))));
|
||||
Identifier = Glamourer.Identifier;
|
||||
StainData = Glamourer.Items.Stains;
|
||||
StainCombo = new FilterComboColors(140,
|
||||
StainData.Data.Prepend(new KeyValuePair<byte, (string Name, uint Dye, bool Gloss)>(0, ("None", 0, false))));
|
||||
Identifier = Glamourer.Items.Identifier;
|
||||
ItemCombos = EquipSlotExtensions.EqdpSlots.Select(s => new ItemCombo(s)).ToArray();
|
||||
MainHandCombo = new WeaponCombo(EquipSlot.MainHand);
|
||||
OffHandCombo = new WeaponCombo(EquipSlot.OffHand);
|
||||
|
|
@ -82,8 +82,8 @@ public partial class EquipmentDrawer
|
|||
|
||||
private void DrawStainCombo()
|
||||
{
|
||||
var found = _stainData.TryGetValue(_currentArmor.Stain, out var stain);
|
||||
_stainCombo.Draw("##stain", stain.RgbaColor, found);
|
||||
var found = StainData.TryGetValue(_currentArmor.Stain, out var stain);
|
||||
StainCombo.Draw("##stain", stain.RgbaColor, found);
|
||||
}
|
||||
|
||||
private void DrawInternal(ref CharacterWeapon mainHand, ref CharacterWeapon offHand)
|
||||
|
|
|
|||
|
|
@ -1,9 +1,6 @@
|
|||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Numerics;
|
||||
using Dalamud.Interface;
|
||||
using FFXIVClientStructs.FFXIV.Client.Graphics.Scene;
|
||||
using Glamourer.Gui.Customization;
|
||||
using Glamourer.Gui.Equipment;
|
||||
using Glamourer.Interop;
|
||||
|
|
@ -13,7 +10,6 @@ using OtterGui;
|
|||
using OtterGui.Classes;
|
||||
using OtterGui.Raii;
|
||||
using Penumbra.GameData.Actors;
|
||||
using Penumbra.GameData.Enums;
|
||||
using ImGui = ImGuiNET.ImGui;
|
||||
|
||||
namespace Glamourer.Gui;
|
||||
|
|
@ -30,7 +26,7 @@ internal partial class Interface
|
|||
private ActorIdentifier _identifier = ActorIdentifier.Invalid;
|
||||
private ObjectManager.ActorData _currentData = ObjectManager.ActorData.Invalid;
|
||||
private string _currentLabel = string.Empty;
|
||||
private CurrentDesign? _currentSave;
|
||||
private ActiveDesign? _currentSave;
|
||||
|
||||
public void Draw()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ internal partial class Interface
|
|||
|
||||
private LowerString _manipulationFilter = LowerString.Empty;
|
||||
private ActorIdentifier _selection = ActorIdentifier.Invalid;
|
||||
private CurrentDesign? _save = null;
|
||||
private ActiveDesign? _save = null;
|
||||
private bool _delete = false;
|
||||
|
||||
public DebugStateTab(CurrentManipulations currentManipulations)
|
||||
|
|
@ -73,14 +73,14 @@ internal partial class Interface
|
|||
DrawSelector(oldSpacing);
|
||||
}
|
||||
|
||||
private bool CheckFilter(KeyValuePair<ActorIdentifier, CurrentDesign> data)
|
||||
private bool CheckFilter(KeyValuePair<ActorIdentifier, ActiveDesign> data)
|
||||
{
|
||||
if (data.Key.Equals(_selection))
|
||||
_save = data.Value;
|
||||
return _manipulationFilter.Length == 0 || _manipulationFilter.IsContained(data.Key.ToString()!);
|
||||
}
|
||||
|
||||
private void DrawSelectable(KeyValuePair<ActorIdentifier, CurrentDesign> data)
|
||||
private void DrawSelectable(KeyValuePair<ActorIdentifier, ActiveDesign> data)
|
||||
{
|
||||
var equal = data.Key.Equals(_selection);
|
||||
if (ImGui.Selectable(data.Key.ToString(), equal))
|
||||
|
|
|
|||
64
Glamourer/Gui/Interface.DesignTab.cs
Normal file
64
Glamourer/Gui/Interface.DesignTab.cs
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
using System;
|
||||
using System.Numerics;
|
||||
using Dalamud.Interface;
|
||||
using Glamourer.Designs;
|
||||
using Glamourer.Gui.Customization;
|
||||
using Glamourer.Gui.Designs;
|
||||
using Glamourer.Gui.Equipment;
|
||||
using Glamourer.Interop;
|
||||
using ImGuiNET;
|
||||
using OtterGui.Raii;
|
||||
using Penumbra.GameData.Structs;
|
||||
|
||||
namespace Glamourer.Gui;
|
||||
|
||||
internal partial class Interface
|
||||
{
|
||||
private class DesignTab : IDisposable
|
||||
{
|
||||
public readonly DesignFileSystemSelector Selector;
|
||||
private readonly DesignFileSystem _fileSystem;
|
||||
private readonly Design.Manager _manager;
|
||||
|
||||
public DesignTab(Design.Manager manager, DesignFileSystem fileSystem)
|
||||
{
|
||||
_manager = manager;
|
||||
_fileSystem = fileSystem;
|
||||
Selector = new DesignFileSystemSelector(manager, fileSystem);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
=> Selector.Dispose();
|
||||
|
||||
public void Draw()
|
||||
{
|
||||
using var tab = ImRaii.TabItem("Designs");
|
||||
if (!tab)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Selector.Draw(GetDesignSelectorSize());
|
||||
ImGui.SameLine();
|
||||
DrawDesignPanel();
|
||||
}
|
||||
|
||||
public float GetDesignSelectorSize()
|
||||
=> 200f * ImGuiHelpers.GlobalScale;
|
||||
|
||||
public void DrawDesignPanel()
|
||||
{
|
||||
using var child = ImRaii.Child("##DesignPanel", new Vector2(-0.001f), true, ImGuiWindowFlags.HorizontalScrollbar);
|
||||
if (!child || Selector.Selected == null)
|
||||
return;
|
||||
|
||||
CustomizationDrawer.Draw(Selector.Selected.Customize(), Selector.Selected.Equipment(), true);
|
||||
var weapon = Selector.Selected.WeaponMain;
|
||||
var mw = new CharacterWeapon(weapon.ModelBase, weapon.WeaponBase, weapon.Variant, weapon.Stain);
|
||||
weapon = Selector.Selected.WeaponOff;
|
||||
var ow = new CharacterWeapon(weapon.ModelBase, weapon.WeaponBase, weapon.Variant, weapon.Stain);
|
||||
ApplicationFlags f = 0;
|
||||
EquipmentDrawer.Draw(Selector.Selected.Customize(), Selector.Selected.Equipment(), ref mw, ref ow, ref f, Array.Empty<Actor>(), true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,5 +1,4 @@
|
|||
using System;
|
||||
using System.Numerics;
|
||||
using Glamourer.State;
|
||||
using ImGuiNET;
|
||||
using OtterGui;
|
||||
|
|
|
|||
|
|
@ -3,7 +3,9 @@ using System.Linq;
|
|||
using System.Numerics;
|
||||
using Dalamud.Interface.Windowing;
|
||||
using Dalamud.Logging;
|
||||
using Glamourer.Designs;
|
||||
using Glamourer.Gui.Customization;
|
||||
using Glamourer.State;
|
||||
using ImGuiNET;
|
||||
using OtterGui.Raii;
|
||||
|
||||
|
|
@ -11,16 +13,14 @@ namespace Glamourer.Gui;
|
|||
|
||||
internal partial class Interface : Window, IDisposable
|
||||
{
|
||||
private readonly Glamourer _plugin;
|
||||
|
||||
private readonly ActorTab _actorTab;
|
||||
private readonly DesignTab _designTab;
|
||||
private readonly DebugStateTab _debugStateTab;
|
||||
private readonly DebugDataTab _debugDataTab;
|
||||
|
||||
public Interface(Glamourer plugin)
|
||||
public Interface(CurrentManipulations manipulations, Design.Manager manager, DesignFileSystem fileSystem)
|
||||
: base(GetLabel())
|
||||
{
|
||||
_plugin = plugin;
|
||||
Dalamud.PluginInterface.UiBuilder.DisableGposeUiHide = true;
|
||||
Dalamud.PluginInterface.UiBuilder.OpenConfigUi += Toggle;
|
||||
SizeConstraints = new WindowSizeConstraints()
|
||||
|
|
@ -28,9 +28,10 @@ internal partial class Interface : Window, IDisposable
|
|||
MinimumSize = new Vector2(675, 675),
|
||||
MaximumSize = ImGui.GetIO().DisplaySize,
|
||||
};
|
||||
_actorTab = new ActorTab(_plugin.CurrentManipulations);
|
||||
_debugStateTab = new DebugStateTab(_plugin.CurrentManipulations);
|
||||
_actorTab = new ActorTab(manipulations);
|
||||
_debugStateTab = new DebugStateTab(manipulations);
|
||||
_debugDataTab = new DebugDataTab(Glamourer.Customization);
|
||||
_designTab = new DesignTab(manager, fileSystem);
|
||||
}
|
||||
|
||||
public override void Draw()
|
||||
|
|
@ -44,6 +45,7 @@ internal partial class Interface : Window, IDisposable
|
|||
UpdateState();
|
||||
|
||||
_actorTab.Draw();
|
||||
_designTab.Draw();
|
||||
DrawSettingsTab();
|
||||
_debugStateTab.Draw();
|
||||
_debugDataTab.Draw();
|
||||
|
|
@ -61,6 +63,7 @@ internal partial class Interface : Window, IDisposable
|
|||
{
|
||||
Dalamud.PluginInterface.UiBuilder.OpenConfigUi -= Toggle;
|
||||
CustomizationDrawer.Dispose();
|
||||
_designTab.Dispose();
|
||||
}
|
||||
|
||||
private static string GetLabel()
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ using System.Reflection;
|
|||
using ImGuiNET;
|
||||
using Penumbra.GameData.Enums;
|
||||
using Lumina.Excel.GeneratedSheets;
|
||||
using Item = Glamourer.Structs.Item;
|
||||
|
||||
namespace Glamourer.Gui;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue