Example #1
0
        void GameLoop_DayStarted(object sender, DayStartedEventArgs e)
        {
            SetTemperatureToday();

            bool warmth = WarmInside(true);


            bool tooColdOutside = TooColdYesterday();

            if (tooColdOutside)
            {
                if (warmth)
                {
                    if (Config.showMessageOnStartOfDay)
                    {
                        Game1.addHUDMessage(new HUDMessage(Helper.Translation.Get("msg.warm"), ""));
                    }
                }
                else
                {
                    if (Config.showMessageOnStartOfDay)
                    {
                        if (HasSpouse())
                        {
                            Game1.addHUDMessage(new HUDMessage(Helper.Translation.Get("msg.spousecold"), ""));
                        }
                        else
                        {
                            Game1.addHUDMessage(new HUDMessage(Helper.Translation.Get("msg.cold"), ""));
                        }
                    }
                    Game1.currentLocation.playSound("coldSpell");

                    if (Config.penalty)
                    {
                        Game1.player.health  = CalcAttribute(Game1.player.health, Config.reduce_health, Game1.player.maxHealth);
                        Game1.player.stamina = CalcAttribute(Game1.player.stamina, Config.reduce_stamina, Game1.player.maxStamina);
                        if (HasSpouse())
                        {
                            Game1.player.changeFriendship(-Config.reduce_friendship_spouse, GetSpouse());
                        }
                        Game1.player.getChildren().ForEach((child) => Game1.player.changeFriendship(-Config.reduce_friendship_children, child));
                    }

                    if (HasSpouse())
                    {
                        string please = Helper.Translation.Get("dia.please");
                        switch (Game1.player.getChildrenCount())
                        {
                        case 1:
                            Child child = Game1.player.getChildren()[0];
                            GetSpouse().setNewDialogue("$2" + Helper.Translation.Get("dia.spousecold_child", new { child1 = child.Name }) + " " + please, true);
                            break;

                        case 2:
                            Child child1 = Game1.player.getChildren()[0];
                            Child child2 = Game1.player.getChildren()[1];
                            GetSpouse().setNewDialogue("$2" + Helper.Translation.Get("dia.spousecold_children", new { child1 = child1.Name, child2 = child2.Name }) + " " + please, true);
                            break;

                        default:
                            GetSpouse().setNewDialogue("$2" + Helper.Translation.Get("dia.spousecold") + " " + please, true);
                            break;
                        }
                    }
                }
            }
        }
Example #2
0
 /// <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)
 {
     TicksOutside = TicksTotal = TicksInLocation = 0;
     StaminaMngr.OnNewDay();
     TimeInBathHouse = 0;
 }
Example #3
0
 private void dayStarted(object sender, DayStartedEventArgs e)
 {
     // Update the switches from the config
     this.Config = this.Helper.ReadConfig <ModConfig>();
 }
Example #4
0
 private static void OnDayStarted(object sender, DayStartedEventArgs e)
 {
     Game1.getLocationFromName("Custom_Ridgeside_RidgeForest").modData["RSV_foxbloomSpawned"] = "false";
 }
Example #5
0
 /// <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)
 {
     CheckForNewRecipe();
 }
Example #6
0
        private void OnDayStarted(object sender, DayStartedEventArgs e)
        {
            foreach (var seenEvent in this.EventsToForget)
            {
                bool anyEventRemoved = false;


                if (Game1.player.eventsSeen.Remove(seenEvent))
                {
                    anyEventRemoved = true;
                    this.Monitor.Log("Repeatable Event Found! Resetting for next time! Event ID: " + seenEvent, LogLevel.Debug);
                }


                if (!anyEventRemoved)
                {
                    this.Monitor.Log("You have not seen any Repeatable Events.");
                }
            }

            foreach (string seenMail in this.MailToForget)
            {
                bool anyMailRemoved = false;
                if (Game1.player.mailReceived.Remove(seenMail))
                {
                    anyMailRemoved = true;
                    Monitor.Log("Repeatable Mail found!  Resetting: " + seenMail, LogLevel.Debug);
                }
                if (!anyMailRemoved)
                {
                    this.Monitor.Log("You have not opened any Repeatable mail.");
                }
            }
            foreach (var seenResponse in this.ResponseToForget)
            {
                bool anyResponseRemoved = false;
                if (Game1.player.dialogueQuestionsAnswered.Remove(seenResponse))
                {
                    anyResponseRemoved = true;
                    Monitor.Log("Repeatable Response Found! Resetting: " + seenResponse, LogLevel.Debug);
                }
                if (!anyResponseRemoved)
                {
                    this.Monitor.Log("No repeatable responses found.");
                }
            }
            if (ManualRepeaterList.Count != 0)
            {
                foreach (int manualEvent in ManualRepeaterList)
                {
                    bool manualEventsRemoved = false;
                    if (Game1.player.eventsSeen.Remove(manualEvent))
                    {
                        manualEventsRemoved = true;
                        Monitor.Log("Manual Repeater Engaged! Resetting: " + manualEvent, LogLevel.Debug);
                    }
                    if (!manualEventsRemoved)
                    {
                        Monitor.Log("Manual Repeater is not being used.", LogLevel.Debug);
                    }
                }
            }
        }
