diff --git a/ClimatesOfFerngill/Assets/WeatherIcons2.png b/ClimatesOfFerngill/Assets/WeatherIcons2.png index 1c5d78c..703dec0 100644 Binary files a/ClimatesOfFerngill/Assets/WeatherIcons2.png and b/ClimatesOfFerngill/Assets/WeatherIcons2.png differ diff --git a/ClimatesOfFerngill/ClimatesOfFerngill.csproj b/ClimatesOfFerngill/ClimatesOfFerngill.csproj index c6d94fb..2bb9a98 100644 --- a/ClimatesOfFerngill/ClimatesOfFerngill.csproj +++ b/ClimatesOfFerngill/ClimatesOfFerngill.csproj @@ -58,6 +58,7 @@ + diff --git a/ClimatesOfFerngill/ClimatesOfFerngillRebuild.cs b/ClimatesOfFerngill/ClimatesOfFerngillRebuild.cs index 132dbf8..0d9a73d 100644 --- a/ClimatesOfFerngill/ClimatesOfFerngillRebuild.cs +++ b/ClimatesOfFerngill/ClimatesOfFerngillRebuild.cs @@ -797,30 +797,58 @@ private void WeatherChangeFromConsole(string arg1, string[] arg2) Game1.isSnowing = Game1.isLightning = Game1.isDebrisWeather = false; Game1.isRaining = true; Game1.debrisWeather.Clear(); + Conditions.GetWeatherMatchingType("Blizzard").First().EndWeather(); + Conditions.GetWeatherMatchingType("WhiteOut").First().EndWeather(); Monitor.Log(Helper.Translation.Get("console-text.weatherset_rain"), LogLevel.Info); break; case "storm": Game1.isSnowing = Game1.isDebrisWeather = false; Game1.isLightning = Game1.isRaining = true; Game1.debrisWeather.Clear(); + Conditions.GetWeatherMatchingType("Blizzard").First().EndWeather(); + Conditions.GetWeatherMatchingType("WhiteOut").First().EndWeather(); Monitor.Log(Helper.Translation.Get("console-text.weatherset_storm"), LogLevel.Info); break; case "snow": Game1.isRaining = Game1.isLightning = Game1.isDebrisWeather = false; Game1.isSnowing = true; Game1.debrisWeather.Clear(); + Conditions.GetWeatherMatchingType("Blizzard").First().EndWeather(); + Conditions.GetWeatherMatchingType("WhiteOut").First().EndWeather(); Monitor.Log(Helper.Translation.Get("console-text.weatherset_snow"), LogLevel.Info); break; case "debris": Game1.isSnowing = Game1.isLightning = Game1.isRaining = false; + Conditions.GetWeatherMatchingType("Blizzard").First().EndWeather(); + Conditions.GetWeatherMatchingType("Fog").First().EndWeather(); + Conditions.GetWeatherMatchingType("WhiteOut").First().EndWeather(); Game1.isDebrisWeather = true; Game1.populateDebrisWeatherArray(); Monitor.Log(Helper.Translation.Get("console-text.weatherset_debris", LogLevel.Info)); break; case "sunny": + Conditions.GetWeatherMatchingType("Blizzard").First().EndWeather(); + Conditions.GetWeatherMatchingType("Fog").First().EndWeather(); + Conditions.GetWeatherMatchingType("WhiteOut").First().EndWeather(); Game1.isSnowing = Game1.isLightning = Game1.isRaining = Game1.isRaining = false; Monitor.Log(Helper.Translation.Get("console-text.weatherset_sun", LogLevel.Info)); break; + case "blizzard": + Game1.isRaining = Game1.isLightning = Game1.isDebrisWeather = false; + Game1.isSnowing = true; + Game1.debrisWeather.Clear(); + Conditions.GetWeatherMatchingType("Blizzard").First().CreateWeather(); + Conditions.GetWeatherMatchingType("WhiteOut").First().EndWeather(); + Monitor.Log(Helper.Translation.Get("console-text.weatherset_snow"), LogLevel.Info); + break; + case "whiteout": + Game1.isRaining = Game1.isLightning = Game1.isDebrisWeather = false; + Game1.isSnowing = true; + Game1.debrisWeather.Clear(); + Conditions.GetWeatherMatchingType("Blizzard").First().CreateWeather(); + Conditions.GetWeatherMatchingType("WhiteOut").First().CreateWeather(); + Monitor.Log(Helper.Translation.Get("console-text.weatherset_snow"), LogLevel.Info); + break; } Game1.updateWeatherIcon(); @@ -927,7 +955,7 @@ private void ShowMenu() // show menu this.PreviousMenu = Game1.activeClickableMenu; Game1.activeClickableMenu = new WeatherMenu(Monitor, this.Helper.Reflection, OurIcons, Helper.Translation, Conditions, - OurMoon, WeatherOpt, 160, MenuText); + OurMoon, WeatherOpt, MenuText); } /// diff --git a/ClimatesOfFerngill/Descriptions.cs b/ClimatesOfFerngill/Descriptions.cs index dff3100..5c6e423 100644 --- a/ClimatesOfFerngill/Descriptions.cs +++ b/ClimatesOfFerngill/Descriptions.cs @@ -60,7 +60,7 @@ private string GetTemperatureString(double temp) } else { - return $"{temp.ToString("N1")}"; + return $"{temp.ToString("N1")} C"; } } @@ -76,8 +76,14 @@ internal string UpperSeason(string season) internal string GenerateMenuPopup(WeatherConditions Current, SDVMoon Moon) { + string text = ""; - string text = Helper.Get("weather-menu.opening", new { descDay = Helper.Get($"date{UpperSeason(SDate.Now().Season)}{SDate.Now().Day}") }) + Environment.NewLine + Environment.NewLine; + 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)) { @@ -85,30 +91,36 @@ internal string GenerateMenuPopup(WeatherConditions Current, SDVMoon Moon) } if (Current.ContainsCondition(CurrentWeather.Frost)) - { + { text += Helper.Get("weather-menu.condition.frost") + 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) }) : GetBasicWeather(Current, Game1.currentSeason)), - todayHigh = GetTemperatureString(Current.TodayHigh), - todayLow = GetTemperatureString(Current.TodayLow), - fogString = (Current.HasEveningFog? Helper.Get("weather-menu.fogFuture", - new { - fogTime = Current.GetWeatherMatchingType("Fog").First().WeatherBeginTime.ToString(), - endFog = Current.GetWeatherMatchingType("Fog").First().WeatherExpirationTime.ToString() - }) - : (Current.GetWeatherMatchingType("Fog").First().IsWeatherVisible? - Helper.Get("weather-menu.fog", - new { - fogTime = Current.GetWeatherMatchingType("Fog").First().IsWeatherVisible ? - Current.GetWeatherMatchingType("Fog").First().WeatherExpirationTime.ToString(): "" - }) : "") - ) + 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 = fogString }) + Environment.NewLine; - text += Environment.NewLine; //Tomorrow weather text += Helper.Get("weather-menu.tomorrow", @@ -133,10 +145,11 @@ internal string GenerateTVForecast(WeatherConditions Current, SDVMoon Moon) { "fogTime", Current.GetFogTime().ToString() }, { "todayHigh", GetTemperatureString(Current.TodayHigh) }, { "todayLow", GetTemperatureString(Current.TodayLow) }, - { "tomorrowWeather", GetWeather(Game1.weatherForTomorrow, Game1.currentSeason) }, + { "tomorrowWeather", GetWeather(Game1.weatherForTomorrow, Game1.currentSeason, true) }, { "tomorrowHigh", GetTemperatureString(Current.TomorrowHigh) }, { "tomorrowLow", GetTemperatureString(Current.TomorrowLow) }, { "condWarning", GetCondWarning(Current) }, + { "condString", GetCondWarning(Current) }, { "eveningFog", GetEveningFog(Current) } }; @@ -153,10 +166,10 @@ internal string GenerateTVForecast(WeatherConditions Current, SDVMoon Moon) //festival today else if (Current.HasWeather(CurrentWeather.Festival)) { - return Helper.Get("weat-fesTomorrow.0", talkParams); + return Helper.Get("weat-fesToday.0", talkParams); } - //festival tomrrow + //festival tomorrow else if (SDVUtilities.GetFestivalName(SDate.Now().AddDays(1)) != "") { return Helper.Get("weat-fesTomorrow.0", talkParams); @@ -201,17 +214,24 @@ internal string GenerateTVForecast(WeatherConditions Current, SDVMoon Moon) private string GetEveningFog(WeatherConditions Current) { - if (Current.HasEveningFog) + if (Current.GenerateEveningFog) { var fList = Current.GetWeatherMatchingType("Fog"); foreach (ISDVWeather weat in fList) { if (weat is FerngillFog fWeat) { - return Helper.Get("weather-condition.evenFog", new { startTime = fWeat.WeatherBeginTime.ToString(), endTime = fWeat.WeatherExpirationTime.ToString() }); + if (Current.GetWeatherMatchingType("Fog").First().IsWeatherVisible && (SDVTime.CurrentTime > new SDVTime(1200))) + return Helper.Get("weather-condition.fog", new { fogTime = fWeat.WeatherExpirationTime.ToString() }); + else + { + if (fWeat.WeatherBeginTime != fWeat.WeatherExpirationTime) + return Helper.Get("weather-condition.evenFog", new { startTime = fWeat.WeatherBeginTime.ToString(), endTime = fWeat.WeatherExpirationTime.ToString() }); + else + return ""; + } } } - return ""; } else @@ -222,34 +242,35 @@ 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}"); return ""; } - private string GetWeather(int weather, string season) + private string GetWeather(int weather, string season, bool TomorrowWeather = false) { int rNumber = OurDice.Next(2); if (weather == Game1.weather_debris) return Helper.Get($"weat-{season}.debris.{rNumber}"); - else if (weather == Game1.weather_festival || weather == Game1.weather_wedding) - return Helper.Get($"weat-{season}.sunny.{rNumber}"); + else if (weather == Game1.weather_festival || weather == Game1.weather_wedding || weather == Game1.weather_sunny && SDVTime.CurrentIntTime < Game1.getModeratelyDarkTime() && !TomorrowWeather) + return Helper.Get($"weat-{season}.sunny_daytime.{rNumber}"); + else if (weather == Game1.weather_festival || weather == Game1.weather_wedding || weather == Game1.weather_sunny && SDVTime.CurrentIntTime >= Game1.getModeratelyDarkTime() && !TomorrowWeather) + return Helper.Get($"weat-{season}.sunny_nighttime.{rNumber}"); + else if (weather == Game1.weather_festival || weather == Game1.weather_wedding || weather == Game1.weather_sunny && TomorrowWeather) + return Helper.Get($"weat-{season}.sunny_daytime.{rNumber}"); else if (weather == Game1.weather_lightning) return Helper.Get($"weat-{season}.stormy.{rNumber}"); else if (weather == Game1.weather_rain) return Helper.Get($"weat-{season}.rainy.{rNumber}"); else if (weather == Game1.weather_snow) return Helper.Get($"weat-{season}.snow.{rNumber}"); - else if (weather == Game1.weather_sunny) - return Helper.Get($"weat-{season}.sunny.{rNumber}"); return "ERROR"; } @@ -276,16 +297,16 @@ private string GetBasicWeather(int weather, string season) private string GetBasicWeather(WeatherConditions Weather, string season) { - int rNumber = OurDice.Next(2); - - if (Weather.CurrentWeatherIconBasic == WeatherIcon.IconBlizzard) + if (Weather.CurrentWeatherIconBasic == WeatherIcon.IconBlizzard || Weather.CurrentWeatherIconBasic == WeatherIcon.IconWhiteOut) return Helper.Get($"weather_blizzard"); else if (Weather.CurrentWeatherIconBasic == WeatherIcon.IconSpringDebris || Weather.CurrentWeatherIconBasic == WeatherIcon.IconDebris) return Helper.Get($"weather_wind"); else if (Weather.CurrentWeatherIconBasic == WeatherIcon.IconDryLightning) return Helper.Get($"weather_drylightning"); - else if (Weather.CurrentWeatherIconBasic == WeatherIcon.IconSunny) - return Helper.Get($"weather_sunny"); + else if (Weather.CurrentWeatherIconBasic == WeatherIcon.IconSunny && SDVTime.CurrentIntTime < Game1.getModeratelyDarkTime()) + return Helper.Get($"weather_sunny_daytime"); + else if (Weather.CurrentWeatherIconBasic == WeatherIcon.IconSunny && SDVTime.CurrentIntTime >= Game1.getModeratelyDarkTime()) + return Helper.Get($"weather_sunny_nighttime"); else if (Weather.CurrentWeatherIconBasic == WeatherIcon.IconStorm) return Helper.Get($"weather_lightning"); else if (Weather.CurrentWeatherIconBasic == WeatherIcon.IconSnow) @@ -301,19 +322,20 @@ private string GetBasicWeather(WeatherConditions Weather, string season) return "ERROR"; } - private string GetWeather(WeatherConditions Weather, string season) { int rNumber = OurDice.Next(2); - if (Weather.CurrentWeatherIconBasic == WeatherIcon.IconBlizzard) + if (Weather.CurrentWeatherIconBasic == WeatherIcon.IconBlizzard || Weather.CurrentWeatherIconBasic == WeatherIcon.IconWhiteOut) return Helper.Get($"weat-{season}.blizzard.{rNumber}"); else if (Weather.CurrentWeatherIconBasic == WeatherIcon.IconSpringDebris || Weather.CurrentWeatherIconBasic == WeatherIcon.IconDebris) return Helper.Get($"weat-{season}.debris.{rNumber}"); else if (Weather.CurrentWeatherIconBasic == WeatherIcon.IconDryLightning) return Helper.Get($"weat-{season}.drylightning.{rNumber}"); - else if (Weather.CurrentWeatherIconBasic == WeatherIcon.IconSunny) - return Helper.Get($"weat-{season}.sunny.{rNumber}"); + else if (Weather.CurrentWeatherIconBasic == WeatherIcon.IconWedding || Weather.CurrentWeatherIconBasic == WeatherIcon.IconFestival || Weather.CurrentWeatherIconBasic == WeatherIcon.IconSunny && SDVTime.CurrentIntTime < Game1.getModeratelyDarkTime()) + return Helper.Get($"weat-{season}.sunny_daytime.{rNumber}"); + else if (Weather.CurrentWeatherIconBasic == WeatherIcon.IconSunny || Weather.CurrentWeatherIconBasic == WeatherIcon.IconWedding || Weather.CurrentWeatherIconBasic == WeatherIcon.IconFestival && SDVTime.CurrentIntTime >= Game1.getModeratelyDarkTime()) + return Helper.Get($"weat-{season}.sunny_nighttime.{rNumber}"); else if (Weather.CurrentWeatherIconBasic == WeatherIcon.IconStorm) return Helper.Get($"weat-{season}.stormy.{rNumber}"); else if (Weather.CurrentWeatherIconBasic == WeatherIcon.IconSnow) @@ -322,8 +344,6 @@ private string GetWeather(WeatherConditions Weather, string season) return Helper.Get($"weat-{season}.rainy.{rNumber}"); else if (Weather.CurrentWeatherIconBasic == WeatherIcon.IconThunderSnow) return Helper.Get($"weat-{season}.thundersnow.{rNumber}"); - else if (Weather.CurrentWeatherIconBasic == WeatherIcon.IconWedding || Weather.CurrentWeatherIconBasic == WeatherIcon.IconFestival) - return Helper.Get($"weat-{season}.sunny.{rNumber}"); return "ERROR"; } @@ -361,6 +381,7 @@ internal TemporaryAnimatedSprite GetWeatherOverlay(WeatherConditions Current, TV break; case WeatherIcon.IconSnow: case WeatherIcon.IconBlizzard: + case WeatherIcon.IconWhiteOut: placement = new Rectangle(465, 346, 13, 13); break; } diff --git a/ClimatesOfFerngill/README.md b/ClimatesOfFerngill/README.md index 0237e8a..2b16e5e 100644 --- a/ClimatesOfFerngill/README.md +++ b/ClimatesOfFerngill/README.md @@ -1,12 +1,13 @@ # Climates of Ferngill (Rebuild) You Can (Not) Have Weather -Current Version (1 January 2018): v1.3-beta1 +Current Version (4 Feburary 2018): 1.3 ## What's New - Fog! - Blizzards, Thundersnow - A more customizable weather system +- More descriptive and varied weather reports ## Requirements @@ -39,13 +40,14 @@ Every ten minutes, the mod checks to see if you've been outside for a certain pe *Special Weathers: Thundersnow, Blizzard (NB: While you incur a stamina penalty for being sick in fog, it deliberately does not trigger this.) -The penalties are cumulative - that is, they add up to the final multiplier. +The penalties are **cumulative** - that is, they add up to the final multiplier. *Lightning : +100% ( 1) *Thundersnow: +100% (1) *Thundersnow (nighttime): +50% (.5) *Foggy: +50% (.5) *Foggy (nightime) +25% (.25) *Blizzard: +125% (1.25) +*Blizzard: **White Out**+225% (2.25) *Blizzard (nighttime) +50% (.5) *Frost (nightime): +125% (1.25) - this is not during the winter. During winter, the frost penalty is untriggered. *Heatwave (daytime): +125% (1.25) @@ -55,7 +57,7 @@ The calculated number is then rounded __down__ For example, therefore, if you're outduring a storm, with the base of 2, you only take a stamina penalty of 2. But if it's also a heatwave, your penatly is now (+1+1.25)=*2.25 or 4.5. So a penalty of 4. If you're out in a blizzard during the day, it's *1.25 or 2.5 rounded down to 2. If you're out in that blizzard at night, another .5 (1.25+.5) is added making it 1.75 or 3.5 rounded down to 3. -(This does mean a foggy blizzard at night is (+.5+.25+1.25+.5 or *2.25), and if you somehow get this in fall, would be *3.5) +(This does mean a foggy blizzard at night is (+.5+.25+1.25+.5 or *2.25), and if you somehow get this in fall, would be *3.5. And somehow, if you get a whiteout, it would be *3.25 and *4.5!) ## Known Issues @@ -70,6 +72,36 @@ If you're out in a blizzard during the day, it's *1.25 or 2.5 rounded down to 2. - ChefRude for testing and the night icon sprites (as well as better fog textures) ## Changelog +v1.3 +- custom popup text on first and last day of the year + +v1.3beta8 + - updated descriptors for (sunny, at night) + - updated evening fog descriptor to not show the fog beginning once started + - added special descriptors for the easter egg. + - some differnation done on current descriptors + - fixed some issues lingering with fog lines not spacing correctly + - refined some of the text to read more cleanly + - added conversion chance for snow in spring if it's cold enough + +v1.3beta7 + - Updated the console command code to be more.. proper. + - Added a easter egg blizzard mode. + +v1.3beta6 + - ISDVWeather now implements a EndWeather + - Console commands can now arbitarily trigger blizzards + - Fog code cleaned up to remove old code + - Sprites cleaned up to remove old sprite code. + - Festival text fixes + +v1.3beta5 +- fog text fixes (remove duplicate fog text, evening fog properly display) + +v1.3beta4 +- text fixes (fog Time not appearing, temperature string incomplete) +- modified the menu screen to work properly over fog. + v1.3beta3 - .. somehow the text fixes didn't take? - cleaned up various elements of the code - no longer attempts to IAssetEditor @@ -239,14 +271,14 @@ over a certain value.). Valid 0-1, but it's recommended that this is kept low. D - 'ChanceOfGettingSick' - Controls the chance you'll get sick when conditions are matched. Default is set to '.7' for (70% chance). Valid Range is 0 to 1. - - 'Use12HourTime' - Tells it whether or not to use 12hour time or not in displays. Defaults to false. + - 'Use12HourTime' - Tells it whether or not to use 12hour time or not in displays. Defaults to false. Valid: true, false - 'BadMoonRising' - Chance of a blood moon on a full moon. Default: .004 (.4%). Valid Range is 0 to 1. - - 'EclipseOn' - Whether or not the eclipse is enabled. Defaults to on. (NOTE: Will not trigger until at least Spring 2, and must be a full moon.) + - 'EclipseOn' - Whether or not the eclipse is enabled. Defaults to true. (NOTE: Will not trigger until at least Spring 2, and must be a full moon.) (valid: true, false) - - 'EclipseChance' - The chance of an eclipse every full moon. Defaults to 1.5%. + - 'EclipseChance' - The chance of an eclipse every full moon. Defaults to .015 (1.5%) Valid Range is 0 to 1. - - 'SpawnMonsters' - Controls if monsters spawn on your wilderness farm. Default: on + - 'SpawnMonsters' - Controls if monsters spawn on your wilderness farm. Default: true. Valid: true, false - - 'SpawnMonstersAllFarms' - Controls if monsters spawn on all farms. Default: off \ No newline at end of file + - 'SpawnMonstersAllFarms' - Controls if monsters spawn on all farms. Default: false. Valid: true, false \ No newline at end of file diff --git a/ClimatesOfFerngill/Sprites.cs b/ClimatesOfFerngill/Sprites.cs index 46b509d..b194796 100644 --- a/ClimatesOfFerngill/Sprites.cs +++ b/ClimatesOfFerngill/Sprites.cs @@ -143,14 +143,7 @@ public Rectangle GetWeatherSprite(CurrentWeather condition) public static readonly Rectangle WeatherFestival = new Rectangle(235, 32, 47, 45); public static readonly Rectangle WeatherBlizzard = new Rectangle(281, 32, 40, 42); public static readonly Rectangle WeatherDryLightning = new Rectangle(321,32,33,39); - public static readonly Rectangle WeatherThundersnow = new Rectangle(355,31,39,40); - - /// A down arrow for scrolling content. - public static readonly Rectangle DownArrow = new Rectangle(12, 76, 40, 44); - - /// An up arrow for scrolling content. - public static readonly Rectangle UpArrow = new Rectangle(76, 72, 40, 44); - + public static readonly Rectangle WeatherThundersnow = new Rectangle(355,31,39,40); } public static Texture2D Pixel => LazyPixel.Value; diff --git a/ClimatesOfFerngill/StaminaDrain.cs b/ClimatesOfFerngill/StaminaDrain.cs index 2ce1025..e5a4517 100644 --- a/ClimatesOfFerngill/StaminaDrain.cs +++ b/ClimatesOfFerngill/StaminaDrain.cs @@ -145,12 +145,18 @@ public int TenMinuteTick(WeatherConditions conditions, int ticksOutside, int tic condList.Add("Night Fog"); } - if (this.FarmerSick && conditions.GetCurrentConditions().HasFlag(CurrentWeather.Blizzard)) + if (this.FarmerSick && conditions.GetCurrentConditions().HasFlag(CurrentWeather.Blizzard) && !conditions.GetCurrentConditions().HasFlag(CurrentWeather.WhiteOut)) { totalMulti += 1.25; condList.Add("Blizzard"); } + if (this.FarmerSick && conditions.GetCurrentConditions().HasFlag(CurrentWeather.Blizzard) && conditions.GetCurrentConditions().HasFlag(CurrentWeather.WhiteOut)) + { + totalMulti += 2.25; + condList.Add("White Out"); + } + if (this.FarmerSick && conditions.GetCurrentConditions().HasFlag(CurrentWeather.Frost) && SDVTime.IsNight) { totalMulti += 1.25; diff --git a/ClimatesOfFerngill/WeatherMenu.cs b/ClimatesOfFerngill/WeatherMenu.cs index ce94b32..7593b20 100644 --- a/ClimatesOfFerngill/WeatherMenu.cs +++ b/ClimatesOfFerngill/WeatherMenu.cs @@ -8,10 +8,6 @@ using StardewValley; using StardewValley.Menus; using Pathoschild.Stardew.UIF; -using System.Linq; -using StardewModdingAPI.Utilities; -using TwilightShards.Stardew.Common; -using TwilightShards.Common; namespace ClimatesOfFerngillRebuild { @@ -34,27 +30,9 @@ internal class WeatherMenu : IClickableMenu /// The aspect ratio of the page background. private readonly Vector2 AspectRatio = new Vector2(Sprites.Letter.Sprite.Width, Sprites.Letter.Sprite.Height); - /// The spacing around the scroll buttons. - private readonly int ScrollButtonGutter = 15; - /// To da Moon, Princess! private SDVMoon OurMoon; - /// The amount to scroll long content on each up/down scroll. - private readonly int ScrollAmount; - - /// The clickable 'scroll up' icon. - private readonly ClickableTextureComponent ScrollUpButton; - - /// The clickable 'scroll down' icon. - private readonly ClickableTextureComponent ScrollDownButton; - - /// The maximum pixels to scroll. - private int MaxScroll; - - /// The number of pixels to scroll. - private int CurrentScroll; - /// The current weather status private WeatherConditions CurrentWeather; @@ -78,7 +56,7 @@ internal class WeatherMenu : IClickableMenu ****/ /// Construct an instance. /// Encapsulates logging and monitoring. - public WeatherMenu(IMonitor monitor, IReflectionHelper reflectionHelper, Sprites.Icons Icon, ITranslationHelper Helper, WeatherConditions weat, SDVMoon Termina, WeatherConfig ModCon, int scroll, string text) + public WeatherMenu(IMonitor monitor, IReflectionHelper reflectionHelper, Sprites.Icons Icon, ITranslationHelper Helper, WeatherConditions weat, SDVMoon Termina, WeatherConfig ModCon, string text) { // save data this.MenuText = text; @@ -86,15 +64,10 @@ public WeatherMenu(IMonitor monitor, IReflectionHelper reflectionHelper, Sprites this.Reflection = reflectionHelper; this.Helper = Helper; this.CurrentWeather = weat; - this.ScrollAmount = scroll; this.IconSheet = Icon; this.OurMoon = Termina; this.OurConfig = ModCon; - // add scroll buttons - this.ScrollUpButton = new ClickableTextureComponent(Rectangle.Empty, Sprites.Icons.source2, Sprites.Icons.UpArrow, 1); - this.ScrollDownButton = new ClickableTextureComponent(Rectangle.Empty, Sprites.Icons.source2, Sprites.Icons.DownArrow, 1); - // update layout this.UpdateLayout(); } @@ -103,16 +76,6 @@ public WeatherMenu(IMonitor monitor, IReflectionHelper reflectionHelper, Sprites ** Events ****/ - /// The method invoked when the player scrolls the mouse wheel on the lookup UI. - /// The scroll direction. - public override void receiveScrollWheelAction(int direction) - { - if (direction > 0) // positive number scrolls content up - this.ScrollUp(); - else - this.ScrollDown(); - } - /// The method invoked when the player left-clicks on the lookup UI. /// The X-position of the cursor. /// The Y-position of the cursor. @@ -159,18 +122,6 @@ public override void receiveGamePadButton(Buttons button) ** Methods ****/ - /// Scroll up the menu content by the specified amount (if possible). - public void ScrollUp() - { - this.CurrentScroll -= this.ScrollAmount; - } - - /// Scroll down the menu content by the specified amount (if possible). - public void ScrollDown() - { - this.CurrentScroll += this.ScrollAmount; - } - /// Handle a left-click from the player's mouse or controller. /// The x-position of the cursor. /// The y-position of the cursor. @@ -218,69 +169,43 @@ public override void draw(SpriteBatch spriteBatch) // and I kinda want to have this where I can understand what it's for float spaceWidth = DrawHelper.GetSpaceWidth(font); + // draw background // (This uses a separate sprite batch because it needs to be drawn before the // foreground batch, and we can't use the foreground batch because the background is // outside the clipping area.) - using (SpriteBatch backgroundBatch = new SpriteBatch(Game1.graphics.GraphicsDevice)) + //spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.NonPremultiplied, SamplerState.PointClamp, null, null); + spriteBatch.DrawSprite(Sprites.Letter.Sheet, Sprites.Letter.Sprite, x, y, scale: width / (float)Sprites.Letter.Sprite.Width); + //spriteBatch.End(); + + // begin draw + + // draw weather icon + spriteBatch.Draw(IconSheet.WeatherSource, new Vector2(x + leftOffset, y + topOffset), IconSheet.GetWeatherSprite(CurrentWeather.GetCurrentConditions()), Color.White); + leftOffset += 72; + string weatherString = ""; + + // draw text as sent from outside the menu + float wrapWidth = this.width - leftOffset - gutter; { - backgroundBatch.Begin(SpriteSortMode.Deferred, BlendState.NonPremultiplied, SamplerState.PointClamp, null, null); - backgroundBatch.DrawSprite(Sprites.Letter.Sheet, Sprites.Letter.Sprite, x, y, scale: width / (float)Sprites.Letter.Sprite.Width); - backgroundBatch.End(); - } + Vector2 textSize = spriteBatch.DrawTextBlock(font, MenuText, new Vector2(x + leftOffset, y + topOffset), wrapWidth); + topOffset += textSize.Y; + topOffset += lineHeight; - // draw foreground - // (This uses a separate sprite batch to set a clipping area for scrolling.) - using (SpriteBatch contentBatch = new SpriteBatch(Game1.graphics.GraphicsDevice)) - { - // begin draw - GraphicsDevice device = Game1.graphics.GraphicsDevice; - device.ScissorRectangle = new Rectangle(x + gutter, y + gutter, (int)contentWidth, (int)contentHeight); - contentBatch.Begin(SpriteSortMode.Deferred, BlendState.NonPremultiplied, SamplerState.PointClamp, null, new RasterizerState { ScissorTestEnable = true }); - - // scroll view - this.CurrentScroll = Math.Max(0, this.CurrentScroll); // don't scroll past top - this.CurrentScroll = Math.Min(this.MaxScroll, this.CurrentScroll); // don't scroll past bottom - topOffset -= this.CurrentScroll; // scrolled down == move text up - - // draw weather icon - contentBatch.Draw(IconSheet.WeatherSource, new Vector2(x + leftOffset, y + topOffset), IconSheet.GetWeatherSprite(CurrentWeather.GetCurrentConditions()), Color.White); - leftOffset += 72; - string weatherString = ""; - - // draw text as sent from outside the menu - float wrapWidth = this.width - leftOffset - gutter; - { - Vector2 textSize = contentBatch.DrawTextBlock(font, MenuText, new Vector2(x + leftOffset, y + topOffset), wrapWidth); - topOffset += textSize.Y; - topOffset += lineHeight; - - } - - //draw moon info - contentBatch.Draw(IconSheet.MoonSource, new Vector2(x + 15, y + topOffset), - IconSheet.GetMoonSprite(OurMoon.CurrentPhase), Color.White); - - weatherString = Helper.Get("moon-desc.desc_moonphase", - new { moonPhase = SDVMoon.DescribeMoonPhase(OurMoon.CurrentPhase, Helper)}); + } - Vector2 moonText = contentBatch.DrawTextBlock(font, - weatherString, new Vector2(x + leftOffset, y + topOffset), wrapWidth); + //draw moon info + spriteBatch.Draw(IconSheet.MoonSource, new Vector2(x + 15, y + topOffset), + IconSheet.GetMoonSprite(OurMoon.CurrentPhase), Color.White); - topOffset += lineHeight; //stop moon from being cut off. + weatherString = Helper.Get("moon-desc.desc_moonphase", + new { moonPhase = SDVMoon.DescribeMoonPhase(OurMoon.CurrentPhase, Helper)}); - // update max scroll - this.MaxScroll = Math.Max(0, (int)(topOffset - contentHeight + this.CurrentScroll)); + Vector2 moonText = spriteBatch.DrawTextBlock(font, + weatherString, new Vector2(x + leftOffset, y + topOffset), wrapWidth); - // draw scroll icons - if (this.MaxScroll > 0 && this.CurrentScroll > 0) - this.ScrollUpButton.draw(contentBatch); - if (this.MaxScroll > 0 && this.CurrentScroll < this.MaxScroll) - this.ScrollDownButton.draw(spriteBatch); + topOffset += lineHeight; //stop moon from being cut off. - // end draw - contentBatch.End(); - } this.drawMouse(Game1.spriteBatch); } @@ -303,7 +228,7 @@ private void UpdateLayout() // update up/down buttons int x = this.xPositionOnScreen; int y = this.yPositionOnScreen; - int gutter = this.ScrollButtonGutter; + int gutter = 16; float contentHeight = this.height - gutter * 2; } diff --git a/ClimatesOfFerngill/Weathers/CurrentWeather.cs b/ClimatesOfFerngill/Weathers/CurrentWeather.cs index 487b546..907afd3 100644 --- a/ClimatesOfFerngill/Weathers/CurrentWeather.cs +++ b/ClimatesOfFerngill/Weathers/CurrentWeather.cs @@ -19,6 +19,7 @@ public enum CurrentWeather Blizzard = 256, Fog = 512, Frost = 1024, - Heatwave = 2048 + Heatwave = 2048, + WhiteOut = 4096 } } diff --git a/ClimatesOfFerngill/Weathers/FerngillBlizzard.cs b/ClimatesOfFerngill/Weathers/FerngillBlizzard.cs index 3a7d9bd..3783e44 100644 --- a/ClimatesOfFerngill/Weathers/FerngillBlizzard.cs +++ b/ClimatesOfFerngill/Weathers/FerngillBlizzard.cs @@ -66,6 +66,7 @@ public void SetWeatherTime(SDVTime begin, SDVTime end) public void CreateWeather() { //Blizzards opt to mostly being all day. + BeginTime = new SDVTime(0600); ExpirTime = new SDVTime(2800); if (Dice.NextDouble() >= .5 && Dice.NextDouble() < .8) { @@ -87,6 +88,16 @@ public void CreateWeather() } } + public void EndWeather() + { + if (IsWeatherVisible) + { + IsBlizzard = false; + ExpirTime = new SDVTime(SDVTime.CurrentIntTime - 10); + UpdateStatus(WeatherType, false); + } + } + public void UpdateWeather() { if (!IsWeatherVisible) @@ -94,7 +105,7 @@ public void UpdateWeather() return; } - if (WeatherExpirationTime <= SDVTime.CurrentTime) + if (SDVTime.CurrentTime >= WeatherExpirationTime) { IsBlizzard = false; UpdateStatus(WeatherType, false); @@ -112,7 +123,7 @@ public override string ToString() } public void DrawWeather() - { + { if (IsWeatherVisible && !(Game1.currentLocation is Desert)) { snowPos = Game1.updateFloatingObjectPositionForMovement(snowPos, new Vector2(Game1.viewport.X, Game1.viewport.Y), diff --git a/ClimatesOfFerngill/Weathers/FerngillFog.cs b/ClimatesOfFerngill/Weathers/FerngillFog.cs index a4cf8c4..63d361e 100644 --- a/ClimatesOfFerngill/Weathers/FerngillFog.cs +++ b/ClimatesOfFerngill/Weathers/FerngillFog.cs @@ -11,18 +11,12 @@ namespace ClimatesOfFerngillRebuild { - // This was a class, but honestly, we should probably just move all of the fog things into one struct. /// This tracks fog details internal class FerngillFog : ISDVWeather { public event EventHandler OnUpdateStatus; - //private bool AmbientFog { get; set; } - //private readonly static Rectangle FogSource = new Rectangle(640, 0, 64, 64); public static Rectangle FogSource = new Rectangle(0, 0, 64, 64); - private readonly static Color DarkOutdoor = new Color(180, 175, 105); - private readonly static Color NormalOutdoor = new Color(135, 120, 145); - private Color FogColor = Color.White * 1.25f; internal Icons Sheet; @@ -47,8 +41,6 @@ internal class FerngillFog : ISDVWeather public string WeatherType => "Fog"; - private bool AfternoonFightDet { get; set; } - /// Returns the expiration time of fog. Note that this doesn't sanity check if the fog is even visible. public SDVTime WeatherExpirationTime => (ExpirTime ?? new SDVTime(0600)); public SDVTime WeatherBeginTime => (BeginTime ?? new SDVTime(0600)); @@ -77,11 +69,9 @@ public bool WeatherInProgress /// The time for the fog to expire public void SetWeatherExpirationTime(SDVTime t) => ExpirTime = t; public void SetWeatherBeginTime(SDVTime t) => BeginTime = t; - public SDVTimePeriods FogTimeSpan { get; set; } - + public SDVTimePeriods FogTimeSpan { get; set;} private MersenneTwister Dice { get; set; } private WeatherConfig ModConfig { get; set; } - private bool FadeOutFog { get; set; } private bool FadeInFog { get; set; } private Stopwatch FogElapsed { get; set; } @@ -96,7 +86,6 @@ internal FerngillFog(Icons Sheet, bool Verbose, IMonitor Monitor, MersenneTwiste this.Monitor = Monitor; this.Dice = Dice; this.ModConfig = config; - AfternoonFightDet = false; this.FogTimeSpan = FogPeriod; FogElapsed = new Stopwatch(); } @@ -114,7 +103,6 @@ public void Reset() BeginTime = null; ExpirTime = null; FogAlpha = 0f; - AfternoonFightDet = false; FadeOutFog = false; FadeInFog = false; FogElapsed.Reset(); @@ -204,30 +192,20 @@ public void CreateWeather() UpdateStatus(WeatherType, true); } - public void SetWeatherTime(SDVTime begin, SDVTime end) + public void EndWeather() { - BeginTime = new SDVTime(begin); - ExpirTime = new SDVTime(end); + if (IsWeatherVisible) + { + ExpirTime = new SDVTime(SDVTime.CurrentTime - 10); + CurrentFogType = FogType.None; + UpdateStatus(WeatherType, false); + } } - public Color CalculateEndLight(SDVTime end) + public void SetWeatherTime(SDVTime begin, SDVTime end) { - int endTime = end.ReturnIntTime(); - - if (endTime >= Game1.getTrulyDarkTime()) - { - float num = Math.Min(0.93f, (float)(0.75 + ((int)(endTime - endTime % 100 + endTime % 100 / 10 * 16.6599998474121) - Game1.getTrulyDarkTime() + Game1.gameTimeInterval / 7000.0 * 16.6000003814697) * 0.000624999986030161)); - return (Game1.isRaining ? DarkOutdoor : Game1.eveningColor) * num; - } - else if (endTime >= Game1.getStartingToGetDarkTime()) - { - float num = Math.Min(0.93f, (float)(0.300000011920929 + ((int)(endTime - endTime % 100 + endTime % 100 / 10 * 16.6599998474121) - Game1.getStartingToGetDarkTime() + (double)Game1.gameTimeInterval / 7000.0 * 16.6000003814697) * 0.00224999990314245)); - return (Game1.isRaining ? DarkOutdoor : Game1.eveningColor) * num; - } - else if (Game1.isRaining) - return Game1.ambientLight * 0.3f; - else - return new Color(0, 0, 0); // I have a sneaking suspcion + BeginTime = new SDVTime(begin); + ExpirTime = new SDVTime(end); } public override string ToString() diff --git a/ClimatesOfFerngill/Weathers/FerngillWhiteOut.cs b/ClimatesOfFerngill/Weathers/FerngillWhiteOut.cs new file mode 100644 index 0000000..3da7c40 --- /dev/null +++ b/ClimatesOfFerngill/Weathers/FerngillWhiteOut.cs @@ -0,0 +1,177 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using StardewValley; +using StardewValley.Locations; +using System; +using TwilightShards.Common; +using TwilightShards.Stardew.Common; + +namespace ClimatesOfFerngillRebuild +{ + /// This tracks white out details + internal class FerngillWhiteOut : ISDVWeather + { + /// This is for the second snow overlay. + private Vector2 snowPos; + private Vector2 snowPos2; + public event EventHandler OnUpdateStatus; + private bool IsWhiteout { get; set; } + public bool IsWeatherVisible => IsWhiteout; + private SDVTime ExpirTime; + private SDVTime BeginTime; + + private MersenneTwister Dice; + private WeatherConfig ModConfig; + + public string WeatherType => "WhiteOut"; + public void SetWeatherExpirationTime(SDVTime t) => ExpirTime = t; + public void SetWeatherBeginTime(SDVTime t) => BeginTime = t; + + public SDVTime WeatherExpirationTime => (ExpirTime ?? new SDVTime(0600)); + public SDVTime WeatherBeginTime => (BeginTime ?? new SDVTime(0600)); + public bool WeatherInProgress => (SDVTime.CurrentTime >= BeginTime && SDVTime.CurrentTime <= ExpirTime); + + public FerngillWhiteOut(MersenneTwister Dice, WeatherConfig config) + { + ExpirTime = new SDVTime(2600); + BeginTime = new SDVTime(0600); + this.Dice = Dice; + this.ModConfig = config; + } + + public void UpdateStatus(string weather, bool status) + { + if (OnUpdateStatus == null) return; + + WeatherNotificationArgs args = new WeatherNotificationArgs(weather, status); + OnUpdateStatus(this, args); + } + + public void OnNewDay() + { + IsWhiteout = false; + } + + public void Reset() + { + IsWhiteout = false; + } + + public void SetWeatherTime(SDVTime begin, SDVTime end) + { + BeginTime = new SDVTime(begin); + ExpirTime = new SDVTime(end); + } + + public void CreateWeather() + { + BeginTime = new SDVTime(0600); + ExpirTime = new SDVTime(2800); + if (Dice.NextDouble() >= .5 && Dice.NextDouble() < .8) + { + ExpirTime = new SDVTime(Game1.getModeratelyDarkTime()); + } + if (Dice.NextDouble() >= .8 && Dice.NextDouble() < .95) + { + ExpirTime = new SDVTime((BeginTime.ReturnIntTime() + 1000)); + } + if (Dice.NextDouble() >= .95) + { + ExpirTime = new SDVTime((BeginTime.ReturnIntTime() + 500)); + } + + if (SDVTime.CurrentTime >= BeginTime) + { + IsWhiteout = true; + UpdateStatus(WeatherType, true); + } + } + + public void EndWeather() + { + if (IsWeatherVisible) + { + IsWhiteout = false; + ExpirTime = new SDVTime(SDVTime.CurrentIntTime - 10); + UpdateStatus(WeatherType, false); + } + } + + public void UpdateWeather() + { + if (!IsWeatherVisible) + { + return; + } + + if (SDVTime.CurrentTime >= WeatherExpirationTime) + { + IsWhiteout = false; + UpdateStatus(WeatherType, false); + } + } + + public void MoveWeather() + { + + } + + public override string ToString() + { + return $"White Out Weather from {BeginTime} to {ExpirTime}. Visible: {IsWeatherVisible}. "; + } + + public void DrawWeather() + { + if (IsWeatherVisible && !(Game1.currentLocation is Desert)) + { + snowPos = Game1.updateFloatingObjectPositionForMovement(snowPos, new Vector2(Game1.viewport.X, Game1.viewport.Y), + Game1.previousViewportPosition, -1f); + snowPos.X = snowPos.X % (16 * Game1.pixelZoom); + Vector2 position = new Vector2(); + float num1 = -16 * Game1.pixelZoom + snowPos.X % (16 * Game1.pixelZoom); + while ((double)num1 < Game1.viewport.Width) + { + float num2 = -12 * Game1.pixelZoom + snowPos.Y % (12 * Game1.pixelZoom); + while (num2 < (double)Game1.viewport.Height) + { + position.X = (int)num1; + position.Y = (int)num2; + Game1.spriteBatch.Draw(Game1.mouseCursors, position, new Microsoft.Xna.Framework.Rectangle? + (new Microsoft.Xna.Framework.Rectangle + (368 + (int)((Game1.currentGameTime.TotalGameTime.TotalMilliseconds + 225) % 1200.0) / 75 * 16, 192, 16, 16)), + Color.White * Game1.options.snowTransparency, 0.0f, Vector2.Zero, + Game1.pixelZoom + 1f / 1000f, SpriteEffects.None, 1f); + num2 += 16 * Game1.pixelZoom; + } + num1 += 16 * Game1.pixelZoom; + } + } + + if (IsWeatherVisible && !(Game1.currentLocation is Desert)) + { + snowPos2 = Game1.updateFloatingObjectPositionForMovement(snowPos2, new Vector2(Game1.viewport.X, Game1.viewport.Y), + Game1.previousViewportPosition, -1f); + snowPos2.X = snowPos2.X % (12 * Game1.pixelZoom); + Vector2 position = new Vector2(); + float num1 = -12 * Game1.pixelZoom + snowPos2.X % (12 * Game1.pixelZoom); + while ((double)num1 < Game1.viewport.Width) + { + float num2 = -8 * Game1.pixelZoom + snowPos2.Y % (8 * Game1.pixelZoom); + while (num2 < (double)Game1.viewport.Height) + { + position.X = (int)num1; + position.Y = (int)num2; + Game1.spriteBatch.Draw(Game1.mouseCursors, position, new Microsoft.Xna.Framework.Rectangle? + (new Microsoft.Xna.Framework.Rectangle + (368 + (int)((Game1.currentGameTime.TotalGameTime.TotalMilliseconds + 125) % 1200.0) / 75 * 16, 192, 16, 16)), + Color.White * Game1.options.snowTransparency, 0.0f, Vector2.Zero, + Game1.pixelZoom + 1f / 1000f, SpriteEffects.None, 1f); + num2 += 16 * Game1.pixelZoom; + } + num1 += 16 * Game1.pixelZoom; + } + } + } + } +} \ No newline at end of file diff --git a/ClimatesOfFerngill/Weathers/ISDVWeather.cs b/ClimatesOfFerngill/Weathers/ISDVWeather.cs index 23f4d47..0aef57c 100644 --- a/ClimatesOfFerngill/Weathers/ISDVWeather.cs +++ b/ClimatesOfFerngill/Weathers/ISDVWeather.cs @@ -32,5 +32,6 @@ interface ISDVWeather void UpdateWeather(); void CreateWeather(); void MoveWeather(); + void EndWeather(); } } diff --git a/ClimatesOfFerngill/Weathers/WeatherConditions.cs b/ClimatesOfFerngill/Weathers/WeatherConditions.cs index b121c20..3e18f92 100644 --- a/ClimatesOfFerngill/Weathers/WeatherConditions.cs +++ b/ClimatesOfFerngill/Weathers/WeatherConditions.cs @@ -45,7 +45,7 @@ public class WeatherConditions private bool FogCreationProhibited { get; set; } - public bool HasEveningFog { get => HasSetEveningFog; } + private SDVTime MorningFogExpir { get; set; } /// ************************************************************************* /// ACCESS METHODS @@ -82,12 +82,17 @@ public string FogDescription(double fogRoll, double fogChance) return desc; } - public void CreateWeather(string Type) + public void CreateWeather(string Type, bool IsMorningFog = false) { foreach (ISDVWeather weather in CurrentWeathers) { if (weather.WeatherType == Type) weather.CreateWeather(); + + if (Type == "Fog" && IsMorningFog) + { + MorningFogExpir = weather.WeatherExpirationTime; + } } } @@ -254,7 +259,7 @@ public bool HasPrecip() public WeatherIcon CurrentWeatherIcon { get - { + { if (GeneralFunctions.ContainsOnlyMatchingFlags(CurrentConditionsN, (int)CurrentWeather.Rain)) return WeatherIcon.IconRain; @@ -276,6 +281,9 @@ public WeatherIcon CurrentWeatherIcon if (GeneralFunctions.ContainsOnlyMatchingFlags(CurrentConditionsN, (int)(CurrentWeather.Snow | CurrentWeather.Blizzard))) return WeatherIcon.IconBlizzard; + if (GeneralFunctions.ContainsOnlyMatchingFlags(CurrentConditionsN, (int)(CurrentWeather.Snow | CurrentWeather.Blizzard | CurrentWeather.WhiteOut))) + return WeatherIcon.IconWhiteOut; + if (GeneralFunctions.ContainsOnlyMatchingFlags(CurrentConditionsN, (int)CurrentWeather.Festival)) return WeatherIcon.IconFestival; @@ -340,6 +348,8 @@ public WeatherIcon CurrentWeatherIcon return WeatherIcon.IconSunny; if (GeneralFunctions.ContainsOnlyMatchingFlags(CurrentConditionsN, (int)(CurrentWeather.Lightning | CurrentWeather.Rain | CurrentWeather.Frost))) return WeatherIcon.IconStorm; + if (GeneralFunctions.ContainsOnlyMatchingFlags(CurrentConditionsN, (int)(CurrentWeather.Snow | CurrentWeather.Blizzard | CurrentWeather.WhiteOut))) + return WeatherIcon.IconWhiteOut; if (GeneralFunctions.ContainsOnlyMatchingFlags(CurrentConditionsN, (int)(CurrentWeather.Sunny | CurrentWeather.Frost))) return WeatherIcon.IconSunny; if (GeneralFunctions.ContainsOnlyMatchingFlags(CurrentConditionsN, (int)(CurrentWeather.Wind | CurrentWeather.Frost))) @@ -353,6 +363,8 @@ public WeatherIcon CurrentWeatherIcon return WeatherIcon.IconSnow; if (GeneralFunctions.ContainsOnlyMatchingFlags(CurrentConditionsN, (int)(CurrentWeather.Blizzard | CurrentWeather.Snow | CurrentWeather.Frost))) return WeatherIcon.IconBlizzard; + if (GeneralFunctions.ContainsOnlyMatchingFlags(CurrentConditionsN, (int)(CurrentWeather.Blizzard | CurrentWeather.Snow | CurrentWeather.Frost | CurrentWeather.WhiteOut))) + return WeatherIcon.IconBlizzard; //And now for fog. if (GeneralFunctions.ContainsOnlyMatchingFlags(CurrentConditionsN, (int)(CurrentWeather.Lightning | CurrentWeather.Fog | CurrentWeather.Sunny))) @@ -372,6 +384,8 @@ public WeatherIcon CurrentWeatherIcon return WeatherIcon.IconSunnyFog; if (GeneralFunctions.ContainsOnlyMatchingFlags(CurrentConditionsN, (int)(CurrentWeather.Rain | CurrentWeather.Frost | CurrentWeather.Fog))) return WeatherIcon.IconRainFog; + if (GeneralFunctions.ContainsOnlyMatchingFlags(CurrentConditionsN, (int)(CurrentWeather.Snow | CurrentWeather.Blizzard | CurrentWeather.WhiteOut | CurrentWeather.Fog))) + return WeatherIcon.IconWhiteOutFog; Console.WriteLine($"Error. Current conditions are: {CurrentConditionsN}"); @@ -379,14 +393,7 @@ public WeatherIcon CurrentWeatherIcon } } - public bool BlockFog - { - get { return GenerateEveningFog; } - set - { - GenerateEveningFog = value; - } - } + public bool BlockFog { get; set; } public WeatherIcon CurrentWeatherIconBasic { @@ -413,6 +420,9 @@ public WeatherIcon CurrentWeatherIconBasic if (GeneralFunctions.ContainsOnlyMatchingFlags(CurrentConditionsN, (int)(CurrentWeather.Snow | CurrentWeather.Blizzard))) return WeatherIcon.IconBlizzard; + if (GeneralFunctions.ContainsOnlyMatchingFlags(CurrentConditionsN, (int)(CurrentWeather.Blizzard | CurrentWeather.Snow | CurrentWeather.WhiteOut))) + return WeatherIcon.IconWhiteOut; + if (GeneralFunctions.ContainsOnlyMatchingFlags(CurrentConditionsN, (int)CurrentWeather.Festival)) return WeatherIcon.IconFestival; @@ -453,7 +463,7 @@ public WeatherIcon CurrentWeatherIconBasic return WeatherIcon.IconStorm; if (GeneralFunctions.ContainsOnlyMatchingFlags(CurrentConditionsN, (int)(CurrentWeather.Rain | CurrentWeather.Lightning | CurrentWeather.Heatwave | CurrentWeather.Fog))) - return WeatherIcon.IconStormFog; + return WeatherIcon.IconStorm; if (GeneralFunctions.ContainsOnlyMatchingFlags(CurrentConditionsN, (int)(CurrentWeather.Heatwave | CurrentWeather.Sunny))) return WeatherIcon.IconSunny; @@ -491,6 +501,8 @@ public WeatherIcon CurrentWeatherIconBasic return WeatherIcon.IconSnow; if (GeneralFunctions.ContainsOnlyMatchingFlags(CurrentConditionsN, (int)(CurrentWeather.Blizzard | CurrentWeather.Snow | CurrentWeather.Frost))) return WeatherIcon.IconBlizzard; + if (GeneralFunctions.ContainsOnlyMatchingFlags(CurrentConditionsN, (int)(CurrentWeather.Blizzard | CurrentWeather.Snow | CurrentWeather.Frost | CurrentWeather.WhiteOut))) + return WeatherIcon.IconWhiteOut; //And now for fog. if (GeneralFunctions.ContainsOnlyMatchingFlags(CurrentConditionsN, (int)(CurrentWeather.Lightning | CurrentWeather.Fog | CurrentWeather.Sunny))) @@ -510,6 +522,8 @@ public WeatherIcon CurrentWeatherIconBasic return WeatherIcon.IconSunny; if (GeneralFunctions.ContainsOnlyMatchingFlags(CurrentConditionsN, (int)(CurrentWeather.Rain | CurrentWeather.Frost | CurrentWeather.Fog))) return WeatherIcon.IconRain; + if (GeneralFunctions.ContainsOnlyMatchingFlags(CurrentConditionsN, (int)(CurrentWeather.Blizzard | CurrentWeather.Snow | CurrentWeather.Fog | CurrentWeather.WhiteOut))) + return WeatherIcon.IconWhiteOut; Console.WriteLine($"Error. Current conditions are: {CurrentConditionsN}"); @@ -537,7 +551,7 @@ public WeatherConditions(Icons Sheets, MersenneTwister Dice, ITranslationHelper CurrentWeathers = new List { new FerngillFog(Sheets, Config.Verbose, monitor, Dice, Config, SDVTimePeriods.Morning), - //new FerngillFog(Sheets, Config.Verbose, monitor, Dice, Config, SDVTimePeriods.Evening), + new FerngillWhiteOut(Dice, Config), new FerngillBlizzard(Dice, Config) }; @@ -547,11 +561,23 @@ public WeatherConditions(Icons Sheets, MersenneTwister Dice, ITranslationHelper private void ProcessWeatherChanges(object sender, WeatherNotificationArgs e) { - if (e.Weather == "Fog") + if (e.Weather == "WhiteOut") { if (e.Present) { - CurrentConditionsN |= CurrentWeather.Fog; + CurrentConditionsN = CurrentConditionsN | CurrentWeather.WhiteOut; + } + else + { + CurrentConditionsN = CurrentConditionsN.RemoveFlags(CurrentWeather.WhiteOut); + } + } + + if (e.Weather == "Fog") + { + if (e.Present) + { + CurrentConditionsN = CurrentConditionsN | CurrentWeather.Fog; } else { @@ -561,8 +587,9 @@ private void ProcessWeatherChanges(object sender, WeatherNotificationArgs e) if (e.Weather == "Blizzard") { + if (e.Present) - CurrentConditionsN |= CurrentWeather.Blizzard; + CurrentConditionsN = CurrentConditionsN | CurrentWeather.Blizzard; else CurrentConditionsN = CurrentConditionsN.RemoveFlags(CurrentWeather.Blizzard); } @@ -600,6 +627,7 @@ public void OnNewDay() CurrentConditionsN = CurrentWeather.Unset; TodayTemps = TomorrowTemps; //If Tomorrow is null, should just allow it to be null. TomorrowTemps = null; + MorningFogExpir = new SDVTime(600); } /// This function resets the weather object to basic. @@ -612,6 +640,7 @@ public void Reset() TodayTemps = null; TomorrowTemps = null; CurrentConditionsN = CurrentWeather.Unset; + MorningFogExpir = new SDVTime(600); } public SDVTime GetFogTime() @@ -663,7 +692,7 @@ internal static CurrentWeather ConvertToCurrentWeather(int weather) } internal void SetTodayWeather() - { + { CurrentConditionsN = CurrentWeather.Unset; //reset the flag. if (!Game1.isDebrisWeather && !Game1.isRaining && !Game1.isSnowing) @@ -683,6 +712,17 @@ internal void SetTodayWeather() if (Game1.weddingToday) AddWeather(CurrentWeather.Wedding); + + //check current weathers. + foreach (ISDVWeather weat in CurrentWeathers) + { + if (weat.WeatherType == "Fog" && weat.IsWeatherVisible) + CurrentConditionsN |= CurrentWeather.Fog; + if (weat.WeatherType == "Blizzard" && weat.IsWeatherVisible) + CurrentConditionsN |= CurrentWeather.Blizzard; + if (weat.WeatherType == "WhiteOut" && weat.IsWeatherVisible) + CurrentConditionsN |= CurrentWeather.WhiteOut; + } } /// Force for wedding only to match vanilla behavior. @@ -856,7 +896,8 @@ internal bool TestForSpecialWeather(double fogChance) // Thundersnow - as Blizzard, but really rare. // Fog - per climate, although night fog in winter is double normal chance - GenerateEveningFog = (Dice.NextDouble() < (Game1.currentSeason == "winter" ? fogChance * 2 : fogChance)) && !this.GetCurrentConditions().HasFlag(CurrentWeather.Wind); + //GenerateEveningFog = (Dice.NextDouble() < (Game1.currentSeason == "winter" ? fogChance * 2 : fogChance)) && !this.GetCurrentConditions().HasFlag(CurrentWeather.Wind); + GenerateEveningFog = true; if (BlockFog) GenerateEveningFog = false; @@ -865,7 +906,7 @@ internal bool TestForSpecialWeather(double fogChance) if (fogRoll < fogChance && !this.GetCurrentConditions().HasFlag(CurrentWeather.Wind) && !BlockFog) { - this.CreateWeather("Fog"); + this.CreateWeather("Fog", true); if (ModConfig.Verbose) Monitor.Log($"{FogDescription(fogRoll, fogChance)}"); @@ -881,6 +922,10 @@ internal bool TestForSpecialWeather(double fogChance) this.CreateWeather("Blizzard"); if (ModConfig.Verbose) Monitor.Log($"With roll {blizRoll.ToString("N3")} against {ModConfig.BlizzardOdds}, there will be blizzards today"); + if (Dice.NextDoublePositive() < .05) + { + this.CreateWeather("WhiteOut"); + } } specialWeatherTriggered = true; @@ -931,6 +976,17 @@ internal bool TestForSpecialWeather(double fogChance) } } + //test for spring conversion.- 50% chance + if (this.HasWeather(CurrentWeather.Rain) && this.HasWeather(CurrentWeather.Frost) && Game1.currentSeason == "spring" && Dice.NextDoublePositive() <= .5) + { + CurrentConditionsN.RemoveFlags(CurrentWeather.Rain); + CurrentConditionsN |= CurrentWeather.Snow; + Game1.isRaining = false; + Game1.isSnowing = true; + specialWeatherTriggered = true; + } + + return specialWeatherTriggered; } } diff --git a/ClimatesOfFerngill/Weathers/WeatherIcon.cs b/ClimatesOfFerngill/Weathers/WeatherIcon.cs index 099c5f7..bd06ea1 100644 --- a/ClimatesOfFerngill/Weathers/WeatherIcon.cs +++ b/ClimatesOfFerngill/Weathers/WeatherIcon.cs @@ -24,6 +24,8 @@ public enum WeatherIcon IconThunderSnow = 17, IconDryLightning = 18, IconDryLightningWind = 19, - IconBloodMoon = 20 + IconWhiteOut = 20, + IconWhiteOutFog = 21, + IconBloodMoon = 99 } } diff --git a/ClimatesOfFerngill/i18n/default.json b/ClimatesOfFerngill/i18n/default.json index 0cda4b3..deed0ea 100644 --- a/ClimatesOfFerngill/i18n/default.json +++ b/ClimatesOfFerngill/i18n/default.json @@ -42,12 +42,12 @@ "fern-loc.11": "Pathos Isle", //Weather - Generic Strings - "weat-loc.0": ".. concludes the weather in {{location}}.#Now for Pelican Town, expect {{descWeather}}, with a high of {{todayHigh}} and low {{todayLow}}.{{condWarning}}{{eveningFog}} #Tomorrow, expect {{tomorrowWeather}} with a high of {{tomorrowHigh}} and low of {{tomorrowLow}}", - "weat-loc.1": "Now for Pelican Town, expect {{descWeather}}, with a high of {{todayHigh}} and low {{todayLow}}.{{condWarning}}{{eveningFog}}#Tomorrow, expect {{tomorrowWeather}} with a high of {{tomorrowHigh}} and low of {{tomorrowLow}}", + "weat-loc.0": ".. concludes the weather in {{location}}.#Now for Pelican Town, expect {{descWeather}}, with a high of {{todayHigh}} and low {{todayLow}}. {{condWarning}}{{eveningFog}} #Tomorrow, expect {{tomorrowWeather}} with a high of {{tomorrowHigh}} and low of {{tomorrowLow}}", + "weat-loc.1": "Now for Pelican Town, expect {{descWeather}}, with a high of {{todayHigh}} and low {{todayLow}}. {{condWarning}}{{eveningFog}}#Tomorrow, expect {{tomorrowWeather}} with a high of {{tomorrowHigh}} and low of {{tomorrowLow}}", "weat-loc.2": "The weather for Stardew Valley will be {{todayWeather}} with a high of {{todayHigh}} and low {{todayLow}}.{{condWarning}}{{eveningFog}}#Tomorrow, expect {{tomorrowWeather}} with a high of {{tomorrowHigh}} and low of {{tomorrowLow}}", - "weat-loc.fog.0": ".. concludes the weather in {{location}}.#Now for Pelican Town, the valley will be blanked in fog until about {{fogTime}}, then expect {{descWeather}}, with a high of {{todayHigh}} and low {{todayLow}}.{{condWarning}}{{eveningFog}}#Tomorrow, expect {{tomorrowWeather}} with a high of {{tomorrowHigh}} and low of {{tomorrowLow}}", - "weat-loc.fog.1": "Now for Pelican Town, fog will continue to blanket the region until roughly {{fogTime}}, then expect {{descWeather}}, with a high of {{todayHigh}} and low {{todayLow}}.{{condWarning}}{{eveningFog}}#Tomorrow, expect {{tomorrowWeather}} with a high of {{tomorrowHigh}} and low of {{tomorrowLow}}.", + "weat-loc.fog.0": ".. concludes the weather in {{location}}.#Now for Pelican Town, the valley will be blanked in fog until about {{fogTime}}, then expect {{descWeather}}, with a high of {{todayHigh}} and low {{todayLow}}. {{condWarning}}{{eveningFog}}#Tomorrow, expect {{tomorrowWeather}} with a high of {{tomorrowHigh}} and low of {{tomorrowLow}}", + "weat-loc.fog.1": "Now for Pelican Town, fog will continue to blanket the region until roughly {{fogTime}}, then expect {{descWeather}}, with a high of {{todayHigh}} and low {{todayLow}}. {{condWarning}}{{eveningFog}}#Tomorrow, expect {{tomorrowWeather}} with a high of {{tomorrowHigh}} and low of {{tomorrowLow}}.", "weat-loc.fog.2": "Fog will be blanketing Stardew Valley until an anticipated {{fogTime}}, giving way to {{descWeather}} with a high of {{todayHigh}} and low {{todayLow}}.{{condWarning}}{{eveningFog}}#Tomorrow, expect {{tomorrowWeather}} with a high of {{tomorrowHigh}} and low of {{tomorrowLow}}", //Weather - Morning Strings @@ -58,17 +58,17 @@ //Weather - Afternoon Strings "weat-afternoon.0": "As morning gives way to afternoon, the weather will continue to be {{descWeather}} with a high of {{todayHigh}} and low {{todayLow}}.{{condWarning}}{{eveningFog}}#Tomorrow, expect {{tomorrowWeather}} with a high of {{tomorrowHigh}} and low of {{tomorrowLow}}", "weat-afternoon.1": "The weather continues to be {{descWeather}} with a high of {{todayHigh}} and low {{todayLow}}.{{condWarning}}{{eveningFog}}#Tomorrow, expect {{tomorrowWeather}} withwith a high of {{tomorrowHigh}} and low of {{tomorrowLow}}", - "weat-afternoon.2": "The weather continues to be {{descWeather}} with a high of {{todayHigh}} and low {{todayLow}}.{{condWarning}}{{eveningFog}}#Tomorrow, expect {{tomorrowWeather}} with a high of {{tomorrowHigh}} and low of {{tomorrowLow}}", + "weat-afternoon.2": "The weather is currently {{descWeather}} with a high of {{todayHigh}} and low {{todayLow}}.{{condWarning}}{{eveningFog}}#Tomorrow, anticipate {{tomorrowWeather}} with a high of {{tomorrowHigh}} and low of {{tomorrowLow}}", //Weather - Evening Strings "weat-evening.0": "The sun sets over the studio, bringing a close to today.#{{condString}}{{eveningFog}}Tomorrow, expect {{tomorrowWeather}} with a high of {{tomorrowHigh}} and low of {{tomorrowLow}}", - "weat-evening.1": "{{condString}}{{eveningFog}}Tomorrow, expect {{tomorrowWeather}} with high:{{tomorrowHigh}} and low:{{tomorrowLow}}", - "weat-evening.2": "{{condString}}{{eveningFog}}Tomorrow, expect {{tomorrowWeather}} with high:{{tomorrowHigh}} and low:{{tomorrowLow}}", + "weat-evening.1": "{{condString}}{{eveningFog}}Tomorrow, expect {{tomorrowWeather}} with high: {{tomorrowHigh}} and low: {{tomorrowLow}}", + "weat-evening.2": "{{condString}}{{eveningFog}}Tomorrow, anticipate {{tomorrowWeather}} with high: {{tomorrowHigh}} and low: {{tomorrowLow}}", //Weather - Night "weat-night.0": "{{condString}}{{eveningFog}Tomorrow, expect {{tomorrowWeather}} with a high of {{tomorrowHigh}} and low of {{tomorrowLow}}.", - "weat-night.1": "{{condString}}{{eveningFog}}Tomorrow, expect {{tomorrowWeather}} with high:{{tomorrowHigh}} and low:{{tomorrowLow}}", - "weat-night.2": "{{condString}}{{eveningFog}}Tomorrow, expect {{tomorrowWeather}} with high:{{tomorrowHigh}} and low:{{tomorrowLow}}", + "weat-night.1": "{{condString}}{{eveningFog}}Tomorrow, it should be {{tomorrowWeather}} with high: {{tomorrowHigh}} and low: {{tomorrowLow}}", + "weat-night.2": "{{condString}}{{eveningFog}}For tomorrow, expect {{tomorrowWeather}} with high: {{tomorrowHigh}} and low: {{tomorrowLow}}", //Weather - Midnight "weat-midnight.0": "As the witching hour reigns, the weather for tomorrow is {{tomorrowWeather}} with a high of {{tomorrowHigh}} and low of {{tomorrowLow}}.", @@ -93,47 +93,36 @@ "weat-wedTomorrow.0": "Today, expect {{weather}} with high:{{high}} and low:{{low}}#Tommorow, for the wedding, expect {{tomorrowWeather}}", //Weather - Condition Strings - "weather-condition.heatwave.0": "RWS: A heatwave is expected for the Stardew Valley area out to Zuzu City. Please keep hydrated!", - "weather-condition.heatwave.1": "RWS: A heatwave is expected for areas bordering the Gem Sea.", - "weather-condition.heatwave.2": "RWS: A heatwave is in progress for areas bordering the Gem Sea.", + "weather-condition.heatwave.0": "RWS: A heatwave is expected for the Stardew Valley area out to Zuzu City. Please keep hydrated! ", + "weather-condition.heatwave.1": "RWS: A heatwave is expected for areas bordering the Gem Sea. ", + "weather-condition.heatwave.2": "RWS: A heatwave is in progress for areas bordering the Gem Sea. ", - "weather-condition.frost.0": "RWS: An unsesaonal frost is expected from areas south and east of Minister Valley, including Stardew Valley. Please keep bundled up!", - "weather-condition.frost.1": "RWS: A frost is expected for areas bordering the Gem Sea. Expect early crop death, as well as possible hypothermia.", - "weather-condition.frost.2": "RWS: An overnight frost is expected for areas bordering the Gem Sea.", + "weather-condition.frost.0": "RWS: An unsesaonal frost is expected from areas south and east of Minister Valley, including Stardew Valley. Please keep bundled up! ", + "weather-condition.frost.1": "RWS: A frost is expected for areas bordering the Gem Sea. Expect early crop death, as well as possible hypothermia. ", + "weather-condition.frost.2": "RWS: An overnight frost is expected for areas bordering the Gem Sea. ", - //this is the night string - "weather-condition.frost.night": "Forecasters are already seeing the temperatures dip dangerously low, and you should expect frosts outside tonight.", - "weather-condition.evenFog": "Fog is predicted this evening from {{startTime}} to {{endTime}}", - - //Basic Weather - "weather-tomorrow.sunny.0": "sun", - "weather-tomorrow.sunny.1": "clear skies", - - "weather-tomorrow.rainy.0": "rain", - "weather-tomorrow.rainy.1": "wet weather", - - "weather-tomorrow.debris.0": "wind", - "weather-tomorrow.debris.1": "gusts", - - "weather-tomorrow.storms.0": "storms", - "weather-tomorrow.storms.1": "lightning and rain", - - "weather-tomorrow.snowy.0": "snow", - "weather-tomorrow.snowy.1": "icy weather", + "weather-condition.whiteout.0": "RWS: An extreme blizzard is sweeping over the region, whiting out the region. ", + "weather-condition.whiteout.1": "RWS: A howling blizzard is expected throughout the valley. Do not travel if at all possible. ", + "weather-condition.whiteout.2": "RWS: Expect near zero visiblity outside as a blizzard passes through. ", - "weather-tomorrow.blizzard.0": "blizzards", - "weather-tomorrow.blizzard.1": "a near white out across the region", + //this is the night string + "weather-condition.frost.night": "Forecasters are already seeing the temperatures dip dangerously low, and you should expect frosts outside tonight. ", + "weather-condition.evenFog": "Fog is predicted this evening from {{startTime}} to {{endTime}}. ", //Weather Descriptions - Spring - "weat-spring.sunny.0": "a beautiful sunny day", - "weat-spring.sunny.1": "a good day to enjoy the sun on a warm spring morning", - "weat-spring.sunny.2": "it's another day for planting those gardens", + "weat-spring.sunny_daytime.0": "a beautiful sunny day", + "weat-spring.sunny_daytime.1": "a good day to enjoy the sun on a warm spring morning", + "weat-spring.sunny_daytime.2": "it's another day for planting those gardens", + + "weat-spring.sunny_nighttime.0": "a clear spring night", + "weat-spring.sunny_nighttime.1": "a cold and beautiful sky viewing night", + "weat-spring.sunny_nighttime.2": "the rest of the day in a chilly night", "weat-spring.rainy.0": "rain to fall down", "weat-spring.rainy.1": "a gentle downpour of preciptation to nourish all of those flowers", "weat-spring.rainy.2": "a good day to stay inside and read, as the rain drenches the town", - "weat-spring.stormy.0": "the spring storms are blowing off the Gem Sea, so batten those hatches", + "weat-spring.stormy.0": "the spring storms are blowing off the Gem Sea.", "weat-spring.stormy.1": "the storms blowing through the valley are expected to be all day", "weat-spring.stormy.2": "expect lightning and thunder all day", @@ -153,20 +142,24 @@ "weat-spring.drythunder.1": "due to the lack of moisture, the lightning will not include rain", "weat-spring.drythunder.2": "expect lightning and thunder but no rain", - "weat-spring.thundersnow.0": "a rare and out of season thunder snow will be in the valley" , + "weat-spring.thundersnow.0": "a rare and out of season thunder snow will be in the valley", "weat-spring.thundersnow.1": "a rare and out of season thunder snow will be in the valley", "weat-spring.thundersnow.2": "a rare and out of season thunder snow will be in the valley", //Weather Descriptions - Summer - "weat-summer.sunny.0": "a hot sunny day", - "weat-summer.sunny.1": "a good day to enjoy the sun", - "weat-summer.sunny.2": "a bright cheery day", + "weat-summer.sunny_daytime.0": "a hot sunny day", + "weat-summer.sunny_daytime.1": "a good day to enjoy the sun", + "weat-summer.sunny_daytime.2": "a bright cheery day", + + "weat-summer.sunny_nighttime.0": "a warm summer night", + "weat-summer.sunny_nighttime.1": "to enjoy a warm clear night", + "weat-summer.sunny_nighttime.2": "a great night to stargaze", "weat-summer.rainy.0": "a rain falling down", "weat-summer.rainy.1": "a rain providing a relief from the sun", "weat-summer.rainy.2": "a good day to stay inside and read, as the rain drenches the town", - "weat-summer.stormy.0": "more summer storms blowing off the Gem Sea, so batten those hatches", + "weat-summer.stormy.0": "more summer storms blowing off the Gem Sea. Make sure to batten those hatches down!", "weat-summer.stormy.1": "that the storms blowing through the valley will last all day", "weat-summer.stormy.2": "lightning and thunder all day", @@ -187,15 +180,19 @@ "weat-summer.thundersnow.2": "a rare and out of season thunder snow will be in the valley", //Weather Descriptions - Fall - "weat-fall.sunny.0": "a cool sunny day", - "weat-fall.sunny.1": "a good day to enjoy the sun on a chilly fall morning", - "weat-fall.sunny.2": "a bright cheery day", + "weat-fall.sunny_daytime.0": "a cool sunny day", + "weat-fall.sunny_daytime.1": "a good day to enjoy the sun on a chilly fall morning", + "weat-fall.sunny_daytime.2": "a bright cheery day", + + "weat-fall.sunny_nighttime.0": "a chilly clear night", + "weat-fall.sunny_nighttime.1": "a chilly night", + "weat-fall.sunny_nighttime.2": "a good night to sit out on the porch", "weat-fall.rainy.0": "a rain falling down", "weat-fall.rainy.1": "a sign of the advancing rain on the valley", "weat-fall.rainy.2": "a good day to stay inside and read, as the rain drenches the town", - "weat-fall.stormy.0": "the fall storms are blowing off the Gem Sea, so batten those hatches", + "weat-fall.stormy.0": "the fall storms are blowing off the Gem Sea", "weat-fall.stormy.1": "the storms blowing through the valley are expected to come in waves all day", "weat-fall.stormy.2": "expect lightning and thunder all day", @@ -220,9 +217,13 @@ "weat-fall.thundersnow.2": "an almost unheard of thunder snow will be in the valley", //Weather Descriptions - Winter - "weat-winter.sunny.0": "a cool sunny day", - "weat-winter.sunny.1": "a good day to enjoy the sun on a chilly winter morning", - "weat-winter.sunny.2": "a bright cheery day in that peculiar winter way", + "weat-winter.sunny_daytime.0": "a cool sunny day", + "weat-winter.sunny_daytime.1": "a good day to enjoy the sun on a chilly winter morning", + "weat-winter.sunny_daytime.2": "a bright winter cheery day", + + "weat-winter.sunny_nighttime.0": "a frigid sunny night", + "weat-winter.sunny_nighttime.1": "a good day to drink hot chocolate from inside", + "weat-winter.sunny_nighttime.2": "a frozen cloudless night", "weat-winter.rainy.0": "an unusually warm day sees rain pouring down", "weat-winter.rainy.1": "a sign of the advancing rain on the valley", @@ -271,16 +272,22 @@ //Weather Menu strings "weather-menu.opening": "This is Kylie from KZAM Radio, broadcasting on 92.5 out of Point Drake. It is the {{descDay}}, and here is the weather report for Stardew Valley:", + "weather-menu.openingS1D1": "This is Kylie from KZAM Radio, broadcasting on 92.5 out of Point Drake. It is the beginning of the year, the {{descDay}}, and here is the weather report for Stardew Valley:", + "weather-menu.openingS4D28": "This is Kylie from KZAM Radio, broadcasting on 92.5 out of Point Drake. It is the end of the year, the {{descDay}}, and here is the weather report for Stardew Valley:", "weather-menu.condition.frost": "RWS Warning: Frost tonight.", "weather-menu.condition.heatwave": "RWS Warning: Heatwave expected through the day.", - "weather-menu.current": "Current Conditions: {{todayCondition}}. High: {{todayHigh}} with Low: {{todayLow}}. {{fogString}}", - "weather-menu.fog": "Fog present until {{fogTime}}", - "weather-menu.fogFuture": "Expected fog at {{fogTime}} to {{endFog}}", + "weather-menu.current": "Current Conditions: {{todayCondition}}. High: {{todayHigh}} with Low: {{todayLow}}.{{fogString}}", + "weather-menu.fog": "Fog present until {{fogTime}}.", + "weather-menu.expectedFog": " Evening fog is expected as well.", + "weather-menu.fogFuture": " Expected fog later at about {{fogTime}} to {{endFog}}.", "weather-menu.tomorrow": "Tomorrow's Forecast: {{tomorrowCondition}}. High: {{tomorrowHigh}} with Low: {{tomorrowLow}}.", //basic conditions + "weather_sunny_daytime": "Sunny", + "weather_sunny_nighttime": "Clear", "weather_sunny": "Sunny", - "weather_wind": "Debris", + "weather_whiteout": "White Out", + "weather_wind": "Windy", "weather_lightning": "Stormy", "weather_snow": "Snowy", "weather_rainy": "Rainy", diff --git a/ClimatesOfFerngill/manifest.json b/ClimatesOfFerngill/manifest.json index 1b9981a..f7bec22 100644 --- a/ClimatesOfFerngill/manifest.json +++ b/ClimatesOfFerngill/manifest.json @@ -1,7 +1,7 @@ { "Name": "Climates of Ferngill [Rebuild]", "Author": "KoihimeNakamura", - "Version": "1.3.0-beta3", + "Version": "1.3.0", "Description": "Create a unique climate system with custom weathers, as well as add weather related events and commands.", "UniqueID": "KoihimeNakamura.ClimatesOfFerngill", "EntryDll": "ClimatesOfFerngill.dll", diff --git a/CustomizableCartRedux/CustomizableCartRedux.cs b/CustomizableCartRedux/CustomizableCartRedux.cs index 844320b..fd4fb2d 100644 --- a/CustomizableCartRedux/CustomizableCartRedux.cs +++ b/CustomizableCartRedux/CustomizableCartRedux.cs @@ -4,8 +4,11 @@ using StardewValley; using StardewModdingAPI.Events; using StardewValley.Locations; +using System.Linq; using StardewModdingAPI.Utilities; using Microsoft.Xna.Framework; +using SObject = StardewValley.Object; +using StardewValley.Objects; namespace CustomizableCartRedux { @@ -115,7 +118,7 @@ private void SetCartSpawn(object Sender, EventArgs e) new Rectangle(23 * Game1.tileSize + 85 * Game1.pixelZoom, 10 * Game1.tileSize + 26 * Game1.pixelZoom, 26 * Game1.pixelZoom, 12 * Game1.pixelZoom) }; - f.travelingMerchantStock = Utility.getTravelingMerchantStock(); + f.travelingMerchantStock = GetTravelingMerchantStock(OurConfig.AmountOfItems); foreach (Rectangle travelingMerchantBound in f.travelingMerchantBounds) { Utility.clearObjectsInArea(travelingMerchantBound, f); @@ -130,6 +133,114 @@ private void SetCartSpawn(object Sender, EventArgs e) } } + private Dictionary GetTravelingMerchantStock(int numStock) + { + Dictionary dictionary = new Dictionary(); + Random r = new Random((int)((long)Game1.uniqueIDForThisGame + (long)Game1.stats.DaysPlayed)); + for (int index1 = 0; index1 < (numStock - 2); ++index1) + { + int index2 = r.Next(2, 790); + string[] strArray; + do + { + do + { + index2 = (index2 + 1) % 790; + } + while (!Game1.objectInformation.ContainsKey(index2) || Utility.isObjectOffLimitsForSale(index2)); + strArray = Game1.objectInformation[index2].Split('/'); + } + while (!strArray[3].Contains('-') || Convert.ToInt32(strArray[1]) <= 0 || (strArray[3].Contains("-13") || strArray[3].Equals("Quest")) || (strArray[0].Equals("Weeds") || strArray[3].Contains("Minerals") || strArray[3].Contains("Arch"))); + + + dictionary.Add((Item)new SObject(index2, 1, false, -1, 0), new int[2] + { + Math.Max(r.Next(1, 11) * 100, Convert.ToInt32(strArray[1]) * r.Next(3, 6)), + r.NextDouble() < 0.1 ? 5 : 1 + }); + } + dictionary.Add((Item)GetRandomFurniture(r, (List)null, 0, 1613), new int[2] + { + r.Next(1, 11) * 250, + 1 + }); + if (Utility.getSeasonNumber(Game1.currentSeason) < 2) + dictionary.Add((Item)new SObject(347, 1, false, -1, 0), new int[2] + { + 1000, + r.NextDouble() < 0.1 ? 5 : 1 + }); + else if (r.NextDouble() < 0.4) + dictionary.Add((Item)new SObject(Vector2.Zero, 136, false), new int[2] + { + 4000, + 1 + }); + if (r.NextDouble() < 0.25) + dictionary.Add((Item)new SObject(433, 1, false, -1, 0), new int[2] + { + 2500, + 1 + }); + return dictionary; + } + + private Furniture GetRandomFurniture(Random r, List stock, int lowerIndexBound = 0, int upperIndexBound = 1462) + { + Dictionary dictionary = Game1.content.Load>("Data\\Furniture"); + int num; + do + { + num = r.Next(lowerIndexBound, upperIndexBound); + if (stock != null) + { + foreach (Item obj in stock) + { + if (obj is Furniture && obj.parentSheetIndex == num) + num = -1; + } + } + } + while (IsFurnitureOffLimitsForSale(num) || !dictionary.ContainsKey(num)); + Furniture furniture = new Furniture(num, Vector2.Zero); + int maxValue = int.MaxValue; + furniture.stack = maxValue; + return furniture; + } + + private static bool IsFurnitureOffLimitsForSale(int index) + { + switch (index) + { + case 1680: + case 1733: + case 1669: + case 1671: + case 1541: + case 1545: + case 1554: + case 1402: + case 1466: + case 1468: + case 131: + case 1226: + case 1298: + case 1299: + case 1300: + case 1301: + case 1302: + case 1303: + case 1304: + case 1305: + case 1306: + case 1307: + case 1308: + return true; + default: + return false; + } + } + private DayOfWeek GetDayOfWeek(SDate Target) { switch (Target.Day % 7) diff --git a/CustomizableCartRedux/manifest.json b/CustomizableCartRedux/manifest.json index de638d5..45269f6 100644 --- a/CustomizableCartRedux/manifest.json +++ b/CustomizableCartRedux/manifest.json @@ -4,8 +4,8 @@ "Version": { "MajorVersion": 1, "MinorVersion": 1, - "PatchVersion": 0, - "Build": "20170917" + "PatchVersion": 1, + "Build": "" }, "Description": "Allows you to alter the chances of the traveling cart appearing. Credit to Yyeahdude for the original idea.", "UniqueID": "KoihimeNakamura.CCR", diff --git a/SolarEclipseEvent/manifest.json b/SolarEclipseEvent/manifest.json index 5fc22eb..01d97bc 100644 --- a/SolarEclipseEvent/manifest.json +++ b/SolarEclipseEvent/manifest.json @@ -1,12 +1,7 @@ { "Name": "Solar Eclipse Event", "Author": "KoihimeNakamura", - "Version": { - "MajorVersion": 1, - "MinorVersion": 3, - "PatchVersion": 1, - "Build": "20180131" - }, + "Version": "1.3.1", "Description": "Adds a solar eclipse event", "UniqueID": "KoihimeNakamura.SolarEclipseEvent", "EntryDll": "SolarEclipseEvent.dll" diff --git a/TimeReminder/TimeReminder.cs b/TimeReminder/TimeReminder.cs index 7b646d9..bb71750 100644 --- a/TimeReminder/TimeReminder.cs +++ b/TimeReminder/TimeReminder.cs @@ -19,31 +19,6 @@ public override void Entry(IModHelper helper) PrevDate = DateTime.Now; GameEvents.OneSecondTick += GameEvents_OneSecondTick; - TimeEvents.AfterDayStarted += TimeEvents_AfterDayStarted; - } - - private void TimeEvents_AfterDayStarted(object sender, EventArgs e) - { - int stage = 0, daysLeft = 0; - int numCropsUnsynced = 0; - - Farm f = Game1.getFarm(); - foreach (KeyValuePair tf in f.terrainFeatures) - { - if (tf.Value is HoeDirt h && h.crop != null) - { - if (stage != h.crop.currentPhase && daysLeft != h.crop.dayOfCurrentPhase) - { - stage = h.crop.currentPhase; - daysLeft = h.crop.dayOfCurrentPhase; - numCropsUnsynced++; - } - - } - } - - numCropsUnsynced--; //subtract 1 - Game1.addHUDMessage(new HUDMessage($"We've got {numCropsUnsynced} unsync'd crops")); } private void GameEvents_OneSecondTick(object sender, EventArgs e)