summaryrefslogtreecommitdiff
path: root/src/SMAPI.Mods.ConsoleCommands
diff options
context:
space:
mode:
Diffstat (limited to 'src/SMAPI.Mods.ConsoleCommands')
-rw-r--r--src/SMAPI.Mods.ConsoleCommands/Framework/ItemRepository.cs16
-rw-r--r--src/SMAPI.Mods.ConsoleCommands/manifest.json4
2 files changed, 13 insertions, 7 deletions
diff --git a/src/SMAPI.Mods.ConsoleCommands/Framework/ItemRepository.cs b/src/SMAPI.Mods.ConsoleCommands/Framework/ItemRepository.cs
index 88ddfe6b..c4619577 100644
--- a/src/SMAPI.Mods.ConsoleCommands/Framework/ItemRepository.cs
+++ b/src/SMAPI.Mods.ConsoleCommands/Framework/ItemRepository.cs
@@ -104,12 +104,18 @@ namespace StardewModdingAPI.Mods.ConsoleCommands.Framework
// weapons
if (ShouldGet(ItemType.Weapon))
{
- foreach (int id in this.TryLoad<int, string>("Data\\weapons").Keys)
+ Dictionary<int, string> weaponsData = this.TryLoad<int, string>("Data\\weapons");
+ foreach (KeyValuePair<int, string> pair in weaponsData)
{
- yield return this.TryCreate(ItemType.Weapon, id, p => p.ID is >= 32 and <= 34
- ? new Slingshot(p.ID)
- : new MeleeWeapon(p.ID)
- );
+ string rawFields = pair.Value;
+ yield return this.TryCreate(ItemType.Weapon, pair.Key, p =>
+ {
+ string[] fields = rawFields.Split('/');
+ bool isSlingshot = fields.Length > 8 && fields[8] == "4";
+ return isSlingshot
+ ? new Slingshot(p.ID)
+ : new MeleeWeapon(p.ID);
+ });
}
}
diff --git a/src/SMAPI.Mods.ConsoleCommands/manifest.json b/src/SMAPI.Mods.ConsoleCommands/manifest.json
index 0afb5837..6ababef0 100644
--- a/src/SMAPI.Mods.ConsoleCommands/manifest.json
+++ b/src/SMAPI.Mods.ConsoleCommands/manifest.json
@@ -1,9 +1,9 @@
{
"Name": "Console Commands",
"Author": "SMAPI",
- "Version": "3.18.1",
+ "Version": "3.18.2",
"Description": "Adds SMAPI console commands that let you manipulate the game.",
"UniqueID": "SMAPI.ConsoleCommands",
"EntryDll": "ConsoleCommands.dll",
- "MinimumApiVersion": "3.18.1"
+ "MinimumApiVersion": "3.18.2"
}