Example #7
0
        /// <summary>The method invoked once the player starts a new day, this is used for checking NPC birthdays and preparing players to get stamina when talking to NPCs.</summary>
        /// <param name="sender">The event sender.</param>
        /// <param name="e">The event data.</param>
        private void Events_DayStarted(object sender, DayStartedEventArgs e)
        {
            // Mark passout handled as false for the new day
            HasPassoutBeenHandled = false;

            // Remove all the mail added by the mod from the mailbox so it can be resent each day
            foreach (var mail in Game1.player.mailReceived)
            {
                if (mail.Contains("better10Hearts"))
                {
                    Game1.player.mailReceived.Remove(mail);
                }
            }

            // Empty the list, this means it's regenerated every day. Meaning if an NPC goes below 10, they no longer will be on the list
            npcEnergyGeneration.Clear();

            foreach (NPC npc in Utility.getAllCharacters())
            {
                // Check the player has friendship data with the NPC
                if (Game1.player.friendshipData.ContainsKey(npc.Name))
                {
                    // Retrieve that frienship data and calculate how many hearts they have
                    var friendship = Game1.player.friendshipData[npc.Name];

                    float hearts = friendship.Points / NPC.friendshipPointsPerHeartLevel;

                    if (Config.OnlyGetStaminaAt10Hearts)
                    {
                        // Check if friendship is at 10 hearts
                        if (hearts >= 10 && !npcEnergyGeneration.ContainsKey(npc.Name))
                        {
                            // Add the npc to a list to check if they have spoken today
                            npcEnergyGeneration.Add(npc.Name, false);

                            // Check if it's the NPC's birthday
                            if (npc.isBirthday(Game1.currentSeason, Game1.dayOfMonth))
                            {
                                // Set max luck
                                Game1.player.team.sharedDailyLuck.Value = 0.12;
                            }
                        }
                    }
                    else
                    {
                        // Check if friendship is at 10 hearts
                        if (!npcEnergyGeneration.ContainsKey(npc.Name))
                        {
                            // Add the npc to a list to check if they have spoken today
                            npcEnergyGeneration.Add(npc.Name, false);

                            // Check if it's the NPC's birthday
                            if (npc.isBirthday(Game1.currentSeason, Game1.dayOfMonth))
                            {
                                // Set max luck
                                Game1.player.team.sharedDailyLuck.Value = 0.12;
                            }
                        }
                    }
                }
            }
        }
Example #8
0
 private void OnNewDay(object sender, DayStartedEventArgs e)
 {
     throw new NotImplementedException();
 }
Example #9
0
 //Apparently getting currentLocation can return null for non-main players when warping, so I decided on this instead
 private void OnDayStarted(object sender, DayStartedEventArgs e)
 {
     gameLocation = Game1.player.currentLocation;
 }
Example #10
0
 private void GameLoop_DayStarted(object sender, DayStartedEventArgs e)
 {
     Helper.Events.GameLoop.DayStarted -= GameLoop_DayStarted;
 }
Example #11
0
 /*********
 ** Private methods
 *********/
 #region Events
 /// <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)
 {
     this.AwardPlayer();            // check if something is missing
     this.SaveAwards();             // save achievements on load, so load & quit is enough to update awards
     this.TravelingMerchantBonus(); // if junimo way is done, travelling merchant always have at least one item required for community center
 }
