Make plugin compatible with AllaganTools 1.7.0.11+

master v1.1
Liza 2024-07-14 16:11:27 +02:00
parent 0a313e8fa3
commit 3156a9e051
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>