public static void CheckEventDay() { if (SDate.Now() == AnimalContestController.GetNextContestDate()) { DataLoader.Helper.Content.InvalidateCache("Data\\Events\\Town"); } }
public override void DoFunction(GameLocation location, int x, int y, int power, StardewValley.Farmer who) { this.CurrentParentTileIndex = InitialParentTileIndex; this.indexOfMenuItemView.Value = IndexOfMenuItemView; if (this._animal != null) { AnimalContestController.MakeAnimalParticipant(this._animal); Game1.player.removeItemFromInventory(this); } else if (this._pet != null) { AnimalContestController.MakePetParticipant(); Game1.player.removeItemFromInventory(this); } this._animal = null; this._pet = null; if (Game1.activeClickableMenu == null) { who.CanMove = true; } else { who.Halt(); } who.UsingTool = false; who.canReleaseTool = true; }
public static void skipEvent(Event __instance) { if (FarmerLoader.FarmerData != null) { AnimalContestItem lastAnimalContest = FarmerLoader.FarmerData.AnimalContestData.LastOrDefault(); if (lastAnimalContest != null && lastAnimalContest.EventId == __instance.id) { AnimalContestController.EndEvent(lastAnimalContest); } } }
public static void CheckEventDay() { CustomEvents.Clear(); if (Context.IsMainPlayer && !DataLoader.ModConfig.DisableAnimalContest && AnimalContestController.IsContestDate()) { AnimalContestController.CleanTemporaryParticipant(); CustomEvents.Add(AnimalContestEventBuilder.CreateEvent(SDate.Now())); DataLoader.Helper.Content.InvalidateCache("Data\\Events\\Town"); Game1.showGlobalMessage(Game1.content.LoadString("Strings\\StringsFromCSFiles:Game1.cs.2640", DataLoader.i18n.Get("AnimalContest.Message.Name")) + Game1.content.LoadString("Strings\\StringsFromCSFiles:Game1.cs.2637")); } }
public static void CheckUnseenEvents() { CustomEvents.ForEach(e => { var id = Convert.ToInt32(e.Key.Split('/')[0]); if (!Game1.player.eventsSeen.Contains(id)) { if (FarmerLoader.FarmerData.AnimalContestData.Find(i => i.EventId == id) is var animalContestInfo && animalContestInfo != null) { AnimalContestController.EndEvent(animalContestInfo, false); } } }); }
public static bool DoFunction(MilkPail __instance, GameLocation location, int x, int y, int power, StardewValley.Farmer who) { if (!IsInseminationSyringe(__instance)) { return(true); } string inseminationSyringeId = __instance.modData[InseminationSyringeKey]; BaseToolDoFunction(__instance, location, x, y, power, who); __instance.CurrentParentTileIndex = InitialParentTileIndex; __instance.indexOfMenuItemView.Value = IndexOfMenuItemView; Animals.TryGetValue(inseminationSyringeId, out FarmAnimal animal); if (animal != null) { who.Stamina -= ((float)4f - (float)who.FarmingLevel * 0.2f); int daysUtillBirth = ((ImpregnatableAnimalItem)DataLoader.AnimalData.GetAnimalItem(animal)).MinimumDaysUtillBirth.Value; if (!DataLoader.ModConfig.DisableContestBonus && AnimalContestController.HasFertilityBonus(animal)) { daysUtillBirth -= (int)Math.Round(daysUtillBirth / 10.0, MidpointRounding.AwayFromZero); } PregnancyController.AddPregnancy(animal, daysUtillBirth); animal.allowReproduction.Value = false; --__instance.attachments[0].Stack; if (__instance.attachments[0].Stack <= 0) { Game1.showGlobalMessage(DataLoader.i18n.Get("Tool.InseminationSyringe.ItemConsumed", new { itemName = __instance.attachments[0].DisplayName })); __instance.attachments[0] = null; } Animals[inseminationSyringeId] = (FarmAnimal)null; } if (Game1.activeClickableMenu == null) { who.CanMove = true; who.completelyStopAnimatingOrDoingAction(); } else { who.Halt(); } who.UsingTool = false; who.canReleaseTool = true; DataLoader.Helper.Reflection.GetMethod(__instance, "finish").Invoke(); return(false); }
public static bool DoFunction(MilkPail __instance, GameLocation location, int x, int y, int power, StardewValley.Farmer who) { if (!IsParticipantRibbon(__instance)) { return(true); } string participantRibbonId = __instance.modData[ParticipantRibbonKey]; BaseToolDoFunction(__instance, location, x, y, power, who); __instance.CurrentParentTileIndex = InitialParentTileIndex; __instance.indexOfMenuItemView.Value = IndexOfMenuItemView; Animals.TryGetValue(participantRibbonId, out FarmAnimal animal); if (animal != null) { AnimalContestController.MakeAnimalParticipant(animal); Game1.player.removeItemFromInventory(__instance); } else { Pets.TryGetValue(participantRibbonId, out Pet pet); if (pet != null) { AnimalContestController.MakeAnimalParticipant(pet); Game1.player.removeItemFromInventory(__instance); } } Animals[participantRibbonId] = null; Pets[participantRibbonId] = null; if (Game1.activeClickableMenu == null) { who.CanMove = true; } else { who.Halt(); } who.UsingTool = false; who.canReleaseTool = true; DataLoader.Helper.Reflection.GetMethod(__instance, "finish").Invoke(); return(false); }
public static void skipEvent(Event __instance) { try { if (__instance.id == AnimalContestEventBuilder.GetEventId(SDate.Now())) { void OnClose(Farmer who = null) { Game1.exitActiveMenu(); _shouldTimePass = true; if (Context.IsMainPlayer && FarmerLoader.FarmerData != null) { AnimalContestItem lastAnimalContest = FarmerLoader.FarmerData.AnimalContestData.LastOrDefault(); if (lastAnimalContest != null && lastAnimalContest.EventId == __instance.id) { AnimalContestController.EndEvent(lastAnimalContest); } } } if (Game1.IsMultiplayer) { Game1.player.team.SetLocalReady("animalContestEnd", ready: true); if (!Game1.player.team.IsReady("animalContestEnd")) { ReadyCheckDialog readyCheckDialog = new ReadyCheckDialog("animalContestEnd", allowCancel: false, onConfirm: OnClose); Game1.activeClickableMenu = readyCheckDialog; } else { _shouldTimePass = true; } } else { OnClose(); } } } catch (Exception e) { AnimalHusbandryModEntry.monitor.Log($"Error while skipping an event. If it was the Animal Contest, report the problem, otherwise you can ignore this message.", LogLevel.Error); AnimalHusbandryModEntry.monitor.Log($"Details of the error above: {e}", LogLevel.Trace); } }
public override void DoFunction(GameLocation location, int x, int y, int power, StardewValley.Farmer who) { this.lastUser = who; Game1.recentMultiplayerRandom = new Random((int)(short)Game1.random.Next((int)short.MinValue, 32768)); this.CurrentParentTileIndex = InitialParentTileIndex; this.indexOfMenuItemView.Value = IndexOfMenuItemView; if (this._animal != null) { who.Stamina -= ((float)4f - (float)who.FarmingLevel * 0.2f); int daysUtillBirth = ((ImpregnatableAnimalItem)DataLoader.AnimalData.GetAnimalItem(this._animal)).MinimumDaysUtillBirth.Value; if (!DataLoader.ModConfig.DisableContestBonus && AnimalContestController.HasFertilityBonus(_animal)) { daysUtillBirth -= (int)Math.Round(daysUtillBirth / 10.0, MidpointRounding.AwayFromZero); } PregnancyController.AddPregnancy(new PregnancyItem(this._animal.myID.Value, daysUtillBirth, this._animal.allowReproduction.Value)); this._animal.allowReproduction.Value = false; --this.attachments[0].Stack; if (this.attachments[0].Stack <= 0) { Game1.showGlobalMessage(DataLoader.i18n.Get("Tool.InseminationSyringe.ItemConsumed", new { itemName = this.attachments[0].DisplayName })); this.attachments[0] = (StardewValley.Object)null; } this._animal = (FarmAnimal)null; } if (Game1.activeClickableMenu == null) { who.CanMove = true; who.completelyStopAnimatingOrDoingAction(); } else { who.Halt(); } who.UsingTool = false; who.canReleaseTool = true; DataLoader.Helper.Reflection.GetMethod(this, "finish").Invoke(); }
public static void skipEvent(Event __instance) { if (__instance.id == AnimalContestEventBuilder.GetEventId(SDate.Now())) { void OnClose(Farmer who = null) { Game1.exitActiveMenu(); _shouldTimePass = true; if (Context.IsMainPlayer && FarmerLoader.FarmerData != null) { AnimalContestItem lastAnimalContest = FarmerLoader.FarmerData.AnimalContestData.LastOrDefault(); if (lastAnimalContest != null && lastAnimalContest.EventId == __instance.id) { AnimalContestController.EndEvent(lastAnimalContest); } } } if (Game1.IsMultiplayer) { Game1.player.team.SetLocalReady("animalContestEnd", ready: true); if (!Game1.player.team.IsReady("animalContestEnd")) { ReadyCheckDialog readyCheckDialog = new ReadyCheckDialog("animalContestEnd", allowCancel: false, onConfirm: OnClose); Game1.activeClickableMenu = readyCheckDialog; } else { _shouldTimePass = true; } } else { OnClose(); } } }
public override bool beginUsing(GameLocation location, int x, int y, StardewValley.Farmer who) { x = (int)who.GetToolLocation(false).X; y = (int)who.GetToolLocation(false).Y; Rectangle rectangle = new Rectangle(x - Game1.tileSize / 2, y - Game1.tileSize / 2, Game1.tileSize, Game1.tileSize); if (!DataLoader.ModConfig.DisableTreats) { if (location is Farm) { foreach (FarmAnimal farmAnimal in (location as Farm).animals.Values) { if (farmAnimal.GetBoundingBox().Intersects(rectangle)) { this._animal = farmAnimal; break; } } if (this._animal == null) { foreach (Pet pet in location.characters.Where(i => i is Pet)) { if (pet.GetBoundingBox().Intersects(rectangle)) { this._pet = pet; break; } } } } else if (location is AnimalHouse) { foreach (FarmAnimal farmAnimal in (location as AnimalHouse).animals.Values) { if (farmAnimal.GetBoundingBox().Intersects(rectangle)) { this._animal = farmAnimal; break; } } } else if (location is FarmHouse) { foreach (Pet pet in location.characters.Where(i => i is Pet)) { if (pet.GetBoundingBox().Intersects(rectangle)) { this._pet = pet; break; } } } } if (this._animal != null) { string dialogue = ""; if (this._animal.isBaby()) { dialogue = DataLoader.i18n.Get("Tool.ParticipantRibbon.CantBeBaby", new { itemName = this.attachments[0].DisplayName }); } else if (AnimalContestController.IsParticipant(this._animal)) { dialogue = DataLoader.i18n.Get("Tool.ParticipantRibbon.HasAlreadyParticipatedContest", new { itemName = this.attachments[0].DisplayName }); } else { this._animal.doEmote(8, true); this._animal.makeSound(); this._animal.pauseTimer = 200; } if (dialogue.Length > 0) { DelayedAction.showDialogueAfterDelay(dialogue, 150); this._animal = null; } } if (this._pet != null) { string dialogue = ""; if (false) { dialogue = DataLoader.i18n.Get("Tool.ParticipantRibbon.PetCantCondition"); } else { this._pet.doEmote(8, true); this._pet.playContentSound(); _pet.Halt(); _pet.CurrentBehavior = 0; _pet.Halt(); _pet.Sprite.setCurrentAnimation(new List <FarmerSprite.AnimationFrame>() { new FarmerSprite.AnimationFrame(18, 200) }); } if (dialogue.Length > 0) { DelayedAction.showDialogueAfterDelay(dialogue, 150); this._pet = null; } } who.Halt(); int currentFrame = who.FarmerSprite.currentFrame; if (this._animal != null || this._pet != null) { switch (who.FacingDirection) { case 0: who.FarmerSprite.animateOnce(new FarmerSprite.AnimationFrame[1] { new FarmerSprite.AnimationFrame(62, 200, false, false, new AnimatedSprite.endOfAnimationBehavior(StardewValley.Farmer.useTool), true) }); break; case 1: who.FarmerSprite.animateOnce(new FarmerSprite.AnimationFrame[1] { new FarmerSprite.AnimationFrame(58, 200, false, false, new AnimatedSprite.endOfAnimationBehavior(StardewValley.Farmer.useTool), true) }); break; case 2: who.FarmerSprite.animateOnce(new FarmerSprite.AnimationFrame[1] { new FarmerSprite.AnimationFrame(54, 200, false, false, new AnimatedSprite.endOfAnimationBehavior(StardewValley.Farmer.useTool), true) }); break; case 3: who.FarmerSprite.animateOnce(new FarmerSprite.AnimationFrame[1] { new FarmerSprite.AnimationFrame(58, 200, false, true, new AnimatedSprite.endOfAnimationBehavior(StardewValley.Farmer.useTool), true) }); break; } } else { who.FarmerSprite.animateOnce(new FarmerSprite.AnimationFrame[1] { new FarmerSprite.AnimationFrame(currentFrame, 0, false, who.FacingDirection == 3, new AnimatedSprite.endOfAnimationBehavior(StardewValley.Farmer.useTool), true) }); } who.FarmerSprite.oldFrame = currentFrame; who.UsingTool = true; who.CanMove = false; return(true); }
public static void addSpecificTemporarySprite(Event __instance, ref string key, GameLocation location, string[] split) { if (!key.StartsWith("animalContest")) { return; } if (key == "animalContest") { String outdoorsTextureName = null; switch (SDate.Now().Season) { case "spring": outdoorsTextureName = spring_outdoorsTileSheetName; break; case "summer": outdoorsTextureName = summer_outdoorsTileSheetName; break; case "fall": outdoorsTextureName = fall_outdoorsTileSheetName; break; case "winter": outdoorsTextureName = winter_outdoorsTileSheetName; break; } location.TemporarySprites.Add(new TemporaryAnimatedSprite(DataLoader.LooseSpritesName, new Rectangle(84, 0, 98, 79), 9999f, 1, 999, new Vector2(26f, 59f) * (float)Game1.tileSize, false, false, (float)(59 * Game1.tileSize) / 10000f, 0.0f, Color.White, (float)Game1.pixelZoom, 0.0f, 0.0f, 0.0f, false)); //Outdoors Rectangle singleFeed = new Rectangle(304, 144, 16, 32); Rectangle doubleFeed = new Rectangle(320, 128, 32, 32); Rectangle water = new Rectangle(288, 112, 32, 32); Rectangle create = new Rectangle(288, 144, 16, 32); //LooseSprites Rectangle TopLeft = new Rectangle(0, 44, 16, 16); Rectangle TopCenter = new Rectangle(16, 44, 16, 16); Rectangle TopRight = new Rectangle(32, 44, 16, 16); Rectangle CenterLeft = new Rectangle(0, 60, 16, 16); Rectangle CenterCenter = new Rectangle(16, 60, 16, 16); Rectangle CenterRight = new Rectangle(32, 60, 16, 16); Rectangle BottonLeft = new Rectangle(0, 76, 16, 16); Rectangle BottonCenter = new Rectangle(16, 76, 16, 16); Rectangle BottonRight = new Rectangle(32, 76, 16, 16); Rectangle LeftUp = new Rectangle(48, 44, 16, 16); Rectangle RightUp = new Rectangle(64, 44, 16, 16); Rectangle LeftDown = new Rectangle(48, 60, 16, 16); Rectangle RightDown = new Rectangle(64, 60, 16, 16); addTemporarySprite(location, outdoorsTextureName, doubleFeed, 24, 62); addTemporarySprite(location, outdoorsTextureName, water, 32, 62); addTemporarySprite(location, outdoorsTextureName, singleFeed, 34, 62); addTemporarySprite(location, outdoorsTextureName, create, 23, 62); addTemporarySprite(location, DataLoader.LooseSpritesName, TopLeft, 22, 64); addTemporarySprite(location, DataLoader.LooseSpritesName, TopRight, 23, 64); addTemporarySprite(location, DataLoader.LooseSpritesName, TopLeft, 24, 64); addTemporarySprite(location, DataLoader.LooseSpritesName, TopCenter, 25, 64); addTemporarySprite(location, DataLoader.LooseSpritesName, TopCenter, 26, 64); addTemporarySprite(location, DataLoader.LooseSpritesName, TopCenter, 27, 64); addTemporarySprite(location, DataLoader.LooseSpritesName, TopCenter, 28, 64); addTemporarySprite(location, DataLoader.LooseSpritesName, TopCenter, 29, 64); addTemporarySprite(location, DataLoader.LooseSpritesName, TopCenter, 30, 64); addTemporarySprite(location, DataLoader.LooseSpritesName, TopCenter, 31, 64); addTemporarySprite(location, DataLoader.LooseSpritesName, TopRight, 32, 64); addTemporarySprite(location, DataLoader.LooseSpritesName, TopLeft, 33, 64); addTemporarySprite(location, DataLoader.LooseSpritesName, TopCenter, 34, 64); addTemporarySprite(location, DataLoader.LooseSpritesName, TopRight, 35, 64); addTemporarySprite(location, DataLoader.LooseSpritesName, CenterLeft, 22, 65); addTemporarySprite(location, DataLoader.LooseSpritesName, RightUp, 23, 65); addTemporarySprite(location, DataLoader.LooseSpritesName, LeftUp, 24, 65); addTemporarySprite(location, DataLoader.LooseSpritesName, CenterCenter, 25, 65); addTemporarySprite(location, DataLoader.LooseSpritesName, CenterCenter, 26, 65); addTemporarySprite(location, DataLoader.LooseSpritesName, CenterCenter, 27, 65); addTemporarySprite(location, DataLoader.LooseSpritesName, CenterCenter, 28, 65); addTemporarySprite(location, DataLoader.LooseSpritesName, CenterCenter, 29, 65); addTemporarySprite(location, DataLoader.LooseSpritesName, CenterCenter, 30, 65); addTemporarySprite(location, DataLoader.LooseSpritesName, CenterCenter, 31, 65); addTemporarySprite(location, DataLoader.LooseSpritesName, CenterRight, 32, 65); addTemporarySprite(location, DataLoader.LooseSpritesName, CenterLeft, 33, 65); addTemporarySprite(location, DataLoader.LooseSpritesName, CenterCenter, 34, 65); addTemporarySprite(location, DataLoader.LooseSpritesName, CenterRight, 35, 65); addTemporarySprite(location, DataLoader.LooseSpritesName, CenterLeft, 22, 66); addTemporarySprite(location, DataLoader.LooseSpritesName, CenterCenter, 23, 66); addTemporarySprite(location, DataLoader.LooseSpritesName, CenterCenter, 24, 66); addTemporarySprite(location, DataLoader.LooseSpritesName, CenterCenter, 25, 66); addTemporarySprite(location, DataLoader.LooseSpritesName, CenterCenter, 26, 66); addTemporarySprite(location, DataLoader.LooseSpritesName, CenterCenter, 27, 66); addTemporarySprite(location, DataLoader.LooseSpritesName, CenterCenter, 28, 66); addTemporarySprite(location, DataLoader.LooseSpritesName, CenterCenter, 29, 66); addTemporarySprite(location, DataLoader.LooseSpritesName, CenterCenter, 30, 66); addTemporarySprite(location, DataLoader.LooseSpritesName, CenterCenter, 31, 66); addTemporarySprite(location, DataLoader.LooseSpritesName, CenterRight, 32, 66); addTemporarySprite(location, DataLoader.LooseSpritesName, CenterLeft, 33, 66); addTemporarySprite(location, DataLoader.LooseSpritesName, CenterCenter, 34, 66); addTemporarySprite(location, DataLoader.LooseSpritesName, CenterRight, 35, 66); addTemporarySprite(location, DataLoader.LooseSpritesName, CenterLeft, 22, 67); addTemporarySprite(location, DataLoader.LooseSpritesName, CenterCenter, 23, 67); addTemporarySprite(location, DataLoader.LooseSpritesName, RightDown, 24, 67); addTemporarySprite(location, DataLoader.LooseSpritesName, LeftDown, 25, 67); addTemporarySprite(location, DataLoader.LooseSpritesName, CenterCenter, 26, 67); addTemporarySprite(location, DataLoader.LooseSpritesName, CenterCenter, 27, 67); addTemporarySprite(location, DataLoader.LooseSpritesName, CenterCenter, 28, 67); addTemporarySprite(location, DataLoader.LooseSpritesName, CenterCenter, 29, 67); addTemporarySprite(location, DataLoader.LooseSpritesName, CenterCenter, 30, 67); addTemporarySprite(location, DataLoader.LooseSpritesName, RightDown, 31, 67); addTemporarySprite(location, DataLoader.LooseSpritesName, BottonRight, 32, 67); addTemporarySprite(location, DataLoader.LooseSpritesName, CenterLeft, 33, 67); addTemporarySprite(location, DataLoader.LooseSpritesName, CenterCenter, 34, 67); addTemporarySprite(location, DataLoader.LooseSpritesName, CenterRight, 35, 67); addTemporarySprite(location, DataLoader.LooseSpritesName, BottonLeft, 22, 68); addTemporarySprite(location, DataLoader.LooseSpritesName, BottonCenter, 23, 68); addTemporarySprite(location, DataLoader.LooseSpritesName, BottonRight, 24, 68); addTemporarySprite(location, DataLoader.LooseSpritesName, TopLeft, 24, 68); addTemporarySprite(location, DataLoader.LooseSpritesName, BottonLeft, 25, 68); addTemporarySprite(location, DataLoader.LooseSpritesName, TopRight, 25, 68); addTemporarySprite(location, DataLoader.LooseSpritesName, BottonCenter, 26, 68); addTemporarySprite(location, DataLoader.LooseSpritesName, BottonCenter, 27, 68); addTemporarySprite(location, DataLoader.LooseSpritesName, BottonCenter, 28, 68); addTemporarySprite(location, DataLoader.LooseSpritesName, BottonCenter, 29, 68); addTemporarySprite(location, DataLoader.LooseSpritesName, BottonCenter, 30, 68); addTemporarySprite(location, DataLoader.LooseSpritesName, BottonRight, 31, 68); addTemporarySprite(location, DataLoader.LooseSpritesName, BottonLeft, 33, 68); addTemporarySprite(location, DataLoader.LooseSpritesName, BottonCenter, 34, 68); addTemporarySprite(location, DataLoader.LooseSpritesName, BottonRight, 35, 68); addTemporarySprite(location, DataLoader.LooseSpritesName, BottonLeft, 24, 69); addTemporarySprite(location, DataLoader.LooseSpritesName, BottonRight, 25, 69); } else if (key == "animalContestJoshDogSteak") { location.removeTemporarySpritesWithID(10); location.TemporarySprites.Add(new TemporaryAnimatedSprite(looseSprites_cursorsName, new Microsoft.Xna.Framework.Rectangle(324, 1936, 12, 20), 80f, 4, 99999, new Vector2(31f, 65f) * (float)Game1.tileSize + new Vector2(3f, 3f) * 4f, false, false, (float)((66 * Game1.tileSize) / 10000f) + 0.00002f, 0.0f, Color.White, (float)Game1.pixelZoom, 0.0f, 0.0f, 0.0f, false) { id = 11f }); location.TemporarySprites.Add(new TemporaryAnimatedSprite(looseSprites_cursorsName, new Microsoft.Xna.Framework.Rectangle(497, 1918, 11, 11), 999f, 1, 9999, new Vector2(30f, 66f) * (float)Game1.tileSize + new Vector2(32f, -8f), false, false, 1f, 0.0f, Color.White, (float)Game1.pixelZoom, 0.0f, 0.0f, 0.0f, false) { id = 12f }); } else if (key == "animalContestJoshDogOut") { location.removeTemporarySpritesWithID(1); location.removeTemporarySpritesWithID(12); location.removeTemporarySpritesWithID(11); location.TemporarySprites.Add(new TemporaryAnimatedSprite(looseSprites_cursorsName, new Microsoft.Xna.Framework.Rectangle(324, 1916, 12, 20), 500f, 6, 9999, new Vector2(31f, 65f) * (float)Game1.tileSize + new Vector2(3f, 3f) * 4f, false, false, (float)((66 * Game1.tileSize) / 10000f) + 0.00002f, 0.0f, Color.White, (float)Game1.pixelZoom, 0.0f, 0.0f, 0.0f, false) { id = 10f }); } else if (key == "animalContestJoshDog") { String townTextureName = null; switch (SDate.Now().Season) { case "spring": townTextureName = spring_towntName; break; case "summer": townTextureName = summer_towntName; break; case "fall": townTextureName = fall_towntName; break; case "winter": townTextureName = winter_towntName; break; } location.TemporarySprites.Add(new TemporaryAnimatedSprite(townTextureName, new Microsoft.Xna.Framework.Rectangle(208, 0, 16, 32), 9999f, 1, 999 , new Vector2(31, 64) * (float)Game1.tileSize, false, false, (float)(65 * Game1.tileSize) / 10000f, 0.0f, Color.White, (float)Game1.pixelZoom, 0.0f, 0.0f, 0.0f, false)); Action <int> addDogEyes = null; void AddDogEyesHidden(int x) { location.TemporarySprites.Add(new TemporaryAnimatedSprite(townTextureName, new Microsoft.Xna.Framework.Rectangle(192, 0, 16, 16), 1000f, 1, 8, new Vector2(31f, 65f) * (float)Game1.tileSize, false, false, (float)((66 * Game1.tileSize) / 10000f) - 0.01f, 0.0f, Color.White, (float)Game1.pixelZoom, 0.0f, 0.0f, 0.0f, false) { id = 1, endFunction = new TemporaryAnimatedSprite.endBehavior(addDogEyes) }); } addDogEyes = (int x) => { location.TemporarySprites.Add(new TemporaryAnimatedSprite(townTextureName, new Microsoft.Xna.Framework.Rectangle(192, 0, 16, 16), 1000f, 1, 1, new Vector2(31f, 65f) * (float)Game1.tileSize, false, false, (float)((66 * Game1.tileSize) / 10000f) + 0.00002f, 0.0f, Color.White, (float)Game1.pixelZoom, 0.0f, 0.0f, 0.0f, false) { id = 1, endFunction = new TemporaryAnimatedSprite.endBehavior((Action <int>)AddDogEyesHidden) }); }; AddDogEyesHidden(0); } else if (key == "animalContestFrogShow") { location.TemporarySprites.Add(new TemporaryAnimatedSprite(tileSheets_critters, new Microsoft.Xna.Framework.Rectangle(0, 240, 16, 16), 500f, 1, 9999, new Vector2(29f, 64f) * (float)Game1.tileSize + FrogOffset * 4f, false, false, (float)((64 * Game1.tileSize) / 10000f) + 0.00002f, 0.0f, Color.White, (float)Game1.pixelZoom, 0.0f, 0.0f, 0.0f, false) { id = 2 }); } else if (key == "animalContestFrogCroak") { location.TemporarySprites.Add(new TemporaryAnimatedSprite(tileSheets_critters, new Microsoft.Xna.Framework.Rectangle(64, 240, 16, 16), 100f, 4, 1, new Vector2(29f, 64f) * (float)Game1.tileSize + FrogOffset * 4f, false, false, (float)((64 * Game1.tileSize) / 10000f) + 0.00003f, 0.0f, Color.White, (float)Game1.pixelZoom, 0.0f, 0.0f, 0.0f, false)); } else if (key == "animalContestFrogRun") { location.removeTemporarySpritesWithID(2); location.TemporarySprites.Add(new TemporaryAnimatedSprite(tileSheets_critters, new Microsoft.Xna.Framework.Rectangle(0, 240, 16, 16), 100f, 4, 5, new Vector2(29f, 64f) * (float)Game1.tileSize + FrogOffset * 4f, false, false, (float)((64 * Game1.tileSize) / 10000f) + 0.00002f, 0.0f, Color.White, (float)Game1.pixelZoom, 0.0f, 0.0f, 0.0f, false) { motion = new Vector2(5f, 0f) }); } else if (key == "animalContestSquirrelShow") { Action <int> addStillSquirrel = null; void AddNimbleSquirrel(int x) { location.TemporarySprites.Add(new TemporaryAnimatedSprite(tileSheets_critters, new Microsoft.Xna.Framework.Rectangle(0, 192, 32, 32), 200f, 2, 4, new Vector2(29f, 64f) * (float)Game1.tileSize + SquirrelOffset * 4f, false, false, (float)((64 * Game1.tileSize) / 10000f) + 0.00002f, 0.0f, Color.White, (float)Game1.pixelZoom, 0.0f, 0.0f, 0.0f, false) { id = 3, endFunction = new TemporaryAnimatedSprite.endBehavior(addStillSquirrel) }); } addStillSquirrel = (int x) => { location.TemporarySprites.Add(new TemporaryAnimatedSprite(tileSheets_critters, new Microsoft.Xna.Framework.Rectangle(0, 192, 32, 32), 2500f, 1, 1, new Vector2(29f, 64f) * (float)Game1.tileSize + SquirrelOffset * 4f, false, false, (float)((64 * Game1.tileSize) / 10000f) + 0.00002f, 0.0f, Color.White, (float)Game1.pixelZoom, 0.0f, 0.0f, 0.0f, false) { id = 3, endFunction = new TemporaryAnimatedSprite.endBehavior((Action <int>)AddNimbleSquirrel) }); }; AddNimbleSquirrel(0); } else if (key == "animalContestSquirrelRun") { location.removeTemporarySpritesWithID(3); location.TemporarySprites.Add(new TemporaryAnimatedSprite(tileSheets_critters, new Microsoft.Xna.Framework.Rectangle(64, 192, 32, 32), 50f, 6, 8, new Vector2(29f, 64f) * (float)Game1.tileSize + SquirrelOffset * 4f, false, false, (float)((64 * Game1.tileSize) / 10000f) + 0.00002f, 0.0f, Color.White, (float)Game1.pixelZoom, 0.0f, 0.0f, 0.0f, false) { motion = new Vector2(5f, 0f) }); } else if (key == "animalContestBirdShow") { Action <int> addSleepBird = null; void AddStillBird(int x) { location.TemporarySprites.Add(new TemporaryAnimatedSprite(tileSheets_critters, new Microsoft.Xna.Framework.Rectangle(160, 64, 32, 32), 2500f, 1, 1, new Vector2(29f, 64f) * (float)Game1.tileSize + BirdOffset * 4f, false, true, (float)((64 * Game1.tileSize) / 10000f) + 0.00002f, 0.0f, Color.White, (float)Game1.pixelZoom, 0.0f, 0.0f, 0.0f, false) { id = 4, endFunction = new TemporaryAnimatedSprite.endBehavior(addSleepBird) }); } addSleepBird = (int x) => { location.TemporarySprites.Add(new TemporaryAnimatedSprite(tileSheets_critters, new Microsoft.Xna.Framework.Rectangle(0, 96, 32, 32), 1500f, 1, 1, new Vector2(29f, 64f) * (float)Game1.tileSize + BirdOffset * 4f, false, true, (float)((64 * Game1.tileSize) / 10000f) + 0.00002f, 0.0f, Color.White, (float)Game1.pixelZoom, 0.0f, 0.0f, 0.0f, false) { id = 4, endFunction = new TemporaryAnimatedSprite.endBehavior((Action <int>)AddStillBird) }); }; AddStillBird(0); } else if (key == "animalContestWildBird") { Action <int> addSleepBird = null; void AddStillBird(int x) { location.TemporarySprites.Add(new TemporaryAnimatedSprite(tileSheets_critters, new Microsoft.Xna.Framework.Rectangle(160, 128, 32, 32), 2500f, 1, 1, new Vector2(34f, 66f) * (float)Game1.tileSize + BirdOffset * 4f, false, true, (float)((64 * Game1.tileSize) / 10000f) + 0.00002f, 0.0f, Color.White, (float)Game1.pixelZoom, 0.0f, 0.0f, 0.0f, false) { id = 7, endFunction = new TemporaryAnimatedSprite.endBehavior(addSleepBird) }); } addSleepBird = (int x) => { location.TemporarySprites.Add(new TemporaryAnimatedSprite(tileSheets_critters, new Microsoft.Xna.Framework.Rectangle(0, 160, 32, 32), 1500f, 1, 1, new Vector2(34f, 66f) * (float)Game1.tileSize + BirdOffset * 4f, false, true, (float)((64 * Game1.tileSize) / 10000f) + 0.00002f, 0.0f, Color.White, (float)Game1.pixelZoom, 0.0f, 0.0f, 0.0f, false) { id = 7, endFunction = new TemporaryAnimatedSprite.endBehavior((Action <int>)AddStillBird) }); }; AddStillBird(0); } else if (key == "animalContestBirdFly2") { location.removeTemporarySpritesWithID(4); location.TemporarySprites.Add(new TemporaryAnimatedSprite(tileSheets_critters, new Microsoft.Xna.Framework.Rectangle(32, 96, 32, 32), 60f, 3, 18, new Vector2(29f, 64f) * (float)Game1.tileSize + BirdOffset * 4f, false, true, (float)((64 * Game1.tileSize) / 10000f) + 0.00003f, 0.0f, Color.White, (float)Game1.pixelZoom, 0.0f, 0.0f, 0.0f, false) { pingPong = true, motion = new Vector2(6f, -1f) }); } else if (key == "animalContestBirdFly") { location.removeTemporarySpritesWithID(4); int count = 18; Action <int> addBirdFlap = null; TemporaryAnimatedSprite lastSprite = null; void AddBirdFly(int x) { if (count == 0) { return; } Game1.playSound("batFlap"); Vector2 position = lastSprite == null ? new Vector2(29f, 64f) * (float)Game1.tileSize + BirdOffset * 4f : lastSprite.Position; lastSprite = new TemporaryAnimatedSprite(tileSheets_critters, new Microsoft.Xna.Framework.Rectangle(32, 96, 32, 32), 60f, 3, 1, position, false, true, (float)((64 * Game1.tileSize) / 10000f) + 0.00003f, 0.0f, Color.White, (float)Game1.pixelZoom, 0.0f, 0.0f, 0.0f, false) { endFunction = new TemporaryAnimatedSprite.endBehavior(addBirdFlap), motion = new Vector2(6f, -1.3f) }; location.TemporarySprites.Add(lastSprite); count--; } addBirdFlap = (int x) => { lastSprite = new TemporaryAnimatedSprite(tileSheets_critters, new Microsoft.Xna.Framework.Rectangle(64, 96, 32, 32), 60f, 1, 1, lastSprite.Position, false, true, (float)((64 * Game1.tileSize) / 10000f) + 0.00003f, 0.0f, Color.White, (float)Game1.pixelZoom, 0.0f, 0.0f, 0.0f, false) { endFunction = new TemporaryAnimatedSprite.endBehavior((Action <int>)AddBirdFly), motion = new Vector2(6f, -1.3f) }; location.TemporarySprites.Add(lastSprite); }; AddBirdFly(0); } else if (key == "animalContestRabbitShow") { bool flipped = split.Length > 4 && Convert.ToBoolean(split[4]); location.TemporarySprites.Add(new TemporaryAnimatedSprite(tileSheets_critters, new Microsoft.Xna.Framework.Rectangle(256, 192, 32, 32), 9999f, 1, 999, new Vector2(Convert.ToSingle(split[2]), Convert.ToSingle(split[3])) * (float)Game1.tileSize + new Vector2(flipped? -7f: -10f, -20f) * 4f, false, flipped, (float)((64 * Game1.tileSize) / 10000f) + 0.00002f, 0.0f, Color.White, (float)Game1.pixelZoom, 0.0f, 0.0f, 0.0f, false) { id = split.Length > 5 ? 5 : 0 }); } else if (key == "animalContestRabbitRun") { location.removeTemporarySpritesWithID(5); location.TemporarySprites.Add(new TemporaryAnimatedSprite(tileSheets_critters, new Microsoft.Xna.Framework.Rectangle(128, 160, 32, 32), 45f, 6, 14, new Vector2(29f, 64f) * (float)Game1.tileSize + new Vector2(-10f, -20f) * 4f, false, false, (float)((64 * Game1.tileSize) / 10000f) + 0.00002f, 0.0f, Color.White, (float)Game1.pixelZoom, 0.0f, 0.0f, 0.0f, false) { motion = new Vector2(6f, 0f) }); } else if (key == "animalContestEmilyParrot") { location.TemporarySprites.Add(new TemporaryAnimatedSprite(townInterior, new Microsoft.Xna.Framework.Rectangle(464, 1056, 16, 32), 9999f, 1, 999, new Vector2(34f, 65f) * (float)Game1.tileSize, false, false, 0.000001f, 0.0f, Color.White, (float)Game1.pixelZoom, 0.0f, 0.0f, 0.0f, false)); location.TemporarySprites.Add(new EmilysParrot(new Vector2(34, 64) * (float)Game1.tileSize + new Vector2(4f, 8f) * 4f)); } else if (key == "animalContestEmilyParrotAction") { if (location.getTemporarySpriteByID(5858585) is EmilysParrot emilysParrot) { emilysParrot.doAction(); } } else if (key == "animalContestEmilyBoomBox") { location.TemporarySprites.Add(new TemporaryAnimatedSprite(looseSprites_cursorsName, new Microsoft.Xna.Framework.Rectangle(586, 1871, 24, 14), 9999f, 1, 999, new Vector2(33f, 65f) * (float)Game1.tileSize, false, false, 0.0000009f, 0.0f, Color.White, (float)Game1.pixelZoom, 0.0f, 0.0f, 0.0f, false) { id = 6 }); } else if (key == "animalContestEmilyBoomBoxStart") { location.getTemporarySpriteByID(6).pulse = true; location.getTemporarySpriteByID(6).pulseTime = 420f; } else if (key == "animalContestEmilyBoomBoxStop") { location.getTemporarySpriteByID(6).pulse = false; location.getTemporarySpriteByID(6).scale = 4f; } else if (key == "animalContestEmilyParrotDance") { if (location.getTemporarySpriteByID(5858585) is EmilysParrot emilysParrot) { Vector2 position = emilysParrot.initialPosition; location.removeTemporarySpritesWithID(5858585); location.TemporarySprites.Add(new EmilysParrotDancer(position)); } } else if (key == "animalContestEmilyParrotStopDance") { if (location.getTemporarySpriteByID(5858586) is EmilysParrotDancer emilysParrotDancer) { Vector2 position = emilysParrotDancer.initialPosition; location.removeTemporarySpritesWithID(5858586); location.TemporarySprites.Add(new EmilysParrot(position)); } } else if (key == "animalContestMaruRobot") { location.TemporarySprites.Add(new TemporaryAnimatedSprite(townInterior, new Microsoft.Xna.Framework.Rectangle(448, 576, 16, 16), 9999f, 1, 999, new Vector2(31f, 66f) * (float)Game1.tileSize, false, false, 0.000001f, 0.0f, Color.White, (float)Game1.pixelZoom, 0.0f, 0.0f, 0.0f, false)); } else if (key == "animalContestAbigailSlime") { __instance.actors.Add(new EventGreenSlime(new Vector2(31f, 66f) * (float)Game1.tileSize, 5)); } else if (key == "animalContestWillyCrab") { location.TemporarySprites.Add(new TemporaryAnimatedSprite(looseSprites_temporary_sprites_1, new Microsoft.Xna.Framework.Rectangle(259, 146, 18, 18), 250f, 3, 99999, new Vector2(31f, 66f) * (float)Game1.tileSize + CrabOffset * 4f, false, false, 0.000001f, 0.0f, Color.White, (float)Game1.pixelZoom, 0.0f, 0.0f, 0.0f, false) { pingPong = true }); } else if (key == "animalContestMarnieWinning") { location.TemporarySprites.Add(new TemporaryAnimatedSprite(looseSprites_cursorsName, new Microsoft.Xna.Framework.Rectangle(558, 1425, 20, 26), 400f, 3, 99999, new Vector2(24f, 65f) * 64f, false, false, 0.416f, 0.0f, Color.White, 4f, 0.0f, 0.0f, 0.0f, false) { pingPong = true }); } else if (key == "animalContestEnding") { AnimalContestController.EndEvent(FarmerLoader.FarmerData.AnimalContestData.Last()); } }
public void LoadMail() { string meatCleaverText = DataLoader.i18n.Get(DataLoader.ModConfig.Softmode ? "Tool.MeatCleaver.Letter.Soft" : "Tool.MeatCleaver.Letter"); string meatCleaverTitle = DataLoader.i18n.Get(DataLoader.ModConfig.Softmode ? "Tool.MeatCleaver.Letter.Soft.Title" : "Tool.MeatCleaver.Letter.Title"); bool HasAnimal() { return(Game1.locations.Any((location) => { if (location is Farm farm) { return farm.buildings .Any((b => (b.indoors.Value as AnimalHouse)?.animalsThatLiveHere.Count > 0)); } return false; })); } bool MeatCleaverCondition(Letter l) { return(!DataLoader.ModConfig.DisableMeatToolLetter && HasAnimal() && (!ItemUtility.HasModdedItem(MeatCleaverOverrides.MeatCleaverKey) || !Game1.player.mailReceived.Contains(l.Id))); } List <string> validBuildingsForInsemination = new List <string>(new string[] { "Deluxe Barn", "Big Barn", "Deluxe Coop" }); bool InseminationSyringeCondition(Letter l) { bool hasAnimalInValidBuildings = Game1.locations.Any((location) => { if (location is Farm farm) { return(farm.buildings .Any((b) => (b.indoors.Value as AnimalHouse)?.animalsThatLiveHere.Count > 0 && validBuildingsForInsemination.Contains(((AnimalHouse)b.indoors.Value)?.Name))); } return(false); }); return(hasAnimalInValidBuildings && (!ItemUtility.HasModdedItem(InseminationSyringeOverrides.InseminationSyringeKey) || !Game1.player.mailReceived.Contains(l.Id))); } bool FeedingBasketCondition(Letter l) { return(!Game1.player.mailReceived.Contains(l.Id) && Game1.player.getFriendshipHeartLevelForNPC("Marnie") >= 2 && (Game1.player.hasPet() || HasAnimal())); } bool FeedingBasketRedeliveryCondition(Letter l) { return(Game1.player.mailReceived.Contains("feedingBasket") && !ItemUtility.HasModdedItem(FeedingBasketOverrides.FeedingBasketKey) && Game1.player.getFriendshipHeartLevelForNPC("Marnie") >= 6); } if (!DataLoader.ModConfig.DisableMeat) { Letter meatCleaverLetter = new Letter("meatCleaver", meatCleaverText, new List <Item> { ToolsFactory.GetMeatCleaver() }, MeatCleaverCondition, (l) => { if (!Game1.player.mailReceived.Contains(l.Id)) { Game1.player.mailReceived.Add(l.Id); } }) { GroupId = "AHM.InterdimentionalFriend", Title = meatCleaverTitle }; meatCleaverLetter.LetterTexture = _customLetterBG; meatCleaverLetter.TextColor = 4; MailDao.SaveLetter(meatCleaverLetter); } if (!DataLoader.ModConfig.DisablePregnancy) { Letter inseminationSyringeLetter = new Letter("inseminationSyringe", DataLoader.i18n.Get("Tool.InseminationSyringe.Letter"), new List <Item> { ToolsFactory.GetInseminationSyringe() }, InseminationSyringeCondition, (l) => { if (!Game1.player.mailReceived.Contains(l.Id)) { Game1.player.mailReceived.Add(l.Id); } }) { GroupId = "AHM.InterdimentionalFriend", Title = DataLoader.i18n.Get("Tool.InseminationSyringe.Letter.Title") }; inseminationSyringeLetter.LetterTexture = _customLetterBG; inseminationSyringeLetter.TextColor = 4; MailDao.SaveLetter(inseminationSyringeLetter); } if (!DataLoader.ModConfig.DisableAnimalContest) { MailDao.SaveLetter ( new Letter ( "participantRibbon" , DataLoader.i18n.Get("Tool.ParticipantRibbon.Letter") , new List <Item> { ToolsFactory.GetParticipantRibbon() } , (l) => SDate.Now().AddDays(1).Equals(AnimalContestController.GetNextContestDate()) && AnimalContestController.GetContestCount() == 0 && !Game1.player.mailReceived.Contains(l.Id + AnimalContestController.GetNextContestDateKey()) , (l) => { Game1.player.mailReceived.Add(l.Id + AnimalContestController.GetNextContestDateKey()); if (!Game1.player.mailReceived.Contains(l.Id)) { Game1.player.mailReceived.Add(l.Id); } }) { Title = DataLoader.i18n.Get("Tool.ParticipantRibbon.Letter.Title") } ); MailDao.SaveLetter ( new Letter ( "participantRibbonRedelivery" , DataLoader.i18n.Get("Tool.ParticipantRibbon.LetterRedelivery") , new List <Item> { ToolsFactory.GetParticipantRibbon() } , (l) => SDate.Now().AddDays(1).Equals(AnimalContestController.GetNextContestDate()) && AnimalContestController.GetContestCount() > 0 && !Game1.player.mailReceived.Contains(l.Id + AnimalContestController.GetNextContestDateKey()) , (l) => { Game1.player.mailReceived.Add(l.Id + AnimalContestController.GetNextContestDateKey()); if (!Game1.player.mailReceived.Contains(l.Id)) { Game1.player.mailReceived.Add(l.Id); } }) { Title = DataLoader.i18n.Get("Tool.ParticipantRibbon.LetterRedelivery.Title") } ); } if (!DataLoader.ModConfig.DisableTreats) { MailDao.SaveLetter ( new Letter ( "feedingBasket", DataLoader.i18n.Get("Tool.FeedingBasket.Letter"), new List <Item> { ToolsFactory.GetFeedingBasket() }, FeedingBasketCondition, (l) => { if (!Game1.player.mailReceived.Contains(l.Id)) { Game1.player.mailReceived.Add(l.Id); } } ) { Title = DataLoader.i18n.Get("Tool.FeedingBasket.Letter.Title") } ); MailDao.SaveLetter ( new Letter ( "feedingBasketRedelivery", DataLoader.i18n.Get("Tool.FeedingBasket.LetterRedelivery"), new List <Item> { ToolsFactory.GetFeedingBasket() }, FeedingBasketRedeliveryCondition, (l) => { if (!Game1.player.mailReceived.Contains(l.Id)) { Game1.player.mailReceived.Add(l.Id); } } ) { Title = DataLoader.i18n.Get("Tool.FeedingBasket.LetterRedelivery.Title") } ); } }
public static bool beginUsing(MilkPail __instance, GameLocation location, int x, int y, StardewValley.Farmer who, ref bool __result) { if (!IsParticipantRibbon(__instance)) { return(true); } string participantRibbonId = __instance.modData[ParticipantRibbonKey]; x = (int)who.GetToolLocation(false).X; y = (int)who.GetToolLocation(false).Y; Rectangle rectangle = new Rectangle(x - Game1.tileSize / 2, y - Game1.tileSize / 2, Game1.tileSize, Game1.tileSize); if (!DataLoader.ModConfig.DisableAnimalContest) { if (location is Farm farm) { foreach (FarmAnimal farmAnimal in farm.animals.Values) { if (farmAnimal.GetBoundingBox().Intersects(rectangle)) { Animals[participantRibbonId] = farmAnimal; break; } } if (!Animals.ContainsKey(participantRibbonId) || Animals[participantRibbonId] == null) { foreach (Pet localPet in farm.characters.Where(i => i is Pet)) { if (localPet.GetBoundingBox().Intersects(rectangle)) { Pets[participantRibbonId] = localPet; break; } } } } else if (location is AnimalHouse animalHouse) { foreach (FarmAnimal farmAnimal in animalHouse.animals.Values) { if (farmAnimal.GetBoundingBox().Intersects(rectangle)) { Animals[participantRibbonId] = farmAnimal; break; } } } else if (location is FarmHouse) { foreach (Pet localPet in location.characters.Where(i => i is Pet)) { if (localPet.GetBoundingBox().Intersects(rectangle)) { Pets[participantRibbonId] = localPet; break; } } } } string dialogue = ""; Animals.TryGetValue(participantRibbonId, out FarmAnimal animal); if (animal != null) { if (animal.isBaby()) { dialogue = DataLoader.i18n.Get("Tool.ParticipantRibbon.CantBeBaby"); } else if (AnimalContestController.HasParticipated(animal)) { dialogue = DataLoader.i18n.Get("Tool.ParticipantRibbon.HasAlreadyParticipatedContest", new { animalName = animal.displayName }); } else if (AnimalContestController.IsNextParticipant(animal)) { dialogue = DataLoader.i18n.Get("Tool.ParticipantRibbon.IsAlreadyParticipant", new { animalName = animal.displayName }); } else if (AnimalContestController.GetNextContestParticipant() is Character participant) { string participantName = participant.displayName; dialogue = DataLoader.i18n.Get("Tool.ParticipantRibbon.AnotherParticipantAlready", new { participantName }); } else { animal.doEmote(8, true); if (who != null && Game1.player.Equals(who)) { animal.makeSound(); } animal.pauseTimer = 200; } } Pets.TryGetValue(participantRibbonId, out Pet pet); if (pet != null) { if (AnimalContestController.IsNextParticipant(pet)) { dialogue = DataLoader.i18n.Get("Tool.ParticipantRibbon.IsAlreadyParticipant", new { animalName = pet.displayName }); } else if (AnimalContestController.GetNextContestParticipant() is Character character) { string participantName = character.displayName; dialogue = DataLoader.i18n.Get("Tool.ParticipantRibbon.AnotherParticipantAlready", new { participantName }); } else { pet.doEmote(8, true); if (who != null && Game1.player.Equals(who)) { pet.playContentSound(); } pet.Halt(); pet.CurrentBehavior = 0; pet.Halt(); pet.Sprite.setCurrentAnimation( new List <FarmerSprite.AnimationFrame>() { new FarmerSprite.AnimationFrame(18, 200) }); } } if (dialogue.Length > 0) { if (who != null && Game1.player.Equals(who)) { DelayedAction.showDialogueAfterDelay(dialogue, 150); } Pets[participantRibbonId] = pet = null; Animals[participantRibbonId] = animal = null; } who.Halt(); int currentFrame = who.FarmerSprite.CurrentFrame; if (animal != null || pet != null) { switch (who.FacingDirection) { case 0: who.FarmerSprite.animateOnce(new FarmerSprite.AnimationFrame[1] { new FarmerSprite.AnimationFrame(62, 200, false, false, new AnimatedSprite.endOfAnimationBehavior(StardewValley.Farmer.useTool), true) }); break; case 1: who.FarmerSprite.animateOnce(new FarmerSprite.AnimationFrame[1] { new FarmerSprite.AnimationFrame(58, 200, false, false, new AnimatedSprite.endOfAnimationBehavior(StardewValley.Farmer.useTool), true) }); break; case 2: who.FarmerSprite.animateOnce(new FarmerSprite.AnimationFrame[1] { new FarmerSprite.AnimationFrame(54, 200, false, false, new AnimatedSprite.endOfAnimationBehavior(StardewValley.Farmer.useTool), true) }); break; case 3: who.FarmerSprite.animateOnce(new FarmerSprite.AnimationFrame[1] { new FarmerSprite.AnimationFrame(58, 200, false, true, new AnimatedSprite.endOfAnimationBehavior(StardewValley.Farmer.useTool), true) }); break; } } else { who.FarmerSprite.animateOnce(new FarmerSprite.AnimationFrame[1] { new FarmerSprite.AnimationFrame(currentFrame, 0, false, who.FacingDirection == 3, new AnimatedSprite.endOfAnimationBehavior(StardewValley.Farmer.useTool), true) }); } who.FarmerSprite.oldFrame = currentFrame; who.UsingTool = true; who.CanMove = false; __result = true; return(false); }