/xldata window refactor (#1257)

Reworks the `/xldata` window so that each individual section is in its own file.
This commit is contained in:
MidoriKami 2023-06-23 10:54:40 -07:00 committed by GitHub
parent 11ea64410e
commit 694159a510
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
37 changed files with 2701 additions and 1893 deletions

View file

@ -0,0 +1,66 @@
using Dalamud.Game.Gui;
using Dalamud.Memory;
using Dalamud.Utility;
using ImGuiNET;
namespace Dalamud.Interface.Internal.Windows.Data;
/// <summary>
/// Widget for displaying Addon Data.
/// </summary>
internal unsafe class AddonWidget : IDataWindowWidget
{
private string inputAddonName = string.Empty;
private int inputAddonIndex;
private nint findAgentInterfacePtr;
/// <inheritdoc/>
public DataKind DataKind { get; init; } = DataKind.Addon;
/// <inheritdoc/>
public bool Ready { get; set; }
/// <inheritdoc/>
public void Load()
{
this.Ready = true;
}
/// <inheritdoc/>
public void Draw()
{
var gameGui = Service<GameGui>.Get();
ImGui.InputText("Addon Name", ref this.inputAddonName, 256);
ImGui.InputInt("Addon Index", ref this.inputAddonIndex);
if (this.inputAddonName.IsNullOrEmpty())
return;
var address = gameGui.GetAddonByName(this.inputAddonName, this.inputAddonIndex);
if (address == nint.Zero)
{
ImGui.Text("Null");
return;
}
var addon = (FFXIVClientStructs.FFXIV.Component.GUI.AtkUnitBase*)address;
var name = MemoryHelper.ReadStringNullTerminated((nint)addon->Name);
ImGui.TextUnformatted($"{name} - 0x{address.ToInt64():X}\n v:{addon->IsVisible} x:{addon->X} y:{addon->Y} s:{addon->Scale}, w:{addon->RootNode->Width}, h:{addon->RootNode->Height}");
if (ImGui.Button("Find Agent"))
{
this.findAgentInterfacePtr = gameGui.FindAgentInterface(address);
}
if (this.findAgentInterfacePtr != nint.Zero)
{
ImGui.TextUnformatted($"Agent: 0x{this.findAgentInterfacePtr.ToInt64():X}");
ImGui.SameLine();
if (ImGui.Button("C"))
ImGui.SetClipboardText(this.findAgentInterfacePtr.ToInt64().ToString("X"));
}
}
}