Skip to content

Commit

Permalink
etc
Browse files Browse the repository at this point in the history
  • Loading branch information
aedenthorn committed Nov 11, 2023
1 parent de1ac72 commit f70a828
Show file tree
Hide file tree
Showing 8 changed files with 59 additions and 11 deletions.
2 changes: 1 addition & 1 deletion Alarms/Alarms.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Version>1.0.0</Version>
<TargetFramework>net5.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<EnableHarmony>true</EnableHarmony>
<Platforms>AnyCPU;x64</Platforms>
</PropertyGroup>
Expand Down
2 changes: 1 addition & 1 deletion Alarms/ClockSoundMenu.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
22 changes: 20 additions & 2 deletions Alarms/ModEntry.cs
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -16,6 +15,7 @@ public partial class ModEntry : Mod
public static ModConfig Config;

public static ModEntry context;
public static string modKey = "aedenthorn.Alarms/alarms";

/// <summary>The mod entry point, called after the mod is first loaded.</summary>
/// <param name="helper">Provides simplified APIs for writing mods.</param>
Expand All @@ -29,13 +29,31 @@ 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;

var harmony = new Harmony(ModManifest.UniqueID);
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<List<ClockSound>>(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())
Expand Down
2 changes: 1 addition & 1 deletion CooperativeEggHunt/CodePatches.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public static bool Prefix(Event __instance, HashSet<long> ___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;
Expand Down
4 changes: 2 additions & 2 deletions CooperativeEggHunt/CooperativeEggHunt.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Version>1.0.0</Version>
<TargetFramework>net5.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<EnableHarmony>true</EnableHarmony>
<Platforms>AnyCPU;x64</Platforms>
</PropertyGroup>
Expand All @@ -12,7 +12,7 @@
</ItemGroup>

<ItemGroup>
<None Update="assets\board.png">
<None Update="i18n\fr.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="i18n\ru.json">
Expand Down
25 changes: 24 additions & 1 deletion CooperativeEggHunt/ModEntry.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,37 @@ 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<string, string>().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<string, string>().Data;
dict["spring_12"] = Helper.Translation.Get("MarriageDialogueAbigail_spring_12");
});
}

else if (e.NameWithoutLocale.IsEquivalentTo("Data/Festivals/spring13"))
{
e.Edit(delegate (IAssetData assetData)
{
var dict = assetData.AsDictionary<string, string>().Data;
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");
});
}
}
Expand Down
7 changes: 7 additions & 0 deletions CooperativeEggHunt/i18n/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
6 changes: 3 additions & 3 deletions VoicedDialogue/ModEntry.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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) {

Expand All @@ -131,10 +131,10 @@ public static void PlayDialogue(string name, string dialogue, string key) {
var voiceDict = SHelper.GameContent.Load<Dictionary<string, VoiceData>>(dictPath) ?? new Dictionary<string, VoiceData>();
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();
Expand Down

0 comments on commit f70a828

Please sign in to comment.