示例#1
0
        internal static void HandleStormTotemInterception(DialogueBox box, double odds, double stormOdds)
        {
            bool          stormDialogue = false;
            List <string> lines         = ClimatesOfFerngill.Reflection.GetField <List <string> >(box, "dialogues").GetValue();

            if (lines.FirstOrDefault() == Game1.content.LoadString("Strings\\StringsFromCSFiles:Object.cs.12822"))
            {
                if (ClimatesOfFerngill.WeatherOpt.Verbose)
                {
                    ClimatesOfFerngill.Logger.Log($"Rain totem interception firing with roll {odds:N3} vs. odds {stormOdds:N3}");
                }

                // rain totem used, do your thing
                if (ClimatesOfFerngill.WeatherOpt.StormTotemChange)
                {
                    if (odds <= stormOdds)
                    {
                        if (ClimatesOfFerngill.WeatherOpt.Verbose)
                        {
                            ClimatesOfFerngill.Logger.Log("Replacing rain with storm..");
                        }

                        SDVUtilities.SetWeather(Game1.weather_lightning);
                        stormDialogue = true;
                    }
                }

                // change dialogue text
                lines.Clear();
                lines.Add(stormDialogue
                    ? ClimatesOfFerngill.Translator.Get("hud-text.desc_stormtotem")
                    : Game1.content.LoadString("Strings\\StringsFromCSFiles:Object.cs.12822"));
            }
        }
示例#2
0
        internal static void SetWeatherOvercast(bool OnNewDay = false)
        {
            Game1.isLightning = Game1.isSnowing = Game1.isDebrisWeather = false;
            Game1.isRaining   = false;
            if (!OnNewDay)
            {
                ClimatesOfFerngill.Conditions.GetWeatherMatchingType("Blizzard").First().EndWeather();
                ClimatesOfFerngill.Conditions.GetWeatherMatchingType("WhiteOut").First().EndWeather();
                ClimatesOfFerngill.Conditions.GetWeatherMatchingType("ThunderFrenzy").First().EndWeather();
                Game1.debrisWeather.Clear();
            }

            ClimatesOfFerngill.Logger.Log("Resizing rain array - setting weather to overcast");
            Array.Resize(ref Game1.rainDrops, 0);
            ClimatesOfFerngill.Conditions.AddWeather(CurrentWeather.Overcast);
            ClimatesOfFerngill.Conditions.RemoveWeather(CurrentWeather.Rain);
            ClimatesOfFerngill.Conditions.SetRainAmt(0);
            ClimatesOfFerngill.Conditions.SetVariableRain(false);
            ClimatesOfFerngill.Conditions.IsOvercast = true;
            Game1.updateWeather(Game1.currentGameTime);
            Game1.currentLocation.UpdateWhenCurrentLocation(Game1.currentGameTime);
            ClimatesOfFerngill.Conditions.Refresh();
            SDVUtilities.UpdateAudio();

            if (Game1.currentLocation is DecoratableLocation)
            {
                UpdateFurniture(Game1.currentLocation as DecoratableLocation);
            }
        }
        /// <summary>Raised after the game is launched, right before the first update tick. This happens once per game session (unrelated to loading saves). All mods are loaded and initialised at this point, so this is a good time to set up mod integrations.</summary>
        /// <param name="sender">The event sender.</param>
        /// <param name="e">The event arguments.</param>
        private void OnGameLaunched(object sender, GameLaunchedEventArgs e)
        {
            var modManifest = Helper.ModRegistry.Get("KoihimeNakamura.summitreborn");

            if (modManifest != null)
            {
                SummitRebornLoaded = true;
                Logger.Log("Summit Reborn loaded. Disabling summit redraw.");
            }

            //testing for ZA MOON, YOUR HIGHNESS.
            MoonAPI          = SDVUtilities.GetModApi <Integrations.ILunarDisturbancesAPI>(Monitor, Helper, "KoihimeNakamura.LunarDisturbances", "1.0", "Lunar Disturbances");
            SafeLightningAPI = SDVUtilities.GetModApi <Integrations.ISafeLightningAPI>(Monitor, Helper, "cat.safelightning", "1.0", "Safe Lightning");
            DynamicNightAPI  = SDVUtilities.GetModApi <Integrations.IDynamicNightAPI>(Monitor, Helper, "knakamura.dynamicnighttime", "1.1-rc3", "Dynamic Night Time");

            if (MoonAPI != null)
            {
                UseLunarDisturbancesApi = true;
            }

            if (SafeLightningAPI != null)
            {
                UseSafeLightningApi = true;
            }

            if (DynamicNightAPI != null)
            {
                UseDynamicNightApi = true;
            }
        }
