Example #1
0
 public void performTenMinuteUpdate(object sender, StardewModdingAPI.Events.TimeChangedEventArgs e)
 {
     Time.TimeHandler.tenMinuteUpdate();
 }
Example #2
0
 private void GameLoop_TimeChanged(object sender, StardewModdingAPI.Events.TimeChangedEventArgs e)
 {
     LoadEffects();
 }
Example #3
0
        private void GameLoop_TimeChanged(object sender, StardewModdingAPI.Events.TimeChangedEventArgs e)
        {
            if (Game1.currentLocation != null && Game1.currentLocation is Farm f)
            {
                foreach (var v in f.buildings)
                {
                    if (v is FishPond fp)
                    {
                        if (Game1.random.NextDouble() <= ModConfig.JumpChance)
                        {
                            NetEvent0 animateHappyFishEvent = this.Helper.Reflection
                                                              .GetField <NetEvent0>(fp, "animateHappyFishEvent").GetValue();
                            animateHappyFishEvent.Fire();
                        }
                    }
                }
            }

            if (Game1.currentLocation != null && Game1.currentLocation.IsOutdoors && _validFishLocations.Count >= ModConfig.NumberOfJumpingFish)
            {
                //get fish
                Dictionary <int, int> fishLocation = SDVUtilities.GetFishListing(Game1.currentLocation);

                if (fishLocation.Keys.Count <= 0)
                {
                    return;
                }

                //legendaries!
                List <int> legendaryFishAdded = new List <int>();
                if (ModConfig.LegendariesJumpAfterCatch)
                {
                    switch (Game1.currentLocation.Name)
                    {
                    case "ExteriorMuseum":
                        foreach (var v in Game1.objectInformation)
                        {
                            if (v.Value.Split('/')[0] == "Pufferchick" && Game1.player.fishCaught.ContainsKey(v.Key))
                            {
                                legendaryFishAdded.Add(v.Key);
                                fishLocation.Add(v.Key, -1);
                            }
                        }
                        break;

                    case "Mountain":
                        if (Game1.currentSeason == "spring" && Game1.player.fishCaught.ContainsKey(163))
                        {
                            legendaryFishAdded.Add(163);
                            fishLocation.Add(163, -1);
                        }
                        break;

                    case "Beach":
                        if (Game1.currentSeason == "summer" && Game1.player.fishCaught.ContainsKey(159))
                        {
                            legendaryFishAdded.Add(159);
                            fishLocation.Add(159, -1);
                        }
                        break;

                    case "Forest":
                        if (Game1.currentSeason == "winter" && Game1.player.fishCaught.ContainsKey(775))
                        {
                            legendaryFishAdded.Add(775);
                            fishLocation.Add(775, 0);
                        }
                        break;

                    case "Town":
                        if (Game1.currentSeason == "fall" && Game1.player.fishCaught.ContainsKey(160))
                        {
                            fishLocation.Add(160, -1);
                        }
                        break;

                    case "Sewer":
                        if (Game1.player.fishCaught.ContainsKey(682))
                        {
                            fishLocation.Add(682, -1);
                        }
                        break;
                    }
                }

                int[]     fishIDs   = fishLocation.Keys.ToArray();
                Vector2[] validLocs = _validFishLocations.Keys.ToArray();

                for (int i = 0; i < ModConfig.NumberOfJumpingFish; i++)
                {
                    if (Game1.random.NextDouble() > ModConfig.JumpChance)
                    {
                        continue;
                    }

                    int rndFish = Game1.random.Next(0, fishIDs.Count() - 1);

                    if (legendaryFishAdded.Contains(rndFish) && Game1.random.NextDouble() < ModConfig.LegendaryJumpChance)
                    {
                        int loopCheck = 0;
                        do
                        {
                            rndFish = Game1.random.Next(0, fishIDs.Count() - 1);
                            i++;
                            loopCheck++;
                        } while (legendaryFishAdded.Contains(rndFish) && loopCheck < 12000);
                    }

                    int rndLoc = Game1.random.Next(0, validLocs.Count() - 1);
                    if (fishLocation[fishIDs[rndFish]] == -1 ||
                        fishLocation[fishIDs[rndFish]] == _validFishLocations[validLocs[rndLoc]] && rndFish != 0)
                    {
                        StardewValley.Object fish = new StardewValley.Object(fishIDs[rndFish], 1, false, -1, 0);
                        var startPosition         = validLocs[rndLoc];
                        var endPosition           = new Vector2(startPosition.X + 1.5f, startPosition.Y + 1.5f);
                        if (ValidFishForJumping(fish.ParentSheetIndex))
                        {
                            this._jumpingFish.Add(new JumpFish(fish, startPosition * Game1.tileSize,
                                                               endPosition * Game1.tileSize));
                        }
                    }
                }
            }
        }
Example #4
0
        private void GameLoop_TimeChanged(object sender, StardewModdingAPI.Events.TimeChangedEventArgs e)
        {
            if (r.Next(9) == 1)
            {
                StardewValley.Object foragedObject = null;
                int quality = 0;
                if (buffOwner.ForagingLevel - 2 <= 2)
                {
                    quality = 1;
                }
                if (buffOwner.ForagingLevel - 2 <= 6)
                {
                    quality = 2;
                }
                if (buffOwner.ForagingLevel - 2 <= 9)
                {
                    quality = 3;
                }
                else
                {
                    quality = 4;
                }
                GameLocation location = buffOwner.currentLocation;
                StardewValley.Locations.MineShaft ms = location as StardewValley.Locations.MineShaft;
                if (location.IsOutdoors)
                {
                    string locationName = buffOwner.currentLocation.Name;
                    if (locationName.Equals("Woods"))
                    {
                        string season = Game1.currentSeason;
                        switch (season)
                        {
                        case "spring":
                            foragedObject = new StardewValley.Object(woodsSpringForage[r.Next(2)], 1, false, -1, quality); break;

                        case "summer":
                            foragedObject = new StardewValley.Object(woodsSummerForage[r.Next(2)], 1, false, -1, quality); break;

                        case "fall":
                            foragedObject = new StardewValley.Object(woodsFallForage[r.Next(2)], 1, false, -1, quality); break;

                        default:
                            foragedObject = new StardewValley.Object(winterForage[r.Next(5)], 1, false, -1, quality); break;
                        }
                    }
                    else if (locationName.Equals("Beach"))
                    {
                        foragedObject = new StardewValley.Object(beachForage[r.Next(8)], 1, false, -1, quality);
                    }
                    else if (locationName.Equals("Desert"))
                    {
                        foragedObject = new StardewValley.Object(desertForage[r.Next(2)], 1, false, -1, quality);
                    }
                    else
                    {
                        string season = Game1.currentSeason;
                        switch (season)
                        {
                        case "spring":
                            foragedObject = new StardewValley.Object(springForage[r.Next(6)], 1, false, -1, quality); break;

                        case "summer":
                            foragedObject = new StardewValley.Object(summerForage[r.Next(3)], 1, false, -1, quality); break;

                        case "fall":
                            foragedObject = new StardewValley.Object(fallForage[r.Next(4)], 1, false, -1, quality); break;

                        case "winter":
                            foragedObject = new StardewValley.Object(winterForage[r.Next(5)], 1, false, -1, quality); break;
                        }
                    }

                    if (foragedObject != null)
                    {
                    }
                }
                else if (ms != null && combatWithheldDialogue.Count == 0)
                {
                    foragedObject = new StardewValley.Object(caveForage[r.Next(3)], 1, false, -1, quality);
                }

                if (foragedObject != null)
                {
                    buffGranter.showTextAboveHead("!", -1, 2, 3000, 0);
                    foragedObjects.Add(foragedObject);

                    if (forageFoundDialogue == null)
                    {
                        Dialogue d = manager.GenerateDialogue("Perk", "Leah", true);
                        forageFoundDialogue =
                            d ?? throw new Exception(
                                      "Tried to push an foraging dialogue, but there weren't any!");
                        buffGranter.CurrentDialogue.Push(d);
                    }
                }
            }

            if (foragedObjects.Count > 0 &&
                !buffGranter.CurrentDialogue.Contains(forageFoundDialogue) &&
                combatWithheldDialogue.Count == 0)
            {
                buffGranter.CurrentDialogue.Push(forageFoundDialogue);
            }
        }
Example #5
0
 private void GameLoop_TimeChanged(object sender, StardewModdingAPI.Events.TimeChangedEventArgs e)
 {
     DarkerNight.CalculateDarkerNightColor();
 }
Example #6
0
 private void GameLoop_TimeChanged(object sender, StardewModdingAPI.Events.TimeChangedEventArgs e)
 {
     isTenting = false;
     Helper.Events.GameLoop.TimeChanged -= GameLoop_TimeChanged;
 }
 private void GameLoop_TimeChanged(object sender, StardewModdingAPI.Events.TimeChangedEventArgs e)
 {
     CheckIfShowActiveAtCurrentTime();
 }
