using Dalamud.Game.ClientState;
using Dalamud.Game.ClientState.Objects;
using Dalamud.Utility;
using ImGuiNET;
namespace Dalamud.Interface.Internal.Windows.Data;
///
/// Widget for displaying target info.
///
internal class TargetWidget : IDataWindowWidget
{
private bool resolveGameData;
///
public DataKind DataKind { get; init; } = DataKind.Target;
///
public bool Ready { get; set; }
///
public void Load()
{
this.Ready = true;
}
///
public void Draw()
{
ImGui.Checkbox("Resolve GameData", ref this.resolveGameData);
var clientState = Service.Get();
var targetMgr = Service.Get();
if (targetMgr.Target != null)
{
Util.PrintGameObject(targetMgr.Target, "CurrentTarget", this.resolveGameData);
ImGui.Text("Target");
Util.ShowGameObjectStruct(targetMgr.Target);
var tot = targetMgr.Target.TargetObject;
if (tot != null)
{
ImGuiHelpers.ScaledDummy(10);
ImGui.Separator();
ImGui.Text("ToT");
Util.ShowGameObjectStruct(tot);
}
ImGuiHelpers.ScaledDummy(10);
}
if (targetMgr.FocusTarget != null)
Util.PrintGameObject(targetMgr.FocusTarget, "FocusTarget", this.resolveGameData);
if (targetMgr.MouseOverTarget != null)
Util.PrintGameObject(targetMgr.MouseOverTarget, "MouseOverTarget", this.resolveGameData);
if (targetMgr.PreviousTarget != null)
Util.PrintGameObject(targetMgr.PreviousTarget, "PreviousTarget", this.resolveGameData);
if (targetMgr.SoftTarget != null)
Util.PrintGameObject(targetMgr.SoftTarget, "SoftTarget", this.resolveGameData);
if (ImGui.Button("Clear CT"))
targetMgr.ClearTarget();
if (ImGui.Button("Clear FT"))
targetMgr.ClearFocusTarget();
var localPlayer = clientState.LocalPlayer;
if (localPlayer != null)
{
if (ImGui.Button("Set CT"))
targetMgr.SetTarget(localPlayer);
if (ImGui.Button("Set FT"))
targetMgr.SetFocusTarget(localPlayer);
}
else
{
ImGui.Text("LocalPlayer is null.");
}
}
}