using System;
using System.Collections.Generic;
using System.Linq;
using StardewValley;
namespace StardewModdingAPI.Events
{
/// Event arguments for a event.
public class EventArgsInventoryChanged : EventArgs
{
/*********
** Accessors
*********/
/// The player's inventory.
#if STARDEW_VALLEY_1_3
public IList- Inventory { get; }
#else
public List
- Inventory { get; }
#endif
/// The added items.
public List Added { get; }
/// The removed items.
public List Removed { get; }
/// The items whose stack sizes changed.
public List QuantityChanged { get; }
/*********
** Public methods
*********/
/// Construct an instance.
/// The player's inventory.
/// The inventory changes.
public EventArgsInventoryChanged(
#if STARDEW_VALLEY_1_3
IList
- inventory,
#else
List
- inventory,
#endif
List changedItems)
{
this.Inventory = inventory;
this.Added = changedItems.Where(n => n.ChangeType == ChangeType.Added).ToList();
this.Removed = changedItems.Where(n => n.ChangeType == ChangeType.Removed).ToList();
this.QuantityChanged = changedItems.Where(n => n.ChangeType == ChangeType.StackChange).ToList();
}
}
}