-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Allow earning walnuts over 130 in case of problems
1 parent
5bdf069
commit ebe381c
Showing
2 changed files
with
52 additions
and
0 deletions.
There are no files selected for viewing
42 changes: 42 additions & 0 deletions
42
StardewArchipelago/GameModifications/CodeInjections/WalnutInjections.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
using System; | ||
using System.Linq; | ||
using KaitoKid.ArchipelagoUtilities.Net.Client; | ||
using KaitoKid.ArchipelagoUtilities.Net.Interfaces; | ||
using Microsoft.Xna.Framework; | ||
using StardewValley; | ||
using StardewValley.Extensions; | ||
using StardewValley.Locations; | ||
using StardewValley.Menus; | ||
using StardewValley.Tools; | ||
|
||
namespace StardewArchipelago.GameModifications.CodeInjections | ||
{ | ||
public static class WalnutInjections | ||
{ | ||
private static ILogger _logger; | ||
private static ArchipelagoClient _archipelago; | ||
|
||
public static void Initialize(ILogger logger, ArchipelagoClient archipelago) | ||
{ | ||
_logger = logger; | ||
_archipelago = archipelago; | ||
} | ||
|
||
// public void foundWalnut(int stack = 1) | ||
public static bool FoundWalnut_NoUpperLimit_Prefix(Farmer __instance, int stack) | ||
{ | ||
try | ||
{ | ||
Game1.netWorldState.Value.GoldenWalnuts += stack; | ||
Game1.netWorldState.Value.GoldenWalnutsFound += stack; | ||
Game1.PerformActionWhenPlayerFree(__instance.showNutPickup); | ||
return false; // don't run original logic | ||
} | ||
catch (Exception ex) | ||
{ | ||
_logger.LogError($"Failed in {nameof(FoundWalnut_NoUpperLimit_Prefix)}:\n{ex}"); | ||
return true; // run original logic | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters