Exemple #1
0
 public override void OnGame1_PerformTenMinuteClockUpdate(Action action)
 {
     alias.OnGame1_PerformTenMinuteClockUpdate(action);
 }
        public static bool performTenMinuteClockUpdate(ref ModHooks ___hooks)
        {
            ___hooks.OnGame1_PerformTenMinuteClockUpdate(() =>
            {
                int trulyDarkTime      = Game1.getTrulyDarkTime();
                Game1.gameTimeInterval = 0;

                if (Game1.IsMasterGame)
                {
                    Game1.timeOfDay++;
                }
                if (Game1.timeOfDay % 10 != 0)
                {
                    if (Game1.IsMasterGame && Game1.farmEvent == null)
                    {
                        Game1.netWorldState.Value.UpdateFromGame1();
                    }
                    return;
                }
                if (Game1.timeOfDay % 100 >= 60)
                {
                    Game1.timeOfDay = Game1.timeOfDay - Game1.timeOfDay % 100 + 100;
                }
                Game1.timeOfDay = Math.Min(Game1.timeOfDay, 2600);
                if (Game1.isLightning && Game1.timeOfDay < 2400 && Game1.IsMasterGame)
                {
                    Utility.performLightningUpdate(Game1.timeOfDay);
                }

                if (Game1.timeOfDay == trulyDarkTime)
                {
                    Game1.currentLocation.switchOutNightTiles();
                }
                else if (Game1.timeOfDay == Game1.getModeratelyDarkTime())
                {
                    if (Game1.currentLocation.IsOutdoors && !Game1.IsRainingHere())
                    {
                        Game1.ambientLight = Color.White;
                    }
                    if (!Game1.IsRainingHere() && !(Game1.currentLocation is MineShaft) && Game1.currentSong != null && !Game1.currentSong.Name.Contains("ambient") && Game1.currentLocation is Town)
                    {
                        Game1.changeMusicTrack("none", false, Game1.MusicContext.Default);
                    }
                }

                if (Game1.getMusicTrackName(Game1.MusicContext.Default).StartsWith(Game1.currentSeason) && !Game1.getMusicTrackName(Game1.MusicContext.Default).Contains("ambient") && !Game1.eventUp && Game1.isDarkOut())
                {
                    Game1.changeMusicTrack("none", true, Game1.MusicContext.Default);
                }
                if (Game1.currentLocation.IsOutdoors && !Game1.IsRainingHere() && !Game1.eventUp && Game1.getMusicTrackName(Game1.MusicContext.Default).Contains("day") && Game1.isDarkOut())
                {
                    Game1.changeMusicTrack("none", true, Game1.MusicContext.Default);
                }
                if (Game1.weatherIcon == 1)
                {
                    int num = Convert.ToInt32(Game1.temporaryContent.Load <Dictionary <string, string> >("Data\\Festivals\\" + Game1.currentSeason + Game1.dayOfMonth)["conditions"].Split('/')[1].Split(' ')[0]);
                    if (Game1.whereIsTodaysFest == null)
                    {
                        Game1.whereIsTodaysFest = Game1.temporaryContent.Load <Dictionary <string, string> >("Data\\Festivals\\" + Game1.currentSeason + Game1.dayOfMonth)["conditions"].Split('/')[0];
                    }
                    if (Game1.timeOfDay == num)
                    {
                        Dictionary <string, string> dictionary = Game1.temporaryContent.Load <Dictionary <string, string> >("Data\\Festivals\\" + Game1.currentSeason + Game1.dayOfMonth);
                        string text = dictionary["conditions"].Split('/')[0];
                        if (dictionary.ContainsKey("locationDisplayName"))
                        {
                            text = dictionary["locationDisplayName"];
                        }
                        else
                        {
                            switch (text)
                            {
                            case "Forest":
                                text = (Game1.currentSeason.Equals("winter") ? Game1.content.LoadString("Strings\\StringsFromCSFiles:Game1.cs.2634") : Game1.content.LoadString("Strings\\StringsFromCSFiles:Game1.cs.2635"));
                                break;

                            case "Town":
                                text = Game1.content.LoadString("Strings\\StringsFromCSFiles:Game1.cs.2637");
                                break;

                            case "Beach":
                                text = Game1.content.LoadString("Strings\\StringsFromCSFiles:Game1.cs.2639");
                                break;
                            }
                        }

                        Game1.showGlobalMessage(Game1.content.LoadString("Strings\\StringsFromCSFiles:Game1.cs.2640", Game1.temporaryContent.Load <Dictionary <string, string> >("Data\\Festivals\\" + Game1.currentSeason + Game1.dayOfMonth)["name"]) + text);
                    }
                }
                Game1.player.performTenMinuteUpdate();
                switch (Game1.timeOfDay)
                {
                case 1200:
                    if ((bool)Game1.currentLocation.isOutdoors && !Game1.IsRainingHere() && (Game1.currentSong == null || Game1.currentSong.IsStopped || Game1.currentSong.Name.ToLower().Contains("ambient")))
                    {
                        Game1.playMorningSong();
                    }

                    break;

                case 2000:
                    if (!Game1.IsRainingHere() && Game1.currentLocation is Town)
                    {
                        Game1.changeMusicTrack("none");
                    }

                    break;

                case 2400:
                    Game1.dayTimeMoneyBox.timeShakeTimer = 2000;
                    Game1.player.doEmote(24);
                    Game1.showGlobalMessage(Game1.content.LoadString("Strings\\StringsFromCSFiles:Game1.cs.2652"));
                    break;

                case 2500:
                    Game1.dayTimeMoneyBox.timeShakeTimer = 2000;
                    Game1.player.doEmote(24);
                    break;

                case 2600:
                    Game1.dayTimeMoneyBox.timeShakeTimer = 2000;
                    if (Game1.player.mount != null)
                    {
                        Game1.player.mount.dismount();
                    }

                    if (Game1.player.IsSitting())
                    {
                        Game1.player.StopSitting(animate: false);
                    }

                    if (Game1.player.UsingTool)
                    {
                        if (Game1.player.CurrentTool != null)
                        {
                            FishingRod fishingRod = Game1.player.CurrentTool as FishingRod;
                            if (fishingRod != null && (fishingRod.isReeling || fishingRod.pullingOutOfWater))
                            {
                                break;
                            }
                        }

                        Game1.player.completelyStopAnimatingOrDoingAction();
                    }

                    break;

                case 2800:
                    if (Game1.activeClickableMenu != null)
                    {
                        Game1.activeClickableMenu.emergencyShutDown();
                        Game1.exitActiveMenu();
                    }

                    Game1.player.startToPassOut();
                    if (Game1.player.mount != null)
                    {
                        Game1.player.mount.dismount();
                    }

                    break;
                }

                foreach (GameLocation location in Game1.locations)
                {
                    GameLocation gameLocation = location;
                    if (gameLocation.NameOrUniqueName == Game1.currentLocation.NameOrUniqueName)
                    {
                        gameLocation = Game1.currentLocation;
                    }

                    gameLocation.performTenMinuteUpdate(Game1.timeOfDay);
                    if (gameLocation is Farm)
                    {
                        ((Farm)gameLocation).timeUpdate(10);
                    }
                }

                MineShaft.UpdateMines10Minutes(Game1.timeOfDay);
                VolcanoDungeon.UpdateLevels10Minutes(Game1.timeOfDay);
                if (Game1.IsMasterGame && Game1.farmEvent == null)
                {
                    Game1.netWorldState.Value.UpdateFromGame1();
                }
            });
            return(false);
        }
Exemple #3
0
        public static bool performTenMinuteClockUpdate(ref ModHooks ___hooks)
        {
            ___hooks.OnGame1_PerformTenMinuteClockUpdate(() =>
            {
                int trulyDarkTime      = Game1.getTrulyDarkTime();
                Game1.gameTimeInterval = 0;

                if (Game1.IsMasterGame)
                {
                    Game1.timeOfDay++;
                }
                if (Game1.timeOfDay % 10 != 0)
                {
                    return;
                }
                if (Game1.timeOfDay % 100 >= 60)
                {
                    Game1.timeOfDay = Game1.timeOfDay - Game1.timeOfDay % 100 + 100;
                }
                Game1.timeOfDay = Math.Min(Game1.timeOfDay, 2600);
                if (Game1.isLightning && Game1.timeOfDay < 2400 && Game1.IsMasterGame)
                {
                    Utility.performLightningUpdate();
                }
                if (Game1.timeOfDay == trulyDarkTime)
                {
                    Game1.currentLocation.switchOutNightTiles();
                }
                else if (Game1.timeOfDay == Game1.getModeratelyDarkTime())
                {
                    if (Game1.currentLocation.IsOutdoors && !Game1.isRaining)
                    {
                        Game1.ambientLight = Color.White;
                    }
                    if (!Game1.isRaining && !(Game1.currentLocation is MineShaft) && Game1.currentSong != null && !Game1.currentSong.Name.Contains("ambient") && Game1.currentLocation is Town)
                    {
                        Game1.changeMusicTrack("none", false, Game1.MusicContext.Default);
                    }
                }
                if (Game1.getMusicTrackName(Game1.MusicContext.Default).StartsWith(Game1.currentSeason) && !Game1.getMusicTrackName(Game1.MusicContext.Default).Contains("ambient") && !Game1.eventUp && Game1.isDarkOut())
                {
                    Game1.changeMusicTrack("none", true, Game1.MusicContext.Default);
                }
                if (Game1.currentLocation.isOutdoors && !Game1.isRaining && !Game1.eventUp && Game1.getMusicTrackName(Game1.MusicContext.Default).Contains("day") && Game1.isDarkOut())
                {
                    Game1.changeMusicTrack("none", true, Game1.MusicContext.Default);
                }
                if (Game1.weatherIcon == 1)
                {
                    int num = Convert.ToInt32(Game1.temporaryContent.Load <Dictionary <string, string> >(string.Concat(string.Concat("Data\\Festivals\\", Game1.currentSeason), Game1.dayOfMonth))["conditions"].Split(new char[] { '/' })[1].Split(new char[] { ' ' })[0]);
                    if (Game1.whereIsTodaysFest == null)
                    {
                        Game1.whereIsTodaysFest = Game1.temporaryContent.Load <Dictionary <string, string> >(string.Concat(string.Concat("Data\\Festivals\\", Game1.currentSeason), Game1.dayOfMonth))["conditions"].Split(new char[] { '/' })[0];
                    }
                    if (Game1.timeOfDay == num)
                    {
                        string str = Game1.temporaryContent.Load <Dictionary <string, string> >(string.Concat(string.Concat("Data\\Festivals\\", Game1.currentSeason), Game1.dayOfMonth))["conditions"].Split(new char[] { '/' })[0];
                        if (str == "Forest")
                        {
                            str = (Game1.currentSeason.Equals("winter") ? Game1.content.LoadString("Strings\\StringsFromCSFiles:Game1.cs.2634") : Game1.content.LoadString("Strings\\StringsFromCSFiles:Game1.cs.2635"));
                        }
                        else if (str == "Town")
                        {
                            str = Game1.content.LoadString("Strings\\StringsFromCSFiles:Game1.cs.2637");
                        }
                        else if (str == "Beach")
                        {
                            str = Game1.content.LoadString("Strings\\StringsFromCSFiles:Game1.cs.2639");
                        }
                        Game1.showGlobalMessage(string.Concat(Game1.content.LoadString("Strings\\StringsFromCSFiles:Game1.cs.2640", Game1.temporaryContent.Load <Dictionary <string, string> >(string.Concat(string.Concat("Data\\Festivals\\", Game1.currentSeason), Game1.dayOfMonth))["name"]), str));
                    }
                }
                Game1.player.performTenMinuteUpdate();
                int num1 = Game1.timeOfDay;
                if (num1 <= 2400)
                {
                    if (num1 == 1200)
                    {
                        if (Game1.currentLocation.isOutdoors && !Game1.isRaining && (Game1.currentSong == null || Game1.currentSong.IsStopped || Game1.currentSong.Name.ToLower().Contains("ambient")))
                        {
                            Game1.playMorningSong();
                        }
                    }
                    else if (num1 != 2000)
                    {
                        if (num1 == 2400)
                        {
                            Game1.dayTimeMoneyBox.timeShakeTimer = 2000;
                            Game1.player.doEmote(24);
                            Game1.showGlobalMessage(Game1.content.LoadString("Strings\\StringsFromCSFiles:Game1.cs.2652"));
                        }
                    }
                    else if (!Game1.isRaining && Game1.currentLocation is Town)
                    {
                        Game1.changeMusicTrack("none", false, Game1.MusicContext.Default);
                    }
                }
                else if (num1 == 2500)
                {
                    Game1.dayTimeMoneyBox.timeShakeTimer = 2000;
                    Game1.player.doEmote(24);
                }
                else if (num1 == 2600)
                {
                    Game1.dayTimeMoneyBox.timeShakeTimer = 2000;
                    if (Game1.player.mount != null)
                    {
                        Game1.player.mount.dismount(false);
                    }
                    if (Game1.player.UsingTool)
                    {
                        if (Game1.player.CurrentTool != null)
                        {
                            FishingRod currentTool = Game1.player.CurrentTool as FishingRod;
                            FishingRod fishingRod  = currentTool;
                            if (currentTool != null && (fishingRod.isReeling || fishingRod.pullingOutOfWater))
                            {
                                foreach (GameLocation location in Game1.locations)
                                {
                                    location.performTenMinuteUpdate(Game1.timeOfDay);
                                    if (!(location is Farm))
                                    {
                                        continue;
                                    }
                                    ((Farm)location).timeUpdate(10);
                                }
                                MineShaft.UpdateMines10Minutes(Game1.timeOfDay);
                                if (Game1.IsMasterGame && Game1.farmEvent == null)
                                {
                                    Game1.netWorldState.Value.UpdateFromGame1();
                                }
                                return;
                            }
                        }
                        Game1.player.completelyStopAnimatingOrDoingAction();
                    }
                }
                else if (num1 == 2800)
                {
                    if (Game1.activeClickableMenu != null)
                    {
                        Game1.activeClickableMenu.emergencyShutDown();
                        Game1.exitActiveMenu();
                    }
                    Game1.player.startToPassOut();
                    if (Game1.player.mount != null)
                    {
                        Game1.player.mount.dismount(false);
                    }
                }
                foreach (GameLocation gameLocation in Game1.locations)
                {
                    gameLocation.performTenMinuteUpdate(Game1.timeOfDay);
                    if (!(gameLocation is Farm))
                    {
                        continue;
                    }
                    ((Farm)gameLocation).timeUpdate(10);
                }
                MineShaft.UpdateMines10Minutes(Game1.timeOfDay);
                if (Game1.IsMasterGame && Game1.farmEvent == null)
                {
                    Game1.netWorldState.Value.UpdateFromGame1();
                }
            });
            return(false);
        }