Пример #1
0
        private void DayEnding(object sender, DayEndingEventArgs e)
        {
            if (GameState.Current?.Activated != true)
            {
                return;
            }

            var p = Game1.MasterPlayer;

            checkProfession(p, BFarming5Perk, p.FarmingLevel, 5, Farmer.tiller, Farmer.rancher);
            checkProfession(p, BMining5Perk, p.MiningLevel, 5, Farmer.miner, Farmer.geologist);
            checkProfession(p, BCombat5Perk, p.CombatLevel, 5, Farmer.fighter, Farmer.scout);
            checkProfession(p, BFishing5Perk, p.FishingLevel, 5, Farmer.fisher, Farmer.trapper);
            checkProfession(p, BForage5Perk, p.ForagingLevel, 5, Farmer.gatherer, Farmer.forester);

            checkProfession(p, BFarming10Perk, p.FarmingLevel, 10, Farmer.artisan, Farmer.shepherd, Farmer.agriculturist, Farmer.butcher);
            checkProfession(p, BMining10Perk, p.MiningLevel, 10, Farmer.blacksmith, Farmer.excavator, Farmer.gemologist, Farmer.burrower);
            checkProfession(p, BCombat10Perk, p.CombatLevel, 10, Farmer.brute, Farmer.acrobat, Farmer.defender, Farmer.desperado);
            checkProfession(p, BFishing10Perk, p.FishingLevel, 10, Farmer.angler, Farmer.mariner, Farmer.pirate, Farmer.baitmaster);
            checkProfession(p, BForage10Perk, p.ForagingLevel, 10, Farmer.lumberjack, Farmer.botanist, Farmer.tapper, Farmer.tracker);

            foreach (var b in new int[]
            {
                BRobinHalf, BMushroomTree, BAlwaysLucky, BShopsOpen,
            })
            {
                if (!p.hasOrWillReceiveMail(rewardMail(b)) && bundleDone(b))
                {
                    p.mailForTomorrow.Add(rewardMail(b));
                    ModEntry.InvalidateCache();
                }
            }
        }
Пример #2
0
        /// <summary>Before the day is done, we need to set all the talked-to flags.</summary>
        private void EndDay(object sender, DayEndingEventArgs e)
        {
            // This is a host-only mod
            if (!Context.IsMainPlayer)
            {
                return;
            }

            if (Config.PreventAnimalFriendshipDecay)
            {
                foreach (var animal in Game1.getFarm().getAllFarmAnimals())
                {
                    animal.wasPet.Set(true);
                }
            }

            if (Config.PreventPeopleFriendshipDecay)
            {
                foreach (var friend in GetFriends())
                {
                    // Set the flag for having talked to that character, but don't add any points.
                    // The player can talk to the person themselves and still get the 20 points.
                    friend.TalkedToToday = true;
                }
            }
        }
Пример #3
0
 private void OnDayEnding(object sender, DayEndingEventArgs e)
 {
     if (Game1.Date.TotalDays >= 7 + Config.DaysAfterAiring + 1)
     {
         Game1.addMailForTomorrow("BestOfQOS.Letter1");
     }
 }
Пример #4
0
 private void OnDayEnding(object sender, DayEndingEventArgs e)
 {
     // Offload the custom locations
     Game1.locations.Remove(_trawlerHull.Value);
     Game1.locations.Remove(_trawlerSurface.Value);
     Game1.locations.Remove(_trawlerCabin.Value);
 }
Пример #5
0
        private static void GameLoop_DayEnding(object sender, DayEndingEventArgs e)
        {
            Log.T("DayEnding");

            // Save local (and/or persistent) community centre data
            BundleManager.Save(Bundles.CC);
        }
Пример #6
0
 /// <summary>Raised after the day is ending.</summary>
 /// <param name="sender">The event sender.</param>
 /// <param name="e">The event data.</param>
 private void OnDayEnding(object sender, DayEndingEventArgs e)
 {
     if (currentlyInPajamas && Game1.currentLocation is StardewValley.Locations.FarmHouse)
     {
         ChangeIntoRegularClothes();
     }
 }
Пример #7
0
        private void OnDayEnding(object sender, DayEndingEventArgs e)
        {
            var location = Game1.getLocationFromName(Const.LocationTarget);

            RemoveNpcs(location);
            RemoveTiles(location);
        }
