Adjustments around FC exclusions
This commit is contained in:
parent
533b87118e
commit
80577a7636
@ -1,7 +1,7 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net7.0-windows</TargetFramework>
|
<TargetFramework>net7.0-windows</TargetFramework>
|
||||||
<Version>0.6</Version>
|
<Version>0.7</Version>
|
||||||
<LangVersion>11.0</LangVersion>
|
<LangVersion>11.0</LangVersion>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
|
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
|
||||||
|
@ -69,7 +69,7 @@ internal sealed class InfluxStatisticsClient : IDisposable
|
|||||||
var validFcIds = currencyStats.Keys
|
var validFcIds = currencyStats.Keys
|
||||||
.Where(x => x.CharacterType == CharacterType.Character)
|
.Where(x => x.CharacterType == CharacterType.Character)
|
||||||
.Where(x => _configuration.IncludedCharacters
|
.Where(x => _configuration.IncludedCharacters
|
||||||
.SingleOrDefault(config => config.LocalContentId == x.CharacterId)?.IncludeFreeCompany == true)
|
.Any(config => config.LocalContentId == x.CharacterId && config.IncludeFreeCompany))
|
||||||
.Select(x => x.FreeCompanyId)
|
.Select(x => x.FreeCompanyId)
|
||||||
.ToList();
|
.ToList();
|
||||||
var client = _influxClient;
|
var client = _influxClient;
|
||||||
|
@ -56,9 +56,12 @@ public class InfluxPlugin : IDalamudPlugin
|
|||||||
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);
|
||||||
_localStatsCalculator = new LocalStatsCalculator(pluginInterface, clientState, addonLifecycle, pluginLog, dataManager);
|
_localStatsCalculator =
|
||||||
_fcStatsCalculator = new FcStatsCalculator(this, pluginInterface, clientState, addonLifecycle, gameGui, framework, pluginLog);
|
new LocalStatsCalculator(pluginInterface, clientState, addonLifecycle, pluginLog, dataManager);
|
||||||
_influxStatisticsClient = new InfluxStatisticsClient(chatGui, _configuration, dataManager, clientState, _pluginLog);
|
_fcStatsCalculator = new FcStatsCalculator(this, pluginInterface, clientState, addonLifecycle, gameGui,
|
||||||
|
framework, _configuration, pluginLog);
|
||||||
|
_influxStatisticsClient =
|
||||||
|
new InfluxStatisticsClient(chatGui, _configuration, dataManager, clientState, _pluginLog);
|
||||||
|
|
||||||
_windowSystem = new WindowSystem(typeof(InfluxPlugin).FullName);
|
_windowSystem = new WindowSystem(typeof(InfluxPlugin).FullName);
|
||||||
_statisticsWindow = new StatisticsWindow();
|
_statisticsWindow = new StatisticsWindow();
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
using AutoRetainerAPI;
|
using AutoRetainerAPI;
|
||||||
using Dalamud.Game.Addon.Lifecycle;
|
using Dalamud.Game.Addon.Lifecycle;
|
||||||
using Dalamud.Game.Addon.Lifecycle.AddonArgTypes;
|
using Dalamud.Game.Addon.Lifecycle.AddonArgTypes;
|
||||||
@ -13,6 +14,7 @@ using FFXIVClientStructs.FFXIV.Client.UI.Info;
|
|||||||
using FFXIVClientStructs.FFXIV.Component.GUI;
|
using FFXIVClientStructs.FFXIV.Component.GUI;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Task = System.Threading.Tasks.Task;
|
using Task = System.Threading.Tasks.Task;
|
||||||
|
|
||||||
namespace Influx.LocalStatistics;
|
namespace Influx.LocalStatistics;
|
||||||
|
|
||||||
public class FcStatsCalculator : IDisposable
|
public class FcStatsCalculator : IDisposable
|
||||||
@ -22,6 +24,7 @@ public class FcStatsCalculator : IDisposable
|
|||||||
private readonly IAddonLifecycle _addonLifecycle;
|
private readonly IAddonLifecycle _addonLifecycle;
|
||||||
private readonly IGameGui _gameGui;
|
private readonly IGameGui _gameGui;
|
||||||
private readonly IFramework _framework;
|
private readonly IFramework _framework;
|
||||||
|
private readonly Configuration _configuration;
|
||||||
private readonly IPluginLog _pluginLog;
|
private readonly IPluginLog _pluginLog;
|
||||||
private readonly AutoRetainerApi _autoRetainerApi;
|
private readonly AutoRetainerApi _autoRetainerApi;
|
||||||
|
|
||||||
@ -36,6 +39,7 @@ public class FcStatsCalculator : IDisposable
|
|||||||
IAddonLifecycle addonLifecycle,
|
IAddonLifecycle addonLifecycle,
|
||||||
IGameGui gameGui,
|
IGameGui gameGui,
|
||||||
IFramework framework,
|
IFramework framework,
|
||||||
|
Configuration configuration,
|
||||||
IPluginLog pluginLog)
|
IPluginLog pluginLog)
|
||||||
{
|
{
|
||||||
_pluginInterface = pluginInterface;
|
_pluginInterface = pluginInterface;
|
||||||
@ -43,13 +47,14 @@ public class FcStatsCalculator : IDisposable
|
|||||||
_addonLifecycle = addonLifecycle;
|
_addonLifecycle = addonLifecycle;
|
||||||
_gameGui = gameGui;
|
_gameGui = gameGui;
|
||||||
_framework = framework;
|
_framework = framework;
|
||||||
|
_configuration = configuration;
|
||||||
_pluginLog = pluginLog;
|
_pluginLog = pluginLog;
|
||||||
|
|
||||||
ECommonsMain.Init(_pluginInterface, plugin);
|
ECommonsMain.Init(_pluginInterface, plugin);
|
||||||
_autoRetainerApi = new();
|
_autoRetainerApi = new();
|
||||||
_autoRetainerApi.OnCharacterPostprocessStep += CheckCharacterPostProcess;
|
_autoRetainerApi.OnCharacterPostprocessStep += CheckCharacterPostProcess;
|
||||||
_autoRetainerApi.OnCharacterReadyToPostProcess += DoCharacterPostProcess;
|
_autoRetainerApi.OnCharacterReadyToPostProcess += DoCharacterPostProcess;
|
||||||
_addonLifecycle.RegisterListener(AddonEvent.PostReceiveEvent ,"FreeCompany", CloseFcWindow);
|
_addonLifecycle.RegisterListener(AddonEvent.PostReceiveEvent, "FreeCompany", CloseFcWindow);
|
||||||
|
|
||||||
foreach (var file in _pluginInterface.ConfigDirectory.GetFiles("f.*.json"))
|
foreach (var file in _pluginInterface.ConfigDirectory.GetFiles("f.*.json"))
|
||||||
{
|
{
|
||||||
@ -70,6 +75,12 @@ public class FcStatsCalculator : IDisposable
|
|||||||
|
|
||||||
private unsafe void CheckCharacterPostProcess()
|
private unsafe void CheckCharacterPostProcess()
|
||||||
{
|
{
|
||||||
|
bool includeFc = _configuration.IncludedCharacters.Any(x =>
|
||||||
|
x.LocalContentId == _clientState.LocalContentId &&
|
||||||
|
x.IncludeFreeCompany);
|
||||||
|
if (!includeFc)
|
||||||
|
return;
|
||||||
|
|
||||||
var infoProxy = Framework.Instance()->UIModule->GetInfoModule()->GetInfoProxyById(InfoProxyId.FreeCompany);
|
var infoProxy = Framework.Instance()->UIModule->GetInfoModule()->GetInfoProxyById(InfoProxyId.FreeCompany);
|
||||||
if (infoProxy != null)
|
if (infoProxy != null)
|
||||||
{
|
{
|
||||||
@ -89,10 +100,18 @@ public class FcStatsCalculator : IDisposable
|
|||||||
private void DoCharacterPostProcess()
|
private void DoCharacterPostProcess()
|
||||||
{
|
{
|
||||||
closeFcWindow = true;
|
closeFcWindow = true;
|
||||||
Chat.Instance.SendMessage("/freecompanycmd");
|
|
||||||
|
unsafe
|
||||||
|
{
|
||||||
|
AtkUnitBase* addon = (AtkUnitBase*)_gameGui.GetAddonByName("FreeCompany");
|
||||||
|
if (addon != null && addon->IsVisible)
|
||||||
|
CloseFcWindow(AddonEvent.PostReceiveEvent);
|
||||||
|
else
|
||||||
|
Chat.Instance.SendMessage("/freecompanycmd");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CloseFcWindow(AddonEvent type, AddonArgs args)
|
private void CloseFcWindow(AddonEvent type, AddonArgs? args = null)
|
||||||
{
|
{
|
||||||
_framework.RunOnTick(() => UpdateOnTick(0), TimeSpan.FromMilliseconds(100));
|
_framework.RunOnTick(() => UpdateOnTick(0), TimeSpan.FromMilliseconds(100));
|
||||||
}
|
}
|
||||||
@ -191,7 +210,7 @@ public class FcStatsCalculator : IDisposable
|
|||||||
|
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
_addonLifecycle.UnregisterListener(AddonEvent.PostReceiveEvent ,"FreeCompany", CloseFcWindow);
|
_addonLifecycle.UnregisterListener(AddonEvent.PostReceiveEvent, "FreeCompany", CloseFcWindow);
|
||||||
_autoRetainerApi.OnCharacterPostprocessStep -= CheckCharacterPostProcess;
|
_autoRetainerApi.OnCharacterPostprocessStep -= CheckCharacterPostProcess;
|
||||||
_autoRetainerApi.OnCharacterReadyToPostProcess -= DoCharacterPostProcess;
|
_autoRetainerApi.OnCharacterReadyToPostProcess -= DoCharacterPostProcess;
|
||||||
_autoRetainerApi.Dispose();
|
_autoRetainerApi.Dispose();
|
||||||
|
@ -155,7 +155,7 @@ internal sealed class ConfigurationWindow : Window
|
|||||||
foreach (var characterInfo in world)
|
foreach (var characterInfo in world)
|
||||||
{
|
{
|
||||||
ImGui.Selectable(
|
ImGui.Selectable(
|
||||||
$"{characterInfo.CachedPlayerName} @ {characterInfo.CachedWorldName} ({characterInfo.LocalContentId:X})");
|
$"{characterInfo.CachedPlayerName} @ {characterInfo.CachedWorldName} ({characterInfo.LocalContentId:X}{(!characterInfo.IncludeFreeCompany ? ", no FC" : "")})");
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui.Unindent(30);
|
ImGui.Unindent(30);
|
||||||
|
Loading…
Reference in New Issue
Block a user