Open FC window for half a second (for allagantools) when logging out in multimode
This commit is contained in:
parent
b757d93780
commit
4f9c3f2a55
6
.gitmodules
vendored
6
.gitmodules
vendored
@ -1,3 +1,9 @@
|
|||||||
[submodule "LLib"]
|
[submodule "LLib"]
|
||||||
path = LLib
|
path = LLib
|
||||||
url = https://git.carvel.li/liza/LLib.git
|
url = https://git.carvel.li/liza/LLib.git
|
||||||
|
[submodule "ECommons"]
|
||||||
|
path = ECommons
|
||||||
|
url = https://github.com/NightmareXIV/ECommons.git
|
||||||
|
[submodule "AutoRetainerAPI"]
|
||||||
|
path = AutoRetainerAPI
|
||||||
|
url = https://github.com/PunishXIV/AutoRetainerAPI.git
|
||||||
|
1
AutoRetainerAPI
Submodule
1
AutoRetainerAPI
Submodule
@ -0,0 +1 @@
|
|||||||
|
Subproject commit 2715088db81d2be34447b27b0e5e5a3e766e47c7
|
1
ECommons
Submodule
1
ECommons
Submodule
@ -0,0 +1 @@
|
|||||||
|
Subproject commit f1c688a0599b41d70230021328a575da7351cf91
|
12
Influx.sln
12
Influx.sln
@ -4,6 +4,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Influx", "Influx\Influx.csp
|
|||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LLib", "LLib\LLib.csproj", "{C11552A8-9C8C-4084-A669-AAFE55E24DCC}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LLib", "LLib\LLib.csproj", "{C11552A8-9C8C-4084-A669-AAFE55E24DCC}"
|
||||||
EndProject
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ECommons", "ECommons\ECommons\ECommons.csproj", "{FC6E184C-5B01-4298-87DF-CC10C4955936}"
|
||||||
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AutoRetainerAPI", "AutoRetainerAPI\AutoRetainerAPI\AutoRetainerAPI.csproj", "{7352C470-D652-4909-AD90-8A5171A86698}"
|
||||||
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Any CPU = Debug|Any CPU
|
Debug|Any CPU = Debug|Any CPU
|
||||||
@ -18,5 +22,13 @@ Global
|
|||||||
{C11552A8-9C8C-4084-A669-AAFE55E24DCC}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{C11552A8-9C8C-4084-A669-AAFE55E24DCC}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{C11552A8-9C8C-4084-A669-AAFE55E24DCC}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{C11552A8-9C8C-4084-A669-AAFE55E24DCC}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{C11552A8-9C8C-4084-A669-AAFE55E24DCC}.Release|Any CPU.Build.0 = Release|Any CPU
|
{C11552A8-9C8C-4084-A669-AAFE55E24DCC}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{FC6E184C-5B01-4298-87DF-CC10C4955936}.Debug|Any CPU.ActiveCfg = Debug|x64
|
||||||
|
{FC6E184C-5B01-4298-87DF-CC10C4955936}.Debug|Any CPU.Build.0 = Debug|x64
|
||||||
|
{FC6E184C-5B01-4298-87DF-CC10C4955936}.Release|Any CPU.ActiveCfg = Release|x64
|
||||||
|
{FC6E184C-5B01-4298-87DF-CC10C4955936}.Release|Any CPU.Build.0 = Release|x64
|
||||||
|
{7352C470-D652-4909-AD90-8A5171A86698}.Debug|Any CPU.ActiveCfg = Debug|x64
|
||||||
|
{7352C470-D652-4909-AD90-8A5171A86698}.Debug|Any CPU.Build.0 = Debug|x64
|
||||||
|
{7352C470-D652-4909-AD90-8A5171A86698}.Release|Any CPU.ActiveCfg = Release|x64
|
||||||
|
{7352C470-D652-4909-AD90-8A5171A86698}.Release|Any CPU.Build.0 = Release|x64
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
EndGlobal
|
EndGlobal
|
||||||
|
@ -54,6 +54,8 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\AutoRetainerAPI\AutoRetainerAPI\AutoRetainerAPI.csproj" />
|
||||||
|
<ProjectReference Include="..\ECommons\ECommons\ECommons.csproj" />
|
||||||
<ProjectReference Include="..\LLib\LLib.csproj" />
|
<ProjectReference Include="..\LLib\LLib.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
@ -2,16 +2,25 @@
|
|||||||
using System.Diagnostics.CodeAnalysis;
|
using System.Diagnostics.CodeAnalysis;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
|
using AutoRetainerAPI;
|
||||||
|
using Dalamud.Game.Addon.Lifecycle;
|
||||||
|
using Dalamud.Game.Addon.Lifecycle.AddonArgTypes;
|
||||||
using Dalamud.Game.Command;
|
using Dalamud.Game.Command;
|
||||||
using Dalamud.Interface.Windowing;
|
using Dalamud.Interface.Windowing;
|
||||||
using Dalamud.Plugin;
|
using Dalamud.Plugin;
|
||||||
using Dalamud.Plugin.Services;
|
using Dalamud.Plugin.Services;
|
||||||
|
using ECommons;
|
||||||
|
using ECommons.Automation;
|
||||||
|
using FFXIVClientStructs.FFXIV.Client.System.Framework;
|
||||||
|
using FFXIVClientStructs.FFXIV.Client.UI.Info;
|
||||||
|
using FFXIVClientStructs.FFXIV.Component.GUI;
|
||||||
using Influx.AllaganTools;
|
using Influx.AllaganTools;
|
||||||
using Influx.Influx;
|
using Influx.Influx;
|
||||||
using Influx.LocalStatistics;
|
using Influx.LocalStatistics;
|
||||||
using Influx.SubmarineTracker;
|
using Influx.SubmarineTracker;
|
||||||
using Influx.Windows;
|
using Influx.Windows;
|
||||||
using LLib;
|
using LLib;
|
||||||
|
using Task = System.Threading.Tasks.Task;
|
||||||
|
|
||||||
namespace Influx;
|
namespace Influx;
|
||||||
|
|
||||||
@ -23,6 +32,8 @@ public class InfluxPlugin : IDalamudPlugin
|
|||||||
private readonly IClientState _clientState;
|
private readonly IClientState _clientState;
|
||||||
private readonly ICommandManager _commandManager;
|
private readonly ICommandManager _commandManager;
|
||||||
private readonly IPluginLog _pluginLog;
|
private readonly IPluginLog _pluginLog;
|
||||||
|
private readonly IAddonLifecycle _addonLifecycle;
|
||||||
|
private readonly IGameGui _gameGui;
|
||||||
private readonly AllaganToolsIpc _allaganToolsIpc;
|
private readonly AllaganToolsIpc _allaganToolsIpc;
|
||||||
private readonly SubmarineTrackerIpc _submarineTrackerIpc;
|
private readonly SubmarineTrackerIpc _submarineTrackerIpc;
|
||||||
private readonly LocalStatsCalculator _localStatsCalculator;
|
private readonly LocalStatsCalculator _localStatsCalculator;
|
||||||
@ -31,16 +42,21 @@ public class InfluxPlugin : IDalamudPlugin
|
|||||||
private readonly StatisticsWindow _statisticsWindow;
|
private readonly StatisticsWindow _statisticsWindow;
|
||||||
private readonly ConfigurationWindow _configurationWindow;
|
private readonly ConfigurationWindow _configurationWindow;
|
||||||
private readonly Timer _timer;
|
private readonly Timer _timer;
|
||||||
|
private readonly AutoRetainerApi _autoRetainerApi;
|
||||||
|
|
||||||
|
private bool closeFcWindow = false;
|
||||||
|
|
||||||
public InfluxPlugin(DalamudPluginInterface pluginInterface, IClientState clientState, IPluginLog pluginLog,
|
public InfluxPlugin(DalamudPluginInterface pluginInterface, IClientState clientState, IPluginLog pluginLog,
|
||||||
ICommandManager commandManager, IChatGui chatGui, IDataManager dataManager, IFramework framework,
|
ICommandManager commandManager, IChatGui chatGui, IDataManager dataManager, IFramework framework,
|
||||||
IAddonLifecycle addonLifecycle)
|
IAddonLifecycle addonLifecycle, IGameGui gameGui)
|
||||||
{
|
{
|
||||||
_pluginInterface = pluginInterface;
|
_pluginInterface = pluginInterface;
|
||||||
_configuration = LoadConfig();
|
_configuration = LoadConfig();
|
||||||
_clientState = clientState;
|
_clientState = clientState;
|
||||||
_commandManager = commandManager;
|
_commandManager = commandManager;
|
||||||
_pluginLog = pluginLog;
|
_pluginLog = pluginLog;
|
||||||
|
_addonLifecycle = addonLifecycle;
|
||||||
|
_gameGui = gameGui;
|
||||||
DalamudReflector dalamudReflector = new DalamudReflector(pluginInterface, framework, pluginLog);
|
DalamudReflector dalamudReflector = new DalamudReflector(pluginInterface, framework, pluginLog);
|
||||||
_allaganToolsIpc = new AllaganToolsIpc(pluginInterface, chatGui, dalamudReflector, framework, _pluginLog);
|
_allaganToolsIpc = new AllaganToolsIpc(pluginInterface, chatGui, dalamudReflector, framework, _pluginLog);
|
||||||
_submarineTrackerIpc = new SubmarineTrackerIpc(dalamudReflector);
|
_submarineTrackerIpc = new SubmarineTrackerIpc(dalamudReflector);
|
||||||
@ -57,6 +73,12 @@ public class InfluxPlugin : IDalamudPlugin
|
|||||||
_timer = new Timer(_ => UpdateStatistics(), null, TimeSpan.Zero, TimeSpan.FromMinutes(1));
|
_timer = new Timer(_ => UpdateStatistics(), null, TimeSpan.Zero, TimeSpan.FromMinutes(1));
|
||||||
_pluginInterface.UiBuilder.Draw += _windowSystem.Draw;
|
_pluginInterface.UiBuilder.Draw += _windowSystem.Draw;
|
||||||
_pluginInterface.UiBuilder.OpenConfigUi += _configurationWindow.Toggle;
|
_pluginInterface.UiBuilder.OpenConfigUi += _configurationWindow.Toggle;
|
||||||
|
|
||||||
|
ECommonsMain.Init(_pluginInterface, this);
|
||||||
|
_autoRetainerApi = new();
|
||||||
|
_autoRetainerApi.OnCharacterPostprocessStep += CheckCharacterPostProcess;
|
||||||
|
_autoRetainerApi.OnCharacterReadyToPostProcess += DoCharacterPostProcess;
|
||||||
|
_addonLifecycle.RegisterListener(AddonEvent.PostSetup ,"FreeCompany", CloseFcWindow);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Configuration LoadConfig()
|
private Configuration LoadConfig()
|
||||||
@ -120,8 +142,63 @@ public class InfluxPlugin : IDalamudPlugin
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private unsafe void CheckCharacterPostProcess()
|
||||||
|
{
|
||||||
|
|
||||||
|
var infoProxy = Framework.Instance()->UIModule->GetInfoModule()->GetInfoProxyById(InfoProxyId.FreeCompany);
|
||||||
|
if (infoProxy != null)
|
||||||
|
{
|
||||||
|
var fcProxy = (InfoProxyFreeCompany*)infoProxy;
|
||||||
|
if (fcProxy->ID != 0)
|
||||||
|
{
|
||||||
|
_pluginLog.Information($"Requesting post-process, FC is {fcProxy->ID}");
|
||||||
|
_autoRetainerApi.RequestCharacterPostprocess();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
_pluginLog.Information("No FC id");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
_pluginLog.Information("No FreeCompany info proxy");
|
||||||
|
}
|
||||||
|
|
||||||
|
private void DoCharacterPostProcess()
|
||||||
|
{
|
||||||
|
closeFcWindow = true;
|
||||||
|
Chat.Instance.SendMessage("/freecompanycmd");
|
||||||
|
}
|
||||||
|
|
||||||
|
private void CloseFcWindow(AddonEvent type, AddonArgs args)
|
||||||
|
{
|
||||||
|
if (closeFcWindow)
|
||||||
|
{
|
||||||
|
Task.Run(async () =>
|
||||||
|
{
|
||||||
|
// this runs every 500ms
|
||||||
|
// https://github.com/Critical-Impact/CriticalCommonLib/blob/7b3814e703dd5b2981cd4334524b4b301c23e639/Services/InventoryScanner.cs#L436
|
||||||
|
await Task.Delay(550);
|
||||||
|
|
||||||
|
_pluginLog.Information("Closing FC window...");
|
||||||
|
unsafe
|
||||||
|
{
|
||||||
|
AtkUnitBase* addon = (AtkUnitBase*)_gameGui.GetAddonByName("FreeCompany");
|
||||||
|
if (addon->IsVisible)
|
||||||
|
addon->FireCallbackInt(-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
closeFcWindow = false;
|
||||||
|
_autoRetainerApi.FinishCharacterPostProcess();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
|
_addonLifecycle.UnregisterListener(AddonEvent.PostSetup ,"FreeCompany", CloseFcWindow);
|
||||||
|
_autoRetainerApi.OnCharacterPostprocessStep -= CheckCharacterPostProcess;
|
||||||
|
_autoRetainerApi.OnCharacterReadyToPostProcess -= DoCharacterPostProcess;
|
||||||
|
_autoRetainerApi.Dispose();
|
||||||
|
ECommonsMain.Dispose();
|
||||||
|
|
||||||
_pluginInterface.UiBuilder.OpenConfigUi -= _configurationWindow.Toggle;
|
_pluginInterface.UiBuilder.OpenConfigUi -= _configurationWindow.Toggle;
|
||||||
_pluginInterface.UiBuilder.Draw -= _windowSystem.Draw;
|
_pluginInterface.UiBuilder.Draw -= _windowSystem.Draw;
|
||||||
_timer.Dispose();
|
_timer.Dispose();
|
||||||
|
@ -209,7 +209,7 @@ internal sealed class LocalStatsCalculator : IDisposable
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_pluginLog.Information($"XX → {playerState->StartTown}");
|
//_pluginLog.Information($"XX → {playerState->StartTown}");
|
||||||
IReadOnlyList<QuestInfo> cityQuests = playerState->StartTown switch
|
IReadOnlyList<QuestInfo> cityQuests = playerState->StartTown switch
|
||||||
{
|
{
|
||||||
1 => _limsaStart!,
|
1 => _limsaStart!,
|
||||||
@ -230,7 +230,7 @@ internal sealed class LocalStatsCalculator : IDisposable
|
|||||||
localStats.MsqGenre = 0;
|
localStats.MsqGenre = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
_pluginLog.Information($"Current MSQ Progress: {localStats.MsqCount}, {localStats.MsqName}");
|
_pluginLog.Verbose($"Current MSQ Progress: {localStats.MsqCount}, {localStats.MsqName}");
|
||||||
|
|
||||||
if (_cache.TryGetValue(localContentId, out var existingStats))
|
if (_cache.TryGetValue(localContentId, out var existingStats))
|
||||||
{
|
{
|
||||||
|
@ -191,6 +191,15 @@
|
|||||||
"System.Drawing.Common": "6.0.0"
|
"System.Drawing.Common": "6.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"autoretainerapi": {
|
||||||
|
"type": "Project",
|
||||||
|
"dependencies": {
|
||||||
|
"ECommons": "[2.1.0, )"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"ecommons": {
|
||||||
|
"type": "Project"
|
||||||
|
},
|
||||||
"llib": {
|
"llib": {
|
||||||
"type": "Project"
|
"type": "Project"
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user