Make plugin compatible with AllaganTools 1.7.0.11+

This commit is contained in:
Liza 2024-07-14 16:11:27 +02:00
parent 0a313e8fa3
commit 859cd4500e
Signed by: liza
GPG Key ID: 7199F8D727D55F67
2 changed files with 4 additions and 6 deletions

View File

@ -65,10 +65,8 @@ internal sealed class AllaganToolsIpc : IDisposable
{
if (_dalamudReflector.TryGetDalamudPlugin("Allagan Tools", out var it, false, true))
{
var pluginLoader = it.GetType()
.GetProperty("PluginLoader", BindingFlags.NonPublic | BindingFlags.Instance)!
.GetValue(it)!;
var host = pluginLoader.GetType().GetProperty("Host")!.GetValue(pluginLoader)!;
var hostedPlugin = it.GetType().BaseType!;
var host = hostedPlugin.GetField("host", BindingFlags.NonPublic | BindingFlags.Instance)!.GetValue(it)!;
var serviceProvider = host.GetType().GetProperty("Services")!.GetValue(host)!;
var getServiceMethod = serviceProvider.GetType().GetMethod("GetService")!;
object GetService(Type t) => getServiceMethod.Invoke(serviceProvider, [t])!;
@ -128,7 +126,7 @@ internal sealed class AllaganToolsIpc : IDisposable
public Dictionary<Character, Currencies> CountCurrencies()
{
_pluginLog.Debug($"{_characters.GetType()}, {_inventories.GetType()}");
_pluginLog.Verbose($"Updating characters with {_characters.GetType()} and {_inventories.GetType()}");
var characters = _characters.All.ToDictionary(x => x.CharacterId, x => x);
return _inventories.All
.Where(x => characters.ContainsKey(x.Value.CharacterId))

View File

@ -1,6 +1,6 @@
<Project Sdk="Dalamud.NET.Sdk/9.0.2">
<PropertyGroup>
<Version>1.0</Version>
<Version>1.1</Version>
<OutputPath>dist</OutputPath>
</PropertyGroup>