private static bool Before_GetFish(Farm __instance, float millisecondsAfterNibble, int bait, int waterDepth, Farmer?who, double baitPotency, Vector2 bobberTile, ref SObject __result) { if (FarmPatcher.IsInPatch || !FarmPatcher.IsSmallBeachFarm(who?.currentLocation)) { return(true); } try { FarmPatcher.IsInPatch = true; FishType type = FarmPatcher.GetFishType(__instance, (int)bobberTile.X, (int)bobberTile.Y); FarmPatcher.Monitor.VerboseLog($"Fishing {type.ToString().ToLower()} tile at ({bobberTile.X / Game1.tileSize}, {bobberTile.Y / Game1.tileSize})."); switch (type) { case FishType.Ocean: __result = __instance.getFish(millisecondsAfterNibble, bait, waterDepth, who, baitPotency, bobberTile, "Beach"); return(false); case FishType.River: // match riverland farm behavior __result = Game1.random.NextDouble() < 0.3 ? __instance.getFish(millisecondsAfterNibble, bait, waterDepth, who, baitPotency, bobberTile, "Forest") : __instance.getFish(millisecondsAfterNibble, bait, waterDepth, who, baitPotency, bobberTile, "Town"); return(false); default: return(true); // run original method } } finally { FarmPatcher.IsInPatch = false; } }
private static void After_ResetLocalState(GameLocation __instance) { if (!FarmPatcher.IsSmallBeachFarm(__instance)) { return; } // change background track if (FarmPatcher.ShouldUseBeachMusic()) { Game1.changeMusicTrack("ocean", music_context: Game1.MusicContext.SubLocation); } }
private static void After_ResetSharedState(GameLocation __instance) { if (!FarmPatcher.IsSmallBeachFarm(__instance)) { return; } // toggle campfire (derived from StardewValley.Locations.Mountain:resetSharedState Vector2 campfireTile = new Vector2(64, 22); if (FarmPatcher.Config.AddCampfire) { if (!__instance.objects.ContainsKey(campfireTile)) { __instance.objects.Add(campfireTile, new Torch(campfireTile, 146, true) { IsOn = false, Fragility = SObject.fragility_Indestructable }); } } else if (__instance.objects.TryGetValue(campfireTile, out SObject obj) && obj is Torch { ParentSheetIndex : 146 })