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})."); if (type == FishType.Ocean) { __result = __instance.getFish(millisecondsAfterNibble, bait, waterDepth, who, baitPotency, bobberTile, "Beach"); return(false); } else { // 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); } } finally { FarmPatcher.IsInPatch = false; } }
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.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 torch && torch.ParentSheetIndex == 146) { __instance.objects.Remove(campfireTile); } }
private static bool Before_GetFish(Farm __instance, float millisecondsAfterNibble, int bait, int waterDepth, Farmer who, double baitPotency, Vector2 bobberTile, ref Object __result) { if (FarmPatcher.IsInPatch || !FarmPatcher.IsSmallBeachFarm(who?.currentLocation)) { return(false); } try { FarmPatcher.IsInPatch = true; // get ocean fish if (FarmPatcher.IsOceanTile(__instance, (int)bobberTile.X, (int)bobberTile.Y)) { __result = __instance.getFish(millisecondsAfterNibble, bait, waterDepth, who, baitPotency, bobberTile, "Beach"); FarmPatcher.Monitor.VerboseLog($"Fishing ocean tile at ({bobberTile.X / Game1.tileSize}, {bobberTile.Y / Game1.tileSize})."); return(false); } // get default riverlands fish FarmPatcher.Monitor.VerboseLog($"Fishing river tile at ({bobberTile.X / Game1.tileSize}, {bobberTile.Y / Game1.tileSize})."); return(true); } finally { FarmPatcher.IsInPatch = false; } }
private static void After_CleanupBeforePlayerExit(GameLocation __instance) { if (!FarmPatcher.IsSmallBeachFarm(__instance)) { return; } // change background track if (FarmPatcher.ShouldUseBeachMusic()) { Game1.changeMusicTrack("none", music_context: Game1.MusicContext.SubLocation); } }
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; } // add campfire (derived from StardewValley.Locations.Mountain:resetSharedState Vector2 campfireTile = new Vector2(64, 22); if (!__instance.objects.ContainsKey(campfireTile)) { __instance.objects.Add(campfireTile, new Torch(campfireTile, 146, true) { IsOn = false, Fragility = Object.fragility_Indestructable }); } }