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)
            {
                this._animal.doEmote(20, true);

                if (!DataLoader.ModConfig.DisableFriendshipInscreseWithTreats)
                {
                    double professionAjust = 1.0;
                    if (!_animal.isCoopDweller() && who.professions.Contains(3) || _animal.isCoopDweller() && who.professions.Contains(2))
                    {
                        professionAjust += DataLoader.ModConfig.PercentualAjustOnFriendshipInscreaseFromProfessions;
                    }
                    this._animal.friendshipTowardFarmer.Value = Math.Min(1000, this._animal.friendshipTowardFarmer.Value + (int)Math.Ceiling(professionAjust * this.attachments[0].Price * (1.0 + this.attachments[0].Quality * 0.25) / (this._animal.price.Value / 1000.0)));
                }
                if (!DataLoader.ModConfig.DisableMoodInscreseWithTreats)
                {
                    this._animal.happiness.Value = byte.MaxValue;
                }

                if (DataLoader.ModConfig.EnableTreatsCountAsAnimalFeed)
                {
                    this._animal.fullness.Value = byte.MaxValue;
                }

                TreatsController.FeedAnimalTreat(this._animal, this.attachments[0]);

                if (this.attachments[0].Category == StardewValley.Object.MilkCategory)
                {
                    this._animal.age.Value = Math.Min(this._animal.ageWhenMature.Value - 1, this._animal.age.Value + 1);
                }

                --this.attachments[0].Stack;
                if (this.attachments[0].Stack <= 0)
                {
                    Game1.showGlobalMessage(DataLoader.i18n.Get("Tool.FeedingBasket.ItemConsumed", new { itemName = this.attachments[0].DisplayName }));
                    this.attachments[0] = (StardewValley.Object)null;
                }
            }
            else if (this._pet != null)
            {
                this._pet.doEmote(20, true);

                if (!DataLoader.ModConfig.DisableFriendshipInscreseWithTreats)
                {
                    this._pet.friendshipTowardFarmer.Value = Math.Min(Pet.maxFriendship, this._pet.friendshipTowardFarmer.Value + 6);
                }
                TreatsController.FeedPetTreat(this.attachments[0]);

                --this.attachments[0].Stack;
                if (this.attachments[0].Stack <= 0)
                {
                    Game1.showGlobalMessage(DataLoader.i18n.Get("Tool.FeedingBasket.ItemConsumed", new { itemName = this.attachments[0].DisplayName }));
                    this.attachments[0] = (StardewValley.Object)null;
                }
            }
            this._animal = null;
            this._pet    = 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 bool DoFunction(MilkPail __instance, GameLocation location, int x, int y, int power, StardewValley.Farmer who)
        {
            if (!IsFeedingBasket(__instance))
            {
                return(true);
            }

            string feedingBasketId = __instance.modData[FeedingBasketKey];

            BaseToolDoFunction(__instance, location, x, y, power, who);
            __instance.CurrentParentTileIndex    = InitialParentTileIndex;
            __instance.indexOfMenuItemView.Value = IndexOfMenuItemView;

            Animals.TryGetValue(feedingBasketId, out FarmAnimal animal);
            if (animal != null)
            {
                if (!DataLoader.ModConfig.DisableFriendshipInscreseWithTreats)
                {
                    double professionAjust = 1.0;
                    if (!animal.isCoopDweller() && who.professions.Contains(3) || animal.isCoopDweller() && who.professions.Contains(2))
                    {
                        professionAjust += DataLoader.ModConfig.PercentualAjustOnFriendshipInscreaseFromProfessions;
                    }
                    animal.friendshipTowardFarmer.Value = Math.Min(1000, animal.friendshipTowardFarmer.Value + (int)Math.Ceiling(professionAjust * __instance.attachments[0].Price * (1.0 + __instance.attachments[0].Quality * 0.25) / (animal.price.Value / 1000.0)));
                }
                if (!DataLoader.ModConfig.DisableMoodInscreseWithTreats)
                {
                    animal.happiness.Value = byte.MaxValue;
                }

                if (DataLoader.ModConfig.EnableTreatsCountAsAnimalFeed)
                {
                    animal.fullness.Value = byte.MaxValue;
                }

                TreatsController.FeedAnimalTreat(animal, __instance.attachments[0]);

                if (__instance.attachments[0].Category == SObject.MilkCategory)
                {
                    animal.age.Value = Math.Min(animal.ageWhenMature.Value - 1, animal.age.Value + 1);
                }

                --__instance.attachments[0].Stack;
                if (__instance.attachments[0].Stack <= 0)
                {
                    Game1.showGlobalMessage(DataLoader.i18n.Get("Tool.FeedingBasket.ItemConsumed", new { itemName = __instance.attachments[0].DisplayName }));
                    __instance.attachments[0] = null;
                }
            }
            if (Pets.TryGetValue(feedingBasketId, out Pet pet) && pet != null)
            {
                if (!DataLoader.ModConfig.DisableFriendshipInscreseWithTreats)
                {
                    pet.friendshipTowardFarmer.Value = Math.Min(Pet.maxFriendship, pet.friendshipTowardFarmer.Value + 6);
                }
                TreatsController.FeedAnimalTreat(pet, __instance.attachments[0]);

                --__instance.attachments[0].Stack;
                if (__instance.attachments[0].Stack <= 0)
                {
                    Game1.showGlobalMessage(DataLoader.i18n.Get("Tool.FeedingBasket.ItemConsumed", new { itemName = __instance.attachments[0].DisplayName }));
                    __instance.attachments[0] = null;
                }
            }
            Animals[feedingBasketId] = (FarmAnimal)null;
            Pets[feedingBasketId]    = (Pet)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);
        }