/// <summary>Get the random gift for today.</summary>
        private static SObject GetRandomGift()
        {
            SObject gift = ObjectPatcher
                           .GetCandidateVillagers()
                           .Select(ObjectPatcher.GetRandomGift)
                           .FirstOrDefault(p => p is not null);

            return(gift ?? new SObject(SObject.prismaticShardIndex, 1));
        }
        /*********
        ** Private methods
        *********/
        /// <summary>The method to call after <see cref="SObject.DayUpdate"/>.</summary>
        public static void After_DayUpdate(SObject __instance, GameLocation location)
        {
            if (!__instance.bigCraftable.Value || __instance.ParentSheetIndex != ObjectPatcher.GetStatueId())
            {
                return;
            }

            __instance.MinutesUntilReady = 1;
            __instance.heldObject.Value  = ObjectPatcher.GetRandomGift();
        }
Example #3
0
        /*********
        ** Private methods
        *********/
        /// <summary>The method to call after <see cref="SObject.DayUpdate"/>.</summary>
        public static void After_DayUpdate(SObject __instance, GameLocation location)
        {
            if (!__instance.bigCraftable.Value || __instance.ParentSheetIndex != ObjectPatcher.GetStatueId())
            {
                return;
            }

            NPC npc = Utility.getTodaysBirthdayNPC(Game1.currentSeason, Game1.dayOfMonth) ?? Utility.getRandomTownNPC();

            Game1.NPCGiftTastes.TryGetValue(npc.Name, out string str);
            string[] favs = str.Split('/')[1].Split(' ');

            __instance.MinutesUntilReady = 1;
            __instance.heldObject.Value  = new SObject(int.Parse(favs[Game1.random.Next(favs.Length)]), 1);
        }