diff --git a/StardewValley/BellsAndWhistles/ParrotPlatform.cs b/StardewValley/BellsAndWhistles/ParrotPlatform.cs index 9198cf9..44468c0 100644 --- a/StardewValley/BellsAndWhistles/ParrotPlatform.cs +++ b/StardewValley/BellsAndWhistles/ParrotPlatform.cs @@ -369,7 +369,7 @@ public virtual void Activate() } } responses.Add(new Response("Cancel", Game1.content.LoadString("Strings\\Locations:MineCart_Destination_Cancel"))); - Game1.currentLocation.createQuestionDialogue("Take Parrot Express?", responses.ToArray(), "ParrotPlatform"); + Game1.currentLocation.createQuestionDialogue(Game1.content.LoadString("Strings\\UI:ParrotPlatform_Question"), responses.ToArray(), "ParrotPlatform"); activePlatform = this; } diff --git a/StardewValley/Characters/Child.cs b/StardewValley/Characters/Child.cs index d6ec584..0def792 100644 --- a/StardewValley/Characters/Child.cs +++ b/StardewValley/Characters/Child.cs @@ -276,6 +276,11 @@ public override void resetForNewDay(int dayOfMonth) } } + protected override string translateName(string name) + { + return name.TrimEnd(); + } + public override void dayUpdate(int dayOfMonth) { resetForNewDay(dayOfMonth); diff --git a/StardewValley/Event.cs b/StardewValley/Event.cs index 0865e76..60efa41 100644 --- a/StardewValley/Event.cs +++ b/StardewValley/Event.cs @@ -10006,7 +10006,7 @@ public void answerDialogue(string questionKey, int answerChoice) } else { - Game1.activeClickableMenu = new ShopMenu(festivalShops["starTokenShop"], 1); + Game1.activeClickableMenu = new ShopMenu(festivalShops["starTokenShop"], 1, null, null, null, "StardewFair"); } } break; diff --git a/StardewValley/Events/BirthingEvent.cs b/StardewValley/Events/BirthingEvent.cs index 772f50f..bba1332 100644 --- a/StardewValley/Events/BirthingEvent.cs +++ b/StardewValley/Events/BirthingEvent.cs @@ -5,6 +5,7 @@ using StardewValley.Characters; using StardewValley.Menus; using System; +using System.Collections.Generic; namespace StardewValley.Events { @@ -112,18 +113,26 @@ public bool tickUpdate(GameTime time) chance2 += (Game1.player.hasDarkSkin() ? 0.5 : 0.0); bool isDarkSkinned = new Random((int)Game1.uniqueIDForThisGame + (int)Game1.stats.DaysPlayed).NextDouble() < chance2; string newBabyName = babyName; + Dictionary dispositions = Game1.content.Load>("Data\\NPCDispositions"); DisposableList all_characters = Utility.getAllCharacters(); bool collision_found2 = false; do { collision_found2 = false; - foreach (NPC item in all_characters) + if (dispositions.ContainsKey(newBabyName)) { - if (item.name.Equals(newBabyName)) + newBabyName += " "; + collision_found2 = true; + } + else + { + foreach (NPC item in all_characters) { - newBabyName += " "; - collision_found2 = true; - break; + if (item.name.Equals(newBabyName)) + { + newBabyName += " "; + collision_found2 = true; + } } } } diff --git a/StardewValley/Farmer.cs b/StardewValley/Farmer.cs index 20d5c77..f3e3498 100644 --- a/StardewValley/Farmer.cs +++ b/StardewValley/Farmer.cs @@ -4750,6 +4750,7 @@ public bool addItemToInventoryBool(Item item, bool makeActiveObject = false) { (item as Object).reloadSprite(); } + bool showHUDNotification = true; if (Utility.IsNormalObjectAtParentSheetIndex(item, 73)) { success = true; @@ -4825,6 +4826,7 @@ public bool addItemToInventoryBool(Item item, bool makeActiveObject = false) base.currentLocation.debris.Add(new Debris(amount, new Vector2(Game1.player.getStandingX(), Game1.player.getStandingY()), Color.Lime, 1f, this)); Game1.playSound("healSound"); removeItemFromInventory(item); + showHUDNotification = false; } if (Utility.IsNormalObjectAtParentSheetIndex(item, 102)) { @@ -4878,7 +4880,7 @@ public bool addItemToInventoryBool(Item item, bool makeActiveObject = false) break; } } - if (Game1.activeClickableMenu == null || !(Game1.activeClickableMenu is ItemGrabMenu)) + if (showHUDNotification && (Game1.activeClickableMenu == null || !(Game1.activeClickableMenu is ItemGrabMenu))) { Game1.addHUDMessage(new HUDMessage(name, Math.Max(1, item.Stack), add: true, fontColor, item)); } @@ -5212,7 +5214,7 @@ public static List GetAllHairstyleIndices() } GetHairStyleMetadataFile(); allHairStyleIndices = new List(); - int highest_hair = FarmerRenderer.hairStylesTexture.Height / 96 * 8 - 1; + int highest_hair = FarmerRenderer.hairStylesTexture.Height / 96 * 8; for (int i = 0; i < highest_hair; i++) { allHairStyleIndices.Add(i); @@ -7290,7 +7292,7 @@ public void Update(GameTime time, GameLocation location) isSitting.Value = false; } } - if ((bool)isInBed && Game1.IsMultiplayer) + if ((bool)isInBed && Game1.IsMultiplayer && Game1.shouldTimePass()) { regenTimer -= time.ElapsedGameTime.Milliseconds; if (regenTimer < 0) diff --git a/StardewValley/FarmerRenderer.cs b/StardewValley/FarmerRenderer.cs index ede9638..60d3d1e 100644 --- a/StardewValley/FarmerRenderer.cs +++ b/StardewValley/FarmerRenderer.cs @@ -843,10 +843,7 @@ public void drawHairAndAccesories(SpriteBatch b, int facingDirection, Farmer who b.Draw(shirtsTexture, position + origin + positionOffset + new Vector2(16f * scale + (float)(featureXOffsetPerFrame[currentFrame] * 4), (float)(56 + featureYOffsetPerFrame[currentFrame] * 4) + (float)(int)heightOffset * scale), shirtSourceRect, overrideColor.Equals(Color.White) ? Color.White : overrideColor, rotation, origin, 4f * scale, SpriteEffects.None, layerDepth + 1.8E-07f); b.Draw(shirtsTexture, position + origin + positionOffset + new Vector2(16f * scale + (float)(featureXOffsetPerFrame[currentFrame] * 4), (float)(56 + featureYOffsetPerFrame[currentFrame] * 4) + (float)(int)heightOffset * scale), dyed_shirt_source_rect5, overrideColor.Equals(Color.White) ? Utility.MakeCompletelyOpaque(who.GetShirtColor()) : overrideColor, rotation, origin, 4f * scale, SpriteEffects.None, layerDepth + 1.8E-07f + dye_layer_offset); } - if (hair_style >= 0) - { - b.Draw(hair_texture, position + origin + positionOffset + new Vector2(featureXOffsetPerFrame[currentFrame] * 4, featureYOffsetPerFrame[currentFrame] * 4 + 4 + ((who.IsMale && hair_style >= 16) ? (-4) : ((!who.IsMale && hair_style < 16) ? 4 : 0))), hairstyleSourceRect, overrideColor.Equals(Color.White) ? ((Color)who.hairstyleColor) : overrideColor, rotation, origin, 4f * scale, SpriteEffects.None, layerDepth + hair_draw_layer); - } + b.Draw(hair_texture, position + origin + positionOffset + new Vector2(featureXOffsetPerFrame[currentFrame] * 4, featureYOffsetPerFrame[currentFrame] * 4 + 4 + ((who.IsMale && hair_style >= 16) ? (-4) : ((!who.IsMale && hair_style < 16) ? 4 : 0))), hairstyleSourceRect, overrideColor.Equals(Color.White) ? ((Color)who.hairstyleColor) : overrideColor, rotation, origin, 4f * scale, SpriteEffects.None, layerDepth + hair_draw_layer); break; case 1: shirtSourceRect.Offset(0, 8); @@ -880,10 +877,7 @@ public void drawHairAndAccesories(SpriteBatch b, int facingDirection, Farmer who { b.Draw(accessoriesTexture, position + origin + positionOffset + rotationAdjustment + new Vector2(featureXOffsetPerFrame[currentFrame] * 4, 4 + featureYOffsetPerFrame[currentFrame] * 4 + (int)heightOffset), accessorySourceRect, (overrideColor.Equals(Color.White) && (int)who.accessory < 6) ? ((Color)who.hairstyleColor) : overrideColor, rotation, origin, 4f * scale + ((rotation != 0f) ? 0f : 0f), SpriteEffects.None, layerDepth + (((int)who.accessory < 8) ? 1.9E-05f : 2.9E-05f)); } - if (hair_style >= 0) - { - b.Draw(hair_texture, position + origin + positionOffset + new Vector2(featureXOffsetPerFrame[currentFrame] * 4, featureYOffsetPerFrame[currentFrame] * 4 + ((who.IsMale && (int)who.hair >= 16) ? (-4) : ((!who.IsMale && (int)who.hair < 16) ? 4 : 0))), hairstyleSourceRect, overrideColor.Equals(Color.White) ? ((Color)who.hairstyleColor) : overrideColor, rotation, origin, 4f * scale, SpriteEffects.None, layerDepth + hair_draw_layer); - } + b.Draw(hair_texture, position + origin + positionOffset + new Vector2(featureXOffsetPerFrame[currentFrame] * 4, featureYOffsetPerFrame[currentFrame] * 4 + ((who.IsMale && (int)who.hair >= 16) ? (-4) : ((!who.IsMale && (int)who.hair < 16) ? 4 : 0))), hairstyleSourceRect, overrideColor.Equals(Color.White) ? ((Color)who.hairstyleColor) : overrideColor, rotation, origin, 4f * scale, SpriteEffects.None, layerDepth + hair_draw_layer); break; case 2: dyed_shirt_source_rect5 = shirtSourceRect; @@ -897,10 +891,7 @@ public void drawHairAndAccesories(SpriteBatch b, int facingDirection, Farmer who { b.Draw(accessoriesTexture, position + origin + positionOffset + rotationAdjustment + new Vector2(featureXOffsetPerFrame[currentFrame] * 4, 8 + featureYOffsetPerFrame[currentFrame] * 4 + (int)heightOffset - 4), accessorySourceRect, (overrideColor.Equals(Color.White) && (int)who.accessory < 6) ? ((Color)who.hairstyleColor) : overrideColor, rotation, origin, 4f * scale + ((rotation != 0f) ? 0f : 0f), SpriteEffects.None, layerDepth + (((int)who.accessory < 8) ? 1.9E-05f : 2.9E-05f)); } - if (hair_style >= 0) - { - b.Draw(hair_texture, position + origin + positionOffset + new Vector2(featureXOffsetPerFrame[currentFrame] * 4, featureYOffsetPerFrame[currentFrame] * 4 + ((who.IsMale && (int)who.hair >= 16) ? (-4) : ((!who.IsMale && (int)who.hair < 16) ? 4 : 0))), hairstyleSourceRect, overrideColor.Equals(Color.White) ? ((Color)who.hairstyleColor) : overrideColor, rotation, origin, 4f * scale, SpriteEffects.None, layerDepth + hair_draw_layer); - } + b.Draw(hair_texture, position + origin + positionOffset + new Vector2(featureXOffsetPerFrame[currentFrame] * 4, featureYOffsetPerFrame[currentFrame] * 4 + ((who.IsMale && (int)who.hair >= 16) ? (-4) : ((!who.IsMale && (int)who.hair < 16) ? 4 : 0))), hairstyleSourceRect, overrideColor.Equals(Color.White) ? ((Color)who.hairstyleColor) : overrideColor, rotation, origin, 4f * scale, SpriteEffects.None, layerDepth + hair_draw_layer); break; case 3: { @@ -944,10 +935,7 @@ public void drawHairAndAccesories(SpriteBatch b, int facingDirection, Farmer who { b.Draw(accessoriesTexture, position + origin + positionOffset + rotationAdjustment + new Vector2(-featureXOffsetPerFrame[currentFrame] * 4, 4 + featureYOffsetPerFrame[currentFrame] * 4 + (int)heightOffset), accessorySourceRect, (overrideColor.Equals(Color.White) && (int)who.accessory < 6) ? ((Color)who.hairstyleColor) : overrideColor, rotation, origin, 4f * scale + ((rotation != 0f) ? 0f : 0f), SpriteEffects.FlipHorizontally, layerDepth + (((int)who.accessory < 8) ? 1.9E-05f : 2.9E-05f)); } - if (hair_style >= 0) - { - b.Draw(hair_texture, position + origin + positionOffset + new Vector2(-featureXOffsetPerFrame[currentFrame] * 4, featureYOffsetPerFrame[currentFrame] * 4 + ((who.IsMale && (int)who.hair >= 16) ? (-4) : ((!who.IsMale && (int)who.hair < 16) ? 4 : 0))), hairstyleSourceRect, overrideColor.Equals(Color.White) ? ((Color)who.hairstyleColor) : overrideColor, rotation, origin, 4f * scale, flip2 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, layerDepth + hair_draw_layer); - } + b.Draw(hair_texture, position + origin + positionOffset + new Vector2(-featureXOffsetPerFrame[currentFrame] * 4, featureYOffsetPerFrame[currentFrame] * 4 + ((who.IsMale && (int)who.hair >= 16) ? (-4) : ((!who.IsMale && (int)who.hair < 16) ? 4 : 0))), hairstyleSourceRect, overrideColor.Equals(Color.White) ? ((Color)who.hairstyleColor) : overrideColor, rotation, origin, 4f * scale, flip2 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, layerDepth + hair_draw_layer); break; } } diff --git a/StardewValley/Game1.cs b/StardewValley/Game1.cs index fe29459..d68c8b8 100644 --- a/StardewValley/Game1.cs +++ b/StardewValley/Game1.cs @@ -164,7 +164,7 @@ public enum MusicContext public const byte errorLogMode = 11; - public static readonly string version = "1.5"; + public static readonly string version = "1.5.1"; public const float keyPollingThreshold = 650f; @@ -3259,6 +3259,9 @@ public static void applySaveFix(SaveGame.SaveFixes save_fix) netWorldState.Value.SetBundleData(new_dictionary); break; } + case SaveGame.SaveFixes.LeoChildrenFix: + Utility.FixChildNameCollisions(); + break; } } @@ -3629,7 +3632,7 @@ public static void loadForNewGame(bool loadedGame = false) currentCursorTile = Vector2.Zero; if (!loadedGame) { - lastAppliedSaveFix = SaveGame.SaveFixes.FixBotchedBundleData; + lastAppliedSaveFix = SaveGame.SaveFixes.LeoChildrenFix; } resetVariables(); chanceToRainTomorrow = 0.0; @@ -3827,6 +3830,10 @@ public static void loadForNewGame(bool loadedGame = false) } } netWorldState.Value.ShuffleMineChests = game1.GetNewGameOption("MineChests"); + if (game1.newGameSetupOptions.ContainsKey("SpawnMonstersAtNight")) + { + spawnMonstersAtNight = game1.GetNewGameOption("SpawnMonstersAtNight"); + } } player.ConvertClothingOverrideToClothesItems(); player.addQuest(9); @@ -7784,7 +7791,7 @@ public static void fixProblems() foreach (string s in NPCDispositions.Keys) { bool found = false; - if ((!(s == "Kent") || player.friendshipData.ContainsKey(s)) && (!(s == "Leo") || player.friendshipData.ContainsKey(s))) + if ((!(s == "Kent") || year > 1) && (!(s == "Leo") || MasterPlayer.hasOrWillReceiveMail("addedParrotBoy"))) { foreach (NPC n2 in allCharacters2) { @@ -15704,7 +15711,7 @@ public void ShowTelephoneMenu() { responses.Add(new Response("AdventureGuild", getCharacterFromName("Marlon").displayName)); } - responses.Add(new Response("HangUp", content.LoadString("Strings\\StringsFromCSFiles:TV.cs.13118"))); + responses.Add(new Response("HangUp", content.LoadString("Strings\\Locations:MineCart_Destination_Cancel"))); currentLocation.createQuestionDialogue(content.LoadString("Strings\\Characters:Phone_SelectNumber"), responses.ToArray(), "telephone"); } diff --git a/StardewValley/GameLocation.cs b/StardewValley/GameLocation.cs index c75befd..e95647b 100644 --- a/StardewValley/GameLocation.cs +++ b/StardewValley/GameLocation.cs @@ -2809,7 +2809,10 @@ public virtual void monsterDrop(Monster monster, int x, int y, Farmer who) extraDrops2 = monster.getExtraDropItems(); for (int i = 0; i < extraDrops2.Count; i++) { - debris.Add(monster.ModifyMonsterLoot(new Debris(extraDrops2[i], new Vector2(x, y), playerPosition))); + Item tmp = extraDrops2[i].getOne(); + tmp.Stack = extraDrops2[i].Stack; + tmp.HasBeenInInventory = false; + debris.Add(monster.ModifyMonsterLoot(new Debris(tmp, new Vector2(x, y), playerPosition))); } } if (HasUnlockedAreaSecretNotes(Game1.player) && Game1.random.NextDouble() < 0.033) diff --git a/StardewValley/Locations/CommunityCenter.cs b/StardewValley/Locations/CommunityCenter.cs index 77d02a4..ca46b4e 100644 --- a/StardewValley/Locations/CommunityCenter.cs +++ b/StardewValley/Locations/CommunityCenter.cs @@ -795,7 +795,7 @@ public void loadArea(int area, bool showEffects = true) { map.GetLayer("Buildings").Tiles[x, y] = new StaticTile(map.GetLayer("Buildings"), map.TileSheets[0], BlendMode.Alpha, refurbishedMap.GetLayer("Buildings").Tiles[x, y].TileIndex); adjustMapLightPropertiesForLamp(refurbishedMap.GetLayer("Buildings").Tiles[x, y].TileIndex, x, y, "Buildings"); - if (Game1.player.getTileX() == x && Game1.player.getTileY() == y) + if (Game1.player.currentLocation == this && Game1.player.getTileX() == x && Game1.player.getTileY() == y) { Game1.player.Position = new Vector2(2080f, 576f); } diff --git a/StardewValley/Locations/FarmHouse.cs b/StardewValley/Locations/FarmHouse.cs index a0af13d..ebb1682 100644 --- a/StardewValley/Locations/FarmHouse.cs +++ b/StardewValley/Locations/FarmHouse.cs @@ -217,7 +217,7 @@ public virtual Point getFrontDoorSpot() { return new Point(warp.TargetX, warp.TargetY); } - if (warp.X == 64 && warp.Y == 15) + if (warp.TargetX == 64 && warp.TargetY == 15) { return Game1.getFarm().GetMainFarmHouseEntry(); } @@ -356,6 +356,15 @@ public Point GetChildBedSpot(int index) return GetChildBed(index)?.GetBedSpot() ?? Point.Zero; } + public override bool isTilePlaceable(Vector2 v, Item item = null) + { + if (isTileOnMap(v) && getTileIndexAt((int)v.X, (int)v.Y, "Back") == 0 && getTileSheetIDAt((int)v.X, (int)v.Y, "Back") == "indoor") + { + return false; + } + return base.isTilePlaceable(v, item); + } + public Point getRandomOpenPointInHouse(Random r, int buffer = 0, int tries = 30) { Point point2 = Point.Zero; @@ -603,12 +612,12 @@ public override void updateEvenIfFarmerIsntHere(GameTime time, bool ignoreWasUpd if (spouse_farmer != null && spouse_farmer == owner) { NPC spouse = npc; - if (spouse != null && Game1.timeOfDay < 1500 && Game1.random.NextDouble() < 0.0006 && spouse.controller == null && spouse.Schedule == null && !spouse.getTileLocation().Equals(Utility.PointToVector2(getSpouseBedSpot(Game1.player.spouse))) && base.furniture.Count > 0) + if (spouse != null && Game1.timeOfDay < 1500 && Game1.random.NextDouble() < 0.0006 && spouse.controller == null && spouse.Schedule == null && !spouse.getTileLocation().Equals(Utility.PointToVector2(getSpouseBedSpot(Game1.player.spouse))) && furniture.Count > 0) { - Furniture furniture = base.furniture[Game1.random.Next(base.furniture.Count)]; - Microsoft.Xna.Framework.Rectangle b = furniture.boundingBox; + Furniture f = furniture[Game1.random.Next(furniture.Count)]; + Microsoft.Xna.Framework.Rectangle b = f.boundingBox; Vector2 possibleLocation = new Vector2(b.X / 64, b.Y / 64); - if (furniture.furniture_type.Value != 15) + if (f.furniture_type.Value != 15 && f.furniture_type.Value != 12) { int tries = 0; int facingDirection = -3; diff --git a/StardewValley/Locations/IslandNorth.cs b/StardewValley/Locations/IslandNorth.cs index 18f4bd4..1da84c3 100644 --- a/StardewValley/Locations/IslandNorth.cs +++ b/StardewValley/Locations/IslandNorth.cs @@ -728,6 +728,16 @@ public override bool isCollidingPosition(Microsoft.Xna.Framework.Rectangle posit return base.isCollidingPosition(position, viewport, isFarmer, damagesFarmer, glider, character); } + public override bool isTilePlaceable(Vector2 tile_location, Item item = null) + { + Point non_tile_position = Utility.Vector2ToPoint((tile_location + new Vector2(0.5f, 0.5f)) * 64f); + if (!caveOpened && boulderPosition.Contains(non_tile_position)) + { + return false; + } + return base.isTilePlaceable(tile_location, item); + } + public override void DayUpdate(int dayOfMonth) { base.DayUpdate(dayOfMonth); diff --git a/StardewValley/Locations/IslandSouth.cs b/StardewValley/Locations/IslandSouth.cs index 60b0914..bf5e7ce 100644 --- a/StardewValley/Locations/IslandSouth.cs +++ b/StardewValley/Locations/IslandSouth.cs @@ -539,6 +539,20 @@ public override bool isCollidingPosition(Microsoft.Xna.Framework.Rectangle posit return base.isCollidingPosition(position, viewport, isFarmer, damagesFarmer, glider, character); } + public override bool isTilePlaceable(Vector2 tile_location, Item item = null) + { + Point non_tile_position = Utility.Vector2ToPoint((tile_location + new Vector2(0.5f, 0.5f)) * 64f); + if (_exitsBlocked && turtle1Spot.Contains(non_tile_position)) + { + return false; + } + if (!westernTurtleMoved && turtle2Spot.Contains(non_tile_position)) + { + return false; + } + return base.isTilePlaceable(tile_location, item); + } + protected override void resetLocalState() { _isFirstVisit = false; diff --git a/StardewValley/Locations/IslandWest.cs b/StardewValley/Locations/IslandWest.cs index 7047bb5..6585a49 100644 --- a/StardewValley/Locations/IslandWest.cs +++ b/StardewValley/Locations/IslandWest.cs @@ -388,7 +388,7 @@ public override bool checkAction(Location tileLocation, xTile.Dimensions.Rectang who.Halt(); Game1.globalFadeToBlack(delegate { - who.ActiveObject = null; + who.reduceActiveItemByOne(); startEvent(new Event(Game1.content.LoadString("Strings\\Locations:IslandSecret_Event_BirdieFinished"), -666777)); }); who.mailReceived.Add("birdieQuestFinished"); diff --git a/StardewValley/Locations/IslandWestCave1.cs b/StardewValley/Locations/IslandWestCave1.cs index b5f215a..f365469 100644 --- a/StardewValley/Locations/IslandWestCave1.cs +++ b/StardewValley/Locations/IslandWestCave1.cs @@ -103,6 +103,9 @@ public void draw(SpriteBatch b) [XmlIgnore] public int currentPlaybackCrystalSequenceIndex; + [XmlIgnore] + public NetInt timesFailed = new NetInt(0); + [XmlIgnore] public NetList currentCrystalSequence = new NetList(); @@ -116,7 +119,7 @@ public IslandWestCave1() protected override void initNetFields() { base.initNetFields(); - base.NetFields.AddFields(netPhase, isActivated, currentDifficulty, currentCrystalSequenceIndex, currentCrystalSequence, enterValueEvent.NetFields, netPhaseTimer, completed); + base.NetFields.AddFields(netPhase, isActivated, currentDifficulty, currentCrystalSequenceIndex, currentCrystalSequence, enterValueEvent.NetFields, netPhaseTimer, completed, timesFailed); enterValueEvent.onEvent += enterValue; isActivated.fieldChangeVisibleEvent += onActivationChanged; } @@ -247,6 +250,7 @@ public virtual void enterValue(int which) { playSound("cancel"); resetPuzzle(); + timesFailed.Value++; return; } currentCrystalSequenceIndex.Value++; @@ -299,14 +303,13 @@ public override void UpdateWhenCurrentLocation(GameTime time) { case 0: case 4: - { currentPlaybackCrystalSequenceIndex = 0; if (Game1.IsMasterGame) { currentDifficulty.Value++; currentCrystalSequence.Clear(); currentCrystalSequenceIndex.Value = 0; - if ((int)currentDifficulty > 7) + if ((int)currentDifficulty > (((int)timesFailed < 8) ? 7 : 6)) { netPhaseTimer.Value = 10f; netPhase.Value = 5; @@ -318,14 +321,8 @@ public override void UpdateWhenCurrentLocation(GameTime time) } netPhase.Value = 1; } - int betweenNotesDivisor = currentDifficulty; - if ((int)currentDifficulty > 5) - { - betweenNotesDivisor--; - } - betweenNotesTimer = 2000f / (float)betweenNotesDivisor; + betweenNotesTimer = 600f; break; - } case 5: if (Game1.currentLocation == this) { @@ -366,8 +363,29 @@ public override void UpdateWhenCurrentLocation(GameTime time) crystals[which].activate(); } currentPlaybackCrystalSequenceIndex++; - betweenNotesTimer = 1500f / (float)(int)currentDifficulty; - if ((int)currentDifficulty > 7) + int betweenNotesDivisor = currentDifficulty; + if ((int)currentDifficulty > 5) + { + betweenNotesDivisor--; + if ((int)timesFailed >= 4) + { + betweenNotesDivisor--; + } + if ((int)timesFailed >= 6) + { + betweenNotesDivisor--; + } + if ((int)timesFailed >= 8) + { + betweenNotesDivisor = 3; + } + } + else if ((int)timesFailed >= 4 && (int)currentDifficulty > 4) + { + betweenNotesDivisor--; + } + betweenNotesTimer = 1500f / (float)betweenNotesDivisor; + if ((int)currentDifficulty > (((int)timesFailed < 8) ? 7 : 6)) { betweenNotesTimer = 100f; } @@ -376,7 +394,7 @@ public override void UpdateWhenCurrentLocation(GameTime time) return; } currentPlaybackCrystalSequenceIndex = -1; - if ((int)currentDifficulty > 7) + if ((int)currentDifficulty > (((int)timesFailed < 8) ? 7 : 6)) { if (Game1.IsMasterGame) { diff --git a/StardewValley/Locations/Mountain.cs b/StardewValley/Locations/Mountain.cs index 3132b8b..319f586 100644 --- a/StardewValley/Locations/Mountain.cs +++ b/StardewValley/Locations/Mountain.cs @@ -373,6 +373,20 @@ public override bool isCollidingPosition(Microsoft.Xna.Framework.Rectangle posit return base.isCollidingPosition(position, viewport, isFarmer, damagesFarmer, glider, character); } + public override bool isTilePlaceable(Vector2 tile_location, Item item = null) + { + Point non_tile_position = Utility.Vector2ToPoint((tile_location + new Vector2(0.5f, 0.5f)) * 64f); + if ((bool)landslide && landSlideRect.Contains(non_tile_position)) + { + return false; + } + if ((bool)railroadAreaBlocked && railroadBlockRect.Contains(non_tile_position)) + { + return false; + } + return base.isTilePlaceable(tile_location, item); + } + public override void draw(SpriteBatch spriteBatch) { base.draw(spriteBatch); diff --git a/StardewValley/Menus/AdvancedGameOptions.cs b/StardewValley/Menus/AdvancedGameOptions.cs index 06b4eed..6abb679 100644 --- a/StardewValley/Menus/AdvancedGameOptions.cs +++ b/StardewValley/Menus/AdvancedGameOptions.cs @@ -48,6 +48,8 @@ public class AdvancedGameOptions : IClickableMenu public const int WINDOW_HEIGHT = 500; + public bool initialMonsterSpawnAtValue; + private int optionsSlotHeld = -1; public AdvancedGameOptions() @@ -143,9 +145,21 @@ public virtual void PopulateOptions() { Game1.game1.SetNewGameOption("MineChests", val); }, new KeyValuePair(Game1.content.LoadString("Strings\\UI:AGO_CCB_Normal"), Game1.MineChestType.Default), new KeyValuePair(Game1.content.LoadString("Strings\\UI:AGO_CCB_Remixed"), Game1.MineChestType.Remixed)); - AddCheckbox(Game1.content.LoadString("Strings\\UI:AGO_FarmMonsters"), Game1.content.LoadString("Strings\\UI:AGO_FarmMonsters_Tooltip"), () => Game1.spawnMonstersAtNight, delegate(bool val) + AddCheckbox(Game1.content.LoadString("Strings\\UI:AGO_FarmMonsters"), Game1.content.LoadString("Strings\\UI:AGO_FarmMonsters_Tooltip"), delegate + { + bool result2 = Game1.spawnMonstersAtNight; + if (Game1.game1.newGameSetupOptions.ContainsKey("SpawnMonstersAtNight")) + { + result2 = Game1.game1.GetNewGameOption("SpawnMonstersAtNight"); + } + initialMonsterSpawnAtValue = result2; + return result2; + }, delegate(bool val) { - Game1.spawnMonstersAtNight = val; + if (initialMonsterSpawnAtValue != val) + { + Game1.game1.SetNewGameOption("SpawnMonstersAtNight", val); + } }); AddDropdown(Game1.content.LoadString("Strings\\UI:Character_Difficulty"), Game1.content.LoadString("Strings\\UI:AGO_ProfitMargin_Tooltip"), () => Game1.player.difficultyModifier, delegate(float val) { diff --git a/StardewValley/Menus/CarpenterMenu.cs b/StardewValley/Menus/CarpenterMenu.cs index 8d95542..ff0a6bd 100644 --- a/StardewValley/Menus/CarpenterMenu.cs +++ b/StardewValley/Menus/CarpenterMenu.cs @@ -682,9 +682,9 @@ public override void receiveLeftClick(int x, int y, bool playSound = true) { if (destroyed.indoors.Value != null && destroyed.indoors.Value is Cabin) { - foreach (Farmer allFarmer in Game1.getAllFarmers()) + foreach (Farmer current in Game1.getAllFarmers()) { - if (allFarmer.currentLocation.Name == (destroyed.indoors.Value as Cabin).GetCellarName()) + if (current.currentLocation != null && current.currentLocation.Name == (destroyed.indoors.Value as Cabin).GetCellarName()) { Game1.addHUDMessage(new HUDMessage(Game1.content.LoadString("Strings\\UI:Carpenter_CantDemolish_PlayerHere"), Color.Red, 3500f)); return; diff --git a/StardewValley/Menus/CharacterCustomization.cs b/StardewValley/Menus/CharacterCustomization.cs index df7549c..5446733 100644 --- a/StardewValley/Menus/CharacterCustomization.cs +++ b/StardewValley/Menus/CharacterCustomization.cs @@ -2695,6 +2695,10 @@ public override bool IsAutomaticSnapValid(int direction, ClickableComponent a, C { return false; } + if (advancedOptionsButton != null && backButton != null && a == advancedOptionsButton && b == backButton) + { + return false; + } if (source == Source.Wizard) { if (a == favThingBoxCC && b.myID >= 522 && b.myID <= 530) diff --git a/StardewValley/Menus/CoopMenu.cs b/StardewValley/Menus/CoopMenu.cs index 331cdfb..b15db4e 100644 --- a/StardewValley/Menus/CoopMenu.cs +++ b/StardewValley/Menus/CoopMenu.cs @@ -503,7 +503,7 @@ protected virtual bool checkFriendFarmCompatibility(FriendFarmData farm) { return false; } - if (farm.ProtocolVersion != "1.5") + if (farm.ProtocolVersion != "1.5.1") { return false; } @@ -515,7 +515,7 @@ protected virtual void onLobbyUpdate(object lobby) try { string protocolVersion = Program.sdk.Networking.GetLobbyData(lobby, "protocolVersion"); - if (!(protocolVersion != "1.5")) + if (!(protocolVersion != "1.5.1")) { Console.WriteLine("Receiving friend lobby data..."); Console.WriteLine("Owner: " + Program.sdk.Networking.GetLobbyOwnerName(lobby)); diff --git a/StardewValley/Menus/ForgeMenu.cs b/StardewValley/Menus/ForgeMenu.cs index 7064559..108dbc2 100644 --- a/StardewValley/Menus/ForgeMenu.cs +++ b/StardewValley/Menus/ForgeMenu.cs @@ -1270,19 +1270,19 @@ protected void _OnCloseMenu() { if (!Game1.player.IsEquippedItem(heldItem)) { - Utility.CollectOrDrop(heldItem); + Utility.CollectOrDrop(heldItem, 2); } if (!Game1.player.IsEquippedItem(leftIngredientSpot.item)) { - Utility.CollectOrDrop(leftIngredientSpot.item); + Utility.CollectOrDrop(leftIngredientSpot.item, 2); } if (!Game1.player.IsEquippedItem(rightIngredientSpot.item)) { - Utility.CollectOrDrop(rightIngredientSpot.item); + Utility.CollectOrDrop(rightIngredientSpot.item, 2); } if (!Game1.player.IsEquippedItem(startTailoringButton.item)) { - Utility.CollectOrDrop(startTailoringButton.item); + Utility.CollectOrDrop(startTailoringButton.item, 2); } heldItem = null; leftIngredientSpot.item = null; diff --git a/StardewValley/Menus/QuestLog.cs b/StardewValley/Menus/QuestLog.cs index aa37ed6..370c8d1 100644 --- a/StardewValley/Menus/QuestLog.cs +++ b/StardewValley/Menus/QuestLog.cs @@ -583,7 +583,7 @@ public override void draw(SpriteBatch b) if (_shownQuest.IsTimedQuest() && _shownQuest.GetDaysLeft() > 0) { Utility.drawWithShadow(b, Game1.mouseCursors, new Vector2(xPositionOnScreen + 32, yPositionOnScreen + 48 - 8), new Rectangle(410, 501, 9, 9), Color.White, 0f, Vector2.Zero, 4f, flipped: false, 0.99f); - Utility.drawTextWithShadow(b, Game1.parseText((pages[currentPage][questPage].GetDaysLeft() > 1) ? Game1.content.LoadString("Strings\\StringsFromCSFiles:QuestLog.cs.11374", pages[currentPage][questPage].GetDaysLeft()) : (Game1.IsEnglish() ? "Final Day" : Game1.content.LoadString("Strings\\StringsFromCSFiles:QuestLog.cs.11375", pages[currentPage][questPage].GetDaysLeft())), Game1.dialogueFont, base.width - 128), Game1.dialogueFont, new Vector2(xPositionOnScreen + 80, yPositionOnScreen + 48 - 8), Game1.textColor); + Utility.drawTextWithShadow(b, Game1.parseText((pages[currentPage][questPage].GetDaysLeft() > 1) ? Game1.content.LoadString("Strings\\StringsFromCSFiles:QuestLog.cs.11374", pages[currentPage][questPage].GetDaysLeft()) : Game1.content.LoadString("Strings\\StringsFromCSFiles:Quest_FinalDay"), Game1.dialogueFont, base.width - 128), Game1.dialogueFont, new Vector2(xPositionOnScreen + 80, yPositionOnScreen + 48 - 8), Game1.textColor); } string description = Game1.parseText(_shownQuest.GetDescription(), Game1.dialogueFont, base.width - 128); Rectangle cached_scissor_rect = b.GraphicsDevice.ScissorRectangle; diff --git a/StardewValley/Menus/ShopMenu.cs b/StardewValley/Menus/ShopMenu.cs index f7644ff..70127fc 100644 --- a/StardewValley/Menus/ShopMenu.cs +++ b/StardewValley/Menus/ShopMenu.cs @@ -1252,7 +1252,7 @@ private bool tryToPurchaseItem(ISalable item, ISalable held_item, int numberToBu { heldItem = item.GetSalableInstance(); heldItem.Stack = numberToBuy; - if (storeContext == "QiGemShop") + if (storeContext == "QiGemShop" || storeContext == "StardewFair") { heldItem.Stack *= item.Stack; } diff --git a/StardewValley/Menus/SocialPage.cs b/StardewValley/Menus/SocialPage.cs index d159091..51461e5 100644 --- a/StardewValley/Menus/SocialPage.cs +++ b/StardewValley/Menus/SocialPage.cs @@ -80,7 +80,7 @@ public SocialPage(int x, int y, int width, int height) if (Game1.player.friendshipData.ContainsKey(l.Name) && l is Child) { kidsNames.Add(l.Name); - npcNames[l.Name] = l.Name; + npcNames[l.Name] = l.Name.Trim(); } else if (Game1.player.friendshipData.ContainsKey(l.Name)) { diff --git a/StardewValley/Menus/TitleMenu.cs b/StardewValley/Menus/TitleMenu.cs index 028bae6..56bf05e 100644 --- a/StardewValley/Menus/TitleMenu.cs +++ b/StardewValley/Menus/TitleMenu.cs @@ -939,8 +939,13 @@ public override void receiveLeftClick(int x, int y, bool playSound = true) } if (subMenu != null) { + bool should_ignore_back_button_press = false; + if (Game1.options.SnappyMenus && subMenu.currentlySnappedComponent != null && subMenu.currentlySnappedComponent.myID != 81114) + { + should_ignore_back_button_press = true; + } bool handled_submenu_close = false; - if (subMenu.readyToClose() && backButton.containsPoint(x, y)) + if (subMenu.readyToClose() && backButton.containsPoint(x, y) && !should_ignore_back_button_press) { backButtonPressed(); handled_submenu_close = true; @@ -949,7 +954,7 @@ public override void receiveLeftClick(int x, int y, bool playSound = true) { subMenu.receiveLeftClick(x, y); } - if (handled_submenu_close || subMenu == null || !subMenu.readyToClose() || (!(subMenu is TooManyFarmsMenu) && !(subMenu is LanguageSelectionMenu) && (backButton == null || !backButton.containsPoint(x, y)))) + if (handled_submenu_close || subMenu == null || !subMenu.readyToClose() || (!(subMenu is TooManyFarmsMenu) && !(subMenu is LanguageSelectionMenu) && (backButton == null || !backButton.containsPoint(x, y))) || should_ignore_back_button_press) { return; } diff --git a/StardewValley/Multiplayer.cs b/StardewValley/Multiplayer.cs index 362256e..56c7768 100644 --- a/StardewValley/Multiplayer.cs +++ b/StardewValley/Multiplayer.cs @@ -320,7 +320,7 @@ public enum DisconnectType public static string kicked = "KICKED"; - public const string protocolVersion = "1.5"; + public const string protocolVersion = "1.5.1"; public readonly NetLogger logging = new NetLogger(); diff --git a/StardewValley/NPC.cs b/StardewValley/NPC.cs index a8b5dbb..4e7d62e 100644 --- a/StardewValley/NPC.cs +++ b/StardewValley/NPC.cs @@ -847,7 +847,7 @@ public virtual void reloadData() try { Dictionary NPCDispositions = Game1.content.Load>("Data\\NPCDispositions"); - if (NPCDispositions.ContainsKey(name)) + if (!(this is Child) && NPCDispositions.ContainsKey(name)) { string[] dataSplit = NPCDispositions[name].Split('/'); string a = dataSplit[0]; @@ -1020,6 +1020,8 @@ protected override string translateName(string name) return Game1.content.LoadString("Strings\\NPCNames:Grandpa"); case "Bear": return Game1.content.LoadString("Strings\\NPCNames:Bear"); + case "Birdie": + return Game1.content.LoadString("Strings\\NPCNames:Birdie"); default: { Dictionary dispositions = Game1.content.Load>("Data\\NPCDispositions"); @@ -1617,11 +1619,11 @@ public virtual void tryToReceiveActiveObject(Farmer who) specialItem = true }; o.questItem.Value = true; - who.ActiveObject = null; + who.reduceActiveItemByOne(); DelayedAction.playSoundAfterDelay("coin", 200); DelayedAction.functionAfterDelay(delegate { - who.addItemToInventoryBool(o); + who.addItemByMenuIfNecessary(o); }, 200); Game1.player.freezePause = 550; DelayedAction.functionAfterDelay(delegate @@ -5533,7 +5535,8 @@ public void setUpForOutdoorPatioActivity() patio_location.Y += -1f; break; case "Maru": - setTilePosition(70, 8); + patio_location.X += -1f; + patio_location.Y += -1f; break; case "Penny": patio_location.Y += -1f; @@ -5880,7 +5883,7 @@ public void marriageDuties() if (spouse.GetDaysMarried() >= 1 && r.NextDouble() < (double)(1f - (float)Math.Max(1, heartsWithSpouse) / 12f)) { Furniture f2 = farmHouse.getRandomFurniture(r); - if (f2 != null && f2.isGroundFurniture() && f2.furniture_type.Value != 15) + if (f2 != null && f2.isGroundFurniture() && f2.furniture_type.Value != 15 && f2.furniture_type.Value != 12) { Point p2 = new Point((int)f2.tileLocation.X - 1, (int)f2.tileLocation.Y); if (farmHouse.isTileLocationTotallyClearAndPlaceable(p2.X, p2.Y)) diff --git a/StardewValley/Network/Client.cs b/StardewValley/Network/Client.cs index 8fe1312..96ce1c8 100644 --- a/StardewValley/Network/Client.cs +++ b/StardewValley/Network/Client.cs @@ -80,7 +80,7 @@ public virtual string getUserName(long farmerId) public virtual void connect() { - Console.WriteLine("Starting client. Protocol version: 1.5"); + Console.WriteLine("Starting client. Protocol version: 1.5.1"); connectionMessage = null; if (!connectionStarted) { diff --git a/StardewValley/Network/GameServer.cs b/StardewValley/Network/GameServer.cs index dbde300..51a7093 100644 --- a/StardewValley/Network/GameServer.cs +++ b/StardewValley/Network/GameServer.cs @@ -349,7 +349,7 @@ public void sendMessages() public void startServer() { _wasConnected = false; - Console.WriteLine("Starting server. Protocol version: 1.5"); + Console.WriteLine("Starting server. Protocol version: 1.5.1"); initialize(); if (Game1.netWorldState == null) { diff --git a/StardewValley/Network/LidgrenClient.cs b/StardewValley/Network/LidgrenClient.cs index 46944e4..752f49a 100644 --- a/StardewValley/Network/LidgrenClient.cs +++ b/StardewValley/Network/LidgrenClient.cs @@ -89,7 +89,7 @@ public override void disconnect(bool neatly = true) protected virtual bool validateProtocol(string version) { - return version == "1.5"; + return version == "1.5.1"; } protected override void receiveMessagesImpl() diff --git a/StardewValley/Network/LidgrenServer.cs b/StardewValley/Network/LidgrenServer.cs index 7bcabaf..a9da4f4 100644 --- a/StardewValley/Network/LidgrenServer.cs +++ b/StardewValley/Network/LidgrenServer.cs @@ -216,7 +216,7 @@ public override void receiveMessages() private void sendVersionInfo(NetIncomingMessage message) { NetOutgoingMessage response = server.CreateMessage(); - response.Write("1.5"); + response.Write("1.5.1"); response.Write("StardewValley"); server.SendDiscoveryResponse(response, message.SenderEndPoint); if (bandwidthLogger != null) diff --git a/StardewValley/Object.cs b/StardewValley/Object.cs index 12ba7d0..ffd3007 100644 --- a/StardewValley/Object.cs +++ b/StardewValley/Object.cs @@ -1616,9 +1616,12 @@ public virtual void DayUpdate(GameLocation location) readyForHarvest.Value = true; break; case 272: - foreach (KeyValuePair pair in (location as AnimalHouse).animals.Pairs) + if (location is AnimalHouse) { - pair.Value.pet(Game1.player, is_auto_pet: true); + foreach (KeyValuePair pair in (location as AnimalHouse).animals.Pairs) + { + pair.Value.pet(Game1.player, is_auto_pet: true); + } } break; case 165: diff --git a/StardewValley/Program.cs b/StardewValley/Program.cs index 523c097..d572d2a 100644 --- a/StardewValley/Program.cs +++ b/StardewValley/Program.cs @@ -1,6 +1,7 @@ using StardewValley.SDKs; using System; using System.IO; +using System.Text; namespace StardewValley { @@ -119,7 +120,51 @@ public static void handleException(object sender, UnhandledExceptionEventArgs ar Game1.gameMode = 11; handlingException = true; Exception e = (Exception)args.ExceptionObject; - Game1.errorMessage = "Message: " + e.Message + Environment.NewLine + "InnerException: " + e.InnerException + Environment.NewLine + "Stack Trace: " + e.StackTrace; + StringBuilder sb = new StringBuilder(); + sb.AppendLine("Message: " + e.Message); + sb.AppendLine("InnerException: " + e.InnerException); + sb.AppendLine("Stack Trace: " + e.StackTrace); + sb.AppendLine(""); + sb.AppendLine("Game Version: " + Game1.version); + try + { + if (sdk != null) + { + sb.AppendLine("SDK Helper: " + sdk.GetType().Name); + } + sb.AppendLine("Game Language: " + LocalizedContentManager.CurrentLanguageCode.ToString()); + sb.AppendLine("GPU: " + Game1.graphics.GraphicsDevice.Adapter.Description); + sb.AppendLine("OS: " + Environment.OSVersion.Platform + " " + Environment.OSVersion.VersionString); + if (GameRunner.instance != null && GameRunner.instance.GetType().FullName.StartsWith("StardewModdingAPI.")) + { + sb.AppendLine("Running SMAPI"); + } + if (Game1.IsMultiplayer) + { + if (LocalMultiplayer.IsLocalMultiplayer()) + { + sb.AppendLine("Multiplayer (Split Screen)"); + } + else if (Game1.IsMasterGame) + { + sb.AppendLine("Multiplayer (Host)"); + } + else + { + sb.AppendLine("Multiplayer (Client)"); + } + } + if (Game1.options.gamepadControls) + { + sb.AppendLine("Playing on Controller"); + } + sb.AppendLine("In-game Date: " + Game1.currentSeason + " " + Game1.dayOfMonth + " Y" + Game1.year + " Time of Day: " + Game1.timeOfDay); + sb.AppendLine("Game Location: " + ((Game1.currentLocation == null) ? "null" : Game1.currentLocation.NameOrUniqueName)); + } + catch (Exception) + { + } + Game1.errorMessage = sb.ToString(); long targetTime = DateTime.Now.Ticks / 10000 + 25000; if (!hasTriedToPrintLog) { diff --git a/StardewValley/Properties/AssemblyInfo.cs b/StardewValley/Properties/AssemblyInfo.cs index 3d43859..b3ba992 100644 --- a/StardewValley/Properties/AssemblyInfo.cs +++ b/StardewValley/Properties/AssemblyInfo.cs @@ -18,5 +18,5 @@ [assembly: ComVisible(false)] [assembly: Guid("cf94604e-6069-4782-a33b-605954798003")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] -[assembly: AssemblyVersion("1.3.7661.39761")] +[assembly: AssemblyVersion("1.3.7664.5241")] [module: UnverifiableCode] diff --git a/StardewValley/SDKs/GalaxyNetClient.cs b/StardewValley/SDKs/GalaxyNetClient.cs index 3e1466d..6342674 100644 --- a/StardewValley/SDKs/GalaxyNetClient.cs +++ b/StardewValley/SDKs/GalaxyNetClient.cs @@ -38,7 +38,7 @@ public override float GetPingToHost() protected override void connectImpl() { - client = new GalaxySocket("1.5"); + client = new GalaxySocket("1.5.1"); GalaxyInstance.User().GetGalaxyID(); client.JoinLobby(lobbyId, onReceiveError); } diff --git a/StardewValley/SDKs/GalaxyNetServer.cs b/StardewValley/SDKs/GalaxyNetServer.cs index c8a6299..b68b196 100644 --- a/StardewValley/SDKs/GalaxyNetServer.cs +++ b/StardewValley/SDKs/GalaxyNetServer.cs @@ -140,7 +140,7 @@ public override void initialize() Console.WriteLine("Starting Galaxy server"); host = GalaxyInstance.User().GetGalaxyID(); galaxyPersonaDataChangedListener = new GalaxyPersonaDataChangedListener(onPersonaDataChanged); - server = new GalaxySocket("1.5"); + server = new GalaxySocket("1.5.1"); server.CreateLobby(Game1.options.serverPrivacy, (uint)(Game1.multiplayer.playerLimit * 2)); } diff --git a/StardewValley/SaveGame.cs b/StardewValley/SaveGame.cs index 7d1bf07..1caf01c 100644 --- a/StardewValley/SaveGame.cs +++ b/StardewValley/SaveGame.cs @@ -59,6 +59,7 @@ public enum SaveFixes Level9PuddingFishingRecipe3, OstrichIncubatorFragility, FixBotchedBundleData, + LeoChildrenFix, MAX } @@ -1266,7 +1267,7 @@ public static IEnumerator getLoadEnumerator(string file) Game1.doMorningStuff(); } int current_save_fix = (int)Game1.lastAppliedSaveFix; - while (current_save_fix < 31) + while (current_save_fix < 32) { if (Enum.IsDefined(typeof(SaveFixes), current_save_fix)) { diff --git a/StardewValley/Tools/Slingshot.cs b/StardewValley/Tools/Slingshot.cs index a0522f8..c7ed84b 100644 --- a/StardewValley/Tools/Slingshot.cs +++ b/StardewValley/Tools/Slingshot.cs @@ -63,7 +63,7 @@ public Slingshot() public override Item getOne() { - Slingshot slingshot = new Slingshot(); + Slingshot slingshot = new Slingshot(base.InitialParentTileIndex); CopyEnchantments(this, slingshot); slingshot._GetOneFrom(this); return slingshot; diff --git a/StardewValley/Utility.cs b/StardewValley/Utility.cs index 29aa435..bce8574 100644 --- a/StardewValley/Utility.cs +++ b/StardewValley/Utility.cs @@ -2585,14 +2585,21 @@ public static void CollectSingleItemOrShowChestMenu(Chest chest, object context Game1.activeClickableMenu = new ItemGrabMenu(chest.items, reverseGrab: false, showReceivingMenu: true, InventoryMenu.highlightAllItems, chest.grabItemFromInventory, null, chest.grabItemFromChest, snapToBottom: false, canBeExitedWithKey: true, playRightClickSound: true, allowRightClick: true, showOrganizeButton: true, 1, null, -1, context); } - public static bool CollectOrDrop(Item item) + public static bool CollectOrDrop(Item item, int direction) { if (item != null) { item = Game1.player.addItemToInventory(item); if (item != null) { - Game1.createItemDebris(item, Game1.player.getStandingPosition(), Game1.player.FacingDirection); + if (direction != -1) + { + Game1.createItemDebris(item, Game1.player.getStandingPosition(), direction); + } + else + { + Game1.createItemDebris(item, Game1.player.getStandingPosition(), Game1.player.FacingDirection); + } return false; } return true; @@ -2600,6 +2607,11 @@ public static bool CollectOrDrop(Item item) return true; } + public static bool CollectOrDrop(Item item) + { + return CollectOrDrop(item, -1); + } + public static void perpareDayForStardewCelebration(int finalFarmerScore) { bool farmerWon = finalFarmerScore >= Game1.percentageToWinStardewHero; @@ -6932,6 +6944,57 @@ public static List getPurchaseAnimalStock() return list; } + public static void FixChildNameCollisions() + { + List all_characters = new List(); + getAllCharacters(all_characters); + bool collision_found2 = false; + Dictionary dispositions = Game1.content.Load>("Data\\NPCDispositions"); + foreach (NPC character in all_characters) + { + if (character is Child) + { + string old_character_name = character.Name; + string character_name = character.Name; + do + { + collision_found2 = false; + if (dispositions.ContainsKey(character_name)) + { + character_name += " "; + collision_found2 = true; + } + else + { + foreach (NPC i in all_characters) + { + if (i != character && i.name.Equals(character_name)) + { + character_name += " "; + collision_found2 = true; + } + } + } + } + while (collision_found2); + if (character_name != character.Name) + { + character.Name = character_name; + character.displayName = null; + _ = character.displayName; + foreach (Farmer farmer in Game1.getAllFarmers()) + { + if (farmer.friendshipData != null && farmer.friendshipData.ContainsKey(old_character_name)) + { + farmer.friendshipData[character_name] = farmer.friendshipData[old_character_name]; + farmer.friendshipData.Remove(old_character_name); + } + } + } + } + } + } + public static List getShopStock(bool Pierres) { List stock = new List(); @@ -8411,7 +8474,7 @@ public static NPC getRandomTownNPC(Random r) Dictionary giftTastes = Game1.content.Load>("Data\\NPCDispositions"); int index = r.Next(giftTastes.Count); NPC i = Game1.getCharacterFromName(giftTastes.ElementAt(index).Key); - while (giftTastes.ElementAt(index).Key.Equals("Wizard") || giftTastes.ElementAt(index).Key.Equals("Krobus") || giftTastes.ElementAt(index).Key.Equals("Sandy") || giftTastes.ElementAt(index).Key.Equals("Dwarf") || giftTastes.ElementAt(index).Key.Equals("Marlon") || i == null) + while (giftTastes.ElementAt(index).Key.Equals("Wizard") || giftTastes.ElementAt(index).Key.Equals("Krobus") || giftTastes.ElementAt(index).Key.Equals("Sandy") || giftTastes.ElementAt(index).Key.Equals("Dwarf") || giftTastes.ElementAt(index).Key.Equals("Marlon") || (giftTastes.ElementAt(index).Key.Equals("Leo") && !Game1.MasterPlayer.mailReceived.Contains("addedParrotBoy")) || i == null) { index = r.Next(giftTastes.Count); i = Game1.getCharacterFromName(giftTastes.ElementAt(index).Key);