diff options
author | ClxS <slxxls92@gmail.com> | 2016-03-04 20:40:46 +0000 |
---|---|---|
committer | ClxS <slxxls92@gmail.com> | 2016-03-04 20:40:46 +0000 |
commit | b8a9f8fc88706896c3191b80d17375a483183226 (patch) | |
tree | 3ebc1fb20daa09105c9e22d2c32685f74271af06 /StardewModdingAPI/Inheritance | |
parent | 4712da9f2d382e4593966530145140f33c7673bf (diff) | |
download | SMAPI-b8a9f8fc88706896c3191b80d17375a483183226.tar.gz SMAPI-b8a9f8fc88706896c3191b80d17375a483183226.tar.bz2 SMAPI-b8a9f8fc88706896c3191b80d17375a483183226.zip |
Added event handlers for each of the level up events
Diffstat (limited to 'StardewModdingAPI/Inheritance')
-rw-r--r-- | StardewModdingAPI/Inheritance/SGame.cs | 46 |
1 files changed, 45 insertions, 1 deletions
diff --git a/StardewModdingAPI/Inheritance/SGame.cs b/StardewModdingAPI/Inheritance/SGame.cs index 366f3045..36f905f7 100644 --- a/StardewModdingAPI/Inheritance/SGame.cs +++ b/StardewModdingAPI/Inheritance/SGame.cs @@ -12,6 +12,7 @@ using StardewValley.Menus; using StardewValley.Monsters;
using StardewValley.Quests;
using StardewValley.TerrainFeatures;
+using StardewModdingAPI.Events;
namespace StardewModdingAPI.Inheritance
{
@@ -48,6 +49,13 @@ namespace StardewModdingAPI.Inheritance public int PreviousItems_ { get; private set; }
public Dictionary<Item, int> PreviousItems { get; private set; }
+ public int PreviousCombatLevel { get; private set; }
+ public int PreviousFarmingLevel { get; private set; }
+ public int PreviousFishingLevel { get; private set; }
+ public int PreviousForagingLevel { get; private set; }
+ public int PreviousMiningLevel { get; private set; }
+ public int PreviousLuckLevel { get; private set; }
+
public GameLocation PreviousGameLocation { get; private set; }
public IClickableMenu PreviousActiveMenu { get; private set; }
@@ -227,7 +235,7 @@ namespace StardewModdingAPI.Inheritance foreach (Keys k in FramePressedKeys)
Events.ControlEvents.InvokeKeyPressed(k);
-
+
if (KStateNow != KStatePrior)
{
Events.ControlEvents.InvokeKeyboardChanged(KStatePrior, KStateNow);
@@ -264,6 +272,42 @@ namespace StardewModdingAPI.Inheritance PreviousFarmer = player;
}
+ if (player != null && player.combatLevel != PreviousCombatLevel)
+ {
+ Events.PlayerEvents.InvokeLeveledUp(EventArgsLevelUp.LevelType.Combat, player.combatLevel);
+ PreviousCombatLevel = player.combatLevel;
+ }
+
+ if (player != null && player.farmingLevel != PreviousFarmingLevel)
+ {
+ Events.PlayerEvents.InvokeLeveledUp(EventArgsLevelUp.LevelType.Farming, player.farmingLevel);
+ PreviousFarmingLevel = player.farmingLevel;
+ }
+
+ if (player != null && player.fishingLevel != PreviousFishingLevel)
+ {
+ Events.PlayerEvents.InvokeLeveledUp(EventArgsLevelUp.LevelType.Fishing, player.fishingLevel);
+ PreviousFishingLevel = player.fishingLevel;
+ }
+
+ if (player != null && player.foragingLevel != PreviousForagingLevel)
+ {
+ Events.PlayerEvents.InvokeLeveledUp(EventArgsLevelUp.LevelType.Foraging, player.foragingLevel);
+ PreviousForagingLevel = player.foragingLevel;
+ }
+
+ if (player != null && player.miningLevel != PreviousMiningLevel)
+ {
+ Events.PlayerEvents.InvokeLeveledUp(EventArgsLevelUp.LevelType.Mining, player.miningLevel);
+ PreviousMiningLevel = player.miningLevel;
+ }
+
+ if (player != null && player.luckLevel != PreviousLuckLevel)
+ {
+ Events.PlayerEvents.InvokeLeveledUp(EventArgsLevelUp.LevelType.Luck, player.luckLevel);
+ PreviousLuckLevel = player.luckLevel;
+ }
+
List<ItemStackChange> changedItems;
if (player != null && HasInventoryChanged(player.items, out changedItems))
{
|