Пример #8
0
 private void DayEnding(object sender, DayEndingEventArgs e)
 {
     if (Config.AutoFeedExtraAnimals)
     {
         DoFeeding(Game1.getFarm());
     }
 }
Пример #9
0
 private void GameLoop_DayEnding(object sender, DayEndingEventArgs e)
 {
     if (Game1.player.getFriendshipLevelForNPC("Sebastian") >= Config.FriendshipPointsRequired)
     {
         Game1.addMailForTomorrow("SolarionChroniclesMail");
     }
 }
Пример #10
0
        private void BeforeSaved(object sender, DayEndingEventArgs args)
        {
            // remove the location

            //remove hometown before save
            if (Game1.locations.Contains(hometown))
            {
                Game1.locations.Remove(hometown);
                this.Monitor.Log("removed hometown", LogLevel.Info);
            }
            else
            {
                this.Monitor.Log("cannot find hometown", LogLevel.Warn);
            }

            //remove parent(house) before save
            if (Game1.locations.Contains(parents))
            {
                Game1.locations.Remove(parents);
                this.Monitor.Log("removed parents(house)", LogLevel.Info);
            }
            else
            {
                this.Monitor.Log("cannot find parents(house)", LogLevel.Warn);
            }
        }
Пример #11
0
 private void OnDayEnding(object?sender, DayEndingEventArgs e)
 {
     foreach (Item item in Game1.getFarm().getShippingBin(Game1.player))
     {
         OnSell(item);
     }
 }
Пример #12
0
 private void OnDayEndingEnableInput(object sender, DayEndingEventArgs e)
 {
     // If the handler wasn't attached nothing will happen here.
     this.Helper.Events.Input.ButtonPressed -= OnButtonPressedDisableInput;
     // Enable all buttons.
     this.Helper.Input.Suppress(SButton.None);
 }
Пример #13
0
 private void GameLoop_DayEnding(object sender, DayEndingEventArgs e)
 {
     if (Game1.IsMasterGame)
     {
         Helper.Data.WriteSaveData("TCDplayerEntries", entries);
     }
 }
Пример #14
0
 private static void OnDayEnding(object sender, DayEndingEventArgs e)
 {
     if ((Game1.player.mailReceived.Contains(LOANMAIL)) & (Game1.player.IsMainPlayer))
     {
         ApplyInterest();
     }
 }
Пример #15
0
        // Apply animal happiness bonus if player has a dog
        private void DayEnding(object sender, DayEndingEventArgs e)
        {
            if (Game1.player.hasPet() && !Game1.player.catPerson)
            {
                List <FarmAnimal> animals = new List <FarmAnimal>();

                foreach (FarmAnimal a in Game1.getFarm().animals.Values)
                {
                    animals.Add(a);
                }

                foreach (StardewValley.Buildings.Building b in Game1.getFarm().buildings)
                {
                    if (b.indoors.Value != null && b.indoors.Value.GetType() == typeof(AnimalHouse))
                    {
                        animals.AddRange(((AnimalHouse)b.indoors.Value).animals.Values);
                    }
                }

                foreach (FarmAnimal a in animals)
                {
                    // Since max value is 255, make sure it doesn't overflow
                    if (a.happiness.Value <= 230)
                    {
                        a.happiness.Value += 25;
                    }
                    else
                    {
                        a.happiness.Value = 255;
                    }
                }
            }
        }
Пример #16
0
        /// <summary>
        /// Raised after the game begins a new day (including when the player loads a save).
        /// </summary>
        /// <param name="sender">The sender of the event.</param>
        /// <param name="e">The event arguments.</param>
        private void GameLoop_DayEnding(object sender, DayEndingEventArgs e)
        {
            var currentChance = this.UpdateChanceForTodaysLuck();

            foreach (var location in Game1.locations.Where(x => x.IsFarm || x.IsGreenhouse))
            {
                foreach (var pair in location.terrainFeatures.Pairs)
                {
                    if (pair.Value is HoeDirt)
                    {
                        var dirt = pair.Value as HoeDirt;

                        // A state of 1 for dirt means it's watered.
                        if (dirt.crop != null && !dirt.crop.dead.Value && dirt.state == 1)
                        {
                            var randomChance = this.config.UseRandomChance ? this.randomvalue.Next(0, 100) : 100;

                            if (randomChance <= currentChance && randomChance != 0)
                            {
                                dirt.crop.growCompletely();
                                // this.Monitor.Log($"Instantly growing crop! Current Chance: {currentChance}, Random Chance: {randomChance}");
                            }
                        }
                    }
                }
            }
        }
