summaryrefslogtreecommitdiff
path: root/src/StardewModdingAPI/Events/PlayerEvents.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/StardewModdingAPI/Events/PlayerEvents.cs')
-rw-r--r--src/StardewModdingAPI/Events/PlayerEvents.cs46
1 files changed, 36 insertions, 10 deletions
diff --git a/src/StardewModdingAPI/Events/PlayerEvents.cs b/src/StardewModdingAPI/Events/PlayerEvents.cs
index 910f3c96..71b43e71 100644
--- a/src/StardewModdingAPI/Events/PlayerEvents.cs
+++ b/src/StardewModdingAPI/Events/PlayerEvents.cs
@@ -5,31 +5,57 @@ using StardewValley;
namespace StardewModdingAPI.Events
{
+ /// <summary>Events raised when the player data changes.</summary>
public static class PlayerEvents
{
+ /*********
+ ** Events
+ *********/
+ /// <summary>Raised after the player loads a saved game.</summary>
+ public static event EventHandler<EventArgsLoadedGameChanged> LoadedGame = delegate { };
+
+ /// <summary>Raised after the game assigns a new player character. This happens just before <see cref="LoadedGame"/>; it's unclear how this would happen any other time.</summary>
public static event EventHandler<EventArgsFarmerChanged> FarmerChanged = delegate { };
+
+ /// <summary>Raised after the player's inventory changes in any way (added or removed item, sorted, etc).</summary>
public static event EventHandler<EventArgsInventoryChanged> InventoryChanged = delegate { };
+
+ /// <summary> Raised after the player levels up a skill. This happens as soon as they level up, not when the game notifies the player after their character goes to bed.</summary>
public static event EventHandler<EventArgsLevelUp> LeveledUp = delegate { };
- public static event EventHandler<EventArgsLoadedGameChanged> LoadedGame = delegate { };
- internal static void InvokeFarmerChanged(Farmer priorFarmer, Farmer newFarmer)
+
+ /*********
+ ** Internal methods
+ *********/
+ /// <summary>Raise a <see cref="LoadedGame"/> event.</summary>
+ /// <param name="loaded">Whether the save has been loaded. This is always true.</param>
+ internal static void InvokeLoadedGame(EventArgsLoadedGameChanged loaded)
{
- FarmerChanged.Invoke(null, new EventArgsFarmerChanged(priorFarmer, newFarmer));
+ PlayerEvents.LoadedGame.Invoke(null, loaded);
}
- internal static void InvokeInventoryChanged(List<Item> inventory, List<ItemStackChange> changedItems)
+ /// <summary>Raise a <see cref="FarmerChanged"/> event.</summary>
+ /// <param name="priorFarmer">The previous player character.</param>
+ /// <param name="newFarmer">The new player character.</param>
+ internal static void InvokeFarmerChanged(Farmer priorFarmer, Farmer newFarmer)
{
- InventoryChanged.Invoke(null, new EventArgsInventoryChanged(inventory, changedItems));
+ PlayerEvents.FarmerChanged.Invoke(null, new EventArgsFarmerChanged(priorFarmer, newFarmer));
}
- internal static void InvokeLeveledUp(EventArgsLevelUp.LevelType type, int newLevel)
+ /// <summary>Raise an <see cref="InventoryChanged"/> event.</summary>
+ /// <param name="inventory">The player's inventory.</param>
+ /// <param name="changedItems">The inventory changes.</param>
+ internal static void InvokeInventoryChanged(List<Item> inventory, List<ItemStackChange> changedItems)
{
- LeveledUp.Invoke(null, new EventArgsLevelUp(type, newLevel));
+ PlayerEvents.InventoryChanged.Invoke(null, new EventArgsInventoryChanged(inventory, changedItems));
}
- internal static void InvokeLoadedGame(EventArgsLoadedGameChanged loaded)
+ /// <summary>Rase a <see cref="LeveledUp"/> event.</summary>
+ /// <param name="type">The player skill that leveled up.</param>
+ /// <param name="newLevel">The new skill level.</param>
+ internal static void InvokeLeveledUp(EventArgsLevelUp.LevelType type, int newLevel)
{
- LoadedGame.Invoke(null, loaded);
+ PlayerEvents.LeveledUp.Invoke(null, new EventArgsLevelUp(type, newLevel));
}
}
-} \ No newline at end of file
+}