private bool AttemptToGiveTreatToFarmAnimals(NetLongDictionary <FarmAnimal, NetRef <FarmAnimal> > animals, Rectangle rectangle)
        {
            foreach (var pair in animals.Pairs.Where(pair => pair.Value.GetBoundingBox().Intersects(rectangle)))
            {
                AttemptToGiveTreatToFarmAnimal(pair.Value);

                // Intersects always return true
                return(true);
            }

            return(false);
        }
Beispiel #2
0
        private bool AttemptToGiveTreatToFarmAnimals(NetLongDictionary <FarmAnimal, NetRef <FarmAnimal> > animals, Microsoft.Xna.Framework.Rectangle rectangle)
        {
            foreach (KeyValuePair <long, FarmAnimal> pair in animals.Pairs)
            {
                if (pair.Value.GetBoundingBox().Intersects(rectangle))
                {
                    this.AttemptToGiveTreatToFarmAnimal(pair.Value);

                    // Intersects always return true
                    return(true);
                }
            }

            return(false);
        }
        private NetLongDictionary <FarmAnimal, NetRef <FarmAnimal> > GetAnimalsInCurrentLocation()
        {
            NetLongDictionary <FarmAnimal, NetRef <FarmAnimal> > animals = null;

            if (Game1.currentLocation is AnimalHouse)
            {
                animals = (Game1.currentLocation as AnimalHouse).animals;
            }
            else if (Game1.currentLocation is Farm)
            {
                animals = (Game1.currentLocation as Farm).animals;
            }

            return(animals);
        }
Beispiel #4
0
        private void OnUpdateTicked(object sender, UpdateTickedEventArgs e)
        {
            if (!Context.IsPlayerFree || !Game1.currentLocation.IsFarm)
            {
                return;
            }
            _hoverText = null;
            if (!_modConfigs.IsUIEnabled)
            {
                return;
            }

            GameLocation location = Game1.currentLocation;
            Vector2      mousePos = new Vector2(Game1.getOldMouseX() + Game1.viewport.X, Game1.getOldMouseY() + Game1.viewport.Y) / Game1.tileSize;

            FarmAnimal[] animals = new FarmAnimal[0];
            switch (location)
            {
            case AnimalHouse house:
                animals = house.animals.Values.ToArray();
                break;

            case Farm farm:
                animals = farm.animals.Values.ToArray();
                break;
            }

            foreach (FarmAnimal animal in animals)
            {
                RectangleF animalBoundaries = new RectangleF(animal.position.X, animal.position.Y - animal.Sprite.getHeight(), animal.Sprite.getWidth() * 3 + animal.Sprite.getWidth() / 1.5f, animal.Sprite.getHeight() * 4);

                if (animalBoundaries.Contains(mousePos.X * Game1.tileSize, mousePos.Y * Game1.tileSize))
                {
                    _hoverText = animal.wasPet.Value ? _modConfigs.AlreadyPettedMessage : _modConfigs.NeedsPettingMessage;
                }
            }

            foreach (Pet pet in location.characters.OfType <Pet>())
            {
                RectangleF petBoundaries = new RectangleF(pet.position.X, pet.position.Y - pet.Sprite.getHeight() * 2, pet.Sprite.getWidth() * 3 + pet.Sprite.getWidth() / 1.5f, pet.Sprite.getHeight() * 4);
                if (petBoundaries.Contains(mousePos.X * Game1.tileSize, mousePos.Y * Game1.tileSize))
                {
                    NetLongDictionary <int, NetInt> lastPettedDays = Helper.Reflection.GetField <NetLongDictionary <int, NetInt> >(pet, "lastPetDay").GetValue();
                    bool wasPet = lastPettedDays.Values.Any(day => day == Game1.Date.TotalDays);
                    _hoverText = wasPet ? _modConfigs.AlreadyPettedMessage : _modConfigs.NeedsPettingMessage;
                }
            }
        }
Beispiel #5
0
        private static bool checkAction_Prefix(GameLocation __instance, Location tileLocation, Farmer who, ref bool __result)
        {
            if (who?.CurrentItem == null || who.CurrentItem.Name != "Instant Growth Powder")
            {
                return(true);
            }

            if (__instance.isCropAtTile(tileLocation.X, tileLocation.Y) && !(__instance.terrainFeatures[new Vector2(tileLocation.X, tileLocation.Y)] as HoeDirt).crop.fullyGrown)
            {
                (__instance.terrainFeatures[new Vector2(tileLocation.X, tileLocation.Y)] as HoeDirt).crop.growCompletely();
                who.CurrentItem.Stack--;
                __instance.playSound("yoba");
                __result = true;
                return(false);
            }
            Microsoft.Xna.Framework.Rectangle tileRect = new Microsoft.Xna.Framework.Rectangle(tileLocation.X * 64, tileLocation.Y * 64, 64, 64);

            foreach (NPC i in __instance.characters)
            {
                if (i != null && i is Child && i.GetBoundingBox().Intersects(tileRect) && (i.Age < 3))
                {
                    i.Age = 3;
                    who.CurrentItem.Stack--;
                    __instance.playSound("yoba");
                    return(true);
                }
            }

            try
            {
                NetLongDictionary <FarmAnimal, NetRef <FarmAnimal> > dict = SHelper.Reflection.GetField <NetLongDictionary <FarmAnimal, NetRef <FarmAnimal> > >(__instance, "animals").GetValue();
                foreach (KeyValuePair <long, FarmAnimal> i in dict.Pairs)
                {
                    if (i.Value.age < i.Value.ageWhenMature)
                    {
                        i.Value.age.Value = i.Value.ageWhenMature;
                        i.Value.Sprite.LoadTexture("Animals\\" + i.Value.type.Value);
                        if (i.Value.type.Value.Contains("Sheep"))
                        {
                            i.Value.currentProduce.Value = i.Value.defaultProduceIndex;
                        }
                        i.Value.daysSinceLastLay.Value = 99;

                        who.CurrentItem.Stack--;
                        __instance.playSound("yoba");
                        return(true);
                    }
                }
            }
            catch { }


            foreach (KeyValuePair <Vector2, TerrainFeature> v in __instance.terrainFeatures.Pairs)
            {
                if (v.Value.getBoundingBox(v.Key).Intersects(tileRect) && v.Value is Tree && (v.Value as Tree).growthStage < 5)
                {
                    (__instance.terrainFeatures[v.Key] as Tree).growthStage.Value = 5;
                    (__instance.terrainFeatures[v.Key] as Tree).fertilized.Value  = true;
                    (__instance.terrainFeatures[v.Key] as Tree).dayUpdate(Game1.currentLocation, v.Key);
                    (__instance.terrainFeatures[v.Key] as Tree).fertilized.Value = false;

                    who.CurrentItem.Stack--;
                    __instance.playSound("yoba");
                    return(true);
                }
                if (v.Value.getBoundingBox(v.Key).Intersects(tileRect) && v.Value is FruitTree && (v.Value as FruitTree).growthStage < 4)
                {
                    FruitTree tree = v.Value as FruitTree;
                    tree.daysUntilMature.Value        = 0;
                    tree.growthStage.Value            = 4;
                    __instance.terrainFeatures[v.Key] = tree;

                    who.CurrentItem.Stack--;
                    __instance.playSound("yoba");
                    return(true);
                }
            }

            foreach (KeyValuePair <Vector2, Object> v in __instance.objects.Pairs)
            {
                if (v.Value.getBoundingBox(v.Key).Intersects(tileRect) && v.Value is IndoorPot && !(v.Value as IndoorPot).hoeDirt.Value.crop.fullyGrown)
                {
                    (v.Value as IndoorPot).hoeDirt.Value.crop.growCompletely();

                    who.CurrentItem.Stack--;
                    __instance.playSound("yoba");
                    return(true);
                }
            }

            return(true);
        }
Beispiel #6
0
        private bool WasPetToday(Pet pet)
        {
            NetLongDictionary <int, NetInt> lastPettedDays = _helper.Reflection.GetField <NetLongDictionary <int, NetInt> >(pet, "lastPetDay").GetValue();

            return(lastPettedDays.TryGetValue(Game1.player.UniqueMultiplayerID, out int lastDay) && lastDay == Game1.Date.TotalDays);
        }
        /// <summary>The method to call before <see cref="Utility.fixAllAnimals"/>.</summary>
        private static bool Before_FixAllAnimals()
        {
            if (!Game1.IsMasterGame)
            {
                return(false);
            }

            foreach (var loc in Mod.GetAllLocations())
            {
                if (loc is BuildableGameLocation farm && loc is IAnimalLocation farm_animals)
                {
                    foreach (Building building in farm.buildings)
                    {
                        if (building.indoors.Value is AnimalHouse house)
                        {
                            foreach (long id in house.animalsThatLiveHere)
                            {
                                FarmAnimal animal = Utility.getAnimal(id);
                                if (animal != null)
                                {
                                    animal.home = building;
                                    animal.homeLocation.Value = new Vector2(building.tileX.Value, building.tileY.Value);
                                }
                            }
                        }
                    }
                    List <FarmAnimal> farmAnimalList1 = new List <FarmAnimal>();
                    foreach (FarmAnimal allFarmAnimal in UtilityPatcher.GetAllFarmAnimals(farm))
                    {
                        if (allFarmAnimal.home == null)
                        {
                            farmAnimalList1.Add(allFarmAnimal);
                        }
                    }
                    foreach (FarmAnimal farmAnimal in farmAnimalList1)
                    {
                        NetDictionary <long, FarmAnimal, NetRef <FarmAnimal>, SerializableDictionary <long, FarmAnimal>, NetLongDictionary <FarmAnimal, NetRef <FarmAnimal> > > .PairsCollection pairs;
                        KeyValuePair <long, FarmAnimal> keyValuePair;
                        foreach (Building building in farm.buildings)
                        {
                            if (building.indoors.Value is AnimalHouse house)
                            {
                                for (int index = house.animals.Count() - 1; index >= 0; --index)
                                {
                                    pairs        = house.animals.Pairs;
                                    keyValuePair = pairs.ElementAt(index);
                                    if (keyValuePair.Value.Equals(farmAnimal))
                                    {
                                        NetLongDictionary <FarmAnimal, NetRef <FarmAnimal> > animals = house.animals;
                                        pairs        = house.animals.Pairs;
                                        keyValuePair = pairs.ElementAt(index);
                                        long key = keyValuePair.Key;
                                        animals.Remove(key);
                                    }
                                }
                            }
                        }
                        for (int index = farm_animals.Animals.Count() - 1; index >= 0; --index)
                        {
                            pairs        = farm_animals.Animals.Pairs;
                            keyValuePair = pairs.ElementAt(index);
                            if (keyValuePair.Value.Equals(farmAnimal))
                            {
                                NetLongDictionary <FarmAnimal, NetRef <FarmAnimal> > animals = farm_animals.Animals;
                                pairs        = farm_animals.Animals.Pairs;
                                keyValuePair = pairs.ElementAt(index);
                                long key = keyValuePair.Key;
                                animals.Remove(key);
                            }
                        }
                    }
                    foreach (Building building in farm.buildings)
                    {
                        if (building.indoors.Value is AnimalHouse house)
                        {
                            for (int index = house.animalsThatLiveHere.Count - 1; index >= 0; --index)
                            {
                                if (Utility.getAnimal(house.animalsThatLiveHere[index]).home != building)
                                {
                                    house.animalsThatLiveHere.RemoveAt(index);
                                }
                            }
                        }
                    }
                    foreach (FarmAnimal farmAnimal in farmAnimalList1)
                    {
                        foreach (Building building in farm.buildings)
                        {
                            if (building.buildingType.Contains(farmAnimal.buildingTypeILiveIn.Value) && building.indoors.Value is AnimalHouse house && !house.isFull())
                            {
                                farmAnimal.home = building;
                                farmAnimal.homeLocation.Value = new Vector2(building.tileX.Value, building.tileY.Value);
                                farmAnimal.setRandomPosition(farmAnimal.home.indoors.Value);
                                (farmAnimal.home.indoors.Value as AnimalHouse).animals.Add(farmAnimal.myID.Value, farmAnimal);
                                (farmAnimal.home.indoors.Value as AnimalHouse).animalsThatLiveHere.Add(farmAnimal.myID.Value);
                                break;
                            }
                        }
                    }
                    List <FarmAnimal> farmAnimalList2 = new List <FarmAnimal>();
                    foreach (FarmAnimal farmAnimal in farmAnimalList1)
                    {
                        if (farmAnimal.home == null)
                        {
                            farmAnimalList2.Add(farmAnimal);
                        }
                    }
                    foreach (FarmAnimal farmAnimal in farmAnimalList2)
                    {
                        farmAnimal.Position = Utility.recursiveFindOpenTileForCharacter(farmAnimal, farm, new Vector2(40f, 40f), 200) * 64f;
                        if (!farm_animals.Animals.ContainsKey(farmAnimal.myID.Value))
                        {
                            farm_animals.Animals.Add(farmAnimal.myID.Value, farmAnimal);
                        }
                    }
                }
            }
            return(false);
        }
Beispiel #8
0
        private static bool checkAction_Prefix(GameLocation __instance, Location tileLocation, Farmer who, ref bool __result)
        {
            if (who?.CurrentItem == null || who.CurrentItem.Name != "Instant Growth Powder")
            {
                return(true);
            }

            if (__instance.isCropAtTile(tileLocation.X, tileLocation.Y))
            {
                if (!(__instance.terrainFeatures[new Vector2(tileLocation.X, tileLocation.Y)] as HoeDirt).crop.fullyGrown.Value)
                {
                    (__instance.terrainFeatures[new Vector2(tileLocation.X, tileLocation.Y)] as HoeDirt).crop.growCompletely();
                }
                else if ((__instance.terrainFeatures[new Vector2(tileLocation.X, tileLocation.Y)] as HoeDirt).crop.regrowAfterHarvest.Value >= 0 && (__instance.terrainFeatures[new Vector2(tileLocation.X, tileLocation.Y)] as HoeDirt).crop.dayOfCurrentPhase.Value > 0)
                {
                    (__instance.terrainFeatures[new Vector2(tileLocation.X, tileLocation.Y)] as HoeDirt).crop.dayOfCurrentPhase.Value = 0;
                }
                else
                {
                    return(true);
                }

                who.reduceActiveItemByOne();
                __instance.playSound("yoba");
                __result = true;
                return(false);
            }
            Microsoft.Xna.Framework.Rectangle tileRect = new Microsoft.Xna.Framework.Rectangle(tileLocation.X * 64, tileLocation.Y * 64, 64, 64);

            foreach (NPC i in __instance.characters)
            {
                if (i != null && i is Child && i.GetBoundingBox().Intersects(tileRect) && (i.Age < 3))
                {
                    i.Age = 3;
                    (i as Child).daysOld.Value = 55;
                    i.speed = 4;
                    i.reloadSprite();

                    who.reduceActiveItemByOne();
                    __instance.playSound("yoba");
                    __result = true;
                    return(false);
                }
            }

            try
            {
                NetLongDictionary <FarmAnimal, NetRef <FarmAnimal> > dict = SHelper.Reflection.GetField <NetLongDictionary <FarmAnimal, NetRef <FarmAnimal> > >(__instance, "animals").GetValue();
                foreach (KeyValuePair <long, FarmAnimal> i in dict.Pairs)
                {
                    if (i.Value.GetCursorPetBoundingBox().Intersects(tileRect))
                    {
                        i.Value.age.Value = i.Value.ageWhenMature.Value;
                        i.Value.reloadData();
                        if (i.Value.type.Value.Contains("Sheep"))
                        {
                            i.Value.currentProduce.Value = i.Value.defaultProduceIndex.Value;
                        }
                        i.Value.daysSinceLastLay.Value = 99;

                        who.reduceActiveItemByOne();
                        __instance.playSound("yoba");
                        __result = true;
                        return(false);
                    }
                }
            }
            catch { }


            foreach (KeyValuePair <Vector2, TerrainFeature> v in __instance.terrainFeatures.Pairs)
            {
                if (v.Value.getBoundingBox(v.Key).Intersects(tileRect) && v.Value is Tree && (v.Value as Tree).growthStage.Value < 5)
                {
                    (__instance.terrainFeatures[v.Key] as Tree).growthStage.Value = 5;
                    (__instance.terrainFeatures[v.Key] as Tree).fertilized.Value  = true;
                    (__instance.terrainFeatures[v.Key] as Tree).dayUpdate(Game1.currentLocation, v.Key);
                    (__instance.terrainFeatures[v.Key] as Tree).fertilized.Value = false;

                    who.reduceActiveItemByOne();
                    __instance.playSound("yoba");
                    __result = true;
                    return(false);
                }
                if (v.Value.getBoundingBox(v.Key).Intersects(tileRect) && v.Value is FruitTree && (v.Value as FruitTree).growthStage.Value < 4)
                {
                    FruitTree tree = v.Value as FruitTree;
                    tree.daysUntilMature.Value        = 0;
                    tree.growthStage.Value            = 4;
                    __instance.terrainFeatures[v.Key] = tree;

                    who.reduceActiveItemByOne();
                    __instance.playSound("yoba");
                    __result = true;
                    return(false);
                }
                if (v.Value.getBoundingBox(v.Key).Intersects(tileRect) && v.Value is Bush && (v.Value as Bush).size.Value == 3 && (v.Value as Bush).getAge() < 20)
                {
                    Bush bush = v.Value as Bush;
                    bush.datePlanted.Value -= 20 - bush.getAge();
                    Game1.currentLocation.terrainFeatures[v.Key] = bush;
                    Game1.currentLocation.terrainFeatures[v.Key].loadSprite();

                    who.reduceActiveItemByOne();
                    __instance.playSound("yoba");
                    __result = true;
                    return(false);
                }
            }

            foreach (KeyValuePair <Vector2, Object> v in __instance.objects.Pairs)
            {
                if (v.Value.getBoundingBox(v.Key).Intersects(tileRect) && v.Value is IndoorPot && (v.Value as IndoorPot).hoeDirt.Value?.crop != null)
                {
                    if (!(v.Value as IndoorPot).hoeDirt.Value.crop.fullyGrown.Value)
                    {
                        (v.Value as IndoorPot).hoeDirt.Value.crop.growCompletely();
                    }
                    else if ((v.Value as IndoorPot).hoeDirt.Value.crop.regrowAfterHarvest.Value >= 0 && (v.Value as IndoorPot).hoeDirt.Value.crop.dayOfCurrentPhase.Value > 0)
                    {
                        (v.Value as IndoorPot).hoeDirt.Value.crop.dayOfCurrentPhase.Value = 0;
                    }
                    else
                    {
                        return(true);
                    }

                    who.reduceActiveItemByOne();
                    __instance.playSound("yoba");
                    __result = true;
                    return(false);
                }
                if (v.Value.getBoundingBox(v.Key).Intersects(tileRect) && v.Value is IndoorPot && (v.Value as IndoorPot).bush.Value?.getAge() < 20)
                {
                    (v.Value as IndoorPot).bush.Value.datePlanted.Value -= 20 - (v.Value as IndoorPot).bush.Value.getAge();
                    (v.Value as IndoorPot).bush.Value.loadSprite();

                    who.reduceActiveItemByOne();
                    __instance.playSound("yoba");
                    __result = true;
                    return(false);
                }
            }

            return(true);
        }
