Include free inventory slots in character stats
This commit is contained in:
parent
1174413b9a
commit
4f9bc6cbe4
@ -1,2 +1,3 @@
|
||||
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Allagan/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Allagan/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Ceruleum/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
|
@ -5,6 +5,7 @@ using Dalamud.Plugin;
|
||||
using Dalamud.Plugin.Ipc;
|
||||
using Dalamud.Plugin.Ipc.Exceptions;
|
||||
using Dalamud.Plugin.Services;
|
||||
using FFXIVClientStructs.FFXIV.Client.Game;
|
||||
using LLib;
|
||||
|
||||
namespace Influx.AllaganTools;
|
||||
@ -129,6 +130,7 @@ internal sealed class AllaganToolsIpc : IDisposable
|
||||
Ventures = inv.Sum(21072),
|
||||
CeruleumTanks = inv.Sum(10155),
|
||||
RepairKits = inv.Sum(10373),
|
||||
FreeSlots = inv.FreeInventorySlots,
|
||||
};
|
||||
});
|
||||
}
|
||||
@ -144,5 +146,7 @@ internal sealed class AllaganToolsIpc : IDisposable
|
||||
private sealed class InventoryWrapper(IEnumerable<InventoryItem> items)
|
||||
{
|
||||
public long Sum(int itemId) => items.Where(x => x.ItemId == itemId).Sum(x => x.Quantity);
|
||||
|
||||
public int FreeInventorySlots => 140 - items.Count(x => x.Category == 1);
|
||||
}
|
||||
}
|
||||
|
@ -10,4 +10,5 @@ internal struct Currencies
|
||||
public long Ventures { get; init; }
|
||||
public long CeruleumTanks { get; init; }
|
||||
public long RepairKits { get; init; }
|
||||
public int FreeSlots { get; init; }
|
||||
}
|
||||
|
@ -27,5 +27,6 @@ internal sealed class Inventory
|
||||
.SelectMany(x => x.Cast<object?>())
|
||||
.Where(x => x != null)
|
||||
.Select(x => new InventoryItem(x!))
|
||||
.Where(x => x.ItemId != 0)
|
||||
.ToList();
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using FFXIVClientStructs.FFXIV.Client.Game;
|
||||
|
||||
namespace Influx.AllaganTools;
|
||||
|
||||
@ -7,10 +8,14 @@ internal sealed class InventoryItem
|
||||
public InventoryItem(object @delegate)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(@delegate);
|
||||
Category = (int)@delegate.GetType().GetField("SortedCategory")!.GetValue(@delegate)!;
|
||||
Container = (int)@delegate.GetType().GetField("SortedContainer")!.GetValue(@delegate)!;
|
||||
ItemId = (uint)@delegate.GetType().GetField("ItemId")!.GetValue(@delegate)!;
|
||||
Quantity = (uint)@delegate.GetType().GetField("Quantity")!.GetValue(@delegate)!;
|
||||
}
|
||||
|
||||
public int Category { get; }
|
||||
public int Container { get; }
|
||||
public uint ItemId { get; }
|
||||
public uint Quantity { get; }
|
||||
}
|
||||
|
@ -171,7 +171,8 @@ internal sealed class InfluxStatisticsClient : IDisposable
|
||||
.Field("mgp", localStats?.MGP ?? 0)
|
||||
.Field("ventures", currencies.Ventures)
|
||||
.Field("ceruleum_tanks", currencies.CeruleumTanks)
|
||||
.Field("repair_kits", currencies.RepairKits);
|
||||
.Field("repair_kits", currencies.RepairKits)
|
||||
.Field("free_inventory", currencies.FreeSlots);
|
||||
|
||||
if (localStats != null)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user