示例#1
0
 public void TimeEvents_DayOfMonthChanged(object sender, StardewModdingAPI.Events.EventArgsIntChanged e)
 {
     if (StardewValley.Game1.dayOfMonth == 27 && Game1.IsFall == true)
     {
         Log.Success("Weather checker now!!!");
         Game1.weatherForTomorrow = Game1.weather_snow;
     }
 }
示例#2
0
 private void OpenAnimalDoors(object sender, StardewModdingAPI.Events.EventArgsIntChanged timeOfDayChanged)
 {
     if (timeOfDayChanged.NewInt >= config.AnimalDoorOpenTime && timeOfDayChanged.NewInt < config.AnimalDoorCloseTime)
     {
         StardewModdingAPI.Events.TimeEvents.TimeOfDayChanged -= this.OpenAnimalDoors;
         SetAllAnimalDoorsState(Buildings.AnimalDoorState.OPEN);
     }
 }
示例#3
0
 public void TimeEvents_DayOfMonthChanged(object sender, StardewModdingAPI.Events.EventArgsIntChanged e)
 {
     if (gameloaded == false)
     {
         return;
     }
     New_day_Update();
 }
示例#4
0
 public void TimeEvents_DayOfMonthChanged(object sender, StardewModdingAPI.Events.EventArgsIntChanged e)
 {
     if (game_loaded == true)
     {
         file_clean_up();
         game_time = 600;                           //resets the game time so that simulation doesn't happen every day.
         game_updated_and_loaded            = true; //prevents the next day from being updated
         StardewValley.Game1.player.canMove = true; //do I even use this?
     }
 }
示例#5
0
 public void TimeEvents_DayOfMonthChanged(object sender, StardewModdingAPI.Events.EventArgsIntChanged e)
 {
     if (isplayersbirthday() == true)
     {
     }
     if (Game1.player == null)
     {
         return;
     }
     if (has_input_birthday == true)
     {
         MyWritter_Birthday();
     }
     MyWritter_Settings();
     once = false;
 }
示例#6
0
        private void TimeEvents_DayOfMonthChanged(object sender, StardewModdingAPI.Events.EventArgsIntChanged e)
        {
            if (Game1.player == null)
            {
                return;
            }

            if ((Game1.player.currentLocation is FarmHouse))
            {
                File.Delete(Path.Combine(playerDataPath, fileName));
            }

            if (sleepingWarp == true)
            {
                loadConfigForWarp();
                sleepingWarp = false;
            }
        }
