mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-12 18:27:23 +01:00
feat: add Util.ShowGameObjectStruct, switch target data viewer
This commit is contained in:
parent
2e20ee7a4a
commit
ca52a8c9e4
4 changed files with 34 additions and 12 deletions
|
|
@ -62,6 +62,6 @@ namespace Dalamud.Game.ClientState.Objects.Types
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the underlying structure.
|
/// Gets the underlying structure.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
internal protected new FFXIVClientStructs.FFXIV.Client.Game.Character.BattleChara* Struct => (FFXIVClientStructs.FFXIV.Client.Game.Character.BattleChara*)this.Address;
|
protected internal new FFXIVClientStructs.FFXIV.Client.Game.Character.BattleChara* Struct => (FFXIVClientStructs.FFXIV.Client.Game.Character.BattleChara*)this.Address;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -112,14 +112,6 @@ namespace Dalamud.Interface
|
||||||
/// <returns><see cref="Vector2"/> with the size of the button.</returns>
|
/// <returns><see cref="Vector2"/> with the size of the button.</returns>
|
||||||
public static Vector2 GetButtonSize(string text) => ImGui.CalcTextSize(text) + (ImGui.GetStyle().FramePadding * 2);
|
public static Vector2 GetButtonSize(string text) => ImGui.CalcTextSize(text) + (ImGui.GetStyle().FramePadding * 2);
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Get data needed for each new frame.
|
|
||||||
/// </summary>
|
|
||||||
internal static void NewFrame()
|
|
||||||
{
|
|
||||||
GlobalScale = ImGui.GetIO().FontGlobalScale;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Print out text that can be copied when clicked.
|
/// Print out text that can be copied when clicked.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
@ -137,5 +129,13 @@ namespace Dalamud.Interface
|
||||||
|
|
||||||
if (ImGui.IsItemClicked()) ImGui.SetClipboardText($"{textCopy}");
|
if (ImGui.IsItemClicked()) ImGui.SetClipboardText($"{textCopy}");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get data needed for each new frame.
|
||||||
|
/// </summary>
|
||||||
|
internal static void NewFrame()
|
||||||
|
{
|
||||||
|
GlobalScale = ImGui.GetIO().FontGlobalScale;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1019,15 +1019,16 @@ namespace Dalamud.Interface.Internal.Windows
|
||||||
this.PrintGameObject(targetMgr.Target, "CurrentTarget");
|
this.PrintGameObject(targetMgr.Target, "CurrentTarget");
|
||||||
|
|
||||||
ImGui.Text("Target");
|
ImGui.Text("Target");
|
||||||
Util.ShowObject(targetMgr.Target);
|
Util.ShowGameObjectStruct(targetMgr.Target);
|
||||||
|
|
||||||
var tot = targetMgr.Target.TargetObject;
|
var tot = targetMgr.Target.TargetObject;
|
||||||
if (tot != null)
|
if (tot != null)
|
||||||
{
|
{
|
||||||
ImGuiHelpers.ScaledDummy(10);
|
ImGuiHelpers.ScaledDummy(10);
|
||||||
|
|
||||||
|
ImGui.Separator();
|
||||||
ImGui.Text("ToT");
|
ImGui.Text("ToT");
|
||||||
Util.ShowObject(tot);
|
Util.ShowGameObjectStruct(tot);
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGuiHelpers.ScaledDummy(10);
|
ImGuiHelpers.ScaledDummy(10);
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,7 @@ using System.Text;
|
||||||
|
|
||||||
using Dalamud.Configuration.Internal;
|
using Dalamud.Configuration.Internal;
|
||||||
using Dalamud.Game;
|
using Dalamud.Game;
|
||||||
|
using Dalamud.Game.ClientState.Objects.Types;
|
||||||
using Dalamud.Interface;
|
using Dalamud.Interface;
|
||||||
using Dalamud.Interface.Colors;
|
using Dalamud.Interface.Colors;
|
||||||
using ImGuiNET;
|
using ImGuiNET;
|
||||||
|
|
@ -243,6 +244,26 @@ namespace Dalamud.Utility
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Show a GameObject's internal data in an ImGui-context.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="go">The GameObject to show.</param>
|
||||||
|
public static unsafe void ShowGameObjectStruct(GameObject go)
|
||||||
|
{
|
||||||
|
switch (go)
|
||||||
|
{
|
||||||
|
case BattleChara bchara:
|
||||||
|
ShowStruct(*bchara.Struct, (ulong)bchara.Address);
|
||||||
|
break;
|
||||||
|
case Character chara:
|
||||||
|
ShowStruct(*chara.Struct, (ulong)chara.Address);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
ShowStruct(*go.Struct, (ulong)go.Address);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Show all properties and fields of the provided object via ImGui.
|
/// Show all properties and fields of the provided object via ImGui.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue