Add rebuild navmesh button
This commit is contained in:
parent
0a702ce361
commit
a0f7e6f081
@ -4,6 +4,7 @@ using System.Numerics;
|
|||||||
using Dalamud.Game.ClientState.Conditions;
|
using Dalamud.Game.ClientState.Conditions;
|
||||||
using Dalamud.Interface;
|
using Dalamud.Interface;
|
||||||
using Dalamud.Interface.Colors;
|
using Dalamud.Interface.Colors;
|
||||||
|
using Dalamud.Interface.Components;
|
||||||
using Dalamud.Interface.Utility;
|
using Dalamud.Interface.Utility;
|
||||||
using Dalamud.Interface.Utility.Raii;
|
using Dalamud.Interface.Utility.Raii;
|
||||||
using Dalamud.Plugin.Services;
|
using Dalamud.Plugin.Services;
|
||||||
@ -27,11 +28,12 @@ internal sealed class QuickAccessButtonsComponent
|
|||||||
private readonly IClientState _clientState;
|
private readonly IClientState _clientState;
|
||||||
private readonly ICondition _condition;
|
private readonly ICondition _condition;
|
||||||
private readonly IFramework _framework;
|
private readonly IFramework _framework;
|
||||||
|
private readonly ICommandManager _commandManager;
|
||||||
|
|
||||||
public QuickAccessButtonsComponent(QuestController questController, MovementController movementController,
|
public QuickAccessButtonsComponent(QuestController questController, MovementController movementController,
|
||||||
GameUiController gameUiController, GameFunctions gameFunctions, ChatFunctions chatFunctions,
|
GameUiController gameUiController, GameFunctions gameFunctions, ChatFunctions chatFunctions,
|
||||||
QuestRegistry questRegistry, NavmeshIpc navmeshIpc, QuestValidationWindow questValidationWindow,
|
QuestRegistry questRegistry, NavmeshIpc navmeshIpc, QuestValidationWindow questValidationWindow,
|
||||||
IClientState clientState, ICondition condition, IFramework framework)
|
IClientState clientState, ICondition condition, IFramework framework, ICommandManager commandManager)
|
||||||
{
|
{
|
||||||
_questController = questController;
|
_questController = questController;
|
||||||
_movementController = movementController;
|
_movementController = movementController;
|
||||||
@ -44,35 +46,49 @@ internal sealed class QuickAccessButtonsComponent
|
|||||||
_clientState = clientState;
|
_clientState = clientState;
|
||||||
_condition = condition;
|
_condition = condition;
|
||||||
_framework = framework;
|
_framework = framework;
|
||||||
|
_commandManager = commandManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
public unsafe void Draw()
|
public unsafe void Draw()
|
||||||
{
|
{
|
||||||
var map = AgentMap.Instance();
|
var map = AgentMap.Instance();
|
||||||
ImGui.BeginDisabled(map == null || map->IsFlagMarkerSet == 0 ||
|
using (var unused = ImRaii.Disabled(map == null || map->IsFlagMarkerSet == 0 ||
|
||||||
map->FlagMapMarker.TerritoryId != _clientState.TerritoryType ||
|
map->FlagMapMarker.TerritoryId != _clientState.TerritoryType ||
|
||||||
!_navmeshIpc.IsReady);
|
!_navmeshIpc.IsReady))
|
||||||
if (ImGui.Button("Move to Flag"))
|
|
||||||
{
|
{
|
||||||
_movementController.Destination = null;
|
if (ImGuiComponents.IconButtonWithText(FontAwesomeIcon.Flag, "To Flag"))
|
||||||
_chatFunctions.ExecuteCommand(
|
{
|
||||||
$"/vnav {(_condition[ConditionFlag.Mounted] && _gameFunctions.IsFlyingUnlockedInCurrentZone() ? "flyflag" : "moveflag")}");
|
_movementController.Destination = null;
|
||||||
|
_chatFunctions.ExecuteCommand(
|
||||||
|
$"/vnav {(_condition[ConditionFlag.Mounted] && _gameFunctions.IsFlyingUnlockedInCurrentZone() ? "flyflag" : "moveflag")}");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui.EndDisabled();
|
|
||||||
|
|
||||||
ImGui.SameLine();
|
ImGui.SameLine();
|
||||||
|
|
||||||
ImGui.BeginDisabled(!_movementController.IsPathRunning);
|
using (var unused = ImRaii.Disabled(!_movementController.IsPathRunning))
|
||||||
if (ImGui.Button("Stop Nav"))
|
|
||||||
{
|
{
|
||||||
_movementController.Stop();
|
if (ImGuiComponents.IconButtonWithText(FontAwesomeIcon.StopCircle, "Stop"))
|
||||||
_questController.Stop("Manual");
|
{
|
||||||
|
_movementController.Stop();
|
||||||
|
_questController.Stop("Manual");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui.EndDisabled();
|
if (_commandManager.Commands.ContainsKey("/vnav"))
|
||||||
|
{
|
||||||
|
ImGui.SameLine();
|
||||||
|
using (var unused = ImRaii.Disabled(!ImGui.IsKeyDown(ImGuiKey.ModCtrl)))
|
||||||
|
{
|
||||||
|
if (ImGuiComponents.IconButtonWithText(FontAwesomeIcon.GlobeEurope, "Rebuild Navmesh"))
|
||||||
|
_commandManager.ProcessCommand("/vnav rebuild");
|
||||||
|
}
|
||||||
|
|
||||||
if (ImGui.Button("Reload Data"))
|
if (ImGui.IsItemHovered(ImGuiHoveredFlags.AllowWhenDisabled))
|
||||||
|
ImGui.SetTooltip("Hold CTRL to enable this button.\nRebuilding the navmesh will take some time.");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ImGuiComponents.IconButtonWithText(FontAwesomeIcon.RedoAlt,"Reload Data"))
|
||||||
Reload();
|
Reload();
|
||||||
|
|
||||||
if (_questRegistry.ValidationIssueCount > 0)
|
if (_questRegistry.ValidationIssueCount > 0)
|
||||||
|
Loading…
Reference in New Issue
Block a user