示例#7
0
        public void Day_Update(object sender, StardewModdingAPI.Events.EventArgsIntChanged e)
        {
            // foreach (var bleh in npc_name_list) npc_name_list.Remove(bleh);
            foreach (var location in Game1.locations)
            {
                foreach (NPC npc in location.characters)
                {
                    if (npc is StardewValley.Characters.Cat || npc is StardewValley.Characters.Child || npc is StardewValley.Characters.Dog || npc is StardewValley.Characters.Horse || npc is StardewValley.Characters.Junimo || npc is StardewValley.Characters.Pet)
                    {
                        return;
                    }
                    if (npc is StardewValley.Monsters.Bat || npc is StardewValley.Monsters.BigSlime || npc is StardewValley.Monsters.Bug || npc is StardewValley.Monsters.Cat || npc is StardewValley.Monsters.Crow || npc is StardewValley.Monsters.Duggy || npc is StardewValley.Monsters.DustSpirit || npc is StardewValley.Monsters.Fireball || npc is StardewValley.Monsters.Fly || npc is StardewValley.Monsters.Ghost || npc is StardewValley.Monsters.GoblinPeasant || npc is StardewValley.Monsters.GoblinWizard || npc is StardewValley.Monsters.GreenSlime || npc is StardewValley.Monsters.Grub || npc is StardewValley.Monsters.LavaCrab || npc is StardewValley.Monsters.MetalHead || npc is StardewValley.Monsters.Monster || npc is StardewValley.Monsters.Mummy || npc is StardewValley.Monsters.RockCrab || npc is StardewValley.Monsters.RockGolem || npc is StardewValley.Monsters.Serpent || npc is StardewValley.Monsters.ShadowBrute || npc is StardewValley.Monsters.ShadowGirl || npc is StardewValley.Monsters.ShadowGuy || npc is StardewValley.Monsters.ShadowShaman || npc is StardewValley.Monsters.Skeleton || npc is StardewValley.Monsters.SkeletonMage || npc is StardewValley.Monsters.SkeletonWarrior || npc is StardewValley.Monsters.Spiker || npc is StardewValley.Monsters.SquidKid)
                    {
                        return;
                    }
                    if (npc_name_list.Contains(npc.name))
                    {
                        continue;
                    }
                    npc_name_list.Add(npc.name);
                    //Log.AsyncM(npc.name);
                }
            }
            if (isplayersbirthday() == true)
            {
                // Game1.mailbox.Enqueue("\n        Dear @,^  Happy birthday sweetheart. It's been amazing watching you grow into the kind, hard working person that I've always dreamed that you would become. I hope you continue to make many more fond memories with the ones you love. ^  Love, Mom ^ P.S. Here's a little something that I made for you. %item object 221 1 %");
                // Game1.mailbox.Enqueue("\n        Dear @,^  Happy birthday kiddo. It's been a little quiet around here on your birthday since you aren't around, but your mother and I know that you are making both your grandpa and us proud.  We both know that living on your own can be tough but we believe in you one hundred percent, just keep following your dreams.^  Love, Dad ^ P.S. Here's some spending money to help you out on the farm. Good luck! %item money 5000 5001 %");
            }

            if (Game1.player == null)
            {
                return;
            }
            if (has_input_birthday == true)
            {
                MyWritter_Birthday();
            }
            MyWritter_Settings();
            once = false;
        }
示例#8
0
 private void CloseAnimalDoors(object sender, StardewModdingAPI.Events.EventArgsIntChanged timeOfDayChanged)
 {
     if (timeOfDayChanged.NewInt >= config.AnimalDoorCloseTime)
     {
         bool allAnimalsInAllFarmsAreHome = true;
         foreach (Farm farm in Game.Instance.Farms)
         {
             if (farm.AreAllAnimalsHome())
             {
                 farm.SetAnimalDoorsState(Buildings.AnimalDoorState.CLOSED);
             }
             else
             {
                 allAnimalsInAllFarmsAreHome = false;
             }
         }
         if (allAnimalsInAllFarmsAreHome)
         {
             StardewModdingAPI.Events.TimeEvents.TimeOfDayChanged -= this.CloseAnimalDoors;
         }
     }
 }