示例#4
0
        /// <summary>Raised after the game is launched, right before the first update tick. This happens once per game session (unrelated to loading saves). All mods are loaded and initialised at this point, so this is a good time to set up mod integrations.</summary>
        /// <param name="sender">The event sender.</param>
        /// <param name="e">The event arguments.</param>
        private void OnGameLaunched(object sender, GameLaunchedEventArgs e)
        {
            JAAPi = SDVUtilities.GetModApi <Integrations.IJsonAssetsApi>(Monitor, Helper, "spacechase0.JsonAssets", "1.1");

            if (JAAPi != null)
            {
                UseJsonAssetsApi        = true;
                JAAPi.AddedItemsToShop += JAAPi_AddedItemsToShop;
                //Monitor.Log("JsonAssets Integration enabled", LogLevel.Info);
            }

            var api = Helper.ModRegistry.GetApi <Integrations.GenericModConfigMenuAPI>("spacechase0.GenericModConfigMenu");

            if (api != null)
            {
                api.RegisterModConfig(ModManifest, () => ModConfig = new MoonConfig(), () => Helper.WriteConfig(ModConfig));
                api.RegisterClampedOption(ModManifest, "Blood Moon Chances", "The chance for a blood moon rising. There's a bad moon on the rise.", () => (float)ModConfig.BadMoonRising, (float val) => ModConfig.BadMoonRising = val, 0f, 1f);
                api.RegisterSimpleOption(ModManifest, "Allow Eclipse", "This option controls if eclipses will happen", () => ModConfig.EclipseOn, (bool val) => ModConfig.EclipseOn = val);
                api.RegisterSimpleOption(ModManifest, "Show Moon Phase", "Show the moon phase popups on moon rise and set", () => ModConfig.ShowMoonPhase, (bool val) => ModConfig.ShowMoonPhase = val);
                api.RegisterSimpleOption(ModManifest, "Spawn Monsters", "This option controls if monsters spawn during eclipses on a wilderness farm. NOTE: They don't spawn if you've turned off monster spawns in game.", () => ModConfig.SpawnMonsters, (bool val) => ModConfig.SpawnMonsters = val);
                api.RegisterSimpleOption(ModManifest, "Hazardous Moon Events", "This controls the moon events that can hinder the player, or spawn monsters. No monsters will spawn ( the blood moon won't even happen) while this is false. This also stops the crop deadvancement on the new moon.", () => ModConfig.HazardousMoonEvents, (bool val) => ModConfig.HazardousMoonEvents = val);
                api.RegisterSimpleOption(ModManifest, "Verbose Logging", "This controls if the mod is verbose to the content.", () => ModConfig.Verbose, (bool val) => ModConfig.Verbose = val);
                api.RegisterClampedOption(ModManifest, "Eclipse Chance", "The chance for an eclipse", () => (float)ModConfig.EclipseChance, (float val) => ModConfig.EclipseChance       = val, 0f, 1f);
                api.RegisterClampedOption(ModManifest, "Crop Growth Chance", "The chance for crops to grow on a full moon", () => (float)ModConfig.CropGrowthChance, (float val) => ModConfig.CropGrowthChance = val, 0f, 1f);
                api.RegisterClampedOption(ModManifest, "Crop Halt Chance", "The chance for crops to not grow on a new moon", () => (float)ModConfig.CropHaltChance, (float val) => ModConfig.CropHaltChance    = val, 0f, 1f);
                api.RegisterClampedOption(ModManifest, "Beach Removal Chance", "The chance for items on the beach to be removed on a new moon", () => (float)ModConfig.BeachRemovalChance, (float val) => ModConfig.BeachRemovalChance = val, 0f, 1f);
                api.RegisterClampedOption(ModManifest, "Beach Spawn Chance", "The chance for items on the beach to be spawned on a full moon", () => (float)ModConfig.BeachSpawnChance, (float val) => ModConfig.BeachSpawnChance      = val, 0f, 1f);
                api.RegisterClampedOption(ModManifest, "Ghost Spawn Chance", "The chance for ghosts to spawn on a full moon", () => (float)ModConfig.GhostSpawnChance, (float val) => ModConfig.GhostSpawnChance = val, 0f, 1f);
            }
        }
        /// <summary>Raised after the game is launched, right before the first update tick. This happens once per game session (unrelated to loading saves). All mods are loaded and initialised at this point, so this is a good time to set up mod integrations.</summary>
        /// <param name="sender">The event sender.</param>
        /// <param name="e">The event arguments.</param>
        private void OnGameLaunched(object sender, GameLaunchedEventArgs e)
        {
            //testing for ZA MOON, YOUR HIGHNESS.
            MoonAPI = SDVUtilities.GetModApi <ILunarDisturbancesAPI>(Monitor, Helper, "KoihimeNakamura.LunarDisturbances", "1.0.7", "Lunar Disturbances");

            if (MoonAPI != null)
            {
                LunarDisturbancesLoaded = true;
            }

            ClimatesAPI = SDVUtilities.GetModApi <IClimatesOfFerngillAPI>(Monitor, Helper, "KoihimeNakamura.ClimatesOfFerngill", "1.5.0-beta15", "Climates of Ferngill");

            if (ClimatesAPI != null)
            {
                ClimatesLoaded = true;
            }

            //GMCM interaction
            var GMCMapi = Helper.ModRegistry.GetApi <GenericModConfigMenuAPI>("spacechase0.GenericModConfigMenu");

            if (GMCMapi != null)
            {
                GMCMapi.RegisterModConfig(ModManifest, () => NightConfig = new DynamicNightConfig(), () => Helper.WriteConfig(NightConfig));
                GMCMapi.RegisterClampedOption(ModManifest, "Latitude", "Latitude used to generate the sunrise and sunset times", () => NightConfig.Latitude,
                                              (float val) => NightConfig.Latitude = val, -63.5f, 63.5f);
                GMCMapi.RegisterSimpleOption(ModManifest, "Sunset Times", "This option controls if you subtract a half hour from the generated time", () => NightConfig.SunsetTimesAreMinusThirty, (bool val) => NightConfig.SunsetTimesAreMinusThirty = val);
                GMCMapi.RegisterSimpleOption(ModManifest, "More Orange Sunrise", "This option controls if you want a more orange sunrise", () => NightConfig.MoreOrangeSunrise, (bool val) => NightConfig.MoreOrangeSunrise = val);
                GMCMapi.RegisterClampedOption(ModManifest, "Night Darkness Level", "Controls the options for how dark it is at night. Higher is darker.", () => NightConfig.NightDarknessLevel,
                                              (int val) => NightConfig.NightDarknessLevel = val, 1, 4);
            }
        }
