From 89de36534d1ce5361af2bb83a1b521e081c1dcf7 Mon Sep 17 00:00:00 2001 From: Mizzion <36684211+Mizzion@users.noreply.github.com> Date: Sat, 21 Dec 2019 21:36:42 -0700 Subject: Fixed the ring issue and flooring Fixed the same issues that CJB Item Spawner had related to the rings and floors. (Sorry for the delay Christmas preparation is taking up most of my time). --- src/SMAPI.Mods.ConsoleCommands/Framework/ItemRepository.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/SMAPI.Mods.ConsoleCommands') diff --git a/src/SMAPI.Mods.ConsoleCommands/Framework/ItemRepository.cs b/src/SMAPI.Mods.ConsoleCommands/Framework/ItemRepository.cs index 0648aa2b..1371d3a5 100644 --- a/src/SMAPI.Mods.ConsoleCommands/Framework/ItemRepository.cs +++ b/src/SMAPI.Mods.ConsoleCommands/Framework/ItemRepository.cs @@ -51,7 +51,7 @@ namespace StardewModdingAPI.Mods.ConsoleCommands.Framework yield return this.TryCreate(ItemType.Wallpaper, id, () => new Wallpaper(id) { Category = SObject.furnitureCategory }); // flooring - for (int id = 0; id < 40; id++) + for (int id = 0; id < 56; id++) yield return this.TryCreate(ItemType.Flooring, id, () => new Wallpaper(id, isFloor: true) { Category = SObject.furnitureCategory }); // equipment @@ -61,7 +61,7 @@ namespace StardewModdingAPI.Mods.ConsoleCommands.Framework yield return this.TryCreate(ItemType.Hat, id, () => new Hat(id)); foreach (int id in Game1.objectInformation.Keys) { - if (id >= Ring.ringLowerIndexRange && id <= Ring.ringUpperIndexRange) + if ((id >= Ring.ringLowerIndexRange && id <= Ring.ringUpperIndexRange) || (id >= 810 && id <= 811)) yield return this.TryCreate(ItemType.Ring, id, () => new Ring(id)); } @@ -103,7 +103,7 @@ namespace StardewModdingAPI.Mods.ConsoleCommands.Framework { if (id == 79) continue; // secret note handled above - if (id >= Ring.ringLowerIndexRange && id <= Ring.ringUpperIndexRange) + if ((id >= Ring.ringLowerIndexRange && id <= Ring.ringUpperIndexRange) || (id >= 810 && id <= 811)) continue; // handled separated // spawn main item -- cgit From 139e267aaaeca9ad84e2a46b1068967b5599f1b6 Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Sun, 22 Dec 2019 12:04:40 -0500 Subject: update item spawning code, detect ring type automatically to support custom rings, minor refactor --- docs/release-notes.md | 5 + .../Framework/ItemRepository.cs | 253 ++++++++++----------- 2 files changed, 128 insertions(+), 130 deletions(-) (limited to 'src/SMAPI.Mods.ConsoleCommands') diff --git a/docs/release-notes.md b/docs/release-notes.md index bae1cb98..a9df73f4 100644 --- a/docs/release-notes.md +++ b/docs/release-notes.md @@ -8,6 +8,11 @@ * Updated for the 'Force Off' gamepad mode added in Stardew Valley 1.4.1. * Fixed compatibility with Linux Mint 18 (thanks to techge!) and Arch Linux. * Fixed compatibility with Linux systems which have libhybris-utils installed. + * Fixes for the bundled Console Commands mod: + * added new clothing items; + * fixed spawning new flooring and rings (thanks to Mizzion!); + * fixed spawning custom rings added by mods; + * Fixed errors when some item data is invalid. * Internal optimizations. * Updated translations. Thanks to PlussRolf (added Spanish)! diff --git a/src/SMAPI.Mods.ConsoleCommands/Framework/ItemRepository.cs b/src/SMAPI.Mods.ConsoleCommands/Framework/ItemRepository.cs index 1371d3a5..08dd8eed 100644 --- a/src/SMAPI.Mods.ConsoleCommands/Framework/ItemRepository.cs +++ b/src/SMAPI.Mods.ConsoleCommands/Framework/ItemRepository.cs @@ -46,6 +46,10 @@ namespace StardewModdingAPI.Mods.ConsoleCommands.Framework yield return this.TryCreate(ItemType.Tool, this.CustomIDOffset + 2, () => new Pan()); yield return this.TryCreate(ItemType.Tool, this.CustomIDOffset + 3, () => new Wand()); + // clothing + foreach (int id in Game1.clothingInformation.Keys) + yield return this.TryCreate(ItemType.Clothing, id, () => new Clothing(id)); + // wallpapers for (int id = 0; id < 112; id++) yield return this.TryCreate(ItemType.Wallpaper, id, () => new Wallpaper(id) { Category = SObject.furnitureCategory }); @@ -59,11 +63,6 @@ namespace StardewModdingAPI.Mods.ConsoleCommands.Framework yield return this.TryCreate(ItemType.Boots, id, () => new Boots(id)); foreach (int id in Game1.content.Load>("Data\\hats").Keys) yield return this.TryCreate(ItemType.Hat, id, () => new Hat(id)); - foreach (int id in Game1.objectInformation.Keys) - { - if ((id >= Ring.ringLowerIndexRange && id <= Ring.ringUpperIndexRange) || (id >= 810 && id <= 811)) - yield return this.TryCreate(ItemType.Ring, id, () => new Ring(id)); - } // weapons foreach (int id in Game1.content.Load>("Data\\weapons").Keys) @@ -87,147 +86,141 @@ namespace StardewModdingAPI.Mods.ConsoleCommands.Framework foreach (int id in Game1.bigCraftablesInformation.Keys) yield return this.TryCreate(ItemType.BigCraftable, id, () => new SObject(Vector2.Zero, id)); - // secret notes - foreach (int id in Game1.content.Load>("Data\\SecretNotes").Keys) - { - yield return this.TryCreate(ItemType.Object, this.CustomIDOffset + id, () => - { - SObject note = new SObject(79, 1); - note.name = $"{note.name} #{id}"; - return note; - }); - } - // objects foreach (int id in Game1.objectInformation.Keys) { - if (id == 79) - continue; // secret note handled above - if ((id >= Ring.ringLowerIndexRange && id <= Ring.ringUpperIndexRange) || (id >= 810 && id <= 811)) - continue; // handled separated - - // spawn main item - SObject item; - { - 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; - } - if (item == null) - continue; + string[] fields = Game1.objectInformation[id]?.Split('/'); - // fruit products - if (item.Category == SObject.FruitsCategory) + // secret notes + if (id == 79) { - // wine - yield return this.TryCreate(ItemType.Object, this.CustomIDOffset * 2 + id, () => + foreach (int secretNoteId in Game1.content.Load>("Data\\SecretNotes").Keys) { - SObject wine = new SObject(348, 1) + yield return this.TryCreate(ItemType.Object, this.CustomIDOffset + secretNoteId, () => { - Name = $"{item.Name} Wine", - Price = item.Price * 3 - }; - wine.preserve.Value = SObject.PreserveType.Wine; - wine.preservedParentSheetIndex.Value = item.ParentSheetIndex; - return wine; - }); - - // jelly - yield return this.TryCreate(ItemType.Object, this.CustomIDOffset * 3 + id, () => - { - SObject jelly = new SObject(344, 1) - { - Name = $"{item.Name} Jelly", - Price = 50 + item.Price * 2 - }; - jelly.preserve.Value = SObject.PreserveType.Jelly; - jelly.preservedParentSheetIndex.Value = item.ParentSheetIndex; - return jelly; - }); + SObject note = new SObject(79, 1); + note.name = $"{note.name} #{secretNoteId}"; + return note; + }); + } } - // vegetable products - else if (item.Category == SObject.VegetableCategory) - { - // juice - yield return this.TryCreate(ItemType.Object, this.CustomIDOffset * 4 + id, () => - { - SObject juice = new SObject(350, 1) - { - Name = $"{item.Name} Juice", - Price = (int)(item.Price * 2.25d) - }; - juice.preserve.Value = SObject.PreserveType.Juice; - juice.preservedParentSheetIndex.Value = item.ParentSheetIndex; - return juice; - }); - - // pickled - yield return this.TryCreate(ItemType.Object, this.CustomIDOffset * 5 + id, () => - { - SObject pickled = new SObject(342, 1) - { - Name = $"Pickled {item.Name}", - Price = 50 + item.Price * 2 - }; - pickled.preserve.Value = SObject.PreserveType.Pickle; - pickled.preservedParentSheetIndex.Value = item.ParentSheetIndex; - return pickled; - }); - } + // ring + else if (id != 801 && fields?.Length >= 4 && fields[3] == "Ring") // 801 = wedding ring, which isn't an equippable ring + yield return this.TryCreate(ItemType.Ring, id, () => new Ring(id)); - // flower honey - else if (item.Category == SObject.flowersCategory) + // item + else { - yield return this.TryCreate(ItemType.Object, this.CustomIDOffset * 5 + id, () => + // spawn main item + SObject item = null; + yield return this.TryCreate(ItemType.Object, id, () => { - SObject honey = new SObject(Vector2.Zero, 340, $"{item.Name} Honey", false, true, false, false) - { - Name = $"{item.Name} Honey", - preservedParentSheetIndex = { item.ParentSheetIndex } - }; - honey.Price += item.Price * 2; - return honey; + return item = (id == 812 // roe + ? new ColoredObject(id, 1, Color.White) + : new SObject(id, 1) + ); }); - } + if (item == null) + continue; - // roe and aged roe (derived from FishPond.GetFishProduce) - else if (id == 812) - { - foreach (var pair in Game1.objectInformation) + // flavored items + switch (item.Category) { - // 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) + // fruit products + case SObject.FruitsCategory: + // wine + yield return this.TryCreate(ItemType.Object, this.CustomIDOffset * 2 + id, () => new SObject(348, 1) + { + Name = $"{item.Name} Wine", + Price = item.Price * 3, + preserve = { SObject.PreserveType.Wine }, + preservedParentSheetIndex = { item.ParentSheetIndex } + }); + + // jelly + yield return this.TryCreate(ItemType.Object, this.CustomIDOffset * 3 + id, () => new SObject(344, 1) + { + Name = $"{item.Name} Jelly", + Price = 50 + item.Price * 2, + preserve = { SObject.PreserveType.Jelly }, + preservedParentSheetIndex = { item.ParentSheetIndex } + }); + break; + + // vegetable products + case SObject.VegetableCategory: + // juice + yield return this.TryCreate(ItemType.Object, this.CustomIDOffset * 4 + id, () => new SObject(350, 1) + { + Name = $"{item.Name} Juice", + Price = (int)(item.Price * 2.25d), + preserve = { SObject.PreserveType.Juice }, + preservedParentSheetIndex = { item.ParentSheetIndex } + }); + + // pickled + yield return this.TryCreate(ItemType.Object, this.CustomIDOffset * 5 + id, () => new SObject(342, 1) + { + Name = $"Pickled {item.Name}", + Price = 50 + item.Price * 2, + preserve = { SObject.PreserveType.Pickle }, + preservedParentSheetIndex = { item.ParentSheetIndex } + }); + break; + + // flower honey + case SObject.flowersCategory: + yield return this.TryCreate(ItemType.Object, this.CustomIDOffset * 5 + id, () => + { + SObject honey = new SObject(Vector2.Zero, 340, $"{item.Name} Honey", false, true, false, false) + { + Name = $"{item.Name} Honey", + preservedParentSheetIndex = { item.ParentSheetIndex } + }; + honey.Price += item.Price * 2; + return honey; + }); + break; + + // roe and aged roe (derived from FishPond.GetFishProduce) + case SObject.sellAtFishShopCategory when id == 812: + foreach (var pair in Game1.objectInformation) { - 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); - } + // get input + 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; + + // yield roe + SObject roe = null; + yield return this.TryCreate(ItemType.Object, this.CustomIDOffset * 7 + id, () => + { + roe = new ColoredObject(812, 1, color) + { + name = $"{input.Name} Roe", + preserve = { Value = SObject.PreserveType.Roe }, + preservedParentSheetIndex = { Value = input.ParentSheetIndex } + }; + roe.Price += input.Price / 2; + return roe; + }); + + // aged roe + if (roe != null && pair.Key != 698) // aged sturgeon roe is caviar, which is a separate item + { + yield return this.TryCreate(ItemType.Object, this.CustomIDOffset * 7 + id, () => 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 + }); + } + } + break; } } } -- cgit From 48959375b9ef52abf7c7a9404d43aac6ba780047 Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Sat, 4 Jan 2020 22:57:38 -0500 Subject: prepare for release --- build/common.targets | 2 +- docs/release-notes.md | 27 ++++++++++++++------------- src/SMAPI.Mods.ConsoleCommands/manifest.json | 4 ++-- src/SMAPI.Mods.SaveBackup/manifest.json | 4 ++-- src/SMAPI/Constants.cs | 2 +- 5 files changed, 20 insertions(+), 19 deletions(-) (limited to 'src/SMAPI.Mods.ConsoleCommands') diff --git a/build/common.targets b/build/common.targets index e738bab0..df2d4861 100644 --- a/build/common.targets +++ b/build/common.targets @@ -4,7 +4,7 @@ - 3.0.1 + 3.1.0 SMAPI $(AssemblySearchPaths);{GAC} diff --git a/docs/release-notes.md b/docs/release-notes.md index 32082356..ed6f9013 100644 --- a/docs/release-notes.md +++ b/docs/release-notes.md @@ -1,30 +1,31 @@ ← [README](README.md) # Release notes -## Upcoming release +## 3.1 +Released 05 January 2019 for Stardew Valley 1.4 or later. * For players: + * Added separate group in 'skipped mods' list for broken dependencies, so it's easier to see what to fix first. * Added friendly log message for save file-not-found errors. - * Updated for the 'Force Off' gamepad mode added in Stardew Valley 1.4.1. - * The 'skipped mods' list now shows broken dependencies first, so it's easier to see which ones to fix first. - * Fixed compatibility with Linux Mint 18 (thanks to techge!) and Arch Linux. - * Fixed compatibility with Linux systems which have libhybris-utils installed. + * Updated for gamepad modes in Stardew Valley 1.4.1. + * Improved performance in some cases. + * Fixed compatibility with Linux Mint 18 (thanks to techge!), Arch Linux, and Linux systems with libhybris-utils installed. * Fixed memory leak when repeatedly loading a save and returning to title. * Fixed memory leak when mods reload assets. - * Fixes for the bundled Console Commands mod: + * Fixes for Console Commands mod: * added new clothing items; * fixed spawning new flooring and rings (thanks to Mizzion!); * fixed spawning custom rings added by mods; * Fixed errors when some item data is invalid. - * Internal optimizations. * Updated translations. Thanks to L30Bola (added Portuguese), PlussRolf (added Spanish), and shirutan (added Japanese)! * For the web UI: * Added option to edit & reupload in the JSON validator. - * The log parser and JSON validator no longer save files to Pastebin due to ongoing performance issues. All files are now saved to Azure Blob storage instead and expire after one month. + * File uploads are now stored in Azure storage instead of Pastebin, due to ongoing Pastebin perfomance issues. + * File uploads now expire after one month. * Updated the JSON validator for Content Patcher 1.10 and 1.11. - * Fixed JSON validator no longer letting you change format when viewing results. - * Fixed JSON validator for Content Patcher schema not requiring `Default` if `AllowBlank` omitted. + * Fixed JSON validator no longer letting you change format when viewing a file. + * Fixed JSON validator for Content Patcher not requiring `Default` if `AllowBlank` was omitted. * Fixed log parser not correctly handling content packs with no author (thanks to danvolchek!). * Fixed main sidebar link pointing to wiki instead of home page. @@ -35,17 +36,17 @@ * winter flooring textures; * `Data\Bundles` changes (for added bundles only); * `Characters\Farmer\farmer_girl_base_bald`. - * Added direct `Console` access to paranoid mode warnings. + * Added paranoid-mode warning for direct `Console` access. * Improved error messages for `TargetParameterCountException` when using the reflection API. * `helper.Read/WriteSaveData` can now be used while a save is being loaded (e.g. within a `Specialized.LoadStageChanged` event). - * Removed `DumpMetadata` option. It was only meant for specific debugging cases, but players would occasionally enable it incorrectly and then report crashes. + * Removed `DumpMetadata` option. It was only for specific debugging cases, but players would sometimes enable it incorrectly and then report crashes. * Fixed private textures loaded from content packs not having their `Name` field set. * For SMAPI developers: * You can now run local environments without configuring Amazon, Azure, MongoDB, and Pastebin accounts. ## 3.0.1 -Released 02 December 2019 for Stardew Valley 1.4.0.1. +Released 02 December 2019 for Stardew Valley 1.4 or later. * For players: * Updated for Stardew Valley 1.4.0.1. diff --git a/src/SMAPI.Mods.ConsoleCommands/manifest.json b/src/SMAPI.Mods.ConsoleCommands/manifest.json index badea825..1e12e13e 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.0.1", + "Version": "3.1.0", "Description": "Adds SMAPI console commands that let you manipulate the game.", "UniqueID": "SMAPI.ConsoleCommands", "EntryDll": "ConsoleCommands.dll", - "MinimumApiVersion": "3.0.1" + "MinimumApiVersion": "3.1.0" } diff --git a/src/SMAPI.Mods.SaveBackup/manifest.json b/src/SMAPI.Mods.SaveBackup/manifest.json index 252c359f..55af8f35 100644 --- a/src/SMAPI.Mods.SaveBackup/manifest.json +++ b/src/SMAPI.Mods.SaveBackup/manifest.json @@ -1,9 +1,9 @@ { "Name": "Save Backup", "Author": "SMAPI", - "Version": "3.0.1", + "Version": "3.1.0", "Description": "Automatically backs up all your saves once per day into its folder.", "UniqueID": "SMAPI.SaveBackup", "EntryDll": "SaveBackup.dll", - "MinimumApiVersion": "3.0.1" + "MinimumApiVersion": "3.1.0" } diff --git a/src/SMAPI/Constants.cs b/src/SMAPI/Constants.cs index 7fdfb8d0..97204d86 100644 --- a/src/SMAPI/Constants.cs +++ b/src/SMAPI/Constants.cs @@ -20,7 +20,7 @@ namespace StardewModdingAPI ** Public ****/ /// SMAPI's current semantic version. - public static ISemanticVersion ApiVersion { get; } = new Toolkit.SemanticVersion("3.0.1"); + public static ISemanticVersion ApiVersion { get; } = new Toolkit.SemanticVersion("3.1.0"); /// The minimum supported version of Stardew Valley. public static ISemanticVersion MinimumGameVersion { get; } = new GameVersion("1.4.0"); -- cgit