Пример #17
0
        private void GameLoop_DayEnding(object sender, DayEndingEventArgs e)
        {
            double chance = 0.0;

            this.totalNumberOfSeenTimeTicks       = Math.Max(1, this.totalNumberOfSeenTimeTicks);
            this.numberOfTimeTicksWearingOneRing  = Math.Max(1, this.numberOfTimeTicksWearingOneRing);
            this.numberOfTimeTicksWearingTwoRings = Math.Max(1, this.numberOfTimeTicksWearingTwoRings);

            if (this.numberOfTimeTicksWearingOneRing / (this.totalNumberOfSeenTimeTicks * 1.0) >= this.config.percentOfDayNeededToWearRingToTriggerEffect)
            {
                chance = this.config.cropChancePercentWithRing;
            }

            if (this.config.shouldWearingBothRingsDoublePercentage && this.numberOfTimeTicksWearingTwoRings / (this.totalNumberOfSeenTimeTicks * 1.0) >= this.config.percentOfDayNeededToWearRingToTriggerEffect)
            {
                chance = 2 * this.config.cropChancePercentWithRing;
            }

            if (chance > 0)
            {
                this.MaybeChangeCrops(chance, Game1.getFarm());
            }

            this.numberOfTimeTicksWearingOneRing  = 0;
            this.numberOfTimeTicksWearingTwoRings = 0;
            this.totalNumberOfSeenTimeTicks       = 0;
        }
        /// <summary>
        /// End of Day routine. Occurs before saving. Swaps the wrapped, custom NPCs (<see cref="SocialNPC"/>) with the Vanilla NPC.
        /// </summary>
        /// <param name="sender">The caller of the event.</param>
        /// <param name="args">Arguments passed in</param>
        private void OnDayEnding(object sender, DayEndingEventArgs args)
        {
            if (Marlon == null && Morris == null)
            {
                return;
            }

            var npcList = new List <SocialNPC>()
            {
                Marlon
            };

            if (Game1.MasterPlayer != null && !Game1.MasterPlayer.hasCompletedCommunityCenter())
            {
                npcList.Add(Morris);
            }

            foreach (SocialNPC npc in npcList)
            {
                npc.currentLocation.characters.Add(npc.OriginalNpc);
                if (!npc.currentLocation.characters.Remove(npc))
                {
                    Monitor.Log($"Unable to remove SocialNPC: {npc.Name}");
                }
            }

            this.PrintNPCs(Marlon.Name);
            this.PrintNPCs(Morris.Name);
        }
Пример #19
0
        /// <summary>Before the day is done, we need to set all the talked-to flags.</summary>
        private void EndDay(object sender, DayEndingEventArgs e)
        {
            //This is a host-only mod:
            if (!Context.IsMainPlayer)
            {
                return;
            }

            var farmers = Game1.getAllFarmers();
            var npcs    = Utility.getAllCharacters();

            var farmerArray = farmers as Farmer[] ?? farmers.ToArray();

            foreach (NPC character in npcs)
            {
                if (!character.isVillager() && !character.IsMonster)
                {
                    continue;
                }

                foreach (Farmer farmer in farmerArray)
                {
                    if (!farmer.friendshipData.ContainsKey(character.Name))
                    {
                        continue;
                    }

                    var friendship = farmer.friendshipData[character.Name];

                    if (farmer.spouse == character.Name && !Config.AffectSpouses)
                    {
                        continue;
                        //If the they are 'dating' and we're not to affect dates, skip them. The exception to this is if
                        //the farmer has a spouse, in which case we want to treat them like everyone else:
                    }
                    else if (friendship.Status == FriendshipStatus.Dating && !Config.AffectDates &&
                             farmer.spouse == null)
                    {
                        continue;
                    }
                    else if (!Config.AffectEveryoneElse)
                    {
                        continue;
                    }

                    //Set the flag for having talked to that character, but don't add any points.
                    //The player can talk to the person themselves and still get the 20 points.
                    friendship.TalkedToToday = true;
                }
            }

            if (Config.AffectAnimals)
            {
                var animals = Game1.getFarm().getAllFarmAnimals().Distinct();
                foreach (var animal in animals)
                {
                    animal.wasPet.Set(true);
                }
            }
        }
        /// <summary>Raised before the game ends the current day.</summary>
        /// <param name="sender">The event sender.</param>
        /// <param name="e">The event data.</param>
        private void DayEnding(object sender, DayEndingEventArgs e)
        {
            // Has the pass out state been saved after passing out?
            if (PlayerStateRestorer.statepassoutps.Value != null)
            {
                //Yes, reload the state

                // Restore playerstate using PassOutPenalty values
                PlayerStateRestorer.LoadStatePassout();

                // Reset PlayerStateRestorer class with the statepassout field
                PlayerStateRestorer.statepassoutps.Value = null;
            }

            // Is the day ending because player died?
            else if (PlayerStateRestorer.statedeathps.Value != null)
            {
                //Yes, reload the state

                // Restore playerstate using DeathPenalty values
                PlayerStateRestorer.LoadStateDeath();

                // Reset PlayerStateRestorer class with the statedeath field
                PlayerStateRestorer.statedeathps.Value = null;
            }
        }
