From 53ed5f4faaffad212a753b33db2106470f48b6b5 Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Mon, 24 Jan 2022 21:55:30 -0500 Subject: update release notes --- docs/release-notes.md | 3 +++ 1 file changed, 3 insertions(+) (limited to 'docs') diff --git a/docs/release-notes.md b/docs/release-notes.md index 05ab58a3..f45df4bd 100644 --- a/docs/release-notes.md +++ b/docs/release-notes.md @@ -1,6 +1,9 @@ ← [README](README.md) # Release notes +## Upcoming release +* Improved translations. Thanks to ChulkyBow (updated Ukrainian)! + ## 3.13.4 Released 16 January 2022 for Stardew Valley 1.5.6 or later. -- cgit From 6dd4a8a12b25d349b18609132dade14da6ec3cf9 Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Sat, 29 Jan 2022 17:46:45 -0500 Subject: fix item repo's handling of Journal Scraps and Secret Notes --- docs/release-notes.md | 6 ++- .../Framework/ItemRepository.cs | 62 ++++++++++++++++------ 2 files changed, 52 insertions(+), 16 deletions(-) (limited to 'docs') diff --git a/docs/release-notes.md b/docs/release-notes.md index f45df4bd..f1911716 100644 --- a/docs/release-notes.md +++ b/docs/release-notes.md @@ -2,7 +2,11 @@ # Release notes ## Upcoming release -* Improved translations. Thanks to ChulkyBow (updated Ukrainian)! +* For players: + * Improved translations. Thanks to ChulkyBow (updated Ukrainian)! + +* For console commands: + * Fixed `player_add` with Journal Scraps and Secret Notes. ## 3.13.4 Released 16 January 2022 for Stardew Valley 1.5.6 or later. diff --git a/src/SMAPI.Mods.ConsoleCommands/Framework/ItemRepository.cs b/src/SMAPI.Mods.ConsoleCommands/Framework/ItemRepository.cs index 4a57ba5a..8704a403 100644 --- a/src/SMAPI.Mods.ConsoleCommands/Framework/ItemRepository.cs +++ b/src/SMAPI.Mods.ConsoleCommands/Framework/ItemRepository.cs @@ -134,24 +134,34 @@ namespace StardewModdingAPI.Mods.ConsoleCommands.Framework { string[] fields = Game1.objectInformation[id]?.Split('/'); - // secret notes - if (id == 79) + // ring + if (id != 801 && fields?.Length >= 4 && fields[3] == "Ring") // 801 = wedding ring, which isn't an equippable ring + { + if (ShouldGet(ItemType.Ring)) + yield return this.TryCreate(ItemType.Ring, id, p => new Ring(p.ID)); + } + + // journal scrap + else if (id == 842) { if (ShouldGet(ItemType.Object)) { - foreach (SearchableItem secretNote in this.GetSecretNotes()) - yield return secretNote; + foreach (SearchableItem journalScrap in this.GetSecretNotes(isJournalScrap: true)) + yield return journalScrap; } } - // ring - else if (id != 801 && fields?.Length >= 4 && fields[3] == "Ring") // 801 = wedding ring, which isn't an equippable ring + // secret notes + else if (id == 79) { - if (ShouldGet(ItemType.Ring)) - yield return this.TryCreate(ItemType.Ring, id, p => new Ring(p.ID)); + if (ShouldGet(ItemType.Object)) + { + foreach (SearchableItem secretNote in this.GetSecretNotes(isJournalScrap: false)) + yield return secretNote; + } } - // item + // object else if (ShouldGet(ItemType.Object)) { // spawn main item @@ -184,16 +194,38 @@ namespace StardewModdingAPI.Mods.ConsoleCommands.Framework /********* ** Private methods *********/ - /// Get the individual secret note items, if any. + /// Get the individual secret note or journal scrap items. + /// Whether to get journal scraps. /// Derived from . - private IEnumerable GetSecretNotes() + private IEnumerable GetSecretNotes(bool isJournalScrap) { - foreach (int secretNoteId in this.TryLoad("Data\\SecretNotes").Keys) + // get base item ID + int baseId = isJournalScrap ? 842 : 79; + + // get secret note IDs + var ids = this + .TryLoad("Data\\SecretNotes") + .Keys + .Where(isJournalScrap + ? id => (id >= GameLocation.JOURNAL_INDEX) + : id => (id < GameLocation.JOURNAL_INDEX) + ) + .Select(isJournalScrap + ? id => (id - GameLocation.JOURNAL_INDEX) + : id => id + ); + + // build items + foreach (int id in ids) { - yield return this.TryCreate(ItemType.Object, this.CustomIDOffset + secretNoteId, _ => + int fakeId = this.CustomIDOffset * 8 + id; + if (isJournalScrap) + fakeId += GameLocation.JOURNAL_INDEX; + + yield return this.TryCreate(ItemType.Object, fakeId, _ => { - SObject note = new(79, 1); - note.name = $"{note.name} #{secretNoteId}"; + SObject note = new(baseId, 1); + note.Name = $"{note.Name} #{id}"; return note; }); } -- cgit From 3431f486a2ef93e86d8923c1a4651644110df81b Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Sat, 29 Jan 2022 18:15:42 -0500 Subject: normalize season names in SDate constructor --- docs/release-notes.md | 3 +++ src/SMAPI.Tests/Utilities/SDateTests.cs | 10 ++++++---- src/SMAPI/Utilities/SDate.cs | 4 +++- 3 files changed, 12 insertions(+), 5 deletions(-) (limited to 'docs') diff --git a/docs/release-notes.md b/docs/release-notes.md index f1911716..4ca11f01 100644 --- a/docs/release-notes.md +++ b/docs/release-notes.md @@ -5,6 +5,9 @@ * For players: * Improved translations. Thanks to ChulkyBow (updated Ukrainian)! +* For mod authors: + * The `SDate` constructor is no longer case-sensitive for season names. + * For console commands: * Fixed `player_add` with Journal Scraps and Secret Notes. diff --git a/src/SMAPI.Tests/Utilities/SDateTests.cs b/src/SMAPI.Tests/Utilities/SDateTests.cs index 0461952e..374f4921 100644 --- a/src/SMAPI.Tests/Utilities/SDateTests.cs +++ b/src/SMAPI.Tests/Utilities/SDateTests.cs @@ -16,9 +16,12 @@ namespace SMAPI.Tests.Utilities /********* ** Fields *********/ - /// All valid seasons. + /// The valid seasons. private static readonly string[] ValidSeasons = { "spring", "summer", "fall", "winter" }; + /// Sample user inputs for season names. + private static readonly string[] SampleSeasonValues = SDateTests.ValidSeasons.Concat(new[] { " WIntEr " }).ToArray(); + /// All valid days of a month. private static readonly int[] ValidDays = Enumerable.Range(1, 28).ToArray(); @@ -55,19 +58,18 @@ namespace SMAPI.Tests.Utilities ** Constructor ****/ [Test(Description = "Assert that the constructor sets the expected values for all valid dates.")] - public void Constructor_SetsExpectedValues([ValueSource(nameof(SDateTests.ValidSeasons))] string season, [ValueSource(nameof(SDateTests.ValidDays))] int day, [Values(1, 2, 100)] int year) + public void Constructor_SetsExpectedValues([ValueSource(nameof(SDateTests.SampleSeasonValues))] string season, [ValueSource(nameof(SDateTests.ValidDays))] int day, [Values(1, 2, 100)] int year) { // act SDate date = new SDate(day, season, year); // assert Assert.AreEqual(day, date.Day); - Assert.AreEqual(season, date.Season); + Assert.AreEqual(season.Trim().ToLowerInvariant(), date.Season); Assert.AreEqual(year, date.Year); } [Test(Description = "Assert that the constructor throws an exception if the values are invalid.")] - [TestCase(01, "Spring", 1)] // seasons are case-sensitive [TestCase(01, "springs", 1)] // invalid season name [TestCase(-1, "spring", 1)] // day < 0 [TestCase(0, "spring", 1)] // day zero diff --git a/src/SMAPI/Utilities/SDate.cs b/src/SMAPI/Utilities/SDate.cs index cd075dcc..e10a59f8 100644 --- a/src/SMAPI/Utilities/SDate.cs +++ b/src/SMAPI/Utilities/SDate.cs @@ -250,6 +250,8 @@ namespace StardewModdingAPI.Utilities /// One of the arguments has an invalid value (like day 35). private SDate(int day, string season, int year, bool allowDayZero) { + season = season?.Trim().ToLowerInvariant(); + // validate if (season == null) throw new ArgumentNullException(nameof(season)); @@ -277,7 +279,7 @@ namespace StardewModdingAPI.Utilities /// The year. private bool IsDayZero(int day, string season, int year) { - return day == 0 && season == "spring" && year == 1; + return day == 0 && season?.Trim().ToLower() == "spring" && year == 1; } /// Get the day of week for a given date. -- cgit From 25a9f54ecfdaf6c4ad67dfb46c3f8c556d15d949 Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Sat, 29 Jan 2022 20:43:45 -0500 Subject: fix manifest JSON schema's update key pattern --- docs/release-notes.md | 3 +++ src/SMAPI.Web/wwwroot/schemas/manifest.json | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) (limited to 'docs') diff --git a/docs/release-notes.md b/docs/release-notes.md index 4ca11f01..585644ef 100644 --- a/docs/release-notes.md +++ b/docs/release-notes.md @@ -11,6 +11,9 @@ * For console commands: * Fixed `player_add` with Journal Scraps and Secret Notes. +* For the web UI: + * Fixed JSON validator warning for update keys without a subkey. + ## 3.13.4 Released 16 January 2022 for Stardew Valley 1.5.6 or later. diff --git a/src/SMAPI.Web/wwwroot/schemas/manifest.json b/src/SMAPI.Web/wwwroot/schemas/manifest.json index b6722347..7457b993 100644 --- a/src/SMAPI.Web/wwwroot/schemas/manifest.json +++ b/src/SMAPI.Web/wwwroot/schemas/manifest.json @@ -103,7 +103,7 @@ "type": "array", "items": { "type": "string", - "pattern": "^(?i)(Chucklefish:\\d+|Nexus:\\d+|GitHub:[A-Za-z0-9_\\-]+/[A-Za-z0-9_\\-]+|ModDrop:\\d+)(?: *@ *[a-zA-Z0-9_]+ *)$", + "pattern": "^(?i)(Chucklefish:\\d+|Nexus:\\d+|GitHub:[A-Za-z0-9_\\-]+/[A-Za-z0-9_\\-]+|ModDrop:\\d+)(?: *@ *[a-zA-Z0-9_]+ *)?$", "@errorMessages": { "pattern": "Invalid update key; see https://stardewvalleywiki.com/Modding:Modder_Guide/APIs/Manifest#Update_checks for more info." } -- cgit From 4a1174cd5086ac615b9218384853a6ad2831b603 Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Fri, 11 Feb 2022 20:56:25 -0500 Subject: fix thumbstick input overrides --- docs/release-notes.md | 1 + src/SMAPI/Framework/Input/GamePadStateBuilder.cs | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) (limited to 'docs') diff --git a/docs/release-notes.md b/docs/release-notes.md index 585644ef..18187e49 100644 --- a/docs/release-notes.md +++ b/docs/release-notes.md @@ -7,6 +7,7 @@ * For mod authors: * The `SDate` constructor is no longer case-sensitive for season names. + * Fixed issue where suppressing `[Left|Right]Thumbstick[Down|Left]` keys would suppress the opposite direction instead. * For console commands: * Fixed `player_add` with Journal Scraps and Secret Notes. diff --git a/src/SMAPI/Framework/Input/GamePadStateBuilder.cs b/src/SMAPI/Framework/Input/GamePadStateBuilder.cs index b0bb7f80..3a99214f 100644 --- a/src/SMAPI/Framework/Input/GamePadStateBuilder.cs +++ b/src/SMAPI/Framework/Input/GamePadStateBuilder.cs @@ -104,10 +104,10 @@ namespace StardewModdingAPI.Framework.Input this.LeftStickPos.Y = isDown ? 1 : 0; break; case SButton.LeftThumbstickDown: - this.LeftStickPos.Y = isDown ? 1 : 0; + this.LeftStickPos.Y = isDown ? -1 : 0; break; case SButton.LeftThumbstickLeft: - this.LeftStickPos.X = isDown ? 1 : 0; + this.LeftStickPos.X = isDown ? -1 : 0; break; case SButton.LeftThumbstickRight: this.LeftStickPos.X = isDown ? 1 : 0; @@ -118,10 +118,10 @@ namespace StardewModdingAPI.Framework.Input this.RightStickPos.Y = isDown ? 1 : 0; break; case SButton.RightThumbstickDown: - this.RightStickPos.Y = isDown ? 1 : 0; + this.RightStickPos.Y = isDown ? -1 : 0; break; case SButton.RightThumbstickLeft: - this.RightStickPos.X = isDown ? 1 : 0; + this.RightStickPos.X = isDown ? -1 : 0; break; case SButton.RightThumbstickRight: this.RightStickPos.X = isDown ? 1 : 0; -- cgit From b0cc403098161ad82b858008e2523e1d2496fc41 Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Sat, 12 Feb 2022 12:07:13 -0500 Subject: add data-* attributes to log parser for external tools --- docs/release-notes.md | 1 + .../Framework/LogParsing/Models/LogModInfo.cs | 3 ++ src/SMAPI.Web/ViewModels/LogParserModel.cs | 2 +- src/SMAPI.Web/Views/LogParser/Index.cshtml | 53 ++++++++++++++-------- 4 files changed, 38 insertions(+), 21 deletions(-) (limited to 'docs') diff --git a/docs/release-notes.md b/docs/release-notes.md index 18187e49..5e004227 100644 --- a/docs/release-notes.md +++ b/docs/release-notes.md @@ -13,6 +13,7 @@ * Fixed `player_add` with Journal Scraps and Secret Notes. * For the web UI: + * Added `data-*` attributes to log parser page for external tools. * Fixed JSON validator warning for update keys without a subkey. ## 3.13.4 diff --git a/src/SMAPI.Web/Framework/LogParsing/Models/LogModInfo.cs b/src/SMAPI.Web/Framework/LogParsing/Models/LogModInfo.cs index 067e4df4..92bfe5c7 100644 --- a/src/SMAPI.Web/Framework/LogParsing/Models/LogModInfo.cs +++ b/src/SMAPI.Web/Framework/LogParsing/Models/LogModInfo.cs @@ -35,5 +35,8 @@ namespace StardewModdingAPI.Web.Framework.LogParsing.Models /// Whether the mod has an update available. public bool HasUpdate => this.UpdateVersion != null && this.Version != this.UpdateVersion; + + /// Whether the mod is a content pack for another mod. + public bool IsContentPack => !string.IsNullOrWhiteSpace(this.ContentPackFor); } } diff --git a/src/SMAPI.Web/ViewModels/LogParserModel.cs b/src/SMAPI.Web/ViewModels/LogParserModel.cs index bea79eae..0b6d7722 100644 --- a/src/SMAPI.Web/ViewModels/LogParserModel.cs +++ b/src/SMAPI.Web/ViewModels/LogParserModel.cs @@ -83,7 +83,7 @@ namespace StardewModdingAPI.Web.ViewModels // group by mod return mods - .Where(mod => mod.ContentPackFor != null) + .Where(mod => mod.IsContentPack) .GroupBy(mod => mod.ContentPackFor) .ToDictionary(group => group.Key, group => group.ToArray()); } diff --git a/src/SMAPI.Web/Views/LogParser/Index.cshtml b/src/SMAPI.Web/Views/LogParser/Index.cshtml index 993e7244..b54867b1 100644 --- a/src/SMAPI.Web/Views/LogParser/Index.cshtml +++ b/src/SMAPI.Web/Views/LogParser/Index.cshtml @@ -7,6 +7,9 @@ @{ ViewData["Title"] = "SMAPI log parser"; + + ParsedLog log = Model!.ParsedLog; + IDictionary contentPacks = Model.GetContentPacksByMod(); IDictionary defaultFilters = Enum .GetValues(typeof(LogLevel)) @@ -15,7 +18,7 @@ string curPageUrl = this.Url.PlainAction("Index", "LogParser", new { id = Model.PasteID }, absoluteUrl: true); - ISet screenIds = new HashSet(Model.ParsedLog?.Messages?.Select(p => p.ScreenId) ?? Array.Empty()); + ISet screenIds = new HashSet(log?.Messages?.Select(p => p.ScreenId) ?? Array.Empty()); } @section Head { @@ -35,9 +38,9 @@