Add IPC to retrieve items that'll be auto-discarded
This commit is contained in:
parent
3cce7bce2d
commit
c2d42317ce
@ -1,7 +1,7 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net7.0-windows</TargetFramework>
|
||||
<Version>4.2</Version>
|
||||
<Version>4.3</Version>
|
||||
<LangVersion>11.0</LangVersion>
|
||||
<Nullable>enable</Nullable>
|
||||
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
|
||||
|
@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
using ARDiscard.External;
|
||||
using ARDiscard.GameData;
|
||||
using ARDiscard.Windows;
|
||||
using AutoRetainerAPI;
|
||||
@ -37,6 +38,7 @@ public class AutoDiscardPlogon : IDalamudPlugin
|
||||
private readonly AutoRetainerApi _autoRetainerApi;
|
||||
private readonly TaskManager _taskManager;
|
||||
private readonly ContextMenuIntegration _contextMenuIntegration;
|
||||
private readonly AutoDiscardIpc _autoDiscardIpc;
|
||||
|
||||
private DateTime _cancelDiscardAfter = DateTime.MaxValue;
|
||||
|
||||
@ -87,6 +89,7 @@ public class AutoDiscardPlogon : IDalamudPlugin
|
||||
_autoRetainerApi = new();
|
||||
_taskManager = new();
|
||||
_contextMenuIntegration = new(_pluginInterface, _chatGui, itemCache, _configuration, _configWindow, _gameGui);
|
||||
_autoDiscardIpc = new(_pluginInterface, _configuration);
|
||||
|
||||
_clientState.Login += _discardWindow.Login;
|
||||
_clientState.Logout += _discardWindow.Logout;
|
||||
@ -274,6 +277,7 @@ public class AutoDiscardPlogon : IDalamudPlugin
|
||||
_clientState.Login -= _discardWindow.Login;
|
||||
_clientState.Logout -= _discardWindow.Logout;
|
||||
|
||||
_autoDiscardIpc.Dispose();
|
||||
_contextMenuIntegration.Dispose();
|
||||
_autoRetainerApi.Dispose();
|
||||
ECommonsMain.Dispose();
|
||||
|
32
ARDiscard/External/AutoDiscardIpc.cs
vendored
Normal file
32
ARDiscard/External/AutoDiscardIpc.cs
vendored
Normal file
@ -0,0 +1,32 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Immutable;
|
||||
using Dalamud.Plugin;
|
||||
using Dalamud.Plugin.Ipc;
|
||||
|
||||
namespace ARDiscard.External;
|
||||
|
||||
internal sealed class AutoDiscardIpc
|
||||
{
|
||||
private const string ItemsToDiscard = "ARDiscard.GetItemsToDiscard";
|
||||
|
||||
private readonly Configuration _configuration;
|
||||
private readonly ICallGateProvider<IReadOnlySet<uint>> _getItemsToDiscard;
|
||||
|
||||
public AutoDiscardIpc(DalamudPluginInterface pluginInterface, Configuration configuration)
|
||||
{
|
||||
_configuration = configuration;
|
||||
|
||||
_getItemsToDiscard = pluginInterface.GetIpcProvider<IReadOnlySet<uint>>(ItemsToDiscard);
|
||||
_getItemsToDiscard.RegisterFunc(GetItemsToDiscard);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
_getItemsToDiscard.UnregisterFunc();
|
||||
}
|
||||
|
||||
private IReadOnlySet<uint> GetItemsToDiscard()
|
||||
{
|
||||
return _configuration.DiscardingItems.ToImmutableHashSet();
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user