Example #12
0
        /// <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>
        public void OnDayStarted(object sender, DayStartedEventArgs e)
        {
            try
            {
                // reset data
                this.IsUpLate = false;

                // transition to the next day
                if (this.ShouldResetPlayerAfterCollapseNow)
                {
                    this.ShouldResetPlayerAfterCollapseNow = false;

                    if (this.Config.KeepStaminaAfterCollapse)
                    {
                        Game1.player.stamina = this.PreCollapseStamina;
                    }
                    if (this.Config.KeepHealthAfterCollapse)
                    {
                        Game1.player.health = this.PreCollapseHealth;
                    }
                    if (this.Config.KeepPositionAfterCollapse)
                    {
                        if (!Game1.weddingToday)
                        {
                            Game1.warpFarmer(this.PreCollapseMap, this.PreCollapseTile.X, this.PreCollapseTile.Y, false);
                            foreach (var v in PostWarpCharacter)
                            {
                                v.Value.Invoke();
                            }
                        }
                    }

                    if (this.horse != null && this.shouldWarpHorse)
                    {
                        Game1.warpCharacter(this.horse, Game1.player.currentLocation, Game1.player.position);
                        this.shouldWarpHorse = false;
                    }
                    if (this.isInSwimSuit)
                    {
                        Game1.player.changeIntoSwimsuit();
                    }
                    if (this.isBathing)
                    {
                        Game1.player.swimming.Value = true;
                    }

                    //Reflection to ensure that the railroad becomes properly unblocked.
                    if (Game1.dayOfMonth == 1 && Game1.currentSeason == "summer" && Game1.year == 1)
                    {
                        Mountain mountain = (Mountain)Game1.getLocationFromName("Mountain");

                        NetBool netBool2 = this.Helper.Reflection.GetField <NetBool>(mountain, "railroadAreaBlocked").GetValue();
                        netBool2.Value = false;

                        this.Helper.Reflection.GetField <Rectangle>(mountain, "railroadBlockRect").SetValue(Rectangle.Empty);

                        this.eve = new StardewValley.Events.SoundInTheNightEvent(4);
                        this.eve.setUp();
                        this.eve.makeChangesToLocation();
                    }
                }

                if (Game1.currentSeason != "spring" && Game1.year >= 1)
                {
                    this.clearRailRoadBlock();
                }

                // delete annoying charge messages (if only I could do this with mail IRL)
                if (this.Config.SkipCollapseMail)
                {
                    string[] validMail = Game1.mailbox
                                         .Where(p => !p.Contains("passedOut"))
                                         .ToArray();

                    Game1.mailbox.Clear();
                    foreach (string mail in validMail)
                    {
                        Game1.mailbox.Add(mail);
                    }
                }

                this.JustStartedNewDay = true;
            }
            catch (Exception ex)
            {
                this.Monitor.Log(ex.ToString(), LogLevel.Error);
                this.WriteErrorLog();
            }
        }
Example #13
0
        // Calculate buff duration based on player's daily luck
        private void TimeEvents_AfterDayStarted(object sender, DayStartedEventArgs e)
        {
            if (!Context.IsWorldReady)
            {
                return;
            }

            double luck = Game1.dailyLuck;

            //this.Monitor.Log("Player's luck: " + luck);

            // Reset daily buff
            buffApplied = false;

            // Base duration of the buff is eight hours
            buffDuration = 6 * 60;

            // TODO: Add/subtract a couple of hours based on daily luck
            double bonus = 0;

            // No bonus on a neutral day
            if (luck <= 0.02 && luck >= -0.02)
            {
                bonus = 0;
                //this.Monitor.Log("No bonus today.");
            }
            // No buff on a very bad luck day
            else if (luck < -0.07)
            {
                buffApplied = true;
                //this.Monitor.Log("No buff today.");
            }
            // Buff lasts the whole day on a very good luck day
            else if (luck > 0.07)
            {
                buffDuration = 24 * 60;
                //this.Monitor.Log("Buff will last the whole day!");
            }
            else
            {
                // Luck is between -0.07 and -0.03 and 0.03 and 0.07
                // So the variable bonus duration with this formula is between 1 and approx. 2.5 hours / -1 and -2.5 hours
                double luckDuration = luck * (100 / 3);
                //this.Monitor.Log("Bonus duration is " + luckDuration + " hours.");

                // Convert to minutes
                bonus = luckDuration * 60;

                // Positive bonus is double the fun, so the overall range for a bonus can be -1 - -2.5 hours and +2 - +5 hours
                // Total duration range is thus 3.5 hours - 11 hours (or 0 or 24 if you're especially lucky or unlucky)
                if (bonus > 0)
                {
                    bonus *= 2;
                }

                buffDuration += (int)bonus;
            }

            //this.Monitor.Log("Total buff duration is " + buffDuration / 60 + " hours");

            // Convert to game time minutes
            buffDuration = buffDuration / 10 * 7000;
        }
