101 lines
3.5 KiB
C#
Raw Normal View History

2024-07-26 17:17:52 +02:00
using System;
using System.Numerics;
2024-06-08 11:30:26 +02:00
using Dalamud.Plugin;
2024-05-25 23:51:37 +02:00
using Dalamud.Plugin.Services;
using ImGuiNET;
2024-06-08 11:30:26 +02:00
using LLib.ImGui;
2024-05-25 23:51:37 +02:00
using Questionable.Controller;
using Questionable.Data;
using Questionable.Windows.QuestComponents;
2024-05-25 23:51:37 +02:00
namespace Questionable.Windows;
2024-06-18 17:51:23 +02:00
internal sealed class QuestWindow : LWindow, IPersistableWindowConfig
2024-05-25 23:51:37 +02:00
{
2024-07-26 17:17:52 +02:00
private static readonly Version PluginVersion = typeof(QuestionablePlugin).Assembly.GetName().Version!;
2024-07-03 21:00:04 +02:00
private readonly IDalamudPluginInterface _pluginInterface;
2024-05-26 21:45:26 +02:00
private readonly QuestController _questController;
2024-05-25 23:51:37 +02:00
private readonly IClientState _clientState;
2024-06-08 11:30:26 +02:00
private readonly Configuration _configuration;
private readonly TerritoryData _territoryData;
private readonly ActiveQuestComponent _activeQuestComponent;
private readonly ARealmRebornComponent _aRealmRebornComponent;
private readonly CreationUtilsComponent _creationUtilsComponent;
private readonly QuickAccessButtonsComponent _quickAccessButtonsComponent;
private readonly RemainingTasksComponent _remainingTasksComponent;
2024-05-25 23:51:37 +02:00
2024-07-03 21:00:04 +02:00
public QuestWindow(IDalamudPluginInterface pluginInterface,
2024-06-12 18:03:48 +02:00
QuestController questController,
IClientState clientState,
Configuration configuration,
TerritoryData territoryData,
ActiveQuestComponent activeQuestComponent,
ARealmRebornComponent aRealmRebornComponent,
CreationUtilsComponent creationUtilsComponent,
QuickAccessButtonsComponent quickAccessButtonsComponent,
RemainingTasksComponent remainingTasksComponent)
2024-07-26 17:17:52 +02:00
: base($"Questionable v{PluginVersion.ToString(2)}###Questionable", ImGuiWindowFlags.AlwaysAutoResize)
2024-05-25 23:51:37 +02:00
{
2024-06-08 11:30:26 +02:00
_pluginInterface = pluginInterface;
2024-05-26 21:45:26 +02:00
_questController = questController;
2024-05-25 23:51:37 +02:00
_clientState = clientState;
2024-06-08 11:30:26 +02:00
_configuration = configuration;
_territoryData = territoryData;
_activeQuestComponent = activeQuestComponent;
_aRealmRebornComponent = aRealmRebornComponent;
_creationUtilsComponent = creationUtilsComponent;
_quickAccessButtonsComponent = quickAccessButtonsComponent;
_remainingTasksComponent = remainingTasksComponent;
2024-05-25 23:51:37 +02:00
2024-06-17 00:32:24 +02:00
#if DEBUG
2024-05-25 23:51:37 +02:00
IsOpen = true;
2024-06-17 00:32:24 +02:00
#endif
2024-05-25 23:51:37 +02:00
SizeConstraints = new WindowSizeConstraints
{
2024-05-27 21:54:34 +02:00
MinimumSize = new Vector2(200, 30),
2024-05-25 23:51:37 +02:00
MaximumSize = default
};
RespectCloseHotkey = false;
2024-05-25 23:51:37 +02:00
}
2024-06-08 11:30:26 +02:00
public WindowConfig WindowConfig => _configuration.DebugWindowConfig;
public void SaveWindowConfig() => _pluginInterface.SavePluginConfig(_configuration);
public override void PreOpenCheck()
{
IsOpen |= _questController.IsRunning;
}
public override bool DrawConditions()
{
if (!_clientState.IsLoggedIn || _clientState.LocalPlayer == null || _clientState.IsPvPExcludingDen)
return false;
if (_configuration.General.HideInAllInstances && _territoryData.IsDutyInstance(_clientState.TerritoryType))
return false;
var currentQuest = _questController.CurrentQuest;
return currentQuest == null || !currentQuest.Quest.Root.TerritoryBlacklist.Contains(_clientState.TerritoryType);
}
2024-06-09 16:37:26 +02:00
public override void Draw()
2024-05-25 23:51:37 +02:00
{
_activeQuestComponent.Draw();
2024-06-09 16:37:26 +02:00
ImGui.Separator();
if (_aRealmRebornComponent.ShouldDraw)
2024-05-25 23:51:37 +02:00
{
_aRealmRebornComponent.Draw();
2024-05-25 23:51:37 +02:00
ImGui.Separator();
}
_creationUtilsComponent.Draw();
ImGui.Separator();
_quickAccessButtonsComponent.Draw();
_remainingTasksComponent.Draw();
2024-05-25 23:51:37 +02:00
}
}