summaryrefslogtreecommitdiff
path: root/src/SMAPI/Events/LevelChangedEventArgs.cs
blob: c7303603066e5367df6757284855949e0a52231a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
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; }

        /// <summary>Whether the affected player is the local one.</summary>
        public bool IsLocalPlayer => this.Player.IsLocalPlayer;


        /*********
        ** 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>
        internal LevelChangedEventArgs(Farmer player, SkillType skill, int oldLevel, int newLevel)
        {
            this.Player = player;
            this.Skill = skill;
            this.OldLevel = oldLevel;
            this.NewLevel = newLevel;
        }
    }
}