Merge pull request #889 from daleao/develop
Replace slingshot ID check with type field check
This commit is contained in:
commit
d438e49f76
|
@ -104,12 +104,18 @@ namespace StardewModdingAPI.Mods.ConsoleCommands.Framework
|
||||||
// weapons
|
// weapons
|
||||||
if (ShouldGet(ItemType.Weapon))
|
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
|
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 Slingshot(p.ID)
|
||||||
: new MeleeWeapon(p.ID)
|
: new MeleeWeapon(p.ID);
|
||||||
);
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue