From d5a12ac9a4c4065d3e10e5ec42dd24ee01d9871a Mon Sep 17 00:00:00 2001 From: Liza Carvelli Date: Tue, 31 Oct 2023 18:27:13 +0100 Subject: [PATCH] Use client structs to read remaining delivery item fields --- Deliveroo/Deliveroo.csproj | 2 +- Deliveroo/DeliverooPlugin.GameFunctions.cs | 17 ++--------------- Deliveroo/GameData/TurnInItem.cs | 7 ++----- 3 files changed, 5 insertions(+), 21 deletions(-) diff --git a/Deliveroo/Deliveroo.csproj b/Deliveroo/Deliveroo.csproj index b8bf2b5..6a6acaf 100644 --- a/Deliveroo/Deliveroo.csproj +++ b/Deliveroo/Deliveroo.csproj @@ -1,7 +1,7 @@ net7.0-windows - 2.14 + 2.15 11.0 enable true diff --git a/Deliveroo/DeliverooPlugin.GameFunctions.cs b/Deliveroo/DeliverooPlugin.GameFunctions.cs index b1a1487..966f645 100644 --- a/Deliveroo/DeliverooPlugin.GameFunctions.cs +++ b/Deliveroo/DeliverooPlugin.GameFunctions.cs @@ -132,25 +132,12 @@ partial class DeliverooPlugin // this includes all items, even if they don't match the filter list.Add(new TurnInItem { - ItemId = Marshal.ReadInt32(new nint(&item) + 132), + ItemId = item.ItemId, Name = MemoryHelper.ReadSeString(&item.ItemName).ToString(), SealsWithBonus = (int)Math.Round(item.SealReward * GetSealMultiplier(), MidpointRounding.AwayFromZero), SealsWithoutBonus = item.SealReward, - ItemUiCategory = Marshal.ReadByte(new nint(&item) + 150), + ItemUiCategory = item.ItemUiCategory, }); - - // GrandCompanyItem + 104 = [int] InventoryType - // GrandCompanyItem + 108 = [int] ?? - // GrandCompanyItem + 124 = [int] - // GrandCompanyItem + 132 = [int] itemId - // GrandCompanyItem + 136 = [int] 0 (always)? - // GrandCompanyItem + 140 = [int] i (item's own position within the unsorted list) - // GrandCompanyItem + 148 = [short] ilvl - // GrandCompanyItem + 150 = [byte] ItemUICategory - // GrandCompanyItem + 151 = [byte] (unchecked) inventory slot in container - // GrandCompanyItem + 152 = [short] 512 (always)? - // int itemId = Marshal.ReadInt32(new nint(&item) + 132); - // PluginLog.Verbose($" {Marshal.ReadInt32(new nint(&item) + 132)};;;; {MemoryHelper.ReadSeString(&item.ItemName)}, {new nint(&agent->ItemArray[i]):X8}, {item.SealReward}, {item.IsTurnInAvailable}"); } return list.OrderByDescending(x => x.SealsWithBonus) diff --git a/Deliveroo/GameData/TurnInItem.cs b/Deliveroo/GameData/TurnInItem.cs index 28758a7..f453492 100644 --- a/Deliveroo/GameData/TurnInItem.cs +++ b/Deliveroo/GameData/TurnInItem.cs @@ -1,11 +1,8 @@ -using System.Runtime.InteropServices; -using FFXIVClientStructs.FFXIV.Client.System.String; - -namespace Deliveroo.GameData; +namespace Deliveroo.GameData; internal sealed class TurnInItem { - public required int ItemId { get; init; } + public required uint ItemId { get; init; } public required string Name { get; init; } public required int SealsWithBonus { get; init; } public required int SealsWithoutBonus { get; init; }