summaryrefslogtreecommitdiff
path: root/src/TrainerMod/ItemData/SearchableRing.cs
blob: 7751e6aaf9a22af122bb8f88a87b976d4be5963e (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
46
47
48
using StardewValley.Objects;

namespace TrainerMod.ItemData
{
    /// <summary>A ring that can be searched and added to the player's inventory through the console.</summary>
    internal class SearchableRing : ISearchItem
    {
        /*********
        ** Properties
        *********/
        /// <summary>The underlying item.</summary>
        private readonly Ring Ring;


        /*********
        ** Accessors
        *********/
        /// <summary>Whether the item is valid.</summary>
        public bool IsValid => this.Ring != null;

        /// <summary>The item ID.</summary>
        public int ID => this.Ring.parentSheetIndex;

        /// <summary>The item name.</summary>
        public string Name => this.Ring.Name;

        /// <summary>The item type.</summary>
        public ItemType Type => ItemType.Ring;


        /*********
        ** Accessors
        *********/
        /// <summary>Construct an instance.</summary>
        /// <param name="id">The ring ID.</param>
        public SearchableRing(int id)
        {
            try
            {
                this.Ring = new Ring(id);
            }
            catch
            {
                // invalid
            }
        }
    }
}