Compare commits

..

No commits in common. "master" and "v1.0" have entirely different histories.
master ... v1.0

6 changed files with 20 additions and 18 deletions

View File

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

View File

@ -3,26 +3,27 @@ using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Reflection; using System.Reflection;
using System.Threading.Tasks;
namespace Influx.AllaganTools; namespace Influx.AllaganTools;
internal sealed class FilterResult internal sealed class FilterResult
{ {
private readonly IEnumerable _searchResultList; private readonly object _delegate;
private readonly PropertyInfo _sortedItems;
public FilterResult(IEnumerable searchResultList) public FilterResult(object @delegate)
{ {
ArgumentNullException.ThrowIfNull(searchResultList); ArgumentNullException.ThrowIfNull(@delegate);
_searchResultList = searchResultList; _delegate = @delegate;
_sortedItems =
_delegate.GetType().GetProperty("SortedItems") ?? throw new MissingMemberException();
} }
public IReadOnlyList<SortingResult> GenerateFilteredList() public IReadOnlyList<SortingResult> GenerateFilteredList()
{ {
return _searchResultList return ((IEnumerable)_sortedItems.GetValue(_delegate)!)
.Cast<object>() .Cast<object>()
.Select(x => x.GetType()
.GetField("_sortingResult", BindingFlags.Instance | BindingFlags.NonPublic)!
.GetValue(x)!)
.Select(x => new SortingResult(x)) .Select(x => new SortingResult(x))
.ToList(); .ToList();
} }

View File

@ -1,5 +1,4 @@
using System; using System;
using System.Collections;
using System.Reflection; using System.Reflection;
namespace Influx.AllaganTools; namespace Influx.AllaganTools;
@ -24,6 +23,6 @@ internal sealed class ListService : IListService
public FilterResult? GetFilterByKeyOrName(string keyOrName) public FilterResult? GetFilterByKeyOrName(string keyOrName)
{ {
var f = _getListByKeyOrName.Invoke(_listService, [keyOrName]); var f = _getListByKeyOrName.Invoke(_listService, [keyOrName]);
return f != null ? new FilterResult((IEnumerable)_refreshList.Invoke(_listFilterService, [f])!) : null; return f != null ? new FilterResult(_refreshList.Invoke(_listFilterService, [f])!) : null;
} }
} }

View File

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

View File

@ -162,9 +162,9 @@ internal sealed class FcStatsCalculator : IDisposable
{ {
var atkArrays = Framework.Instance()->GetUIModule()->GetRaptureAtkModule()->AtkModule var atkArrays = Framework.Instance()->GetUIModule()->GetRaptureAtkModule()->AtkModule
.AtkArrayDataHolder; .AtkArrayDataHolder;
if (atkArrays.NumberArrayCount > 51) if (atkArrays.NumberArrayCount > 50)
{ {
var fcArrayData = atkArrays.GetNumberArrayData(51); var fcArrayData = atkArrays.GetNumberArrayData(50);
FcStats fcStats = new FcStats FcStats fcStats = new FcStats
{ {
ContentId = localContentId, ContentId = localContentId,

2
LLib

@ -1 +1 @@
Subproject commit 8d947be6784804a7cab120d596dd54e88e548efc Subproject commit 7027d291efbbff6a55944dd521d3907210ddecbe