Example #1
0
 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
                     });
                 }
             }
         }
     }
 }
Example #2
0
        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");
        }
Example #3
0
        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))
            {
                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);
                }
                else
                {
                    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");
        }