示例#6
0
        public void ClearDrain(int reason = 1)
        {
            FarmerSick = false;
            if (Game1.buffsDisplay.otherBuffs.Any())
            {
                int buffId = UniqueStaID + SicknessBuffID;
                int i      = Game1.buffsDisplay.otherBuffs.FindIndex(p => p.which == buffId);
                //of course a not found is a negative index.
                if (i > 0)
                {
                    Game1.buffsDisplay.otherBuffs.RemoveAt(i);
                }
            }

            if (IllOptions.Verbose)
            {
                Monitor.Log("Removing buff icon!!");
            }

            if (reason == StaminaDrain.MedicineClear)
            {
                SDVUtilities.ShowMessage(Helper.Get("hud-text.desc_cold_removed"), 4);
            }
            else if (reason == StaminaDrain.BathHouseClear)
            {
                SDVUtilities.ShowMessage(Helper.Get("hud-text.desc_bathHouse"), 4);
            }
        }
示例#7
0
        internal static void SetWeatherTesting2()
        {
            Game1.isSnowing       = Game1.isLightning = false;
            Game1.isDebrisWeather = Game1.isRaining = true;
            ClimatesOfFerngill.Conditions.RemoveWeather(CurrentWeather.Overcast);
            Game1.debrisWeather.Clear();
            ClimatesOfFerngill.Conditions.GetWeatherMatchingType("Blizzard").First().EndWeather();
            ClimatesOfFerngill.Conditions.GetWeatherMatchingType("WhiteOut").First().EndWeather();
            ClimatesOfFerngill.Conditions.GetWeatherMatchingType("ThunderFrenzy").First().EndWeather();
            ClimatesOfFerngill.Conditions.GetWeatherMatchingType("Sandstorm").First().EndWeather();
            ClimatesOfFerngill.Conditions.SetVariableRain(false);
            Game1.populateDebrisWeatherArray();

            if (!ClimatesOfFerngill.Conditions.IsFoggy())
            {
                ClimatesOfFerngill.Conditions.GetWeatherMatchingType("Fog").First().ForceWeatherStart();
                ClimatesOfFerngill.Conditions.GetWeatherMatchingType("Fog").First().SetWeatherExpirationTime(new SDVTime(2600));
            }

            Game1.updateWeather(Game1.currentGameTime);
            Game1.currentLocation.UpdateWhenCurrentLocation(Game1.currentGameTime);
            ClimatesOfFerngill.Conditions.Refresh();
            SDVUtilities.UpdateAudio();

            Array.Resize(ref Game1.rainDrops, 70);
            ClimatesOfFerngill.Conditions.SetRainAmt(70);

            if (Game1.currentLocation is DecoratableLocation)
            {
                UpdateFurniture(Game1.currentLocation as DecoratableLocation);
            }
        }
示例#8
0
        internal static void SetWeatherTomorrow(string Result, MersenneTwister Dice, FerngillClimate GameClimate, double stormOdds, RangePair TmrwTemps)
        {
            //now parse the result.
            if (Result == "rain")
            {
                SDVUtilities.SetWeather(Game1.weather_rain);

                if (Game1.currentSeason == "winter")
                {
                    SDVUtilities.SetWeather(Game1.weather_snow);

                    if (GameClimate.AllowRainInWinter && ClimatesOfFerngill.Conditions.TomorrowHigh >= -2.5)
                    {
                        SDVUtilities.SetWeather(Game1.weather_rain);
                    }
                }

                //Moved from the *wrong function and logic gate*
                //snow applies first
                if (WeatherConditions.IsValidWeatherForSnow(TmrwTemps) && Game1.currentSeason != "spring")
                {
                    if (ClimatesOfFerngill.WeatherOpt.Verbose)
                    {
                        ClimatesOfFerngill.Logger.Log($"Snow is enabled, with the High for the day being: {TmrwTemps.HigherBound}" +
                                                      $" and the calculated midpoint temperature being {TmrwTemps.GetMidPoint()}");
                    }

                    SDVUtilities.SetWeather(Game1.weather_snow);
                }

                //apply lightning logic.
                if (Dice.NextDoublePositive() >= stormOdds && Game1.weatherForTomorrow == Game1.weather_rain)
                {
                    SDVUtilities.SetWeather(Game1.weather_lightning);
                    if (SDate.Now().Year == 1 && SDate.Now().Season == "spring" && !ClimatesOfFerngill.WeatherOpt.AllowStormsSpringYear1)
                    {
                        SDVUtilities.SetWeather(Game1.weather_rain);
                    }
                }

                //tracking time! - Snow fall on Fall 28, if the flag is set.
                if (Game1.dayOfMonth == 28 && Game1.currentSeason == "fall" && ClimatesOfFerngill.WeatherOpt.SnowOnFall28)
                {
                    ClimatesOfFerngill.Conditions.ForceTodayTemps(2, -1);
                    SDVUtilities.SetWeather(Game1.weather_snow);
                }
            }

            if (Result == "debris")
            {
                SDVUtilities.SetWeather(Game1.weather_debris);
            }

            if (Result == "sunny")
            {
                SDVUtilities.SetWeather(Game1.weather_sunny);
            }
        }
示例#9
0
        /// <summary>Raised after the game is launched, right before the first update tick. This happens once per game session (unrelated to loading saves). All mods are loaded and initialised at this point, so this is a good time to set up mod integrations.</summary>
        /// <param name="sender">The event sender.</param>
        /// <param name="e">The event arguments.</param>
        private void OnGameLaunched(object sender, GameLaunchedEventArgs e)
        {
            climatesAPI = SDVUtilities.GetModApi <Integrations.IClimatesOfFerngillAPI>(Monitor, Helper, "KoihimeNakamura.ClimatesOfFerngill", "1.4-beta.12");

            if (climatesAPI != null)
            {
                UseClimates = true;
            }
        }
        private void OnGameLaunched(object sender, StardewModdingAPI.Events.GameLaunchedEventArgs e)
        {
            ClimateAPI = SDVUtilities.GetModApi <Integrations.IClimatesOfFerngillAPI>(Monitor, Helper, "KoihimeNakamura.ClimatesOfFerngill", "1.5.0-beta.14");

            if (ClimateAPI is null)
            {
                Monitor.Log("This mod has encountered a error with the API being missing", LogLevel.Alert);
                DoNothing = true;
            }
        }
示例#11
0
        /// <summary>Raised after the game is launched, right before the first update tick. This happens once per game session (unrelated to loading saves). All mods are loaded and initialised at this point, so this is a good time to set up mod integrations.</summary>
        /// <param name="sender">The event sender.</param>
        /// <param name="e">The event arguments.</param>
        private void OnGameLaunched(object sender, GameLaunchedEventArgs e)
        {
            //testing for ZA MOON, YOUR HIGHNESS.
            MoonAPI = SDVUtilities.GetModApi <ILunarDisturbancesAPI>(Monitor, Helper, "KoihimeNakamura.LunarDisturbances", "1.0.7");

            if (MoonAPI != null)
            {
                LunarDisturbancesLoaded = true;
            }
        }
示例#12
0
 internal static void SetWeatherTesting3()
 {
     ClimatesOfFerngill.Conditions.GetWeatherMatchingType("Fog").First().SetWeatherExpirationTime(new SDVTime(Game1.timeOfDay + 10));
     Game1.windGust = -18.0f;
     ClimatesOfFerngill.WindOverrideSpeed = -24.35f;
     Game1.updateWeather(Game1.currentGameTime);
     Game1.currentLocation.UpdateWhenCurrentLocation(Game1.currentGameTime);
     ClimatesOfFerngill.Conditions.Refresh();
     SDVUtilities.UpdateAudio();
 }
示例#13
0
        /// <summary>Raised after the game is launched, right before the first update tick. This happens once per game session (unrelated to loading saves). All mods are loaded and initialised at this point, so this is a good time to set up mod integrations.</summary>
        /// <param name="sender">The event sender.</param>
        /// <param name="e">The event arguments.</param>
        private void OnGameLaunched(object sender, GameLaunchedEventArgs e)
        {
            JAAPi = SDVUtilities.GetModApi <Integrations.IJsonAssetsApi>(Monitor, Helper, "spacechase0.JsonAssets", "1.1");

            if (JAAPi != null)
            {
                UseJsonAssetsApi        = true;
                JAAPi.AddedItemsToShop += JAAPi_AddedItemsToShop;
                Monitor.Log("JsonAssets Integration enabled", LogLevel.Info);
            }
        }
示例#14
0
        /// <summary>
        /// Handles events that fire at sleep.
        /// </summary>
        /// <param name="f"></param>
        public void HandleMoonAtSleep(Farm f)
        {
            if (f == null)
            {
                return;
            }

            if (Dice.NextDoublePositive() < .20)
            {
                return;
            }

            int cropsAffected = 0;

            //moon processing
            if (CurrentPhase == MoonPhase.FullMoon)
            {
                foreach (var TF in f.terrainFeatures.Pairs)
                {
                    if (TF.Value is HoeDirt curr && curr.crop != null && Dice.NextDouble() < CropGrowthChance)
                    {
                        SDVUtilities.AdvanceArbitrarySteps(f, curr, TF.Key);
                    }
                }

                if (cropsAffected > 0)
                {
                    Game1.addHUDMessage(new HUDMessage(Translations.Get("moon-text.fullmoon_eff", new { cropsAffected })));
                }
            }

            if (CurrentPhase == MoonPhase.NewMoon && ModConfig.HazardousMoonEvents)
            {
                if (f != null)
                {
                    foreach (KeyValuePair <Vector2, TerrainFeature> TF in f.terrainFeatures.Pairs)
                    {
                        if (TF.Value is HoeDirt curr && curr.crop != null)
                        {
                            if (Dice.NextDouble() < CropNoGrowthChance)
                            {
                                cropsAffected++;
                                curr.state.Value = HoeDirt.dry;
                            }
                        }
                    }
                }

                if (cropsAffected > 0)
                {
                    Game1.addHUDMessage(new HUDMessage(Translations.Get("moon-text.newmoon_eff", new { cropsAffected })));
                }
            }
        }
示例#15
0
 public void ClearDrain(int reason = 1)
 {
     FarmerSick = false;
     if (reason == StaminaDrain.MedicineClear)
     {
         SDVUtilities.ShowMessage(Helper.Get("hud-text.desc_cold_removed"), 4);
     }
     else if (reason == StaminaDrain.BathHouseClear)
     {
         SDVUtilities.ShowMessage(Helper.Get("hud-text.desc_bathHouse"), 4);
     }
 }
