Beispiel #1
0
        private string GetCondWarning(WeatherConditions Current)
        {
            int rNumber = OurDice.Next(2);

            if (Current.ContainsCondition(CurrentWeather.Heatwave))
            {
                return(Helper.Get($"weather-condition.heatwave.{rNumber}"));
            }

            if (Current.ContainsCondition(CurrentWeather.Frost))
            {
                return(Helper.Get($"weather-condition.frost.{rNumber}"));
            }

            if (Current.ContainsCondition(CurrentWeather.WhiteOut))
            {
                return(Helper.Get($"weather-condition.whiteout.{rNumber}"));
            }

            if (Current.ContainsCondition(CurrentWeather.ThunderFrenzy))
            {
                return(Helper.Get($"weather-condition.thunderfrenzy.{rNumber}"));
            }

            return("");
        }
        internal string GenerateMenuPopup(WeatherConditions Current, string MoonPhase = "", string NightTime = "")
        {
            string text;

            if (SDate.Now().Season == "spring" && SDate.Now().Day == 1)
            {
                text = Translator.Get("weather-menu.openingS1D1", new { descDay = Translator.Get($"date{UpperSeason(SDate.Now().Season)}{SDate.Now().Day}") }) + Environment.NewLine + Environment.NewLine;
            }
            else if (SDate.Now().Season == "winter" && SDate.Now().Day == 28)
            {
                text = Translator.Get("weather-menu.openingS4D28", new { descDay = Translator.Get($"date{UpperSeason(SDate.Now().Season)}{SDate.Now().Day}") }) + Environment.NewLine + Environment.NewLine;
            }
            else
            {
                text = Translator.Get("weather-menu.opening", new { descDay = Translator.Get($"date{UpperSeason(SDate.Now().Season)}{SDate.Now().Day}") }) + Environment.NewLine + Environment.NewLine;
            }

            if (Current.ContainsCondition(CurrentWeather.Sandstorm))
            {
                text += Translator.Get("weather-menu.condition.sandstorm") + Environment.NewLine;
            }

            if (Current.ContainsCondition(CurrentWeather.Heatwave))
            {
                text += Translator.Get("weather-menu.condition.heatwave") + Environment.NewLine;
            }

            if (Current.ContainsCondition(CurrentWeather.Frost))
            {
                text += Translator.Get("weather-menu.condition.frost") + Environment.NewLine;
            }

            if (Current.ContainsCondition(CurrentWeather.WhiteOut))
            {
                text += Translator.Get("weather-menu.condition.whiteOut") + Environment.NewLine;
            }

            if (Current.ContainsCondition(CurrentWeather.ThunderFrenzy))
            {
                text += Translator.Get("weather-menu.condition.thunderFrenzy") + Environment.NewLine;
            }

            if (Current.IsVariableRain)
            {
                switch (WeatherUtilities.GetRainCategory(Current.AmtOfRainDrops))
                {
                case RainLevels.Severe:
                    text += Translator.Get("weather-condition.vrain.severe_sw") + Environment.NewLine;
                    break;

                case RainLevels.Torrential:
                    text += Translator.Get("weather-condition.vrain.torrential_sw") + Environment.NewLine;
                    break;

                case RainLevels.Typhoon:
                    text += Translator.Get("weather-condition.vrain.typhoon_sw") + Environment.NewLine;
                    break;

                case RainLevels.NoahsFlood:
                    text += Translator.Get("weather-condition.vrain.godswrath_sw") + Environment.NewLine;
                    break;

                default:
                    break;
                }
            }

            if (MoonPhase == "Blood Moon")
            {
                text += Translator.Get("weather-menu.condition.bloodmoon") + Environment.NewLine;
            }

            if (ClimatesOfFerngill.UseLunarDisturbancesApi && ClimatesOfFerngill.MoonAPI.IsSolarEclipse())
            {
                text += Translator.Get("weather-menu.condition.solareclipse") + Environment.NewLine;
            }

            ISDVWeather CurrentFog = Current.GetWeatherMatchingType("Fog").First();
            string      fogString  = "";

            //  If the fog is visible, we don't need to display fog information. However, if it's in the morning,
            //    and we know evening fog is likely, we should display the message it's expected
            // That said, if it's not, we need to pull the fog information down, assuming it's been reset. This checks that the fog end
            //    time is *before* now. To avoid nested trinary statements..
            if (SDVTime.CurrentTime < CurrentFog.WeatherExpirationTime && Current.GenerateEveningFog && CurrentFog.WeatherBeginTime < new SDVTime(1200))
            {
                fogString = Translator.Get("weather-menu.expectedFog");
            }
            if (CurrentFog.WeatherBeginTime > SDVTime.CurrentTime && Current.GenerateEveningFog)
            {
                fogString = Translator.Get("weather-menu.fogFuture",
                                           new
                {
                    fogTime = CurrentFog.WeatherBeginTime.ToString(),
                    endFog  = CurrentFog.WeatherExpirationTime.ToString()
                });
            }

            //Current Conditions.
            string currentMenu;

            if (Current.HasWeather(CurrentWeather.Rain) && Current.IsVariableRain)
            {
                currentMenu = "weather-menu.currentRainfall";
            }
            else
            {
                currentMenu = "weather-menu.current";
            }

            text += Translator.Get(currentMenu, new
            {
                todayCondition = Current.HasWeather(CurrentWeather.Fog)
                                        ? Translator.Get("weather-menu.fog", new { condition = GetBasicWeather(Current), fogTime = CurrentFog.IsWeatherVisible
                                                ? CurrentFog.WeatherExpirationTime.ToString()
                                                : "" })
                                        : GetBasicWeather(Current),
                tempString      = GetTemperatureString(Current.GetCurrentTemperature(Game1.timeOfDay)),
                todayHigh       = GetTemperatureString(Current.TodayHigh),
                todayLow        = GetTemperatureString(Current.TodayLow),
                currentRainfall = WeatherUtilities.GetRainfallAmt(Current.AmtOfRainDrops).ToString("N2"),
                fogString
            }) + Environment.NewLine;

            //Tomorrow weather
            text += Translator.Get("weather-menu.tomorrow",
                                   new {
                tomorrowCondition = GetBasicWeather(Game1.weatherForTomorrow),
                tomorrowLow       = GetTemperatureString(Current.TomorrowLow),
                tomorrowHigh      = GetTemperatureString(Current.TomorrowHigh)
            }) + Environment.NewLine;

            //now, night time
            if (!String.IsNullOrEmpty(NightTime))
            {
                text += NightTime + Environment.NewLine;
            }

            if (ClimatesOfFerngill.UseLunarDisturbancesApi)
            {
                if (ClimatesOfFerngill.MoonAPI.IsMoonUp(Game1.timeOfDay))
                {
                    text += Translator.Get("weather-menu.desc-moonNotUp", new { moonPhase = ClimatesOfFerngill.MoonAPI.GetCurrentMoonPhase(), moonRise = ClimatesOfFerngill.MoonAPI.GetMoonRise(), moonSet = ClimatesOfFerngill.MoonAPI.GetMoonSet() });
                }
                else
                {
                    text += Translator.Get("weather-menu.desc-moonUp", new { moonPhase = ClimatesOfFerngill.MoonAPI.GetCurrentMoonPhase(), moonSet = ClimatesOfFerngill.MoonAPI.GetMoonSet() });
                }
            }

            //new line replacer
            text.Replace("[NLK]", Environment.NewLine);

            return(text);
        }
