wip; needs testing and more thinking

This commit is contained in:
Soreepeong 2023-12-01 18:10:09 +09:00
parent 7c6f98dc9f
commit 34e3adb3f2
10 changed files with 286 additions and 232 deletions

View file

@ -1,4 +1,7 @@
using Dalamud.Game.GameInventory;
using System.Collections.Generic;
using Dalamud.Game.Inventory;
using Dalamud.Game.Inventory.InventoryChangeArgsTypes;
namespace Dalamud.Plugin.Services;
@ -12,7 +15,7 @@ public interface IGameInventory
/// This delegate sends the entire set of changes recorded.
/// </summary>
/// <param name="events">The events.</param>
public delegate void InventoryChangelogDelegate(ReadOnlySpan<InventoryEventArgs> events);
public delegate void InventoryChangelogDelegate(IReadOnlyCollection<InventoryEventArgs> events);
/// <summary>
/// Delegate function to be called for each change to inventories.
@ -26,24 +29,37 @@ public interface IGameInventory
/// Event that is fired when the inventory has been changed.
/// </summary>
public event InventoryChangelogDelegate InventoryChanged;
/// <summary>
/// Event that is fired when the inventory has been changed, without trying to interpret two inventory slot changes
/// as a move event as appropriate.<br />
/// In other words, <see cref="GameInventoryEvent.Moved"/> does not fire in this event.
/// </summary>
public event InventoryChangelogDelegate InventoryChangedRaw;
/// <summary>
/// Event that is fired when an item is added to an inventory.
/// Event that is fired when an item is added to an inventory.<br />
/// If an accompanying item remove event happens, then <see cref="ItemMoved"/> will be called instead.<br />
/// Use <see cref="InventoryChangedRaw"/> if you do not want such reinterpretation.
/// </summary>
public event InventoryChangedDelegate ItemAdded;
/// <summary>
/// Event that is fired when an item is removed from an inventory.
/// Event that is fired when an item is removed from an inventory.<br />
/// If an accompanying item add event happens, then <see cref="ItemMoved"/> will be called instead.<br />
/// Use <see cref="InventoryChangedRaw"/> if you do not want such reinterpretation.
/// </summary>
public event InventoryChangedDelegate ItemRemoved;
/// <summary>
/// Event that is fired when an items properties are changed.<br />
/// If an accompanying item change event happens, then <see cref="ItemMoved"/> will be called instead.<br />
/// Use <see cref="InventoryChangedRaw"/> if you do not want such reinterpretation.
/// </summary>
public event InventoryChangedDelegate ItemChanged;
/// <summary>
/// Event that is fired when an item is moved from one inventory into another.
/// </summary>
public event InventoryChangedDelegate ItemMoved;
/// <summary>
/// Event that is fired when an items properties are changed.
/// </summary>
public event InventoryChangedDelegate ItemChanged;
}