punish v6.8.18.0
This commit is contained in:
commit
cfb4dea47e
316 changed files with 554088 additions and 0 deletions
86
Questionable/Questionable.External/TextAdvanceIpc.cs
Normal file
86
Questionable/Questionable.External/TextAdvanceIpc.cs
Normal file
|
@ -0,0 +1,86 @@
|
|||
using System;
|
||||
using Dalamud.Plugin;
|
||||
using Dalamud.Plugin.Ipc;
|
||||
using Dalamud.Plugin.Services;
|
||||
using Questionable.Controller;
|
||||
|
||||
namespace Questionable.External;
|
||||
|
||||
internal sealed class TextAdvanceIpc : IDisposable
|
||||
{
|
||||
public sealed class ExternalTerritoryConfig
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
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 ExternalTerritoryConfig();
|
||||
|
||||
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)
|
||||
{
|
||||
bool flag = _questController.IsRunning || _questController.AutomationType != QuestController.EAutomationType.Manual;
|
||||
if (_configuration.General.ConfigureTextAdvance && flag)
|
||||
{
|
||||
if (!_isInExternalControl.InvokeFunc() && _enableExternalControl.InvokeFunc(_pluginName, _externalTerritoryConfig))
|
||||
{
|
||||
_isExternalControlActivated = true;
|
||||
}
|
||||
}
|
||||
else if (_isExternalControlActivated && (_disableExternalControl.InvokeFunc(_pluginName) || !_isInExternalControl.InvokeFunc()))
|
||||
{
|
||||
_isExternalControlActivated = false;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue