Skip to content

Commit

Permalink
- update mod to 1.3 and update CCR to 1.1.1 - see readme for changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
KoihimeNakamura committed Feb 5, 2018
1 parent 77d8dc4 commit d4b54ff
Show file tree
Hide file tree
Showing 21 changed files with 633 additions and 313 deletions.
Binary file modified ClimatesOfFerngill/Assets/WeatherIcons2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions ClimatesOfFerngill/ClimatesOfFerngill.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
<ItemGroup>
<Compile Include="ClimatesOfFerngillApi.cs" />
<Compile Include="DaMoon\MoonPhase.cs" />
<Compile Include="Weathers\FerngillWhiteOut.cs" />
<Compile Include="Weathers\ForceDays.cs" />
<Compile Include="Weathers\ISDVWeather.cs" />
<Compile Include="Weathers\IWeatherEvent.cs" />
Expand Down
30 changes: 29 additions & 1 deletion ClimatesOfFerngill/ClimatesOfFerngillRebuild.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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);
}

/// <summary>
Expand Down
111 changes: 66 additions & 45 deletions ClimatesOfFerngill/Descriptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ private string GetTemperatureString(double temp)
}
else
{
return $"{temp.ToString("N1")}";
return $"{temp.ToString("N1")} C";
}
}

Expand All @@ -76,39 +76,51 @@ 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))
{
text += Helper.Get("weather-menu.condition.heatwave") + Environment.NewLine;
}

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",
Expand All @@ -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) }
};

Expand All @@ -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);
Expand Down Expand Up @@ -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
Expand All @@ -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";
}
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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";
}
Expand Down Expand Up @@ -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;
}
Expand Down
Loading

0 comments on commit d4b54ff

Please sign in to comment.