muffin v7.4.6
This commit is contained in:
parent
bb09805213
commit
1cc65e495d
13 changed files with 1291 additions and 949 deletions
|
|
@ -1,4 +1,5 @@
|
|||
using System;
|
||||
using Dalamud.Game.ClientState.Conditions;
|
||||
using Dalamud.Plugin;
|
||||
using Dalamud.Plugin.Ipc;
|
||||
using Dalamud.Plugin.Services;
|
||||
|
|
@ -10,31 +11,37 @@ internal sealed class TextAdvanceIpc : IDisposable
|
|||
{
|
||||
public sealed class ExternalTerritoryConfig
|
||||
{
|
||||
public bool? EnableQuestAccept = true;
|
||||
public bool? EnableQuestAccept;
|
||||
|
||||
public bool? EnableQuestComplete = true;
|
||||
public bool? EnableQuestComplete;
|
||||
|
||||
public bool? EnableRewardPick = true;
|
||||
public bool? EnableRewardPick;
|
||||
|
||||
public bool? EnableRequestHandin = true;
|
||||
public bool? EnableRequestHandin;
|
||||
|
||||
public bool? EnableCutsceneEsc = true;
|
||||
public bool? EnableCutsceneEsc;
|
||||
|
||||
public bool? EnableCutsceneSkipConfirm = true;
|
||||
public bool? EnableCutsceneSkipConfirm;
|
||||
|
||||
public bool? EnableTalkSkip = true;
|
||||
public bool? EnableTalkSkip;
|
||||
|
||||
public bool? EnableRequestFill = true;
|
||||
public bool? EnableRequestFill;
|
||||
|
||||
public bool? EnableAutoInteract = false;
|
||||
public bool? EnableAutoInteract;
|
||||
}
|
||||
|
||||
private bool _isExternalControlActivated;
|
||||
|
||||
private bool _lastCinemaModeState;
|
||||
|
||||
private bool _lastInCutsceneState;
|
||||
|
||||
private readonly QuestController _questController;
|
||||
|
||||
private readonly Configuration _configuration;
|
||||
|
||||
private readonly ICondition _condition;
|
||||
|
||||
private readonly IFramework _framework;
|
||||
|
||||
private readonly ICallGateSubscriber<bool> _isInExternalControl;
|
||||
|
|
@ -45,13 +52,12 @@ internal sealed class TextAdvanceIpc : IDisposable
|
|||
|
||||
private readonly string _pluginName;
|
||||
|
||||
private readonly ExternalTerritoryConfig _externalTerritoryConfig = new ExternalTerritoryConfig();
|
||||
|
||||
public TextAdvanceIpc(IDalamudPluginInterface pluginInterface, IFramework framework, QuestController questController, Configuration configuration)
|
||||
public TextAdvanceIpc(IDalamudPluginInterface pluginInterface, IFramework framework, QuestController questController, Configuration configuration, ICondition condition)
|
||||
{
|
||||
_framework = framework;
|
||||
_questController = questController;
|
||||
_configuration = configuration;
|
||||
_condition = condition;
|
||||
_isInExternalControl = pluginInterface.GetIpcSubscriber<bool>("TextAdvance.IsInExternalControl");
|
||||
_enableExternalControl = pluginInterface.GetIpcSubscriber<string, ExternalTerritoryConfig, bool>("TextAdvance.EnableExternalControl");
|
||||
_disableExternalControl = pluginInterface.GetIpcSubscriber<string, bool>("TextAdvance.DisableExternalControl");
|
||||
|
|
@ -71,16 +77,53 @@ internal sealed class TextAdvanceIpc : IDisposable
|
|||
private void OnUpdate(IFramework framework)
|
||||
{
|
||||
bool flag = _questController.IsRunning || _questController.AutomationType != QuestController.EAutomationType.Manual;
|
||||
if (_configuration.General.ConfigureTextAdvance && flag)
|
||||
if (!_configuration.General.ConfigureTextAdvance || !flag)
|
||||
{
|
||||
if (!_isInExternalControl.InvokeFunc() && _enableExternalControl.InvokeFunc(_pluginName, _externalTerritoryConfig))
|
||||
if (_isExternalControlActivated && (_disableExternalControl.InvokeFunc(_pluginName) || !_isInExternalControl.InvokeFunc()))
|
||||
{
|
||||
_isExternalControlActivated = true;
|
||||
_isExternalControlActivated = false;
|
||||
}
|
||||
return;
|
||||
}
|
||||
bool cinemaMode = _configuration.General.CinemaMode;
|
||||
bool flag2 = _condition[ConditionFlag.OccupiedInCutSceneEvent] || _condition[ConditionFlag.WatchingCutscene] || _condition[ConditionFlag.WatchingCutscene78];
|
||||
bool flag3 = cinemaMode != _lastCinemaModeState || (cinemaMode && flag2 != _lastInCutsceneState);
|
||||
if (!_isExternalControlActivated)
|
||||
{
|
||||
if (!_isInExternalControl.InvokeFunc())
|
||||
{
|
||||
ExternalTerritoryConfig arg = CreateExternalTerritoryConfig(cinemaMode, flag2);
|
||||
if (_enableExternalControl.InvokeFunc(_pluginName, arg))
|
||||
{
|
||||
_isExternalControlActivated = true;
|
||||
_lastCinemaModeState = cinemaMode;
|
||||
_lastInCutsceneState = flag2;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (_isExternalControlActivated && (_disableExternalControl.InvokeFunc(_pluginName) || !_isInExternalControl.InvokeFunc()))
|
||||
else if (flag3)
|
||||
{
|
||||
_isExternalControlActivated = false;
|
||||
ExternalTerritoryConfig arg2 = CreateExternalTerritoryConfig(cinemaMode, flag2);
|
||||
_enableExternalControl.InvokeFunc(_pluginName, arg2);
|
||||
_lastCinemaModeState = cinemaMode;
|
||||
_lastInCutsceneState = flag2;
|
||||
}
|
||||
}
|
||||
|
||||
private static ExternalTerritoryConfig CreateExternalTerritoryConfig(bool cinemaMode, bool inCutscene)
|
||||
{
|
||||
bool flag = cinemaMode && inCutscene;
|
||||
return new ExternalTerritoryConfig
|
||||
{
|
||||
EnableQuestAccept = true,
|
||||
EnableQuestComplete = true,
|
||||
EnableRewardPick = true,
|
||||
EnableRequestHandin = true,
|
||||
EnableCutsceneEsc = !cinemaMode,
|
||||
EnableCutsceneSkipConfirm = !cinemaMode,
|
||||
EnableTalkSkip = !flag,
|
||||
EnableRequestFill = true,
|
||||
EnableAutoInteract = false
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue