Esempio n. 1
0
        private void OnDayChanged(object obj, EventArgs args)
        {
            Farmer player = Game1.player;

            if (player != null)
            {
                String season       = Game1.currentSeason;
                int    fishingLevel = player.FishingLevel;

                switch (season)
                {
                case ("spring"):

                    if (fishingLevel >= 10 && !letterLegendarySpring.HasRecieved(player))
                    {
                        letterLegendarySpring.DeliverMail(player, immediately: true);
                    }

                    break;

                case ("summer"):

                    if (fishingLevel >= 5 && !letterLegendarySummer.HasRecieved(player))
                    {
                        letterLegendarySummer.DeliverMail(player, immediately: true);
                    }

                    break;

                case ("winter"):

                    if (fishingLevel >= 6 && !letterLegendaryWinter.HasRecieved(player))
                    {
                        letterLegendaryWinter.DeliverMail(player, immediately: true);
                    }

                    break;

                case ("fall"):

                    if (fishingLevel >= 3 && !letterLegendaryFall.HasRecieved(player))
                    {
                        letterLegendaryFall.DeliverMail(player, immediately: true);
                    }
                    break;

                default:
                    logger.Error($"Unknown season {season}");
                    break;
                }

                // 10% chance to deliver the dish of the day notice.
                if (MathsUtils.TryPercentage(0.10))
                {
                    // 5% chance for the dish of the day to include a sample.
                    if (MathsUtils.TryPercentage(0.05))
                    {
                        letterDishOfTheDaySample.DeliverMail(Game1.player, allowDuplicates: true, immediately: true);
                    }

                    // Otherwise the player just gets the notification.
                    else
                    {
                        letterDishOfTheDay.DeliverMail(Game1.player, allowDuplicates: true, immediately: true);
                    }
                }

                // Deliver secret woods letter if the player doesn't have it, and has an axe that can break the log.
                if (!letterSecretWoodsHideAndSeek.HasRecieved(Game1.player) && DoesFarmerHaveToolTier(Game1.player, "Axe", 2))
                {
                    letterSecretWoodsHideAndSeek.DeliverMail(Game1.player, immediately: true);
                }

                Tool tool     = Game1.player.toolBeingUpgraded.Value;
                int  daysLeft = Game1.player.daysLeftForToolUpgrade.Value;

                // If Clint has a tool ready for delivery, send the notif letter.
                if (tool != null && daysLeft == 0)
                {
                    letterBlacksmithFinished.DeliverMail(Game1.player, allowDuplicates: true, immediately: true);
                }
            }
        }