Beispiel #3
0
        internal string GenerateMenuPopup(WeatherConditions Current, string MoonPhase = "", string NightTime = "")
        {
            string text = "";

            if (SDate.Now().Season == "spring" && SDate.Now().Day == 1)
            {
                text = Helper.Get("weather-menu.openingS1D1", new { descDay = Helper.Get($"date{UpperSeason(SDate.Now().Season)}{SDate.Now().Day}") }) + Environment.NewLine + Environment.NewLine;
            }
            else if (SDate.Now().Season == "winter" && SDate.Now().Day == 28)
            {
                text = Helper.Get("weather-menu.openingS4D28", new { descDay = Helper.Get($"date{UpperSeason(SDate.Now().Season)}{SDate.Now().Day}") }) + Environment.NewLine + Environment.NewLine;
            }
            else
            {
                text = Helper.Get("weather-menu.opening", new { descDay = Helper.Get($"date{UpperSeason(SDate.Now().Season)}{SDate.Now().Day}") }) + Environment.NewLine + Environment.NewLine;
            }

            if (Current.ContainsCondition(CurrentWeather.Heatwave))
            {
                text += Helper.Get("weather-menu.condition.heatwave") + Environment.NewLine;
            }

            if (Current.ContainsCondition(CurrentWeather.Frost))
            {
                text += Helper.Get("weather-menu.condition.frost") + Environment.NewLine;
            }

            if (Current.ContainsCondition(CurrentWeather.WhiteOut))
            {
                text += Helper.Get("weather-menu.condition.whiteOut") + Environment.NewLine;
            }

            if (Current.ContainsCondition(CurrentWeather.ThunderFrenzy))
            {
                text += Helper.Get("weather-menu.condition.thunderFrenzy") + Environment.NewLine;
            }

            if (MoonPhase == "Blood Moon")
            {
                text += Helper.Get("weather-menu.condition.bloodmoon") + Environment.NewLine;
            }

            ISDVWeather CurrentFog = Current.GetWeatherMatchingType("Fog").First();
            string      fogString  = "";

            //  If the fog is visible, we don't need to display fog information. However, if it's in the morning,
            //    and we know evening fog is likely, we should display the message it's expected
            // That said, if it's not, we need to pull the fog information down, assuming it's been reset. This checks that the fog end
            //    time is *before* now. To avoid nested trinary statements..
            if (SDVTime.CurrentTime < CurrentFog.WeatherExpirationTime && Current.GenerateEveningFog && CurrentFog.WeatherBeginTime < new SDVTime(1200))
            {
                fogString = Helper.Get("weather-menu.expectedFog");
            }
            if (CurrentFog.WeatherBeginTime > SDVTime.CurrentTime && Current.GenerateEveningFog)
            {
                fogString = Helper.Get("weather-menu.fogFuture",
                                       new
                {
                    fogTime = CurrentFog.WeatherBeginTime.ToString(),
                    endFog  = CurrentFog.WeatherExpirationTime.ToString()
                });
            }

            //Current Conditions.
            text += Helper.Get("weather-menu.current", new
            {
                todayCondition = Current.HasWeather(CurrentWeather.Fog) ? Helper.Get("weather-menu.fog", new { condition = GetBasicWeather(Current, Game1.currentSeason), fogTime = CurrentFog.IsWeatherVisible ? CurrentFog.WeatherExpirationTime.ToString() : "" }) : GetBasicWeather(Current, Game1.currentSeason),

                todayHigh = GetTemperatureString(Current.TodayHigh),
                todayLow  = GetTemperatureString(Current.TodayLow),
                fogString
            }) + Environment.NewLine;

            //Tomorrow weather
            text += Helper.Get("weather-menu.tomorrow",
                               new {
                tomorrowCondition = GetBasicWeather(Game1.weatherForTomorrow, Game1.currentSeason),
                tomorrowLow       = GetTemperatureString(Current.TomorrowLow),
                tomorrowHigh      = GetTemperatureString(Current.TomorrowHigh)
            }) + Environment.NewLine;

            //now, night time
            if (NightTime != "")
            {
                text += Environment.NewLine;
                text += NightTime + Environment.NewLine;
            }

            return(text);
        }