Beispiel #1
0
        private void onDayStarted(object _sender, DayStartedEventArgs _e)
        {
            if (!Game1.player.knowsRecipe("Flower Bomb"))
            {
                if (!Config.LeahRecipe)
                {
                    // Unlock the recipe directly.
                    Game1.player.craftingRecipes.Add("Flower Bomb", 0);
                }
                else if (Game1.player.getSpouse()?.Name == "Leah")
                {
                    // Ensure that the correct version of the event is loaded.
                    Helper.Content.InvalidateCache("Data\\Events\\FarmHouse");
                }
                else
                {
                    // Deliver the letter if Leah befriended and not winter.
                    if (!Game1.player.hasOrWillReceiveMail(MailEditor.RecipeKey) &&
                        Game1.player.getFriendshipHeartLevelForNPC("Leah") >= 2 &&
                        Game1.currentSeason != "winter")
                    {
                        Game1.player.mailbox.Add(MailEditor.RecipeKey);
                    }
                }
            }

            if (Context.IsMainPlayer)
            {
                // Melt any crystals left over from winter.
                if (Game1.currentSeason != "winter")
                {
                    foreach (GameLocation location in Game1.locations)
                    {
                        if (location is MineShaft)
                        {
                            continue;
                        }
                        foreach (var kvp in location.objects.Pairs.ToArray())
                        {
                            if (Crystals.Contains(kvp.Value.ParentSheetIndex))
                            {
                                location.objects.Remove(kvp.Key);
                            }
                        }
                    }
                }

                // Detonate the Flower Bombs.
                FlowerBomb.DetonateAll();
            }
        }
Beispiel #2
0
        private void cmdDetonateFlowerBombs(string _command, string[] _args)
        {
            try
            {
                if (!Context.IsMainPlayer)
                {
                    throw new Exception("Cannot detonate Flower Bombs without an active save as host.");
                }
                FlowerBomb.DetonateAll();
            }
            catch (Exception e)
            {
                Monitor.Log($"detonate_flower_bombs failed: {e.Message}", LogLevel.Error);
#if DEBUG
                Monitor.Log(e.StackTrace, LogLevel.Trace);
#endif
            }
        }