/// <summary>Raised after the game begins a new day (including when the player loads a save).</summary> /// <param name="sender">The event sender.</param> /// <param name="e">The event arguments.</param> private void OnDayStarted(object sender, DayStartedEventArgs e) { if (OurMoon.GetMoonRiseTime() <= 0600 || OurMoon.GetMoonRiseTime() >= 2600 && ModConfig.ShowMoonPhase) { Game1.addHUDMessage(new HUDMessage(Helper.Translation.Get("moon-text.moonriseBefore6", new { moonPhase = OurMoon.DescribeMoonPhase(), riseTime = OurMoon.GetMoonRiseDisplayTime() }))); } if (OurMoon == null) { Monitor.Log("OurMoon is null"); return; } if (Dice.NextDouble() < ModConfig.EclipseChance && ModConfig.EclipseOn && OurMoon.CurrentPhase == MoonPhase.FullMoon && SDate.Now().DaysSinceStart > 2) { IsEclipse = true; var n = new HUDMessage(Helper.Translation.Get("moon-text.solareclipse")) { color = Color.SeaGreen, fadeIn = true, timeLeft = 4000, noIcon = true }; Game1.addHUDMessage(n); Monitor.Log("There's a solar eclipse today!", LogLevel.Info); } OurMoon.OnNewDay(); OurMoon.HandleMoonAfterWake(); }
/// <summary>Raised after the game begins a new day (including when the player loads a save).</summary> /// <param name="sender">The event sender.</param> /// <param name="e">The event arguments.</param> private void OnDayStarted(object sender, DayStartedEventArgs e) { Helper.Content.InvalidateCache("LooseSprites/Cursors"); if (OurMoon.GetMoonRiseTime() <= 0600 || OurMoon.GetMoonRiseTime() >= 2600 && ModConfig.ShowMoonPhase) { Game1.addHUDMessage(new TCHUDMessage(Helper.Translation.Get("moon-text.moonriseBefore6", new { moonPhase = OurMoon.DescribeMoonPhase(), riseTime = OurMoon.GetMoonRiseDisplayTime() }), OurMoon.CurrentPhase())); } if (OurMoon == null) { Monitor.Log("OurMoon is null"); return; } if (queuedMsg != null) { Game1.addHUDMessage(queuedMsg); queuedMsg = null; } if (Context.IsMainPlayer) { if (OurMoon.MoonTracker.CurrentSeason != Game1.currentSeason) { OurMoon.MoonTracker.CurrentSeason = Game1.currentSeason; OurMoon.MoonTracker.FullMoonThisSeason = false; } } if (Dice.NextDouble() < ModConfig.EclipseChance && ModConfig.EclipseOn && OurMoon.CurrentPhase() == MoonPhase.NewMoon && SDate.Now().DaysSinceStart > 2 && !Utility.isFestivalDay(Game1.dayOfMonth, Game1.currentSeason)) { IsEclipse = true; var n = new HUDMessage(Helper.Translation.Get("moon-text.solareclipse")) { color = Color.SeaGreen, fadeIn = true, timeLeft = 4000, noIcon = true }; Game1.addHUDMessage(n); MoonMessage message = GenerateLunarSync(); MPHandler.SendMessage <MoonMessage>(message, "MoonMessage", new[] { "KoihimeNakamura.LunarDisturbances" }); Monitor.Log("There's a solar eclipse today!", LogLevel.Info); } OurMoon.UpdateForBloodMoon(); OurMoon.OnNewDay(); OurMoon.HandleMoonAfterWake(); }
private void ShowMoonInfo(string arg1, string[] arg2) { Monitor.Log($"Moon phase according to end of night: {OurMoon.GetLunarPhaseForDay(SDate.Now())}, with coords: { Sprites.Icons.GetNightMoonSprite(OurMoon.GetLunarPhaseForDay(SDate.Now()))}. According to normal phrasing: Phase is {OurMoon.DescribeMoonPhase()}, with rise {OurMoon.GetMoonRiseTime()} and set {OurMoon.GetMoonSetTime()}", LogLevel.Info); }