public static void dayUpdate(FarmAnimal __instance) { if (__instance.harvestType.Value == FarmAnimal.layHarvestType && __instance.daysSinceLastLay.Value == 0 && AnimalContestController.HasFertilityBonus(__instance) && !DataLoader.ModConfig.DisableContestBonus) { GameLocation homeIndoors = __instance.home.indoors.Value; if (homeIndoors.Objects.ContainsKey(__instance.getTileLocation())) { StardewValley.Object originalLayedObject = homeIndoors.Objects[__instance.getTileLocation()]; if (originalLayedObject.Category == StardewValley.Object.EggCategory) { __instance.setRandomPosition(homeIndoors); if (!homeIndoors.Objects.ContainsKey(__instance.getTileLocation())) { homeIndoors.Objects.Add(__instance.getTileLocation(), new StardewValley.Object(Vector2.Zero, originalLayedObject.ParentSheetIndex, (string)null, false, true, false, true) { Quality = originalLayedObject.Quality }); } } } } }
public AnimalQueryMenuExtended(FarmAnimal farmAnimal) : base(farmAnimal) { _farmAnimal = farmAnimal; if (Context.IsMainPlayer && !DataLoader.ModConfig.DisablePregnancy) { if (PregnancyController.IsAnimalPregnant(this._farmAnimal.myID.Value)) { this.allowReproductionButton = null; pregnantStatus = new ClickableTextureComponent( new Microsoft.Xna.Framework.Rectangle( this.xPositionOnScreen + AnimalQueryMenu.width + Game1.pixelZoom * 3, this.yPositionOnScreen + AnimalQueryMenu.height - Game1.tileSize * 2 - IClickableMenu.borderWidth + Game1.pixelZoom, Game1.pixelZoom * 11, Game1.pixelZoom * 11), DataLoader.LooseSprites, new Microsoft.Xna.Framework.Rectangle(34, 29, 11, 11), 4f, false); } } if (Context.IsMainPlayer && !DataLoader.ModConfig.DisableTreats && TreatsController.CanReceiveTreat(farmAnimal)) { if (TreatsController.IsReadyForTreat(farmAnimal)) { treatStatus = new ClickableTextureComponent( new Microsoft.Xna.Framework.Rectangle( this.xPositionOnScreen + AnimalQueryMenu.width + Game1.tileSize + 4, this.yPositionOnScreen + AnimalQueryMenu.height - Game1.tileSize * 2 - IClickableMenu.borderWidth, Game1.tileSize, Game1.tileSize), DataLoader.ToolsSprites, new Microsoft.Xna.Framework.Rectangle(240, 0, 16, 16), 4f, false); } else { treatStatus = new ClickableTextureComponent( new Microsoft.Xna.Framework.Rectangle( this.xPositionOnScreen + AnimalQueryMenu.width + Game1.tileSize + 4, this.yPositionOnScreen + AnimalQueryMenu.height - Game1.tileSize * 2 - IClickableMenu.borderWidth, Game1.tileSize, Game1.tileSize), DataLoader.LooseSprites, new Microsoft.Xna.Framework.Rectangle(16, 28, 16, 16), 4f, false); } } if (AnimalContestController.IsParticipant(farmAnimal)) { animalContestIndicator = new ClickableTextureComponent(new Microsoft.Xna.Framework.Rectangle(this.xPositionOnScreen + AnimalQueryMenu.width + Game1.tileSize + 4, this.yPositionOnScreen + AnimalQueryMenu.height - Game1.tileSize * 4 - IClickableMenu.borderWidth, Game1.tileSize, Game1.tileSize), DataLoader.ToolsSprites, new Microsoft.Xna.Framework.Rectangle(256, 0, 16, 16), 4f, false); } if (!DataLoader.ModConfig.DisableMeat && MeatController.CanGetMeatFrom(farmAnimal)) { if (!this._farmAnimal.isBaby()) { meatButton = new ClickableTextureComponent(new Microsoft.Xna.Framework.Rectangle(this.xPositionOnScreen + AnimalQueryMenu.width + Game1.tileSize + 4, this.yPositionOnScreen + AnimalQueryMenu.height - Game1.tileSize * 3 - IClickableMenu.borderWidth, Game1.tileSize, Game1.tileSize), DataLoader.LooseSprites, new Microsoft.Xna.Framework.Rectangle(0, 28, 16, 16), 4f, false); } } _parentName = DataLoader.Helper.Reflection.GetField <String>(this, "parentName").GetValue(); _textBox = DataLoader.Helper.Reflection.GetField <TextBox>(this, "textBox").GetValue(); _movingAnimal = DataLoader.Helper.Reflection.GetField <bool>(this, "movingAnimal"); _confirmingSell = DataLoader.Helper.Reflection.GetField <bool>(this, "confirmingSell"); _lovelLevel = DataLoader.Helper.Reflection.GetField <double>(this, "loveLevel"); _hoverText = DataLoader.Helper.Reflection.GetField <string>(this, "hoverText"); }
public static bool checkAction(Pet __instance, Farmer who) { if (__instance.IsInvisible) { return(false); } if (!__instance.lastPetDay.ContainsKey(who.UniqueMultiplayerID)) { __instance.lastPetDay.Add(who.UniqueMultiplayerID, -1); } if (__instance.lastPetDay[who.UniqueMultiplayerID] == Game1.Date.TotalDays && AnimalContestController.CanChangeParticipant(__instance)) { __instance.playContentSound(); __instance.Halt(); __instance.CurrentBehavior = 0; __instance.OnNewBehavior(); __instance.Halt(); __instance.Sprite.setCurrentAnimation(new List <FarmerSprite.AnimationFrame>() { new FarmerSprite.AnimationFrame(18, 200) }); who.Halt(); int currentFrame = who.FarmerSprite.currentFrame; 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; } who.FarmerSprite.oldFrame = currentFrame; AnimalContestController.RemoveAnimalParticipant(__instance); Game1.player.addItemByMenuIfNecessary(ToolsFactory.GetParticipantRibbon()); return(false); } return(true); }
public static bool checkAction(Pet __instance, ref int __result) { if (DataLoader.Helper.Reflection.GetField <bool>(__instance, "wasPetToday").GetValue() && AnimalContestController.CanChangeParticipantPet()) { __instance.playContentSound(); __instance.Halt(); __instance.CurrentBehavior = 0; __instance.initiateCurrentBehavior(); __instance.Halt(); __instance.Sprite.setCurrentAnimation(new List <FarmerSprite.AnimationFrame>() { new FarmerSprite.AnimationFrame(18, 200) }); var who = Game1.player; who.Halt(); int currentFrame = who.FarmerSprite.currentFrame; 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; } who.FarmerSprite.oldFrame = currentFrame; AnimalContestController.RemovePetParticipant(); Game1.player.addItemByMenuIfNecessary(new ParticipantRibbon()); return(false); } return(true); }
private static int ProduceQuality(Random random, FarmAnimal farmAnimal) { if (!DataLoader.ModConfig.DisableContestBonus && AnimalContestController.HasProductionBonus(farmAnimal)) { return 4; } double chance = (double)farmAnimal.friendshipTowardFarmer.Value / 1000.0 - (1.0 - (double)farmAnimal.happiness.Value / 225.0); if (!farmAnimal.isCoopDweller() && Game1.getFarmer(farmAnimal.ownerID.Value).professions.Contains(3) || farmAnimal.isCoopDweller() && Game1.getFarmer(farmAnimal.ownerID.Value).professions.Contains(2)) chance += 0.33; var produceQuality = chance < 0.95 || random.NextDouble() >= chance / 2.0 ? (random.NextDouble() >= chance / 2.0 ? (random.NextDouble() >= chance ? 0 : 1) : 2) : 4; return produceQuality; }
public static void EndEvent(AnimalContestItem animalContestItem, bool participated = true) { if (Context.IsMainPlayer) { if (!participated) { animalContestItem.Winner = "Marnie"; animalContestItem.Contenders = new List <string>(new[] { "Marnie" }); animalContestItem.VincentAnimal = null; animalContestItem.MarnieAnimal = null; } if (animalContestItem.ParticipantId.HasValue) { long participantIdValue = animalContestItem.ParticipantId.Value; Character participant = null; if (participantIdValue != AnimalData.PetId) { if (_temporaryFarmAnimal != null) { participant = _temporaryFarmAnimal; if (participated) { _temporaryFarmAnimal.friendshipTowardFarmer.Value = Math.Min(1000, _temporaryFarmAnimal.friendshipTowardFarmer.Value + DataLoader.AnimalContestData.FarmAnimalFriendshipForParticipating); _temporaryFarmAnimal.happiness.Value = 255; } else { _temporaryFarmAnimal.friendshipTowardFarmer.Value = Math.Max(0, _temporaryFarmAnimal.friendshipTowardFarmer.Value - DataLoader.AnimalContestData.FarmAnimalFriendshipForParticipating); _temporaryFarmAnimal.happiness.Value = 0; } ReAddFarmAnimal(participantIdValue); } } else { participant = Game1.player.getPet(); if (participated) { Pet pet = (Pet)participant; pet.friendshipTowardFarmer.Value = Math.Min(Pet.maxFriendship, pet.friendshipTowardFarmer.Value + DataLoader.AnimalContestData.PetFriendshipForParticipating); } AnimalContestController.ReAddPet(); } participant?.SetHasWon((participant.GetHasWon() ?? false) || animalContestItem.Winner == "Farmer"); } } }
public override void receiveLeftClick(int x, int y, bool playSound = true) { if (Game1.globalFade) { return; } if (_movingAnimal.GetValue()) { Building buildingAt = (Game1.getLocationFromName("Farm") as Farm).getBuildingAt(new Vector2((float)((x + Game1.viewport.X) / Game1.tileSize), (float)((y + Game1.viewport.Y) / Game1.tileSize))); if ( buildingAt != null && buildingAt.buildingType.Value.Contains(this._farmAnimal.buildingTypeILiveIn.Value) && !((AnimalHouse)buildingAt.indoors.Value).isFull() && !buildingAt.Equals((object)this._farmAnimal.home) && PregnancyController.IsAnimalPregnant(this._farmAnimal.myID.Value) && PregnancyController.CheckBuildingLimit(((AnimalHouse)buildingAt.indoors.Value)) ) { if (this.okButton != null && this.okButton.containsPoint(x, y)) { Game1.globalFadeToBlack(new Game1.afterFadeFunction(this.prepareForReturnFromPlacement), 0.02f); Game1.playSound("smallSelect"); } Game1.showRedMessage(DataLoader.i18n.Get("Menu.AnimalQueryMenu.PregnancyBuildingLimit", new { buildingType = this._farmAnimal.displayHouse })); return; } } else if (this.confirmingMeat) { if (this.yesButton.containsPoint(x, y)) { (this._farmAnimal.home.indoors.Value as AnimalHouse)?.animalsThatLiveHere.Remove(this._farmAnimal.myID.Value); this._farmAnimal.health.Value = -1; int num1 = this._farmAnimal.frontBackSourceRect.Width / 2; for (int index = 0; index < num1; ++index) { int num2 = Game1.random.Next(25, 200); Game1.currentLocation.temporarySprites.Add(new TemporaryAnimatedSprite(5, this._farmAnimal.position + new Vector2((float)Game1.random.Next(-Game1.tileSize / 2, this._farmAnimal.frontBackSourceRect.Width * 3), (float)Game1.random.Next(-Game1.tileSize / 2, this._farmAnimal.frontBackSourceRect.Height * 3)), new Color((int)byte.MaxValue - num2, (int)byte.MaxValue, (int)byte.MaxValue - num2), 8, false, Game1.random.NextDouble() < 0.5 ? 50f : (float)Game1.random.Next(30, 200), 0, Game1.tileSize, -1f, Game1.tileSize, Game1.random.NextDouble() < 0.5 ? 0 : Game1.random.Next(0, 600)) { scale = (float)Game1.random.Next(2, 5) * 0.25f, alpha = (float)Game1.random.Next(2, 5) * 0.25f, motion = new Vector2(0.0f, (float)-Game1.random.NextDouble()) }); } Game1.playSound("newRecipe"); Game1.playSound("money"); Game1.exitActiveMenu(); Game1.player.Stamina -= ((float)4f - (float)Game1.player.FarmingLevel * 0.2f); Game1.player.Stamina -= ((float)4f - (float)Game1.player.FarmingLevel * 0.2f); Game1.player.gainExperience(0, 5); MeatController.AddItemsToInventoryByMenuIfNecessary(MeatController.CreateMeat(this._farmAnimal)); } else { if (!this.noButton.containsPoint(x, y)) { return; } this.confirmingMeat = false; Game1.playSound("smallSelect"); if (!Game1.options.SnappyMenus) { return; } this.currentlySnappedComponent = this.getComponentWithID(103); this.snapCursorToCurrentSnappedComponent(); } return; } else if (!_confirmingSell.GetValue()) { if (this.meatButton?.containsPoint(x, y) ?? false) { this.confirmingMeat = true; ClickableTextureComponent textureComponent1 = new ClickableTextureComponent(new Microsoft.Xna.Framework.Rectangle(Game1.viewport.Width / 2 - Game1.tileSize - 4, Game1.viewport.Height / 2 - Game1.tileSize / 2, Game1.tileSize, Game1.tileSize), Game1.mouseCursors, Game1.getSourceRectForStandardTileSheet(Game1.mouseCursors, 46, -1, -1), 1f, false); textureComponent1.myID = 111; textureComponent1.rightNeighborID = 105; this.yesButton = textureComponent1; ClickableTextureComponent textureComponent2 = new ClickableTextureComponent(new Microsoft.Xna.Framework.Rectangle(Game1.viewport.Width / 2 + 4, Game1.viewport.Height / 2 - Game1.tileSize / 2, Game1.tileSize, Game1.tileSize), Game1.mouseCursors, Game1.getSourceRectForStandardTileSheet(Game1.mouseCursors, 47, -1, -1), 1f, false); textureComponent2.myID = 105; textureComponent2.leftNeighborID = 111; this.noButton = textureComponent2; Game1.playSound("smallSelect"); if (!Game1.options.SnappyMenus) { return; } this.populateClickableComponentList(); this.currentlySnappedComponent = (ClickableComponent)this.noButton; this.snapCursorToCurrentSnappedComponent(); } else if (this.animalContestIndicator?.containsPoint(x, y) ?? false && AnimalContestController.CanChangeParticipant(this._farmAnimal)) { this.animalContestIndicator = null; AnimalContestController.RemoveAnimalParticipant(this._farmAnimal); Game1.player.addItemByMenuIfNecessary(new ParticipantRibbon()); } } base.receiveLeftClick(x, y, playSound); }
public override void performHoverAction(int x, int y) { base.performHoverAction(x, y); if (_movingAnimal.GetValue()) { Vector2 tile = new Vector2((float)((x + Game1.viewport.X) / Game1.tileSize), (float)((y + Game1.viewport.Y) / Game1.tileSize)); Farm locationFromName = Game1.getLocationFromName("Farm") as Farm; Building buildingAt = locationFromName.getBuildingAt(tile); if (buildingAt != null) { if (buildingAt.color.Equals(Color.LightGreen * 0.8f) && PregnancyController.IsAnimalPregnant(this._farmAnimal.myID.Value) && PregnancyController.CheckBuildingLimit((buildingAt.indoors.Value as AnimalHouse))) { buildingAt.color.Value = Color.Red * 0.8f; } } } else { if (this.meatButton != null) { if (this.meatButton.containsPoint(x, y)) { this.meatButton.scale = Math.Min(4.1f, this.meatButton.scale + 0.05f); _hoverText.SetValue(DataLoader.i18n.Get("Menu.AnimalQueryMenu.ExchangeAnimalForMeat")); } else { this.meatButton.scale = Math.Max(4f, this.sellButton.scale - 0.05f); } } if (this.pregnantStatus != null) { if (this.pregnantStatus.containsPoint(x, y)) { int daysUtilBirth = PregnancyController.GetPregnancyItem(this._farmAnimal.myID.Value).DaysUntilBirth; if (daysUtilBirth > 1) { _hoverText.SetValue(DataLoader.i18n.Get("Menu.AnimalQueryMenu.DaysUntilBirth", new { numberOfDays = daysUtilBirth })); } else { _hoverText.SetValue(DataLoader.i18n.Get("Menu.AnimalQueryMenu.ReadyForBirth")); } } } if (this.treatStatus != null) { if (this.treatStatus.containsPoint(x, y)) { int daysUntilNextTreat = TreatsController.DaysUntilNextTreat(this._farmAnimal); if (daysUntilNextTreat > 1) { _hoverText.SetValue(DataLoader.i18n.Get("Menu.AnimalQueryMenu.WantsTreatInDays", new { numberOfDays = daysUntilNextTreat })); } else if (daysUntilNextTreat == 1) { _hoverText.SetValue(DataLoader.i18n.Get("Menu.AnimalQueryMenu.WantsTreatTomorrow")); } else { _hoverText.SetValue(DataLoader.i18n.Get("Menu.AnimalQueryMenu.WantsTreat")); } } } if (this.animalContestIndicator != null) { if (this.animalContestIndicator.containsPoint(x, y)) { if (AnimalContestController.CanChangeParticipant(this._farmAnimal)) { _hoverText.SetValue(DataLoader.i18n.Get("Menu.AnimalQueryMenu.ChangeParticipant")); } else if (AnimalContestController.HasParticipated(this._farmAnimal) && AnimalContestController.HasWon(this._farmAnimal)) { SDate date = AnimalContestController.GetParticipantDate(this._farmAnimal); _hoverText.SetValue(DataLoader.i18n.Get("Menu.AnimalQueryMenu.Winner", new { contestDate = Utility.getDateStringFor(date.Day, Utility.getSeasonNumber(date.Season), date.Year) })); } else { SDate date = AnimalContestController.GetParticipantDate(this._farmAnimal); _hoverText.SetValue(DataLoader.i18n.Get("Menu.AnimalQueryMenu.ContestParticipant", new { contestDate = Utility.getDateStringFor(date.Day, Utility.getSeasonNumber(date.Season), date.Year) })); } } } } }
public static CustomEvent CreateEvent(SDate contestDate) { int eventId = GetEventId(contestDate); string key = GenerateKey(eventId, contestDate); Random random = new Random((int)((long)Game1.uniqueIDForThisGame * 100000 + contestDate.Year * 1000 + Utility.getSeasonNumber(contestDate.Season) * 100 + contestDate.Day)); //Player and Participant init long? contestParticipantId = AnimalContestController.ContestParticipantId(contestDate); AnimalStatus participantAnimalStatus = contestParticipantId != null?AnimalStatusController.GetAnimalStatus((long)contestParticipantId) : null; bool isPlayerJustWatching = participantAnimalStatus == null; bool isParticipantPet = !isPlayerJustWatching && participantAnimalStatus.Id == AnimalData.PetId; FarmAnimal farmAnimal = null; if (isParticipantPet) { AnimalContestController.TemporalyRemovePet(); } else if (!isPlayerJustWatching) { farmAnimal = AnimalContestController.GetAnimal(participantAnimalStatus.Id); if (farmAnimal == null) { isPlayerJustWatching = true; } else { AnimalContestController.TemporalyRemoveFarmAnimal(farmAnimal); } } List <AnimalContestItem> history = FarmerLoader.FarmerData.AnimalContestData; string[] contenders = new string[3]; contenders[0] = "Marnie"; contenders[1] = GetContenderFromPool(new List <IAnimalContestAct>(PossibleSecondContenders).Where(c => !isPlayerJustWatching || !c.NpcName.Equals("Jas")).ToList(), history) ?? "Maru"; contenders[2] = GetContenderFromPool(new List <IAnimalContestAct>(PossibleThirdContenders), history) ?? "Jodi"; string marnieAnimal = MarnieAct.ChooseMarnieAnimal(random, history); VincentAnimal vincentAnimal = VincentAct.ChooseVincentAnimal(random, history); AnimalContestItem animalContestInfo = new AnimalContestItem(eventId, contestDate, contenders.ToList(), vincentAnimal.ToString(), marnieAnimal) { ParticipantId = isParticipantPet ? AnimalData.PetId : farmAnimal?.myID.Value, PlayerAnimal = isParticipantPet ? Game1.player.catPerson ? "Cat" : "Dog" : farmAnimal?.type.Value }; animalContestInfo = PickTheWinner(animalContestInfo, history, participantAnimalStatus, farmAnimal, contenders[2]); // Deciding who will be present bool isHaleyWatching = Game1.player.eventsSeen.Contains(14) || Game1.player.spouse == "Haley"; bool isKentWatching = Game1.year > 1 && contenders.Contains("Jodi"); bool isSebastianWatching = Game1.player.spouse != "Sebastian" && (vincentAnimal == VincentAnimal.Frog || contenders.Contains("Abigail")); bool isPennyWatching = Game1.player.spouse != "Penny" && !isSebastianWatching && (contenders.Contains("Maru") || contenders.Contains("Jas") || isPlayerJustWatching || Game1.player.getFriendshipHeartLevelForNPC("Penny") >= 4); bool isDemetriusWatching = contenders.Contains("Maru"); bool isClintWatching = contenders.Contains("Emily"); bool isLeahWatching = Game1.player.spouse != "Leah" && Game1.player.eventsSeen.Contains(53); bool isLinusWatching = !contenders.Contains("Linus") && (Game1.player.eventsSeen.Contains(26) || vincentAnimal == VincentAnimal.Rabbit); bool isShaneWatching = !contenders.Contains("Shane") && (contenders.Contains("Jas") || isPlayerJustWatching || Game1.player.eventsSeen.Contains(3900074) || Game1.player.spouse == "Shane"); StringBuilder initialPosition = new StringBuilder(); initialPosition.Append("none/-100 -100"); if (!isPlayerJustWatching) { initialPosition.Append("/farmer 27 62 2"); } else { if (IsWatchingPositionNorthEast(animalContestInfo)) { initialPosition.Append("/farmer 37 62 2"); } else { initialPosition.Append($"/farmer 28 70 {(IsWatchingPositionSouthEest(animalContestInfo)?"1":"3")}"); } } initialPosition.Append(" Lewis 28 63 2"); initialPosition.Append($" {contenders[0]} 24 66 3"); initialPosition.Append($" {contenders[1]} 30 66 1"); initialPosition.Append($" {contenders[2]} 33 66 1"); if (isKentWatching) { initialPosition.Append($" Kent 36 66 3"); } if (!contenders.Contains("Jodi")) { initialPosition.Append($" Jodi 36 65 3"); } initialPosition.Append($" Sam 37 66 3"); initialPosition.Append($" Gus 36 68 3"); initialPosition.Append($" Evelyn 30 69 1"); initialPosition.Append($" George 31 69 0"); if (!contenders.Contains("Alex")) { initialPosition.Append($" Alex 31 70 0"); } initialPosition.Append($" Pierre 26 69 1"); initialPosition.Append($" Caroline 27 69 3"); if (Game1.player.spouse != "Elliott") { initialPosition.Append($" Elliott 33 69 0"); } if (!contenders.Contains("Willy")) { initialPosition.Append($" Willy 35 69 0"); } if (isHaleyWatching) { initialPosition.Append($" Haley 22 68 1"); } if (isLeahWatching) { initialPosition.Append($" Leah 22 70 0"); } if (isSebastianWatching) { initialPosition.Append($" Sebastian 37 67 3"); } else if (isPennyWatching) { initialPosition.Append($" Penny 37 67 3"); } if (isDemetriusWatching) { initialPosition.Append($" Demetrius 32 70 0"); } if (isClintWatching) { initialPosition.Append($" Clint 34 70 0"); } if (isPlayerJustWatching) { initialPosition.Append($" Jas 27 66 0"); } else if (!contenders.Contains("Jas")) { initialPosition.Append($" Jas 23 70 0"); } if (isShaneWatching) { initialPosition.Append($" Shane 24 70 0"); } bool linusAlternateAnimal = false; if (isLinusWatching) { initialPosition.Append($" Linus 37 70 3"); } else { linusAlternateAnimal = history.Count(h => h.Contenders.Contains("Linus")) % 2 == new Random((int)Game1.uniqueIDForThisGame).Next(2); } if (Game1.player.spouse != null && !new string[] { "Shane", "Alex", "Sam", "Haley" }.Contains(Game1.player.spouse) && !animalContestInfo.Contenders.Contains(Game1.player.spouse)) { initialPosition.Append($" {Game1.player.spouse} 25 69 0"); } initialPosition.Append($" Vincent 28 80 0"); if (isParticipantPet) { if (!Game1.player.catPerson) { initialPosition.Append(" dog 26 66 2/showFrame Dog 23"); } else { initialPosition.Append(" cat 26 66 2/positionOffset Cat -8 0/showFrame Cat 18"); } } else { if (!isPlayerJustWatching) { string spriteTextureName = farmAnimal.Sprite.textureName.Value; string playerAnimalTextureName; if (spriteTextureName.StartsWith("Animals\\")) { playerAnimalTextureName = farmAnimal.Sprite.textureName.Value .Substring(farmAnimal.Sprite.textureName.Value.IndexOf('\\') + 1) .Replace(' ', '_'); } else { DataLoader.AssetsToLoad["Animals\\" + spriteTextureName.Replace('_', ' ')] = farmAnimal.Sprite.Texture; playerAnimalTextureName = spriteTextureName.Replace(' ', '_');; } bool isPlayerAnimalSmall = IsAnimalSmall(farmAnimal); initialPosition.Append($"/addTemporaryActor {playerAnimalTextureName} {(isPlayerAnimalSmall? SmallSize : BigSize)} {(isPlayerAnimalSmall?26:25)} 66 0 false Animal participant/showFrame participant 0"); if (!isPlayerAnimalSmall) { initialPosition.Append("/positionOffset participant 5 0"); } } } initialPosition.Append("/specificTemporarySprite animalContest/skippable"); initialPosition.Append(GetContendersAnimalPosition(contenders, marnieAnimal, isPlayerJustWatching, linusAlternateAnimal)); initialPosition.Append("/viewport 28 65 true"); StringBuilder eventAction = new StringBuilder(); if (isHaleyWatching) { eventAction.Append("/showFrame Haley 25"); } if (contenders.Contains("Maru")) { eventAction.Append("/animate Maru false false 130 16 16 16 16 16 17 18 19 20 21 22 23 23 23 23"); } string faceDirectionPlayerPosition; if (!isPlayerJustWatching) { faceDirectionPlayerPosition = "farmer"; eventAction.Append("/move farmer 0 4 2/faceDirection farmer 3"); if (isParticipantPet) { eventAction.Append($"/playSound {(Game1.player.catPerson ? "cat" : "dog_bark")}"); } eventAction.Append("/emote farmer 32"); //eventAction.Append($"/emote {(isParticipantPet?!Game1.player.catPerson? "Dog":"Cat": "participant")} 20"); } else { faceDirectionPlayerPosition = "Jas"; if (IsWatchingPositionNorthEast(animalContestInfo)) { eventAction.Append("/move farmer 0 3 2/faceDirection farmer 3"); } else if (IsWatchingPositionSouthEest(animalContestInfo)) { eventAction.Append("/move farmer 2 0 1/faceDirection farmer 0"); } else { eventAction.Append("/move farmer -3 0 3/faceDirection farmer 0"); } if (Game1.player.spouse != null) { eventAction.Append($"/emote {Game1.player.spouse} 20 true/emote farmer 20"); } } if (isHaleyWatching) { eventAction.Append("/pause 200/playSound cameraNoise/shake Haley 50/screenFlash .5/pause 1000/showFrame Haley 5/pause 1000"); } if (!isPlayerJustWatching) { eventAction.Append("/faceDirection farmer 0"); eventAction.Append($"/speak Lewis \"{i18n.Get("AnimalContest.Dialog.Lewis.PlayerParticipant")}\""); } else { eventAction.Append($"/speak Lewis \"{i18n.Get("AnimalContest.Dialog.Lewis.PlayerWatching")}\""); } eventAction.Append($"/faceDirection {contenders[0]} 0"); eventAction.Append($"/pause 1000/emote Lewis 40/speak Lewis \"{i18n.Get("AnimalContest.Dialog.Lewis.Attention")}\""); eventAction.Append($"/pause 100/faceDirection {contenders[1]} 0 true"); eventAction.Append($"/faceDirection Pierre 0"); eventAction.Append($"/faceDirection {contenders[2]} 0 true"); eventAction.Append($"/faceDirection Evelyn 0 true"); if (!contenders.Contains("Willy")) { initialPosition.Append($"/faceDirection Willy 3"); } eventAction.Append($"/faceDirection Caroline 0"); if (history.Count == 0) { eventAction.Append($"/speak Lewis \"{i18n.Get("AnimalContest.Dialog.Lewis.IntroductionFirstTime")}\""); } else { eventAction.Append($"/speak Lewis \"{i18n.Get("AnimalContest.Dialog.Lewis.IntroductionOtherTimes")}\""); } eventAction.Append(new VincentAct().GetAct(animalContestInfo, history)); eventAction.Append($"/speak Lewis \"{i18n.Get("AnimalContest.Dialog.Lewis.ContestExplanation")}\""); eventAction.Append($"/faceDirection {contenders[2]} 3 true"); eventAction.Append("/move Lewis 0 1 2"); eventAction.Append($"/faceDirection {contenders[0]} 3 true"); eventAction.Append("/move Lewis 0 1 2"); eventAction.Append($"/faceDirection {faceDirectionPlayerPosition} 3 true"); eventAction.Append($"/faceDirection {contenders[1]} 3 true"); eventAction.Append("/move Lewis 0 2 2"); eventAction.Append("/move Lewis -5 0 3/faceDirection Lewis 0"); eventAction.Append(new MarnieAct().GetAct(animalContestInfo, history)); eventAction.Append($"/faceDirection Lewis 1/move Lewis 1 0 1/faceDirection {contenders[0]} 2 true/move Lewis 2 0 1/faceDirection {contenders[0]} 1 true/faceDirection Lewis 0"); if (!isPlayerJustWatching) { eventAction.Append(GetPlayerAct(animalContestInfo, farmAnimal, history)); } else { eventAction.Append(JasAct.GetAct(animalContestInfo, history)); } eventAction.Append($"/faceDirection Lewis 1/move Lewis 1 0 1/faceDirection {faceDirectionPlayerPosition} 2 true/move Lewis 1 0 1/faceDirection {faceDirectionPlayerPosition} 1 true/move Lewis 1 0 1/faceDirection {contenders[1]} 2 true/move Lewis 2 0 1/faceDirection {contenders[1]} 1 true/faceDirection Lewis 0"); eventAction.Append(PossibleSecondContenders.First(c => c.NpcName.Equals(contenders[1])).GetAct(animalContestInfo, history)); eventAction.Append($"/faceDirection Lewis 1/move Lewis 1 0 1/faceDirection {contenders[2]} 2 true/move Lewis 2 0 1/faceDirection {contenders[2]} 1 true/faceDirection Lewis 0"); eventAction.Append(PossibleThirdContenders.First(c => c.NpcName.Equals(contenders[2])).GetAct(animalContestInfo, history)); eventAction.Append($"/playMusic event1/faceDirection Lewis 3/faceDirection Lewis 2/speak Lewis \"{i18n.Get("AnimalContest.Dialog.Lewis.Closure")}\""); eventAction.Append($"/faceDirection Lewis 3/move Lewis -6 0 3/faceDirection Lewis 0/move Lewis 0 -4 0/faceDirection {contenders[1]} 0 true/faceDirection {contenders[0]} 0 true/faceDirection Lewis 3/faceDirection {contenders[2]} 0 true/faceDirection {faceDirectionPlayerPosition} 0 true/faceDirection Lewis 2"); eventAction.Append($"/speak Lewis \"{i18n.Get("AnimalContest.Dialog.Lewis.ClosureThanks")}#$b#"); if (history.Count == 0) { eventAction.Append($"{i18n.Get("AnimalContest.Dialog.Lewis.ClosureSuccessFirstTime")}\""); } else { eventAction.Append($"{i18n.Get("AnimalContest.Dialog.Lewis.ClosureSuccessOtherTimes")}\""); } String winnerAnimalName = animalContestInfo.Winner == "Farmer" ? farmAnimal.displayName : animalContestInfo.Winner == "Emily" ? i18n.Get("AnimalContest.Dialog.Lewis.EmilyUnnamedParrot") : "%name"; String winnerName = animalContestInfo.Winner == "Farmer"?"@":animalContestInfo.Winner; eventAction.Append($"/stopMusic/pause 200/speak Lewis \"{ i18n.Get("AnimalContest.Dialog.Lewis.WinnerAnnouncement", new {winnerName, winnerAnimalName})}\""); eventAction.Append("/playMusic event1/emote Alex 56 true/pause 60"); if (animalContestInfo.Winner == "Farmer") { eventAction.Append("/emote farmer 32 true/pause 500"); if (Game1.player.spouse != null) { eventAction.Append($"/textAboveHead {Game1.player.spouse} \"{i18n.Get("AnimalContest.Dialog.Spouse.PlayerCongrats")}\"/pause 1500"); } if (Game1.player.getFriendshipHeartLevelForNPC("Gus") >= 4) { eventAction.Append($"/textAboveHead Gus \"{i18n.Get("AnimalContest.Dialog.Gus.PlayerCongrats", new { playerName = Game1.player.Name })}\"/pause 1500"); } else if (Game1.player.spouse != null) { eventAction.Append($"/pause 1500"); } if (Game1.player.getFriendshipHeartLevelForNPC("Pierre") >= 4) { eventAction.Append($"/textAboveHead Pierre \"{i18n.Get("AnimalContest.Dialog.Pierre.PlayerCongrats", new { playerName = Game1.player.Name })}\"/pause 1500"); } if (isLinusWatching && Game1.player.getFriendshipHeartLevelForNPC("Linus") >= 4) { eventAction.Append($"/textAboveHead Linus \"{i18n.Get("AnimalContest.Dialog.Linus.PlayerCongrats", new { playerName = Game1.player.Name })}\"/pause 1500"); } else if (Game1.player.getFriendshipHeartLevelForNPC("Pierre") >= 4) { eventAction.Append($"/pause 1500"); } } else if (animalContestInfo.Winner == "Marnie") { eventAction.Append("/specificTemporarySprite animalContestMarnieWinning/warp Marnie -2000 -2000/pause 500"); eventAction.Append($"/emote Jas 32 true/pause 1500"); if (isShaneWatching || animalContestInfo.Contenders.Contains("Shane")) { eventAction.Append($"/textAboveHead Shane \"{i18n.Get("AnimalContest.Dialog.Shane.MarnieCongrats")}\"/pause 1000"); } } else if (animalContestInfo.Winner == "Shane") { eventAction.Append("/emote Shane 16 true/emote shaneAnimal 20 true"); eventAction.Append($"/pause 500/emote Jas 32 true/pause 500/textAboveHead Marnie \"{i18n.Get("AnimalContest.Dialog.Marnie.ShaneContrats")}\"/pause 1000"); } else if (animalContestInfo.Winner == "Emily") { eventAction.Append("/specificTemporarySprite animalContestEmilyParrotAction/emote Emily 20 true"); eventAction.Append($"/textAboveHead Clint \"{i18n.Get("AnimalContest.Dialog.Clint.EmilyContrats")}\"/pause 500"); if (isHaleyWatching) { eventAction.Append($"/textAboveHead Haley \"{i18n.Get("AnimalContest.Dialog.Haley.EmilyContrats")}\"/pause 500"); } eventAction.Append($"/pause 1000/textAboveHead Gus \"{i18n.Get("AnimalContest.Dialog.Gus.EmilyContrats")}\"/pause 1000"); } else if (animalContestInfo.Winner == "Jodi") { eventAction.Append("/emote jodiAnimal 20 true/emote Jodi 32 true/pause 1000"); if (isKentWatching) { eventAction.Append($"/textAboveHead Kent \"{i18n.Get("AnimalContest.Dialog.Kent.JodiContrats")}\"/pause 1500"); } eventAction.Append($"/textAboveHead Caroline \"{i18n.Get("AnimalContest.Dialog.Caroline.JodiContrats")}\"/pause 1500"); eventAction.Append($"/textAboveHead Sam \"{i18n.Get("AnimalContest.Dialog.Sam.JodiContrats")}\"/pause 1500"); } eventAction.Append($"/textAboveHead Evelyn \"{i18n.Get("AnimalContest.Dialog.Evelyn.Contrats")}\""); if (isHaleyWatching) { eventAction.Append("/showFrame Haley 25/pause 1000/playSound cameraNoise/shake Haley 50/screenFlash .5/pause 1000/showFrame Haley 5/pause 1500"); } else { eventAction.Append($"/pause 3000"); } eventAction.Append($"/speak Lewis \"{i18n.Get("AnimalContest.Dialog.Lewis.Ending")}\"/faceDirection Lewis 3/move Lewis -2 0 3 true"); if (animalContestInfo.Winner != "Marnie") { eventAction.Append($"/faceDirection Marnie 0/move Marnie 0 -2 0 true"); } eventAction.Append($"/pause 1500/showFrame Lewis 16/globalFade/viewport -1000 -1000"); if (animalContestInfo.Winner == "Farmer" && !DataLoader.ModConfig.DisableContestBonus) { string bonusType = contestDate.Season == "spring" || contestDate.Season == "summer" ? i18n.Get("AnimalContest.Message.Reward.Fertility") : i18n.Get("AnimalContest.Message.Reward.Production"); eventAction.Append($"/playSound reward/message \"{i18n.Get("AnimalContest.Message.Reward", new { animalName = farmAnimal.displayName, bonusType })}\""); } eventAction.Append("/specificTemporarySprite animalContestEnding/end"); string script = initialPosition.ToString() + eventAction.ToString(); FarmerLoader.FarmerData.AnimalContestData.Add(animalContestInfo); return(new CustomEvent(key, script)); }
public static List<Item> CreateMeat(FarmAnimal farmAnimal) { List<Item> itemsToReturn = new List<Item>(); Animal animal; Animal? foundAnimal = AnimalExtension.GetAnimalFromType(farmAnimal.type.Value); if (foundAnimal == null || !CanGetMeatFrom(farmAnimal)) { return itemsToReturn; } else { animal = (Animal)foundAnimal; } AnimalItem animalItem = DataLoader.AnimalData.GetAnimalItem(farmAnimal); int minimumNumberOfMeat; int maxNumberOfMeat; int meatPrice; int debrisType; if (animal == Animal.Dinosaur) { if (DataLoader.ModConfig.DisableMeatFromDinosaur) { return itemsToReturn; } var meats = Enum.GetValues(typeof(Meat)); Meat meat = ((Meat)meats.GetValue(new Random((int)farmAnimal.myID.Value).Next(meats.Length))); meatPrice = DataLoader.MeatData.getMeatItem(meat).Price; minimumNumberOfMeat = 1; maxNumberOfMeat = 1 + (1300 / meatPrice); debrisType = (int)meat; } else if (animal == Animal.CustomAnimal) { MeatAnimalItem meatAnimalItem = (MeatAnimalItem) animalItem; debrisType = farmAnimal.meatIndex.Value; if (Enum.IsDefined(typeof(Meat), debrisType)) { meatPrice = DataLoader.MeatData.getMeatItem((Meat)debrisType).Price; } else { var objects = DataLoader.Helper.Content.Load<Dictionary<int, string>>("Data\\ObjectInformation", ContentSource.GameContent); meatPrice = Convert.ToInt32(objects[debrisType].Split('/')[1]); } minimumNumberOfMeat = meatAnimalItem.MinimalNumberOfMeat; maxNumberOfMeat = meatAnimalItem.MaximumNumberOfMeat; } else { MeatAnimalItem meatAnimalItem = (MeatAnimalItem) animalItem; Meat meat = animal.GetMeat(); meatPrice = DataLoader.MeatData.getMeatItem(meat).Price; minimumNumberOfMeat = meatAnimalItem.MinimalNumberOfMeat; maxNumberOfMeat = meatAnimalItem.MaximumNumberOfMeat; debrisType = (int)meat; } var numberOfMeat = minimumNumberOfMeat; numberOfMeat += (int)((farmAnimal.getSellPrice() / ((double)farmAnimal.price.Value) - 0.3) * (maxNumberOfMeat - minimumNumberOfMeat)); Random random = new Random((int)farmAnimal.myID.Value * 10000 + (int)Game1.stats.DaysPlayed); int[] quality = { 0, 0, 0, 0, 0 }; for (int i = 0; i < numberOfMeat; i++) { var produceQuality = ProduceQuality(random, farmAnimal); quality[produceQuality]++; } var tempTotal = meatPrice * quality[0] + meatPrice * quality[1] * 1.25 + meatPrice * quality[2] * 1.5 + meatPrice * quality[4] * 2; while (tempTotal < farmAnimal.getSellPrice() && quality[4] != numberOfMeat) { if (numberOfMeat < maxNumberOfMeat) { numberOfMeat++; quality[0]++; tempTotal += meatPrice; } else if (quality[0] > 0) { quality[0]--; quality[1]++; tempTotal += meatPrice * 0.25; } else if ((quality[1] > 0)) { quality[1]--; quality[2]++; tempTotal += meatPrice * 0.25; } else if ((quality[2] > 0)) { quality[2]--; quality[4]++; tempTotal += meatPrice * 0.50; } } for (; numberOfMeat > 0; --numberOfMeat) { Object newItem = new Object(Vector2.Zero, debrisType, 1); newItem.Quality = quality[4] > 0 ? 4 : quality[2] > 0 ? 2 : quality[1] > 0 ? 1 : 0; quality[newItem.Quality]--; itemsToReturn.Add(newItem); } if (animalItem is WoolAnimalItem woolAnimalItem) { int numberOfWools = farmAnimal.currentProduce.Value > 0 ? 1 : 0; numberOfWools += (int)(woolAnimalItem.MinimumNumberOfExtraWool + (farmAnimal.getSellPrice() / ((double)farmAnimal.price.Value) - 0.3) * (woolAnimalItem.MaximumNumberOfExtraWool - woolAnimalItem.MinimumNumberOfExtraWool)); for (; numberOfWools > 0; --numberOfWools) { Object newItem = new Object(Vector2.Zero, farmAnimal.defaultProduceIndex.Value, 1); newItem.Quality = ProduceQuality(random, farmAnimal); itemsToReturn.Add(newItem); } } if (animalItem is FeatherAnimalItem featherAnimalItem) { int numberOfFeather = (int)(featherAnimalItem.MinimumNumberOfFeatherChances + (farmAnimal.getSellPrice() / ((double)farmAnimal.price.Value) - 0.3) * (featherAnimalItem.MaximumNumberOfFeatherChances - featherAnimalItem.MinimumNumberOfFeatherChances)); float num1 = (int)farmAnimal.happiness.Value > 200 ? (float)farmAnimal.happiness.Value * 1.5f : ((int)farmAnimal.happiness.Value <= 100 ? (float)((int)farmAnimal.happiness.Value - 100) : 0.0f); for (; numberOfFeather > 0; --numberOfFeather) { if (random.NextDouble() < (double)farmAnimal.happiness.Value / 150.0) { if (random.NextDouble() < ((double)farmAnimal.friendshipTowardFarmer.Value + (double)num1) / 5000.0 + Game1.player.DailyLuck + (double)Game1.player.LuckLevel * 0.01) { Object newItem = new Object(Vector2.Zero, farmAnimal.deluxeProduceIndex.Value, 1); newItem.Quality = ProduceQuality(random, farmAnimal); itemsToReturn.Add(newItem); } } } } if (animalItem is FeetAnimalItem feetAnimalItem) { int numberOfFeet = (int)(feetAnimalItem.MinimumNumberOfFeetChances + (farmAnimal.getSellPrice() / ((double)farmAnimal.price.Value) - 0.3) * (feetAnimalItem.MaximumNumberOfFeetChances - feetAnimalItem.MinimumNumberOfFeetChances)); float num1 = (int)farmAnimal.happiness.Value > 200 ? (float)farmAnimal.happiness.Value * 1.5f : ((int)farmAnimal.happiness.Value <= 100 ? (float)((int)farmAnimal.happiness.Value - 100) : 0.0f); for (; numberOfFeet > 0; --numberOfFeet) { if (random.NextDouble() < (double)farmAnimal.happiness.Value / 150.0) { if (random.NextDouble() < ((double)farmAnimal.friendshipTowardFarmer.Value + (double)num1) / 5000.0 + Game1.player.DailyLuck + (double)Game1.player.LuckLevel * 0.01) { Object newItem = new Object(Vector2.Zero, farmAnimal.deluxeProduceIndex.Value, 1); newItem.Quality = ProduceQuality(random, farmAnimal); itemsToReturn.Add(newItem); } } } } if (AnimalContestController.CanChangeParticipant(farmAnimal)) { AnimalContestController.RemoveAnimalParticipant(farmAnimal); itemsToReturn.Add(ToolsFactory.GetParticipantRibbon()); } return itemsToReturn; }
public AnimalQueryMenuExtended(FarmAnimal farmAnimal) : base(farmAnimal) { _farmAnimal = farmAnimal; if (!DataLoader.ModConfig.DisablePregnancy) { if (PregnancyController.IsAnimalPregnant(this._farmAnimal)) { pregnantStatus = new ClickableTextureComponent( new Microsoft.Xna.Framework.Rectangle( this.xPositionOnScreen + AnimalQueryMenu.width + Game1.pixelZoom * 3, this.yPositionOnScreen + AnimalQueryMenu.height - Game1.tileSize * 2 - IClickableMenu.borderWidth + Game1.pixelZoom, Game1.pixelZoom * 11, Game1.pixelZoom * 11), DataLoader.LooseSprites, new Microsoft.Xna.Framework.Rectangle(34, 29, 11, 11), 4f, false) { myID = region_allowReproductionButton, downNeighborID = region_okButton, upNeighborID = region_sellButton, rightNeighborID = region_treatStatus }; this.okButton.upNeighborID = region_allowReproductionButton; this.sellButton.downNeighborID = region_allowReproductionButton; if (Game1.options.SnappyMenus) { this.allClickableComponents.Remove(this.allowReproductionButton); this.allClickableComponents.Add(pregnantStatus); } this.allowReproductionButton = null; } } if (!DataLoader.ModConfig.DisableTreats && TreatsController.CanReceiveTreat(farmAnimal)) { if (TreatsController.IsReadyForTreat(farmAnimal)) { treatStatus = new ClickableTextureComponent( new Microsoft.Xna.Framework.Rectangle( this.xPositionOnScreen + AnimalQueryMenu.width + Game1.tileSize + 4, this.yPositionOnScreen + AnimalQueryMenu.height - Game1.tileSize * 2 - IClickableMenu.borderWidth, Game1.tileSize, Game1.tileSize), DataLoader.ToolsSprites, new Microsoft.Xna.Framework.Rectangle(240, 0, 16, 16), 4f, false) { myID = region_treatStatus, leftNeighborID = region_allowReproductionButton }; } else { treatStatus = new ClickableTextureComponent( new Microsoft.Xna.Framework.Rectangle( this.xPositionOnScreen + AnimalQueryMenu.width + Game1.tileSize + 4, this.yPositionOnScreen + AnimalQueryMenu.height - Game1.tileSize * 2 - IClickableMenu.borderWidth, Game1.tileSize, Game1.tileSize), DataLoader.LooseSprites, new Microsoft.Xna.Framework.Rectangle(16, 28, 16, 16), 4f, false) { myID = region_treatStatus, leftNeighborID = region_allowReproductionButton }; } if (this.allowReproductionButton != null) { this.allowReproductionButton.rightNeighborID = region_treatStatus; } if (Game1.options.SnappyMenus) { this.allClickableComponents.Add(treatStatus); } } if (AnimalContestController.HasWon(farmAnimal)) { animalContestIndicator = new ClickableTextureComponent(new Microsoft.Xna.Framework.Rectangle(this.xPositionOnScreen + AnimalQueryMenu.width + Game1.tileSize + 4, this.yPositionOnScreen + AnimalQueryMenu.height - Game1.tileSize * 4 - IClickableMenu.borderWidth, Game1.tileSize, Game1.tileSize), DataLoader.LooseSprites, new Microsoft.Xna.Framework.Rectangle(AnimalContestController.HasFertilityBonus(this._farmAnimal) ? 48 : 64, 29, 16, 15), 4f, false) { myID = region_animalConstestIndicator, leftNeighborID = region_moveHomeButton }; this.moveHomeButton.rightNeighborID = region_animalConstestIndicator; if (Game1.options.SnappyMenus) { this.allClickableComponents.Add(animalContestIndicator); } } else if (farmAnimal.GetDayParticipatedContest() != null) { animalContestIndicator = new ClickableTextureComponent(new Microsoft.Xna.Framework.Rectangle(this.xPositionOnScreen + AnimalQueryMenu.width + Game1.tileSize + 4, this.yPositionOnScreen + AnimalQueryMenu.height - Game1.tileSize * 4 - IClickableMenu.borderWidth, Game1.tileSize, Game1.tileSize), DataLoader.ToolsSprites, new Microsoft.Xna.Framework.Rectangle(256, 0, 16, 16), 4f, false) { myID = region_animalConstestIndicator, leftNeighborID = region_moveHomeButton }; this.moveHomeButton.rightNeighborID = region_animalConstestIndicator; if (Game1.options.SnappyMenus) { this.allClickableComponents.Add(animalContestIndicator); } } if (!DataLoader.ModConfig.DisableMeat && MeatController.CanGetMeatFrom(farmAnimal)) { if (!this._farmAnimal.isBaby()) { meatButton = new ClickableTextureComponent(new Microsoft.Xna.Framework.Rectangle(this.xPositionOnScreen + AnimalQueryMenu.width + Game1.tileSize + 4, this.yPositionOnScreen + AnimalQueryMenu.height - Game1.tileSize * 3 - IClickableMenu.borderWidth, Game1.tileSize, Game1.tileSize), DataLoader.LooseSprites, new Microsoft.Xna.Framework.Rectangle(0, 28, 16, 16), 4f, false) { myID = region_meatButton, leftNeighborID = region_sellButton }; } this.sellButton.rightNeighborID = region_meatButton; if (Game1.options.SnappyMenus) { this.allClickableComponents.Add(meatButton); } } if (this.animalContestIndicator != null) { this.moveHomeButton.rightNeighborID = region_animalConstestIndicator; if (this.meatButton != null) { this.meatButton.upNeighborID = region_animalConstestIndicator; this.animalContestIndicator.downNeighborID = region_meatButton; } else if (this.treatStatus != null) { this.treatStatus.upNeighborID = region_animalConstestIndicator; this.animalContestIndicator.downNeighborID = region_treatStatus; } } if (this.meatButton != null) { this.sellButton.rightNeighborID = region_meatButton; if (this.treatStatus != null) { this.treatStatus.upNeighborID = region_meatButton; this.meatButton.downNeighborID = region_treatStatus; } } if (this.treatStatus != null) { if (this.pregnantStatus == null && this.allowReproductionButton == null) { this.treatStatus.downNeighborID = region_okButton; if (this.meatButton == null && this.animalContestIndicator == null) { this.treatStatus.upNeighborID = region_sellButton; this.okButton.upNeighborID = region_treatStatus; this.sellButton.downNeighborID = region_treatStatus; } } } _parentName = DataLoader.Helper.Reflection.GetField <String>(this, "parentName").GetValue(); _textBox = DataLoader.Helper.Reflection.GetField <TextBox>(this, "textBox").GetValue(); _movingAnimal = DataLoader.Helper.Reflection.GetField <bool>(this, "movingAnimal"); _confirmingSell = DataLoader.Helper.Reflection.GetField <bool>(this, "confirmingSell"); _lovelLevel = DataLoader.Helper.Reflection.GetField <double>(this, "loveLevel"); _hoverText = DataLoader.Helper.Reflection.GetField <string>(this, "hoverText"); }