diff --git a/StardewArchipelago/Locations/CodeInjections/ArcadeMachineInjections.cs b/StardewArchipelago/Locations/CodeInjections/ArcadeMachineInjections.cs index c4189d8a6..fa2c5bb6c 100644 --- a/StardewArchipelago/Locations/CodeInjections/ArcadeMachineInjections.cs +++ b/StardewArchipelago/Locations/CodeInjections/ArcadeMachineInjections.cs @@ -72,6 +72,8 @@ public static void UpdateFruitsSummary_ExtraLives_Postfix(MineCart __instance, f { try { + SendJunimoKartLevelsBeatChecks(__instance); + var livesLeftField = _helper.Reflection.GetField(__instance, "livesLeft"); var livesLeft = livesLeftField.GetValue(); var numberExtraLives = GetJunimoKartExtraLives(); @@ -94,20 +96,7 @@ public static bool EndCutscene_JunimoKartLevelComplete_Prefix(MineCart __instanc { try { - var gamemode = _helper.Reflection.GetField(__instance, "gameMode"); - var levelsBeat = _helper.Reflection.GetField(__instance, "levelsBeat"); - if (gamemode.GetValue() != 3 || levelsBeat.GetValue() < 1) - { - return true; // run original logic - } - - if (levelsBeat.GetValue() != 7) - { - _locationChecker.AddCheckedLocation(string.Format(JK_LEVEL_LOCATION, levelsBeat.GetValue())); - return true; // run original logic - } - - _locationChecker.AddCheckedLocation(JK_VICTORY); + SendJunimoKartLevelsBeatChecks(__instance); return true; // run original logic } catch (Exception ex) @@ -117,6 +106,24 @@ public static bool EndCutscene_JunimoKartLevelComplete_Prefix(MineCart __instanc } } + private static void SendJunimoKartLevelsBeatChecks(MineCart __instance) + { + var gamemode = _helper.Reflection.GetField(__instance, "gameMode"); + var levelsBeat = _helper.Reflection.GetField(__instance, "levelsBeat"); + if (gamemode.GetValue() != 3 || levelsBeat.GetValue() < 1) + { + return; + } + + if (levelsBeat.GetValue() != 7) + { + _locationChecker.AddCheckedLocation(string.Format(JK_LEVEL_LOCATION, levelsBeat.GetValue())); + return; + } + + _locationChecker.AddCheckedLocation(JK_VICTORY); + } + private static int GetJunimoKartExtraLives() { var numberExtraLives = 6;