diff --git a/Alarms/Alarms.csproj b/Alarms/Alarms.csproj index a7e1074c..c5ce7428 100644 --- a/Alarms/Alarms.csproj +++ b/Alarms/Alarms.csproj @@ -1,7 +1,7 @@  1.0.0 - net5.0 + net6.0 true AnyCPU;x64 diff --git a/Alarms/ClockSoundMenu.cs b/Alarms/ClockSoundMenu.cs index 2268f253..c30c5460 100644 --- a/Alarms/ClockSoundMenu.cs +++ b/Alarms/ClockSoundMenu.cs @@ -338,7 +338,7 @@ public override void draw(SpriteBatch b) downCC?.draw(b); if (hoverText != null && hoveredItem == null) { - drawHoverText(b, hoverText, Game1.smallFont, 0, 0, -1, null, -1, null, null, 0, -1, -1, -1, -1, 1f, null, null); + drawHoverText(b, hoverText, Game1.smallFont, 0, 0, -1, null, -1, null, null, 0, null, -1, -1, -1, 1f, null, null); } Game1.mouseCursorTransparency = 1f; drawMouse(b); diff --git a/Alarms/ModEntry.cs b/Alarms/ModEntry.cs index a0bbd2af..99bef82f 100644 --- a/Alarms/ModEntry.cs +++ b/Alarms/ModEntry.cs @@ -1,8 +1,7 @@ using HarmonyLib; -using Microsoft.Xna.Framework.Graphics; +using Newtonsoft.Json; using StardewModdingAPI; using StardewValley; -using System; using System.Collections.Generic; namespace Alarms @@ -16,6 +15,7 @@ public partial class ModEntry : Mod public static ModConfig Config; public static ModEntry context; + public static string modKey = "aedenthorn.Alarms/alarms"; /// The mod entry point, called after the mod is first loaded. /// Provides simplified APIs for writing mods. @@ -29,6 +29,8 @@ public override void Entry(IModHelper helper) SHelper = helper; Helper.Events.GameLoop.GameLaunched += GameLoop_GameLaunched; + Helper.Events.GameLoop.SaveLoaded += GameLoop_SaveLoaded; + Helper.Events.GameLoop.Saving += GameLoop_Saving; Helper.Events.Input.ButtonsChanged += Input_ButtonsChanged; Helper.Events.GameLoop.TimeChanged += GameLoop_TimeChanged; @@ -36,6 +38,22 @@ public override void Entry(IModHelper helper) harmony.PatchAll(); } + private void GameLoop_SaveLoaded(object sender, StardewModdingAPI.Events.SaveLoadedEventArgs e) + { + if(!Config.ModEnabled) + { + return; + } + if(Game1.player.modData.TryGetValue(modKey, out var dataString)) + { + ClockSoundMenu.soundList = JsonConvert.DeserializeObject>(dataString); + } + } + private void GameLoop_Saving(object sender, StardewModdingAPI.Events.SavingEventArgs e) + { + Game1.player.modData[modKey] = JsonConvert.SerializeObject(ClockSoundMenu.soundList); + } + private void Input_ButtonsChanged(object sender, StardewModdingAPI.Events.ButtonsChangedEventArgs e) { if (Context.CanPlayerMove && Game1.activeClickableMenu is null && Config.ModEnabled && Config.MenuButton.JustPressed()) diff --git a/CooperativeEggHunt/CodePatches.cs b/CooperativeEggHunt/CodePatches.cs index e0acd38e..1098f564 100644 --- a/CooperativeEggHunt/CodePatches.cs +++ b/CooperativeEggHunt/CodePatches.cs @@ -50,7 +50,7 @@ public static bool Prefix(Event __instance, HashSet ___festivalWinners) string dialogue = string.Join("#$b#", dialogueArray); var lewis = __instance.getActorByName("Lewis"); - lewis.CurrentDialogue.Push(new Dialogue(dialogue, lewis)); + lewis.CurrentDialogue.Push(new Dialogue(lewis, null, dialogue)); Game1.drawDialogue(lewis); return false; diff --git a/CooperativeEggHunt/CooperativeEggHunt.csproj b/CooperativeEggHunt/CooperativeEggHunt.csproj index bfa31608..888e34c6 100644 --- a/CooperativeEggHunt/CooperativeEggHunt.csproj +++ b/CooperativeEggHunt/CooperativeEggHunt.csproj @@ -1,7 +1,7 @@  1.0.0 - net5.0 + net6.0 true AnyCPU;x64 @@ -12,7 +12,7 @@ - + PreserveNewest diff --git a/CooperativeEggHunt/ModEntry.cs b/CooperativeEggHunt/ModEntry.cs index 83d45c52..0aa59981 100644 --- a/CooperativeEggHunt/ModEntry.cs +++ b/CooperativeEggHunt/ModEntry.cs @@ -41,7 +41,27 @@ public override void Entry(IModHelper helper) private void Content_AssetRequested(object sender, StardewModdingAPI.Events.AssetRequestedEventArgs e) { - if(Config.ModEnabled && e.NameWithoutLocale.IsEquivalentTo("Data/Festivals/spring13")) + if (!Config.ModEnabled) + return; + if (e.NameWithoutLocale.IsEquivalentTo("Characters/Dialogue/Abigail")) + { + e.Edit(delegate (IAssetData assetData) + { + var dict = assetData.AsDictionary().Data; + dict["spring_12"] = Helper.Translation.Get("Abigail_spring_12"); + }); + } + + else if (e.NameWithoutLocale.IsEquivalentTo("Characters/Dialogue/MarriageDialogueAbigail")) + { + e.Edit(delegate (IAssetData assetData) + { + var dict = assetData.AsDictionary().Data; + dict["spring_12"] = Helper.Translation.Get("MarriageDialogueAbigail_spring_12"); + }); + } + + else if (e.NameWithoutLocale.IsEquivalentTo("Data/Festivals/spring13")) { e.Edit(delegate (IAssetData assetData) { @@ -49,6 +69,9 @@ private void Content_AssetRequested(object sender, StardewModdingAPI.Events.Asse dict["mainEvent"] = $"pause 500/playMusic none/pause 500/globalFade/viewport -1000 -1000/loadActors MainEvent/warp farmer1 27 69 /warp farmer2 27 67/warp farmer3 32 67/warp farmer4 28 71/faceDirection farmer1 0/faceDirection farmer2 1/faceDirection farmer3 3/faceDirection farmer4 0/pause 1000/viewport 27 67 true unfreeze/pause 2000/speak Lewis \"{Helper.Translation.Get("mainEvent-1")}\"/pause 100/jump Jas/jump Vincent/pause 1000/speak Lewis \"{Helper.Translation.Get("mainEvent-2")}\"/pause 100/faceDirection Vincent 3 true/faceDirection Jas 1 true/pause 1000/faceDirection Vincent 0 true/faceDirection Jas 0 /pause 800/faceDirection Lewis 3/faceDirection Lewis 2/faceDirection Lewis 1/faceDirection Lewis 2/pause 800/speak Lewis \"{Helper.Translation.Get("mainEvent-3")}\"/pause 1000/waitForOtherPlayers startContest/jump Lewis/pause 1000/speak Lewis \"{Helper.Translation.Get("mainEvent-4")}\"/advancedMove Maru false -2 0 0 6 -9 0 0 -2 -9 0 0 -1 2 0 0 -12 6 0 0 -7 3 0/advancedMove Abigail false 0 21 -20 0 0 3 7 0 0 -15 -9 0 9 0 0 18/advancedMove Jas false 0 12 8 0 0 10 3 0 0 4 14 0 0 -20 -6 0 0 3/advancedMove Sam false 4 0 0 -4 2 0 0 -4 12 0 0 -6 19 0 0 20 0 -20 0 20/advancedMove Vincent false 0 3 24 0 0 21 9 0 0 4 -20 0 20 0 -20 0/advancedMove Leo false 0 -10 -1 0 0 -3 -6 0 0 -2 -3 0 0 -3 -1 0 0 20 -5 0 0 -10 -2 0/playSound whistle/playMusic tickTock/playerControl eggHunt"; dict["afterEggHunt"] = $"pause 100/playSound whistle/waitForOtherPlayers endContest/pause 1000/globalFade/viewport -1000 -1000/playMusic event1/loadActors MainEvent/warp farmer1 27 69 /warp farmer2 26 67/warp farmer3 32 67/warp farmer4 28 71/faceDirection farmer1 0/faceDirection farmer2 1/faceDirection farmer3 3/faceDirection farmer4 0/pause 1000/viewport 27 67 true/pause 2000/speak Lewis \"{Helper.Translation.Get("afterEggHunt-1")}\"/pause 800/playMusic none/speak Lewis \"{Helper.Translation.Get("afterEggHunt-2")}\"/playMusic none/pause 3000/cutscene eggHuntWinner/null/playMusic event1/pause 500/fork AbbyWin/jump Abigail/faceDirection Vincent 3/move Lewis 0 1 2/speak Lewis \"{Helper.Translation.Get("afterEggHunt-3")}\"/awardFestivalPrize/null/move Lewis 0 -1 0/speak Lewis \"{Helper.Translation.Get("afterEggHunt-4")}\"/pause 600/viewport move 1 0 5000/pause 2000/globalFade/viewport -1000 -1000/waitForOtherPlayers festivalEnd/end"; dict["AbbyWin"] = $"pause 400/speak Lewis \"{Helper.Translation.Get("afterEggHunt-4")}\"/pause 1000/viewport move 1 -1 5000/pause 2000/globalFade/viewport -1000 -1000/waitForOtherPlayers festivalEnd/end"; + dict["Maru_y2"] = Helper.Translation.Get("Maru_y2"); + dict["Sebastian_spouse"] = Helper.Translation.Get("Sebastian_spouse"); + dict["Jas_y2"] = Helper.Translation.Get("Jas_y2"); }); } } diff --git a/CooperativeEggHunt/i18n/default.json b/CooperativeEggHunt/i18n/default.json index b7e21485..07747ba5 100644 --- a/CooperativeEggHunt/i18n/default.json +++ b/CooperativeEggHunt/i18n/default.json @@ -13,6 +13,13 @@ "results-enough": "Congratulations everyone, you've found enough eggs! Everyone gets a prize!$h", "results-not-enough": "I'm sorry to say, that's not enough eggs to win. Better luck next year!", + "Maru_y2": "Think we'll win the egg hunt this year?", + "Sebastian_spouse": "I'll be rooting for you all in the egg hunt.$h", + "Jas_y2": "I'm going to try my best to make sure we win this year!", + + "Abigail_spring_12": "I'm definitely going to join the egg hunt tomorrow. Are you?", + "MarriageDialogueAbigail_spring_12": "Hey, the egg festival is tomorrow. I know it's a cooperative effort, but I won't go easy on you because we're married!$h#$e#I plan on getting the most eggs! Go ahead and try to beat me!", + // GMCM "GMCM_Option_ModEnabled_Name": "Mod Enabled", "GMCM_Option_EggsToWin_Name": "Eggs To Win", diff --git a/VoicedDialogue/ModEntry.cs b/VoicedDialogue/ModEntry.cs index 80a08819..1f1f1fd5 100644 --- a/VoicedDialogue/ModEntry.cs +++ b/VoicedDialogue/ModEntry.cs @@ -121,7 +121,7 @@ public static void PlayDialogue(Dialogue dialogue) { if (!Config.EnableMod || dialogue.speaker == null || dialogue.dialogues[dialogue.currentDialogueIndex] == currentDialogue.Value) return; - PlayDialogue(dialogue.speaker.Name, dialogue.dialogues[dialogue.currentDialogueIndex], null); // dialogue.TranslationKey + "_" + dialogue.currentDialogueIndex + PlayDialogue(dialogue.speaker.Name, dialogue.dialogues[dialogue.currentDialogueIndex], dialogue.TranslationKey + "_" + dialogue.currentDialogueIndex); } public static void PlayDialogue(string name, string dialogue, string key) { @@ -131,10 +131,10 @@ public static void PlayDialogue(string name, string dialogue, string key) { var voiceDict = SHelper.GameContent.Load>(dictPath) ?? new Dictionary(); foreach(var data in voiceDict.Values) { - if(data.speaker == name && data.dialogueString == dialogue) + if(data.speaker == name && (key == data.dialogueKey || data.dialogueString == dialogue)) { currentDialogue.Value = dialogue; - SMonitor.Log($"Dialogue found, playing voice line"); + SMonitor.Log($"Dialogue {(key == data.dialogueKey ? "key" : "string")} found, playing voice line"); try { voiceSound?.Dispose();