Example #14
0
 public static void GameLoop_DayStarted(object sender, DayStartedEventArgs e)
 {
 }
Example #15
0
        /// <summary>Raised after the day starts. Checks to see if it is raining. If yes, equips rain equipment.</summary>
        /// <param name="sender">The event sender.</param>
        /// <param name="e">The event data.</param>
        private void OnDayStarted(object sender, DayStartedEventArgs e)
        {
            this.Monitor.Log("Rain Coat ID: " + this.rainCoatIndex, LogLevel.Debug);
            this.Monitor.Log("Gumboots ID: " + this.rainBootsIndex, LogLevel.Debug);
            this.Monitor.Log("Rain Hood ID: " + this.rainHatIndex, LogLevel.Debug);
            this.Monitor.Log($"Rain Coat ID transformed into Clothes: {new Clothing(this.rainCoatIndex).displayName}", LogLevel.Debug);
            this.Monitor.Log($"Rain Boots ID transformed into Boots: {new Boots(this.rainBootsIndex).DisplayName}", LogLevel.Debug);
            this.Monitor.Log($"Rain Hat ID transformed into Hat: {new Hat(this.rainHatIndex).DisplayName}", LogLevel.Debug);

            // ignore if player hasn't loaded a save yet
            if (!Context.IsWorldReady)
            {
                return;
            }

            // ignore if the rainy clothes aren't loaded
            if (!this.Helper.ModRegistry.IsLoaded("IMS.JA.RainyDayClothing"))
            {
                return;
            }

            try {
                foreach (Furniture furniture in Game1.player.currentLocation.furniture)
                {
                    if (furniture is StorageFurniture)
                    {
                        this.dresserList.Add(furniture as StorageFurniture);
                    }
                }
                foreach (KeyValuePair <Vector2, StardewValley.Object> pair in Game1.player.currentLocation.Objects.Pairs)
                {
                    if (pair.Value is Chest)
                    {
                        this.chestList.Add(pair.Value as Chest);
                    }
                }
            } catch (Exception exception)
            {
                this.Monitor.Log("Exception ocurred while attempting to store Game1.player.currentLocation furniture and Objects as Lists", LogLevel.Error);
                this.Monitor.Log(exception.Message);
                this.Monitor.Log(exception.StackTrace);
            }


            /*
             *
             *              public readonly NetRef<Clothing> shirtItem;
             *              public readonly NetRef<Boots> boots;
             *              public readonly NetRef<Hat> hat;
             *
             *              //note: changeShirt appears to use female/male tilesheet index, whereas the initialization uses something else
             *              public void changeShirt(int whichShirt, bool is_customization_screen = false);
             *              public void ConvertClothingOverrideToClothesItems();
             *
             *              public Color GetShirtColor();
             *              public List<string> GetShirtExtraData();
             *              public int GetShirtIndex();
             *
             *              public bool hasItemInInventory(int itemIndex, int quantity, int minPrice = 0);
             *              public bool hasItemInInventoryNamed(string name);
             *              public Item hasItemWithNameThatContains(string name);
             *
             *              public void removeFirstOfThisItemFromInventory(int parentSheetIndexOfItem);
             *              public void removeItemFromInventory(Item which);
             *              public Item removeItemFromInventory(int whichItemIndex);
             *              public bool removeItemsFromInventory(int index, int stack);
             */

            //When it is raining, equip Rain Hood, Coat, and Boots at start of day
            if (this.WeatherJustifiesRainCoat())
            {
                // Rain Coat!
                if (this.Config.RainCoatEnabled)
                {
                    // Look to see if the player owns a rain coat
                    bool ownsRainCoat = Game1.player.hasItemInInventoryNamed(RAIN_SHIRT_DISPLAY_NAME);
                    if (!ownsRainCoat)
                    {
                        // check to see if there is a rain coat in any nearby containers
                        ownsRainCoat = IsAnyRainItem(RAIN_SHIRT_DISPLAY_NAME);
                    }

                    // only change player into raincoat if one is available
                    if (ownsRainCoat)
                    {
                        // save current shirt for later retrieval (reequip at end of rainy day)
                        this.previousShirt = Game1.player.shirtItem.Value;
                        this.PutItemAway(this.previousShirt);

                        // Change current shirt to be rain coat!
                        Clothing raincoat = new Clothing(this.rainCoatIndex);
                        Game1.player.changeShirt(ConvertToMaleOrFemaleIndex(raincoat));
                        Game1.player.ConvertClothingOverrideToClothesItems();

                        // remove rain coat from inventory
                        this.RemoveItemFromInventoryOrContainer(raincoat as Item);
                    }
                }


                // Rain Hood!
                if (this.Config.RainHoodEnabled)
                {
                    // Look to see if the player owns a rain hood
                    bool ownsRainHood = Game1.player.hasItemInInventoryNamed(RAIN_HAT_DISPLAY_NAME);
                    if (!ownsRainHood)
                    {
                        ownsRainHood = IsAnyRainItem(RAIN_HAT_DISPLAY_NAME);
                    }

                    // only change player into rain hood if one is available
                    if (ownsRainHood)
                    {
                        // Ensure hat is not null (no need to save hat if there is none!)
                        if (Game1.player.hat.Value != null)
                        {
                            // save current hat for later retrieval (reequip at end of rainy day)
                            this.isWearingHat = true;
                            this.previousHat  = Game1.player.hat.Value;
                            // put previous hat into player's inventory or nearby dresser
                            this.PutItemAway(this.previousHat);
                        }
                        // Replace hat with rain hood
                        Game1.player.changeHat(this.rainHatIndex);

                        // Remove rain hood from inventory
                        this.RemoveItemFromInventoryOrContainer(new Hat(this.rainHatIndex) as Item);

                        //this.Monitor.Log($"CURRENT HAIR??: {Game1.player.hair}", LogLevel.Debug);
                        //TODO: add config option to force change hair on rainy days - hair 8 (index 7)
                        // Game1.player.changeHairStyle();
                    }
                }

                // Rain Boots!
                if (this.Config.RainBootsEnabled)
                {
                    // Step 0 - Look to see if the player owns rain booties (named Gumshoes)
                    bool ownsRainBooties = Game1.player.hasItemInInventoryNamed(RAIN_BOOTIES_DISPLAY_NAME);
                    if (!ownsRainBooties)
                    {
                        ownsRainBooties = IsAnyRainItem(RAIN_BOOTIES_DISPLAY_NAME);
                    }

                    // only change into rain booties if they are available
                    if (ownsRainBooties)
                    {
                        // Step 1 - take off old boots, put in nearby dresser or player's inventory
                        if (Game1.player.boots.Value != null && Game1.player.boots.Value.DisplayName != new Boots(this.rainBootsIndex).DisplayName)
                        {
                            this.previousBoots = Game1.player.boots.Value;
                            Game1.player.boots.Value.onUnequip();
                            // put boots into nearby dresser or player's inventory
                            this.PutItemAway(this.previousBoots);
                        }
                        // Step 2 - equip new boots (rain boots!)
                        Game1.player.boots.Value = new Boots(this.rainBootsIndex);
                        Game1.player.boots.Value.onEquip();

                        // Step 3 - remove rain boots from inventory
                        this.RemoveItemFromInventoryOrContainer(new Boots(this.rainBootsIndex) as Item);
                    }
                }

                if (this.Config.RainBootsEnabled || this.Config.RainCoatEnabled || this.Config.RainHoodEnabled)
                {
                    Game1.player.UpdateClothing();
                }
            }
            // clear these lists to ensure they stay up to date during each function exection
            this.dresserList.Clear();
            this.chestList.Clear();
        }