示例#9
0
        public void TimeEvents_TimeOfDayChanged(object sender, StardewModdingAPI.Events.EventArgsIntChanged e)
        {
            /*
             * Implement try catch system here.
             *
             */
            try {
                if (game_loaded == false)
                {
                    return;
                }
                float color_mod;
                //transition the lighting for more "realistic" lighting from 2am to 11am. There is an awkward screen shuffle that happens because of this update.

                if (lighting_transition == true)
                {
                    if (Game1.timeOfDay > 400 && Game1.timeOfDay < 600)
                    {
                        color_mod          = (1300 - Game1.timeOfDay) / 1000f; //.7f
                        Game1.outdoorLight = Game1.ambientLight * color_mod;
                    }
                }


                if (stay_up == true)
                {
                    if (Game1.timeOfDay == 2550)
                    {
                        if (StardewValley.Game1.isRaining == true)
                        {
                            was_raining = true;
                            StardewValley.Game1.isRaining = false; //regardless make sure I change the weather. Otherwise lighting gets screwy.
                        }
                        StardewValley.Game1.updateWeatherIcon();
                        Game1.timeOfDay = 150; //change it from 1:50 am late, to 1:50 am early
                    }
                }


                if (Game1.timeOfDay == 550) //if the game time is 5:50 AM
                {
                    up_late = true;
                }

                if (Game1.timeOfDay == 600) //when time is 6:00 AM after staying up
                {
                    if (up_late == false)
                    {
                        return;
                    }


                    if (super_map_warping_check == true)
                    {
                        if (Game1.currentMinigame != null)
                        {
                            Game1.currentMinigame = null;
                        }
                        //if (time_reset == false)  return;
                        time_reset = true;
                        player_x   = Game1.player.getTileX();
                        player_y   = Game1.player.getTileY();
                        prior_map  = Game1.player.currentLocation.name;

                        Monitor.Log(prior_map);
                        Monitor.Log(player_x.ToString());
                        Monitor.Log(player_y.ToString());
                        super_map_warping_check = false;


                        Game1.farmerShouldPassOut = true; //make the farmer collapse.

                        pre_stam    = Game1.player.stamina;
                        pre_health  = Game1.player.health;
                        prior_money = Game1.player.money;

                        if (Game1.player.money <= 10000)
                        {
                            post_money = prior_money / 10;
                        }
                        else
                        {
                            post_money = 1000;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                try
                {
                    Newtonsoft.Json.JsonSerializer serializer = new Newtonsoft.Json.JsonSerializer();
                    serializer.NullValueHandling     = Newtonsoft.Json.NullValueHandling.Ignore;
                    serializer.TypeNameHandling      = Newtonsoft.Json.TypeNameHandling.All;
                    serializer.Formatting            = Newtonsoft.Json.Formatting.Indented;
                    serializer.ReferenceLoopHandling = ReferenceLoopHandling.Ignore;
                    using (StreamWriter sw = new StreamWriter(Path.Combine(Error_Path, "Mod_State.json")))
                    {
                        using (Newtonsoft.Json.JsonWriter writer2 = new Newtonsoft.Json.JsonTextWriter(sw))
                        {
                            serializer.Serialize(writer2, this);
                        }
                    }
                }
                catch (Exception exc)
                {
                    Monitor.Log(exc.ToString());
                }
            }
        }
示例#10
0
        public void TimeEvents_DayOfMonthChanged(object sender, StardewModdingAPI.Events.EventArgsIntChanged e)
        {
            /*
             * IMPLEMENT TRY CATCH SYSTEM HERE
             *
             */
            try {
                if (game_loaded == false)
                {
                    return;
                }
                if (first_check == false)
                {
                    first_check = true;
                    Monitor.Log("first");
                    return;
                }
                else
                {
                    first_check = false;
                    Monitor.Log("Second");
                }
                if (Game1.farmerShouldPassOut == true)
                {
                    Game1.farmerShouldPassOut = false;                             //make the farmer collapse.
                }
                reset_check = false;
                //Game1.farmerShouldPassOut = false; //make the farmer collapse.
                DataLoader();
                MyWritter();
                //List<string> newmail = new List<string>();
                Queue <string> newmail = new Queue <string>();

                up_late = false;

                if (time_reset == true)
                {
                    was_raining = false;
                    if (persistant_stamina == true)
                    {
                        Game1.player.stamina = pre_stam;                       //reset health and stam upon collapsing
                    }
                    if (persistant_health == true)
                    {
                        Game1.player.health = pre_health;
                    }
                    //post_money = Game1.player.money;
                    if (protect_money == true)
                    {
                        Game1.player.money += post_money;
                        once = true;
                    } //add the money back from colapsing.
                    time_reset = false; //reset my bool.
                    if (warp == true)
                    {
                        Game1.warpFarmer(prior_map, player_x, player_y, false);
                    }
                    // very_old_money = (safety_cash - Game1.player.money);
                    //Game1.player.money += very_old_money;
                }

                if (wipe_mail == true)
                {
                    foreach (var i in Game1.mailbox) //delete those annoying charge messages. If only I could do this with mail IRL.
                    {
                        Monitor.Log(i);

                        if (i.Contains("passedOut"))
                        {
                            Monitor.Log("Found bad mail");
                        }
                        else
                        {
                            newmail.Enqueue(i);
                        }
                    }
                    Game1.mailbox.Clear();
                    foreach (string mail in newmail)
                    {
                        Game1.mailbox.Enqueue(mail);
                    }
                }
                warped_check = false;
                //prior_map==null; //prevents multiple warping when sleeping
            }
            catch (Exception ex)
            {
                try
                {
                    Newtonsoft.Json.JsonSerializer serializer = new Newtonsoft.Json.JsonSerializer();
                    serializer.NullValueHandling     = Newtonsoft.Json.NullValueHandling.Ignore;
                    serializer.TypeNameHandling      = Newtonsoft.Json.TypeNameHandling.All;
                    serializer.Formatting            = Newtonsoft.Json.Formatting.Indented;
                    serializer.ReferenceLoopHandling = ReferenceLoopHandling.Ignore;
                    using (StreamWriter sw = new StreamWriter(Path.Combine(Error_Path, "Mod_State.json")))
                    {
                        using (Newtonsoft.Json.JsonWriter writer2 = new Newtonsoft.Json.JsonTextWriter(sw))
                        {
                            serializer.Serialize(writer2, this);
                        }
                    }
                }
                catch (Exception exc)
                {
                    Monitor.Log(exc.ToString());
                }
            }
        }
示例#11
0
 public void Day_Update(object sender, StardewModdingAPI.Events.EventArgsIntChanged e)
 {
     //  Log.AsyncC("is this running?");
     // foreach (var bleh in npc_name_list) npc_name_list.Remove(bleh);
 }
示例#12
0
        public void TimeEvents_TimeOfDayChanged(object sender, StardewModdingAPI.Events.EventArgsIntChanged e)
        {
            if (game_loaded == false)
            {
                return;
            }
            float color_mod;

            //transition the lighting for more "realistic" lighting from 2am to 11am. There is an awkward screen shuffle that happens because of this update.

            if (lighting_transition == true)
            {
                if (Game1.timeOfDay > 200 && Game1.timeOfDay < 1100)
                {
                    color_mod          = (1100 - Game1.timeOfDay) / 1000f; //.7f
                    Game1.outdoorLight = Game1.ambientLight * color_mod;
                }
            }


            if (stay_up == true)
            {
                if (Game1.timeOfDay == 2550)
                {
                    if (StardewValley.Game1.isRaining == true)
                    {
                        was_raining = true;
                        StardewValley.Game1.isRaining = false; //regardless make sure I change the weather. Otherwise lighting gets screwy.
                    }
                    StardewValley.Game1.updateWeatherIcon();
                    Game1.timeOfDay = 150; //change it from 1:50 am late, to 1:50 am early
                }
            }


            if (Game1.timeOfDay == 550) //if the game time is 5:50 AM
            {
                up_late = true;
            }

            if (Game1.timeOfDay == 600) //when time is 6:00 AM after staying up
            {
                if (up_late == false)
                {
                    return;
                }


                if (super_map_warping_check == true)
                {
                    if (Game1.currentMinigame != null)
                    {
                        Game1.currentMinigame = null;
                    }
                    //if (time_reset == false)  return;
                    time_reset = true;
                    player_x   = Game1.player.getTileX();
                    player_y   = Game1.player.getTileY();
                    prior_map  = Game1.player.currentLocation.name;

                    Log.Info(prior_map);
                    Log.Info(player_x);
                    Log.Info(player_y);
                    super_map_warping_check = false;


                    Game1.farmerShouldPassOut = true; //make the farmer collapse.

                    pre_stam    = Game1.player.stamina;
                    pre_health  = Game1.player.health;
                    prior_money = Game1.player.money;

                    if (Game1.player.money <= 10000)
                    {
                        post_money = prior_money / 10;
                    }
                    else
                    {
                        post_money = 1000;
                    }
                }
            }
        }