From 2c2644f5a083562822dda48311678daf3b8d5e1f Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Fri, 19 Jul 2019 21:31:35 -0400 Subject: add roe spawning (#638) --- .../Framework/ItemRepository.cs | 43 +++++++++++++++++++++- 1 file changed, 42 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/SMAPI.Mods.ConsoleCommands/Framework/ItemRepository.cs b/src/SMAPI.Mods.ConsoleCommands/Framework/ItemRepository.cs index 4d9091b0..0648aa2b 100644 --- a/src/SMAPI.Mods.ConsoleCommands/Framework/ItemRepository.cs +++ b/src/SMAPI.Mods.ConsoleCommands/Framework/ItemRepository.cs @@ -5,6 +5,7 @@ using System.Linq; using Microsoft.Xna.Framework; using StardewModdingAPI.Mods.ConsoleCommands.Framework.ItemData; using StardewValley; +using StardewValley.Menus; using StardewValley.Objects; using StardewValley.Tools; using SObject = StardewValley.Object; @@ -108,7 +109,10 @@ namespace StardewModdingAPI.Mods.ConsoleCommands.Framework // spawn main item SObject item; { - SearchableItem main = this.TryCreate(ItemType.Object, id, () => new SObject(id, 1)); + SearchableItem main = this.TryCreate(ItemType.Object, id, () => id == 812 + ? new ColoredObject(id, 1, Color.White) + : new SObject(id, 1) + ); yield return main; item = main?.Item as SObject; } @@ -189,6 +193,43 @@ namespace StardewModdingAPI.Mods.ConsoleCommands.Framework return honey; }); } + + // roe and aged roe (derived from FishPond.GetFishProduce) + else if (id == 812) + { + foreach (var pair in Game1.objectInformation) + { + // get input + SObject input = new SObject(pair.Key, 1); + if (input.Category != SObject.FishCategory) + continue; + Color color = TailoringMenu.GetDyeColor(input) ?? Color.Orange; + + // yield roe + SObject roe = new ColoredObject(812, 1, color) + { + name = $"{input.Name} Roe", + preserve = { Value = SObject.PreserveType.Roe }, + preservedParentSheetIndex = { Value = input.ParentSheetIndex } + }; + roe.Price += input.Price / 2; + yield return new SearchableItem(ItemType.Object, this.CustomIDOffset * 6 + 1, roe); + + // aged roe + if (pair.Key != 698) // aged sturgeon roe is caviar, which is a separate item + { + ColoredObject agedRoe = new ColoredObject(447, 1, color) + { + name = $"Aged {input.Name} Roe", + Category = -27, + preserve = { Value = SObject.PreserveType.AgedRoe }, + preservedParentSheetIndex = { Value = input.ParentSheetIndex }, + Price = roe.Price * 2 + }; + yield return new SearchableItem(ItemType.Object, this.CustomIDOffset * 6 + 1, agedRoe); + } + } + } } } -- cgit