From 0411dcf3db277ed0d3c9f0201b7554a7d61ed1e8 Mon Sep 17 00:00:00 2001 From: wartech0 Date: Tue, 31 Dec 2019 04:20:36 -0600 Subject: Finished chest events --- src/SMAPI/Events/ChestInventoryChangedEventArgs.cs | 20 ++++++-------------- src/SMAPI/Events/ItemStackChange.cs | 7 ++++++- 2 files changed, 12 insertions(+), 15 deletions(-) (limited to 'src/SMAPI/Events') diff --git a/src/SMAPI/Events/ChestInventoryChangedEventArgs.cs b/src/SMAPI/Events/ChestInventoryChangedEventArgs.cs index 0b54e909..a0c63fdc 100644 --- a/src/SMAPI/Events/ChestInventoryChangedEventArgs.cs +++ b/src/SMAPI/Events/ChestInventoryChangedEventArgs.cs @@ -16,17 +16,10 @@ namespace StardewModdingAPI.Events public GameLocation Location { get; } /// The tile position of the chest. - public Vector2 Tile { get; } - - /// The objects added to the location. - public IEnumerable Added { get; } - - /// The objects removed from the location. - public IEnumerable Removed { get; } - - /// Whether this is the location containing the local player. - public bool IsCurrentLocation => object.ReferenceEquals(this.Location, Game1.player?.currentLocation); + public StardewValley.Objects.Chest Chest { get; } + /// The inventory changes added to the chest. + public ItemStackChange[] Changes { get; } /********* ** Public methods @@ -36,12 +29,11 @@ namespace StardewModdingAPI.Events /// The tile position of the chest. /// The objects added to the location. /// The objects removed from the location. - internal ChestInventoryChangedEventArgs(GameLocation location, Vector2 tile, IEnumerable added, IEnumerable removed) + internal ChestInventoryChangedEventArgs(GameLocation location, StardewValley.Objects.Chest chest, ItemStackChange[] changes) { this.Location = location; - this.Tile = tile; - this.Added = added.ToArray(); - this.Removed = removed.ToArray(); + this.Chest = chest; + this.Changes = changes; } } } diff --git a/src/SMAPI/Events/ItemStackChange.cs b/src/SMAPI/Events/ItemStackChange.cs index f9ae6df6..dbb529d6 100644 --- a/src/SMAPI/Events/ItemStackChange.cs +++ b/src/SMAPI/Events/ItemStackChange.cs @@ -16,5 +16,10 @@ namespace StardewModdingAPI.Events /// How the inventory slot changed. public ChangeType ChangeType { get; set; } + + public override string ToString() + { + return this.StackChange + " " + this.Item.Name + " " + this.ChangeType.ToString(); + } } -} \ No newline at end of file +} -- cgit