From af50fd114c5a0c60c8796da202a3d9ab6d6e7ae9 Mon Sep 17 00:00:00 2001 From: Mohammad Shoaib Date: Sun, 15 May 2022 15:03:04 +0530 Subject: [PATCH] Cleaned the code a bit --- stardew-access/Patches/MiniGamesPatches.cs | 23 +++++++++++----------- stardew-access/i18n/default.json | 4 +++- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/stardew-access/Patches/MiniGamesPatches.cs b/stardew-access/Patches/MiniGamesPatches.cs index ec3985d..1020aeb 100644 --- a/stardew-access/Patches/MiniGamesPatches.cs +++ b/stardew-access/Patches/MiniGamesPatches.cs @@ -13,14 +13,18 @@ namespace stardew_access.Patches { try { + if (MainClass.ModHelper == null) + return; + string toSpeak = " "; + if (___currentState == 3) { - toSpeak = "Travelling to Stardew Valley bus stop"; + toSpeak = MainClass.ModHelper.Translation.Get("intro.scene3"); } - if (___currentState == 4) + else if (___currentState == 4) { - toSpeak = "Stardew valley 0.5 miles away"; + toSpeak = MainClass.ModHelper.Translation.Get("intro.scene4"); } if (toSpeak != " " && introQuery != toSpeak) @@ -56,29 +60,26 @@ namespace stardew_access.Patches { toSpeak = MainClass.ModHelper.Translation.Get("grandpastory.scene0"); } - - if (___drawGrandpa) + else if (___drawGrandpa) { if (___grandpaSpeech.Count > 0 && ___grandpaSpeechTimer > 3000) { toSpeak = ___grandpaSpeech.Peek(); } } - if (___scene == 3) + else if (___scene == 3) { toSpeak = Game1.content.LoadString("Strings\\StringsFromCSFiles:GrandpaStory.cs.12059"); } - - if (___scene == 4) + else if (___scene == 4) { toSpeak = MainClass.ModHelper.Translation.Get("grandpastory.scene4"); } - if (___scene == 5) + else if (___scene == 5) { toSpeak = MainClass.ModHelper.Translation.Get("grandpastory.scene5"); } - - if (___scene == 6) + else if (___scene == 6) { if (___grandpaSpeechTimer > 3000) { diff --git a/stardew-access/i18n/default.json b/stardew-access/i18n/default.json index 893d9b2..cc93de8 100644 --- a/stardew-access/i18n/default.json +++ b/stardew-access/i18n/default.json @@ -6,5 +6,7 @@ "grandpastory.scene4":"Employees working in JoJa corp.", "grandpastory.scene5":"Employees in their cubicals, some of them look exhausted including yourself.", "grandpastory.scene6":"You reach your desk finding grandpa's letter.", - "grandpastory.letteropen":"Left click to open grandpa's letter" + "grandpastory.letteropen":"Left click to open grandpa's letter", + "intro.scene3":"Travelling to Stardew Valley bus stop", + "intro.scene4":"Stardew valley 0.5 miles away" } \ No newline at end of file