Пример #21
0
 private void GameLoop_DayEnding(object sender, DayEndingEventArgs e)
 {
     if (Game1.player?.hat?.Value?.modData.ContainsKey(seedKey) == true)
     {
         NewDay(Game1.player.hat.Value);
     }
 }
Пример #22
0
 private void OnDayEnd(object sender, DayEndingEventArgs e)
 {
     UpdateLevel(Farmer.farmingSkill);
     UpdateLevel(Farmer.fishingSkill);
     UpdateLevel(Farmer.foragingSkill);
     UpdateLevel(Farmer.miningSkill);
     UpdateLevel(Farmer.combatSkill);
 }
Пример #23
0
 private void DayEnding(object sender, DayEndingEventArgs e)
 {
     if (string.IsNullOrEmpty(currentlyPlaying))
     {
         return;
     }
     StopJukeboxMusic();
 }
Пример #24
0
 /// <summary>
 /// Check for friendship with robin at the end of the day
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void GameLoop_DayEnding(object sender, DayEndingEventArgs e)
 {
     //if friendship is higher enough, send the mail tomorrow
     if (Game1.player.getFriendshipLevelForNPC("Robin") >= Config.FriendshipPointsRequired)
     {
         Game1.addMailForTomorrow("FarmRearrangerMail");
     }
 }
Пример #25
0
 private void OnDayEnding(object o, DayEndingEventArgs e)
 {
     // Clear unused player data when sleeping.
     foreach (Farmer f in Game1.getAllFarmers())
     {
         M.Api.GetAndClearPlayerData(f.UniqueMultiplayerID);
     }
 }
Пример #26
0
 private void OnDayEnding(object?sender, DayEndingEventArgs e)
 {
     if (!Config.ActivateBeforeSleep)
     {
         return;
     }
     ActivateAllSprinklers();
 }
Пример #27
0
 public void DayEnding(object sender, DayEndingEventArgs e)
 {
     if (File.Exists(Environment.CurrentDirectory + $"\\InvestmentData\\{saveFolderName}\\yprcdtm"))
     {
         File.Delete(Environment.CurrentDirectory + $"\\InvestmentData\\{saveFolderName}\\yprcdtm");
     }
     File.Copy(Environment.CurrentDirectory + $"\\InvestmentData\\{saveFolderName}\\prcdtm", Environment.CurrentDirectory + $"\\InvestmentData\\{saveFolderName}\\yprcdtm");
 }
Пример #28
0
 /// Move mini fridges into reach if option and master game.
 private void OnDayEnding(object sender, DayEndingEventArgs e)
 {
     if (Game1.IsMasterGame && _entry.Config.HideMiniFridges)
     {
         Utilities.MoveMiniFridgesOutOfMapBounds();
         Utilities.MoveMiniFridgesIntoMapBounds();
     }
 }
Пример #29
0
 /// Callback function on day ended. We cleanup from the expanded fridge so when the game is saved all data is safe.
 private void OnDayEnded(object sender, DayEndingEventArgs e)
 {
     if (this.expandedFridgeHub != null)
     {
         this.expandedFridgeHub.CleanupForRelease();
         this.expandedFridgeHub = null;
     }
 }
Пример #30
0
 private void GameLoop_DayEnding(object sender, DayEndingEventArgs e)
 {
     // Check item sell quests for shipping bin items
     foreach (ISalable item in Game1.getFarm().getShippingBin(Game1.player))
     {
         QuestCheckers.CheckSellQuests(item);
     }
 }