using StardewValley.Tools; namespace TrainerMod.ItemData { /// A weapon that can be searched and added to the player's inventory through the console. internal class SearchableWeapon : ISearchItem { /********* ** Properties *********/ /// The underlying item. private readonly MeleeWeapon Weapon; /********* ** Accessors *********/ /// Whether the item is valid. public bool IsValid => this.Weapon != null; /// The item ID. public int ID => this.Weapon.initialParentTileIndex; /// The item name. public string Name => this.Weapon.Name; /// The item type. public ItemType Type => ItemType.Weapon; /********* ** Accessors *********/ /// Construct an instance. /// The weapon ID. public SearchableWeapon(int id) { try { this.Weapon = new MeleeWeapon(id); } catch { // invalid } } } }