1
0
forked from liza/Deliveroo

Hide turn in UI in cutscene

This commit is contained in:
Liza 2023-09-25 21:36:06 +02:00
parent 1633b4390a
commit dba5754d40
Signed by: liza
GPG Key ID: 7199F8D727D55F67

View File

@ -4,6 +4,7 @@ using System.Linq;
using Dalamud.Data; using Dalamud.Data;
using Dalamud.Game; using Dalamud.Game;
using Dalamud.Game.ClientState; using Dalamud.Game.ClientState;
using Dalamud.Game.ClientState.Conditions;
using Dalamud.Game.ClientState.Objects; using Dalamud.Game.ClientState.Objects;
using Dalamud.Game.ClientState.Objects.Types; using Dalamud.Game.ClientState.Objects.Types;
using Dalamud.Game.Gui; using Dalamud.Game.Gui;
@ -16,6 +17,7 @@ using Deliveroo.Windows;
using FFXIVClientStructs.FFXIV.Client.UI; using FFXIVClientStructs.FFXIV.Client.UI;
using FFXIVClientStructs.FFXIV.Component.GUI; using FFXIVClientStructs.FFXIV.Component.GUI;
using Lumina.Excel.GeneratedSheets; using Lumina.Excel.GeneratedSheets;
using Condition = Dalamud.Game.ClientState.Conditions.Condition;
namespace Deliveroo; namespace Deliveroo;
@ -30,6 +32,7 @@ public sealed partial class DeliverooPlugin : IDalamudPlugin
private readonly ClientState _clientState; private readonly ClientState _clientState;
private readonly ObjectTable _objectTable; private readonly ObjectTable _objectTable;
private readonly TargetManager _targetManager; private readonly TargetManager _targetManager;
private readonly Condition _condition;
// ReSharper disable once PrivateFieldCanBeConvertedToLocalVariable // ReSharper disable once PrivateFieldCanBeConvertedToLocalVariable
private readonly Configuration _configuration; private readonly Configuration _configuration;
@ -51,7 +54,7 @@ public sealed partial class DeliverooPlugin : IDalamudPlugin
public DeliverooPlugin(DalamudPluginInterface pluginInterface, ChatGui chatGui, GameGui gameGui, public DeliverooPlugin(DalamudPluginInterface pluginInterface, ChatGui chatGui, GameGui gameGui,
Framework framework, ClientState clientState, ObjectTable objectTable, TargetManager targetManager, Framework framework, ClientState clientState, ObjectTable objectTable, TargetManager targetManager,
DataManager dataManager) DataManager dataManager, Condition condition)
{ {
_pluginInterface = pluginInterface; _pluginInterface = pluginInterface;
_chatGui = chatGui; _chatGui = chatGui;
@ -60,6 +63,7 @@ public sealed partial class DeliverooPlugin : IDalamudPlugin
_clientState = clientState; _clientState = clientState;
_objectTable = objectTable; _objectTable = objectTable;
_targetManager = targetManager; _targetManager = targetManager;
_condition = condition;
var dalamudReflector = new DalamudReflector(_pluginInterface, _framework); var dalamudReflector = new DalamudReflector(_pluginInterface, _framework);
_yesAlreadyIpc = new YesAlreadyIpc(dalamudReflector); _yesAlreadyIpc = new YesAlreadyIpc(dalamudReflector);
@ -96,6 +100,7 @@ public sealed partial class DeliverooPlugin : IDalamudPlugin
{ {
_turnInWindow.Error = string.Empty; _turnInWindow.Error = string.Empty;
if (!_clientState.IsLoggedIn || _clientState.TerritoryType is not 128 and not 130 and not 132 || if (!_clientState.IsLoggedIn || _clientState.TerritoryType is not 128 and not 130 and not 132 ||
_condition[ConditionFlag.OccupiedInCutSceneEvent] ||
GetDistanceToNpc(GetQuartermasterId(), out GameObject? quartermaster) >= 7f || GetDistanceToNpc(GetQuartermasterId(), out GameObject? quartermaster) >= 7f ||
GetDistanceToNpc(GetPersonnelOfficerId(), out GameObject? personnelOfficer) >= 7f || GetDistanceToNpc(GetPersonnelOfficerId(), out GameObject? personnelOfficer) >= 7f ||
_configWindow.IsOpen) _configWindow.IsOpen)