using Dalamud.Game.ClientState.Buddy; using Dalamud.Utility; using Dalamud.Bindings.ImGui; namespace Dalamud.Interface.Internal.Windows.Data.Widgets; /// /// Widget for displaying data about the Buddy List. /// internal class BuddyListWidget : IDataWindowWidget { private bool resolveGameData; /// public bool Ready { get; set; } /// public string[]? CommandShortcuts { get; init; } = { "buddy", "buddylist" }; /// public string DisplayName { get; init; } = "Buddy List"; /// public void Load() { this.Ready = true; } /// public void Draw() { var buddyList = Service.Get(); ImGui.Checkbox("Resolve GameData", ref this.resolveGameData); { var member = buddyList.CompanionBuddy; if (member == null) { ImGui.Text("[Companion] null"); } else { ImGui.Text($"[Companion] {member.Address.ToInt64():X} - {member.ObjectId} - {member.DataID}"); if (this.resolveGameData) { var gameObject = member.GameObject; if (gameObject == null) { ImGui.Text("GameObject was null"); } else { Util.PrintGameObject(gameObject, "-", this.resolveGameData); } } } } { var member = buddyList.PetBuddy; if (member == null) { ImGui.Text("[Pet] null"); } else { ImGui.Text($"[Pet] {member.Address.ToInt64():X} - {member.ObjectId} - {member.DataID}"); if (this.resolveGameData) { var gameObject = member.GameObject; if (gameObject == null) { ImGui.Text("GameObject was null"); } else { Util.PrintGameObject(gameObject, "-", this.resolveGameData); } } } } { var count = buddyList.Length; if (count == 0) { ImGui.Text("[BattleBuddy] None present"); } else { for (var i = 0; i < count; i++) { var member = buddyList[i]; ImGui.Text($"[BattleBuddy] [{i}] {member?.Address.ToInt64():X} - {member?.ObjectId} - {member?.DataID}"); if (this.resolveGameData) { var gameObject = member?.GameObject; if (gameObject == null) { ImGui.Text("GameObject was null"); } else { Util.PrintGameObject(gameObject, "-", this.resolveGameData); } } } } } } }