Example #16
0
 private void OnDayStarted(object sender, DayStartedEventArgs e)
 {
     screenshotTaken = false;
     takeShot        = false;
 }
Example #17
0
 private void GameLoop_DayStarted(object sender, DayStartedEventArgs e)
 {
     initValue();
 }
Example #18
0
 private void HandleDayStart(object sender, DayStartedEventArgs e)
 {
     Helper.Content.InvalidateCache("TileSheets/crops");
 }
Example #19
0
 private void onDayStarted(object sender, DayStartedEventArgs e)
 {
     Helper.ReadConfig <ModConfig>();
 }
Example #20
0
        private void GameLoop_DayStarted(object sender, DayStartedEventArgs e)
        {
            if (!Game1.player.IsMainPlayer)
            {
                if (!this.HasLoggedMultiplayerMessage)
                {
                    this.Monitor.Log("Not main player, so no color changes will be attempted", LogLevel.Debug);
                    this.HasLoggedMultiplayerMessage = true;
                }
                return;
            }

            // Because we need to account for the possibility of previously animated ponds being no longer animated due to population changes
            //  (or no longer existing) and we are rescanning all ponds anyway, I am just gonna clear the Active Animations list every morning.
            Instance.ActiveAnimations.Clear();

            IEnumerable <BuildableGameLocation> BuildableLocations =
                from loc in Game1.locations where loc is BuildableGameLocation select loc as BuildableGameLocation;

            foreach (BuildableGameLocation bloc in BuildableLocations)
            {
                IEnumerable <FishPond> FishPonds =
                    from b in bloc.buildings where b is FishPond select b as FishPond;
                foreach (FishPond pond in FishPonds)
                {
                    bool pondHasCustomColor = false;
                    this.Monitor.Log($"Checking pond at {pond.tileX}, {pond.tileY}.", LogLevel.Trace);
                    if (Config.Enable_Custom_Pond_Coloring)
                    {
                        if (pond.fishType == -1 && Data.EmptyPondColor != null)
                        {
                            pond.overrideWaterColor.Value = Data.EmptyPondColor;
                            this.Monitor.Log($"Pond is empty and was recolored", LogLevel.Trace);
                            break;
                        }
                        foreach (PondPainterDataEntry entry in Data.Entries)
                        {
                            bool match = true;
                            //this.Monitor.Log($"Comparing with entry {entry.LogName}", LogLevel.Trace);
                            foreach (string t in entry.Tags)
                            {
                                /* For now we are removing the capability to set a default color until I find a better
                                 * way to do it.
                                 * if (t.Equals("pp_default"))
                                 * {
                                 * // pp_default trumps all other tags and immediately sets the color
                                 *      // I need a better way to do this, possibly moving it to a config instead of per pack.
                                 * ChangePondColor(pond, entry);
                                 * match = false;
                                 * break;
                                 * }
                                 * //*/
                                SObject pondFish = new SObject(pond.fishType.Value, 1, false, -1, 0);
                                if (!pondFish.HasContextTag(t))
                                {
                                    match = false;
                                }
                            }
                            if (match)
                            {
                                pondHasCustomColor = true;
                                this.Monitor.Log($"Found a match on entry {entry.LogName} with tags {String.Join(", ", entry.Tags)}.", LogLevel.Trace);
                                ChangePondColor(pond, entry);
                                break;
                            }
                        }
                    }
                    if (Config.Auto_Color_Other_Ponds_by_Dye_Color_of_Inhabitants && !pondHasCustomColor)
                    {
                        if (pond.FishCount > 0 && pond.FishCount >= Config.Minimum_Population_For_Auto_Coloring)
                        {
                            // Copying similar logic to how the roe is colored, but convert
                            // White to nearest color Snow since White means no override to the game
                            Color?c     = TailoringMenu.GetDyeColor(pond.GetFishObject());
                            Color?white = new Color?(Color.White);
                            if (c.HasValue)
                            {
                                if (c.Equals(white))
                                {
                                    c = new Color?(Color.Snow);
                                }
                            }
                            else
                            {
                                c = white;
                            }
                            pond.overrideWaterColor.Value = c.Value;
                        }
                    }
                }
            }
            this.Monitor.Log($"Finished Day Update. There are {Instance.ActiveAnimations.Count} active animations.", LogLevel.Trace);
        }
