mirror of
https://github.com/goatcorp/Dalamud.git
synced 2026-02-25 14:11:48 +01:00
Apply ImRaii to multiple widgets
This commit is contained in:
parent
9538af0554
commit
17a054fa1b
24 changed files with 378 additions and 452 deletions
|
|
@ -2,7 +2,6 @@ using System.Linq;
|
||||||
|
|
||||||
using Dalamud.Bindings.ImGui;
|
using Dalamud.Bindings.ImGui;
|
||||||
using Dalamud.Game.Command;
|
using Dalamud.Game.Command;
|
||||||
using Dalamud.Interface.Utility;
|
|
||||||
using Dalamud.Interface.Utility.Raii;
|
using Dalamud.Interface.Utility.Raii;
|
||||||
|
|
||||||
namespace Dalamud.Interface.Internal.Windows.Data.Widgets;
|
namespace Dalamud.Interface.Internal.Windows.Data.Widgets;
|
||||||
|
|
@ -12,8 +11,12 @@ namespace Dalamud.Interface.Internal.Windows.Data.Widgets;
|
||||||
/// </summary>
|
/// </summary>
|
||||||
internal class CommandWidget : IDataWindowWidget
|
internal class CommandWidget : IDataWindowWidget
|
||||||
{
|
{
|
||||||
|
private const ImGuiTableFlags TableFlags = ImGuiTableFlags.ScrollY | ImGuiTableFlags.Borders |
|
||||||
|
ImGuiTableFlags.SizingStretchProp | ImGuiTableFlags.Sortable |
|
||||||
|
ImGuiTableFlags.SortTristate;
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public string[]? CommandShortcuts { get; init; } = { "command" };
|
public string[]? CommandShortcuts { get; init; } = ["command"];
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public string DisplayName { get; init; } = "Command";
|
public string DisplayName { get; init; } = "Command";
|
||||||
|
|
@ -32,9 +35,7 @@ internal class CommandWidget : IDataWindowWidget
|
||||||
{
|
{
|
||||||
var commandManager = Service<CommandManager>.Get();
|
var commandManager = Service<CommandManager>.Get();
|
||||||
|
|
||||||
var tableFlags = ImGuiTableFlags.ScrollY | ImGuiTableFlags.Borders | ImGuiTableFlags.SizingStretchProp |
|
using var table = ImRaii.Table("CommandList"u8, 4, TableFlags);
|
||||||
ImGuiTableFlags.Sortable | ImGuiTableFlags.SortTristate;
|
|
||||||
using var table = ImRaii.Table("CommandList"u8, 4, tableFlags);
|
|
||||||
if (table)
|
if (table)
|
||||||
{
|
{
|
||||||
ImGui.TableSetupScrollFreeze(0, 1);
|
ImGui.TableSetupScrollFreeze(0, 1);
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ internal class ConditionWidget : IDataWindowWidget
|
||||||
public bool Ready { get; set; }
|
public bool Ready { get; set; }
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public string[]? CommandShortcuts { get; init; } = { "condition" };
|
public string[]? CommandShortcuts { get; init; } = ["condition"];
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public string DisplayName { get; init; } = "Condition";
|
public string DisplayName { get; init; } = "Condition";
|
||||||
|
|
|
||||||
|
|
@ -9,10 +9,10 @@ namespace Dalamud.Interface.Internal.Windows.Data.Widgets;
|
||||||
internal class ConfigurationWidget : IDataWindowWidget
|
internal class ConfigurationWidget : IDataWindowWidget
|
||||||
{
|
{
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public string[]? CommandShortcuts { get; init; } = { "config", "configuration" };
|
public string[]? CommandShortcuts { get; init; } = ["config", "configuration"];
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public string DisplayName { get; init; } = "Configuration";
|
public string DisplayName { get; init; } = "Configuration";
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public bool Ready { get; set; }
|
public bool Ready { get; set; }
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics.CodeAnalysis;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Numerics;
|
using System.Numerics;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
|
@ -20,21 +19,17 @@ namespace Dalamud.Interface.Internal.Windows.Data.Widgets;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Widget for displaying plugin data share modules.
|
/// Widget for displaying plugin data share modules.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[SuppressMessage(
|
|
||||||
"StyleCop.CSharp.LayoutRules",
|
|
||||||
"SA1519:Braces should not be omitted from multi-line child statement",
|
|
||||||
Justification = "Multiple fixed blocks")]
|
|
||||||
internal class DataShareWidget : IDataWindowWidget
|
internal class DataShareWidget : IDataWindowWidget
|
||||||
{
|
{
|
||||||
private const ImGuiTabItemFlags NoCloseButton = (ImGuiTabItemFlags)(1 << 20);
|
private const ImGuiTabItemFlags NoCloseButton = (ImGuiTabItemFlags)ImGuiTabItemFlagsPrivate.NoCloseButton;
|
||||||
|
|
||||||
private readonly List<(string Name, byte[]? Data)> dataView = new();
|
private readonly List<(string Name, byte[]? Data)> dataView = [];
|
||||||
private int nextTab = -1;
|
private int nextTab = -1;
|
||||||
private IReadOnlyDictionary<string, CallGateChannel>? gates;
|
private IReadOnlyDictionary<string, CallGateChannel>? gates;
|
||||||
private List<CallGateChannel>? gatesSorted;
|
private List<CallGateChannel>? gatesSorted;
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public string[]? CommandShortcuts { get; init; } = { "datashare" };
|
public string[]? CommandShortcuts { get; init; } = ["datashare"];
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public string DisplayName { get; init; } = "Data Share & Call Gate";
|
public string DisplayName { get; init; } = "Data Share & Call Gate";
|
||||||
|
|
@ -49,42 +44,37 @@ internal class DataShareWidget : IDataWindowWidget
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public unsafe void Draw()
|
public void Draw()
|
||||||
{
|
{
|
||||||
using var tabbar = ImRaii.TabBar("##tabbar"u8);
|
using var tabbar = ImRaii.TabBar("##tabbar"u8);
|
||||||
if (!tabbar.Success)
|
if (!tabbar.Success)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var d = true;
|
var d = true;
|
||||||
using (var tabitem = ImRaii.TabItem(
|
using (var tabItem = ImRaii.TabItem("Data Share##tabbar-datashare"u8, ref d, NoCloseButton | (this.nextTab == 0 ? ImGuiTabItemFlags.SetSelected : 0)))
|
||||||
"Data Share##tabbar-datashare"u8,
|
|
||||||
ref d,
|
|
||||||
NoCloseButton | (this.nextTab == 0 ? ImGuiTabItemFlags.SetSelected : 0)))
|
|
||||||
{
|
{
|
||||||
if (tabitem.Success)
|
if (tabItem.Success)
|
||||||
this.DrawDataShare();
|
this.DrawDataShare();
|
||||||
}
|
}
|
||||||
|
|
||||||
using (var tabitem = ImRaii.TabItem(
|
using (var tabItem = ImRaii.TabItem("Call Gate##tabbar-callgate"u8, ref d, NoCloseButton | (this.nextTab == 1 ? ImGuiTabItemFlags.SetSelected : 0)))
|
||||||
"Call Gate##tabbar-callgate"u8,
|
|
||||||
ref d,
|
|
||||||
NoCloseButton | (this.nextTab == 1 ? ImGuiTabItemFlags.SetSelected : 0)))
|
|
||||||
{
|
{
|
||||||
if (tabitem.Success)
|
if (tabItem.Success)
|
||||||
this.DrawCallGate();
|
this.DrawCallGate();
|
||||||
}
|
}
|
||||||
|
|
||||||
for (var i = 0; i < this.dataView.Count; i++)
|
for (var i = 0; i < this.dataView.Count; i++)
|
||||||
{
|
{
|
||||||
using var idpush = ImRaii.PushId($"##tabbar-data-{i}");
|
using var idpush = ImRaii.PushId($"##tabbar-data-{i}");
|
||||||
|
|
||||||
var (name, data) = this.dataView[i];
|
var (name, data) = this.dataView[i];
|
||||||
d = true;
|
d = true;
|
||||||
using var tabitem = ImRaii.TabItem(
|
|
||||||
name,
|
using var tabitem = ImRaii.TabItem(name, ref d, this.nextTab == 2 + i ? ImGuiTabItemFlags.SetSelected : 0);
|
||||||
ref d,
|
|
||||||
this.nextTab == 2 + i ? ImGuiTabItemFlags.SetSelected : 0);
|
|
||||||
if (!d)
|
if (!d)
|
||||||
this.dataView.RemoveAt(i--);
|
this.dataView.RemoveAt(i--);
|
||||||
|
|
||||||
if (!tabitem.Success)
|
if (!tabitem.Success)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
|
@ -122,11 +112,7 @@ internal class DataShareWidget : IDataWindowWidget
|
||||||
if (ImGui.Button("Copy"u8))
|
if (ImGui.Button("Copy"u8))
|
||||||
ImGui.SetClipboardText(data);
|
ImGui.SetClipboardText(data);
|
||||||
|
|
||||||
ImGui.InputTextMultiline(
|
ImGui.InputTextMultiline("text"u8, data, ImGui.GetContentRegionAvail(), ImGuiInputTextFlags.ReadOnly);
|
||||||
"text"u8,
|
|
||||||
data,
|
|
||||||
ImGui.GetContentRegionAvail(),
|
|
||||||
ImGuiInputTextFlags.ReadOnly);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this.nextTab = -1;
|
this.nextTab = -1;
|
||||||
|
|
@ -141,8 +127,10 @@ internal class DataShareWidget : IDataWindowWidget
|
||||||
sb.Append(ReprType(mi.DeclaringType))
|
sb.Append(ReprType(mi.DeclaringType))
|
||||||
.Append("::")
|
.Append("::")
|
||||||
.Append(mi.Name);
|
.Append(mi.Name);
|
||||||
|
|
||||||
if (!withParams)
|
if (!withParams)
|
||||||
return sb.ToString();
|
return sb.ToString();
|
||||||
|
|
||||||
sb.Append('(');
|
sb.Append('(');
|
||||||
var parfirst = true;
|
var parfirst = true;
|
||||||
foreach (var par in mi.GetParameters())
|
foreach (var par in mi.GetParameters())
|
||||||
|
|
@ -151,6 +139,7 @@ internal class DataShareWidget : IDataWindowWidget
|
||||||
sb.Append(", ");
|
sb.Append(", ");
|
||||||
else
|
else
|
||||||
parfirst = false;
|
parfirst = false;
|
||||||
|
|
||||||
sb.AppendLine()
|
sb.AppendLine()
|
||||||
.Append('\t')
|
.Append('\t')
|
||||||
.Append(ReprType(par.ParameterType))
|
.Append(ReprType(par.ParameterType))
|
||||||
|
|
@ -160,9 +149,11 @@ internal class DataShareWidget : IDataWindowWidget
|
||||||
|
|
||||||
if (!parfirst)
|
if (!parfirst)
|
||||||
sb.AppendLine();
|
sb.AppendLine();
|
||||||
|
|
||||||
sb.Append(')');
|
sb.Append(')');
|
||||||
if (mi.ReturnType != typeof(void))
|
if (mi.ReturnType != typeof(void))
|
||||||
sb.Append(" -> ").Append(ReprType(mi.ReturnType));
|
sb.Append(" -> ").Append(ReprType(mi.ReturnType));
|
||||||
|
|
||||||
return sb.ToString();
|
return sb.ToString();
|
||||||
|
|
||||||
static string WithoutGeneric(string s)
|
static string WithoutGeneric(string s)
|
||||||
|
|
@ -171,8 +162,7 @@ internal class DataShareWidget : IDataWindowWidget
|
||||||
return i != -1 ? s[..i] : s;
|
return i != -1 ? s[..i] : s;
|
||||||
}
|
}
|
||||||
|
|
||||||
static string ReprType(Type? t) =>
|
static string ReprType(Type? t) => t switch
|
||||||
t switch
|
|
||||||
{
|
{
|
||||||
null => "null",
|
null => "null",
|
||||||
_ when t == typeof(string) => "string",
|
_ when t == typeof(string) => "string",
|
||||||
|
|
@ -214,18 +204,19 @@ internal class DataShareWidget : IDataWindowWidget
|
||||||
var offset = ImGui.GetCursorScreenPos() + new Vector2(0, framepad ? ImGui.GetStyle().FramePadding.Y : 0);
|
var offset = ImGui.GetCursorScreenPos() + new Vector2(0, framepad ? ImGui.GetStyle().FramePadding.Y : 0);
|
||||||
if (framepad)
|
if (framepad)
|
||||||
ImGui.AlignTextToFramePadding();
|
ImGui.AlignTextToFramePadding();
|
||||||
|
|
||||||
ImGui.Text(s);
|
ImGui.Text(s);
|
||||||
if (ImGui.IsItemHovered())
|
if (ImGui.IsItemHovered())
|
||||||
{
|
{
|
||||||
ImGui.SetNextWindowPos(offset - ImGui.GetStyle().WindowPadding);
|
ImGui.SetNextWindowPos(offset - ImGui.GetStyle().WindowPadding);
|
||||||
var vp = ImGui.GetWindowViewport();
|
var vp = ImGui.GetWindowViewport();
|
||||||
var wrx = (vp.WorkPos.X + vp.WorkSize.X) - offset.X;
|
var wrx = (vp.WorkPos.X + vp.WorkSize.X) - offset.X;
|
||||||
|
|
||||||
ImGui.SetNextWindowSizeConstraints(Vector2.One, new(wrx, float.MaxValue));
|
ImGui.SetNextWindowSizeConstraints(Vector2.One, new(wrx, float.MaxValue));
|
||||||
using (ImRaii.Tooltip())
|
using (ImRaii.Tooltip())
|
||||||
{
|
{
|
||||||
ImGui.PushTextWrapPos(wrx);
|
using var pushedWrap = ImRaii.TextWrapPos(wrx);
|
||||||
ImGui.TextWrapped(tooltip?.Invoke() ?? s);
|
ImGui.TextWrapped(tooltip?.Invoke() ?? s);
|
||||||
ImGui.PopTextWrapPos();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -246,6 +237,9 @@ internal class DataShareWidget : IDataWindowWidget
|
||||||
callGate.PurgeEmptyGates();
|
callGate.PurgeEmptyGates();
|
||||||
|
|
||||||
using var table = ImRaii.Table("##callgate-table"u8, 5);
|
using var table = ImRaii.Table("##callgate-table"u8, 5);
|
||||||
|
if (!table.Success)
|
||||||
|
return;
|
||||||
|
|
||||||
ImGui.TableSetupColumn("Name"u8, ImGuiTableColumnFlags.DefaultSort);
|
ImGui.TableSetupColumn("Name"u8, ImGuiTableColumnFlags.DefaultSort);
|
||||||
ImGui.TableSetupColumn("Action"u8);
|
ImGui.TableSetupColumn("Action"u8);
|
||||||
ImGui.TableSetupColumn("Func"u8);
|
ImGui.TableSetupColumn("Func"u8);
|
||||||
|
|
@ -267,12 +261,8 @@ internal class DataShareWidget : IDataWindowWidget
|
||||||
{
|
{
|
||||||
ImGui.TableNextRow();
|
ImGui.TableNextRow();
|
||||||
this.DrawTextCell(item.Name);
|
this.DrawTextCell(item.Name);
|
||||||
this.DrawTextCell(
|
this.DrawTextCell(ReprMethod(item.Action?.Method, false), () => ReprMethod(item.Action?.Method, true));
|
||||||
ReprMethod(item.Action?.Method, false),
|
this.DrawTextCell(ReprMethod(item.Func?.Method, false), () => ReprMethod(item.Func?.Method, true));
|
||||||
() => ReprMethod(item.Action?.Method, true));
|
|
||||||
this.DrawTextCell(
|
|
||||||
ReprMethod(item.Func?.Method, false),
|
|
||||||
() => ReprMethod(item.Func?.Method, true));
|
|
||||||
if (subs.Count == 0)
|
if (subs.Count == 0)
|
||||||
{
|
{
|
||||||
this.DrawTextCell("0");
|
this.DrawTextCell("0");
|
||||||
|
|
@ -287,47 +277,43 @@ internal class DataShareWidget : IDataWindowWidget
|
||||||
|
|
||||||
private void DrawDataShare()
|
private void DrawDataShare()
|
||||||
{
|
{
|
||||||
if (!ImGui.BeginTable("###DataShareTable"u8, 5, ImGuiTableFlags.SizingFixedFit | ImGuiTableFlags.RowBg))
|
using var table = ImRaii.Table("###DataShareTable"u8, 5, ImGuiTableFlags.SizingFixedFit | ImGuiTableFlags.RowBg);
|
||||||
|
if (!table.Success)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
try
|
ImGui.TableSetupColumn("Shared Tag"u8);
|
||||||
|
ImGui.TableSetupColumn("Show"u8);
|
||||||
|
ImGui.TableSetupColumn("Creator Assembly"u8);
|
||||||
|
ImGui.TableSetupColumn("#"u8, ImGuiTableColumnFlags.WidthFixed, 30 * ImGuiHelpers.GlobalScale);
|
||||||
|
ImGui.TableSetupColumn("Consumers"u8);
|
||||||
|
ImGui.TableHeadersRow();
|
||||||
|
|
||||||
|
foreach (var share in Service<DataShare>.Get().GetAllShares())
|
||||||
{
|
{
|
||||||
ImGui.TableSetupColumn("Shared Tag"u8);
|
ImGui.TableNextRow();
|
||||||
ImGui.TableSetupColumn("Show"u8);
|
this.DrawTextCell(share.Tag, null, true);
|
||||||
ImGui.TableSetupColumn("Creator Assembly"u8);
|
|
||||||
ImGui.TableSetupColumn("#"u8, ImGuiTableColumnFlags.WidthFixed, 30 * ImGuiHelpers.GlobalScale);
|
ImGui.TableNextColumn();
|
||||||
ImGui.TableSetupColumn("Consumers"u8);
|
if (ImGui.Button($"Show##datasharetable-show-{share.Tag}"))
|
||||||
ImGui.TableHeadersRow();
|
|
||||||
foreach (var share in Service<DataShare>.Get().GetAllShares())
|
|
||||||
{
|
{
|
||||||
ImGui.TableNextRow();
|
var index = 0;
|
||||||
this.DrawTextCell(share.Tag, null, true);
|
for (; index < this.dataView.Count; index++)
|
||||||
|
|
||||||
ImGui.TableNextColumn();
|
|
||||||
if (ImGui.Button($"Show##datasharetable-show-{share.Tag}"))
|
|
||||||
{
|
{
|
||||||
var index = 0;
|
if (this.dataView[index].Name == share.Tag)
|
||||||
for (; index < this.dataView.Count; index++)
|
break;
|
||||||
{
|
|
||||||
if (this.dataView[index].Name == share.Tag)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (index == this.dataView.Count)
|
|
||||||
this.dataView.Add((share.Tag, null));
|
|
||||||
else
|
|
||||||
this.dataView[index] = (share.Tag, null);
|
|
||||||
this.nextTab = 2 + index;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this.DrawTextCell(share.CreatorAssembly, null, true);
|
if (index == this.dataView.Count)
|
||||||
this.DrawTextCell(share.Users.Length.ToString(), null, true);
|
this.dataView.Add((share.Tag, null));
|
||||||
this.DrawTextCell(string.Join(", ", share.Users), null, true);
|
else
|
||||||
|
this.dataView[index] = (share.Tag, null);
|
||||||
|
|
||||||
|
this.nextTab = 2 + index;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
finally
|
this.DrawTextCell(share.CreatorAssembly, null, true);
|
||||||
{
|
this.DrawTextCell(share.Users.Length.ToString(), null, true);
|
||||||
ImGui.EndTable();
|
this.DrawTextCell(string.Join(", ", share.Users), null, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ internal class DtrBarWidget : IDataWindowWidget, IDisposable
|
||||||
private CancellationTokenSource? loadTestThreadCt;
|
private CancellationTokenSource? loadTestThreadCt;
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public string[]? CommandShortcuts { get; init; } = { "dtr", "dtrbar" };
|
public string[]? CommandShortcuts { get; init; } = ["dtr", "dtrbar"];
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public string DisplayName { get; init; } = "DTR Bar";
|
public string DisplayName { get; init; } = "DTR Bar";
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
using Dalamud.Bindings.ImGui;
|
using Dalamud.Bindings.ImGui;
|
||||||
using Dalamud.Game.ClientState.Fates;
|
using Dalamud.Game.ClientState.Fates;
|
||||||
using Dalamud.Interface.Textures.Internal;
|
using Dalamud.Interface.Textures.Internal;
|
||||||
using Dalamud.Interface.Utility;
|
|
||||||
using Dalamud.Interface.Utility.Raii;
|
using Dalamud.Interface.Utility.Raii;
|
||||||
|
|
||||||
namespace Dalamud.Interface.Internal.Windows.Data.Widgets;
|
namespace Dalamud.Interface.Internal.Windows.Data.Widgets;
|
||||||
|
|
@ -11,8 +10,11 @@ namespace Dalamud.Interface.Internal.Windows.Data.Widgets;
|
||||||
/// </summary>
|
/// </summary>
|
||||||
internal class FateTableWidget : IDataWindowWidget
|
internal class FateTableWidget : IDataWindowWidget
|
||||||
{
|
{
|
||||||
|
private const ImGuiTableFlags TableFlags = ImGuiTableFlags.ScrollY | ImGuiTableFlags.RowBg |
|
||||||
|
ImGuiTableFlags.Borders | ImGuiTableFlags.NoSavedSettings;
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public string[]? CommandShortcuts { get; init; } = { "fate", "fatetable" };
|
public string[]? CommandShortcuts { get; init; } = ["fate", "fatetable"];
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public string DisplayName { get; init; } = "Fate Table";
|
public string DisplayName { get; init; } = "Fate Table";
|
||||||
|
|
@ -38,7 +40,7 @@ internal class FateTableWidget : IDataWindowWidget
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
using var table = ImRaii.Table("FateTable"u8, 13, ImGuiTableFlags.ScrollY | ImGuiTableFlags.RowBg | ImGuiTableFlags.Borders | ImGuiTableFlags.NoSavedSettings);
|
using var table = ImRaii.Table("FateTable"u8, 13, TableFlags);
|
||||||
if (!table) return;
|
if (!table) return;
|
||||||
|
|
||||||
ImGui.TableSetupColumn("Index"u8, ImGuiTableColumnFlags.WidthFixed, 40);
|
ImGui.TableSetupColumn("Index"u8, ImGuiTableColumnFlags.WidthFixed, 40);
|
||||||
|
|
@ -98,11 +100,11 @@ internal class FateTableWidget : IDataWindowWidget
|
||||||
if (ImGui.IsItemHovered())
|
if (ImGui.IsItemHovered())
|
||||||
{
|
{
|
||||||
ImGui.SetMouseCursor(ImGuiMouseCursor.Hand);
|
ImGui.SetMouseCursor(ImGuiMouseCursor.Hand);
|
||||||
ImGui.BeginTooltip();
|
|
||||||
|
using var tooltip = ImRaii.Tooltip();
|
||||||
ImGui.Text("Click to copy IconId"u8);
|
ImGui.Text("Click to copy IconId"u8);
|
||||||
ImGui.Text($"ID: {fate.IconId} – Size: {texture.Width}x{texture.Height}");
|
ImGui.Text($"ID: {fate.IconId} – Size: {texture.Width}x{texture.Height}");
|
||||||
ImGui.Image(texture.Handle, new(texture.Width, texture.Height));
|
ImGui.Image(texture.Handle, new(texture.Width, texture.Height));
|
||||||
ImGui.EndTooltip();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ImGui.IsItemClicked())
|
if (ImGui.IsItemClicked())
|
||||||
|
|
@ -123,11 +125,11 @@ internal class FateTableWidget : IDataWindowWidget
|
||||||
if (ImGui.IsItemHovered())
|
if (ImGui.IsItemHovered())
|
||||||
{
|
{
|
||||||
ImGui.SetMouseCursor(ImGuiMouseCursor.Hand);
|
ImGui.SetMouseCursor(ImGuiMouseCursor.Hand);
|
||||||
ImGui.BeginTooltip();
|
|
||||||
|
using var tooltip = ImRaii.Tooltip();
|
||||||
ImGui.Text("Click to copy MapIconId"u8);
|
ImGui.Text("Click to copy MapIconId"u8);
|
||||||
ImGui.Text($"ID: {fate.MapIconId} – Size: {texture.Width}x{texture.Height}");
|
ImGui.Text($"ID: {fate.MapIconId} – Size: {texture.Width}x{texture.Height}");
|
||||||
ImGui.Image(texture.Handle, new(texture.Width, texture.Height));
|
ImGui.Image(texture.Handle, new(texture.Width, texture.Height));
|
||||||
ImGui.EndTooltip();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ImGui.IsItemClicked())
|
if (ImGui.IsItemClicked())
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ using System.Numerics;
|
||||||
|
|
||||||
using Dalamud.Bindings.ImGui;
|
using Dalamud.Bindings.ImGui;
|
||||||
using Dalamud.Game.Gui.FlyText;
|
using Dalamud.Game.Gui.FlyText;
|
||||||
|
using Dalamud.Interface.Utility.Raii;
|
||||||
|
|
||||||
namespace Dalamud.Interface.Internal.Windows.Data.Widgets;
|
namespace Dalamud.Interface.Internal.Windows.Data.Widgets;
|
||||||
|
|
||||||
|
|
@ -22,7 +23,7 @@ internal class FlyTextWidget : IDataWindowWidget
|
||||||
private Vector4 flyColor = new(1, 0, 0, 1);
|
private Vector4 flyColor = new(1, 0, 0, 1);
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public string[]? CommandShortcuts { get; init; } = { "flytext" };
|
public string[]? CommandShortcuts { get; init; } = ["flytext"];
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public string DisplayName { get; init; } = "Fly Text";
|
public string DisplayName { get; init; } = "Fly Text";
|
||||||
|
|
@ -39,18 +40,18 @@ internal class FlyTextWidget : IDataWindowWidget
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public void Draw()
|
public void Draw()
|
||||||
{
|
{
|
||||||
if (ImGui.BeginCombo("Kind"u8, $"{this.flyKind} ({(int)this.flyKind})"))
|
using (var combo = ImRaii.Combo("Kind"u8, $"{this.flyKind} ({(int)this.flyKind})"))
|
||||||
{
|
{
|
||||||
var values = Enum.GetValues<FlyTextKind>().Distinct();
|
if (combo.Success)
|
||||||
foreach (var value in values)
|
|
||||||
{
|
{
|
||||||
if (ImGui.Selectable($"{value} ({(int)value})"))
|
foreach (var value in Enum.GetValues<FlyTextKind>().Distinct())
|
||||||
{
|
{
|
||||||
this.flyKind = value;
|
if (ImGui.Selectable($"{value} ({(int)value})"))
|
||||||
|
{
|
||||||
|
this.flyKind = value;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui.EndCombo();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui.InputText("Text1"u8, ref this.flyText1, 200);
|
ImGui.InputText("Text1"u8, ref this.flyText1, 200);
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,6 @@ using System.Collections.Generic;
|
||||||
using System.Collections.Immutable;
|
using System.Collections.Immutable;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Numerics;
|
using System.Numerics;
|
||||||
using System.Runtime.CompilerServices;
|
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
|
@ -14,6 +13,7 @@ using Dalamud.Interface.ImGuiFontChooserDialog;
|
||||||
using Dalamud.Interface.ManagedFontAtlas;
|
using Dalamud.Interface.ManagedFontAtlas;
|
||||||
using Dalamud.Interface.ManagedFontAtlas.Internals;
|
using Dalamud.Interface.ManagedFontAtlas.Internals;
|
||||||
using Dalamud.Interface.Utility;
|
using Dalamud.Interface.Utility;
|
||||||
|
using Dalamud.Interface.Utility.Raii;
|
||||||
using Dalamud.Utility;
|
using Dalamud.Utility;
|
||||||
using Serilog;
|
using Serilog;
|
||||||
|
|
||||||
|
|
@ -25,11 +25,11 @@ namespace Dalamud.Interface.Internal.Windows.Data.Widgets;
|
||||||
internal class GamePrebakedFontsTestWidget : IDataWindowWidget, IDisposable
|
internal class GamePrebakedFontsTestWidget : IDataWindowWidget, IDisposable
|
||||||
{
|
{
|
||||||
private static readonly string[] FontScaleModes =
|
private static readonly string[] FontScaleModes =
|
||||||
{
|
[
|
||||||
nameof(FontScaleMode.Default),
|
nameof(FontScaleMode.Default),
|
||||||
nameof(FontScaleMode.SkipHandling),
|
nameof(FontScaleMode.SkipHandling),
|
||||||
nameof(FontScaleMode.UndoGlobalScale),
|
nameof(FontScaleMode.UndoGlobalScale)
|
||||||
};
|
];
|
||||||
|
|
||||||
private ImVectorWrapper<byte> testStringBuffer;
|
private ImVectorWrapper<byte> testStringBuffer;
|
||||||
private IFontAtlas? privateAtlas;
|
private IFontAtlas? privateAtlas;
|
||||||
|
|
@ -248,7 +248,8 @@ internal class GamePrebakedFontsTestWidget : IDataWindowWidget, IDisposable
|
||||||
{
|
{
|
||||||
ImGui.Text($"{gfs.SizePt}pt");
|
ImGui.Text($"{gfs.SizePt}pt");
|
||||||
ImGui.SameLine(offsetX);
|
ImGui.SameLine(offsetX);
|
||||||
ImGui.PushTextWrapPos(this.useWordWrap ? 0f : -1f);
|
|
||||||
|
using var pushedWrap = ImRaii.TextWrapPos(this.useWordWrap ? 0f : -1f);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (handle.Value.LoadException is { } exc)
|
if (handle.Value.LoadException is { } exc)
|
||||||
|
|
@ -263,6 +264,7 @@ internal class GamePrebakedFontsTestWidget : IDataWindowWidget, IDisposable
|
||||||
{
|
{
|
||||||
if (!this.atlasScaleMode)
|
if (!this.atlasScaleMode)
|
||||||
ImGui.SetWindowFontScale(1 / ImGuiHelpers.GlobalScale);
|
ImGui.SetWindowFontScale(1 / ImGuiHelpers.GlobalScale);
|
||||||
|
|
||||||
if (counter++ % 2 == 0)
|
if (counter++ % 2 == 0)
|
||||||
{
|
{
|
||||||
using var pushPop = handle.Value.Push();
|
using var pushPop = handle.Value.Push();
|
||||||
|
|
@ -279,7 +281,6 @@ internal class GamePrebakedFontsTestWidget : IDataWindowWidget, IDisposable
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
ImGui.SetWindowFontScale(1);
|
ImGui.SetWindowFontScale(1);
|
||||||
ImGui.PopTextWrapPos();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ namespace Dalamud.Interface.Internal.Windows.Data.Widgets;
|
||||||
internal class GamepadWidget : IDataWindowWidget
|
internal class GamepadWidget : IDataWindowWidget
|
||||||
{
|
{
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public string[]? CommandShortcuts { get; init; } = { "gamepad", "controller" };
|
public string[]? CommandShortcuts { get; init; } = ["gamepad", "controller"];
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public string DisplayName { get; init; } = "Gamepad";
|
public string DisplayName { get; init; } = "Gamepad";
|
||||||
|
|
@ -39,22 +39,10 @@ internal class GamepadWidget : IDataWindowWidget
|
||||||
ImGui.SetClipboardText($"{Util.DescribeAddress(gamepadState.GamepadInputAddress)}");
|
ImGui.SetClipboardText($"{Util.DescribeAddress(gamepadState.GamepadInputAddress)}");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
this.DrawHelper(
|
this.DrawHelper("Buttons Raw", (uint)gamepadState.ButtonsRaw, gamepadState.Raw);
|
||||||
"Buttons Raw",
|
this.DrawHelper("Buttons Pressed", (uint)gamepadState.ButtonsPressed, gamepadState.Pressed);
|
||||||
(uint)gamepadState.ButtonsRaw,
|
this.DrawHelper("Buttons Repeat", (uint)gamepadState.ButtonsRepeat, gamepadState.Repeat);
|
||||||
gamepadState.Raw);
|
this.DrawHelper("Buttons Released", (uint)gamepadState.ButtonsReleased, gamepadState.Released);
|
||||||
this.DrawHelper(
|
|
||||||
"Buttons Pressed",
|
|
||||||
(uint)gamepadState.ButtonsPressed,
|
|
||||||
gamepadState.Pressed);
|
|
||||||
this.DrawHelper(
|
|
||||||
"Buttons Repeat",
|
|
||||||
(uint)gamepadState.ButtonsRepeat,
|
|
||||||
gamepadState.Repeat);
|
|
||||||
this.DrawHelper(
|
|
||||||
"Buttons Released",
|
|
||||||
(uint)gamepadState.ButtonsReleased,
|
|
||||||
gamepadState.Released);
|
|
||||||
ImGui.Text($"LeftStick {gamepadState.LeftStick}");
|
ImGui.Text($"LeftStick {gamepadState.LeftStick}");
|
||||||
ImGui.Text($"RightStick {gamepadState.RightStick}");
|
ImGui.Text($"RightStick {gamepadState.RightStick}");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ namespace Dalamud.Interface.Internal.Windows.Data.Widgets;
|
||||||
internal class GaugeWidget : IDataWindowWidget
|
internal class GaugeWidget : IDataWindowWidget
|
||||||
{
|
{
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public string[]? CommandShortcuts { get; init; } = { "gauge", "jobgauge", "job" };
|
public string[]? CommandShortcuts { get; init; } = ["gauge", "jobgauge", "job"];
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public string DisplayName { get; init; } = "Job Gauge";
|
public string DisplayName { get; init; } = "Job Gauge";
|
||||||
|
|
@ -39,8 +39,7 @@ internal class GaugeWidget : IDataWindowWidget
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var jobID = player.ClassJob.RowId;
|
JobGaugeBase? gauge = player.ClassJob.RowId switch
|
||||||
JobGaugeBase? gauge = jobID switch
|
|
||||||
{
|
{
|
||||||
19 => jobGauges.Get<PLDGauge>(),
|
19 => jobGauges.Get<PLDGauge>(),
|
||||||
20 => jobGauges.Get<MNKGauge>(),
|
20 => jobGauges.Get<MNKGauge>(),
|
||||||
|
|
@ -63,7 +62,7 @@ internal class GaugeWidget : IDataWindowWidget
|
||||||
40 => jobGauges.Get<SGEGauge>(),
|
40 => jobGauges.Get<SGEGauge>(),
|
||||||
41 => jobGauges.Get<VPRGauge>(),
|
41 => jobGauges.Get<VPRGauge>(),
|
||||||
42 => jobGauges.Get<PCTGauge>(),
|
42 => jobGauges.Get<PCTGauge>(),
|
||||||
_ => null,
|
_ => null
|
||||||
};
|
};
|
||||||
|
|
||||||
if (gauge == null)
|
if (gauge == null)
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@ using System.Threading.Tasks;
|
||||||
using Dalamud.Bindings.ImGui;
|
using Dalamud.Bindings.ImGui;
|
||||||
using Dalamud.Game;
|
using Dalamud.Game;
|
||||||
using Dalamud.Hooking;
|
using Dalamud.Hooking;
|
||||||
|
using Dalamud.Interface.Utility.Raii;
|
||||||
using FFXIVClientStructs.FFXIV.Component.GUI;
|
using FFXIVClientStructs.FFXIV.Component.GUI;
|
||||||
using Serilog;
|
using Serilog;
|
||||||
using Windows.Win32.Foundation;
|
using Windows.Win32.Foundation;
|
||||||
|
|
@ -23,12 +24,12 @@ internal unsafe class HookWidget : IDataWindowWidget
|
||||||
private Hook<MessageBoxWDelegate>? messageBoxMinHook;
|
private Hook<MessageBoxWDelegate>? messageBoxMinHook;
|
||||||
private bool hookUseMinHook;
|
private bool hookUseMinHook;
|
||||||
|
|
||||||
private int hookStressTestCount = 0;
|
private int hookStressTestCount;
|
||||||
private int hookStressTestMax = 1000;
|
private int hookStressTestMax = 1000;
|
||||||
private int hookStressTestWait = 100;
|
private int hookStressTestWait = 100;
|
||||||
private int hookStressTestMaxDegreeOfParallelism = 10;
|
private int hookStressTestMaxDegreeOfParallelism = 10;
|
||||||
private StressTestHookTarget hookStressTestHookTarget = StressTestHookTarget.Random;
|
private StressTestHookTarget hookStressTestHookTarget = StressTestHookTarget.Random;
|
||||||
private bool hookStressTestRunning = false;
|
private bool hookStressTestRunning;
|
||||||
|
|
||||||
private MessageBoxWDelegate? messageBoxWOriginal;
|
private MessageBoxWDelegate? messageBoxWOriginal;
|
||||||
private AddonFinalizeDelegate? addonFinalizeOriginal;
|
private AddonFinalizeDelegate? addonFinalizeOriginal;
|
||||||
|
|
@ -47,7 +48,7 @@ internal unsafe class HookWidget : IDataWindowWidget
|
||||||
{
|
{
|
||||||
MessageBoxW,
|
MessageBoxW,
|
||||||
AddonFinalize,
|
AddonFinalize,
|
||||||
Random,
|
Random
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
|
|
@ -103,67 +104,68 @@ internal unsafe class HookWidget : IDataWindowWidget
|
||||||
|
|
||||||
ImGui.Separator();
|
ImGui.Separator();
|
||||||
|
|
||||||
ImGui.BeginDisabled(this.hookStressTestRunning);
|
using (ImRaii.Disabled(this.hookStressTestRunning))
|
||||||
ImGui.Text("Stress Test"u8);
|
|
||||||
|
|
||||||
if (ImGui.InputInt("Max"u8, ref this.hookStressTestMax))
|
|
||||||
this.hookStressTestCount = 0;
|
|
||||||
|
|
||||||
ImGui.InputInt("Wait (ms)"u8, ref this.hookStressTestWait);
|
|
||||||
ImGui.InputInt("Max Degree of Parallelism"u8, ref this.hookStressTestMaxDegreeOfParallelism);
|
|
||||||
|
|
||||||
if (ImGui.BeginCombo("Target"u8, HookTargetToString(this.hookStressTestHookTarget)))
|
|
||||||
{
|
{
|
||||||
foreach (var target in Enum.GetValues<StressTestHookTarget>())
|
ImGui.Text("Stress Test"u8);
|
||||||
|
|
||||||
|
if (ImGui.InputInt("Max"u8, ref this.hookStressTestMax))
|
||||||
|
this.hookStressTestCount = 0;
|
||||||
|
|
||||||
|
ImGui.InputInt("Wait (ms)"u8, ref this.hookStressTestWait);
|
||||||
|
ImGui.InputInt("Max Degree of Parallelism"u8, ref this.hookStressTestMaxDegreeOfParallelism);
|
||||||
|
|
||||||
|
using (var combo = ImRaii.Combo("Target"u8, HookTargetToString(this.hookStressTestHookTarget)))
|
||||||
{
|
{
|
||||||
if (ImGui.Selectable(HookTargetToString(target), this.hookStressTestHookTarget == target))
|
if (combo.Success)
|
||||||
this.hookStressTestHookTarget = target;
|
{
|
||||||
|
foreach (var target in Enum.GetValues<StressTestHookTarget>())
|
||||||
|
{
|
||||||
|
if (ImGui.Selectable(HookTargetToString(target), this.hookStressTestHookTarget == target))
|
||||||
|
this.hookStressTestHookTarget = target;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui.EndCombo();
|
if (ImGui.Button("Stress Test"u8))
|
||||||
}
|
|
||||||
|
|
||||||
if (ImGui.Button("Stress Test"u8))
|
|
||||||
{
|
|
||||||
Task.Run(() =>
|
|
||||||
{
|
{
|
||||||
this.hookStressTestRunning = true;
|
Task.Run(() =>
|
||||||
this.hookStressTestCount = 0;
|
{
|
||||||
Parallel.For(
|
this.hookStressTestRunning = true;
|
||||||
0,
|
this.hookStressTestCount = 0;
|
||||||
this.hookStressTestMax,
|
Parallel.For(
|
||||||
new ParallelOptions
|
0,
|
||||||
|
this.hookStressTestMax,
|
||||||
|
new ParallelOptions
|
||||||
|
{
|
||||||
|
MaxDegreeOfParallelism = this.hookStressTestMaxDegreeOfParallelism,
|
||||||
|
},
|
||||||
|
_ =>
|
||||||
|
{
|
||||||
|
this.hookStressTestList.Add(this.HookTarget(this.hookStressTestHookTarget));
|
||||||
|
this.hookStressTestCount++;
|
||||||
|
Thread.Sleep(this.hookStressTestWait);
|
||||||
|
});
|
||||||
|
}).ContinueWith(t =>
|
||||||
|
{
|
||||||
|
if (t.IsFaulted)
|
||||||
{
|
{
|
||||||
MaxDegreeOfParallelism = this.hookStressTestMaxDegreeOfParallelism,
|
Log.Error(t.Exception, "Stress test failed");
|
||||||
},
|
}
|
||||||
_ =>
|
else
|
||||||
{
|
{
|
||||||
this.hookStressTestList.Add(this.HookTarget(this.hookStressTestHookTarget));
|
Log.Information("Stress test completed");
|
||||||
this.hookStressTestCount++;
|
}
|
||||||
Thread.Sleep(this.hookStressTestWait);
|
|
||||||
|
this.hookStressTestRunning = false;
|
||||||
|
this.hookStressTestList.ForEach(hook =>
|
||||||
|
{
|
||||||
|
hook.Dispose();
|
||||||
});
|
});
|
||||||
}).ContinueWith(t =>
|
this.hookStressTestList.Clear();
|
||||||
{
|
|
||||||
if (t.IsFaulted)
|
|
||||||
{
|
|
||||||
Log.Error(t.Exception, "Stress test failed");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Log.Information("Stress test completed");
|
|
||||||
}
|
|
||||||
|
|
||||||
this.hookStressTestRunning = false;
|
|
||||||
this.hookStressTestList.ForEach(hook =>
|
|
||||||
{
|
|
||||||
hook.Dispose();
|
|
||||||
});
|
});
|
||||||
this.hookStressTestList.Clear();
|
}
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui.EndDisabled();
|
|
||||||
|
|
||||||
ImGui.Text("Status: " + (this.hookStressTestRunning ? "Running" : "Idle"));
|
ImGui.Text("Status: " + (this.hookStressTestRunning ? "Running" : "Idle"));
|
||||||
ImGui.ProgressBar(this.hookStressTestCount / (float)this.hookStressTestMax, new System.Numerics.Vector2(0, 0), $"{this.hookStressTestCount}/{this.hookStressTestMax}");
|
ImGui.ProgressBar(this.hookStressTestCount / (float)this.hookStressTestMax, new System.Numerics.Vector2(0, 0), $"{this.hookStressTestCount}/{this.hookStressTestMax}");
|
||||||
}
|
}
|
||||||
|
|
@ -203,11 +205,6 @@ internal unsafe class HookWidget : IDataWindowWidget
|
||||||
this.addonFinalizeOriginal!(unitManager, atkUnitBase);
|
this.addonFinalizeOriginal!(unitManager, atkUnitBase);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnAddonUpdate(AtkUnitBase* thisPtr, float delta)
|
|
||||||
{
|
|
||||||
Log.Information("OnAddonUpdate");
|
|
||||||
}
|
|
||||||
|
|
||||||
private IDalamudHook HookMessageBoxW()
|
private IDalamudHook HookMessageBoxW()
|
||||||
{
|
{
|
||||||
var hook = Hook<MessageBoxWDelegate>.FromSymbol(
|
var hook = Hook<MessageBoxWDelegate>.FromSymbol(
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@ using Dalamud.Interface.Textures.Internal;
|
||||||
using Dalamud.Interface.Textures.TextureWraps;
|
using Dalamud.Interface.Textures.TextureWraps;
|
||||||
using Dalamud.Interface.Utility;
|
using Dalamud.Interface.Utility;
|
||||||
using Dalamud.Interface.Utility.Internal;
|
using Dalamud.Interface.Utility.Internal;
|
||||||
|
using Dalamud.Interface.Utility.Raii;
|
||||||
|
|
||||||
namespace Dalamud.Interface.Internal.Windows.Data.Widgets;
|
namespace Dalamud.Interface.Internal.Windows.Data.Widgets;
|
||||||
|
|
||||||
|
|
@ -33,7 +34,7 @@ public class IconBrowserWidget : IDataWindowWidget
|
||||||
private Vector2 lastWindowSize = Vector2.Zero;
|
private Vector2 lastWindowSize = Vector2.Zero;
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public string[]? CommandShortcuts { get; init; } = { "icon", "icons" };
|
public string[]? CommandShortcuts { get; init; } = ["icon", "icons"];
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public string DisplayName { get; init; } = "Icon Browser";
|
public string DisplayName { get; init; } = "Icon Browser";
|
||||||
|
|
@ -62,6 +63,7 @@ public class IconBrowserWidget : IDataWindowWidget
|
||||||
// continue;
|
// continue;
|
||||||
if (!texm.TryGetIconPath(new((uint)iconId), out var path))
|
if (!texm.TryGetIconPath(new((uint)iconId), out var path))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
result.Add((iconId, path));
|
result.Add((iconId, path));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -82,17 +84,17 @@ public class IconBrowserWidget : IDataWindowWidget
|
||||||
{
|
{
|
||||||
this.RecalculateIndexRange();
|
this.RecalculateIndexRange();
|
||||||
|
|
||||||
if (ImGui.BeginChild("ScrollableSection"u8, ImGui.GetContentRegionAvail(), false, ImGuiWindowFlags.NoMove))
|
using (var child = ImRaii.Child("ScrollableSection"u8, ImGui.GetContentRegionAvail(), false, ImGuiWindowFlags.NoMove))
|
||||||
{
|
{
|
||||||
var itemsPerRow = (int)MathF.Floor(
|
if (child.Success)
|
||||||
ImGui.GetContentRegionMax().X / (this.iconSize.X + ImGui.GetStyle().ItemSpacing.X));
|
{
|
||||||
var itemHeight = this.iconSize.Y + ImGui.GetStyle().ItemSpacing.Y;
|
var itemsPerRow = (int)MathF.Floor(ImGui.GetContentRegionMax().X / (this.iconSize.X + ImGui.GetStyle().ItemSpacing.X));
|
||||||
|
var itemHeight = this.iconSize.Y + ImGui.GetStyle().ItemSpacing.Y;
|
||||||
|
|
||||||
ImGuiClip.ClippedDraw(this.valueRange!, this.DrawIcon, itemsPerRow, itemHeight);
|
ImGuiClip.ClippedDraw(this.valueRange!, this.DrawIcon, itemsPerRow, itemHeight);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui.EndChild();
|
|
||||||
|
|
||||||
this.ProcessMouseDragging();
|
this.ProcessMouseDragging();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -118,16 +120,16 @@ public class IconBrowserWidget : IDataWindowWidget
|
||||||
{
|
{
|
||||||
ImGui.Columns(2);
|
ImGui.Columns(2);
|
||||||
|
|
||||||
ImGui.PushItemWidth(ImGui.GetContentRegionAvail().X);
|
ImGui.SetNextItemWidth(ImGui.GetContentRegionAvail().X);
|
||||||
if (ImGui.InputInt("##StartRange"u8, ref this.startRange, 0, 0))
|
if (ImGui.InputInt("##StartRange"u8, ref this.startRange))
|
||||||
{
|
{
|
||||||
this.startRange = Math.Clamp(this.startRange, 0, MaxIconId);
|
this.startRange = Math.Clamp(this.startRange, 0, MaxIconId);
|
||||||
this.valueRange = null;
|
this.valueRange = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui.NextColumn();
|
ImGui.NextColumn();
|
||||||
ImGui.PushItemWidth(ImGui.GetContentRegionAvail().X);
|
ImGui.SetNextItemWidth(ImGui.GetContentRegionAvail().X);
|
||||||
if (ImGui.InputInt("##StopRange"u8, ref this.stopRange, 0, 0))
|
if (ImGui.InputInt("##StopRange"u8, ref this.stopRange))
|
||||||
{
|
{
|
||||||
this.stopRange = Math.Clamp(this.stopRange, 0, MaxIconId);
|
this.stopRange = Math.Clamp(this.stopRange, 0, MaxIconId);
|
||||||
this.valueRange = null;
|
this.valueRange = null;
|
||||||
|
|
@ -151,6 +153,10 @@ public class IconBrowserWidget : IDataWindowWidget
|
||||||
var texm = Service<TextureManager>.Get();
|
var texm = Service<TextureManager>.Get();
|
||||||
var cursor = ImGui.GetCursorScreenPos();
|
var cursor = ImGui.GetCursorScreenPos();
|
||||||
|
|
||||||
|
var white = ImGui.GetColorU32(ImGuiColors.DalamudWhite);
|
||||||
|
var red = ImGui.GetColorU32(ImGuiColors.DalamudRed);
|
||||||
|
var drawList = ImGui.GetWindowDrawList();
|
||||||
|
|
||||||
if (texm.Shared.GetFromGameIcon(iconId).TryGetWrap(out var texture, out var exc))
|
if (texm.Shared.GetFromGameIcon(iconId).TryGetWrap(out var texture, out var exc))
|
||||||
{
|
{
|
||||||
ImGui.Image(texture.Handle, this.iconSize);
|
ImGui.Image(texture.Handle, this.iconSize);
|
||||||
|
|
@ -158,21 +164,17 @@ public class IconBrowserWidget : IDataWindowWidget
|
||||||
// If we have the option to show a tooltip image, draw the image, but make sure it's not too big.
|
// If we have the option to show a tooltip image, draw the image, but make sure it's not too big.
|
||||||
if (ImGui.IsItemHovered() && this.showTooltipImage)
|
if (ImGui.IsItemHovered() && this.showTooltipImage)
|
||||||
{
|
{
|
||||||
ImGui.BeginTooltip();
|
using var tooltip = ImRaii.Tooltip();
|
||||||
|
|
||||||
var scale = GetImageScaleFactor(texture);
|
var scale = GetImageScaleFactor(texture);
|
||||||
|
|
||||||
var textSize = ImGui.CalcTextSize(iconId.ToString());
|
var textSize = ImGui.CalcTextSize(iconId.ToString());
|
||||||
ImGui.SetCursorPosX(
|
ImGui.SetCursorPosX((texture.Size.X * scale / 2.0f - (textSize.X / 2.0f)) + (ImGui.GetStyle().FramePadding.X * 2.0f));
|
||||||
texture.Size.X * scale / 2.0f - textSize.X / 2.0f + ImGui.GetStyle().FramePadding.X * 2.0f);
|
|
||||||
ImGui.Text(iconId.ToString());
|
ImGui.Text(iconId.ToString());
|
||||||
|
|
||||||
ImGui.Image(texture.Handle, texture.Size * scale);
|
ImGui.Image(texture.Handle, texture.Size * scale);
|
||||||
ImGui.EndTooltip();
|
|
||||||
}
|
}
|
||||||
|
else if (ImGui.IsItemHovered()) // else, just draw the iconId.
|
||||||
// else, just draw the iconId.
|
|
||||||
else if (ImGui.IsItemHovered())
|
|
||||||
{
|
{
|
||||||
ImGui.SetTooltip(iconId.ToString());
|
ImGui.SetTooltip(iconId.ToString());
|
||||||
}
|
}
|
||||||
|
|
@ -185,10 +187,7 @@ public class IconBrowserWidget : IDataWindowWidget
|
||||||
Task.FromResult(texture.CreateWrapSharingLowLevelResource()));
|
Task.FromResult(texture.CreateWrapSharingLowLevelResource()));
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui.GetWindowDrawList().AddRect(
|
drawList.AddRect(cursor, cursor + this.iconSize, white);
|
||||||
cursor,
|
|
||||||
cursor + this.iconSize,
|
|
||||||
ImGui.GetColorU32(ImGuiColors.DalamudWhite));
|
|
||||||
}
|
}
|
||||||
else if (exc is not null)
|
else if (exc is not null)
|
||||||
{
|
{
|
||||||
|
|
@ -197,19 +196,13 @@ public class IconBrowserWidget : IDataWindowWidget
|
||||||
{
|
{
|
||||||
var iconText = FontAwesomeIcon.Ban.ToIconString();
|
var iconText = FontAwesomeIcon.Ban.ToIconString();
|
||||||
var textSize = ImGui.CalcTextSize(iconText);
|
var textSize = ImGui.CalcTextSize(iconText);
|
||||||
ImGui.GetWindowDrawList().AddText(
|
drawList.AddText(cursor + ((this.iconSize - textSize) / 2), red, iconText);
|
||||||
cursor + ((this.iconSize - textSize) / 2),
|
|
||||||
ImGui.GetColorU32(ImGuiColors.DalamudRed),
|
|
||||||
iconText);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ImGui.IsItemHovered())
|
if (ImGui.IsItemHovered())
|
||||||
ImGui.SetTooltip($"{iconId}\n{exc}");
|
ImGui.SetTooltip($"{iconId}\n{exc}");
|
||||||
|
|
||||||
ImGui.GetWindowDrawList().AddRect(
|
drawList.AddRect(cursor, cursor + this.iconSize, red);
|
||||||
cursor,
|
|
||||||
cursor + this.iconSize,
|
|
||||||
ImGui.GetColorU32(ImGuiColors.DalamudRed));
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -218,18 +211,12 @@ public class IconBrowserWidget : IDataWindowWidget
|
||||||
|
|
||||||
ImGui.Dummy(this.iconSize);
|
ImGui.Dummy(this.iconSize);
|
||||||
var textSize = ImGui.CalcTextSize(text);
|
var textSize = ImGui.CalcTextSize(text);
|
||||||
ImGui.GetWindowDrawList().AddText(
|
drawList.AddText(cursor + ((this.iconSize - textSize) / 2), color, text);
|
||||||
cursor + ((this.iconSize - textSize) / 2),
|
|
||||||
color,
|
|
||||||
text);
|
|
||||||
|
|
||||||
if (ImGui.IsItemHovered())
|
if (ImGui.IsItemHovered())
|
||||||
ImGui.SetTooltip(iconId.ToString());
|
ImGui.SetTooltip(iconId.ToString());
|
||||||
|
|
||||||
ImGui.GetWindowDrawList().AddRect(
|
drawList.AddRect(cursor, cursor + this.iconSize, color);
|
||||||
cursor,
|
|
||||||
cursor + this.iconSize,
|
|
||||||
color);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -269,7 +256,7 @@ public class IconBrowserWidget : IDataWindowWidget
|
||||||
if (this.valueRange is not null)
|
if (this.valueRange is not null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
this.valueRange = new();
|
this.valueRange = [];
|
||||||
foreach (var (id, _) in this.iconIdsTask!.Result)
|
foreach (var (id, _) in this.iconIdsTask!.Result)
|
||||||
{
|
{
|
||||||
if (this.startRange <= id && id < this.stopRange)
|
if (this.startRange <= id && id < this.stopRange)
|
||||||
|
|
|
||||||
|
|
@ -19,11 +19,11 @@ namespace Dalamud.Interface.Internal.Windows.Data.Widgets;
|
||||||
/// </summary>
|
/// </summary>
|
||||||
internal class ImGuiWidget : IDataWindowWidget
|
internal class ImGuiWidget : IDataWindowWidget
|
||||||
{
|
{
|
||||||
private readonly HashSet<IActiveNotification> notifications = new();
|
private readonly HashSet<IActiveNotification> notifications = [];
|
||||||
private NotificationTemplate notificationTemplate;
|
private NotificationTemplate notificationTemplate;
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public string[]? CommandShortcuts { get; init; } = { "imgui" };
|
public string[]? CommandShortcuts { get; init; } = ["imgui"];
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public string DisplayName { get; init; } = "ImGui";
|
public string DisplayName { get; init; } = "ImGui";
|
||||||
|
|
@ -54,8 +54,7 @@ internal class ImGuiWidget : IDataWindowWidget
|
||||||
|
|
||||||
ImGui.Separator();
|
ImGui.Separator();
|
||||||
|
|
||||||
ImGui.Text(
|
ImGui.Text($"WindowSystem.TimeSinceLastAnyFocus: {WindowSystem.TimeSinceLastAnyFocus.TotalMilliseconds:0}ms");
|
||||||
$"WindowSystem.TimeSinceLastAnyFocus: {WindowSystem.TimeSinceLastAnyFocus.TotalMilliseconds:0}ms");
|
|
||||||
|
|
||||||
ImGui.Separator();
|
ImGui.Separator();
|
||||||
|
|
||||||
|
|
@ -79,45 +78,24 @@ internal class ImGuiWidget : IDataWindowWidget
|
||||||
switch (this.notificationTemplate.IconInt)
|
switch (this.notificationTemplate.IconInt)
|
||||||
{
|
{
|
||||||
case 1 or 2:
|
case 1 or 2:
|
||||||
ImGui.InputText(
|
ImGui.InputText("Icon Text##iconText"u8, ref this.notificationTemplate.IconText, 255);
|
||||||
"Icon Text##iconText"u8,
|
|
||||||
ref this.notificationTemplate.IconText,
|
|
||||||
255);
|
|
||||||
break;
|
break;
|
||||||
case 5 or 6:
|
case 5 or 6:
|
||||||
ImGui.Combo(
|
ImGui.Combo("Asset##iconAssetCombo", ref this.notificationTemplate.IconAssetInt, NotificationTemplate.AssetSources);
|
||||||
"Asset##iconAssetCombo",
|
|
||||||
ref this.notificationTemplate.IconAssetInt,
|
|
||||||
NotificationTemplate.AssetSources);
|
|
||||||
break;
|
break;
|
||||||
case 3 or 7:
|
case 3 or 7:
|
||||||
ImGui.InputText(
|
ImGui.InputText("Game Path##iconText"u8, ref this.notificationTemplate.IconText, 255);
|
||||||
"Game Path##iconText"u8,
|
|
||||||
ref this.notificationTemplate.IconText,
|
|
||||||
255);
|
|
||||||
break;
|
break;
|
||||||
case 4 or 8:
|
case 4 or 8:
|
||||||
ImGui.InputText(
|
ImGui.InputText("File Path##iconText"u8, ref this.notificationTemplate.IconText, 255);
|
||||||
"File Path##iconText"u8,
|
|
||||||
ref this.notificationTemplate.IconText,
|
|
||||||
255);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui.Combo(
|
ImGui.Combo("Initial Duration", ref this.notificationTemplate.InitialDurationInt, NotificationTemplate.InitialDurationTitles);
|
||||||
"Initial Duration",
|
|
||||||
ref this.notificationTemplate.InitialDurationInt,
|
|
||||||
NotificationTemplate.InitialDurationTitles);
|
|
||||||
|
|
||||||
ImGui.Combo(
|
ImGui.Combo("Extension Duration", ref this.notificationTemplate.HoverExtendDurationInt, NotificationTemplate.HoverExtendDurationTitles);
|
||||||
"Extension Duration",
|
|
||||||
ref this.notificationTemplate.HoverExtendDurationInt,
|
|
||||||
NotificationTemplate.HoverExtendDurationTitles);
|
|
||||||
|
|
||||||
ImGui.Combo(
|
ImGui.Combo("Progress", ref this.notificationTemplate.ProgressMode, NotificationTemplate.ProgressModeTitles);
|
||||||
"Progress",
|
|
||||||
ref this.notificationTemplate.ProgressMode,
|
|
||||||
NotificationTemplate.ProgressModeTitles);
|
|
||||||
|
|
||||||
ImGui.Checkbox("Respect UI Hidden"u8, ref this.notificationTemplate.RespectUiHidden);
|
ImGui.Checkbox("Respect UI Hidden"u8, ref this.notificationTemplate.RespectUiHidden);
|
||||||
|
|
||||||
|
|
@ -127,14 +105,11 @@ internal class ImGuiWidget : IDataWindowWidget
|
||||||
|
|
||||||
ImGui.Checkbox("User Dismissable"u8, ref this.notificationTemplate.UserDismissable);
|
ImGui.Checkbox("User Dismissable"u8, ref this.notificationTemplate.UserDismissable);
|
||||||
|
|
||||||
ImGui.Checkbox(
|
ImGui.Checkbox("Action Bar (always on if not user dismissable for the example)"u8, ref this.notificationTemplate.ActionBar);
|
||||||
"Action Bar (always on if not user dismissable for the example)"u8,
|
|
||||||
ref this.notificationTemplate.ActionBar);
|
|
||||||
|
|
||||||
if (ImGui.Button("Add notification"u8))
|
if (ImGui.Button("Add notification"u8))
|
||||||
{
|
{
|
||||||
var text =
|
var text = "Bla bla bla bla bla bla bla bla bla bla bla.\nBla bla bla bla bla bla bla bla bla bla bla bla bla bla.";
|
||||||
"Bla bla bla bla bla bla bla bla bla bla bla.\nBla bla bla bla bla bla bla bla bla bla bla bla bla bla.";
|
|
||||||
|
|
||||||
NewRandom(out var title, out var type, out var progress);
|
NewRandom(out var title, out var type, out var progress);
|
||||||
if (this.notificationTemplate.ManualTitle)
|
if (this.notificationTemplate.ManualTitle)
|
||||||
|
|
@ -334,7 +309,7 @@ internal class ImGuiWidget : IDataWindowWidget
|
||||||
private struct NotificationTemplate
|
private struct NotificationTemplate
|
||||||
{
|
{
|
||||||
public static readonly string[] IconTitles =
|
public static readonly string[] IconTitles =
|
||||||
{
|
[
|
||||||
"None (use Type)",
|
"None (use Type)",
|
||||||
"SeIconChar",
|
"SeIconChar",
|
||||||
"FontAwesomeIcon",
|
"FontAwesomeIcon",
|
||||||
|
|
@ -343,8 +318,8 @@ internal class ImGuiWidget : IDataWindowWidget
|
||||||
"TextureWrap from DalamudAssets",
|
"TextureWrap from DalamudAssets",
|
||||||
"TextureWrap from DalamudAssets(Async)",
|
"TextureWrap from DalamudAssets(Async)",
|
||||||
"TextureWrap from GamePath",
|
"TextureWrap from GamePath",
|
||||||
"TextureWrap from FilePath",
|
"TextureWrap from FilePath"
|
||||||
};
|
];
|
||||||
|
|
||||||
public static readonly string[] AssetSources =
|
public static readonly string[] AssetSources =
|
||||||
Enum.GetValues<DalamudAsset>()
|
Enum.GetValues<DalamudAsset>()
|
||||||
|
|
@ -353,46 +328,46 @@ internal class ImGuiWidget : IDataWindowWidget
|
||||||
.ToArray();
|
.ToArray();
|
||||||
|
|
||||||
public static readonly string[] ProgressModeTitles =
|
public static readonly string[] ProgressModeTitles =
|
||||||
{
|
[
|
||||||
"Default",
|
"Default",
|
||||||
"Random",
|
"Random",
|
||||||
"Increasing",
|
"Increasing",
|
||||||
"Increasing & Auto Dismiss",
|
"Increasing & Auto Dismiss",
|
||||||
"Indeterminate",
|
"Indeterminate"
|
||||||
};
|
];
|
||||||
|
|
||||||
public static readonly string[] TypeTitles =
|
public static readonly string[] TypeTitles =
|
||||||
{
|
[
|
||||||
nameof(NotificationType.None),
|
nameof(NotificationType.None),
|
||||||
nameof(NotificationType.Success),
|
nameof(NotificationType.Success),
|
||||||
nameof(NotificationType.Warning),
|
nameof(NotificationType.Warning),
|
||||||
nameof(NotificationType.Error),
|
nameof(NotificationType.Error),
|
||||||
nameof(NotificationType.Info),
|
nameof(NotificationType.Info)
|
||||||
};
|
];
|
||||||
|
|
||||||
public static readonly string[] InitialDurationTitles =
|
public static readonly string[] InitialDurationTitles =
|
||||||
{
|
[
|
||||||
"Infinite",
|
"Infinite",
|
||||||
"1 seconds",
|
"1 seconds",
|
||||||
"3 seconds (default)",
|
"3 seconds (default)",
|
||||||
"10 seconds",
|
"10 seconds"
|
||||||
};
|
];
|
||||||
|
|
||||||
public static readonly string[] HoverExtendDurationTitles =
|
public static readonly string[] HoverExtendDurationTitles =
|
||||||
{
|
[
|
||||||
"Disable",
|
"Disable",
|
||||||
"1 seconds",
|
"1 seconds",
|
||||||
"3 seconds (default)",
|
"3 seconds (default)",
|
||||||
"10 seconds",
|
"10 seconds"
|
||||||
};
|
];
|
||||||
|
|
||||||
public static readonly TimeSpan[] Durations =
|
public static readonly TimeSpan[] Durations =
|
||||||
{
|
[
|
||||||
TimeSpan.Zero,
|
TimeSpan.Zero,
|
||||||
TimeSpan.FromSeconds(1),
|
TimeSpan.FromSeconds(1),
|
||||||
NotificationConstants.DefaultDuration,
|
NotificationConstants.DefaultDuration,
|
||||||
TimeSpan.FromSeconds(10),
|
TimeSpan.FromSeconds(10)
|
||||||
};
|
];
|
||||||
|
|
||||||
public bool ManualContent;
|
public bool ManualContent;
|
||||||
public string Content;
|
public string Content;
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,11 @@ namespace Dalamud.Interface.Internal.Windows.Data.Widgets;
|
||||||
/// </summary>
|
/// </summary>
|
||||||
internal class InventoryWidget : IDataWindowWidget
|
internal class InventoryWidget : IDataWindowWidget
|
||||||
{
|
{
|
||||||
|
private const ImGuiTableFlags TableFlags = ImGuiTableFlags.RowBg | ImGuiTableFlags.Borders |
|
||||||
|
ImGuiTableFlags.ScrollY | ImGuiTableFlags.NoSavedSettings;
|
||||||
|
|
||||||
|
private const ImGuiTableFlags InnerTableFlags = ImGuiTableFlags.BordersInner | ImGuiTableFlags.NoSavedSettings;
|
||||||
|
|
||||||
private DataManager dataManager;
|
private DataManager dataManager;
|
||||||
private TextureManager textureManager;
|
private TextureManager textureManager;
|
||||||
private GameInventoryType? selectedInventoryType = GameInventoryType.Inventory1;
|
private GameInventoryType? selectedInventoryType = GameInventoryType.Inventory1;
|
||||||
|
|
@ -62,7 +67,7 @@ internal class InventoryWidget : IDataWindowWidget
|
||||||
|
|
||||||
private unsafe void DrawInventoryTypeList()
|
private unsafe void DrawInventoryTypeList()
|
||||||
{
|
{
|
||||||
using var table = ImRaii.Table("InventoryTypeTable"u8, 2, ImGuiTableFlags.RowBg | ImGuiTableFlags.Borders | ImGuiTableFlags.ScrollY | ImGuiTableFlags.NoSavedSettings, new Vector2(300, -1));
|
using var table = ImRaii.Table("InventoryTypeTable"u8, 2, TableFlags, new Vector2(300, -1));
|
||||||
if (!table) return;
|
if (!table) return;
|
||||||
|
|
||||||
ImGui.TableSetupColumn("Type"u8);
|
ImGui.TableSetupColumn("Type"u8);
|
||||||
|
|
@ -105,7 +110,7 @@ internal class InventoryWidget : IDataWindowWidget
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private unsafe void DrawInventoryType(GameInventoryType inventoryType)
|
private void DrawInventoryType(GameInventoryType inventoryType)
|
||||||
{
|
{
|
||||||
var items = GameInventoryItem.GetReadOnlySpanOfInventory(inventoryType);
|
var items = GameInventoryItem.GetReadOnlySpanOfInventory(inventoryType);
|
||||||
if (items.IsEmpty)
|
if (items.IsEmpty)
|
||||||
|
|
@ -114,8 +119,9 @@ internal class InventoryWidget : IDataWindowWidget
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
using var itemTable = ImRaii.Table("InventoryItemTable"u8, 4, ImGuiTableFlags.RowBg | ImGuiTableFlags.Borders | ImGuiTableFlags.ScrollY | ImGuiTableFlags.NoSavedSettings);
|
using var itemTable = ImRaii.Table("InventoryItemTable"u8, 4, TableFlags);
|
||||||
if (!itemTable) return;
|
if (!itemTable) return;
|
||||||
|
|
||||||
ImGui.TableSetupColumn("Slot"u8, ImGuiTableColumnFlags.WidthFixed, 40);
|
ImGui.TableSetupColumn("Slot"u8, ImGuiTableColumnFlags.WidthFixed, 40);
|
||||||
ImGui.TableSetupColumn("ItemId"u8, ImGuiTableColumnFlags.WidthFixed, 70);
|
ImGui.TableSetupColumn("ItemId"u8, ImGuiTableColumnFlags.WidthFixed, 70);
|
||||||
ImGui.TableSetupColumn("Quantity"u8, ImGuiTableColumnFlags.WidthFixed, 70);
|
ImGui.TableSetupColumn("Quantity"u8, ImGuiTableColumnFlags.WidthFixed, 70);
|
||||||
|
|
@ -127,7 +133,7 @@ internal class InventoryWidget : IDataWindowWidget
|
||||||
{
|
{
|
||||||
var item = items[slotIndex];
|
var item = items[slotIndex];
|
||||||
|
|
||||||
using var disableditem = ImRaii.Disabled(item.ItemId == 0);
|
using var disabledItem = ImRaii.Disabled(item.ItemId == 0);
|
||||||
|
|
||||||
ImGui.TableNextRow();
|
ImGui.TableNextRow();
|
||||||
ImGui.TableNextColumn(); // Slot
|
ImGui.TableNextColumn(); // Slot
|
||||||
|
|
@ -152,11 +158,11 @@ internal class InventoryWidget : IDataWindowWidget
|
||||||
if (ImGui.IsItemHovered())
|
if (ImGui.IsItemHovered())
|
||||||
{
|
{
|
||||||
ImGui.SetMouseCursor(ImGuiMouseCursor.Hand);
|
ImGui.SetMouseCursor(ImGuiMouseCursor.Hand);
|
||||||
ImGui.BeginTooltip();
|
|
||||||
|
using var tooltip = ImRaii.Tooltip();
|
||||||
ImGui.Text("Click to copy IconId"u8);
|
ImGui.Text("Click to copy IconId"u8);
|
||||||
ImGui.Text($"ID: {iconId} – Size: {texture.Width}x{texture.Height}");
|
ImGui.Text($"ID: {iconId} – Size: {texture.Width}x{texture.Height}");
|
||||||
ImGui.Image(texture.Handle, new(texture.Width, texture.Height));
|
ImGui.Image(texture.Handle, new(texture.Width, texture.Height));
|
||||||
ImGui.EndTooltip();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ImGui.IsItemClicked())
|
if (ImGui.IsItemClicked())
|
||||||
|
|
@ -167,7 +173,7 @@ internal class InventoryWidget : IDataWindowWidget
|
||||||
|
|
||||||
using var itemNameColor = ImRaii.PushColor(ImGuiCol.Text, this.GetItemRarityColor(item.ItemId));
|
using var itemNameColor = ImRaii.PushColor(ImGuiCol.Text, this.GetItemRarityColor(item.ItemId));
|
||||||
using var node = ImRaii.TreeNode($"{itemName}###{inventoryType}_{slotIndex}", ImGuiTreeNodeFlags.SpanAvailWidth);
|
using var node = ImRaii.TreeNode($"{itemName}###{inventoryType}_{slotIndex}", ImGuiTreeNodeFlags.SpanAvailWidth);
|
||||||
itemNameColor.Dispose();
|
itemNameColor.Pop();
|
||||||
|
|
||||||
using (var contextMenu = ImRaii.ContextPopupItem($"{inventoryType}_{slotIndex}_ContextMenu"))
|
using (var contextMenu = ImRaii.ContextPopupItem($"{inventoryType}_{slotIndex}_ContextMenu"))
|
||||||
{
|
{
|
||||||
|
|
@ -182,7 +188,7 @@ internal class InventoryWidget : IDataWindowWidget
|
||||||
|
|
||||||
if (!node) continue;
|
if (!node) continue;
|
||||||
|
|
||||||
using var itemInfoTable = ImRaii.Table($"{inventoryType}_{slotIndex}_Table", 2, ImGuiTableFlags.BordersInner | ImGuiTableFlags.NoSavedSettings);
|
using var itemInfoTable = ImRaii.Table($"{inventoryType}_{slotIndex}_Table", 2, InnerTableFlags);
|
||||||
if (!itemInfoTable) continue;
|
if (!itemInfoTable) continue;
|
||||||
|
|
||||||
ImGui.TableSetupColumn("Name"u8, ImGuiTableColumnFlags.WidthFixed, 150);
|
ImGui.TableSetupColumn("Name"u8, ImGuiTableColumnFlags.WidthFixed, 150);
|
||||||
|
|
@ -264,7 +270,7 @@ internal class InventoryWidget : IDataWindowWidget
|
||||||
ImGui.Text("Stains"u8);
|
ImGui.Text("Stains"u8);
|
||||||
ImGui.TableNextColumn();
|
ImGui.TableNextColumn();
|
||||||
|
|
||||||
using var stainTable = ImRaii.Table($"{inventoryType}_{slotIndex}_StainTable", 2, ImGuiTableFlags.BordersInner | ImGuiTableFlags.NoSavedSettings);
|
using var stainTable = ImRaii.Table($"{inventoryType}_{slotIndex}_StainTable", 2, InnerTableFlags);
|
||||||
if (!stainTable) continue;
|
if (!stainTable) continue;
|
||||||
|
|
||||||
ImGui.TableSetupColumn("Stain Id"u8, ImGuiTableColumnFlags.WidthFixed, 80);
|
ImGui.TableSetupColumn("Stain Id"u8, ImGuiTableColumnFlags.WidthFixed, 80);
|
||||||
|
|
@ -285,7 +291,7 @@ internal class InventoryWidget : IDataWindowWidget
|
||||||
ImGui.Text("Materia"u8);
|
ImGui.Text("Materia"u8);
|
||||||
ImGui.TableNextColumn();
|
ImGui.TableNextColumn();
|
||||||
|
|
||||||
using var materiaTable = ImRaii.Table($"{inventoryType}_{slotIndex}_MateriaTable", 2, ImGuiTableFlags.BordersInner | ImGuiTableFlags.NoSavedSettings);
|
using var materiaTable = ImRaii.Table($"{inventoryType}_{slotIndex}_MateriaTable", 2, InnerTableFlags);
|
||||||
if (!materiaTable) continue;
|
if (!materiaTable) continue;
|
||||||
|
|
||||||
ImGui.TableSetupColumn("Materia Id"u8, ImGuiTableColumnFlags.WidthFixed, 80);
|
ImGui.TableSetupColumn("Materia Id"u8, ImGuiTableColumnFlags.WidthFixed, 80);
|
||||||
|
|
@ -311,10 +317,12 @@ internal class InventoryWidget : IDataWindowWidget
|
||||||
|
|
||||||
private uint GetItemRarityColor(uint itemId, bool isEdgeColor = false)
|
private uint GetItemRarityColor(uint itemId, bool isEdgeColor = false)
|
||||||
{
|
{
|
||||||
if (ItemUtil.IsEventItem(itemId))
|
var normalized = ItemUtil.GetBaseId(itemId);
|
||||||
|
|
||||||
|
if (normalized.Kind == ItemKind.EventItem)
|
||||||
return isEdgeColor ? 0xFF000000 : 0xFFFFFFFF;
|
return isEdgeColor ? 0xFF000000 : 0xFFFFFFFF;
|
||||||
|
|
||||||
if (!this.dataManager.Excel.GetSheet<Item>().TryGetRow(ItemUtil.GetBaseId(itemId).ItemId, out var item))
|
if (!this.dataManager.Excel.GetSheet<Item>().TryGetRow(normalized.ItemId, out var item))
|
||||||
return isEdgeColor ? 0xFF000000 : 0xFFFFFFFF;
|
return isEdgeColor ? 0xFF000000 : 0xFFFFFFFF;
|
||||||
|
|
||||||
var rowId = ItemUtil.GetItemRarityColorType(item.RowId, isEdgeColor);
|
var rowId = ItemUtil.GetItemRarityColorType(item.RowId, isEdgeColor);
|
||||||
|
|
@ -325,18 +333,12 @@ internal class InventoryWidget : IDataWindowWidget
|
||||||
|
|
||||||
private uint GetItemIconId(uint itemId)
|
private uint GetItemIconId(uint itemId)
|
||||||
{
|
{
|
||||||
|
var normalized = ItemUtil.GetBaseId(itemId);
|
||||||
|
|
||||||
// EventItem
|
// EventItem
|
||||||
if (ItemUtil.IsEventItem(itemId))
|
if (normalized.Kind == ItemKind.EventItem)
|
||||||
return this.dataManager.Excel.GetSheet<EventItem>().TryGetRow(itemId, out var eventItem) ? eventItem.Icon : 0u;
|
return this.dataManager.Excel.GetSheet<EventItem>().TryGetRow(itemId, out var eventItem) ? eventItem.Icon : 0u;
|
||||||
|
|
||||||
// HighQuality
|
return this.dataManager.Excel.GetSheet<Item>().TryGetRow(normalized.ItemId, out var item) ? item.Icon : 0u;
|
||||||
if (ItemUtil.IsHighQuality(itemId))
|
|
||||||
itemId -= 1_000_000;
|
|
||||||
|
|
||||||
// Collectible
|
|
||||||
if (ItemUtil.IsCollectible(itemId))
|
|
||||||
itemId -= 500_000;
|
|
||||||
|
|
||||||
return this.dataManager.Excel.GetSheet<Item>().TryGetRow(itemId, out var item) ? item.Icon : 0u;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
using Dalamud.Bindings.ImGui;
|
using Dalamud.Bindings.ImGui;
|
||||||
using Dalamud.Game.ClientState.Keys;
|
using Dalamud.Game.ClientState.Keys;
|
||||||
using Dalamud.Interface.Colors;
|
using Dalamud.Interface.Colors;
|
||||||
|
using Dalamud.Interface.Utility.Raii;
|
||||||
|
|
||||||
namespace Dalamud.Interface.Internal.Windows.Data.Widgets;
|
namespace Dalamud.Interface.Internal.Windows.Data.Widgets;
|
||||||
|
|
||||||
|
|
@ -10,7 +11,7 @@ namespace Dalamud.Interface.Internal.Windows.Data.Widgets;
|
||||||
internal class KeyStateWidget : IDataWindowWidget
|
internal class KeyStateWidget : IDataWindowWidget
|
||||||
{
|
{
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public string[]? CommandShortcuts { get; init; } = { "keystate" };
|
public string[]? CommandShortcuts { get; init; } = ["keystate"];
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public string DisplayName { get; init; } = "KeyState";
|
public string DisplayName { get; init; } = "KeyState";
|
||||||
|
|
@ -29,6 +30,7 @@ internal class KeyStateWidget : IDataWindowWidget
|
||||||
{
|
{
|
||||||
var keyState = Service<KeyState>.Get();
|
var keyState = Service<KeyState>.Get();
|
||||||
|
|
||||||
|
// TODO: Use table instead of columns
|
||||||
ImGui.Columns(4);
|
ImGui.Columns(4);
|
||||||
|
|
||||||
var i = 0;
|
var i = 0;
|
||||||
|
|
@ -37,11 +39,10 @@ internal class KeyStateWidget : IDataWindowWidget
|
||||||
var code = (int)vkCode;
|
var code = (int)vkCode;
|
||||||
var value = keyState[code];
|
var value = keyState[code];
|
||||||
|
|
||||||
ImGui.PushStyleColor(ImGuiCol.Text, value ? ImGuiColors.HealerGreen : ImGuiColors.DPSRed);
|
using (ImRaii.PushColor(ImGuiCol.Text, value ? ImGuiColors.HealerGreen : ImGuiColors.DPSRed))
|
||||||
|
{
|
||||||
ImGui.Text($"{vkCode} ({code})");
|
ImGui.Text($"{vkCode} ({code})");
|
||||||
|
}
|
||||||
ImGui.PopStyleColor();
|
|
||||||
|
|
||||||
i++;
|
i++;
|
||||||
if (i % 24 == 0)
|
if (i % 24 == 0)
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,6 @@ using System.Globalization;
|
||||||
using Dalamud.Bindings.ImGui;
|
using Dalamud.Bindings.ImGui;
|
||||||
using Dalamud.Game.MarketBoard;
|
using Dalamud.Game.MarketBoard;
|
||||||
using Dalamud.Game.Network.Structures;
|
using Dalamud.Game.Network.Structures;
|
||||||
using Dalamud.Interface.Utility;
|
|
||||||
using Dalamud.Interface.Utility.Raii;
|
using Dalamud.Interface.Utility.Raii;
|
||||||
|
|
||||||
using ImGuiTable = Dalamud.Interface.Utility.ImGuiTable;
|
using ImGuiTable = Dalamud.Interface.Utility.ImGuiTable;
|
||||||
|
|
@ -16,6 +15,8 @@ namespace Dalamud.Interface.Internal.Windows.Data.Widgets;
|
||||||
/// </summary>
|
/// </summary>
|
||||||
internal class MarketBoardWidget : IDataWindowWidget
|
internal class MarketBoardWidget : IDataWindowWidget
|
||||||
{
|
{
|
||||||
|
private const ImGuiTableFlags TableFlags = ImGuiTableFlags.SizingFixedFit | ImGuiTableFlags.RowBg;
|
||||||
|
|
||||||
private readonly ConcurrentQueue<(IMarketBoardHistory MarketBoardHistory, IMarketBoardHistoryListing Listing)> marketBoardHistoryQueue = new();
|
private readonly ConcurrentQueue<(IMarketBoardHistory MarketBoardHistory, IMarketBoardHistoryListing Listing)> marketBoardHistoryQueue = new();
|
||||||
private readonly ConcurrentQueue<(IMarketBoardCurrentOfferings MarketBoardCurrentOfferings, IMarketBoardItemListing Listing)> marketBoardCurrentOfferingsQueue = new();
|
private readonly ConcurrentQueue<(IMarketBoardCurrentOfferings MarketBoardCurrentOfferings, IMarketBoardItemListing Listing)> marketBoardCurrentOfferingsQueue = new();
|
||||||
private readonly ConcurrentQueue<IMarketBoardPurchase> marketBoardPurchasesQueue = new();
|
private readonly ConcurrentQueue<IMarketBoardPurchase> marketBoardPurchasesQueue = new();
|
||||||
|
|
@ -44,7 +45,7 @@ internal class MarketBoardWidget : IDataWindowWidget
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public string[]? CommandShortcuts { get; init; } = { "marketboard" };
|
public string[]? CommandShortcuts { get; init; } = ["marketboard"];
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public string DisplayName { get; init; } = "Market Board";
|
public string DisplayName { get; init; } = "Market Board";
|
||||||
|
|
@ -100,49 +101,47 @@ internal class MarketBoardWidget : IDataWindowWidget
|
||||||
this.marketBoardHistoryQueue.Clear();
|
this.marketBoardHistoryQueue.Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
using (var tabBar = ImRaii.TabBar("marketTabs"u8))
|
using var tabBar = ImRaii.TabBar("marketTabs"u8);
|
||||||
|
if (!tabBar.Success)
|
||||||
|
return;
|
||||||
|
|
||||||
|
using (var tabItem = ImRaii.TabItem("History"u8))
|
||||||
{
|
{
|
||||||
if (tabBar)
|
if (tabItem)
|
||||||
{
|
{
|
||||||
using (var tabItem = ImRaii.TabItem("History"u8))
|
ImGuiTable.DrawTable("history-table", this.marketBoardHistoryQueue, this.DrawMarketBoardHistory, TableFlags, "Item ID", "Quantity", "Is HQ?", "Sale Price", "Buyer Name", "Purchase Time");
|
||||||
{
|
}
|
||||||
if (tabItem)
|
}
|
||||||
{
|
|
||||||
ImGuiTable.DrawTable(string.Empty, this.marketBoardHistoryQueue, this.DrawMarketBoardHistory, ImGuiTableFlags.SizingFixedFit | ImGuiTableFlags.RowBg, "Item ID", "Quantity", "Is HQ?", "Sale Price", "Buyer Name", "Purchase Time");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
using (var tabItem = ImRaii.TabItem("Offerings"u8))
|
using (var tabItem = ImRaii.TabItem("Offerings"u8))
|
||||||
{
|
{
|
||||||
if (tabItem)
|
if (tabItem)
|
||||||
{
|
{
|
||||||
ImGuiTable.DrawTable(string.Empty, this.marketBoardCurrentOfferingsQueue, this.DrawMarketBoardCurrentOfferings, ImGuiTableFlags.SizingFixedFit | ImGuiTableFlags.RowBg, "Item ID", "Quantity", "Is HQ?", "Price Per Unit", "Retainer Name");
|
ImGuiTable.DrawTable("offerings-table", this.marketBoardCurrentOfferingsQueue, this.DrawMarketBoardCurrentOfferings, TableFlags, "Item ID", "Quantity", "Is HQ?", "Price Per Unit", "Retainer Name");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
using (var tabItem = ImRaii.TabItem("Purchases"u8))
|
using (var tabItem = ImRaii.TabItem("Purchases"u8))
|
||||||
{
|
{
|
||||||
if (tabItem)
|
if (tabItem)
|
||||||
{
|
{
|
||||||
ImGuiTable.DrawTable(string.Empty, this.marketBoardPurchasesQueue, this.DrawMarketBoardPurchases, ImGuiTableFlags.SizingFixedFit | ImGuiTableFlags.RowBg, "Item ID", "Quantity");
|
ImGuiTable.DrawTable("purchases-table", this.marketBoardPurchasesQueue, this.DrawMarketBoardPurchases, TableFlags, "Item ID", "Quantity");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
using (var tabItem = ImRaii.TabItem("Purchase Requests"u8))
|
using (var tabItem = ImRaii.TabItem("Purchase Requests"u8))
|
||||||
{
|
{
|
||||||
if (tabItem)
|
if (tabItem)
|
||||||
{
|
{
|
||||||
ImGuiTable.DrawTable(string.Empty, this.marketBoardPurchaseRequestsQueue, this.DrawMarketBoardPurchaseRequests, ImGuiTableFlags.SizingFixedFit | ImGuiTableFlags.RowBg, "Item ID", "Is HQ?", "Quantity", "Price Per Unit", "Total Tax", "City ID", "Listing ID", "Retainer ID");
|
ImGuiTable.DrawTable("requests-table", this.marketBoardPurchaseRequestsQueue, this.DrawMarketBoardPurchaseRequests, TableFlags, "Item ID", "Is HQ?", "Quantity", "Price Per Unit", "Total Tax", "City ID", "Listing ID", "Retainer ID");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
using (var tabItem = ImRaii.TabItem("Taxes"u8))
|
using (var tabItem = ImRaii.TabItem("Taxes"u8))
|
||||||
{
|
{
|
||||||
if (tabItem)
|
if (tabItem)
|
||||||
{
|
{
|
||||||
ImGuiTable.DrawTable(string.Empty, this.marketTaxRatesQueue, this.DrawMarketTaxRates, ImGuiTableFlags.SizingFixedFit | ImGuiTableFlags.RowBg, "Uldah", "Limsa Lominsa", "Gridania", "Ishgard", "Kugane", "Crystarium", "Sharlayan", "Tuliyollal", "Valid Until");
|
ImGuiTable.DrawTable("taxes-table", this.marketTaxRatesQueue, this.DrawMarketTaxRates, TableFlags, "Uldah", "Limsa Lominsa", "Gridania", "Ishgard", "Kugane", "Crystarium", "Sharlayan", "Tuliyollal", "Valid Until");
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,7 @@ internal class NetworkMonitorWidget : IDataWindowWidget
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public string[]? CommandShortcuts { get; init; } = { "network", "netmon", "networkmonitor" };
|
public string[]? CommandShortcuts { get; init; } = ["network", "netmon", "networkmonitor"];
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public string DisplayName { get; init; } = "Network Monitor";
|
public string DisplayName { get; init; } = "Network Monitor";
|
||||||
|
|
@ -209,7 +209,7 @@ internal class NetworkMonitorWidget : IDataWindowWidget
|
||||||
private readonly record struct NetworkPacketData(ushort OpCode, NetworkMessageDirection Direction, uint SourceActorId, uint TargetActorId)
|
private readonly record struct NetworkPacketData(ushort OpCode, NetworkMessageDirection Direction, uint SourceActorId, uint TargetActorId)
|
||||||
#pragma warning restore SA1313
|
#pragma warning restore SA1313
|
||||||
{
|
{
|
||||||
public readonly IReadOnlyList<byte> Data = Array.Empty<byte>();
|
public readonly IReadOnlyList<byte> Data = [];
|
||||||
|
|
||||||
public NetworkPacketData(NetworkMonitorWidget widget, ushort opCode, NetworkMessageDirection direction, uint sourceActorId, uint targetActorId, nint dataPtr)
|
public NetworkPacketData(NetworkMonitorWidget widget, ushort opCode, NetworkMessageDirection direction, uint sourceActorId, uint targetActorId, nint dataPtr)
|
||||||
: this(opCode, direction, sourceActorId, targetActorId)
|
: this(opCode, direction, sourceActorId, targetActorId)
|
||||||
|
|
|
||||||
|
|
@ -54,13 +54,13 @@ internal class NounProcessorWidget : IDataWindowWidget
|
||||||
private ClientLanguage[] languages = [];
|
private ClientLanguage[] languages = [];
|
||||||
private string[] languageNames = [];
|
private string[] languageNames = [];
|
||||||
|
|
||||||
private int selectedSheetNameIndex = 0;
|
private int selectedSheetNameIndex;
|
||||||
private int selectedLanguageIndex = 0;
|
private int selectedLanguageIndex;
|
||||||
private int rowId = 1;
|
private int rowId = 1;
|
||||||
private int amount = 1;
|
private int amount = 1;
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public string[]? CommandShortcuts { get; init; } = { "noun" };
|
public string[]? CommandShortcuts { get; init; } = ["noun"];
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public string DisplayName { get; init; } = "Noun Processor";
|
public string DisplayName { get; init; } = "Noun Processor";
|
||||||
|
|
@ -83,7 +83,6 @@ internal class NounProcessorWidget : IDataWindowWidget
|
||||||
{
|
{
|
||||||
var nounProcessor = Service<NounProcessor>.Get();
|
var nounProcessor = Service<NounProcessor>.Get();
|
||||||
var dataManager = Service<DataManager>.Get();
|
var dataManager = Service<DataManager>.Get();
|
||||||
var clientState = Service<ClientState>.Get();
|
|
||||||
|
|
||||||
var sheetType = NounSheets.ElementAt(this.selectedSheetNameIndex);
|
var sheetType = NounSheets.ElementAt(this.selectedSheetNameIndex);
|
||||||
var language = this.languages[this.selectedLanguageIndex];
|
var language = this.languages[this.selectedLanguageIndex];
|
||||||
|
|
|
||||||
|
|
@ -14,12 +14,17 @@ namespace Dalamud.Interface.Internal.Windows.Data.Widgets;
|
||||||
/// </summary>
|
/// </summary>
|
||||||
internal class ObjectTableWidget : IDataWindowWidget
|
internal class ObjectTableWidget : IDataWindowWidget
|
||||||
{
|
{
|
||||||
|
private const ImGuiWindowFlags CharacterWindowFlags = ImGuiWindowFlags.NoDecoration | ImGuiWindowFlags.AlwaysAutoResize |
|
||||||
|
ImGuiWindowFlags.NoSavedSettings | ImGuiWindowFlags.NoMove |
|
||||||
|
ImGuiWindowFlags.NoMouseInputs | ImGuiWindowFlags.NoDocking |
|
||||||
|
ImGuiWindowFlags.NoFocusOnAppearing | ImGuiWindowFlags.NoNav;
|
||||||
|
|
||||||
private bool resolveGameData;
|
private bool resolveGameData;
|
||||||
private bool drawCharacters;
|
private bool drawCharacters;
|
||||||
private float maxCharaDrawDistance = 20.0f;
|
private float maxCharaDrawDistance = 20.0f;
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public string[]? CommandShortcuts { get; init; } = { "ot", "objecttable" };
|
public string[]? CommandShortcuts { get; init; } = ["ot", "objecttable"];
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public string DisplayName { get; init; } = "Object Table";
|
public string DisplayName { get; init; } = "Object Table";
|
||||||
|
|
@ -49,74 +54,66 @@ internal class ObjectTableWidget : IDataWindowWidget
|
||||||
if (objectTable.LocalPlayer == null)
|
if (objectTable.LocalPlayer == null)
|
||||||
{
|
{
|
||||||
ImGui.Text("LocalPlayer null."u8);
|
ImGui.Text("LocalPlayer null."u8);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
else if (clientState.IsPvPExcludingDen)
|
|
||||||
|
if (clientState.IsPvPExcludingDen)
|
||||||
{
|
{
|
||||||
ImGui.Text("Cannot access object table while in PvP."u8);
|
ImGui.Text("Cannot access object table while in PvP."u8);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
stateString += $"ObjectTableLen: {objectTable.Length}\n";
|
||||||
|
stateString += $"LocalPlayerName: {playerState.CharacterName}\n";
|
||||||
|
stateString += $"CurrentWorldName: {(this.resolveGameData ? playerState.CurrentWorld.ValueNullable?.Name : playerState.CurrentWorld.RowId.ToString())}\n";
|
||||||
|
stateString += $"HomeWorldName: {(this.resolveGameData ? playerState.HomeWorld.ValueNullable?.Name : playerState.HomeWorld.RowId.ToString())}\n";
|
||||||
|
stateString += $"LocalCID: {playerState.ContentId:X}\n";
|
||||||
|
stateString += $"LastLinkedItem: {chatGui.LastLinkedItemId}\n";
|
||||||
|
stateString += $"TerritoryType: {clientState.TerritoryType}\n\n";
|
||||||
|
|
||||||
|
ImGui.Text(stateString);
|
||||||
|
|
||||||
|
ImGui.Checkbox("Draw characters on screen"u8, ref this.drawCharacters);
|
||||||
|
ImGui.SliderFloat("Draw Distance"u8, ref this.maxCharaDrawDistance, 2f, 40f);
|
||||||
|
|
||||||
|
for (var i = 0; i < objectTable.Length; i++)
|
||||||
{
|
{
|
||||||
stateString += $"ObjectTableLen: {objectTable.Length}\n";
|
var obj = objectTable[i];
|
||||||
stateString += $"LocalPlayerName: {playerState.CharacterName}\n";
|
|
||||||
stateString += $"CurrentWorldName: {(this.resolveGameData ? playerState.CurrentWorld.ValueNullable?.Name : playerState.CurrentWorld.RowId.ToString())}\n";
|
|
||||||
stateString += $"HomeWorldName: {(this.resolveGameData ? playerState.HomeWorld.ValueNullable?.Name : playerState.HomeWorld.RowId.ToString())}\n";
|
|
||||||
stateString += $"LocalCID: {playerState.ContentId:X}\n";
|
|
||||||
stateString += $"LastLinkedItem: {chatGui.LastLinkedItemId}\n";
|
|
||||||
stateString += $"TerritoryType: {clientState.TerritoryType}\n\n";
|
|
||||||
|
|
||||||
ImGui.Text(stateString);
|
if (obj == null)
|
||||||
|
continue;
|
||||||
|
|
||||||
ImGui.Checkbox("Draw characters on screen"u8, ref this.drawCharacters);
|
Util.PrintGameObject(obj, i.ToString(), this.resolveGameData);
|
||||||
ImGui.SliderFloat("Draw Distance"u8, ref this.maxCharaDrawDistance, 2f, 40f);
|
|
||||||
|
|
||||||
for (var i = 0; i < objectTable.Length; i++)
|
if (this.drawCharacters && gameGui.WorldToScreen(obj.Position, out var screenCoords))
|
||||||
{
|
{
|
||||||
var obj = objectTable[i];
|
// So, while WorldToScreen will return false if the point is off of game client screen, to
|
||||||
|
// to avoid performance issues, we have to manually determine if creating a window would
|
||||||
|
// produce a new viewport, and skip rendering it if so
|
||||||
|
var objectText = $"{obj.Address:X}:{obj.GameObjectId:X}[{i}] - {obj.ObjectKind} - {obj.Name}";
|
||||||
|
|
||||||
if (obj == null)
|
var screenPos = ImGui.GetMainViewport().Pos;
|
||||||
|
var screenSize = ImGui.GetMainViewport().Size;
|
||||||
|
|
||||||
|
var windowSize = ImGui.CalcTextSize(objectText);
|
||||||
|
|
||||||
|
// Add some extra safety padding
|
||||||
|
windowSize.X += ImGui.GetStyle().WindowPadding.X + 10;
|
||||||
|
windowSize.Y += ImGui.GetStyle().WindowPadding.Y + 10;
|
||||||
|
|
||||||
|
if (screenCoords.X + windowSize.X > screenPos.X + screenSize.X ||
|
||||||
|
screenCoords.Y + windowSize.Y > screenPos.Y + screenSize.Y)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
Util.PrintGameObject(obj, i.ToString(), this.resolveGameData);
|
if (obj.YalmDistanceX > this.maxCharaDrawDistance)
|
||||||
|
continue;
|
||||||
|
|
||||||
if (this.drawCharacters && gameGui.WorldToScreen(obj.Position, out var screenCoords))
|
ImGui.SetNextWindowPos(new Vector2(screenCoords.X, screenCoords.Y));
|
||||||
{
|
ImGui.SetNextWindowBgAlpha(Math.Max(1f - (obj.YalmDistanceX / this.maxCharaDrawDistance), 0.2f));
|
||||||
// So, while WorldToScreen will return false if the point is off of game client screen, to
|
|
||||||
// to avoid performance issues, we have to manually determine if creating a window would
|
|
||||||
// produce a new viewport, and skip rendering it if so
|
|
||||||
var objectText = $"{obj.Address.ToInt64():X}:{obj.GameObjectId:X}[{i}] - {obj.ObjectKind} - {obj.Name}";
|
|
||||||
|
|
||||||
var screenPos = ImGui.GetMainViewport().Pos;
|
if (ImGui.Begin($"Actor{i}##ActorWindow{i}", CharacterWindowFlags))
|
||||||
var screenSize = ImGui.GetMainViewport().Size;
|
ImGui.Text(objectText);
|
||||||
|
ImGui.End();
|
||||||
var windowSize = ImGui.CalcTextSize(objectText);
|
|
||||||
|
|
||||||
// Add some extra safety padding
|
|
||||||
windowSize.X += ImGui.GetStyle().WindowPadding.X + 10;
|
|
||||||
windowSize.Y += ImGui.GetStyle().WindowPadding.Y + 10;
|
|
||||||
|
|
||||||
if (screenCoords.X + windowSize.X > screenPos.X + screenSize.X ||
|
|
||||||
screenCoords.Y + windowSize.Y > screenPos.Y + screenSize.Y)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (obj.YalmDistanceX > this.maxCharaDrawDistance)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
ImGui.SetNextWindowPos(new Vector2(screenCoords.X, screenCoords.Y));
|
|
||||||
|
|
||||||
ImGui.SetNextWindowBgAlpha(Math.Max(1f - (obj.YalmDistanceX / this.maxCharaDrawDistance), 0.2f));
|
|
||||||
if (ImGui.Begin(
|
|
||||||
$"Actor{i}##ActorWindow{i}",
|
|
||||||
ImGuiWindowFlags.NoDecoration |
|
|
||||||
ImGuiWindowFlags.AlwaysAutoResize |
|
|
||||||
ImGuiWindowFlags.NoSavedSettings |
|
|
||||||
ImGuiWindowFlags.NoMove |
|
|
||||||
ImGuiWindowFlags.NoMouseInputs |
|
|
||||||
ImGuiWindowFlags.NoDocking |
|
|
||||||
ImGuiWindowFlags.NoFocusOnAppearing |
|
|
||||||
ImGuiWindowFlags.NoNav))
|
|
||||||
ImGui.Text(objectText);
|
|
||||||
ImGui.End();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ internal class PartyListWidget : IDataWindowWidget
|
||||||
private bool resolveGameData;
|
private bool resolveGameData;
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public string[]? CommandShortcuts { get; init; } = { "partylist", "party" };
|
public string[]? CommandShortcuts { get; init; } = ["partylist", "party"];
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public string DisplayName { get; init; } = "Party List";
|
public string DisplayName { get; init; } = "Party List";
|
||||||
|
|
@ -33,9 +33,9 @@ internal class PartyListWidget : IDataWindowWidget
|
||||||
|
|
||||||
ImGui.Checkbox("Resolve GameData"u8, ref this.resolveGameData);
|
ImGui.Checkbox("Resolve GameData"u8, ref this.resolveGameData);
|
||||||
|
|
||||||
ImGui.Text($"GroupManager: {partyList.GroupManagerAddress.ToInt64():X}");
|
ImGui.Text($"GroupManager: {partyList.GroupManagerAddress:X}");
|
||||||
ImGui.Text($"GroupList: {partyList.GroupListAddress.ToInt64():X}");
|
ImGui.Text($"GroupList: {partyList.GroupListAddress:X}");
|
||||||
ImGui.Text($"AllianceList: {partyList.AllianceListAddress.ToInt64():X}");
|
ImGui.Text($"AllianceList: {partyList.AllianceListAddress:X}");
|
||||||
|
|
||||||
ImGui.Text($"{partyList.Length} Members");
|
ImGui.Text($"{partyList.Length} Members");
|
||||||
|
|
||||||
|
|
@ -48,7 +48,7 @@ internal class PartyListWidget : IDataWindowWidget
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui.Text($"[{i}] {member.Address.ToInt64():X} - {member.Name} - {member.GameObject?.GameObjectId}");
|
ImGui.Text($"[{i}] {member.Address:X} - {member.Name} - {member.GameObject?.GameObjectId ?? 0}");
|
||||||
if (this.resolveGameData)
|
if (this.resolveGameData)
|
||||||
{
|
{
|
||||||
var actor = member.GameObject;
|
var actor = member.GameObject;
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ internal class PluginIpcWidget : IDataWindowWidget
|
||||||
private string callGateResponse = string.Empty;
|
private string callGateResponse = string.Empty;
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public string[]? CommandShortcuts { get; init; } = { "ipc" };
|
public string[]? CommandShortcuts { get; init; } = ["ipc"];
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public string DisplayName { get; init; } = "Plugin IPC";
|
public string DisplayName { get; init; } = "Plugin IPC";
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ namespace Dalamud.Interface.Internal.Windows.Data.Widgets;
|
||||||
internal class SeFontTestWidget : IDataWindowWidget
|
internal class SeFontTestWidget : IDataWindowWidget
|
||||||
{
|
{
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public string[]? CommandShortcuts { get; init; } = { "sefont", "sefonttest" };
|
public string[]? CommandShortcuts { get; init; } = ["sefont", "sefonttest"];
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public string DisplayName { get; init; } = "SeFont Test";
|
public string DisplayName { get; init; } = "SeFont Test";
|
||||||
|
|
|
||||||
|
|
@ -38,6 +38,11 @@ internal class SeStringCreatorWidget : IDataWindowWidget
|
||||||
{
|
{
|
||||||
private const LinkMacroPayloadType DalamudLinkType = (LinkMacroPayloadType)Payload.EmbeddedInfoType.DalamudLink - 1;
|
private const LinkMacroPayloadType DalamudLinkType = (LinkMacroPayloadType)Payload.EmbeddedInfoType.DalamudLink - 1;
|
||||||
|
|
||||||
|
private const ImGuiTableFlags TableFlags = ImGuiTableFlags.Borders | ImGuiTableFlags.RowBg |
|
||||||
|
ImGuiTableFlags.ScrollY | ImGuiTableFlags.NoSavedSettings;
|
||||||
|
|
||||||
|
private static readonly string[] TextEntryTypeOptions = ["String", "Macro", "Fixed"];
|
||||||
|
|
||||||
private readonly Dictionary<MacroCode, string[]> expressionNames = new()
|
private readonly Dictionary<MacroCode, string[]> expressionNames = new()
|
||||||
{
|
{
|
||||||
{ MacroCode.SetResetTime, ["Hour", "WeekDay"] },
|
{ MacroCode.SetResetTime, ["Hour", "WeekDay"] },
|
||||||
|
|
@ -191,7 +196,7 @@ internal class SeStringCreatorWidget : IDataWindowWidget
|
||||||
if (contentWidth != this.lastContentWidth)
|
if (contentWidth != this.lastContentWidth)
|
||||||
{
|
{
|
||||||
var originalWidth = this.lastContentWidth != 0 ? this.lastContentWidth : contentWidth;
|
var originalWidth = this.lastContentWidth != 0 ? this.lastContentWidth : contentWidth;
|
||||||
this.inputsWidth = this.inputsWidth / originalWidth * contentWidth;
|
this.inputsWidth = (this.inputsWidth / originalWidth) * contentWidth;
|
||||||
this.lastContentWidth = contentWidth;
|
this.lastContentWidth = contentWidth;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -258,7 +263,7 @@ internal class SeStringCreatorWidget : IDataWindowWidget
|
||||||
using var tab = ImRaii.TabItem("Global Parameters"u8);
|
using var tab = ImRaii.TabItem("Global Parameters"u8);
|
||||||
if (!tab) return;
|
if (!tab) return;
|
||||||
|
|
||||||
using var table = ImRaii.Table("GlobalParametersTable"u8, 5, ImGuiTableFlags.Borders | ImGuiTableFlags.RowBg | ImGuiTableFlags.ScrollY | ImGuiTableFlags.NoSavedSettings);
|
using var table = ImRaii.Table("GlobalParametersTable"u8, 5, TableFlags);
|
||||||
if (!table) return;
|
if (!table) return;
|
||||||
|
|
||||||
ImGui.TableSetupColumn("Id"u8, ImGuiTableColumnFlags.WidthFixed, 40);
|
ImGui.TableSetupColumn("Id"u8, ImGuiTableColumnFlags.WidthFixed, 40);
|
||||||
|
|
@ -541,18 +546,16 @@ internal class SeStringCreatorWidget : IDataWindowWidget
|
||||||
|
|
||||||
ImGui.SameLine();
|
ImGui.SameLine();
|
||||||
ImGui.SetNextItemWidth(90 * ImGuiHelpers.GlobalScale);
|
ImGui.SetNextItemWidth(90 * ImGuiHelpers.GlobalScale);
|
||||||
using (var dropdown = ImRaii.Combo("##Language"u8, this.language.ToString() ?? "Language..."))
|
using var dropdown = ImRaii.Combo("##Language"u8, this.language.ToString() ?? "Language...");
|
||||||
|
if (dropdown)
|
||||||
{
|
{
|
||||||
if (dropdown)
|
var values = Enum.GetValues<ClientLanguage>().OrderBy(lang => lang.ToString());
|
||||||
|
foreach (var value in values)
|
||||||
{
|
{
|
||||||
var values = Enum.GetValues<ClientLanguage>().OrderBy((ClientLanguage lang) => lang.ToString());
|
if (ImGui.Selectable(Enum.GetName(value), value == this.language))
|
||||||
foreach (var value in values)
|
|
||||||
{
|
{
|
||||||
if (ImGui.Selectable(Enum.GetName(value), value == this.language))
|
this.language = value;
|
||||||
{
|
this.UpdateInputString();
|
||||||
this.language = value;
|
|
||||||
this.UpdateInputString();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -572,7 +575,7 @@ internal class SeStringCreatorWidget : IDataWindowWidget
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var headerFile = dataManager.GameData.GetFile<ExcelHeaderFile>($"exd/{sheetName}.exh");
|
var headerFile = dataManager.GameData.GetFile<ExcelHeaderFile>($"exd/{sheetName}.exh");
|
||||||
if (headerFile.Header.Variant != ExcelVariant.Default)
|
if (headerFile == null || headerFile.Header.Variant != ExcelVariant.Default)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
var sheet = dataManager.Excel.GetSheet<RawRow>(Language.English, sheetName);
|
var sheet = dataManager.Excel.GetSheet<RawRow>(Language.English, sheetName);
|
||||||
|
|
@ -668,11 +671,10 @@ internal class SeStringCreatorWidget : IDataWindowWidget
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
ImGui.Text(e.Message);
|
ImGui.Text(e.Message);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private unsafe void DrawInputs()
|
private void DrawInputs()
|
||||||
{
|
{
|
||||||
using var child = ImRaii.Child("Inputs"u8, new Vector2(this.inputsWidth, -1));
|
using var child = ImRaii.Child("Inputs"u8, new Vector2(this.inputsWidth, -1));
|
||||||
if (!child) return;
|
if (!child) return;
|
||||||
|
|
@ -688,8 +690,6 @@ internal class SeStringCreatorWidget : IDataWindowWidget
|
||||||
|
|
||||||
var arrowUpButtonSize = this.GetIconButtonSize(FontAwesomeIcon.ArrowUp);
|
var arrowUpButtonSize = this.GetIconButtonSize(FontAwesomeIcon.ArrowUp);
|
||||||
var arrowDownButtonSize = this.GetIconButtonSize(FontAwesomeIcon.ArrowDown);
|
var arrowDownButtonSize = this.GetIconButtonSize(FontAwesomeIcon.ArrowDown);
|
||||||
var trashButtonSize = this.GetIconButtonSize(FontAwesomeIcon.Trash);
|
|
||||||
var terminalButtonSize = this.GetIconButtonSize(FontAwesomeIcon.Terminal);
|
|
||||||
|
|
||||||
var entryToRemove = -1;
|
var entryToRemove = -1;
|
||||||
var entryToMoveUp = -1;
|
var entryToMoveUp = -1;
|
||||||
|
|
@ -706,7 +706,7 @@ internal class SeStringCreatorWidget : IDataWindowWidget
|
||||||
ImGui.TableNextColumn(); // Type
|
ImGui.TableNextColumn(); // Type
|
||||||
var type = (int)entry.Type;
|
var type = (int)entry.Type;
|
||||||
ImGui.SetNextItemWidth(-1);
|
ImGui.SetNextItemWidth(-1);
|
||||||
if (ImGui.Combo($"##Type{i}", ref type, ["String", "Macro", "Fixed"]))
|
if (ImGui.Combo($"##Type{i}", ref type, TextEntryTypeOptions))
|
||||||
{
|
{
|
||||||
entry.Type = (TextEntryType)type;
|
entry.Type = (TextEntryType)type;
|
||||||
updateString |= true;
|
updateString |= true;
|
||||||
|
|
@ -798,7 +798,7 @@ internal class SeStringCreatorWidget : IDataWindowWidget
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private unsafe void UpdateInputString(bool resetLocalParameters = true)
|
private void UpdateInputString(bool resetLocalParameters = true)
|
||||||
{
|
{
|
||||||
using var rssb = new RentedSeStringBuilder();
|
using var rssb = new RentedSeStringBuilder();
|
||||||
|
|
||||||
|
|
@ -1022,14 +1022,14 @@ internal class SeStringCreatorWidget : IDataWindowWidget
|
||||||
|
|
||||||
if (macroCode is MacroCode.JaNoun or MacroCode.EnNoun or MacroCode.DeNoun or MacroCode.FrNoun && exprIdx == 1)
|
if (macroCode is MacroCode.JaNoun or MacroCode.EnNoun or MacroCode.DeNoun or MacroCode.FrNoun && exprIdx == 1)
|
||||||
{
|
{
|
||||||
var language = macroCode switch
|
var macroLanguage = macroCode switch
|
||||||
{
|
{
|
||||||
MacroCode.JaNoun => ClientLanguage.Japanese,
|
MacroCode.JaNoun => ClientLanguage.Japanese,
|
||||||
MacroCode.DeNoun => ClientLanguage.German,
|
MacroCode.DeNoun => ClientLanguage.German,
|
||||||
MacroCode.FrNoun => ClientLanguage.French,
|
MacroCode.FrNoun => ClientLanguage.French,
|
||||||
_ => ClientLanguage.English,
|
_ => ClientLanguage.English,
|
||||||
};
|
};
|
||||||
var articleTypeEnumType = language switch
|
var articleTypeEnumType = macroLanguage switch
|
||||||
{
|
{
|
||||||
ClientLanguage.Japanese => typeof(JapaneseArticleType),
|
ClientLanguage.Japanese => typeof(JapaneseArticleType),
|
||||||
ClientLanguage.German => typeof(GermanArticleType),
|
ClientLanguage.German => typeof(GermanArticleType),
|
||||||
|
|
@ -1208,12 +1208,10 @@ internal class SeStringCreatorWidget : IDataWindowWidget
|
||||||
if (expressionType == (int)ExpressionType.LocalNumber)
|
if (expressionType == (int)ExpressionType.LocalNumber)
|
||||||
{
|
{
|
||||||
parameters[index] = new SeStringParameter(0);
|
parameters[index] = new SeStringParameter(0);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
else if (expressionType == (int)ExpressionType.LocalString)
|
else if (expressionType == (int)ExpressionType.LocalString)
|
||||||
{
|
{
|
||||||
parameters[index] = new SeStringParameter(string.Empty);
|
parameters[index] = new SeStringParameter(string.Empty);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -17,14 +17,13 @@ namespace Dalamud.Interface.Internal.Windows.Data.Widgets;
|
||||||
internal class ServicesWidget : IDataWindowWidget
|
internal class ServicesWidget : IDataWindowWidget
|
||||||
{
|
{
|
||||||
private readonly Dictionary<ServiceDependencyNode, Vector4> nodeRects = new();
|
private readonly Dictionary<ServiceDependencyNode, Vector4> nodeRects = new();
|
||||||
private readonly HashSet<Type> selectedNodes = new();
|
private readonly HashSet<Type> selectedNodes = [];
|
||||||
private readonly HashSet<Type> tempRelatedNodes = new();
|
|
||||||
|
|
||||||
private bool includeUnloadDependencies;
|
private bool includeUnloadDependencies;
|
||||||
private List<List<ServiceDependencyNode>>? dependencyNodes;
|
private List<List<ServiceDependencyNode>>? dependencyNodes;
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public string[]? CommandShortcuts { get; init; } = { "services" };
|
public string[]? CommandShortcuts { get; init; } = ["services"];
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public string DisplayName { get; init; } = "Service Container";
|
public string DisplayName { get; init; } = "Service Container";
|
||||||
|
|
@ -66,11 +65,10 @@ internal class ServicesWidget : IDataWindowWidget
|
||||||
var margin = ImGui.CalcTextSize("W\nW\nW"u8);
|
var margin = ImGui.CalcTextSize("W\nW\nW"u8);
|
||||||
var rowHeight = cellPad.Y * 3;
|
var rowHeight = cellPad.Y * 3;
|
||||||
var width = ImGui.GetContentRegionAvail().X;
|
var width = ImGui.GetContentRegionAvail().X;
|
||||||
if (ImGui.BeginChild(
|
var childSize = new Vector2(width, (this.dependencyNodes.Count * (rowHeight + margin.Y)) + cellPad.Y);
|
||||||
"dependency-graph"u8,
|
|
||||||
new(width, (this.dependencyNodes.Count * (rowHeight + margin.Y)) + cellPad.Y),
|
using var child = ImRaii.Child("dependency-graph"u8, childSize, false, ImGuiWindowFlags.HorizontalScrollbar);
|
||||||
false,
|
if (child.Success)
|
||||||
ImGuiWindowFlags.HorizontalScrollbar))
|
|
||||||
{
|
{
|
||||||
const uint rectBaseBorderColor = 0xFFFFFFFF;
|
const uint rectBaseBorderColor = 0xFFFFFFFF;
|
||||||
const uint rectHoverFillColor = 0xFF404040;
|
const uint rectHoverFillColor = 0xFF404040;
|
||||||
|
|
@ -118,10 +116,8 @@ internal class ServicesWidget : IDataWindowWidget
|
||||||
hoveredNode = node;
|
hoveredNode = node;
|
||||||
if (ImGui.IsMouseClicked(ImGuiMouseButton.Left))
|
if (ImGui.IsMouseClicked(ImGuiMouseButton.Left))
|
||||||
{
|
{
|
||||||
if (this.selectedNodes.Contains(node.Type))
|
if (!this.selectedNodes.Add(node.Type))
|
||||||
this.selectedNodes.Remove(node.Type);
|
this.selectedNodes.Remove(node.Type);
|
||||||
else
|
|
||||||
this.selectedNodes.Add(node.Type);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -195,13 +191,11 @@ internal class ServicesWidget : IDataWindowWidget
|
||||||
ImGui.SetTooltip(node.BlockingReason);
|
ImGui.SetTooltip(node.BlockingReason);
|
||||||
|
|
||||||
ImGui.SetCursorPos((new Vector2(rc.X, rc.Y) - pos) + ((cellSize - textSize) / 2));
|
ImGui.SetCursorPos((new Vector2(rc.X, rc.Y) - pos) + ((cellSize - textSize) / 2));
|
||||||
ImGui.PushStyleVar(ImGuiStyleVar.ItemSpacing, Vector2.Zero);
|
using var pushedStyle = ImRaii.PushStyle(ImGuiStyleVar.ItemSpacing, Vector2.Zero);
|
||||||
ImGui.Text(node.DisplayedName);
|
ImGui.Text(node.DisplayedName);
|
||||||
ImGui.SameLine();
|
ImGui.SameLine();
|
||||||
ImGui.PushStyleColor(ImGuiCol.Text, node.TypeSuffixColor);
|
using var pushedColor = ImRaii.PushColor(ImGuiCol.Text, node.TypeSuffixColor);
|
||||||
ImGui.Text(node.TypeSuffix);
|
ImGui.Text(node.TypeSuffix);
|
||||||
ImGui.PopStyleVar();
|
|
||||||
ImGui.PopStyleColor();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -233,7 +227,6 @@ internal class ServicesWidget : IDataWindowWidget
|
||||||
|
|
||||||
ImGui.SetCursorPos(default);
|
ImGui.SetCursorPos(default);
|
||||||
ImGui.Dummy(new(maxRowWidth, this.dependencyNodes.Count * rowHeight));
|
ImGui.Dummy(new(maxRowWidth, this.dependencyNodes.Count * rowHeight));
|
||||||
ImGui.EndChild();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -280,9 +273,9 @@ internal class ServicesWidget : IDataWindowWidget
|
||||||
|
|
||||||
private class ServiceDependencyNode
|
private class ServiceDependencyNode
|
||||||
{
|
{
|
||||||
private readonly List<ServiceDependencyNode> parents = new();
|
private readonly List<ServiceDependencyNode> parents = [];
|
||||||
private readonly List<ServiceDependencyNode> children = new();
|
private readonly List<ServiceDependencyNode> children = [];
|
||||||
private readonly List<ServiceDependencyNode> invalidParents = new();
|
private readonly List<ServiceDependencyNode> invalidParents = [];
|
||||||
|
|
||||||
private ServiceDependencyNode(Type t)
|
private ServiceDependencyNode(Type t)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue