summaryrefslogtreecommitdiff
path: root/src/SMAPI.Mods.ConsoleCommands/Framework
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2023-01-09 12:27:49 -0500
committerJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2023-01-09 12:27:49 -0500
commitb4e95a92b33c541d36379d69d3650c5c22ea324c (patch)
treede020a6dc7e065f725d68ea43b4a3a57eb7ccf8c /src/SMAPI.Mods.ConsoleCommands/Framework
parent368b25b5411683192f4398616abed61441457799 (diff)
parent25b8e13ba827a0512f5089d3bd22e8ed1a15e7ba (diff)
downloadSMAPI-b4e95a92b33c541d36379d69d3650c5c22ea324c.tar.gz
SMAPI-b4e95a92b33c541d36379d69d3650c5c22ea324c.tar.bz2
SMAPI-b4e95a92b33c541d36379d69d3650c5c22ea324c.zip
Merge branch 'develop' into stable
Diffstat (limited to 'src/SMAPI.Mods.ConsoleCommands/Framework')
-rw-r--r--src/SMAPI.Mods.ConsoleCommands/Framework/ItemRepository.cs16
1 files changed, 11 insertions, 5 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);
+ });
}
}