Ejemplo n.º 1
0
        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.CanChangeParticipantPet())
            {
                __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.RemovePetParticipant();
                Game1.player.addItemByMenuIfNecessary(new ParticipantRibbon());
                return(false);
            }
            return(true);
        }
Ejemplo n.º 2
0
        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);
        }