summaryrefslogtreecommitdiff
path: root/src/TrainerMod/Framework/ItemData
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <github@jplamondonw.com>2017-07-02 17:21:28 -0400
committerJesse Plamondon-Willard <github@jplamondonw.com>2017-07-02 17:21:28 -0400
commit5d5f7192dc49546610df13147f4e076eb199efc1 (patch)
tree8413fc4890cb992516b1b437fa6967413efddcb5 /src/TrainerMod/Framework/ItemData
parent2ca49fba62f59135c2ed3ec7958cb78073ff486b (diff)
downloadSMAPI-5d5f7192dc49546610df13147f4e076eb199efc1.tar.gz
SMAPI-5d5f7192dc49546610df13147f4e076eb199efc1.tar.bz2
SMAPI-5d5f7192dc49546610df13147f4e076eb199efc1.zip
add item repository which returns all spawnable items in the game (#302)
Based on code I wrote for CJB Item Spawner.
Diffstat (limited to 'src/TrainerMod/Framework/ItemData')
-rw-r--r--src/TrainerMod/Framework/ItemData/ItemType.cs28
-rw-r--r--src/TrainerMod/Framework/ItemData/SearchableItem.cs41
2 files changed, 67 insertions, 2 deletions
diff --git a/src/TrainerMod/Framework/ItemData/ItemType.cs b/src/TrainerMod/Framework/ItemData/ItemType.cs
index f93160a2..423455e9 100644
--- a/src/TrainerMod/Framework/ItemData/ItemType.cs
+++ b/src/TrainerMod/Framework/ItemData/ItemType.cs
@@ -3,13 +3,37 @@
/// <summary>An item type that can be searched and added to the player through the console.</summary>
internal enum ItemType
{
+ /// <summary>A big craftable object in <see cref="StardewValley.Game1.bigCraftablesInformation"/></summary>
+ BigCraftable,
+
+ /// <summary>A <see cref="Boots"/> item.</summary>
+ Boots,
+
+ /// <summary>A fish item.</summary>
+ Fish,
+
+ /// <summary>A <see cref="Wallpaper"/> flooring item.</summary>
+ Flooring,
+
+ /// <summary>A <see cref="Furniture"/> item.</summary>
+ Furniture,
+
+ /// <summary>A <see cref="Hat"/> item.</summary>
+ Hat,
+
/// <summary>Any object in <see cref="StardewValley.Game1.objectInformation"/> (except rings).</summary>
Object,
- /// <summary>A ring in <see cref="StardewValley.Game1.objectInformation"/>.</summary>
+ /// <summary>A <see cref="Ring"/> item.</summary>
Ring,
- /// <summary>A weapon from <c>Data\weapons</c>.</summary>
+ /// <summary>A <see cref="Tool"/> tool.</summary>
+ Tool,
+
+ /// <summary>A <see cref="Wallpaper"/> wall item.</summary>
+ Wallpaper,
+
+ /// <summary>A <see cref="StardewValley.Tools.MeleeWeapon"/> or <see cref="StardewValley.Tools.Slingshot"/> item.</summary>
Weapon
}
}
diff --git a/src/TrainerMod/Framework/ItemData/SearchableItem.cs b/src/TrainerMod/Framework/ItemData/SearchableItem.cs
new file mode 100644
index 00000000..146da1a8
--- /dev/null
+++ b/src/TrainerMod/Framework/ItemData/SearchableItem.cs
@@ -0,0 +1,41 @@
+using StardewValley;
+
+namespace TrainerMod.Framework.ItemData
+{
+ /// <summary>A game item with metadata.</summary>
+ internal class SearchableItem
+ {
+ /*********
+ ** Accessors
+ *********/
+ /// <summary>The item type.</summary>
+ public ItemType Type { get; }
+
+ /// <summary>The item instance.</summary>
+ public Item Item { get; }
+
+ /// <summary>The item's unique ID for its type.</summary>
+ public int ID { get; }
+
+ /// <summary>The item's default name.</summary>
+ public string Name => this.Item.Name;
+
+ /// <summary>The item's display name for the current language.</summary>
+ public string DisplayName => this.Item.DisplayName;
+
+
+ /*********
+ ** Public methods
+ *********/
+ /// <summary>Construct an instance.</summary>
+ /// <param name="type">The item type.</param>
+ /// <param name="id">The unique ID (if different from the item's parent sheet index).</param>
+ /// <param name="item">The item instance.</param>
+ public SearchableItem(ItemType type, int id, Item item)
+ {
+ this.Type = type;
+ this.ID = id;
+ this.Item = item;
+ }
+ }
+}