forked from aly/qstbak
punish v6.8.18.0
This commit is contained in:
commit
cfb4dea47e
316 changed files with 554088 additions and 0 deletions
171
Questionable/Questionable/Configuration.cs
Normal file
171
Questionable/Questionable/Configuration.cs
Normal file
|
|
@ -0,0 +1,171 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Dalamud.Configuration;
|
||||
using Dalamud.Game.Text;
|
||||
using FFXIVClientStructs.FFXIV.Client.UI.Agent;
|
||||
using LLib.GameData;
|
||||
using LLib.ImGui;
|
||||
using Newtonsoft.Json;
|
||||
using Questionable.Model.Questing;
|
||||
|
||||
namespace Questionable;
|
||||
|
||||
internal sealed class Configuration : IPluginConfiguration
|
||||
{
|
||||
internal sealed class GeneralConfiguration
|
||||
{
|
||||
public ECombatModule CombatModule { get; set; }
|
||||
|
||||
public uint MountId { get; set; } = 71u;
|
||||
|
||||
public GrandCompany GrandCompany { get; set; }
|
||||
|
||||
public EClassJob CombatJob { get; set; }
|
||||
|
||||
public bool HideInAllInstances { get; set; } = true;
|
||||
|
||||
public bool UseEscToCancelQuesting { get; set; } = true;
|
||||
|
||||
public bool ShowIncompleteSeasonalEvents { get; set; } = true;
|
||||
|
||||
public bool SkipLowPriorityDuties { get; set; }
|
||||
|
||||
public bool ConfigureTextAdvance { get; set; } = true;
|
||||
|
||||
public bool AutoStepRefreshEnabled { get; set; } = true;
|
||||
|
||||
public int AutoStepRefreshDelaySeconds { get; set; } = 30;
|
||||
}
|
||||
|
||||
internal sealed class StopConfiguration
|
||||
{
|
||||
public bool Enabled { get; set; }
|
||||
|
||||
[JsonProperty(ItemConverterType = typeof(ElementIdNConverter))]
|
||||
public List<ElementId> QuestsToStopAfter { get; set; } = new List<ElementId>();
|
||||
|
||||
public bool LevelToStopAfter { get; set; }
|
||||
|
||||
public int TargetLevel { get; set; } = 50;
|
||||
}
|
||||
|
||||
internal sealed class DutyConfiguration
|
||||
{
|
||||
public bool RunInstancedContentWithAutoDuty { get; set; }
|
||||
|
||||
public HashSet<uint> WhitelistedDutyCfcIds { get; set; } = new HashSet<uint>();
|
||||
|
||||
public HashSet<uint> BlacklistedDutyCfcIds { get; set; } = new HashSet<uint>();
|
||||
|
||||
public Dictionary<string, bool> ExpansionHeaderStates { get; set; } = new Dictionary<string, bool>();
|
||||
}
|
||||
|
||||
internal sealed class SinglePlayerDutyConfiguration
|
||||
{
|
||||
public bool RunSoloInstancesWithBossMod { get; set; }
|
||||
|
||||
public byte RetryDifficulty => 0;
|
||||
|
||||
public HashSet<uint> WhitelistedSinglePlayerDutyCfcIds { get; set; } = new HashSet<uint>();
|
||||
|
||||
public HashSet<uint> BlacklistedSinglePlayerDutyCfcIds { get; set; } = new HashSet<uint>();
|
||||
|
||||
public Dictionary<string, bool> HeaderStates { get; set; } = new Dictionary<string, bool>();
|
||||
}
|
||||
|
||||
internal sealed class NotificationConfiguration
|
||||
{
|
||||
public bool Enabled { get; set; } = true;
|
||||
|
||||
public XivChatType ChatType { get; set; } = XivChatType.Debug;
|
||||
|
||||
public bool ShowTrayMessage { get; set; }
|
||||
|
||||
public bool FlashTaskbar { get; set; }
|
||||
}
|
||||
|
||||
internal sealed class AdvancedConfiguration
|
||||
{
|
||||
public bool DebugOverlay { get; set; }
|
||||
|
||||
public bool CombatDataOverlay { get; set; }
|
||||
|
||||
public bool NeverFly { get; set; }
|
||||
|
||||
public bool AdditionalStatusInformation { get; set; }
|
||||
|
||||
public bool DisableAutoDutyBareMode { get; set; }
|
||||
|
||||
public bool SkipAetherCurrents { get; set; }
|
||||
|
||||
public bool SkipClassJobQuests { get; set; }
|
||||
|
||||
public bool SkipARealmRebornHardModePrimals { get; set; }
|
||||
|
||||
public bool SkipCrystalTowerRaids { get; set; }
|
||||
|
||||
public bool PreventQuestCompletion { get; set; }
|
||||
|
||||
public bool ShowWindowOnStart { get; set; }
|
||||
|
||||
public bool StartMinimized { get; set; }
|
||||
}
|
||||
|
||||
internal enum ECombatModule
|
||||
{
|
||||
None,
|
||||
BossMod,
|
||||
WrathCombo,
|
||||
RotationSolverReborn
|
||||
}
|
||||
|
||||
public sealed class ElementIdNConverter : JsonConverter<ElementId>
|
||||
{
|
||||
public override void WriteJson(JsonWriter writer, ElementId? value, JsonSerializer serializer)
|
||||
{
|
||||
writer.WriteValue(value?.ToString());
|
||||
}
|
||||
|
||||
public override ElementId? ReadJson(JsonReader reader, Type objectType, ElementId? existingValue, bool hasExistingValue, JsonSerializer serializer)
|
||||
{
|
||||
string text = reader.Value?.ToString();
|
||||
if (text == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return ElementId.FromString(text);
|
||||
}
|
||||
}
|
||||
|
||||
public const int PluginSetupVersion = 5;
|
||||
|
||||
public int Version { get; set; } = 1;
|
||||
|
||||
public int PluginSetupCompleteVersion { get; set; }
|
||||
|
||||
public GeneralConfiguration General { get; } = new GeneralConfiguration();
|
||||
|
||||
public StopConfiguration Stop { get; } = new StopConfiguration();
|
||||
|
||||
public DutyConfiguration Duties { get; } = new DutyConfiguration();
|
||||
|
||||
public SinglePlayerDutyConfiguration SinglePlayerDuties { get; } = new SinglePlayerDutyConfiguration();
|
||||
|
||||
public NotificationConfiguration Notifications { get; } = new NotificationConfiguration();
|
||||
|
||||
public AdvancedConfiguration Advanced { get; } = new AdvancedConfiguration();
|
||||
|
||||
public WindowConfig DebugWindowConfig { get; } = new WindowConfig();
|
||||
|
||||
public WindowConfig ConfigWindowConfig { get; } = new WindowConfig();
|
||||
|
||||
internal bool IsPluginSetupComplete()
|
||||
{
|
||||
return PluginSetupCompleteVersion == 5;
|
||||
}
|
||||
|
||||
internal void MarkPluginSetupComplete()
|
||||
{
|
||||
PluginSetupCompleteVersion = 5;
|
||||
}
|
||||
}
|
||||
131
Questionable/Questionable/DalamudInitializer.cs
Normal file
131
Questionable/Questionable/DalamudInitializer.cs
Normal file
|
|
@ -0,0 +1,131 @@
|
|||
using System;
|
||||
using Dalamud.Game.Gui.Toast;
|
||||
using Dalamud.Game.Text.SeStringHandling;
|
||||
using Dalamud.Interface.Windowing;
|
||||
using Dalamud.Plugin;
|
||||
using Dalamud.Plugin.Services;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Questionable.Controller;
|
||||
using Questionable.Controller.Utils;
|
||||
using Questionable.Windows;
|
||||
|
||||
namespace Questionable;
|
||||
|
||||
internal sealed class DalamudInitializer : IDisposable
|
||||
{
|
||||
private readonly IDalamudPluginInterface _pluginInterface;
|
||||
|
||||
private readonly IFramework _framework;
|
||||
|
||||
private readonly QuestController _questController;
|
||||
|
||||
private readonly MovementController _movementController;
|
||||
|
||||
private readonly WindowSystem _windowSystem;
|
||||
|
||||
private readonly OneTimeSetupWindow _oneTimeSetupWindow;
|
||||
|
||||
private readonly QuestWindow _questWindow;
|
||||
|
||||
private readonly ConfigWindow _configWindow;
|
||||
|
||||
private readonly IToastGui _toastGui;
|
||||
|
||||
private readonly Configuration _configuration;
|
||||
|
||||
private readonly PartyWatchDog _partyWatchDog;
|
||||
|
||||
private readonly ILogger<DalamudInitializer> _logger;
|
||||
|
||||
public DalamudInitializer(IDalamudPluginInterface pluginInterface, IFramework framework, QuestController questController, MovementController movementController, WindowSystem windowSystem, OneTimeSetupWindow oneTimeSetupWindow, QuestWindow questWindow, DebugOverlay debugOverlay, ConfigWindow configWindow, QuestSelectionWindow questSelectionWindow, QuestValidationWindow questValidationWindow, JournalProgressWindow journalProgressWindow, PriorityWindow priorityWindow, IToastGui toastGui, Configuration configuration, PartyWatchDog partyWatchDog, ILogger<DalamudInitializer> logger)
|
||||
{
|
||||
_pluginInterface = pluginInterface;
|
||||
_framework = framework;
|
||||
_questController = questController;
|
||||
_movementController = movementController;
|
||||
_windowSystem = windowSystem;
|
||||
_oneTimeSetupWindow = oneTimeSetupWindow;
|
||||
_questWindow = questWindow;
|
||||
_configWindow = configWindow;
|
||||
_toastGui = toastGui;
|
||||
_configuration = configuration;
|
||||
_partyWatchDog = partyWatchDog;
|
||||
_logger = logger;
|
||||
_windowSystem.AddWindow(oneTimeSetupWindow);
|
||||
_windowSystem.AddWindow(questWindow);
|
||||
_windowSystem.AddWindow(configWindow);
|
||||
_windowSystem.AddWindow(debugOverlay);
|
||||
_windowSystem.AddWindow(questSelectionWindow);
|
||||
_windowSystem.AddWindow(questValidationWindow);
|
||||
_windowSystem.AddWindow(journalProgressWindow);
|
||||
_windowSystem.AddWindow(priorityWindow);
|
||||
_pluginInterface.UiBuilder.Draw += _windowSystem.Draw;
|
||||
_pluginInterface.UiBuilder.OpenMainUi += ToggleQuestWindow;
|
||||
_pluginInterface.UiBuilder.OpenConfigUi += _configWindow.Toggle;
|
||||
_framework.Update += FrameworkUpdate;
|
||||
_toastGui.Toast += OnToast;
|
||||
_toastGui.ErrorToast += OnErrorToast;
|
||||
_toastGui.QuestToast += OnQuestToast;
|
||||
if (_configuration.Advanced.StartMinimized)
|
||||
{
|
||||
_questWindow.IsMinimized = true;
|
||||
}
|
||||
if (_configuration.Advanced.ShowWindowOnStart)
|
||||
{
|
||||
ToggleQuestWindow();
|
||||
}
|
||||
}
|
||||
|
||||
private void FrameworkUpdate(IFramework framework)
|
||||
{
|
||||
_partyWatchDog.Update();
|
||||
_questController.Update();
|
||||
try
|
||||
{
|
||||
_movementController.Update();
|
||||
}
|
||||
catch (MovementController.PathfindingFailedException)
|
||||
{
|
||||
_questController.Stop("Pathfinding failed");
|
||||
}
|
||||
}
|
||||
|
||||
private void OnToast(ref SeString message, ref ToastOptions options, ref bool isHandled)
|
||||
{
|
||||
_logger.LogTrace("Normal Toast: {Message}", message);
|
||||
}
|
||||
|
||||
private void OnErrorToast(ref SeString message, ref bool isHandled)
|
||||
{
|
||||
_logger.LogTrace("Error Toast: {Message}", message);
|
||||
}
|
||||
|
||||
private void OnQuestToast(ref SeString message, ref QuestToastOptions options, ref bool isHandled)
|
||||
{
|
||||
_logger.LogTrace("Quest Toast: {Message}", message);
|
||||
}
|
||||
|
||||
private void ToggleQuestWindow()
|
||||
{
|
||||
if (_configuration.IsPluginSetupComplete())
|
||||
{
|
||||
_questWindow.ToggleOrUncollapse();
|
||||
}
|
||||
else
|
||||
{
|
||||
_oneTimeSetupWindow.IsOpenAndUncollapsed = true;
|
||||
}
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
_toastGui.QuestToast -= OnQuestToast;
|
||||
_toastGui.ErrorToast -= OnErrorToast;
|
||||
_toastGui.Toast -= OnToast;
|
||||
_framework.Update -= FrameworkUpdate;
|
||||
_pluginInterface.UiBuilder.OpenConfigUi -= _configWindow.Toggle;
|
||||
_pluginInterface.UiBuilder.OpenMainUi -= ToggleQuestWindow;
|
||||
_pluginInterface.UiBuilder.Draw -= _windowSystem.Draw;
|
||||
_windowSystem.RemoveAllWindows();
|
||||
}
|
||||
}
|
||||
297
Questionable/Questionable/QuestionablePlugin.cs
Normal file
297
Questionable/Questionable/QuestionablePlugin.cs
Normal file
|
|
@ -0,0 +1,297 @@
|
|||
using System;
|
||||
using Dalamud.Extensions.MicrosoftLogging;
|
||||
using Dalamud.Game;
|
||||
using Dalamud.Game.ClientState.Objects;
|
||||
using Dalamud.Interface.Windowing;
|
||||
using Dalamud.Plugin;
|
||||
using Dalamud.Plugin.Services;
|
||||
using LLib;
|
||||
using LLib.Gear;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Questionable.Controller;
|
||||
using Questionable.Controller.CombatModules;
|
||||
using Questionable.Controller.GameUi;
|
||||
using Questionable.Controller.NavigationOverrides;
|
||||
using Questionable.Controller.Steps;
|
||||
using Questionable.Controller.Steps.Common;
|
||||
using Questionable.Controller.Steps.Gathering;
|
||||
using Questionable.Controller.Steps.Interactions;
|
||||
using Questionable.Controller.Steps.Movement;
|
||||
using Questionable.Controller.Steps.Shared;
|
||||
using Questionable.Controller.Utils;
|
||||
using Questionable.Data;
|
||||
using Questionable.External;
|
||||
using Questionable.Functions;
|
||||
using Questionable.Validation;
|
||||
using Questionable.Validation.Validators;
|
||||
using Questionable.Windows;
|
||||
using Questionable.Windows.ConfigComponents;
|
||||
using Questionable.Windows.JournalComponents;
|
||||
using Questionable.Windows.QuestComponents;
|
||||
using Questionable.Windows.Utils;
|
||||
|
||||
namespace Questionable;
|
||||
|
||||
public sealed class QuestionablePlugin : IDalamudPlugin, IDisposable
|
||||
{
|
||||
private readonly ServiceProvider? _serviceProvider;
|
||||
|
||||
public QuestionablePlugin(IDalamudPluginInterface pluginInterface, IClientState clientState, ITargetManager targetManager, IFramework framework, IGameGui gameGui, IDataManager dataManager, ISigScanner sigScanner, IObjectTable objectTable, IPluginLog pluginLog, ICondition condition, IChatGui chatGui, ICommandManager commandManager, IAddonLifecycle addonLifecycle, IKeyState keyState, IContextMenu contextMenu, IToastGui toastGui, IGameInteropProvider gameInteropProvider, IAetheryteList aetheryteList)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(pluginInterface, "pluginInterface");
|
||||
ArgumentNullException.ThrowIfNull(chatGui, "chatGui");
|
||||
try
|
||||
{
|
||||
ServiceCollection serviceCollection = new ServiceCollection();
|
||||
serviceCollection.AddLogging(delegate(ILoggingBuilder builder)
|
||||
{
|
||||
builder.SetMinimumLevel(LogLevel.Trace).ClearProviders().AddDalamudLogger(pluginLog, delegate(string t)
|
||||
{
|
||||
int num = t.LastIndexOf('.') + 1;
|
||||
return t.Substring(num, t.Length - num);
|
||||
});
|
||||
});
|
||||
((IServiceCollection)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);
|
||||
serviceCollection.AddSingleton(pluginLog);
|
||||
serviceCollection.AddSingleton(condition);
|
||||
serviceCollection.AddSingleton(chatGui);
|
||||
serviceCollection.AddSingleton(commandManager);
|
||||
serviceCollection.AddSingleton(addonLifecycle);
|
||||
serviceCollection.AddSingleton(keyState);
|
||||
serviceCollection.AddSingleton(contextMenu);
|
||||
serviceCollection.AddSingleton(toastGui);
|
||||
serviceCollection.AddSingleton(gameInteropProvider);
|
||||
serviceCollection.AddSingleton(aetheryteList);
|
||||
serviceCollection.AddSingleton(new WindowSystem("Questionable"));
|
||||
serviceCollection.AddSingleton(((Configuration)pluginInterface.GetPluginConfig()) ?? new Configuration());
|
||||
AddBasicFunctionsAndData(serviceCollection);
|
||||
AddTaskFactories(serviceCollection);
|
||||
AddControllers(serviceCollection);
|
||||
AddWindows(serviceCollection);
|
||||
AddQuestValidators(serviceCollection);
|
||||
serviceCollection.AddSingleton<CommandHandler>();
|
||||
serviceCollection.AddSingleton<DalamudInitializer>();
|
||||
_serviceProvider = serviceCollection.BuildServiceProvider();
|
||||
Initialize(_serviceProvider);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
chatGui.PrintError("Unable to load plugin, check /xllog for details", "Questionable");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
private static void AddBasicFunctionsAndData(ServiceCollection serviceCollection)
|
||||
{
|
||||
serviceCollection.AddSingleton<AetheryteFunctions>();
|
||||
serviceCollection.AddSingleton<ExcelFunctions>();
|
||||
serviceCollection.AddSingleton<GameFunctions>();
|
||||
serviceCollection.AddSingleton<ChatFunctions>();
|
||||
serviceCollection.AddSingleton<QuestFunctions>();
|
||||
serviceCollection.AddSingleton<AlliedSocietyQuestFunctions>();
|
||||
serviceCollection.AddSingleton<DalamudReflector>();
|
||||
serviceCollection.AddSingleton<Mount.MountEvaluator>();
|
||||
serviceCollection.AddSingleton<AetherCurrentData>();
|
||||
serviceCollection.AddSingleton<AetheryteData>();
|
||||
serviceCollection.AddSingleton<AlliedSocietyData>();
|
||||
serviceCollection.AddSingleton<GatheringData>();
|
||||
serviceCollection.AddSingleton<JournalData>();
|
||||
serviceCollection.AddSingleton<QuestData>();
|
||||
serviceCollection.AddSingleton<TerritoryData>();
|
||||
serviceCollection.AddSingleton<NavmeshIpc>();
|
||||
serviceCollection.AddSingleton<LifestreamIpc>();
|
||||
serviceCollection.AddSingleton<ArtisanIpc>();
|
||||
serviceCollection.AddSingleton<QuestionableIpc>();
|
||||
serviceCollection.AddSingleton<TextAdvanceIpc>();
|
||||
serviceCollection.AddSingleton<NotificationMasterIpc>();
|
||||
serviceCollection.AddSingleton<AutomatonIpc>();
|
||||
serviceCollection.AddSingleton<AutoDutyIpc>();
|
||||
serviceCollection.AddSingleton<BossModIpc>();
|
||||
serviceCollection.AddSingleton<PandorasBoxIpc>();
|
||||
serviceCollection.AddSingleton<GearStatsCalculator>();
|
||||
}
|
||||
|
||||
private static void AddTaskFactories(ServiceCollection serviceCollection)
|
||||
{
|
||||
serviceCollection.AddTaskFactory<QuestCleanUp.CheckAlliedSocietyMount>();
|
||||
serviceCollection.AddTaskFactoryAndExecutor<QuestCleanUp.CloseGatheringAddonTask, QuestCleanUp.CloseGatheringAddonFactory, QuestCleanUp.DoCloseAddon>();
|
||||
serviceCollection.AddTaskExecutor<MoveToLandingLocation.Task, MoveToLandingLocation.MoveToLandingLocationExecutor>();
|
||||
serviceCollection.AddTaskFactoryAndExecutor<RedeemRewardItems.Task, RedeemRewardItems.Factory, RedeemRewardItems.Executor>();
|
||||
serviceCollection.AddTaskExecutor<DoGather.Task, DoGather.GatherExecutor>();
|
||||
serviceCollection.AddTaskExecutor<DoGatherCollectable.Task, DoGatherCollectable.GatherCollectableExecutor>();
|
||||
serviceCollection.AddTaskFactoryAndExecutor<SwitchClassJob.Task, SwitchClassJob.Factory, SwitchClassJob.SwitchClassJobExecutor>();
|
||||
serviceCollection.AddTaskExecutor<Mount.MountTask, Mount.MountExecutor>();
|
||||
serviceCollection.AddTaskExecutor<Mount.UnmountTask, Mount.UnmountExecutor>();
|
||||
serviceCollection.AddTaskFactoryAndExecutor<StepDisabled.SkipRemainingTasks, StepDisabled.Factory, StepDisabled.SkipDisabledStepsExecutor>();
|
||||
serviceCollection.AddTaskFactory<EquipRecommended.BeforeDutyOrInstance>();
|
||||
serviceCollection.AddTaskExecutor<Gather.SkipMarker, Gather.DoSkip>();
|
||||
serviceCollection.AddTaskFactoryAndExecutor<AetheryteShortcut.Task, AetheryteShortcut.Factory, AetheryteShortcut.UseAetheryteShortcut>();
|
||||
serviceCollection.AddTaskExecutor<AetheryteShortcut.MoveAwayFromAetheryte, AetheryteShortcut.MoveAwayFromAetheryteExecutor>();
|
||||
serviceCollection.AddTaskFactoryAndExecutor<SkipCondition.SkipTask, SkipCondition.Factory, SkipCondition.CheckSkip>();
|
||||
serviceCollection.AddTaskFactoryAndExecutor<Gather.GatheringTask, Gather.Factory, Gather.StartGathering>();
|
||||
serviceCollection.AddTaskExecutor<Gather.DelayedGatheringTask, Gather.DelayedGatheringExecutor>();
|
||||
serviceCollection.AddTaskFactoryAndExecutor<AethernetShortcut.Task, AethernetShortcut.Factory, AethernetShortcut.UseAethernetShortcut>();
|
||||
serviceCollection.AddTaskFactoryAndExecutor<WaitAtStart.WaitDelay, WaitAtStart.Factory, WaitAtStart.WaitDelayExecutor>();
|
||||
serviceCollection.AddTaskFactoryAndExecutor<MoveTask, MoveTo.Factory, MoveExecutor>();
|
||||
serviceCollection.AddTaskExecutor<WaitForNearDataId, WaitForNearDataIdExecutor>();
|
||||
serviceCollection.AddTaskExecutor<LandTask, LandExecutor>();
|
||||
serviceCollection.AddTaskFactoryAndExecutor<SendNotification.Task, SendNotification.Factory, SendNotification.Executor>();
|
||||
serviceCollection.AddTaskFactoryAndExecutor<NextQuest.SetQuestTask, NextQuest.Factory, NextQuest.NextQuestExecutor>();
|
||||
serviceCollection.AddTaskFactoryAndExecutor<AetherCurrent.Attune, AetherCurrent.Factory, AetherCurrent.DoAttune>();
|
||||
serviceCollection.AddTaskFactoryAndExecutor<AethernetShard.Attune, AethernetShard.Factory, AethernetShard.DoAttune>();
|
||||
serviceCollection.AddTaskFactoryAndExecutor<Aetheryte.Attune, Aetheryte.Factory, Aetheryte.DoAttune>();
|
||||
serviceCollection.AddTaskFactoryAndExecutor<AetheryteFreeOrFavored.Register, AetheryteFreeOrFavored.Factory, AetheryteFreeOrFavored.DoRegister>();
|
||||
serviceCollection.AddTaskFactoryAndExecutor<Combat.Task, Combat.Factory, Combat.HandleCombat>();
|
||||
serviceCollection.AddTaskFactoryAndExecutor<Duty.OpenDutyFinderTask, Duty.Factory, Duty.OpenDutyFinderExecutor>();
|
||||
serviceCollection.AddTaskExecutor<Duty.StartAutoDutyTask, Duty.StartAutoDutyExecutor>();
|
||||
serviceCollection.AddTaskExecutor<Duty.WaitAutoDutyTask, Duty.WaitAutoDutyExecutor>();
|
||||
serviceCollection.AddTaskFactory<Emote.Factory>();
|
||||
serviceCollection.AddTaskExecutor<Emote.UseOnObject, Emote.UseOnObjectExecutor>();
|
||||
serviceCollection.AddTaskExecutor<Emote.UseOnSelf, Emote.UseOnSelfExecutor>();
|
||||
serviceCollection.AddTaskFactoryAndExecutor<Questionable.Controller.Steps.Interactions.Action.UseOnObject, Questionable.Controller.Steps.Interactions.Action.Factory, Questionable.Controller.Steps.Interactions.Action.UseOnObjectExecutor>();
|
||||
serviceCollection.AddTaskExecutor<Questionable.Controller.Steps.Interactions.Action.UseMudraOnObject, Questionable.Controller.Steps.Interactions.Action.UseMudraOnObjectExecutor>();
|
||||
serviceCollection.AddTaskExecutor<Questionable.Controller.Steps.Interactions.Action.TriggerStatusIfMissing, Questionable.Controller.Steps.Interactions.Action.TriggerStatusIfMissingExecutor>();
|
||||
serviceCollection.AddTaskFactoryAndExecutor<StatusOff.Task, StatusOff.Factory, StatusOff.DoStatusOff>();
|
||||
serviceCollection.AddTaskFactoryAndExecutor<Interact.Task, Interact.Factory, Interact.DoInteract>();
|
||||
serviceCollection.AddTaskFactory<Jump.Factory>();
|
||||
serviceCollection.AddTaskExecutor<Jump.SingleJumpTask, Jump.DoSingleJump>();
|
||||
serviceCollection.AddTaskExecutor<Jump.RepeatedJumpTask, Jump.DoRepeatedJumps>();
|
||||
serviceCollection.AddTaskFactoryAndExecutor<Dive.Task, Dive.Factory, Dive.DoDive>();
|
||||
serviceCollection.AddTaskFactoryAndExecutor<Say.Task, Say.Factory, Say.UseChat>();
|
||||
serviceCollection.AddTaskFactory<UseItem.Factory>();
|
||||
serviceCollection.AddTaskExecutor<UseItem.UseOnGround, UseItem.UseOnGroundExecutor>();
|
||||
serviceCollection.AddTaskExecutor<UseItem.UseOnPosition, UseItem.UseOnPositionExecutor>();
|
||||
serviceCollection.AddTaskExecutor<UseItem.UseOnObject, UseItem.UseOnObjectExecutor>();
|
||||
serviceCollection.AddTaskExecutor<UseItem.UseOnSelf, UseItem.UseOnSelfExecutor>();
|
||||
serviceCollection.AddTaskFactoryAndExecutor<EquipItem.Task, EquipItem.Factory, EquipItem.DoEquip>();
|
||||
serviceCollection.AddTaskFactoryAndExecutor<EquipRecommended.EquipTask, EquipRecommended.Factory, EquipRecommended.DoEquipRecommended>();
|
||||
serviceCollection.AddTaskFactoryAndExecutor<Craft.CraftTask, Craft.Factory, Craft.DoCraft>();
|
||||
serviceCollection.AddTaskFactoryAndExecutor<TurnInDelivery.Task, TurnInDelivery.Factory, TurnInDelivery.SatisfactionSupplyTurnIn>();
|
||||
serviceCollection.AddTaskFactory<SinglePlayerDuty.Factory>();
|
||||
serviceCollection.AddTaskExecutor<SinglePlayerDuty.StartSinglePlayerDuty, SinglePlayerDuty.StartSinglePlayerDutyExecutor>();
|
||||
serviceCollection.AddTaskExecutor<SinglePlayerDuty.EnableAi, SinglePlayerDuty.EnableAiExecutor>();
|
||||
serviceCollection.AddTaskExecutor<SinglePlayerDuty.WaitSinglePlayerDuty, SinglePlayerDuty.WaitSinglePlayerDutyExecutor>();
|
||||
serviceCollection.AddTaskExecutor<SinglePlayerDuty.DisableAi, SinglePlayerDuty.DisableAiExecutor>();
|
||||
serviceCollection.AddTaskExecutor<SinglePlayerDuty.SetTarget, SinglePlayerDuty.SetTargetExecutor>();
|
||||
serviceCollection.AddTaskExecutor<WaitCondition.Task, WaitCondition.WaitConditionExecutor>();
|
||||
serviceCollection.AddTaskExecutor<WaitNavmesh.Task, WaitNavmesh.Executor>();
|
||||
serviceCollection.AddTaskFactory<WaitAtEnd.Factory>();
|
||||
serviceCollection.AddTaskExecutor<WaitAtEnd.WaitDelay, WaitAtEnd.WaitDelayExecutor>();
|
||||
serviceCollection.AddTaskExecutor<WaitAtEnd.WaitNextStepOrSequence, WaitAtEnd.WaitNextStepOrSequenceExecutor>();
|
||||
serviceCollection.AddTaskExecutor<WaitAtEnd.WaitForCompletionFlags, WaitAtEnd.WaitForCompletionFlagsExecutor>();
|
||||
serviceCollection.AddTaskExecutor<WaitAtEnd.WaitObjectAtPosition, WaitAtEnd.WaitObjectAtPositionExecutor>();
|
||||
serviceCollection.AddTaskExecutor<WaitAtEnd.WaitQuestAccepted, WaitAtEnd.WaitQuestAcceptedExecutor>();
|
||||
serviceCollection.AddTaskExecutor<WaitAtEnd.WaitQuestCompleted, WaitAtEnd.WaitQuestCompletedExecutor>();
|
||||
serviceCollection.AddTaskExecutor<WaitAtEnd.NextStep, WaitAtEnd.NextStepExecutor>();
|
||||
serviceCollection.AddTaskExecutor<WaitAtEnd.EndAutomation, WaitAtEnd.EndAutomationExecutor>();
|
||||
serviceCollection.AddSingleton<TaskCreator>();
|
||||
serviceCollection.AddSingleton<ExtraConditionUtils>();
|
||||
serviceCollection.AddSingleton<ClassJobUtils>();
|
||||
}
|
||||
|
||||
private static void AddControllers(ServiceCollection serviceCollection)
|
||||
{
|
||||
serviceCollection.AddSingleton<MovementController>();
|
||||
serviceCollection.AddSingleton<MovementOverrideController>();
|
||||
serviceCollection.AddSingleton<GatheringPointRegistry>();
|
||||
serviceCollection.AddSingleton<QuestRegistry>();
|
||||
serviceCollection.AddSingleton<QuestController>();
|
||||
serviceCollection.AddSingleton<CombatController>();
|
||||
serviceCollection.AddSingleton<GatheringController>();
|
||||
serviceCollection.AddSingleton<ContextMenuController>();
|
||||
serviceCollection.AddSingleton<ShopController>();
|
||||
serviceCollection.AddSingleton<InterruptHandler>();
|
||||
serviceCollection.AddSingleton<PartyWatchDog>();
|
||||
serviceCollection.AddSingleton<CraftworksSupplyController>();
|
||||
serviceCollection.AddSingleton<CreditsController>();
|
||||
serviceCollection.AddSingleton<HelpUiController>();
|
||||
serviceCollection.AddSingleton<InteractionUiController>();
|
||||
serviceCollection.AddSingleton<ICombatModule, Mount128Module>();
|
||||
serviceCollection.AddSingleton<ICombatModule, Mount147Module>();
|
||||
serviceCollection.AddSingleton<ICombatModule, ItemUseModule>();
|
||||
serviceCollection.AddSingleton<ICombatModule, BossModModule>();
|
||||
serviceCollection.AddSingleton<ICombatModule, WrathComboModule>();
|
||||
serviceCollection.AddSingleton<ICombatModule, RotationSolverRebornModule>();
|
||||
}
|
||||
|
||||
private static void AddWindows(ServiceCollection serviceCollection)
|
||||
{
|
||||
serviceCollection.AddSingleton<UiUtils>();
|
||||
serviceCollection.AddTransient<QuestSelector>();
|
||||
serviceCollection.AddSingleton<ActiveQuestComponent>();
|
||||
serviceCollection.AddSingleton<ARealmRebornComponent>();
|
||||
serviceCollection.AddSingleton<CreationUtilsComponent>();
|
||||
serviceCollection.AddSingleton<EventInfoComponent>();
|
||||
serviceCollection.AddSingleton<QuestTooltipComponent>();
|
||||
serviceCollection.AddSingleton<QuickAccessButtonsComponent>();
|
||||
serviceCollection.AddSingleton<RemainingTasksComponent>();
|
||||
serviceCollection.AddSingleton<QuestJournalUtils>();
|
||||
serviceCollection.AddSingleton<QuestJournalComponent>();
|
||||
serviceCollection.AddSingleton<QuestRewardComponent>();
|
||||
serviceCollection.AddSingleton<GatheringJournalComponent>();
|
||||
serviceCollection.AddSingleton<AlliedSocietyJournalComponent>();
|
||||
serviceCollection.AddSingleton<OneTimeSetupWindow>();
|
||||
serviceCollection.AddSingleton<QuestWindow>();
|
||||
serviceCollection.AddSingleton<ConfigWindow>();
|
||||
serviceCollection.AddSingleton<DebugOverlay>();
|
||||
serviceCollection.AddSingleton<QuestSelectionWindow>();
|
||||
serviceCollection.AddSingleton<QuestValidationWindow>();
|
||||
serviceCollection.AddSingleton<JournalProgressWindow>();
|
||||
serviceCollection.AddSingleton<PriorityWindow>();
|
||||
serviceCollection.AddSingleton<GeneralConfigComponent>();
|
||||
serviceCollection.AddSingleton<PluginConfigComponent>();
|
||||
serviceCollection.AddSingleton<DutyConfigComponent>();
|
||||
serviceCollection.AddSingleton<SinglePlayerDutyConfigComponent>();
|
||||
serviceCollection.AddSingleton<StopConditionComponent>();
|
||||
serviceCollection.AddSingleton<NotificationConfigComponent>();
|
||||
serviceCollection.AddSingleton<DebugConfigComponent>();
|
||||
}
|
||||
|
||||
private static void AddQuestValidators(ServiceCollection serviceCollection)
|
||||
{
|
||||
serviceCollection.AddSingleton<QuestValidator>();
|
||||
serviceCollection.AddSingleton<IQuestValidator, QuestDisabledValidator>();
|
||||
serviceCollection.AddSingleton<IQuestValidator, BasicSequenceValidator>();
|
||||
serviceCollection.AddSingleton<IQuestValidator, UniqueStartStopValidator>();
|
||||
serviceCollection.AddSingleton<IQuestValidator, NextQuestValidator>();
|
||||
serviceCollection.AddSingleton<IQuestValidator, CompletionFlagsValidator>();
|
||||
serviceCollection.AddSingleton<IQuestValidator, AethernetShortcutValidator>();
|
||||
serviceCollection.AddSingleton<IQuestValidator, DialogueChoiceValidator>();
|
||||
serviceCollection.AddSingleton<IQuestValidator, ClassQuestShouldHaveShortcutValidator>();
|
||||
serviceCollection.AddSingleton<IQuestValidator, SinglePlayerInstanceValidator>();
|
||||
serviceCollection.AddSingleton<IQuestValidator, UniqueSinglePlayerInstanceValidator>();
|
||||
serviceCollection.AddSingleton<IQuestValidator, SayValidator>();
|
||||
serviceCollection.AddSingleton<JsonSchemaValidator>();
|
||||
((IServiceCollection)serviceCollection).AddSingleton((Func<IServiceProvider, IQuestValidator>)((IServiceProvider sp) => sp.GetRequiredService<JsonSchemaValidator>()));
|
||||
}
|
||||
|
||||
private static void Initialize(IServiceProvider serviceProvider)
|
||||
{
|
||||
serviceProvider.GetRequiredService<QuestRegistry>().Reload();
|
||||
serviceProvider.GetRequiredService<GatheringPointRegistry>().Reload();
|
||||
serviceProvider.GetRequiredService<SinglePlayerDutyConfigComponent>().Reload();
|
||||
serviceProvider.GetRequiredService<CommandHandler>();
|
||||
serviceProvider.GetRequiredService<ContextMenuController>();
|
||||
serviceProvider.GetRequiredService<CraftworksSupplyController>();
|
||||
serviceProvider.GetRequiredService<CreditsController>();
|
||||
serviceProvider.GetRequiredService<HelpUiController>();
|
||||
serviceProvider.GetRequiredService<ShopController>();
|
||||
serviceProvider.GetRequiredService<QuestionableIpc>();
|
||||
serviceProvider.GetRequiredService<DalamudInitializer>();
|
||||
serviceProvider.GetRequiredService<TextAdvanceIpc>();
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
_serviceProvider?.Dispose();
|
||||
}
|
||||
}
|
||||
25
Questionable/Questionable/ServiceCollectionExtensions.cs
Normal file
25
Questionable/Questionable/ServiceCollectionExtensions.cs
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Questionable.Controller.Steps;
|
||||
|
||||
namespace Questionable;
|
||||
|
||||
internal static class ServiceCollectionExtensions
|
||||
{
|
||||
public static void AddTaskFactory<TFactory>(this IServiceCollection serviceCollection) where TFactory : class, ITaskFactory
|
||||
{
|
||||
serviceCollection.AddSingleton<ITaskFactory, TFactory>();
|
||||
serviceCollection.AddSingleton<TFactory>();
|
||||
}
|
||||
|
||||
public static void AddTaskExecutor<T, TExecutor>(this IServiceCollection serviceCollection) where T : class, ITask where TExecutor : TaskExecutor<T>
|
||||
{
|
||||
serviceCollection.AddKeyedTransient<ITaskExecutor, TExecutor>(typeof(T));
|
||||
serviceCollection.AddTransient<TExecutor>();
|
||||
}
|
||||
|
||||
public static void AddTaskFactoryAndExecutor<T, TFactory, TExecutor>(this IServiceCollection serviceCollection) where T : class, ITask where TFactory : class, ITaskFactory where TExecutor : TaskExecutor<T>
|
||||
{
|
||||
serviceCollection.AddTaskFactory<TFactory>();
|
||||
serviceCollection.AddTaskExecutor<T, TExecutor>();
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue