Пример #1
0
        /// <summary>Raised after the in-game clock time changes.</summary>
        /// <param name="sender">The event sender.</param>
        /// <param name="e">The event arguments.</param>
        private void OnTimeChanged(object sender, TimeChangedEventArgs e)
        {
            if (!Game1.hasLoadedGame)
            {
                return;
            }

            if (Game1.currentLocation is BathHousePool && Game1.player.swimming.Value)
            {
                TimeInBathHouse += 10;
                Monitor.Log($"In the BathHouse Pool for {TimeInBathHouse}");
            }

            if (TimeInBathHouse > 30)
            {
                StaminaMngr.ClearDrain(StaminaDrain.BathHouseClear);
                TimeInBathHouse = 0;
            }

            string weatherStatus;

            //get current weather string
            if (UseClimates)
            {
                weatherStatus = climatesAPI.GetCurrentWeatherName();
            }
            else
            {
                weatherStatus = SDVUtilities.GetWeatherName();
            }

            //handle being inside...
            double?temp = (UseClimates) ? climatesAPI.GetTodaysLow() : 100.0;

            if (temp is null)
            {
                temp = 100.0;
            }

            Game1.player.stamina += StaminaMngr.TenMinuteTick(Game1.player.hat.Value?.which.Value, temp, weatherStatus, TicksInLocation, TicksOutside, TicksTotal, Dice);

            if (Game1.player.stamina <= 0)
            {
                Game1.player.exhausted.Value = true;
                Game1.player.stamina         = -20;
            }

            TicksTotal      = 0;
            TicksOutside    = 0;
            TicksInLocation = 0;
        }