private bool AttemptToGiveTreatToFarmAnimal(FarmAnimal farmAnimal)
        {
            string type = farmAnimal.GetType().ToString();
            string id   = farmAnimal.myID.ToString();

            FarmAnimalTreat treatHandler = new FarmAnimalTreat(farmAnimal, this.Config);

            // Refuse a poisonous treat
            if (treatHandler.IsPoisonous(Game1.player.ActiveObject))
            {
                treatHandler.RefuseTreat(true);

                return(false);
            }

            // Can only give a treat once per day
            if (this.GivenTreatToday(type, id))
            {
                treatHandler.RefuseTreat(false);

                return(false);
            }

            treatHandler.GiveTreat();

            this.TrackGivenTreat(type, id);

            return(true);
        }
        private void AttemptToGiveTreatToFarmAnimal(FarmAnimal farmAnimal)
        {
            var type = farmAnimal.GetType().ToString();
            var id   = farmAnimal.myID.ToString();

            var treatHandler = new FarmAnimalTreat(farmAnimal, _config);

            // Refuse a poisonous treat
            if (CharacterTreat.IsPoisonous(Game1.player.ActiveObject))
            {
                treatHandler.RefuseTreat(true);

                return;
            }

            // Can only give a treat once per day
            if (GivenTreatToday(type, id))
            {
                treatHandler.RefuseTreat(false);

                return;
            }

            treatHandler.GiveTreat();

            TrackGivenTreat(type, id);
        }
Exemple #3
0
 public static void CanFindProduce(FarmAnimal moddedAnimal)
 {
     if (!moddedAnimal.CanFindProduce())
     {
         throw new ApplicationException(string.Format("{0} cannot find produce", moddedAnimal.GetType()));
     }
 }