示例#16
0
        /// <summary>
        /// Handles events that fire at sleep.
        /// </summary>
        /// <param name="f"></param>
        public int HandleMoonAtSleep(Farm f, IMonitor Logger)
        {
            if (f == null)
            {
                return(0);
            }

            int cropsAffected = 0;

            if (CurrentPhase == MoonPhase.FullMoon)
            {
                foreach (var TF in f.terrainFeatures.Pairs)
                {
                    if (TF.Value is HoeDirt curr && curr.crop != null && Dice.NextDouble() < ModConfig.CropGrowthChance)
                    {
                        if (ModConfig.Verbose)
                        {
                            Logger.Log($"Advancing crop at {TF.Key}", LogLevel.Trace);
                        }
                        SDVUtilities.AdvanceArbitrarySteps(f, curr, TF.Key);
                    }
                }

                return(cropsAffected);
            }

            if (CurrentPhase == MoonPhase.NewMoon && ModConfig.HazardousMoonEvents)
            {
                if (f != null)
                {
                    foreach (KeyValuePair <Vector2, TerrainFeature> TF in f.terrainFeatures.Pairs)
                    {
                        if (TF.Value is HoeDirt curr && curr.crop != null)
                        {
                            if (Dice.NextDouble() < ModConfig.CropHaltChance)
                            {
                                //SDVUtilities.DeAdvanceCrop(f, curr, TF.Key, 1);
                                curr.state.Value = 0;
                                cropsAffected++;
                                if (ModConfig.Verbose)
                                {
                                    Logger.Log($"Deadvancing crop at {TF.Key}", LogLevel.Trace);
                                }
                            }
                        }
                    }
                }


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

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

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

            string weatherStatus;

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

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

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

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

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

            TicksTotal      = 0;
            TicksOutside    = 0;
            TicksInLocation = 0;
        }
示例#18
0
        public void MakeSick()
        {
            FarmerSick        = true;
            FarmerHasBeenSick = true;
            if (IllOptions.Verbose)
            {
                Monitor.Log("Adding buff icon!!");
            }

            switch (ReasonSick)
            {
            case IllCauses.InclementWeather:
                SDVUtilities.ShowMessage(Helper.Get("hud-text.desc_inclement"), 4);
                break;

            case IllCauses.BlizzardsOutside:
                SDVUtilities.ShowMessage(Helper.Get("hud-text.desc_blizzard"), 4);
                break;

            case IllCauses.NonspecificSevereWeather:
                SDVUtilities.ShowMessage(Helper.Get("hud-text.desc_flu"), 4);
                break;

            case IllCauses.TheWampaWillGetYou:
                SDVUtilities.ShowMessage(Helper.Get("hud-text.desc_wampa"), 4);
                break;

            case IllCauses.Darude:
                SDVUtilities.ShowMessage(Helper.Get("hud-text.desc_darude"), 4);
                break;

            case IllCauses.TooColdInside:
                SDVUtilities.ShowMessage(Helper.Get("hud-text.desc_turntheheaton"), 4);
                break;

            case IllCauses.TooColdOutside:
                SDVUtilities.ShowMessage(Helper.Get("hud-text.desc_cold"), 4);
                break;

            case IllCauses.TooHotOutside:
                SDVUtilities.ShowMessage(Helper.Get("hud-text.desc_hot"), 4);
                break;

            default:
                SDVUtilities.ShowMessage(Helper.Get("hud-text.desc_sick"), 4);
                break;
            }
        }
示例#19
0
        /// <summary>
        /// This function handles the end of the day.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void OnEndOfDay(object sender, EventArgs e)
        {
            if (Conditions.HasWeather(CurrentWeather.Frost) && WeatherOpt.AllowCropDeath)
            {
                Farm f = Game1.getFarm();
                int  count = 0, maxCrops = (int)Math.Floor(SDVUtilities.CropCountInFarm(f) * WeatherOpt.DeadCropPercentage);

                foreach (KeyValuePair <Vector2, TerrainFeature> tf in f.terrainFeatures)
                {
                    if (count >= maxCrops)
                    {
                        break;
                    }

                    if (tf.Value is HoeDirt curr && curr.crop != null)
                    {
                        if (Dice.NextDouble() > WeatherOpt.CropResistance)
                        {
                            CropList.Add(tf.Key);
                            count++;
                        }
                    }
                }

                if (count > 0)
                {
                    foreach (Vector2 v in CropList)
                    {
                        HoeDirt hd = (HoeDirt)f.terrainFeatures[v];
                        hd.crop.dead = true;
                    }

                    queuedMsg = new HUDMessage(Helper.Translation.Get("hud-text.desc_frost_killed", new { deadCrops = count }), Color.SeaGreen, 5250f, true)
                    {
                        whatType = 2
                    };
                }
            }

            if (IsEclipse)
            {
                IsEclipse = false;
            }

            //moon works after frost does
            OurMoon.HandleMoonAtSleep(Game1.getFarm(), Helper.Translation);
        }
示例#20
0
        /// <summary>Raised before the game begins writes data to the save file (except the initial save creation).</summary>
        /// <param name="sender">The event sender.</param>
        /// <param name="e">The event arguments.</param>
        private void OnSaving(object sender, SavingEventArgs e)
        {
            if (!Context.IsMainPlayer)
            {
                return;
            }
            if (Conditions.HasWeather(CurrentWeather.Frost) && WeatherOpt.AllowCropDeath)
            {
                Farm f        = Game1.getFarm();
                int  count    = 0,
                     maxCrops = (int)Math.Floor(SDVUtilities.CropCountInFarm(f) * WeatherOpt.DeadCropPercentage);

                foreach (KeyValuePair <Vector2, TerrainFeature> tf in f.terrainFeatures.Pairs)
                {
                    if (count >= maxCrops)
                    {
                        break;
                    }

                    if (tf.Value is HoeDirt curr && curr.crop != null)
                    {
                        if (Dice.NextDouble() > WeatherOpt.CropResistance)
                        {
                            CropList.Add(tf.Key);
                            count++;
                        }
                    }
                }

                if (count > 0)
                {
                    foreach (Vector2 v in CropList)
                    {
                        HoeDirt hd = (HoeDirt)f.terrainFeatures[v];
                        hd.crop.dead.Value = true;
                    }

                    queuedMsg = new HUDMessage(
                        Helper.Translation.Get("hud-text.desc_frost_killed", new { deadCrops = count }),
                        Color.SeaGreen, 5250f, true)
                    {
                        whatType = 2
                    };
                }
            }
        }
示例#21
0
        internal static HUDMessage HandleOnSaving(WeatherConditions Conditions, MersenneTwister Dice)
        {
            if (Conditions.HasWeather(CurrentWeather.Frost) && ClimatesOfFerngill.WeatherOpt.AllowCropDeath)
            {
                Farm f        = Game1.getFarm();
                int  count    = 0,
                     maxCrops = (int)Math.Floor(SDVUtilities.CropCountInFarm(f) * ClimatesOfFerngill.WeatherOpt.DeadCropPercentage);

                foreach (KeyValuePair <Vector2, TerrainFeature> tf in f.terrainFeatures.Pairs)
                {
                    if (count >= maxCrops)
                    {
                        break;
                    }

                    if (tf.Value is HoeDirt curr && curr.crop != null)
                    {
                        Crop test = new Crop(curr.crop.indexOfHarvest.Value, 0, 0);

                        if (Dice.NextDouble() > ClimatesOfFerngill.WeatherOpt.CropResistance && (!test.seasonsToGrowIn.Contains("winter") || !SDVUtilities.IsWinterForageable(test.indexOfHarvest.Value)))
                        {
                            CropList.Add(tf.Key);
                            count++;
                        }
                    }
                }

                if (count > 0)
                {
                    foreach (Vector2 v in CropList)
                    {
                        HoeDirt hd = (HoeDirt)f.terrainFeatures[v];
                        hd.crop.dead.Value = true;
                    }

                    return(new HUDMessage(
                               ClimatesOfFerngill.Translator.Get("hud-text.desc_frost_killed", new { deadCrops = count }),
                               Color.SeaGreen, 5250f, true)
                    {
                        whatType = 2
                    });
                }
            }

            return(null);
        }
示例#22
0
 public void MakeSick(int reason = 0)
 {
     FarmerSick        = true;
     FarmerHasBeenSick = true;
     if (reason == FROST)
     {
         SDVUtilities.ShowMessage(Helper.Get("hud-text.desc_freeze"));
     }
     else if (reason == HEATWAVE)
     {
         SDVUtilities.ShowMessage(Helper.Get("hud-text.desc_exhaust"));
     }
     else
     {
         SDVUtilities.ShowMessage(Helper.Get("hud-text.desc_sick"));
     }
 }
示例#23
0
        internal static void SetWeatherStorm()
        {
            Game1.isSnowing   = Game1.isDebrisWeather = false;
            Game1.isLightning = Game1.isRaining = true;
            Game1.debrisWeather.Clear();
            ClimatesOfFerngill.Conditions.GetWeatherMatchingType("Blizzard").First().EndWeather();
            ClimatesOfFerngill.Conditions.GetWeatherMatchingType("Sandstorm").First().EndWeather();
            ClimatesOfFerngill.Conditions.GetWeatherMatchingType("WhiteOut").First().EndWeather();
            Game1.updateWeather(Game1.currentGameTime);
            Game1.currentLocation.UpdateWhenCurrentLocation(Game1.currentGameTime);
            ClimatesOfFerngill.Conditions.Refresh();
            SDVUtilities.UpdateAudio();

            if (Game1.currentLocation is DecoratableLocation)
            {
                UpdateFurniture(Game1.currentLocation as DecoratableLocation);
            }
        }
示例#24
0
        /// <summary>Raised after drawing the HUD (item toolbar, clock, etc) to the sprite batch, but before it's rendered to the screen. The vanilla HUD may be hidden at this point (e.g. because a menu is open).</summary>
        /// <param name="sender">The event sender.</param>
        /// <param name="e">The event arguments.</param>
        private void OnRenderedHud(object sender, RenderedHudEventArgs e)
        {
            //float shadowMult = 0f;
            if (!Context.IsWorldReady)
            {
                return;
            }

            var weatherMenu = Game1.onScreenMenus.OfType <DayTimeMoneyBox>().FirstOrDefault();

            if (weatherMenu == null)
            {
                return;
            }
            // abort abort abort (maybe another mod replaced it?)

            if (WeatherOpt.EnableCustomWeatherIcon)
            {
                //determine icon offset
                if (!Game1.eventUp)
                {
                    if ((int)Conditions.CurrentWeatherIcon != (int)WeatherIcon.IconError)
                    {
                        RWeatherIcon = new Rectangle(0 + 12 * (int)Conditions.CurrentWeatherIcon, Game1.isDarkOut() ? 8 : 0, 12, 8);
                    }

                    if ((int)Conditions.CurrentWeatherIcon == (int)WeatherIcon.IconBloodMoon)
                    {
                        RWeatherIcon = new Rectangle(144, 8, 12, 8);
                    }

                    if ((int)Conditions.CurrentWeatherIcon == (int)WeatherIcon.IconError)
                    {
                        RWeatherIcon = new Rectangle(144, 0, 12, 8);
                    }

                    Game1.spriteBatch.Draw(OurIcons.WeatherSource, weatherMenu.position + new Vector2(116f, 68f), RWeatherIcon, Color.White, 0.0f, Vector2.Zero, 4f, SpriteEffects.None, .1f);
                }

                //redraw mouse cursor
                SDVUtilities.RedrawMouseCursor();
            }
        }
示例#25
0
        internal static void SetWeatherDebris()
        {
            Game1.isSnowing = Game1.isLightning = Game1.isRaining = false;
            ClimatesOfFerngill.Conditions.GetWeatherMatchingType("Blizzard").First().EndWeather();
            ClimatesOfFerngill.Conditions.GetWeatherMatchingType("Fog").First().EndWeather();
            ClimatesOfFerngill.Conditions.GetWeatherMatchingType("WhiteOut").First().EndWeather();
            ClimatesOfFerngill.Conditions.GetWeatherMatchingType("ThunderFrenzy").First().EndWeather();
            Game1.isDebrisWeather = true;
            Game1.populateDebrisWeatherArray();
            Game1.updateWeather(Game1.currentGameTime);
            Game1.currentLocation.UpdateWhenCurrentLocation(Game1.currentGameTime);
            ClimatesOfFerngill.Conditions.Refresh();
            SDVUtilities.UpdateAudio();

            if (Game1.currentLocation is DecoratableLocation)
            {
                UpdateFurniture(Game1.currentLocation as DecoratableLocation);
            }
        }
示例#26
0
        /// <summary>Raised after the game is launched, right before the first update tick. This happens once per game session (unrelated to loading saves). All mods are loaded and initialised at this point, so this is a good time to set up mod integrations.</summary>
        /// <param name="sender">The event sender.</param>
        /// <param name="e">The event arguments.</param>
        private void OnGameLaunched(object sender, GameLaunchedEventArgs e)
        {
            JAAPi = SDVUtilities.GetModApi <Integrations.IJsonAssetsApi>(Monitor, Helper, "spacechase0.JsonAssets", "1.1");

            if (JAAPi != null)
            {
                UseJsonAssetsApi        = true;
                JAAPi.AddedItemsToShop += JAAPi_AddedItemsToShop;
            }

            var api = Helper.ModRegistry.GetApi <Integrations.IGenericModConfigMenuAPI>("spacechase0.GenericModConfigMenu");

            if (api != null)
            {
                api.RegisterModConfig(ModManifest, () => ModConfig = new MoonConfig(), () => Helper.WriteConfig(ModConfig));
                api.RegisterClampedOption(ModManifest, "Blood Moon Chances", "The chance for a blood moon rising. There's a bad moon on the rise.", () => (float)ModConfig.BadMoonRising, (float val) => ModConfig.BadMoonRising = val, 0f, 1f);
                api.RegisterSimpleOption(ModManifest, "Allow Eclipse", "This option controls if eclipses will happen", () => ModConfig.EclipseOn, (bool val) => ModConfig.EclipseOn = val);
                api.RegisterSimpleOption(ModManifest, "Show Moon Phase", "Show the moon phase popups on moon rise and set", () => ModConfig.ShowMoonPhase, (bool val) => ModConfig.ShowMoonPhase = val);
                api.RegisterSimpleOption(ModManifest, "Spawn Monsters", "This option controls if monsters spawn during eclipses on a wilderness farm. NOTE: They don't spawn if you've turned off monster spawns in game.", () => ModConfig.SpawnMonsters, (bool val) => ModConfig.SpawnMonsters = val);
                api.RegisterSimpleOption(ModManifest, "Hazardous Moon Events", "This controls the moon events that can hinder the player, or spawn monsters. No monsters will spawn ( the blood moon won't even happen) while this is false. This also stops the crop de advancement on the new moon.", () => ModConfig.HazardousMoonEvents, (bool val) => ModConfig.HazardousMoonEvents = val);
                api.RegisterSimpleOption(ModManifest, "Verbose Logging", "This controls if the mod is verbose when logging for debug purposes", () => ModConfig.Verbose, (bool val) => ModConfig.Verbose    = val);
                api.RegisterSimpleOption(ModManifest, "Use More Monthly Cycle", "When true, the mod uses a 25-day cycle.", () => ModConfig.UseMoreMonthlyCycle, (bool val) => ModConfig.UseMoreMonthlyCycle = val);
                api.RegisterClampedOption(ModManifest, "Eclipse Chance", "The chance for an eclipse", () => (float)ModConfig.EclipseChance, (float val) => ModConfig.EclipseChance             = val, 0f, 1f);
                api.RegisterClampedOption(ModManifest, "Super Moon Chances", "The chance for a super moon", () => (float)ModConfig.SuperMoonChances, (float val) => ModConfig.SuperMoonChances = val, 0f, 1f);
                api.RegisterClampedOption(ModManifest, "Harvest Moon Double Grow Chance", "The chance for a crop double growth on a harvest moon", () => (float)ModConfig.HarvestMoonDoubleGrowChance, (float val) => ModConfig.HarvestMoonDoubleGrowChance = val, 0f, 1f);
                api.RegisterClampedOption(ModManifest, "Crop Growth Chance", "The chance for crops to grow on a full moon", () => (float)ModConfig.CropGrowthChance, (float val) => ModConfig.CropGrowthChance = val, 0f, 1f);
                api.RegisterClampedOption(ModManifest, "Crop Halt Chance", "The chance for crops to not grow on a new moon", () => (float)ModConfig.CropHaltChance, (float val) => ModConfig.CropHaltChance    = val, 0f, 1f);
                api.RegisterClampedOption(ModManifest, "Beach Removal Chance", "The chance for items on the beach to be removed on a new moon", () => (float)ModConfig.BeachRemovalChance, (float val) => ModConfig.BeachRemovalChance = val, 0f, 1f);
                api.RegisterClampedOption(ModManifest, "Beach Spawn Chance", "The chance for items on the beach to be spawned on a full moon", () => (float)ModConfig.BeachSpawnChance, (float val) => ModConfig.BeachSpawnChance      = val, 0f, 1f);
                api.RegisterClampedOption(ModManifest, "Ghost Spawn Chance", "The chance for ghosts to spawn on a full moon", () => (float)ModConfig.GhostSpawnChance, (float val) => ModConfig.GhostSpawnChance = val, 0f, 1f);
            }

            var cpAPI = this.Helper.ModRegistry.GetApi <IContentPatcherAPI>("Pathoschild.ContentPatcher");

            if (cpAPI != null)
            {
                cpAPI.RegisterToken(this.ModManifest, "MoonPhase", () => new[] { OurMoon.SimpleMoonPhase() });
                cpAPI.RegisterToken(this.ModManifest, "MoonRise", () => new[] { OurMoon.GetMoonRiseTime().ToString() });
                cpAPI.RegisterToken(this.ModManifest, "MoonSet", () => new[] { OurMoon.GetMoonSetTime().ToString() });
                cpAPI.RegisterToken(this.ModManifest, name: "IsEclipse", () => new[] { OurMoon.IsEclipse.ToString() });
            }
        }
示例#27
0
        /// <summary>Raised once per second after the game state is updated.</summary>
        /// <param name="sender">The event sender.</param>
        /// <param name="e">The event arguments.</param>
        private void OnOneSecondUpdateTicked(object sender, OneSecondUpdateTickedEventArgs e)
        {
            if (Context.IsPlayerFree)
            {
                if (Game1.game1.IsActive)
                {
                    SecondCount++;
                }

                if (SecondCount == 10)
                {
                    SecondCount = 0;
                    if (Game1.currentLocation.IsOutdoors && OurMoon.CurrentPhase == MoonPhase.BloodMoon)
                    {
                        Monitor.Log("Spawning monster....");
                        SDVUtilities.SpawnMonster(Game1.currentLocation);
                    }
                }
            }
        }
示例#28
0
        public void ClearFog()
        {
            FogDebuffValid = false;
            if (Game1.buffsDisplay.otherBuffs.Any())
            {
                int buffId = UniqueStaID + FogBuffID;
                int i      = Game1.buffsDisplay.otherBuffs.FindIndex(p => p.which == buffId);
                //of course a not found is a negative index.
                if (i > 0)
                {
                    Game1.buffsDisplay.otherBuffs.RemoveAt(i);
                }
            }

            if (IllOptions.Verbose)
            {
                Monitor.Log("Removing buff icon!!");
            }

            SDVUtilities.ShowMessage("The evil is defeated!", 4);
        }
示例#29
0
        /// <summary>Raised after the game is launched, right before the first update tick. This happens once per game session (unrelated to loading saves). All mods are loaded and initialised at this point, so this is a good time to set up mod integrations.</summary>
        /// <param name="sender">The event sender.</param>
        /// <param name="e">The event arguments.</param>
        private void OnGameLaunched(object sender, GameLaunchedEventArgs e)
        {
            //testing for ZA MOON, YOUR HIGHNESS.
            MoonAPI          = SDVUtilities.GetModApi <Integrations.ILunarDisturbancesAPI>(Monitor, Helper, "KoihimeNakamura.LunarDisturbances", "1.0");
            SafeLightningAPI = SDVUtilities.GetModApi <Integrations.ISafeLightningAPI>(Monitor, Helper, "cat.safelightning", "1.0");
            DynamicNightAPI  = SDVUtilities.GetModApi <Integrations.IDynamicNightAPI>(Monitor, Helper, "knakamura.dynamicnighttime", "1.1-rc3");

            if (MoonAPI != null)
            {
                UseLunarDisturbancesApi = true;
            }

            if (SafeLightningAPI != null)
            {
                UseSafeLightningApi = true;
            }

            if (DynamicNightAPI != null)
            {
                UseDynamicNightApi = true;
            }
        }
示例#30
0
        /// <summary>Raised after the game is launched, right before the first update tick. This happens once per game session (unrelated to loading saves). All mods are loaded and initialised at this point, so this is a good time to set up mod integrations.</summary>
        /// <param name="sender">The event sender.</param>
        /// <param name="e">The event arguments.</param>
        private void OnGameLaunched(object sender, GameLaunchedEventArgs e)
        {
            climatesAPI = SDVUtilities.GetModApi <Integrations.IClimatesOfFerngillAPI>(Monitor, Helper, "KoihimeNakamura.ClimatesOfFerngill", "1.5.12", "Climates of Ferngill");

            if (climatesAPI != null)
            {
                UseClimates = true;
            }

            var api = Helper.ModRegistry.GetApi <Integrations.GenericModConfigMenuAPI>("spacechase0.GenericModConfigMenu");

            if (api != null)
            {
                api.RegisterModConfig(ModManifest, () => IllnessConfig = new IllnessConfig(), () => Helper.WriteConfig(IllnessConfig));
                api.RegisterClampedOption(ModManifest, "Stamina Drain", "The drain per 10 minute tick. I wouldn't recommend a too high value.", () => IllnessConfig.StaminaDrain, (int val) => IllnessConfig.StaminaDrain         = val, 0, 65);
                api.RegisterSimpleOption(ModManifest, "Sick More Than Once", "This option controls if you can get sick more than once a day.", () => IllnessConfig.SickMoreThanOnce, (bool val) => IllnessConfig.SickMoreThanOnce = val);
                api.RegisterSimpleOption(ModManifest, "Verbose", "This option controls verbosity in logs.", () => IllnessConfig.Verbose, (bool val) => IllnessConfig.Verbose = val);
                api.RegisterClampedOption(ModManifest, "Chance of Getting Sick", "The chance of getting sick every 10 minute tick.", () => (float)IllnessConfig.ChanceOfGettingSick, (float val) => IllnessConfig.ChanceOfGettingSick = val, 0f, 1f);
                api.RegisterClampedOption(ModManifest, "Percentage Outside", "How long you have to be outside every 10 minutes to be affected by the weather", () => (float)IllnessConfig.PercentageOutside, (float val) => IllnessConfig.PercentageOutside = val, 0f, 1f);
                api.RegisterClampedOption(ModManifest, "Too Cold Inside", "Under this temperature, you will get sick if you don't have the heat on in your house.", () => (float)IllnessConfig.TooColdInside, (float val) => IllnessConfig.TooColdInside    = val, -15f, 10f);
            }
        }