summaryrefslogtreecommitdiff
path: root/src/SMAPI/Events
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <github@jplamondonw.com>2018-10-08 18:57:09 -0400
committerJesse Plamondon-Willard <github@jplamondonw.com>2018-10-08 18:57:09 -0400
commitec6025aad35addab8121a31d1c4abf667fd5210a (patch)
tree5f7ea2836180adc1f26e05110f8f28ab18b61e8e /src/SMAPI/Events
parent79705448f57c962e9331fb802097c24d2424476c (diff)
downloadSMAPI-ec6025aad35addab8121a31d1c4abf667fd5210a.tar.gz
SMAPI-ec6025aad35addab8121a31d1c4abf667fd5210a.tar.bz2
SMAPI-ec6025aad35addab8121a31d1c4abf667fd5210a.zip
add more events (#310)
Diffstat (limited to 'src/SMAPI/Events')
-rw-r--r--src/SMAPI/Events/EventArgsInventoryChanged.cs2
-rw-r--r--src/SMAPI/Events/EventArgsLevelUp.cs13
-rw-r--r--src/SMAPI/Events/IDisplayEvents.cs39
-rw-r--r--src/SMAPI/Events/IGameLoopEvents.cs6
-rw-r--r--src/SMAPI/Events/IModEvents.cs9
-rw-r--r--src/SMAPI/Events/IPlayerEvents.cs17
-rw-r--r--src/SMAPI/Events/ISpecialisedEvents.cs14
-rw-r--r--src/SMAPI/Events/InventoryChangedEventArgs.cs56
-rw-r--r--src/SMAPI/Events/ItemStackSizeChange.cs35
-rw-r--r--src/SMAPI/Events/LevelChangedEventArgs.cs42
-rw-r--r--src/SMAPI/Events/MenuChangedEventArgs.cs31
-rw-r--r--src/SMAPI/Events/RenderedActiveMenuEventArgs.cs16
-rw-r--r--src/SMAPI/Events/RenderedEventArgs.cs16
-rw-r--r--src/SMAPI/Events/RenderedHudEventArgs.cs16
-rw-r--r--src/SMAPI/Events/RenderedWorldEventArgs.cs16
-rw-r--r--src/SMAPI/Events/RenderingActiveMenuEventArgs.cs16
-rw-r--r--src/SMAPI/Events/RenderingEventArgs.cs16
-rw-r--r--src/SMAPI/Events/RenderingHudEventArgs.cs16
-rw-r--r--src/SMAPI/Events/RenderingWorldEventArgs.cs16
-rw-r--r--src/SMAPI/Events/ReturnedToTitleEventArgs.cs7
-rw-r--r--src/SMAPI/Events/SpecialisedEvents.cs2
-rw-r--r--src/SMAPI/Events/TimeChangedEventArgs.cs30
-rw-r--r--src/SMAPI/Events/UnvalidatedUpdateTickedEventArgs.cs36
-rw-r--r--src/SMAPI/Events/UnvalidatedUpdateTickingEventArgs.cs36
-rw-r--r--src/SMAPI/Events/WarpedEventArgs.cs37
-rw-r--r--src/SMAPI/Events/WindowResizedEventArgs.cs31
26 files changed, 563 insertions, 8 deletions
diff --git a/src/SMAPI/Events/EventArgsInventoryChanged.cs b/src/SMAPI/Events/EventArgsInventoryChanged.cs
index 1fdca834..3a2354b6 100644
--- a/src/SMAPI/Events/EventArgsInventoryChanged.cs
+++ b/src/SMAPI/Events/EventArgsInventoryChanged.cs
@@ -30,7 +30,7 @@ namespace StardewModdingAPI.Events
/// <summary>Construct an instance.</summary>
/// <param name="inventory">The player's inventory.</param>
/// <param name="changedItems">The inventory changes.</param>
- public EventArgsInventoryChanged(IList<Item> inventory, List<ItemStackChange> changedItems)
+ public EventArgsInventoryChanged(IList<Item> inventory, ItemStackChange[] changedItems)
{
this.Inventory = inventory;
this.Added = changedItems.Where(n => n.ChangeType == ChangeType.Added).ToList();
diff --git a/src/SMAPI/Events/EventArgsLevelUp.cs b/src/SMAPI/Events/EventArgsLevelUp.cs
index fe6696d4..e9a697e7 100644
--- a/src/SMAPI/Events/EventArgsLevelUp.cs
+++ b/src/SMAPI/Events/EventArgsLevelUp.cs
@@ -1,4 +1,5 @@
using System;
+using StardewModdingAPI.Enums;
namespace StardewModdingAPI.Events
{
@@ -18,22 +19,22 @@ namespace StardewModdingAPI.Events
public enum LevelType
{
/// <summary>The combat skill.</summary>
- Combat,
+ Combat = SkillType.Combat,
/// <summary>The farming skill.</summary>
- Farming,
+ Farming = SkillType.Farming,
/// <summary>The fishing skill.</summary>
- Fishing,
+ Fishing = SkillType.Fishing,
/// <summary>The foraging skill.</summary>
- Foraging,
+ Foraging = SkillType.Foraging,
/// <summary>The mining skill.</summary>
- Mining,
+ Mining = SkillType.Mining,
/// <summary>The luck skill.</summary>
- Luck
+ Luck = SkillType.Luck
}
diff --git a/src/SMAPI/Events/IDisplayEvents.cs b/src/SMAPI/Events/IDisplayEvents.cs
new file mode 100644
index 00000000..dbf8d90f
--- /dev/null
+++ b/src/SMAPI/Events/IDisplayEvents.cs
@@ -0,0 +1,39 @@
+using System;
+using StardewValley;
+
+namespace StardewModdingAPI.Events
+{
+ /// <summary>Events related to UI and drawing to the screen.</summary>
+ public interface IDisplayEvents
+ {
+ /// <summary>Raised after a game menu is opened, closed, or replaced.</summary>
+ event EventHandler<MenuChangedEventArgs> MenuChanged;
+
+ /// <summary>Raised before the game draws anything to the screen in a draw tick, as soon as the sprite batch is opened. The sprite batch may be closed and reopened multiple times after this event is called, but it's only raised once per draw tick. This event isn't useful for drawing to the screen, since the game will draw over it.</summary>
+ event EventHandler<RenderingEventArgs> Rendering;
+
+ /// <summary>Raised after the game draws to the sprite patch in a draw tick, just before the final sprite batch is rendered to the screen. Since the game may open/close the sprite batch multiple times in a draw tick, the sprite batch may not contain everything being drawn and some things may already be rendered to the screen. Content drawn to the sprite batch at this point will be drawn over all vanilla content (including menus, HUD, and cursor).</summary>
+ event EventHandler<RenderedEventArgs> Rendered;
+
+ /// <summary>Raised before the game world is drawn to the screen. This event isn't useful for drawing to the screen, since the game will draw over it.</summary>
+ event EventHandler<RenderingWorldEventArgs> RenderingWorld;
+
+ /// <summary>Raised after the game world is drawn to the sprite patch, before it's rendered to the screen. Content drawn to the sprite batch at this point will be drawn over the world, but under any active menu, HUD elements, or cursor.</summary>
+ event EventHandler<RenderedWorldEventArgs> RenderedWorld;
+
+ /// <summary>When a menu is open (<see cref="Game1.activeClickableMenu"/> isn't null), raised before that menu is drawn to the screen. This includes the game's internal menus like the title screen. Content drawn to the sprite batch at this point will appear under the menu.</summary>
+ event EventHandler<RenderingActiveMenuEventArgs> RenderingActiveMenu;
+
+ /// <summary>When a menu is open (<see cref="Game1.activeClickableMenu"/> isn't null), raised after that menu is drawn to the sprite batch but before it's rendered to the screen. Content drawn to the sprite batch at this point will appear over the menu and menu cursor.</summary>
+ event EventHandler<RenderedActiveMenuEventArgs> RenderedActiveMenu;
+
+ /// <summary>Raised before drawing the HUD (item toolbar, clock, etc) to the screen. The vanilla HUD may be hidden at this point (e.g. because a menu is open). Content drawn to the sprite batch at this point will appear under the HUD.</summary>
+ event EventHandler<RenderingHudEventArgs> RenderingHud;
+
+ /// <summary>Raised after drawing the HUD (item toolbar, clock, etc) to the sprite batch, but before it's rendered to the screen. The vanilla HUD may be hidden at this point (e.g. because a menu is open). Content drawn to the sprite batch at this point will appear over the HUD.</summary>
+ event EventHandler<RenderedHudEventArgs> RenderedHud;
+
+ /// <summary>Raised after the game window is resized.</summary>
+ event EventHandler<WindowResizedEventArgs> WindowResized;
+ }
+}
diff --git a/src/SMAPI/Events/IGameLoopEvents.cs b/src/SMAPI/Events/IGameLoopEvents.cs
index 5f531ba7..e1900f79 100644
--- a/src/SMAPI/Events/IGameLoopEvents.cs
+++ b/src/SMAPI/Events/IGameLoopEvents.cs
@@ -34,5 +34,11 @@ namespace StardewModdingAPI.Events
/// <summary>Raised before the game ends the current day. This happens before it starts setting up the next day and before <see cref="Saving"/>.</summary>
event EventHandler<DayEndingEventArgs> DayEnding;
+
+ /// <summary>Raised after the in-game clock time changes.</summary>
+ event EventHandler<TimeChangedEventArgs> TimeChanged;
+
+ /// <summary>Raised after the game returns to the title screen.</summary>
+ event EventHandler<ReturnedToTitleEventArgs> ReturnedToTitle;
}
}
diff --git a/src/SMAPI/Events/IModEvents.cs b/src/SMAPI/Events/IModEvents.cs
index cf2f8cb8..76da7751 100644
--- a/src/SMAPI/Events/IModEvents.cs
+++ b/src/SMAPI/Events/IModEvents.cs
@@ -3,13 +3,22 @@ namespace StardewModdingAPI.Events
/// <summary>Manages access to events raised by SMAPI.</summary>
public interface IModEvents
{
+ /// <summary>Events related to UI and drawing to the screen.</summary>
+ IDisplayEvents Display { get; }
+
/// <summary>Events linked to the game's update loop. The update loop runs roughly ≈60 times/second to run game logic like state changes, action handling, etc. These can be useful, but you should consider more semantic events like <see cref="Input"/> if possible.</summary>
IGameLoopEvents GameLoop { get; }
/// <summary>Events raised when the player provides input using a controller, keyboard, or mouse.</summary>
IInputEvents Input { get; }
+ /// <summary>Events raised when the player data changes.</summary>
+ IPlayerEvents Player { get; }
+
/// <summary>Events raised when something changes in the world.</summary>
IWorldEvents World { get; }
+
+ /// <summary>Events serving specialised edge cases that shouldn't be used by most mods.</summary>
+ ISpecialisedEvents Specialised { get; }
}
}
diff --git a/src/SMAPI/Events/IPlayerEvents.cs b/src/SMAPI/Events/IPlayerEvents.cs
new file mode 100644
index 00000000..81e17b1a
--- /dev/null
+++ b/src/SMAPI/Events/IPlayerEvents.cs
@@ -0,0 +1,17 @@
+using System;
+
+namespace StardewModdingAPI.Events
+{
+ /// <summary>Events raised when the player data changes.</summary>
+ public interface IPlayerEvents
+ {
+ /// <summary>Raised after items are added or removed to a player's inventory. NOTE: this event is currently only raised for the current player.</summary>
+ event EventHandler<InventoryChangedEventArgs> InventoryChanged;
+
+ /// <summary>Raised after a player skill level changes. This happens as soon as they level up, not when the game notifies the player after their character goes to bed. NOTE: this event is currently only raised for the current player.</summary>
+ event EventHandler<LevelChangedEventArgs> LevelChanged;
+
+ /// <summary>Raised after a player warps to a new location. NOTE: this event is currently only raised for the current player.</summary>
+ event EventHandler<WarpedEventArgs> Warped;
+ }
+}
diff --git a/src/SMAPI/Events/ISpecialisedEvents.cs b/src/SMAPI/Events/ISpecialisedEvents.cs
new file mode 100644
index 00000000..928cd05d
--- /dev/null
+++ b/src/SMAPI/Events/ISpecialisedEvents.cs
@@ -0,0 +1,14 @@
+using System;
+
+namespace StardewModdingAPI.Events
+{
+ /// <summary>Events serving specialised edge cases that shouldn't be used by most mods.</summary>
+ public interface ISpecialisedEvents
+ {
+ /// <summary>Raised before the game state is updated (≈60 times per second), regardless of normal SMAPI validation. This event is not thread-safe and may be invoked while game logic is running asynchronously. Changes to game state in this method may crash the game or corrupt an in-progress save. Do not use this event unless you're fully aware of the context in which your code will be run. Mods using this event will trigger a stability warning in the SMAPI console.</summary>
+ event EventHandler<UnvalidatedUpdateTickingEventArgs> UnvalidatedUpdateTicking;
+
+ /// <summary>Raised after the game state is updated (≈60 times per second), regardless of normal SMAPI validation. This event is not thread-safe and may be invoked while game logic is running asynchronously. Changes to game state in this method may crash the game or corrupt an in-progress save. Do not use this event unless you're fully aware of the context in which your code will be run. Mods using this event will trigger a stability warning in the SMAPI console.</summary>
+ event EventHandler<UnvalidatedUpdateTickedEventArgs> UnvalidatedUpdateTicked;
+ }
+}
diff --git a/src/SMAPI/Events/InventoryChangedEventArgs.cs b/src/SMAPI/Events/InventoryChangedEventArgs.cs
new file mode 100644
index 00000000..a081611b
--- /dev/null
+++ b/src/SMAPI/Events/InventoryChangedEventArgs.cs
@@ -0,0 +1,56 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using StardewValley;
+
+namespace StardewModdingAPI.Events
+{
+ /// <summary>Event arguments for an <see cref="IPlayerEvents.InventoryChanged"/> event.</summary>
+ public class InventoryChangedEventArgs : EventArgs
+ {
+ /*********
+ ** Accessors
+ *********/
+ /// <summary>The player whose inventory changed.</summary>
+ public Farmer Player { get; }
+
+ /// <summary>The added items.</summary>
+ public IEnumerable<Item> Added { get; }
+
+ /// <summary>The removed items.</summary>
+ public IEnumerable<Item> Removed { get; }
+
+ /// <summary>The items whose stack sizes changed, with the relative change.</summary>
+ public IEnumerable<ItemStackSizeChange> QuantityChanged { get; }
+
+
+ /*********
+ ** Public methods
+ *********/
+ /// <summary>Construct an instance.</summary>
+ /// <param name="player">The player whose inventory changed.</param>
+ /// <param name="changedItems">The inventory changes.</param>
+ public InventoryChangedEventArgs(Farmer player, ItemStackChange[] changedItems)
+ {
+ 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();
+ }
+ }
+}
diff --git a/src/SMAPI/Events/ItemStackSizeChange.cs b/src/SMAPI/Events/ItemStackSizeChange.cs
new file mode 100644
index 00000000..35369be2
--- /dev/null
+++ b/src/SMAPI/Events/ItemStackSizeChange.cs
@@ -0,0 +1,35 @@
+using StardewValley;
+
+namespace StardewModdingAPI.Events
+{
+ /// <summary>An inventory item stack size change.</summary>
+ public class ItemStackSizeChange
+ {
+ /*********
+ ** Accessors
+ *********/
+ /// <summary>The item whose stack size changed.</summary>
+ public Item Item { get; }
+
+ /// <summary>The previous stack size.</summary>
+ public int OldSize { get; }
+
+ /// <summary>The new stack size.</summary>
+ public int NewSize { get; }
+
+
+ /*********
+ ** Public methods
+ *********/
+ /// <summary>Construct an instance.</summary>
+ /// <param name="item">The item whose stack size changed.</param>
+ /// <param name="oldSize">The previous stack size.</param>
+ /// <param name="newSize">The new stack size.</param>
+ public ItemStackSizeChange(Item item, int oldSize, int newSize)
+ {
+ this.Item = item;
+ this.OldSize = oldSize;
+ this.NewSize = newSize;
+ }
+ }
+}
diff --git a/src/SMAPI/Events/LevelChangedEventArgs.cs b/src/SMAPI/Events/LevelChangedEventArgs.cs
new file mode 100644
index 00000000..174094c7
--- /dev/null
+++ b/src/SMAPI/Events/LevelChangedEventArgs.cs
@@ -0,0 +1,42 @@
+using System;
+using StardewModdingAPI.Enums;
+using StardewValley;
+
+namespace StardewModdingAPI.Events
+{
+ /// <summary>Event arguments for a <see cref="IPlayerEvents.LevelChanged"/> event.</summary>
+ public class LevelChangedEventArgs : EventArgs
+ {
+ /*********
+ ** Accessors
+ *********/
+ /// <summary>The player whose skill level changed.</summary>
+ public Farmer Player { get; }
+
+ /// <summary>The skill whose level changed.</summary>
+ public SkillType Skill { get; }
+
+ /// <summary>The previous skill level.</summary>
+ public int OldLevel { get; }
+
+ /// <summary>The new skill level.</summary>
+ public int NewLevel { get; }
+
+
+ /*********
+ ** Public methods
+ *********/
+ /// <summary>Construct an instance.</summary>
+ /// <param name="player">The player whose skill level changed.</param>
+ /// <param name="skill">The skill whose level changed.</param>
+ /// <param name="oldLevel">The previous skill level.</param>
+ /// <param name="newLevel">The new skill level.</param>
+ public LevelChangedEventArgs(Farmer player, SkillType skill, int oldLevel, int newLevel)
+ {
+ this.Player = player;
+ this.Skill = skill;
+ this.OldLevel = oldLevel;
+ this.NewLevel = newLevel;
+ }
+ }
+}
diff --git a/src/SMAPI/Events/MenuChangedEventArgs.cs b/src/SMAPI/Events/MenuChangedEventArgs.cs
new file mode 100644
index 00000000..e1c049a2
--- /dev/null
+++ b/src/SMAPI/Events/MenuChangedEventArgs.cs
@@ -0,0 +1,31 @@
+using System;
+using StardewValley.Menus;
+
+namespace StardewModdingAPI.Events
+{
+ /// <summary>Event arguments for an <see cref="IDisplayEvents.MenuChanged"/> event.</summary>
+ public class MenuChangedEventArgs : EventArgs
+ {
+ /*********
+ ** Accessors
+ *********/
+ /// <summary>The previous menu.</summary>
+ public IClickableMenu OldMenu { get; }
+
+ /// <summary>The current menu.</summary>
+ public IClickableMenu NewMenu { get; }
+
+
+ /*********
+ ** Public methods
+ *********/
+ /// <summary>Construct an instance.</summary>
+ /// <param name="oldMenu">The previous menu.</param>
+ /// <param name="newMenu">The current menu.</param>
+ public MenuChangedEventArgs(IClickableMenu oldMenu, IClickableMenu newMenu)
+ {
+ this.OldMenu = oldMenu;
+ this.NewMenu = newMenu;
+ }
+ }
+}
diff --git a/src/SMAPI/Events/RenderedActiveMenuEventArgs.cs b/src/SMAPI/Events/RenderedActiveMenuEventArgs.cs
new file mode 100644
index 00000000..efd4163b
--- /dev/null
+++ b/src/SMAPI/Events/RenderedActiveMenuEventArgs.cs
@@ -0,0 +1,16 @@
+using System;
+using Microsoft.Xna.Framework.Graphics;
+using StardewValley;
+
+namespace StardewModdingAPI.Events
+{
+ /// <summary>Event arguments for an <see cref="IDisplayEvents.RenderedActiveMenu"/> event.</summary>
+ public class RenderedActiveMenuEventArgs : EventArgs
+ {
+ /*********
+ ** Accessors
+ *********/
+ /// <summary>The sprite batch being drawn. Add anything you want to appear on-screen to this sprite batch.</summary>
+ public SpriteBatch SpriteBatch => Game1.spriteBatch;
+ }
+}
diff --git a/src/SMAPI/Events/RenderedEventArgs.cs b/src/SMAPI/Events/RenderedEventArgs.cs
new file mode 100644
index 00000000..d6341b19
--- /dev/null
+++ b/src/SMAPI/Events/RenderedEventArgs.cs
@@ -0,0 +1,16 @@
+using System;
+using Microsoft.Xna.Framework.Graphics;
+using StardewValley;
+
+namespace StardewModdingAPI.Events
+{
+ /// <summary>Event arguments for an <see cref="IDisplayEvents.Rendered"/> event.</summary>
+ public class RenderedEventArgs : EventArgs
+ {
+ /*********
+ ** Accessors
+ *********/
+ /// <summary>The sprite batch being drawn. Add anything you want to appear on-screen to this sprite batch.</summary>
+ public SpriteBatch SpriteBatch => Game1.spriteBatch;
+ }
+}
diff --git a/src/SMAPI/Events/RenderedHudEventArgs.cs b/src/SMAPI/Events/RenderedHudEventArgs.cs
new file mode 100644
index 00000000..46e89013
--- /dev/null
+++ b/src/SMAPI/Events/RenderedHudEventArgs.cs
@@ -0,0 +1,16 @@
+using System;
+using Microsoft.Xna.Framework.Graphics;
+using StardewValley;
+
+namespace StardewModdingAPI.Events
+{
+ /// <summary>Event arguments for an <see cref="IDisplayEvents.RenderedHud"/> event.</summary>
+ public class RenderedHudEventArgs : EventArgs
+ {
+ /*********
+ ** Accessors
+ *********/
+ /// <summary>The sprite batch being drawn. Add anything you want to appear on-screen to this sprite batch.</summary>
+ public SpriteBatch SpriteBatch => Game1.spriteBatch;
+ }
+}
diff --git a/src/SMAPI/Events/RenderedWorldEventArgs.cs b/src/SMAPI/Events/RenderedWorldEventArgs.cs
new file mode 100644
index 00000000..56145381
--- /dev/null
+++ b/src/SMAPI/Events/RenderedWorldEventArgs.cs
@@ -0,0 +1,16 @@
+using System;
+using Microsoft.Xna.Framework.Graphics;
+using StardewValley;
+
+namespace StardewModdingAPI.Events
+{
+ /// <summary>Event arguments for an <see cref="IDisplayEvents.RenderedWorld"/> event.</summary>
+ public class RenderedWorldEventArgs : EventArgs
+ {
+ /*********
+ ** Accessors
+ *********/
+ /// <summary>The sprite batch being drawn. Add anything you want to appear on-screen to this sprite batch.</summary>
+ public SpriteBatch SpriteBatch => Game1.spriteBatch;
+ }
+}
diff --git a/src/SMAPI/Events/RenderingActiveMenuEventArgs.cs b/src/SMAPI/Events/RenderingActiveMenuEventArgs.cs
new file mode 100644
index 00000000..103f56df
--- /dev/null
+++ b/src/SMAPI/Events/RenderingActiveMenuEventArgs.cs
@@ -0,0 +1,16 @@
+using System;
+using Microsoft.Xna.Framework.Graphics;
+using StardewValley;
+
+namespace StardewModdingAPI.Events
+{
+ /// <summary>Event arguments for an <see cref="IDisplayEvents.RenderingActiveMenu"/> event.</summary>
+ public class RenderingActiveMenuEventArgs : EventArgs
+ {
+ /*********
+ ** Accessors
+ *********/
+ /// <summary>The sprite batch being drawn. Add anything you want to appear on-screen to this sprite batch.</summary>
+ public SpriteBatch SpriteBatch => Game1.spriteBatch;
+ }
+}
diff --git a/src/SMAPI/Events/RenderingEventArgs.cs b/src/SMAPI/Events/RenderingEventArgs.cs
new file mode 100644
index 00000000..5acbef09
--- /dev/null
+++ b/src/SMAPI/Events/RenderingEventArgs.cs
@@ -0,0 +1,16 @@
+using System;
+using Microsoft.Xna.Framework.Graphics;
+using StardewValley;
+
+namespace StardewModdingAPI.Events
+{
+ /// <summary>Event arguments for an <see cref="IDisplayEvents.Rendering"/> event.</summary>
+ public class RenderingEventArgs : EventArgs
+ {
+ /*********
+ ** Accessors
+ *********/
+ /// <summary>The sprite batch being drawn. Add anything you want to appear on-screen to this sprite batch.</summary>
+ public SpriteBatch SpriteBatch => Game1.spriteBatch;
+ }
+}
diff --git a/src/SMAPI/Events/RenderingHudEventArgs.cs b/src/SMAPI/Events/RenderingHudEventArgs.cs
new file mode 100644
index 00000000..84c96ecd
--- /dev/null
+++ b/src/SMAPI/Events/RenderingHudEventArgs.cs
@@ -0,0 +1,16 @@
+using System;
+using Microsoft.Xna.Framework.Graphics;
+using StardewValley;
+
+namespace StardewModdingAPI.Events
+{
+ /// <summary>Event arguments for an <see cref="IDisplayEvents.RenderingHud"/> event.</summary>
+ public class RenderingHudEventArgs : EventArgs
+ {
+ /*********
+ ** Accessors
+ *********/
+ /// <summary>The sprite batch being drawn. Add anything you want to appear on-screen to this sprite batch.</summary>
+ public SpriteBatch SpriteBatch => Game1.spriteBatch;
+ }
+}
diff --git a/src/SMAPI/Events/RenderingWorldEventArgs.cs b/src/SMAPI/Events/RenderingWorldEventArgs.cs
new file mode 100644
index 00000000..d0d44789
--- /dev/null
+++ b/src/SMAPI/Events/RenderingWorldEventArgs.cs
@@ -0,0 +1,16 @@
+using System;
+using Microsoft.Xna.Framework.Graphics;
+using StardewValley;
+
+namespace StardewModdingAPI.Events
+{
+ /// <summary>Event arguments for an <see cref="IDisplayEvents.RenderingWorld"/> event.</summary>
+ public class RenderingWorldEventArgs : EventArgs
+ {
+ /*********
+ ** Accessors
+ *********/
+ /// <summary>The sprite batch being drawn. Add anything you want to appear on-screen to this sprite batch.</summary>
+ public SpriteBatch SpriteBatch => Game1.spriteBatch;
+ }
+}
diff --git a/src/SMAPI/Events/ReturnedToTitleEventArgs.cs b/src/SMAPI/Events/ReturnedToTitleEventArgs.cs
new file mode 100644
index 00000000..96309cde
--- /dev/null
+++ b/src/SMAPI/Events/ReturnedToTitleEventArgs.cs
@@ -0,0 +1,7 @@
+using System;
+
+namespace StardewModdingAPI.Events
+{
+ /// <summary>Event arguments for an <see cref="IGameLoopEvents.ReturnedToTitle"/> event.</summary>
+ public class ReturnedToTitleEventArgs : EventArgs { }
+}
diff --git a/src/SMAPI/Events/SpecialisedEvents.cs b/src/SMAPI/Events/SpecialisedEvents.cs
index af84b397..bdf25ccb 100644
--- a/src/SMAPI/Events/SpecialisedEvents.cs
+++ b/src/SMAPI/Events/SpecialisedEvents.cs
@@ -3,7 +3,7 @@ using StardewModdingAPI.Framework.Events;
namespace StardewModdingAPI.Events
{
- /// <summary>Events serving specialised edge cases that shouldn't be used by most mod.</summary>
+ /// <summary>Events serving specialised edge cases that shouldn't be used by most mods.</summary>
public static class SpecialisedEvents
{
/*********
diff --git a/src/SMAPI/Events/TimeChangedEventArgs.cs b/src/SMAPI/Events/TimeChangedEventArgs.cs
new file mode 100644
index 00000000..fd472092
--- /dev/null
+++ b/src/SMAPI/Events/TimeChangedEventArgs.cs
@@ -0,0 +1,30 @@
+using System;
+
+namespace StardewModdingAPI.Events
+{
+ /// <summary>Event arguments for an <see cref="IGameLoopEvents.TimeChanged"/> event.</summary>
+ public class TimeChangedEventArgs : EventArgs
+ {
+ /*********
+ ** Accessors
+ *********/
+ /// <summary>The previous time of day in 24-hour notation (like 1600 for 4pm). The clock time resets when the player sleeps, so 2am (before sleeping) is 2600.</summary>
+ public int OldTime { get; }
+
+ /// <summary>The current time of day in 24-hour notation (like 1600 for 4pm). The clock time resets when the player sleeps, so 2am (before sleeping) is 2600.</summary>
+ public int NewTime { get; }
+
+
+ /*********
+ ** Public methods
+ *********/
+ /// <summary>Construct an instance.</summary>
+ /// <param name="oldTime">The previous time of day in 24-hour notation (like 1600 for 4pm).</param>
+ /// <param name="newTime">The current time of day in 24-hour notation (like 1600 for 4pm).</param>
+ public TimeChangedEventArgs(int oldTime, int newTime)
+ {
+ this.OldTime = oldTime;
+ this.NewTime = newTime;
+ }
+ }
+}
diff --git a/src/SMAPI/Events/UnvalidatedUpdateTickedEventArgs.cs b/src/SMAPI/Events/UnvalidatedUpdateTickedEventArgs.cs
new file mode 100644
index 00000000..5638bdb7
--- /dev/null
+++ b/src/SMAPI/Events/UnvalidatedUpdateTickedEventArgs.cs
@@ -0,0 +1,36 @@
+using System;
+
+namespace StardewModdingAPI.Events
+{
+ /// <summary>Event arguments for an <see cref="ISpecialisedEvents.UnvalidatedUpdateTicked"/> event.</summary>
+ public class UnvalidatedUpdateTickedEventArgs : EventArgs
+ {
+ /*********
+ ** Accessors
+ *********/
+ /// <summary>The number of ticks elapsed since the game started, including the current tick.</summary>
+ public uint Ticks { get; }
+
+ /// <summary>Whether <see cref="Ticks"/> is a multiple of 60, which happens approximately once per second.</summary>
+ public bool IsOneSecond { get; }
+
+
+ /*********
+ ** Public methods
+ *********/
+ /// <summary>Construct an instance.</summary>
+ /// <param name="ticks">The number of ticks elapsed since the game started, including the current tick.</param>
+ public UnvalidatedUpdateTickedEventArgs(uint ticks)
+ {
+ this.Ticks = ticks;
+ this.IsOneSecond = this.IsMultipleOf(60);
+ }
+
+ /// <summary>Get whether <see cref="Ticks"/> is a multiple of the given <paramref name="number"/>. This is mainly useful if you want to run logic intermittently (e.g. <code>e.IsMultipleOf(30)</code> for every half-second).</summary>
+ /// <param name="number">The factor to check.</param>
+ public bool IsMultipleOf(uint number)
+ {
+ return this.Ticks % number == 0;
+ }
+ }
+}
diff --git a/src/SMAPI/Events/UnvalidatedUpdateTickingEventArgs.cs b/src/SMAPI/Events/UnvalidatedUpdateTickingEventArgs.cs
new file mode 100644
index 00000000..ebadbb99
--- /dev/null
+++ b/src/SMAPI/Events/UnvalidatedUpdateTickingEventArgs.cs
@@ -0,0 +1,36 @@
+using System;
+
+namespace StardewModdingAPI.Events
+{
+ /// <summary>Event arguments for an <see cref="ISpecialisedEvents.UnvalidatedUpdateTicking"/> event.</summary>
+ public class UnvalidatedUpdateTickingEventArgs : EventArgs
+ {
+ /*********
+ ** Accessors
+ *********/
+ /// <summary>The number of ticks elapsed since the game started, including the current tick.</summary>
+ public uint Ticks { get; }
+
+ /// <summary>Whether <see cref="Ticks"/> is a multiple of 60, which happens approximately once per second.</summary>
+ public bool IsOneSecond { get; }
+
+
+ /*********
+ ** Public methods
+ *********/
+ /// <summary>Construct an instance.</summary>
+ /// <param name="ticks">The number of ticks elapsed since the game started, including the current tick.</param>
+ public UnvalidatedUpdateTickingEventArgs(uint ticks)
+ {
+ this.Ticks = ticks;
+ this.IsOneSecond = this.IsMultipleOf(60);
+ }
+
+ /// <summary>Get whether <see cref="Ticks"/> is a multiple of the given <paramref name="number"/>. This is mainly useful if you want to run logic intermittently (e.g. <code>e.IsMultipleOf(30)</code> for every half-second).</summary>
+ /// <param name="number">The factor to check.</param>
+ public bool IsMultipleOf(uint number)
+ {
+ return this.Ticks % number == 0;
+ }
+ }
+}
diff --git a/src/SMAPI/Events/WarpedEventArgs.cs b/src/SMAPI/Events/WarpedEventArgs.cs
new file mode 100644
index 00000000..1b1c7381
--- /dev/null
+++ b/src/SMAPI/Events/WarpedEventArgs.cs
@@ -0,0 +1,37 @@
+using System;
+using StardewValley;
+
+namespace StardewModdingAPI.Events
+{
+ /// <summary>Event arguments for an <see cref="IPlayerEvents.Warped"/> event.</summary>
+ public class WarpedEventArgs : EventArgs
+ {
+ /*********
+ ** Accessors
+ *********/
+ /// <summary>The player who warped to a new location.</summary>
+ public Farmer Player { get; }
+
+ /// <summary>The player's previous location.</summary>
+ public GameLocation OldLocation { get; }
+
+ /// <summary>The player's current location.</summary>
+ public GameLocation NewLocation { get; }
+
+
+
+ /*********
+ ** Public methods
+ *********/
+ /// <summary>Construct an instance.</summary>
+ /// <param name="player">The player who warped to a new location.</param>
+ /// <param name="oldLocation">The player's previous location.</param>
+ /// <param name="newLocation">The player's current location.</param>
+ public WarpedEventArgs(Farmer player, GameLocation oldLocation, GameLocation newLocation)
+ {
+ this.Player = player;
+ this.NewLocation = newLocation;
+ this.OldLocation = oldLocation;
+ }
+ }
+}
diff --git a/src/SMAPI/Events/WindowResizedEventArgs.cs b/src/SMAPI/Events/WindowResizedEventArgs.cs
new file mode 100644
index 00000000..a990ba9d
--- /dev/null
+++ b/src/SMAPI/Events/WindowResizedEventArgs.cs
@@ -0,0 +1,31 @@
+using System;
+using Microsoft.Xna.Framework;
+
+namespace StardewModdingAPI.Events
+{
+ /// <summary>Event arguments for an <see cref="IDisplayEvents.WindowResized"/> event.</summary>
+ public class WindowResizedEventArgs : EventArgs
+ {
+ /*********
+ ** Accessors
+ *********/
+ /// <summary>The previous window size.</summary>
+ public Point OldSize { get; }
+
+ /// <summary>The current window size.</summary>
+ public Point NewSize { get; }
+
+
+ /*********
+ ** Public methods
+ *********/
+ /// <summary>Construct an instance.</summary>
+ /// <param name="oldSize">The previous window size.</param>
+ /// <param name="newSize">The current window size.</param>
+ public WindowResizedEventArgs(Point oldSize, Point newSize)
+ {
+ this.OldSize = oldSize;
+ this.NewSize = newSize;
+ }
+ }
+}