Beispiel #9
0
        public static bool Prefix()
        {
            if (!Game1.IsMasterGame)
            {
                return(false);
            }

            foreach (var loc in Mod.GetAllLocations())
            {
                if (loc is BuildableGameLocation farm && loc is IAnimalLocation farm_animals)
                {
                    foreach (Building building in farm.buildings)
                    {
                        if (building.indoors.Value != null && building.indoors.Value is AnimalHouse)
                        {
                            foreach (long id in (NetList <long, NetLong>)(building.indoors.Value as AnimalHouse).animalsThatLiveHere)
                            {
                                FarmAnimal animal = Utility.getAnimal(id);
                                if (animal != null)
                                {
                                    animal.home = building;
                                    animal.homeLocation.Value = new Vector2(( float )( int )(NetFieldBase <int, NetInt>)building.tileX, ( float )( int )(NetFieldBase <int, NetInt>)building.tileY);
                                }
                            }
                        }
                    }
                    List <FarmAnimal> farmAnimalList1 = new List <FarmAnimal>();
                    foreach (FarmAnimal allFarmAnimal in getAllFarmAnimals(farm))
                    {
                        if (allFarmAnimal.home == null)
                        {
                            farmAnimalList1.Add(allFarmAnimal);
                        }
                    }
                    foreach (FarmAnimal farmAnimal in farmAnimalList1)
                    {
                        NetDictionary <long, FarmAnimal, NetRef <FarmAnimal>, SerializableDictionary <long, FarmAnimal>, NetLongDictionary <FarmAnimal, NetRef <FarmAnimal> > > .PairsCollection pairs;
                        KeyValuePair <long, FarmAnimal> keyValuePair;
                        foreach (Building building in farm.buildings)
                        {
                            if (building.indoors.Value != null && building.indoors.Value is AnimalHouse)
                            {
                                for (int index = (building.indoors.Value as AnimalHouse).animals.Count() - 1; index >= 0; --index)
                                {
                                    pairs        = (building.indoors.Value as AnimalHouse).animals.Pairs;
                                    keyValuePair = pairs.ElementAt(index);
                                    if (keyValuePair.Value.Equals(( object )farmAnimal))
                                    {
                                        NetLongDictionary <FarmAnimal, NetRef <FarmAnimal> > animals = (building.indoors.Value as AnimalHouse).animals;
                                        pairs        = (building.indoors.Value as AnimalHouse).animals.Pairs;
                                        keyValuePair = pairs.ElementAt(index);
                                        long key = keyValuePair.Key;
                                        animals.Remove(key);
                                    }
                                }
                            }
                        }
                        for (int index = farm_animals.Animals.Count() - 1; index >= 0; --index)
                        {
                            pairs        = farm_animals.Animals.Pairs;
                            keyValuePair = pairs.ElementAt(index);
                            if (keyValuePair.Value.Equals(( object )farmAnimal))
                            {
                                NetLongDictionary <FarmAnimal, NetRef <FarmAnimal> > animals = farm_animals.Animals;
                                pairs        = farm_animals.Animals.Pairs;
                                keyValuePair = pairs.ElementAt(index);
                                long key = keyValuePair.Key;
                                animals.Remove(key);
                            }
                        }
                    }
                    foreach (Building building in farm.buildings)
                    {
                        if (building.indoors.Value != null && building.indoors.Value is AnimalHouse)
                        {
                            for (int index = (building.indoors.Value as AnimalHouse).animalsThatLiveHere.Count - 1; index >= 0; --index)
                            {
                                if (Utility.getAnimal((building.indoors.Value as AnimalHouse).animalsThatLiveHere[index]).home != building)
                                {
                                    (building.indoors.Value as AnimalHouse).animalsThatLiveHere.RemoveAt(index);
                                }
                            }
                        }
                    }
                    foreach (FarmAnimal farmAnimal in farmAnimalList1)
                    {
                        foreach (Building building in farm.buildings)
                        {
                            if (building.buildingType.Contains(( string )(NetFieldBase <string, NetString>)farmAnimal.buildingTypeILiveIn) && building.indoors.Value != null && (building.indoors.Value is AnimalHouse && !(building.indoors.Value as AnimalHouse).isFull()))
                            {
                                farmAnimal.home = building;
                                farmAnimal.homeLocation.Value = new Vector2(( float )( int )(NetFieldBase <int, NetInt>)building.tileX, ( float )( int )(NetFieldBase <int, NetInt>)building.tileY);
                                farmAnimal.setRandomPosition(( GameLocation )(NetFieldBase <GameLocation, NetRef <GameLocation> >)farmAnimal.home.indoors);
                                (farmAnimal.home.indoors.Value as AnimalHouse).animals.Add(( long )farmAnimal.myID, farmAnimal);
                                (farmAnimal.home.indoors.Value as AnimalHouse).animalsThatLiveHere.Add(( long )farmAnimal.myID);
                                break;
                            }
                        }
                    }
                    List <FarmAnimal> farmAnimalList2 = new List <FarmAnimal>();
                    foreach (FarmAnimal farmAnimal in farmAnimalList1)
                    {
                        if (farmAnimal.home == null)
                        {
                            farmAnimalList2.Add(farmAnimal);
                        }
                    }
                    foreach (FarmAnimal farmAnimal in farmAnimalList2)
                    {
                        farmAnimal.Position = Utility.recursiveFindOpenTileForCharacter(( Character )farmAnimal, ( GameLocation )farm, new Vector2(40f, 40f), 200) * 64f;
                        if (!farm_animals.Animals.ContainsKey(( long )farmAnimal.myID))
                        {
                            farm_animals.Animals.Add(( long )farmAnimal.myID, farmAnimal);
                        }
                    }
                }
            }
            return(false);
        }
Beispiel #10
0
        //This code copied from: https://stardewvalleywiki.com/Modding:Migrate_to_Stardew_Valley_1.4
        //The assumption is that pet cats and dogs can only benefit from being pet once, not once from each player in a multiplayer context
        //I couldn't determine whether this assumption is correct from the available documentation -- Garth
        private bool WasPetToday(Pet pet)
        {
            NetLongDictionary <int, NetInt> lastPettedDays = ModEntry.ReflectionHelper.GetField <NetLongDictionary <int, NetInt> >(pet, "lastPetDay").GetValue();

            return(lastPettedDays.Values.Any(day => day == Game1.Date.TotalDays));
        }