master #3

Open
cacahuetes wants to merge 640 commits from liza/Questionable:master into cacahuetes-ShB-Healer
Showing only changes of commit c8fed9d278 - Show all commits

View File

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