From b8a9f8fc88706896c3191b80d17375a483183226 Mon Sep 17 00:00:00 2001 From: ClxS Date: Fri, 4 Mar 2016 20:40:46 +0000 Subject: Added event handlers for each of the level up events --- StardewModdingAPI/Events/EventArgs.cs | 20 ++++++++++++++++++++ StardewModdingAPI/Events/Player.cs | 6 ++++++ 2 files changed, 26 insertions(+) (limited to 'StardewModdingAPI/Events') diff --git a/StardewModdingAPI/Events/EventArgs.cs b/StardewModdingAPI/Events/EventArgs.cs index 7f2e28c7..66d057a7 100644 --- a/StardewModdingAPI/Events/EventArgs.cs +++ b/StardewModdingAPI/Events/EventArgs.cs @@ -108,6 +108,26 @@ namespace StardewModdingAPI.Events public List QuantityChanged { get; private set; } } + public class EventArgsLevelUp : EventArgs + { + public enum LevelType + { + Combat, + Farming, + Fishing, + Foraging, + Mining, + Luck + } + public EventArgsLevelUp(LevelType type, Int32 newLevel) + { + Type = type; + NewLevel = newLevel; + } + public LevelType Type { get; private set; } + public Int32 NewLevel { get; private set; } + } + public class EventArgsIntChanged : EventArgs { public EventArgsIntChanged(Int32 priorInt, Int32 newInt) diff --git a/StardewModdingAPI/Events/Player.cs b/StardewModdingAPI/Events/Player.cs index 47d21f63..f0547f87 100644 --- a/StardewModdingAPI/Events/Player.cs +++ b/StardewModdingAPI/Events/Player.cs @@ -12,6 +12,7 @@ namespace StardewModdingAPI.Events { public static event EventHandler FarmerChanged = delegate { }; public static event EventHandler InventoryChanged = delegate { }; + public static event EventHandler LeveledUp = delegate { }; public static void InvokeFarmerChanged(Farmer priorFarmer, Farmer newFarmer) { @@ -22,5 +23,10 @@ namespace StardewModdingAPI.Events { InventoryChanged.Invoke(null, new EventArgsInventoryChanged(inventory, changedItems)); } + + public static void InvokeLeveledUp(EventArgsLevelUp.LevelType type, int newLevel) + { + LeveledUp.Invoke(null, new EventArgsLevelUp(type, newLevel)); + } } } -- cgit