forked from liza/Questionable
master #3
@ -4,6 +4,7 @@ using System.Globalization;
|
||||
using System.Numerics;
|
||||
using Dalamud.Game.ClientState.Conditions;
|
||||
using Dalamud.Game.ClientState.Objects;
|
||||
using Dalamud.Game.ClientState.Objects.Types;
|
||||
using Dalamud.Game.Text;
|
||||
using Dalamud.Interface;
|
||||
using Dalamud.Interface.Colors;
|
||||
@ -146,17 +147,38 @@ internal sealed class CreationUtilsComponent
|
||||
#endif
|
||||
|
||||
if (_targetManager.Target != null)
|
||||
{
|
||||
DrawTargetDetails(_targetManager.Target);
|
||||
DrawInteractionButtons(_targetManager.Target);
|
||||
ImGui.SameLine();
|
||||
DrawCopyButton(_targetManager.Target);
|
||||
}
|
||||
else
|
||||
{
|
||||
DrawCopyButton();
|
||||
}
|
||||
|
||||
ulong hoveredItemId = _gameGui.HoveredItem;
|
||||
if (hoveredItemId != 0)
|
||||
{
|
||||
ImGui.Separator();
|
||||
ImGui.Text($"Hovered Item: {hoveredItemId}");
|
||||
}
|
||||
}
|
||||
|
||||
private unsafe void DrawTargetDetails(IGameObject target)
|
||||
{
|
||||
ImGui.Separator();
|
||||
ImGui.Text(string.Create(CultureInfo.InvariantCulture,
|
||||
$"Target: {_targetManager.Target.Name} ({_targetManager.Target.ObjectKind}; {_targetManager.Target.DataId})"));
|
||||
$"Target: {target.Name} ({target.ObjectKind}; {target.DataId})"));
|
||||
|
||||
GameObject* gameObject = (GameObject*)_targetManager.Target.Address;
|
||||
if (_clientState.LocalPlayer != null)
|
||||
{
|
||||
ImGui.Text(string.Create(CultureInfo.InvariantCulture,
|
||||
$"Distance: {(_targetManager.Target.Position - _clientState.LocalPlayer.Position).Length():F2}"));
|
||||
$"Distance: {(target.Position - _clientState.LocalPlayer.Position).Length():F2}"));
|
||||
ImGui.SameLine();
|
||||
|
||||
float verticalDistance = _targetManager.Target.Position.Y - _clientState.LocalPlayer.Position.Y;
|
||||
float verticalDistance = target.Position.Y - _clientState.LocalPlayer.Position.Y;
|
||||
string verticalDistanceText = string.Create(CultureInfo.InvariantCulture, $"Y: {verticalDistance:F2}");
|
||||
if (Math.Abs(verticalDistance) >= MovementController.DefaultVerticalInteractionDistance)
|
||||
ImGui.TextColored(ImGuiColors.DalamudOrange, verticalDistanceText);
|
||||
@ -164,15 +186,21 @@ internal sealed class CreationUtilsComponent
|
||||
ImGui.Text(verticalDistanceText);
|
||||
|
||||
ImGui.SameLine();
|
||||
ImGui.Text($"QM: {gameObject->NamePlateIconId}");
|
||||
}
|
||||
|
||||
GameObject* gameObject = (GameObject*)target.Address;
|
||||
ImGui.Text($"QM: {gameObject->NamePlateIconId}");
|
||||
}
|
||||
|
||||
private unsafe void DrawInteractionButtons(IGameObject target)
|
||||
{
|
||||
ImGui.BeginDisabled(!_movementController.IsNavmeshReady || _gameFunctions.IsOccupied());
|
||||
if (!_movementController.IsPathfinding)
|
||||
{
|
||||
if (ImGuiComponents.IconButtonWithText(FontAwesomeIcon.Bullseye, "To Target"))
|
||||
{
|
||||
_movementController.NavigateTo(EMovementType.DebugWindow, _targetManager.Target.DataId,
|
||||
_targetManager.Target.Position,
|
||||
_movementController.NavigateTo(EMovementType.DebugWindow, target.DataId,
|
||||
target.Position,
|
||||
fly: _condition[ConditionFlag.Mounted] && _gameFunctions.IsFlyingUnlockedInCurrentZone(),
|
||||
sprint: true);
|
||||
}
|
||||
@ -186,7 +214,7 @@ internal sealed class CreationUtilsComponent
|
||||
ImGui.EndDisabled();
|
||||
|
||||
ImGui.SameLine();
|
||||
ImGui.BeginDisabled(!_questData.IsIssuerOfAnyQuest(_targetManager.Target.DataId));
|
||||
ImGui.BeginDisabled(!_questData.IsIssuerOfAnyQuest(target.DataId));
|
||||
bool showQuests = ImGuiComponents.IconButton(FontAwesomeIcon.MapMarkerAlt);
|
||||
if (ImGui.IsItemHovered())
|
||||
ImGui.SetTooltip("Show all Quests starting with your current target.");
|
||||
@ -203,19 +231,22 @@ internal sealed class CreationUtilsComponent
|
||||
if (interact)
|
||||
{
|
||||
ulong result = TargetSystem.Instance()->InteractWithObject(
|
||||
(GameObject*)_targetManager.Target.Address, false);
|
||||
(GameObject*)target.Address, false);
|
||||
_logger.LogInformation("XXXXX Interaction Result: {Result}", result);
|
||||
}
|
||||
ImGui.EndDisabled();
|
||||
ImGui.SameLine();
|
||||
|
||||
ImGui.EndDisabled();
|
||||
}
|
||||
|
||||
private unsafe void DrawCopyButton(IGameObject target)
|
||||
{
|
||||
GameObject* gameObject = (GameObject*)target.Address;
|
||||
bool copy = ImGuiComponents.IconButton(FontAwesomeIcon.Copy);
|
||||
if (ImGui.IsItemHovered())
|
||||
ImGui.SetTooltip(
|
||||
"Left click: Copy target position as JSON.\nRight click: Copy target position as C# code.");
|
||||
if (copy)
|
||||
{
|
||||
var target = _targetManager.Target;
|
||||
if (target.ObjectKind == ObjectKind.GatheringPoint)
|
||||
{
|
||||
ImGui.SetClipboardText($$"""
|
||||
@ -250,19 +281,23 @@ internal sealed class CreationUtilsComponent
|
||||
}
|
||||
else if (ImGui.IsItemClicked(ImGuiMouseButton.Right))
|
||||
{
|
||||
if (_targetManager.Target.ObjectKind == ObjectKind.Aetheryte)
|
||||
if (target.ObjectKind == ObjectKind.Aetheryte)
|
||||
{
|
||||
EAetheryteLocation location = (EAetheryteLocation)_targetManager.Target.DataId;
|
||||
EAetheryteLocation location = (EAetheryteLocation)target.DataId;
|
||||
ImGui.SetClipboardText(string.Create(CultureInfo.InvariantCulture,
|
||||
$"{{EAetheryteLocation.{location}, new({_targetManager.Target.Position.X}f, {_targetManager.Target.Position.Y}f, {_targetManager.Target.Position.Z}f)}},"));
|
||||
$"{{EAetheryteLocation.{location}, new({target.Position.X}f, {target.Position.Y}f, {target.Position.Z}f)}},"));
|
||||
}
|
||||
else
|
||||
ImGui.SetClipboardText(string.Create(CultureInfo.InvariantCulture,
|
||||
$"new({_targetManager.Target.Position.X}f, {_targetManager.Target.Position.Y}f, {_targetManager.Target.Position.Z}f)"));
|
||||
$"new({target.Position.X}f, {target.Position.Y}f, {target.Position.Z}f)"));
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
private void DrawCopyButton()
|
||||
{
|
||||
if (_clientState.LocalPlayer == null)
|
||||
return;
|
||||
|
||||
bool copy = ImGuiComponents.IconButton(FontAwesomeIcon.Copy);
|
||||
if (ImGui.IsItemHovered())
|
||||
ImGui.SetTooltip(
|
||||
@ -286,12 +321,4 @@ internal sealed class CreationUtilsComponent
|
||||
$"new({position.X}f, {position.Y}f, {position.Z}f)"));
|
||||
}
|
||||
}
|
||||
|
||||
ulong hoveredItemId = _gameGui.HoveredItem;
|
||||
if (hoveredItemId != 0)
|
||||
{
|
||||
ImGui.Separator();
|
||||
ImGui.Text($"Hovered Item: {hoveredItemId}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user