2024-05-26 19:45:26 +00:00
|
|
|
|
using System;
|
2024-06-08 19:16:57 +00:00
|
|
|
|
using System.Diagnostics.CodeAnalysis;
|
|
|
|
|
using Dalamud.Extensions.MicrosoftLogging;
|
2024-05-25 21:51:37 +00:00
|
|
|
|
using Dalamud.Game;
|
|
|
|
|
using Dalamud.Game.ClientState.Objects;
|
|
|
|
|
using Dalamud.Interface.Windowing;
|
|
|
|
|
using Dalamud.Plugin;
|
|
|
|
|
using Dalamud.Plugin.Services;
|
2024-06-08 19:16:57 +00:00
|
|
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
|
|
|
using Microsoft.Extensions.Logging;
|
2024-05-25 21:51:37 +00:00
|
|
|
|
using Questionable.Controller;
|
2024-07-14 01:42:30 +00:00
|
|
|
|
using Questionable.Controller.CombatModules;
|
2024-07-12 08:31:34 +00:00
|
|
|
|
using Questionable.Controller.NavigationOverrides;
|
2024-07-12 19:18:53 +00:00
|
|
|
|
using Questionable.Controller.Steps.Shared;
|
|
|
|
|
using Questionable.Controller.Steps.Common;
|
|
|
|
|
using Questionable.Controller.Steps.Interactions;
|
2024-05-27 19:54:34 +00:00
|
|
|
|
using Questionable.Data;
|
2024-05-25 21:51:37 +00:00
|
|
|
|
using Questionable.External;
|
2024-07-15 22:18:10 +00:00
|
|
|
|
using Questionable.Validation;
|
|
|
|
|
using Questionable.Validation.Validators;
|
2024-05-25 21:51:37 +00:00
|
|
|
|
using Questionable.Windows;
|
2024-07-12 19:18:53 +00:00
|
|
|
|
using Action = Questionable.Controller.Steps.Interactions.Action;
|
2024-05-25 21:51:37 +00:00
|
|
|
|
|
|
|
|
|
namespace Questionable;
|
|
|
|
|
|
2024-06-08 19:16:57 +00:00
|
|
|
|
[SuppressMessage("ReSharper", "UnusedType.Global")]
|
2024-05-27 19:54:34 +00:00
|
|
|
|
public sealed class QuestionablePlugin : IDalamudPlugin
|
2024-05-25 21:51:37 +00:00
|
|
|
|
{
|
2024-06-08 19:16:57 +00:00
|
|
|
|
private readonly ServiceProvider? _serviceProvider;
|
|
|
|
|
|
2024-07-03 19:00:04 +00:00
|
|
|
|
public QuestionablePlugin(IDalamudPluginInterface pluginInterface,
|
2024-06-08 19:16:57 +00:00
|
|
|
|
IClientState clientState,
|
|
|
|
|
ITargetManager targetManager,
|
|
|
|
|
IFramework framework,
|
|
|
|
|
IGameGui gameGui,
|
|
|
|
|
IDataManager dataManager,
|
|
|
|
|
ISigScanner sigScanner,
|
|
|
|
|
IObjectTable objectTable,
|
|
|
|
|
IPluginLog pluginLog,
|
|
|
|
|
ICondition condition,
|
|
|
|
|
IChatGui chatGui,
|
|
|
|
|
ICommandManager commandManager,
|
2024-06-09 14:30:53 +00:00
|
|
|
|
IAddonLifecycle addonLifecycle,
|
|
|
|
|
IKeyState keyState)
|
2024-05-25 21:51:37 +00:00
|
|
|
|
{
|
2024-05-26 19:45:26 +00:00
|
|
|
|
ArgumentNullException.ThrowIfNull(pluginInterface);
|
2024-05-25 21:51:37 +00:00
|
|
|
|
|
2024-06-08 19:16:57 +00:00
|
|
|
|
ServiceCollection serviceCollection = new();
|
|
|
|
|
serviceCollection.AddLogging(builder => builder.SetMinimumLevel(LogLevel.Trace)
|
|
|
|
|
.ClearProviders()
|
2024-06-09 14:30:53 +00:00
|
|
|
|
.AddDalamudLogger(pluginLog, t => t[(t.LastIndexOf('.') + 1)..]));
|
2024-06-08 19:16:57 +00:00
|
|
|
|
serviceCollection.AddSingleton<IDalamudPlugin>(this);
|
|
|
|
|
serviceCollection.AddSingleton(pluginInterface);
|
|
|
|
|
serviceCollection.AddSingleton(clientState);
|
|
|
|
|
serviceCollection.AddSingleton(targetManager);
|
|
|
|
|
serviceCollection.AddSingleton(framework);
|
|
|
|
|
serviceCollection.AddSingleton(gameGui);
|
|
|
|
|
serviceCollection.AddSingleton(dataManager);
|
|
|
|
|
serviceCollection.AddSingleton(sigScanner);
|
|
|
|
|
serviceCollection.AddSingleton(objectTable);
|
2024-06-13 15:35:33 +00:00
|
|
|
|
serviceCollection.AddSingleton(pluginLog);
|
2024-06-08 19:16:57 +00:00
|
|
|
|
serviceCollection.AddSingleton(condition);
|
|
|
|
|
serviceCollection.AddSingleton(chatGui);
|
|
|
|
|
serviceCollection.AddSingleton(commandManager);
|
|
|
|
|
serviceCollection.AddSingleton(addonLifecycle);
|
2024-06-09 14:30:53 +00:00
|
|
|
|
serviceCollection.AddSingleton(keyState);
|
2024-06-08 19:16:57 +00:00
|
|
|
|
serviceCollection.AddSingleton(new WindowSystem(nameof(Questionable)));
|
|
|
|
|
serviceCollection.AddSingleton((Configuration?)pluginInterface.GetPluginConfig() ?? new Configuration());
|
|
|
|
|
|
|
|
|
|
serviceCollection.AddSingleton<GameFunctions>();
|
2024-06-20 19:55:48 +00:00
|
|
|
|
serviceCollection.AddSingleton<ChatFunctions>();
|
2024-07-08 18:46:01 +00:00
|
|
|
|
serviceCollection.AddSingleton<AetherCurrentData>();
|
2024-06-08 19:16:57 +00:00
|
|
|
|
serviceCollection.AddSingleton<AetheryteData>();
|
2024-07-11 00:56:42 +00:00
|
|
|
|
serviceCollection.AddSingleton<QuestData>();
|
2024-06-08 19:16:57 +00:00
|
|
|
|
serviceCollection.AddSingleton<TerritoryData>();
|
|
|
|
|
serviceCollection.AddSingleton<NavmeshIpc>();
|
|
|
|
|
serviceCollection.AddSingleton<LifestreamIpc>();
|
2024-06-16 15:43:42 +00:00
|
|
|
|
serviceCollection.AddSingleton<YesAlreadyIpc>();
|
2024-06-08 19:16:57 +00:00
|
|
|
|
|
2024-06-09 14:30:53 +00:00
|
|
|
|
// individual tasks
|
|
|
|
|
serviceCollection.AddTransient<MountTask>();
|
|
|
|
|
serviceCollection.AddTransient<UnmountTask>();
|
|
|
|
|
|
|
|
|
|
// tasks with factories
|
|
|
|
|
serviceCollection.AddTaskWithFactory<StepDisabled.Factory, StepDisabled.Task>();
|
|
|
|
|
serviceCollection.AddTaskWithFactory<AetheryteShortcut.Factory, AetheryteShortcut.UseAetheryteShortcut>();
|
|
|
|
|
serviceCollection.AddTaskWithFactory<SkipCondition.Factory, SkipCondition.CheckTask>();
|
|
|
|
|
serviceCollection.AddTaskWithFactory<AethernetShortcut.Factory, AethernetShortcut.UseAethernetShortcut>();
|
2024-06-18 15:51:23 +00:00
|
|
|
|
serviceCollection.AddTaskWithFactory<WaitAtStart.Factory, WaitAtStart.WaitDelay>();
|
2024-07-12 21:58:48 +00:00
|
|
|
|
serviceCollection.AddTaskWithFactory<Move.Factory, Move.MoveInternal, Move.ExpectToBeNearDataId, Move.Land>();
|
2024-06-09 14:30:53 +00:00
|
|
|
|
serviceCollection.AddTransient<Move.MoveBuilder>();
|
|
|
|
|
|
2024-07-11 11:11:50 +00:00
|
|
|
|
serviceCollection.AddTaskWithFactory<NextQuest.Factory, NextQuest.SetQuest>();
|
2024-06-09 14:30:53 +00:00
|
|
|
|
serviceCollection.AddTaskWithFactory<AetherCurrent.Factory, AetherCurrent.DoAttune>();
|
|
|
|
|
serviceCollection.AddTaskWithFactory<AethernetShard.Factory, AethernetShard.DoAttune>();
|
|
|
|
|
serviceCollection.AddTaskWithFactory<Aetheryte.Factory, Aetheryte.DoAttune>();
|
2024-07-14 01:42:30 +00:00
|
|
|
|
serviceCollection.AddTaskWithFactory<Combat.Factory, Combat.HandleCombat>();
|
2024-06-09 14:30:53 +00:00
|
|
|
|
serviceCollection.AddTaskWithFactory<Duty.Factory, Duty.OpenDutyFinder>();
|
|
|
|
|
serviceCollection.AddTaskWithFactory<Emote.Factory, Emote.UseOnObject, Emote.Use>();
|
2024-07-10 19:01:41 +00:00
|
|
|
|
serviceCollection.AddTaskWithFactory<Action.Factory, Action.UseOnObject>();
|
2024-06-09 14:30:53 +00:00
|
|
|
|
serviceCollection.AddTaskWithFactory<Interact.Factory, Interact.DoInteract>();
|
|
|
|
|
serviceCollection.AddTaskWithFactory<Jump.Factory, Jump.DoJump>();
|
|
|
|
|
serviceCollection.AddTaskWithFactory<Say.Factory, Say.UseChat>();
|
|
|
|
|
serviceCollection.AddTaskWithFactory<UseItem.Factory, UseItem.UseOnGround, UseItem.UseOnObject, UseItem.Use>();
|
2024-06-13 15:35:33 +00:00
|
|
|
|
serviceCollection.AddTaskWithFactory<EquipItem.Factory, EquipItem.DoEquip>();
|
2024-06-20 19:55:48 +00:00
|
|
|
|
serviceCollection
|
|
|
|
|
.AddTaskWithFactory<SinglePlayerDuty.Factory, SinglePlayerDuty.DisableYesAlready,
|
|
|
|
|
SinglePlayerDuty.RestoreYesAlready>();
|
2024-06-09 14:30:53 +00:00
|
|
|
|
|
|
|
|
|
serviceCollection
|
|
|
|
|
.AddTaskWithFactory<WaitAtEnd.Factory,
|
|
|
|
|
WaitAtEnd.WaitDelay,
|
|
|
|
|
WaitAtEnd.WaitNextStepOrSequence,
|
|
|
|
|
WaitAtEnd.WaitForCompletionFlags,
|
|
|
|
|
WaitAtEnd.WaitObjectAtPosition>();
|
2024-06-24 16:15:45 +00:00
|
|
|
|
serviceCollection.AddTransient<WaitAtEnd.WaitQuestAccepted>();
|
|
|
|
|
serviceCollection.AddTransient<WaitAtEnd.WaitQuestCompleted>();
|
2024-06-09 14:30:53 +00:00
|
|
|
|
|
2024-06-08 19:16:57 +00:00
|
|
|
|
serviceCollection.AddSingleton<MovementController>();
|
2024-07-12 08:31:34 +00:00
|
|
|
|
serviceCollection.AddSingleton<MovementOverrideController>();
|
2024-06-08 19:16:57 +00:00
|
|
|
|
serviceCollection.AddSingleton<QuestRegistry>();
|
|
|
|
|
serviceCollection.AddSingleton<QuestController>();
|
|
|
|
|
serviceCollection.AddSingleton<GameUiController>();
|
|
|
|
|
serviceCollection.AddSingleton<NavigationShortcutController>();
|
2024-07-14 01:42:30 +00:00
|
|
|
|
serviceCollection.AddSingleton<CombatController>();
|
|
|
|
|
|
|
|
|
|
serviceCollection.AddSingleton<ICombatModule, RotationSolverRebornModule>();
|
2024-06-08 19:16:57 +00:00
|
|
|
|
|
2024-06-18 15:51:23 +00:00
|
|
|
|
serviceCollection.AddSingleton<QuestWindow>();
|
2024-06-12 16:03:48 +00:00
|
|
|
|
serviceCollection.AddSingleton<ConfigWindow>();
|
2024-06-18 15:51:23 +00:00
|
|
|
|
serviceCollection.AddSingleton<DebugOverlay>();
|
2024-07-14 19:31:07 +00:00
|
|
|
|
serviceCollection.AddSingleton<QuestSelectionWindow>();
|
2024-07-15 22:18:10 +00:00
|
|
|
|
serviceCollection.AddSingleton<QuestValidationWindow>();
|
|
|
|
|
|
|
|
|
|
serviceCollection.AddSingleton<QuestValidator>();
|
|
|
|
|
serviceCollection.AddSingleton<IQuestValidator, QuestDisabledValidator>();
|
|
|
|
|
serviceCollection.AddSingleton<IQuestValidator, BasicSequenceValidator>();
|
|
|
|
|
serviceCollection.AddSingleton<IQuestValidator, UniqueStartStopValidator>();
|
|
|
|
|
serviceCollection.AddSingleton<IQuestValidator, CompletionFlagsValidator>();
|
2024-07-14 19:31:07 +00:00
|
|
|
|
|
2024-07-11 00:56:42 +00:00
|
|
|
|
serviceCollection.AddSingleton<CommandHandler>();
|
2024-06-08 19:16:57 +00:00
|
|
|
|
serviceCollection.AddSingleton<DalamudInitializer>();
|
|
|
|
|
|
|
|
|
|
_serviceProvider = serviceCollection.BuildServiceProvider();
|
|
|
|
|
_serviceProvider.GetRequiredService<QuestRegistry>().Reload();
|
2024-07-11 00:56:42 +00:00
|
|
|
|
_serviceProvider.GetRequiredService<CommandHandler>();
|
2024-06-08 19:16:57 +00:00
|
|
|
|
_serviceProvider.GetRequiredService<DalamudInitializer>();
|
2024-05-25 21:51:37 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void Dispose()
|
|
|
|
|
{
|
2024-06-08 19:16:57 +00:00
|
|
|
|
_serviceProvider?.Dispose();
|
2024-05-25 21:51:37 +00:00
|
|
|
|
}
|
|
|
|
|
}
|