Example #8
0
        private void GameLoop_TimeChanged(object sender, StardewModdingAPI.Events.TimeChangedEventArgs e)
        {
            if (r.Next(2) == 1 && foragedObject == null)
            {
                GameLocation location = buffOwner.currentLocation;
                StardewValley.Locations.MineShaft ms = location as StardewValley.Locations.MineShaft;
                if (location.IsOutdoors)
                {
                    string locationName = buffOwner.currentLocation.Name;
                    if (locationName.Equals("Woods"))
                    {
                        string season = Game1.currentSeason;
                        switch (season)
                        {
                        case "spring":
                            foragedObject = new StardewValley.Object(woodsSpringForage[r.Next(2)], 1, false, -1, 4); break;

                        case "summer":
                            foragedObject = new StardewValley.Object(woodsSummerForage[r.Next(2)], 1, false, -1, 4); break;

                        case "fall":
                            foragedObject = new StardewValley.Object(woodsFallForage[r.Next(2)], 1, false, -1, 4); break;

                        default:
                            foragedObject = new StardewValley.Object(winterForage[r.Next(5)], 1, false, -1, 4); break;
                        }
                    }
                    else if (locationName.Equals("Beach"))
                    {
                        foragedObject = new StardewValley.Object(beachForage[r.Next(8)], 1, false, -1, 4);
                    }
                    else if (locationName.Equals("Desert"))
                    {
                        foragedObject = new StardewValley.Object(desertForage[r.Next(2)], 1, false, -1, 4);
                    }
                    else
                    {
                        string season = Game1.currentSeason;
                        switch (season)
                        {
                        case "spring":
                            foragedObject = new StardewValley.Object(springForage[r.Next(6)], 1, false, -1, 4); break;

                        case "summer":
                            foragedObject = new StardewValley.Object(summerForage[r.Next(3)], 1, false, -1, 4); break;

                        case "fall":
                            foragedObject = new StardewValley.Object(fallForage[r.Next(4)], 1, false, -1, 4); break;

                        case "winter":
                            foragedObject = new StardewValley.Object(winterForage[r.Next(5)], 1, false, -1, 4); break;
                        }
                    }

                    buffGranter.showTextAboveHead("!", -1, 2, 3000, 0);
                    string dialogueString = r.Next(2) == 0
                        ? forageFoundStrings[0] + foragedObject.Name + "!"
                        : forageFoundStrings[1] + foragedObject.Name + forageFoundStrings[2];
                    Dialogue d = new Dialogue(dialogueString, buffGranter);
                    buffGranter.CurrentDialogue.Push(d);
                    forageFoundDialogue = d;
                }
                else if (ms != null && manager.combatWithheldDialogue.Count == 0)
                {
                    foragedObject = new StardewValley.Object(caveForage[r.Next(3)], 1, false, -1, 4);

                    buffGranter.showTextAboveHead("!", -1, 2, 3000, 0);
                    string dialogueString = r.Next(2) == 0
                        ? forageFoundStrings[0] + foragedObject.Name + "!"
                        : forageFoundStrings[1] + foragedObject.Name + forageFoundStrings[2];
                    Dialogue d = new Dialogue(dialogueString, buffGranter);
                    buffGranter.CurrentDialogue.Push(d);
                    forageFoundDialogue = d;
                }
            }

            if (foragedObject != null &&
                !buffGranter.CurrentDialogue.Contains(forageFoundDialogue) &&
                manager.combatWithheldDialogue.Count == 0)
            {
                buffGranter.CurrentDialogue.Push(forageFoundDialogue);
            }
        }
Example #9
0
 private void TimeChanged(object sender, StardewModdingAPI.Events.TimeChangedEventArgs e)
 {
     CheckForEdits("TimeChanged");
 }
 private static void GameLoop_TimeChanged(object sender, StardewModdingAPI.Events.TimeChangedEventArgs e)
 {
     DisableShadowsHere(Game1.player.currentLocation);
 }
Example #11
0
 private void GameLoop_TimeChanged(object sender, StardewModdingAPI.Events.TimeChangedEventArgs e)
 {
     ReloadDict();
 }
Example #12
0
 private void GameLoop_TimeChanged(object sender, StardewModdingAPI.Events.TimeChangedEventArgs e)
 {
     CheckForAchievements();
 }