diff options
Diffstat (limited to 'src/SMAPI.Mods.ConsoleCommands/Framework')
4 files changed, 21 insertions, 9 deletions
diff --git a/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/ArgumentParser.cs b/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/ArgumentParser.cs index 9c7082c9..e84445d7 100644 --- a/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/ArgumentParser.cs +++ b/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/ArgumentParser.cs @@ -64,7 +64,7 @@ namespace StardewModdingAPI.Mods.ConsoleCommands.Framework.Commands this.LogError($"Argument {index} ({name}) is required."); return false; } - if (oneOf?.Any() == true && !oneOf.Contains(this.Args[index], StringComparer.InvariantCultureIgnoreCase)) + if (oneOf?.Any() == true && !oneOf.Contains(this.Args[index], StringComparer.OrdinalIgnoreCase)) { this.LogError($"Argument {index} ({name}) must be one of {string.Join(", ", oneOf)}."); return false; diff --git a/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/World/ClearCommand.cs b/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/World/ClearCommand.cs index e9545575..1190a4ab 100644 --- a/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/World/ClearCommand.cs +++ b/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/World/ClearCommand.cs @@ -56,7 +56,7 @@ namespace StardewModdingAPI.Mods.ConsoleCommands.Framework.Commands.World return; // get target location - GameLocation location = Game1.locations.FirstOrDefault(p => p.Name != null && p.Name.Equals(locationName, StringComparison.InvariantCultureIgnoreCase)); + GameLocation location = Game1.locations.FirstOrDefault(p => p.Name != null && p.Name.Equals(locationName, StringComparison.OrdinalIgnoreCase)); if (location == null && locationName == "current") location = Game1.currentLocation; if (location == null) diff --git a/src/SMAPI.Mods.ConsoleCommands/Framework/ItemData/SearchableItem.cs b/src/SMAPI.Mods.ConsoleCommands/Framework/ItemData/SearchableItem.cs index b618a308..d9e63126 100644 --- a/src/SMAPI.Mods.ConsoleCommands/Framework/ItemData/SearchableItem.cs +++ b/src/SMAPI.Mods.ConsoleCommands/Framework/ItemData/SearchableItem.cs @@ -44,8 +44,8 @@ namespace StardewModdingAPI.Mods.ConsoleCommands.Framework.ItemData public bool NameContains(string substring) { return - this.Name.IndexOf(substring, StringComparison.InvariantCultureIgnoreCase) != -1 - || this.DisplayName.IndexOf(substring, StringComparison.InvariantCultureIgnoreCase) != -1; + this.Name.IndexOf(substring, StringComparison.OrdinalIgnoreCase) != -1 + || this.DisplayName.IndexOf(substring, StringComparison.OrdinalIgnoreCase) != -1; } /// <summary>Get whether the item name is exactly equal to a case-insensitive string.</summary> @@ -53,8 +53,8 @@ namespace StardewModdingAPI.Mods.ConsoleCommands.Framework.ItemData public bool NameEquivalentTo(string name) { return - this.Name.Equals(name, StringComparison.InvariantCultureIgnoreCase) - || this.DisplayName.Equals(name, StringComparison.InvariantCultureIgnoreCase); + this.Name.Equals(name, StringComparison.OrdinalIgnoreCase) + || this.DisplayName.Equals(name, StringComparison.OrdinalIgnoreCase); } } } diff --git a/src/SMAPI.Mods.ConsoleCommands/Framework/ItemRepository.cs b/src/SMAPI.Mods.ConsoleCommands/Framework/ItemRepository.cs index 6a17213c..37f5f8d1 100644 --- a/src/SMAPI.Mods.ConsoleCommands/Framework/ItemRepository.cs +++ b/src/SMAPI.Mods.ConsoleCommands/Framework/ItemRepository.cs @@ -77,7 +77,7 @@ namespace StardewModdingAPI.Mods.ConsoleCommands.Framework // furniture foreach (int id in this.TryLoad<int, string>("Data\\Furniture").Keys) { - if (id == 1466 || id == 1468) + if (id == 1466 || id == 1468 || id == 1680) yield return this.TryCreate(ItemType.Furniture, id, () => new TV(id, Vector2.Zero)); else yield return this.TryCreate(ItemType.Furniture, id, () => new Furniture(id, Vector2.Zero)); @@ -192,7 +192,7 @@ namespace StardewModdingAPI.Mods.ConsoleCommands.Framework SObject input = this.TryCreate(ItemType.Object, -1, () => new SObject(pair.Key, 1))?.Item as SObject; if (input == null || input.Category != SObject.FishCategory) continue; - Color color = TailoringMenu.GetDyeColor(input) ?? Color.Orange; + Color color = this.GetRoeColor(input); // yield roe SObject roe = null; @@ -259,12 +259,24 @@ namespace StardewModdingAPI.Mods.ConsoleCommands.Framework { try { - return new SearchableItem(type, id, createItem()); + var item = createItem(); + item.getDescription(); // force-load item data, so it crashes here if it's invalid + return new SearchableItem(type, id, item); } catch { return null; // if some item data is invalid, just don't include it } } + + /// <summary>Get the color to use a given fish's roe.</summary> + /// <param name="fish">The fish whose roe to color.</param> + /// <remarks>Derived from <see cref="StardewValley.Buildings.FishPond.GetFishProduce"/>.</remarks> + private Color GetRoeColor(SObject fish) + { + return fish.ParentSheetIndex == 698 // sturgeon + ? new Color(61, 55, 42) + : (TailoringMenu.GetDyeColor(fish) ?? Color.Orange); + } } } |