diff --git a/Dalamud/Interface/DalamudDataWindow.cs b/Dalamud/Interface/DalamudDataWindow.cs index 142018601..80dcd927f 100644 --- a/Dalamud/Interface/DalamudDataWindow.cs +++ b/Dalamud/Interface/DalamudDataWindow.cs @@ -12,6 +12,7 @@ using Dalamud.Game.Internal; using Dalamud.Game.Internal.Gui.Addon; using Dalamud.Game.Internal.Gui.Toast; using Dalamud.Game.Text; +using Dalamud.Interface.Colors; using Dalamud.Interface.Windowing; using Dalamud.Plugin; using ImGuiNET; @@ -541,7 +542,10 @@ namespace Dalamud.Interface var targetMgr = this.dalamud.ClientState.Targets; if (targetMgr.CurrentTarget != null) + { this.PrintActor(targetMgr.CurrentTarget, "CurrentTarget"); + Util.ShowObject(targetMgr.CurrentTarget); + } if (targetMgr.FocusTarget != null) this.PrintActor(targetMgr.FocusTarget, "FocusTarget"); diff --git a/Dalamud/Util.cs b/Dalamud/Util.cs index 9df4e5a53..e83458e83 100644 --- a/Dalamud/Util.cs +++ b/Dalamud/Util.cs @@ -5,6 +5,9 @@ using System.Runtime.InteropServices; using System.Text; using Dalamud.Game; +using Dalamud.Interface; +using Dalamud.Interface.Colors; +using ImGuiNET; using Serilog; namespace Dalamud @@ -116,5 +119,32 @@ namespace Dalamud return sb.ToString().TrimEnd(Environment.NewLine.ToCharArray()); } + + /// + /// Show all properties and fields of the provided object via ImGui. + /// + /// The object to show. + public static void ShowObject(object obj) + { + var type = obj.GetType(); + + ImGui.Text($"Object Dump({type.Name}) for {obj}({obj.GetHashCode()})"); + + ImGuiHelpers.ScaledDummy(5); + + ImGui.TextColored(ImGuiColors.DalamudOrange, "-> Properties:"); + foreach (var propertyInfo in type.GetProperties()) + { + ImGui.TextColored(ImGuiColors.DalamudOrange, $" {propertyInfo.Name}: {propertyInfo.GetValue(obj)}"); + } + + ImGuiHelpers.ScaledDummy(5); + + ImGui.TextColored(ImGuiColors.HealerGreen, "-> Fields:"); + foreach (var fieldInfo in type.GetFields()) + { + ImGui.TextColored(ImGuiColors.HealerGreen, $" {fieldInfo.Name}: {fieldInfo.GetValue(obj)}"); + } + } } }