forked from liza/Questionable
master #3
@ -1,5 +1,5 @@
|
|||||||
<Project>
|
<Project>
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Version>3.8</Version>
|
<Version>3.9</Version>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
</Project>
|
</Project>
|
||||||
|
@ -20,6 +20,7 @@ internal sealed class Configuration : IPluginConfiguration
|
|||||||
public bool UseEscToCancelQuesting { get; set; } = true;
|
public bool UseEscToCancelQuesting { get; set; } = true;
|
||||||
public bool ShowIncompleteSeasonalEvents { get; set; } = true;
|
public bool ShowIncompleteSeasonalEvents { get; set; } = true;
|
||||||
public bool AutomaticallyCompleteSnipeTasks { get; set; }
|
public bool AutomaticallyCompleteSnipeTasks { get; set; }
|
||||||
|
public bool ConfigureTextAdvance { get; set; } = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
internal sealed class AdvancedConfiguration
|
internal sealed class AdvancedConfiguration
|
||||||
|
85
Questionable/External/TextAdvanceIpc.cs
vendored
Normal file
85
Questionable/External/TextAdvanceIpc.cs
vendored
Normal file
@ -0,0 +1,85 @@
|
|||||||
|
using Dalamud.Plugin;
|
||||||
|
using Dalamud.Plugin.Ipc;
|
||||||
|
using Dalamud.Plugin.Services;
|
||||||
|
using FFXIVClientStructs.FFXIV.Client.Game;
|
||||||
|
using Questionable.Controller;
|
||||||
|
using Questionable.Data;
|
||||||
|
using Questionable.Model.Common;
|
||||||
|
using System;
|
||||||
|
using System.Diagnostics.CodeAnalysis;
|
||||||
|
|
||||||
|
namespace Questionable.External;
|
||||||
|
|
||||||
|
internal sealed class TextAdvanceIpc : IDisposable
|
||||||
|
{
|
||||||
|
private bool _isExternalControlActivated;
|
||||||
|
private readonly QuestController _questController;
|
||||||
|
private readonly Configuration _configuration;
|
||||||
|
private readonly IFramework _framework;
|
||||||
|
private readonly ICallGateSubscriber<bool> _isInExternalControl;
|
||||||
|
private readonly ICallGateSubscriber<string, ExternalTerritoryConfig, bool> _enableExternalControl;
|
||||||
|
private readonly ICallGateSubscriber<string, bool> _disableExternalControl;
|
||||||
|
private readonly string _pluginName;
|
||||||
|
private readonly ExternalTerritoryConfig _externalTerritoryConfig = new();
|
||||||
|
|
||||||
|
public TextAdvanceIpc(IDalamudPluginInterface pluginInterface, IFramework framework, QuestController questController, Configuration configuration)
|
||||||
|
{
|
||||||
|
_framework = framework;
|
||||||
|
_questController = questController;
|
||||||
|
_configuration = configuration;
|
||||||
|
_isInExternalControl = pluginInterface.GetIpcSubscriber<bool>("TextAdvance.IsInExternalControl");
|
||||||
|
_enableExternalControl = pluginInterface.GetIpcSubscriber<string, ExternalTerritoryConfig, bool>("TextAdvance.EnableExternalControl");
|
||||||
|
_disableExternalControl = pluginInterface.GetIpcSubscriber<string, bool>("TextAdvance.DisableExternalControl");
|
||||||
|
_pluginName = pluginInterface.InternalName;
|
||||||
|
_framework.Update += OnUpdate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Dispose()
|
||||||
|
{
|
||||||
|
_framework.Update -= OnUpdate;
|
||||||
|
if(_isExternalControlActivated)
|
||||||
|
{
|
||||||
|
_disableExternalControl.InvokeFunc(_pluginName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnUpdate(IFramework framework)
|
||||||
|
{
|
||||||
|
if(_configuration.General.ConfigureTextAdvance && _questController.IsRunning)
|
||||||
|
{
|
||||||
|
if(!_isInExternalControl.InvokeFunc())
|
||||||
|
{
|
||||||
|
if(_enableExternalControl.InvokeFunc(_pluginName, _externalTerritoryConfig))
|
||||||
|
{
|
||||||
|
_isExternalControlActivated = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(_isExternalControlActivated)
|
||||||
|
{
|
||||||
|
if(_disableExternalControl.InvokeFunc(_pluginName) || !_isInExternalControl.InvokeFunc())
|
||||||
|
{
|
||||||
|
_isExternalControlActivated = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[SuppressMessage("ReSharper", "MemberCanBePrivate.Global")]
|
||||||
|
public sealed class ExternalTerritoryConfig
|
||||||
|
{
|
||||||
|
#pragma warning disable CS0414 // Field is assigned but its value is never used
|
||||||
|
public bool? EnableQuestAccept = true;
|
||||||
|
public bool? EnableQuestComplete = true;
|
||||||
|
public bool? EnableRewardPick = true;
|
||||||
|
public bool? EnableRequestHandin = true;
|
||||||
|
public bool? EnableCutsceneEsc = true;
|
||||||
|
public bool? EnableCutsceneSkipConfirm = true;
|
||||||
|
public bool? EnableTalkSkip = true;
|
||||||
|
public bool? EnableRequestFill = true;
|
||||||
|
public bool? EnableAutoInteract = false;
|
||||||
|
#pragma warning restore CS0414 // Field is assigned but its value is never used
|
||||||
|
}
|
||||||
|
}
|
@ -124,6 +124,7 @@ public sealed class QuestionablePlugin : IDalamudPlugin
|
|||||||
serviceCollection.AddSingleton<YesAlreadyIpc>();
|
serviceCollection.AddSingleton<YesAlreadyIpc>();
|
||||||
serviceCollection.AddSingleton<ArtisanIpc>();
|
serviceCollection.AddSingleton<ArtisanIpc>();
|
||||||
serviceCollection.AddSingleton<QuestionableIpc>();
|
serviceCollection.AddSingleton<QuestionableIpc>();
|
||||||
|
serviceCollection.AddSingleton<TextAdvanceIpc>();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void AddTaskFactories(ServiceCollection serviceCollection)
|
private static void AddTaskFactories(ServiceCollection serviceCollection)
|
||||||
@ -289,6 +290,7 @@ public sealed class QuestionablePlugin : IDalamudPlugin
|
|||||||
serviceProvider.GetRequiredService<QuestionableIpc>();
|
serviceProvider.GetRequiredService<QuestionableIpc>();
|
||||||
serviceProvider.GetRequiredService<DalamudInitializer>();
|
serviceProvider.GetRequiredService<DalamudInitializer>();
|
||||||
serviceProvider.GetRequiredService<AutoSnipeHandler>().Enable();
|
serviceProvider.GetRequiredService<AutoSnipeHandler>().Enable();
|
||||||
|
serviceProvider.GetRequiredService<TextAdvanceIpc>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
|
@ -90,6 +90,13 @@ internal sealed class ConfigWindow : LWindow, IPersistableWindowConfig
|
|||||||
Save();
|
Save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool configureTextAdvance = _configuration.General.ConfigureTextAdvance;
|
||||||
|
if (ImGui.Checkbox("Automatically configure TextAdvance with the recommended settings", ref configureTextAdvance))
|
||||||
|
{
|
||||||
|
_configuration.General.ConfigureTextAdvance = configureTextAdvance;
|
||||||
|
Save();
|
||||||
|
}
|
||||||
|
|
||||||
if (ImGui.CollapsingHeader("Cheats"))
|
if (ImGui.CollapsingHeader("Cheats"))
|
||||||
{
|
{
|
||||||
ImGui.TextColored(ImGuiColors.DalamudRed, "This setting will be removed in a future version, and will be\navailable through TextAdvance instead.");
|
ImGui.TextColored(ImGuiColors.DalamudRed, "This setting will be removed in a future version, and will be\navailable through TextAdvance instead.");
|
||||||
|
Loading…
Reference in New Issue
Block a user