Dalamud/Dalamud/Interface/Internal/Windows/Data/Widgets/PartyListWidget.cs
MidoriKami 694159a510
/xldata window refactor (#1257)
Reworks the `/xldata` window so that each individual section is in its own file.
2023-06-23 10:54:40 -07:00

63 lines
1.7 KiB
C#

using Dalamud.Game.ClientState.Party;
using Dalamud.Utility;
using ImGuiNET;
namespace Dalamud.Interface.Internal.Windows.Data;
/// <summary>
/// Widget for displaying information about the current party.
/// </summary>
internal class PartyListWidget : IDataWindowWidget
{
private bool resolveGameData;
/// <inheritdoc/>
public DataKind DataKind { get; init; } = DataKind.Party_List;
/// <inheritdoc/>
public bool Ready { get; set; }
/// <inheritdoc/>
public void Load()
{
this.Ready = true;
}
/// <inheritdoc/>
public void Draw()
{
var partyList = Service<PartyList>.Get();
ImGui.Checkbox("Resolve GameData", ref this.resolveGameData);
ImGui.Text($"GroupManager: {partyList.GroupManagerAddress.ToInt64():X}");
ImGui.Text($"GroupList: {partyList.GroupListAddress.ToInt64():X}");
ImGui.Text($"AllianceList: {partyList.AllianceListAddress.ToInt64():X}");
ImGui.Text($"{partyList.Length} Members");
for (var i = 0; i < partyList.Length; i++)
{
var member = partyList[i];
if (member == null)
{
ImGui.Text($"[{i}] was null");
continue;
}
ImGui.Text($"[{i}] {member.Address.ToInt64():X} - {member.Name} - {member.GameObject?.ObjectId}");
if (this.resolveGameData)
{
var actor = member.GameObject;
if (actor == null)
{
ImGui.Text("Actor was null");
}
else
{
Util.PrintGameObject(actor, "-", this.resolveGameData);
}
}
}
}
}