diff options
author | Jesse Plamondon-Willard <Pathoschild@users.noreply.github.com> | 2020-01-01 18:57:05 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-01-01 18:57:05 -0500 |
commit | 00932a335c86be1303ff6443b38d1db629b444fc (patch) | |
tree | 8376207a89b08b4e72c1bcbd46ecd3946e516e5c /src/SMAPI/Events/InventoryChangedEventArgs.cs | |
parent | dca60f42b2048d6b0b27517b9e7686665e61e9c2 (diff) | |
parent | b6aef499d3c9b82d33c75039e0ed58c22618c426 (diff) | |
download | SMAPI-00932a335c86be1303ff6443b38d1db629b444fc.tar.gz SMAPI-00932a335c86be1303ff6443b38d1db629b444fc.tar.bz2 SMAPI-00932a335c86be1303ff6443b38d1db629b444fc.zip |
Merge pull request #686 from wartech0/chest-tracking
Add chest items changed event
Diffstat (limited to 'src/SMAPI/Events/InventoryChangedEventArgs.cs')
-rw-r--r-- | src/SMAPI/Events/InventoryChangedEventArgs.cs | 34 |
1 files changed, 10 insertions, 24 deletions
diff --git a/src/SMAPI/Events/InventoryChangedEventArgs.cs b/src/SMAPI/Events/InventoryChangedEventArgs.cs index 874c2e48..40cd4128 100644 --- a/src/SMAPI/Events/InventoryChangedEventArgs.cs +++ b/src/SMAPI/Events/InventoryChangedEventArgs.cs @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; -using System.Linq; using StardewValley; namespace StardewModdingAPI.Events @@ -14,13 +13,13 @@ namespace StardewModdingAPI.Events /// <summary>The player whose inventory changed.</summary> public Farmer Player { get; } - /// <summary>The added items.</summary> + /// <summary>The added item stacks.</summary> public IEnumerable<Item> Added { get; } - /// <summary>The removed items.</summary> + /// <summary>The removed item stacks.</summary> public IEnumerable<Item> Removed { get; } - /// <summary>The items whose stack sizes changed, with the relative change.</summary> + /// <summary>The item stacks whose size changed.</summary> public IEnumerable<ItemStackSizeChange> QuantityChanged { get; } /// <summary>Whether the affected player is the local one.</summary> @@ -32,28 +31,15 @@ namespace StardewModdingAPI.Events *********/ /// <summary>Construct an instance.</summary> /// <param name="player">The player whose inventory changed.</param> - /// <param name="changedItems">The inventory changes.</param> - internal InventoryChangedEventArgs(Farmer player, ItemStackChange[] changedItems) + /// <param name="added">The added item stacks.</param> + /// <param name="removed">The removed item stacks.</param> + /// <param name="quantityChanged">The item stacks whose size changed.</param> + internal InventoryChangedEventArgs(Farmer player, Item[] added, Item[] removed, ItemStackSizeChange[] quantityChanged) { this.Player = player; - this.Added = changedItems - .Where(n => n.ChangeType == ChangeType.Added) - .Select(p => p.Item) - .ToArray(); - - this.Removed = changedItems - .Where(n => n.ChangeType == ChangeType.Removed) - .Select(p => p.Item) - .ToArray(); - - this.QuantityChanged = changedItems - .Where(n => n.ChangeType == ChangeType.StackChange) - .Select(change => new ItemStackSizeChange( - item: change.Item, - oldSize: change.Item.Stack - change.StackChange, - newSize: change.Item.Stack - )) - .ToArray(); + this.Added = added; + this.Removed = removed; + this.QuantityChanged = quantityChanged; } } } |