From b019dd4f69c9fefeba9f14c2049fb352127e448f Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Wed, 7 Dec 2016 20:36:28 -0500 Subject: replace out_items, out_melee, and out_rings commands with a searchable list_items command --- src/TrainerMod/ItemData/SearchableWeapon.cs | 48 +++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 src/TrainerMod/ItemData/SearchableWeapon.cs (limited to 'src/TrainerMod/ItemData/SearchableWeapon.cs') diff --git a/src/TrainerMod/ItemData/SearchableWeapon.cs b/src/TrainerMod/ItemData/SearchableWeapon.cs new file mode 100644 index 00000000..cc9ef459 --- /dev/null +++ b/src/TrainerMod/ItemData/SearchableWeapon.cs @@ -0,0 +1,48 @@ +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 + } + } + } +} \ No newline at end of file -- cgit