Example #21
0
 private void GameLoop_DayStarted(object sender, DayStartedEventArgs e)
 {
     ShowParrots(Game1.player.currentLocation);
 }
Example #22
0
 private void GameLoop_DayStarted(object sender, DayStartedEventArgs e)
 {
     ReloadTextures();
 }
Example #23
0
        /// <summary>Raised after the day starts in game.</summary>
        /// <param name="sender">The event sender.</param>
        /// <param name="e">The event arguments.</param>
        private void OnDayStarted(object sender, DayStartedEventArgs e)
        {
            var           model             = this.Helper.Data.ReadSaveData <ModData>("TileChecksData") ?? new ModData();
            List <string> locationsToUnsave = new List <string>();
            List <string> tilesToUnsave     = new List <string>();

            // goes through each tile in farmable locations and checks for harvestable crops that are in tiles that are saved
            foreach (string location in model.TileChecks.Keys)
            {
                // unsaves location if there are no tiles saved
                if (model.TileChecks[location].Count <= 1)
                {
                    locationsToUnsave.Add(location);
                }
                else
                {
                    foreach (TerrainFeature t in Game1.getLocationFromName(location).terrainFeatures.Values)
                    {
                        // checks for harvestable crop on tile
                        if (t is HoeDirt && (t as HoeDirt).readyForHarvest())
                        {
                            foreach (KeyValuePair <string, string> entry in model.TileChecks[location])
                            {
                                if (entry.Value == t.currentTileLocation.ToString())
                                {
                                    Game1.addHUDMessage(new HUDMessage($"{entry.Key} is ready to be harvested in {GetDisplayName(location)}.", ""));
                                    if (this.Config.AutoUnsave)
                                    {
                                        tilesToUnsave.Add(entry.Key);
                                    }
                                }
                            }
                        }
                        // checks for tree with harvestable fruits on tile
                        else if (t is FruitTree && (t as FruitTree).fruitsOnTree >= this.Config.FruitTreeAlertNumber)
                        {
                            foreach (KeyValuePair <string, string> entry in model.TileChecks[location])
                            {
                                if (entry.Value == t.currentTileLocation.ToString())
                                {
                                    Game1.addHUDMessage(new HUDMessage($"{entry.Key} has {(t as FruitTree).fruitsOnTree} fruit(s) ready to be harvested in {GetDisplayName(location)}.", ""));
                                    if (this.Config.AutoUnsave)
                                    {
                                        tilesToUnsave.Add(entry.Key);
                                    }
                                }
                            }
                        }
                    }
                    foreach (Object o in Game1.getLocationFromName(location).Objects.Values)
                    {
                        if (o is IndoorPot && (o as IndoorPot).hoeDirt.Value.readyForHarvest())
                        {
                            foreach (KeyValuePair <string, string> entry in model.TileChecks[location])
                            {
                                if (entry.Value == o.tileLocation.ToString())
                                {
                                    Game1.addHUDMessage(new HUDMessage($"{entry.Key} is ready to be harvested in {GetDisplayName(location)}.", ""));
                                    if (this.Config.AutoUnsave)
                                    {
                                        tilesToUnsave.Add(entry.Key);
                                    }
                                }
                            }
                        }
                    }
                }
                foreach (string entry in tilesToUnsave)
                {
                    model.TileChecks[location].Remove(entry);
                    this.Helper.Data.WriteSaveData("TileChecksData", model);
                }
            }
            foreach (string location in locationsToUnsave)
            {
                model.TileChecks.Remove(location);
                this.Helper.Data.WriteSaveData("TileChecksData", model);
            }
        }
Example #24
0
 /// <summary>The method invoked when a new day starts.</summary>
 /// <param name="sender">The event sender.</param>
 /// <param name="e">The event data.</param>
 private void OnDayStarted(object sender, DayStartedEventArgs e)
 {
     // reset low-level cache once per game day (used for expensive queries that don't change within a day)
     this.GameHelper.ResetCache(this.Helper.Reflection, this.Monitor);
 }
Example #25
0
 private void OnDayStarted(object sender, DayStartedEventArgs e)
 {
     // wait for Quest Framework to potentially initialize a quest
     this.Helper.Events.GameLoop.UpdateTicked += this.OnDayStartedDelayed;
 }
Example #26
0
 /// <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)
 {
     this.RunSprinklers();
 }
 private static void OnDayStarted(object sender, DayStartedEventArgs e)
 {
     Data = new OfferingData();
     PerformedOfferingToday = false;
 }
 public static void DayStarted(object sender, DayStartedEventArgs e)
 {
     ApplyHatEffect();
     OnDayStarted?.Invoke(e);
 }
Example #29
0
 /// <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)
 {
     CheckForBirthday();
 }
Example #30
0
 /*********
 ** Private methods
 *********/
 /****
 ** Event handlers
 ****/
 /// <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)
 {
     // When the player loads a saved game, or after the overnight level screen,
     // add any professions the player should have but doesn't.
     this.AddMissingProfessions();
 }