diff --git a/StardewValley/BellsAndWhistles/SpriteText.cs b/StardewValley/BellsAndWhistles/SpriteText.cs index ec24520..b62e09a 100644 --- a/StardewValley/BellsAndWhistles/SpriteText.cs +++ b/StardewValley/BellsAndWhistles/SpriteText.cs @@ -590,6 +590,7 @@ public static void drawString(SpriteBatch b, string s, int x, int y, int charact position.Y += 18f * fontPixelZoom; position.X = x; accumulatedHorizontalSpaceBetweenCharacters = 0; + fontPixelZoom = tempzoom; continue; } accumulatedHorizontalSpaceBetweenCharacters = (int)(0f * fontPixelZoom); @@ -606,11 +607,11 @@ public static void drawString(SpriteBatch b, string s, int x, int y, int charact position.X = x; if (s[i] == ' ') { + fontPixelZoom = tempzoom; continue; } } b.Draw((color != -1) ? coloredTexture : spriteTexture, position + spriteFontOffset * fontPixelZoom, getSourceRectForChar(s[i], junimoText), ((IsSpecialCharacter(s[i]) | junimoText) ? Color.White : getColorFromIndex(color)) * alpha, 0f, Vector2.Zero, fontPixelZoom, SpriteEffects.None, layerDepth); - fontPixelZoom = tempzoom; if (i < s.Length - 1) { position.X += 8f * fontPixelZoom + (float)accumulatedHorizontalSpaceBetweenCharacters + (float)getWidthOffsetForChar(s[i + 1]) * fontPixelZoom; @@ -619,6 +620,7 @@ public static void drawString(SpriteBatch b, string s, int x, int y, int charact { position.X += (float)getWidthOffsetForChar(s[i]) * fontPixelZoom; } + fontPixelZoom = tempzoom; continue; } if (s[i] == '^') diff --git a/StardewValley/Characters/TrashBear.cs b/StardewValley/Characters/TrashBear.cs index f94ddca..95c3eca 100644 --- a/StardewValley/Characters/TrashBear.cs +++ b/StardewValley/Characters/TrashBear.cs @@ -83,8 +83,9 @@ private void updateItemWanted() { if (counter == position) { - string[] split = v.Split('/'); - itemWantedIndex = Convert.ToInt32(split[2]); + string craft_result2 = v.Split('/')[2]; + craft_result2 = craft_result2.Split(' ')[0]; + itemWantedIndex = Convert.ToInt32(craft_result2); break; } counter++; diff --git a/StardewValley/Debris.cs b/StardewValley/Debris.cs index 9a02fe6..23619e5 100644 --- a/StardewValley/Debris.cs +++ b/StardewValley/Debris.cs @@ -193,6 +193,7 @@ public NetFields NetFields public Debris() { NetFields.AddFields(chunks, chunkType, sizeOfSourceRectSquares, netItemQuality, netChunkFinalYLevel, netChunkFinalYTarget, scale, floppingFish, debrisType, debrisMessage, nonSpriteChunkColor, chunksColor, spriteChunkSheetName, netItem, player.NetFields, DroppedByPlayerID); + player.Delayed(interpolationWait: false); } public Debris(int objectIndex, Vector2 debrisOrigin, Vector2 playerPosition) @@ -537,16 +538,24 @@ public bool updateChunks(GameTime time, GameLocation location) } Vector2 position = approximatePosition(); Farmer farmer = player.Value; - if (chunksMoveTowardPlayer && shouldControlThis(location)) + if (chunksMoveTowardPlayer) { - if (player.Value != null && (player.Value.currentLocation != location || !playerInRange(position, player.Value))) + if (player.Value != null && player.Value == Game1.player && !playerInRange(position, player.Value)) { player.Value = null; farmer = null; } - if (farmer == null) + if (shouldControlThis(location)) { - farmer = findBestPlayer(location); + if (player.Value != null && player.Value.currentLocation != location) + { + player.Value = null; + farmer = null; + } + if (farmer == null) + { + farmer = findBestPlayer(location); + } } } bool anyCouldMove = false; diff --git a/StardewValley/Event.cs b/StardewValley/Event.cs index 5d829d9..0880eb2 100644 --- a/StardewValley/Event.cs +++ b/StardewValley/Event.cs @@ -913,6 +913,10 @@ public virtual void command_removeTemporarySprites(GameLocation location, GameTi CurrentCommand++; } + public virtual void command_null(GameLocation location, GameTime time, string[] split) + { + } + public virtual void command_specificTemporarySprite(GameLocation location, GameTime time, string[] split) { addSpecificTemporarySprite(split[1], location, split); @@ -3518,7 +3522,7 @@ private void samPreOllie(int extraInfo) { getActorByName("Sam").Sprite.currentFrame = 27; farmer.faceDirection(0); - TemporaryAnimatedSprite temporarySpriteByID = Game1.currentLocation.getTemporarySpriteByID(1); + TemporaryAnimatedSprite temporarySpriteByID = Game1.currentLocation.getTemporarySpriteByID(92473); temporarySpriteByID.xStopCoordinate = 1408; temporarySpriteByID.reachedStopCoordinate = samOllie; temporarySpriteByID.motion = new Vector2(2f, 0f); @@ -3528,7 +3532,7 @@ private void samOllie(int extraInfo) { Game1.playSound("crafting"); getActorByName("Sam").Sprite.currentFrame = 26; - TemporaryAnimatedSprite temporarySpriteByID = Game1.currentLocation.getTemporarySpriteByID(1); + TemporaryAnimatedSprite temporarySpriteByID = Game1.currentLocation.getTemporarySpriteByID(92473); temporarySpriteByID.currentNumberOfLoops = 0; temporarySpriteByID.totalNumberOfLoops = 1; temporarySpriteByID.motion.Y = -9f; @@ -3545,7 +3549,7 @@ private void samGrind(int extraInfo) { Game1.playSound("hammer"); getActorByName("Sam").Sprite.currentFrame = 28; - TemporaryAnimatedSprite temporarySpriteByID = Game1.currentLocation.getTemporarySpriteByID(1); + TemporaryAnimatedSprite temporarySpriteByID = Game1.currentLocation.getTemporarySpriteByID(92473); temporarySpriteByID.currentNumberOfLoops = 0; temporarySpriteByID.totalNumberOfLoops = 9999; temporarySpriteByID.motion.Y = 0f; @@ -3563,7 +3567,7 @@ private void samDropOff(int extraInfo) { NPC actorByName = getActorByName("Sam"); actorByName.Sprite.currentFrame = 31; - TemporaryAnimatedSprite temporarySpriteByID = Game1.currentLocation.getTemporarySpriteByID(1); + TemporaryAnimatedSprite temporarySpriteByID = Game1.currentLocation.getTemporarySpriteByID(92473); temporarySpriteByID.currentNumberOfLoops = 9999; temporarySpriteByID.totalNumberOfLoops = 0; temporarySpriteByID.motion.Y = 0f; @@ -3586,7 +3590,7 @@ private void samDropOff(int extraInfo) private void samGround(int extraInfo) { - TemporaryAnimatedSprite temporarySpriteByID = Game1.currentLocation.getTemporarySpriteByID(1); + TemporaryAnimatedSprite temporarySpriteByID = Game1.currentLocation.getTemporarySpriteByID(92473); Game1.playSound("thudStep"); temporarySpriteByID.attachedCharacter = null; temporarySpriteByID.reachedStopCoordinate = null; @@ -3598,7 +3602,7 @@ private void samGround(int extraInfo) private void catchFootball(int extraInfo) { - TemporaryAnimatedSprite temporarySpriteByID = Game1.currentLocation.getTemporarySpriteByID(1); + TemporaryAnimatedSprite temporarySpriteByID = Game1.currentLocation.getTemporarySpriteByID(56232); Game1.playSound("fishSlap"); temporarySpriteByID.motion = new Vector2(2f, -8f); temporarySpriteByID.rotationChange = (float)Math.PI / 24f; @@ -3609,7 +3613,7 @@ private void catchFootball(int extraInfo) private void footballLand(int extraInfo) { - TemporaryAnimatedSprite temporarySpriteByID = Game1.currentLocation.getTemporarySpriteByID(1); + TemporaryAnimatedSprite temporarySpriteByID = Game1.currentLocation.getTemporarySpriteByID(56232); Game1.playSound("sandyStep"); temporarySpriteByID.motion = new Vector2(0f, 0f); temporarySpriteByID.rotationChange = 0f; @@ -6342,7 +6346,7 @@ private void addSpecificTemporarySprite(string key, GameLocation location, strin xStopCoordinate = 1856, reachedStopCoordinate = catchFootball, layerDepth = 1f, - id = 1f + id = 56232f }); break; case "skateboardFly": @@ -6364,7 +6368,7 @@ private void addSpecificTemporarySprite(string key, GameLocation location, strin xStopCoordinate = 1344, reachedStopCoordinate = samPreOllie, attachedCharacter = getActorByName("Sam"), - id = 1f + id = 92473f }); break; case "beachStuff": @@ -7725,7 +7729,7 @@ private void judgeGrange() { if (i != null && i is Object) { - if ((int)(i as Object).parentSheetIndex == 789 || (int)(i as Object).parentSheetIndex == 71) + if (IsItemMayorShorts(i as Object)) { purpleShorts = true; } @@ -8733,7 +8737,7 @@ public void answerDialogue(string questionKey, int answerChoice) case "secretSanta": if (answerChoice == 0) { - Game1.activeClickableMenu = new ItemGrabMenu(null, reverseGrab: true, showReceivingMenu: false, Utility.highlightSmallObjects, chooseSecretSantaGift, Game1.content.LoadString("Strings\\StringsFromCSFiles:Event.cs.1788", secretSantaRecipient.displayName), null, snapToBottom: false, canBeExitedWithKey: false, playRightClickSound: true, allowRightClick: true, showOrganizeButton: false, 0, null, -1, this); + Game1.activeClickableMenu = new ItemGrabMenu(null, reverseGrab: true, showReceivingMenu: false, Utility.highlightSantaObjects, chooseSecretSantaGift, Game1.content.LoadString("Strings\\StringsFromCSFiles:Event.cs.1788", secretSantaRecipient.displayName), null, snapToBottom: false, canBeExitedWithKey: false, playRightClickSound: true, allowRightClick: true, showOrganizeButton: false, 0, null, -1, this); } break; case "cave": @@ -9002,6 +9006,15 @@ public void setUpAdvancedMove(string[] split, NPCController.endBehavior endBehav } } + public static bool IsItemMayorShorts(Item i) + { + if (!Utility.IsNormalObjectAtParentSheetIndex(i, 789)) + { + return Utility.IsNormalObjectAtParentSheetIndex(i, 71); + } + return true; + } + public void addItemToLuauSoup(Item i, Farmer who) { if (i == null) @@ -9012,12 +9025,13 @@ public void addItemToLuauSoup(Item i, Farmer who) if (who.IsLocalPlayer) { specialEventVariable2 = true; - if (i != null && i.Stack > 1 && (int)i.parentSheetIndex != 789 && (int)i.parentSheetIndex != 71) + bool is_shorts = IsItemMayorShorts(i); + if (i != null && i.Stack > 1 && !is_shorts) { i.Stack--; who.addItemToInventory(i); } - else if ((int)i.parentSheetIndex == 789 || (int)i.parentSheetIndex == 71) + else if (is_shorts) { who.addItemToInventory(i); } @@ -9043,7 +9057,7 @@ private void governorTaste() { Object o = luauIngredient as Object; int itemLevel = 5; - if ((int)o.parentSheetIndex == 789 || (int)o.parentSheetIndex == 71) + if (IsItemMayorShorts(o)) { likeLevel = 6; break; diff --git a/StardewValley/Farmer.cs b/StardewValley/Farmer.cs index 0fdcbc9..3b6fa12 100644 --- a/StardewValley/Farmer.cs +++ b/StardewValley/Farmer.cs @@ -2985,7 +2985,7 @@ public void addItemByMenuIfNecessaryElseHoldUp(Item item, ItemGrabMenu.behaviorO { item }, itemSelectedCallback); - if (Game1.activeClickableMenu == null && (int)mostRecentlyGrabbedItem.parentSheetIndex != 434) + if (Game1.activeClickableMenu == null && !Utility.IsNormalObjectAtParentSheetIndex(mostRecentlyGrabbedItem, 434)) { holdUpItemThenMessage(item); } @@ -3005,7 +3005,7 @@ public void addItemsByMenuIfNecessary(List itemsToAdd, ItemGrabMenu.behavi { return; } - if (itemsToAdd.Count > 0 && itemsToAdd[0] is Object && (int)(itemsToAdd[0] as Object).parentSheetIndex == 434) + if (itemsToAdd.Count > 0 && itemsToAdd[0] is Object && Utility.IsNormalObjectAtParentSheetIndex(itemsToAdd[0], 434)) { eatObject(itemsToAdd[0] as Object, overrideFullness: true); if (Game1.activeClickableMenu != null) @@ -3118,7 +3118,7 @@ public void showCarrying() { mostRecentlyGrabbedItem = ActiveObject; } - if (IsLocalPlayer && mostRecentlyGrabbedItem != null && mostRecentlyGrabbedItem is Object && (mostRecentlyGrabbedItem as Object).ParentSheetIndex == 434) + if (IsLocalPlayer && mostRecentlyGrabbedItem != null && mostRecentlyGrabbedItem is Object && Utility.IsNormalObjectAtParentSheetIndex(mostRecentlyGrabbedItem, 434)) { eatHeldObject(); } @@ -3357,10 +3357,10 @@ public static void showEatingItem(Farmer who) switch (who.FarmerSprite.currentAnimationIndex) { case 1: - tempSprite2 = ((!who.IsLocalPlayer || who.itemToEat == null || !(who.itemToEat is Object) || (who.itemToEat as Object).ParentSheetIndex != 434) ? new TemporaryAnimatedSprite("Maps\\springobjects", Game1.getSourceRectForStandardTileSheet(Game1.objectSpriteSheet, (who.itemToEat as Object).parentSheetIndex, 16, 16), 254f, 1, 0, who.Position + new Vector2(-21f, -112f), flicker: false, flipped: false, (float)who.getStandingY() / 10000f + 0.01f, 0f, Color.White, 4f, 0f, 0f, 0f) : new TemporaryAnimatedSprite("LooseSprites\\Cursors", new Microsoft.Xna.Framework.Rectangle(368, 16, 16, 16), 62.75f, 8, 2, who.Position + new Vector2(-21f, -112f), flicker: false, flipped: false, (float)who.getStandingY() / 10000f + 0.01f, 0f, Color.White, 4f, 0f, 0f, 0f)); + tempSprite2 = ((!who.IsLocalPlayer || who.itemToEat == null || !(who.itemToEat is Object) || !Utility.IsNormalObjectAtParentSheetIndex(who.itemToEat, 434)) ? new TemporaryAnimatedSprite("Maps\\springobjects", Game1.getSourceRectForStandardTileSheet(Game1.objectSpriteSheet, (who.itemToEat as Object).parentSheetIndex, 16, 16), 254f, 1, 0, who.Position + new Vector2(-21f, -112f), flicker: false, flipped: false, (float)who.getStandingY() / 10000f + 0.01f, 0f, Color.White, 4f, 0f, 0f, 0f) : new TemporaryAnimatedSprite("LooseSprites\\Cursors", new Microsoft.Xna.Framework.Rectangle(368, 16, 16, 16), 62.75f, 8, 2, who.Position + new Vector2(-21f, -112f), flicker: false, flipped: false, (float)who.getStandingY() / 10000f + 0.01f, 0f, Color.White, 4f, 0f, 0f, 0f)); break; case 2: - if (who.IsLocalPlayer && who.itemToEat != null && who.itemToEat is Object && (who.itemToEat as Object).ParentSheetIndex == 434) + if (who.IsLocalPlayer && who.itemToEat != null && who.itemToEat is Object && Utility.IsNormalObjectAtParentSheetIndex(who.itemToEat, 434)) { tempSprite2 = new TemporaryAnimatedSprite("LooseSprites\\Cursors", new Microsoft.Xna.Framework.Rectangle(368, 16, 16, 16), 81.25f, 8, 0, who.Position + new Vector2(-21f, -108f), flicker: false, flipped: false, (float)who.getStandingY() / 10000f + 0.01f, 0f, Color.White, 4f, -0.01f, 0f, 0f) { @@ -3497,7 +3497,7 @@ public static void showHoldingItem(Farmer who) scale = 4f, layerDepth = 1f }); - if (who.IsLocalPlayer && (int)who.mostRecentlyGrabbedItem.parentSheetIndex == 434) + if (who.IsLocalPlayer && Utility.IsNormalObjectAtParentSheetIndex(who.mostRecentlyGrabbedItem, 434)) { who.eatHeldObject(); } @@ -7643,7 +7643,7 @@ public void addSeenResponse(int id) public void eatObject(Object o, bool overrideFullness = false) { - if (o.ParentSheetIndex == 434) + if (Utility.IsNormalObjectAtParentSheetIndex(o, 434)) { Game1.changeMusicTrack("none"); Game1.multiplayer.globalChatInfoMessage("Stardrop", base.Name); diff --git a/StardewValley/Game1.cs b/StardewValley/Game1.cs index 0f88224..afcdf1f 100644 --- a/StardewValley/Game1.cs +++ b/StardewValley/Game1.cs @@ -146,7 +146,7 @@ public enum MusicContext public const byte errorLogMode = 11; - public static readonly string version = "1.4.3"; + public static readonly string version = "1.4.5"; public const float keyPollingThreshold = 650f; @@ -2408,6 +2408,15 @@ public static void applySaveFix(SaveGame.SaveFixes save_fix) l.largeTerrainFeatures.Add(new Bush(new Vector2(105f, 18f), 0, l)); break; } + case SaveGame.SaveFixes.MissingQisChallenge: + foreach (Farmer farmer in getAllFarmers()) + { + if (farmer.mailReceived.Contains("skullCave") && !farmer.hasQuest(20) && !farmer.hasOrWillReceiveMail("QiChallengeComplete")) + { + farmer.addQuest(20); + } + } + break; } } @@ -2734,7 +2743,7 @@ public static void loadForNewGame(bool loadedGame = false) currentCursorTile = Vector2.Zero; if (!loadedGame) { - lastAppliedSaveFix = SaveGame.SaveFixes.quarryMineBushes; + lastAppliedSaveFix = SaveGame.SaveFixes.MissingQisChallenge; } resetVariables(); chanceToRainTomorrow = 0.0; diff --git a/StardewValley/GameLocation.cs b/StardewValley/GameLocation.cs index df818c2..89fea90 100644 --- a/StardewValley/GameLocation.cs +++ b/StardewValley/GameLocation.cs @@ -1285,7 +1285,7 @@ public virtual bool isCollidingPosition(Microsoft.Xna.Framework.Rectangle positi } } tmp6 = map.GetLayer("Buildings").PickTile(new Location(position.Right, position.Bottom), viewport.Size); - if (tmp6 != null && ((passable == null) | isFarmer)) + if (tmp6 != null) { tmp6.TileIndexProperties.TryGetValue("Shadow", out passable); if (passable == null) @@ -1306,7 +1306,7 @@ public virtual bool isCollidingPosition(Microsoft.Xna.Framework.Rectangle positi } } tmp6 = map.GetLayer("Buildings").PickTile(new Location(position.Left, position.Top), viewport.Size); - if (tmp6 != null && ((passable == null) | isFarmer)) + if (tmp6 != null) { tmp6.TileIndexProperties.TryGetValue("Shadow", out passable); if (passable == null) @@ -1327,7 +1327,7 @@ public virtual bool isCollidingPosition(Microsoft.Xna.Framework.Rectangle positi } } tmp6 = map.GetLayer("Buildings").PickTile(new Location(position.Left, position.Bottom), viewport.Size); - if (tmp6 != null && ((passable == null) | isFarmer)) + if (tmp6 != null) { tmp6.TileIndexProperties.TryGetValue("Shadow", out passable); if (passable == null) @@ -1350,7 +1350,7 @@ public virtual bool isCollidingPosition(Microsoft.Xna.Framework.Rectangle positi if (biggerThanTile) { tmp6 = map.GetLayer("Buildings").PickTile(new Location(position.Center.X, position.Top), viewport.Size); - if (tmp6 != null && ((passable == null) | isFarmer)) + if (tmp6 != null) { tmp6.TileIndexProperties.TryGetValue("Shadow", out passable); if (passable == null) @@ -1371,7 +1371,7 @@ public virtual bool isCollidingPosition(Microsoft.Xna.Framework.Rectangle positi } } tmp6 = map.GetLayer("Buildings").PickTile(new Location(position.Center.X, position.Bottom), viewport.Size); - if (tmp6 != null && ((passable == null) | isFarmer)) + if (tmp6 != null) { tmp6.TileIndexProperties.TryGetValue("Shadow", out passable); if (passable == null) @@ -2521,7 +2521,7 @@ private bool isMonsterDamageApplicable(Farmer who, Monster monster, bool horizon pointInQuestion.X += Math.Sign(xDif); xDif -= Math.Sign(xDif); } - if (objects.ContainsKey(pointInQuestion) || getTileIndexAt((int)pointInQuestion.X, (int)pointInQuestion.Y, "Buildings") != -1) + if ((objects.ContainsKey(pointInQuestion) && !objects[pointInQuestion].isPassable()) || getTileIndexAt((int)pointInQuestion.X, (int)pointInQuestion.Y, "Buildings") != -1) { return false; } @@ -2534,169 +2534,168 @@ private bool isMonsterDamageApplicable(Farmer who, Monster monster, bool horizon public bool damageMonster(Microsoft.Xna.Framework.Rectangle areaOfEffect, int minDamage, int maxDamage, bool isBomb, float knockBackModifier, int addedPrecision, float critChance, float critMultiplier, bool triggerMonsterInvincibleTimer, Farmer who) { bool didAnyDamage = false; - int i; - for (i = characters.Count - 1; i >= 0; i--) + for (int i = characters.Count - 1; i >= 0; i--) { - if (i >= characters.Count || !characters[i].GetBoundingBox().Intersects(areaOfEffect) || !characters[i].IsMonster || ((Monster)characters[i]).Health <= 0 || characters[i].IsInvisible || (characters[i] as Monster).isInvincible() || (characters[i] as Monster).isInvincible() || (!isBomb && !isMonsterDamageApplicable(who, characters[i] as Monster) && !isMonsterDamageApplicable(who, characters[i] as Monster, horizontalBias: false))) - { - continue; - } - bool isDagger = who != null && who.CurrentTool != null && who.CurrentTool is MeleeWeapon && (int)(who.CurrentTool as MeleeWeapon).type == 1; - didAnyDamage = true; - if (Game1.currentLocation == this) - { - Rumble.rumble(0.1f + (float)(Game1.random.NextDouble() / 8.0), 200 + Game1.random.Next(-50, 50)); - } - Microsoft.Xna.Framework.Rectangle monsterBox = characters[i].GetBoundingBox(); - Vector2 trajectory = Utility.getAwayFromPlayerTrajectory(monsterBox, who); - if (!(knockBackModifier > 0f)) - { - trajectory = new Vector2(characters[i].xVelocity, characters[i].yVelocity); - } - else - { - trajectory *= knockBackModifier; - } - if ((characters[i] as Monster).Slipperiness == -1) - { - trajectory = Vector2.Zero; - } - bool crit = false; - int damageAmount5 = 0; - if (who != null && who.CurrentTool != null && characters[i].hitWithTool(who.CurrentTool)) - { - return false; - } - if (who.professions.Contains(25)) - { - critChance += critChance * 0.5f; - } - if (maxDamage >= 0) + Monster monster; + if (i < characters.Count && (monster = (characters[i] as Monster)) != null && monster.IsMonster && monster.Health > 0 && monster.GetBoundingBox().Intersects(areaOfEffect) && !monster.IsInvisible && !monster.isInvincible() && (isBomb || isMonsterDamageApplicable(who, monster) || isMonsterDamageApplicable(who, monster, horizontalBias: false))) { - damageAmount5 = Game1.random.Next(minDamage, maxDamage + 1); - if (who != null && Game1.random.NextDouble() < (double)(critChance + (float)who.LuckLevel * (critChance / 40f))) - { - crit = true; - playSound("crit"); - } - damageAmount5 = (crit ? ((int)((float)damageAmount5 * critMultiplier)) : damageAmount5); - damageAmount5 = Math.Max(1, damageAmount5 + ((who != null) ? (who.attack * 3) : 0)); - if (who != null && who.professions.Contains(24)) + bool isDagger = who != null && who.CurrentTool != null && who.CurrentTool is MeleeWeapon && (int)(who.CurrentTool as MeleeWeapon).type == 1; + didAnyDamage = true; + if (Game1.currentLocation == this) { - damageAmount5 = (int)Math.Ceiling((float)damageAmount5 * 1.1f); + Rumble.rumble(0.1f + (float)(Game1.random.NextDouble() / 8.0), 200 + Game1.random.Next(-50, 50)); } - if (who != null && who.professions.Contains(26)) + Microsoft.Xna.Framework.Rectangle monsterBox = monster.GetBoundingBox(); + Vector2 trajectory = Utility.getAwayFromPlayerTrajectory(monsterBox, who); + if (!(knockBackModifier > 0f)) { - damageAmount5 = (int)Math.Ceiling((float)damageAmount5 * 1.15f); - } - if (who != null && crit && who.professions.Contains(29)) - { - damageAmount5 *= 3; - } - damageAmount5 = ((Monster)characters[i]).takeDamage(damageAmount5, (int)trajectory.X, (int)trajectory.Y, isBomb, (double)addedPrecision / 10.0, who); - if (damageAmount5 == -1) - { - debris.Add(new Debris("Miss", 1, new Vector2(monsterBox.Center.X, monsterBox.Center.Y), Color.LightGray, 1f, 0f)); + trajectory = new Vector2(monster.xVelocity, monster.yVelocity); } else { - debris.Filter((Debris d) => d.toHover == null || !d.toHover.Equals(characters[i]) || d.nonSpriteChunkColor.Equals(Color.Yellow) || !(d.timeSinceDoneBouncing > 900f)); - debris.Add(new Debris(damageAmount5, new Vector2(monsterBox.Center.X + 16, monsterBox.Center.Y), crit ? Color.Yellow : new Color(255, 130, 0), crit ? (1f + (float)damageAmount5 / 300f) : 1f, characters[i])); + trajectory *= knockBackModifier; } - if (triggerMonsterInvincibleTimer) + if (monster.Slipperiness == -1) { - (characters[i] as Monster).setInvincibleCountdown(450 / (isDagger ? 3 : 2)); + trajectory = Vector2.Zero; } - } - else - { - damageAmount5 = -2; - characters[i].setTrajectory(trajectory); - if (((Monster)characters[i]).Slipperiness > 10) + bool crit = false; + int damageAmount5 = 0; + if (who != null && who.CurrentTool != null && monster.hitWithTool(who.CurrentTool)) { - characters[i].xVelocity /= 2f; - characters[i].yVelocity /= 2f; - } - } - if (who != null && who.CurrentTool != null && who.CurrentTool.Name.Equals("Galaxy Sword")) - { - Game1.multiplayer.broadcastSprites(this, new TemporaryAnimatedSprite(362, Game1.random.Next(50, 120), 6, 1, new Vector2(monsterBox.Center.X - 32, monsterBox.Center.Y - 32), flicker: false, flipped: false)); - } - if (((Monster)characters[i]).Health <= 0) - { - if (!isFarm) - { - who.checkForQuestComplete(null, 1, 1, null, characters[i].Name, 4); - } - Monster monster = characters[i] as Monster; - if (who != null && who.leftRing.Value != null) - { - who.leftRing.Value.onMonsterSlay(monster, this, who); + return false; } - if (who != null && who.rightRing.Value != null) + if (who.professions.Contains(25)) { - who.rightRing.Value.onMonsterSlay(monster, this, who); + critChance += critChance * 0.5f; } - if (who != null && !isFarm && (!(monster is GreenSlime) || (bool)(monster as GreenSlime).firstGeneration)) + if (maxDamage >= 0) { - if (who.IsLocalPlayer) + damageAmount5 = Game1.random.Next(minDamage, maxDamage + 1); + if (who != null && Game1.random.NextDouble() < (double)(critChance + (float)who.LuckLevel * (critChance / 40f))) { - Game1.stats.monsterKilled(monster.Name); + crit = true; + playSound("crit"); } - else if (Game1.IsMasterGame) + damageAmount5 = (crit ? ((int)((float)damageAmount5 * critMultiplier)) : damageAmount5); + damageAmount5 = Math.Max(1, damageAmount5 + ((who != null) ? (who.attack * 3) : 0)); + if (who != null && who.professions.Contains(24)) { - who.queueMessage(25, Game1.player, monster.Name); + damageAmount5 = (int)Math.Ceiling((float)damageAmount5 * 1.1f); + } + if (who != null && who.professions.Contains(26)) + { + damageAmount5 = (int)Math.Ceiling((float)damageAmount5 * 1.15f); + } + if (who != null && crit && who.professions.Contains(29)) + { + damageAmount5 *= 3; + } + damageAmount5 = monster.takeDamage(damageAmount5, (int)trajectory.X, (int)trajectory.Y, isBomb, (double)addedPrecision / 10.0, who); + if (damageAmount5 == -1) + { + debris.Add(new Debris("Miss", 1, new Vector2(monsterBox.Center.X, monsterBox.Center.Y), Color.LightGray, 1f, 0f)); + } + else + { + debris.Filter((Debris d) => d.toHover == null || !d.toHover.Equals(monster) || d.nonSpriteChunkColor.Equals(Color.Yellow) || !(d.timeSinceDoneBouncing > 900f)); + debris.Add(new Debris(damageAmount5, new Vector2(monsterBox.Center.X + 16, monsterBox.Center.Y), crit ? Color.Yellow : new Color(255, 130, 0), crit ? (1f + (float)damageAmount5 / 300f) : 1f, monster)); + } + if (triggerMonsterInvincibleTimer) + { + monster.setInvincibleCountdown(450 / (isDagger ? 3 : 2)); } } - monsterDrop(monster, monsterBox.Center.X, monsterBox.Center.Y, who); - if (who != null && !isFarm) + else { - who.gainExperience(4, monster.ExperienceGained); + damageAmount5 = -2; + monster.setTrajectory(trajectory); + if (monster.Slipperiness > 10) + { + monster.xVelocity /= 2f; + monster.yVelocity /= 2f; + } } - characters.Remove(monster); - Game1.stats.MonstersKilled++; - } - else if (damageAmount5 > 0) - { - ((Monster)characters[i]).shedChunks(Game1.random.Next(1, 3)); - if (crit) + if (who != null && who.CurrentTool != null && who.CurrentTool.Name.Equals("Galaxy Sword")) { - Game1.multiplayer.broadcastSprites(this, new TemporaryAnimatedSprite(362, Game1.random.Next(15, 50), 6, 1, characters[i].getStandingPosition() - new Vector2(32f, 32f), flicker: false, (Game1.random.NextDouble() < 0.5) ? true : false) + Game1.multiplayer.broadcastSprites(this, new TemporaryAnimatedSprite(362, Game1.random.Next(50, 120), 6, 1, new Vector2(monsterBox.Center.X - 32, monsterBox.Center.Y - 32), flicker: false, flipped: false)); + } + if (monster.Health <= 0) + { + if (!isFarm) { - scale = 0.75f, - alpha = (crit ? 0.75f : 0.5f) - }); - Game1.multiplayer.broadcastSprites(this, new TemporaryAnimatedSprite(362, Game1.random.Next(15, 50), 6, 1, characters[i].getStandingPosition() - new Vector2(32 + Game1.random.Next(-21, 21) + 32, 32 + Game1.random.Next(-21, 21)), flicker: false, (Game1.random.NextDouble() < 0.5) ? true : false) + who.checkForQuestComplete(null, 1, 1, null, monster.Name, 4); + } + if (who != null && who.leftRing.Value != null) { - scale = 0.5f, - delayBeforeAnimationStart = 50, - alpha = (crit ? 0.75f : 0.5f) - }); - Game1.multiplayer.broadcastSprites(this, new TemporaryAnimatedSprite(362, Game1.random.Next(15, 50), 6, 1, characters[i].getStandingPosition() - new Vector2(32 + Game1.random.Next(-21, 21) - 32, 32 + Game1.random.Next(-21, 21)), flicker: false, (Game1.random.NextDouble() < 0.5) ? true : false) + who.leftRing.Value.onMonsterSlay(monster, this, who); + } + if (who != null && who.rightRing.Value != null) { - scale = 0.5f, - delayBeforeAnimationStart = 100, - alpha = (crit ? 0.75f : 0.5f) - }); - Game1.multiplayer.broadcastSprites(this, new TemporaryAnimatedSprite(362, Game1.random.Next(15, 50), 6, 1, characters[i].getStandingPosition() - new Vector2(32 + Game1.random.Next(-21, 21) + 32, 32 + Game1.random.Next(-21, 21)), flicker: false, (Game1.random.NextDouble() < 0.5) ? true : false) + who.rightRing.Value.onMonsterSlay(monster, this, who); + } + if (who != null && !isFarm && (!(monster is GreenSlime) || (bool)(monster as GreenSlime).firstGeneration)) { - scale = 0.5f, - delayBeforeAnimationStart = 150, - alpha = (crit ? 0.75f : 0.5f) - }); - Game1.multiplayer.broadcastSprites(this, new TemporaryAnimatedSprite(362, Game1.random.Next(15, 50), 6, 1, characters[i].getStandingPosition() - new Vector2(32 + Game1.random.Next(-21, 21) - 32, 32 + Game1.random.Next(-21, 21)), flicker: false, (Game1.random.NextDouble() < 0.5) ? true : false) + if (who.IsLocalPlayer) + { + Game1.stats.monsterKilled(monster.Name); + } + else if (Game1.IsMasterGame) + { + who.queueMessage(25, Game1.player, monster.Name); + } + } + monsterDrop(monster, monsterBox.Center.X, monsterBox.Center.Y, who); + if (who != null && !isFarm) { - scale = 0.5f, - delayBeforeAnimationStart = 200, - alpha = (crit ? 0.75f : 0.5f) - }); + who.gainExperience(4, monster.ExperienceGained); + } + characters.Remove(monster); + Game1.stats.MonstersKilled++; + } + else if (damageAmount5 > 0) + { + monster.shedChunks(Game1.random.Next(1, 3)); + if (crit) + { + Vector2 standPos = monster.getStandingPosition(); + Game1.multiplayer.broadcastSprites(this, new TemporaryAnimatedSprite(362, Game1.random.Next(15, 50), 6, 1, standPos - new Vector2(32f, 32f), flicker: false, (Game1.random.NextDouble() < 0.5) ? true : false) + { + scale = 0.75f, + alpha = (crit ? 0.75f : 0.5f) + }); + Game1.multiplayer.broadcastSprites(this, new TemporaryAnimatedSprite(362, Game1.random.Next(15, 50), 6, 1, standPos - new Vector2(32 + Game1.random.Next(-21, 21) + 32, 32 + Game1.random.Next(-21, 21)), flicker: false, (Game1.random.NextDouble() < 0.5) ? true : false) + { + scale = 0.5f, + delayBeforeAnimationStart = 50, + alpha = (crit ? 0.75f : 0.5f) + }); + Game1.multiplayer.broadcastSprites(this, new TemporaryAnimatedSprite(362, Game1.random.Next(15, 50), 6, 1, standPos - new Vector2(32 + Game1.random.Next(-21, 21) - 32, 32 + Game1.random.Next(-21, 21)), flicker: false, (Game1.random.NextDouble() < 0.5) ? true : false) + { + scale = 0.5f, + delayBeforeAnimationStart = 100, + alpha = (crit ? 0.75f : 0.5f) + }); + Game1.multiplayer.broadcastSprites(this, new TemporaryAnimatedSprite(362, Game1.random.Next(15, 50), 6, 1, standPos - new Vector2(32 + Game1.random.Next(-21, 21) + 32, 32 + Game1.random.Next(-21, 21)), flicker: false, (Game1.random.NextDouble() < 0.5) ? true : false) + { + scale = 0.5f, + delayBeforeAnimationStart = 150, + alpha = (crit ? 0.75f : 0.5f) + }); + Game1.multiplayer.broadcastSprites(this, new TemporaryAnimatedSprite(362, Game1.random.Next(15, 50), 6, 1, standPos - new Vector2(32 + Game1.random.Next(-21, 21) - 32, 32 + Game1.random.Next(-21, 21)), flicker: false, (Game1.random.NextDouble() < 0.5) ? true : false) + { + scale = 0.5f, + delayBeforeAnimationStart = 200, + alpha = (crit ? 0.75f : 0.5f) + }); + } + } + if (damageAmount5 > 0 && who != null && damageAmount5 > 1 && Game1.player.CurrentTool != null && Game1.player.CurrentTool.Name.Equals("Dark Sword") && Game1.random.NextDouble() < 0.08) + { + who.health = Math.Min(who.maxHealth, Game1.player.health + damageAmount5 / 2); + debris.Add(new Debris(damageAmount5 / 2, new Vector2(Game1.player.getStandingX(), Game1.player.getStandingY()), Color.Lime, 1f, who)); + playSound("healSound"); } - } - if (damageAmount5 > 0 && who != null && damageAmount5 > 1 && Game1.player.CurrentTool != null && Game1.player.CurrentTool.Name.Equals("Dark Sword") && Game1.random.NextDouble() < 0.08) - { - who.health = Math.Min(who.maxHealth, Game1.player.health + damageAmount5 / 2); - debris.Add(new Debris(damageAmount5 / 2, new Vector2(Game1.player.getStandingX(), Game1.player.getStandingY()), Color.Lime, 1f, who)); - playSound("healSound"); } } return didAnyDamage; @@ -11196,7 +11195,7 @@ public void updateDoors() { doors.Add(new Point(x, y), new NetString("Sunroom")); } - else if ((!name.Equals("Mountain") || x != 8 || y != 20) && split.Length > 2) + else if ((!name.Equals("Mountain") || x != 8 || y != 20) && split.Length > 3) { doors.Add(new Point(x, y), new NetString(split[3])); } diff --git a/StardewValley/Locations/Desert.cs b/StardewValley/Locations/Desert.cs index 4136756..9ec9426 100644 --- a/StardewValley/Locations/Desert.cs +++ b/StardewValley/Locations/Desert.cs @@ -439,6 +439,10 @@ public override bool isCollidingPosition(Microsoft.Xna.Framework.Rectangle posit public override void performTenMinuteUpdate(int timeOfDay) { base.performTenMinuteUpdate(timeOfDay); + if (Game1.currentLocation != this) + { + return; + } if (isTravelingDeserteMerchantHere()) { if (Game1.random.NextDouble() < 0.33) @@ -732,6 +736,15 @@ public override void DayUpdate(int dayOfMonth) boughtMagicRockCandy = false; } + public override bool isTilePlaceable(Vector2 v, Item item = null) + { + if (v.X >= 33f && v.X < 46f && v.Y >= 20f && v.Y < 25f) + { + return false; + } + return base.isTilePlaceable(v, item); + } + public override bool shouldHideCharacters() { if (!drivingOff) diff --git a/StardewValley/Locations/FarmHouse.cs b/StardewValley/Locations/FarmHouse.cs index e8994e2..27c71f8 100644 --- a/StardewValley/Locations/FarmHouse.cs +++ b/StardewValley/Locations/FarmHouse.cs @@ -676,28 +676,79 @@ public virtual void showSpouseRoom() switch (upgradeLevel) { case 1: - spouseRoomBounds = new Microsoft.Xna.Framework.Rectangle(29, 4, 6, 6); + spouseRoomBounds = new Microsoft.Xna.Framework.Rectangle(28, 4, 7, 6); break; case 2: case 3: - spouseRoomBounds = new Microsoft.Xna.Framework.Rectangle(35, 13, 6, 6); + spouseRoomBounds = new Microsoft.Xna.Framework.Rectangle(34, 13, 7, 6); break; } + List collected_items = new List(); + Microsoft.Xna.Framework.Rectangle room_bounds = new Microsoft.Xna.Framework.Rectangle(spouseRoomBounds.X * 64, spouseRoomBounds.Y * 64, spouseRoomBounds.Width * 64, spouseRoomBounds.Height * 64); + foreach (Furniture placed_furniture in new List(furniture)) + { + if (placed_furniture.getBoundingBox(placed_furniture.tileLocation).Intersects(room_bounds)) + { + if (placed_furniture is StorageFurniture) + { + StorageFurniture storage_furniture = placed_furniture as StorageFurniture; + collected_items.AddRange(storage_furniture.heldItems); + storage_furniture.heldItems.Clear(); + } + if (placed_furniture.heldObject.Value != null) + { + collected_items.Add((Object)placed_furniture.heldObject); + placed_furniture.heldObject.Value = null; + } + collected_items.Add(placed_furniture); + furniture.Remove(placed_furniture); + } + } for (int x = spouseRoomBounds.X - 1; x <= spouseRoomBounds.Right; x++) { for (int y = spouseRoomBounds.Y; y <= spouseRoomBounds.Bottom; y++) { - Vector2 tile = new Vector2(x, y); - for (int i = furniture.Count - 1; i >= 0; i--) + Object tile_object = getObjectAtTile(x, y); + if (tile_object == null) { - if (furniture[i].tileLocation.Equals(tile)) + continue; + } + tile_object.performRemoveAction(new Vector2(x, y), this); + if (tile_object is IndoorPot) + { + IndoorPot garden_pot = tile_object as IndoorPot; + if (garden_pot.hoeDirt.Value != null && garden_pot.hoeDirt.Value.crop != null) { - Game1.createItemDebris(furniture[i], new Vector2(spouseRoomBounds.X, spouseRoomBounds.Center.Y) * 64f, 3); - furniture.RemoveAt(i); + garden_pot.hoeDirt.Value.destroyCrop(garden_pot.tileLocation, showAnimation: false, this); } } + else if (tile_object is Chest) + { + Chest chest = tile_object as Chest; + collected_items.AddRange(chest.items); + chest.items.Clear(); + } + if (tile_object.heldObject != null) + { + tile_object.heldObject.Value = null; + } + tile_object.minutesUntilReady.Value = -1; + if (tile_object.readyForHarvest.Value) + { + tile_object.readyForHarvest.Value = false; + } + collected_items.Add(getObjectAtTile(x, y)); + objects.Remove(new Vector2(x, y)); } } + if (upgradeLevel >= 2) + { + Utility.createOverflowChest(this, new Vector2(24f, 22f), collected_items); + } + else + { + Utility.createOverflowChest(this, new Vector2(21f, 10f), collected_items); + } } loadObjects(); if (upgradeLevel == 3) @@ -936,7 +987,7 @@ protected override void resetLocalState() } Object o2 = null; o2 = getObjectAtTile(x, y); - if (o2 != null && !(o2 is Chest) && !(o2 is StorageFurniture)) + if (o2 != null && !(o2 is Chest) && !(o2 is StorageFurniture) && !(o2 is IndoorPot)) { if (o2.Name != null && o2.Name.Contains("Table") && o2.heldObject.Value != null) { diff --git a/StardewValley/Locations/LibraryMuseum.cs b/StardewValley/Locations/LibraryMuseum.cs index aa1167f..8487f89 100644 --- a/StardewValley/Locations/LibraryMuseum.cs +++ b/StardewValley/Locations/LibraryMuseum.cs @@ -315,6 +315,9 @@ public List getRewardsForPlayer(Farmer who) if (!who.specialItems.Contains(499) && museumItems.Contains(114)) { AddRewardIfUncollected(who, rewards, new Object(499, 1)); + } + if (!who.knowsRecipe("Ancient Seeds") && museumItems.Contains(114)) + { AddRewardIfUncollected(who, rewards, new Object(499, 1, isRecipe: true)); } if (!who.specialBigCraftables.Contains(1301) && museumContainsTheseItems(new int[3] diff --git a/StardewValley/Locations/MineShaft.cs b/StardewValley/Locations/MineShaft.cs index afa3838..2e14634 100644 --- a/StardewValley/Locations/MineShaft.cs +++ b/StardewValley/Locations/MineShaft.cs @@ -2076,7 +2076,6 @@ public void loadLevel(int level) prepareElevator(); } } - Utility.CollectGarbage(); } public static void CheckForQiChallengeCompletion() diff --git a/StardewValley/Locations/Woods.cs b/StardewValley/Locations/Woods.cs index 4781819..73c942f 100644 --- a/StardewValley/Locations/Woods.cs +++ b/StardewValley/Locations/Woods.cs @@ -72,7 +72,7 @@ public override void checkForMusic(GameTime time) { Game1.changeMusicTrack("rain"); } - else + else if (!Game1.isDarkOut()) { Game1.changeMusicTrack(Game1.currentSeason + "_day_ambient"); } diff --git a/StardewValley/Menus/CharacterCustomization.cs b/StardewValley/Menus/CharacterCustomization.cs index 9d4f25f..3a55720 100644 --- a/StardewValley/Menus/CharacterCustomization.cs +++ b/StardewValley/Menus/CharacterCustomization.cs @@ -458,6 +458,7 @@ public override void gameWindowSizeChanged(Rectangle oldBounds, Rectangle newBou private void setUpPositions() { + colorPickerCCs.Clear(); if (source == Source.ClothesDye && _itemToDye == null) { return; diff --git a/StardewValley/Menus/CraftingPage.cs b/StardewValley/Menus/CraftingPage.cs index 0d3c3d6..14482fa 100644 --- a/StardewValley/Menus/CraftingPage.cs +++ b/StardewValley/Menus/CraftingPage.cs @@ -414,7 +414,6 @@ protected void _UpdateCurrentPageButtons() private void clickCraftingRecipe(ClickableTextureComponent c, bool playSound = true) { Item crafted = pagesOfCraftingRecipes[currentCraftingPage][c].createItem(); - Game1.player.checkForQuestComplete(null, -1, -1, crafted, null, 2); if (heldItem == null) { pagesOfCraftingRecipes[currentCraftingPage][c].consumeIngredients(_materialContainers); @@ -424,8 +423,12 @@ private void clickCraftingRecipe(ClickableTextureComponent c, bool playSound = t Game1.playSound("coin"); } } - else if (heldItem.Name.Equals(crafted.Name) && heldItem.Stack + pagesOfCraftingRecipes[currentCraftingPage][c].numberProducedPerCraft - 1 < heldItem.maximumStackSize()) + else { + if (!heldItem.Name.Equals(crafted.Name) || heldItem.Stack + pagesOfCraftingRecipes[currentCraftingPage][c].numberProducedPerCraft - 1 >= heldItem.maximumStackSize()) + { + return; + } heldItem.Stack += pagesOfCraftingRecipes[currentCraftingPage][c].numberProducedPerCraft; pagesOfCraftingRecipes[currentCraftingPage][c].consumeIngredients(_materialContainers); if (playSound) @@ -433,6 +436,7 @@ private void clickCraftingRecipe(ClickableTextureComponent c, bool playSound = t Game1.playSound("coin"); } } + Game1.player.checkForQuestComplete(null, -1, -1, crafted, null, 2); if (!cooking && Game1.player.craftingRecipes.ContainsKey(pagesOfCraftingRecipes[currentCraftingPage][c].name)) { Game1.player.craftingRecipes[pagesOfCraftingRecipes[currentCraftingPage][c].name] += pagesOfCraftingRecipes[currentCraftingPage][c].numberProducedPerCraft; diff --git a/StardewValley/Menus/InventoryPage.cs b/StardewValley/Menus/InventoryPage.cs index 9196f9a..ff46699 100644 --- a/StardewValley/Menus/InventoryPage.cs +++ b/StardewValley/Menus/InventoryPage.cs @@ -397,7 +397,7 @@ public override void receiveLeftClick(int x, int y, bool playSound = true) } } setHeldItem(inventory.leftClick(x, y, takeHeldItem(), !Game1.oldKBState.IsKeyDown(Keys.LeftShift))); - if (checkHeldItem((Item i) => i != null && i is Object && (i as Object).ParentSheetIndex == 434)) + if (checkHeldItem((Item i) => i != null && Utility.IsNormalObjectAtParentSheetIndex(i, 434))) { Game1.playSound("smallSelect"); Game1.player.eatObject(takeHeldItem() as Object, overrideFullness: true); diff --git a/StardewValley/Menus/ItemGrabMenu.cs b/StardewValley/Menus/ItemGrabMenu.cs index 9d86f83..a62cf64 100644 --- a/StardewValley/Menus/ItemGrabMenu.cs +++ b/StardewValley/Menus/ItemGrabMenu.cs @@ -563,7 +563,7 @@ public override void receiveRightClick(int x, int y, bool playSound = true) (Game1.activeClickableMenu as ItemGrabMenu).snapCursorToCurrentSnappedComponent(); } } - if (heldItem is Object && (int)(heldItem as Object).parentSheetIndex == 326) + if (Utility.IsNormalObjectAtParentSheetIndex(heldItem, 326)) { heldItem = null; Game1.player.canUnderstandDwarves = true; diff --git a/StardewValley/Menus/LevelUpMenu.cs b/StardewValley/Menus/LevelUpMenu.cs index be8c841..ee71d83 100644 --- a/StardewValley/Menus/LevelUpMenu.cs +++ b/StardewValley/Menus/LevelUpMenu.cs @@ -851,7 +851,7 @@ public override void draw(SpriteBatch b) } okButton.draw(b); } - if (!Game1.options.gamepadControls || !isProfessionChooser || hasMovedSelection) + if (!Game1.options.SnappyMenus || !isProfessionChooser || hasMovedSelection) { drawMouse(b); } diff --git a/StardewValley/Menus/TitleMenu.cs b/StardewValley/Menus/TitleMenu.cs index 458277a..adeece6 100644 --- a/StardewValley/Menus/TitleMenu.cs +++ b/StardewValley/Menus/TitleMenu.cs @@ -1681,7 +1681,7 @@ private void showButterflies() { Game1.playSound("yoba"); int zoom = (height < 800) ? 2 : 3; - tempSprites.Add(new TemporaryAnimatedSprite("Tilesheets\\Critters", new Rectangle(128, 96, 16, 16), new Vector2(width / 2 - 240 * zoom, -300 * zoom - (int)(viewportY / 3f) * zoom + 86 * zoom), flipped: false, 0f, Color.White) + tempSprites.Add(new TemporaryAnimatedSprite("TileSheets\\critters", new Rectangle(128, 96, 16, 16), new Vector2(width / 2 - 240 * zoom, -300 * zoom - (int)(viewportY / 3f) * zoom + 86 * zoom), flipped: false, 0f, Color.White) { scale = zoom, animationLength = 4, @@ -1705,7 +1705,7 @@ private void showButterflies() item.scale = (float)zoom / 4f; } tempSprites.AddRange(l); - tempSprites.Add(new TemporaryAnimatedSprite("Tilesheets\\Critters", new Rectangle(192, 96, 16, 16), new Vector2(width / 2 + 220 * zoom, -300 * zoom - (int)(viewportY / 3f) * zoom + 15 * zoom), flipped: false, 0f, Color.White) + tempSprites.Add(new TemporaryAnimatedSprite("TileSheets\\critters", new Rectangle(192, 96, 16, 16), new Vector2(width / 2 + 220 * zoom, -300 * zoom - (int)(viewportY / 3f) * zoom + 15 * zoom), flipped: false, 0f, Color.White) { scale = zoom, animationLength = 4, @@ -1730,7 +1730,7 @@ private void showButterflies() item2.scale = (float)zoom / 4f; } tempSprites.AddRange(l); - tempSprites.Add(new TemporaryAnimatedSprite("Tilesheets\\Critters", new Rectangle(256, 96, 16, 16), new Vector2(width / 2 - 250 * zoom, -300 * zoom - (int)(viewportY / 3f) * zoom + 35 * zoom), flipped: false, 0f, Color.White) + tempSprites.Add(new TemporaryAnimatedSprite("TileSheets\\critters", new Rectangle(256, 96, 16, 16), new Vector2(width / 2 - 250 * zoom, -300 * zoom - (int)(viewportY / 3f) * zoom + 35 * zoom), flipped: false, 0f, Color.White) { scale = zoom, animationLength = 4, @@ -1755,7 +1755,7 @@ private void showButterflies() item3.scale = (float)zoom / 4f; } tempSprites.AddRange(l); - tempSprites.Add(new TemporaryAnimatedSprite("Tilesheets\\Critters", new Rectangle(256, 112, 16, 16), new Vector2(width / 2 + 250 * zoom, -300 * zoom - (int)(viewportY / 3f) * zoom + 60 * zoom), flipped: false, 0f, Color.White) + tempSprites.Add(new TemporaryAnimatedSprite("TileSheets\\critters", new Rectangle(256, 112, 16, 16), new Vector2(width / 2 + 250 * zoom, -300 * zoom - (int)(viewportY / 3f) * zoom + 60 * zoom), flipped: false, 0f, Color.White) { scale = zoom, animationLength = 4, diff --git a/StardewValley/Minigames/FishingGame.cs b/StardewValley/Minigames/FishingGame.cs index 5b9932c..fa602a0 100644 --- a/StardewValley/Minigames/FishingGame.cs +++ b/StardewValley/Minigames/FishingGame.cs @@ -237,7 +237,11 @@ public void receiveKeyPress(Keys k) } if (k == Keys.Escape) { - if (Game1.activeClickableMenu == null) + if (gameEndTimer <= 0 && !gameDone) + { + EmergencyCancel(); + } + else if (Game1.activeClickableMenu == null) { gameEndTimer = 1; } @@ -251,10 +255,6 @@ public void receiveKeyPress(Keys k) { Game1.player.setRunning(isRunning: true); } - if (k == Keys.End) - { - gameEndTimer -= 10000; - } } public void receiveKeyRelease(Keys k) @@ -289,6 +289,20 @@ public void receiveKeyRelease(Keys k) } } + public virtual void EmergencyCancel() + { + Game1.player.Halt(); + Game1.player.isEating = false; + Game1.player.CanMove = true; + Game1.player.UsingTool = false; + Game1.player.usingSlingshot = false; + Game1.player.FarmerSprite.PauseForSingleAnimation = false; + if (Game1.player.CurrentTool is FishingRod) + { + (Game1.player.CurrentTool as FishingRod).resetState(); + } + } + private void handleCastInput() { if (timerToStart <= 0 && showResultsTimer < 0 && !gameDone && Game1.activeClickableMenu == null && !(Game1.player.CurrentTool as FishingRod).hit && !(Game1.player.CurrentTool as FishingRod).pullingOutOfWater && !(Game1.player.CurrentTool as FishingRod).isCasting && !(Game1.player.CurrentTool as FishingRod).fishCaught && !(Game1.player.CurrentTool as FishingRod).castedButBobberStillInAir) diff --git a/StardewValley/Multiplayer.cs b/StardewValley/Multiplayer.cs index 676440e..403769e 100644 --- a/StardewValley/Multiplayer.cs +++ b/StardewValley/Multiplayer.cs @@ -302,7 +302,7 @@ public enum DisconnectType public static string kicked = "KICKED"; - public string protocolVersion = "1.4.0.1"; + public string protocolVersion = "1.4.5"; public readonly NetLogger logging = new NetLogger(); diff --git a/StardewValley/NPC.cs b/StardewValley/NPC.cs index 82f4b01..9acab3f 100644 --- a/StardewValley/NPC.cs +++ b/StardewValley/NPC.cs @@ -1704,7 +1704,7 @@ public virtual void tryToReceiveActiveObject(Farmer who) who.reduceActiveItemByOne(); who.completelyStopAnimatingOrDoingAction(); faceTowardFarmerForPeriod(4000, 3, faceAway: false, who); - if ((bool)datable && who.spouse != null && !who.spouse.Contains(base.Name) && Utility.isMale(who.spouse) == Utility.isMale(base.Name) && Game1.random.NextDouble() < 0.3 - (double)((float)who.LuckLevel / 100f) - who.DailyLuck && !isBirthday(Game1.currentSeason, Game1.dayOfMonth) && who.friendshipData[base.Name].IsDating()) + if ((bool)datable && who.spouse != null && !who.spouse.Contains(base.Name) && !who.spouse.Contains("Krobus") && Utility.isMale(who.spouse) == Utility.isMale(base.Name) && Game1.random.NextDouble() < 0.3 - (double)((float)who.LuckLevel / 100f) - who.DailyLuck && !isBirthday(Game1.currentSeason, Game1.dayOfMonth) && who.friendshipData[base.Name].IsDating()) { NPC spouse = Game1.getCharacterFromName(who.spouse); who.changeFriendship(-30, spouse); @@ -5166,7 +5166,7 @@ public void marriageDuties() else { addMarriageDialogue("Strings\\StringsFromCSFiles", "NPC.cs.4466", false, "%endearment"); - addMarriageDialogue("Strings\\StringsFromCSFiles", "NPC.cs.4462", false); + addMarriageDialogue("Strings\\StringsFromCSFiles", "NPC.cs.4462", true); if (filledBowl) { addMarriageDialogue("Strings\\StringsFromCSFiles", "NPC.cs.4463", false, Game1.player.getPetDisplayName()); diff --git a/StardewValley/Object.cs b/StardewValley/Object.cs index 4b3c5a4..1f65fa4 100644 --- a/StardewValley/Object.cs +++ b/StardewValley/Object.cs @@ -1557,6 +1557,10 @@ public virtual bool performObjectDropInAction(Item dropInItem, bool probe, Farme if (dropInItem is Object) { Object dropIn = dropInItem as Object; + if (dropInItem is Wallpaper) + { + return false; + } if (heldObject.Value != null && !name.Equals("Recycling Machine") && !name.Equals("Crystalarium")) { return false; @@ -1569,6 +1573,10 @@ public virtual bool performObjectDropInAction(Item dropInItem, bool probe, Farme { scale.X = 5f; } + if (probe && MinutesUntilReady > 0) + { + return false; + } if (name.Equals("Incubator")) { if (heldObject.Value == null && (dropIn.Category == -5 || Utility.IsNormalObjectAtParentSheetIndex(dropIn, 107))) @@ -4235,7 +4243,7 @@ public override bool canBePlacedHere(GameLocation l, Vector2 tile) } return false; } - if (((int)category == -74 || (int)category == -19) && !l.isTileHoeDirt(tile)) + if (((int)category == -74 || (int)category == -19) && !l.isTileHoeDirt(tile) && !bigCraftable.Value) { switch ((int)parentSheetIndex) { @@ -4885,7 +4893,7 @@ public virtual bool placementAction(GameLocation location, int x, int y, Farmer } return false; } - return true; + return false; } if (!performDropDownAction(who)) { @@ -4946,7 +4954,7 @@ public override bool actionWhenPurchased() } return true; } - if ((int)parentSheetIndex == 434) + if (Utility.IsNormalObjectAtParentSheetIndex(this, 434)) { if (!Game1.isFestival()) { diff --git a/StardewValley/Objects/Chest.cs b/StardewValley/Objects/Chest.cs index 7a3359e..37529a5 100644 --- a/StardewValley/Objects/Chest.cs +++ b/StardewValley/Objects/Chest.cs @@ -314,7 +314,7 @@ public void dumpContents(GameLocation location) } if (items.Count > 0 && !chestType.Equals("Monster") && items.Count >= 1 && (mutex.IsLockHeld() || !playerChest)) { - bool isStardrop = items[0] is Object && !(items[0] as Object).bigCraftable && (int)items[0].parentSheetIndex == 434; + bool isStardrop = Utility.IsNormalObjectAtParentSheetIndex(items[0], 434); if (location is FarmHouse) { if ((location as FarmHouse).owner.UniqueMultiplayerID != Game1.player.UniqueMultiplayerID) diff --git a/StardewValley/Options.cs b/StardewValley/Options.cs index 7316137..bbb0f72 100644 --- a/StardewValley/Options.cs +++ b/StardewValley/Options.cs @@ -483,7 +483,7 @@ public void setToDefaults() invertScrollDirection = false; ambientOnlyToggle = false; showAdvancedCraftingInformation = false; - stowingMode = ItemStowingModes.GamepadOnly; + stowingMode = ItemStowingModes.Off; gamepadMode = GamepadModes.Auto; windowedBorderlessFullscreen = true; showPlacementTileForGamepad = true; diff --git a/StardewValley/Properties/AssemblyInfo.cs b/StardewValley/Properties/AssemblyInfo.cs index c621055..ba941fa 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.7286.33936")] +[assembly: AssemblyVersion("1.3.7346.34283")] [module: UnverifiableCode] diff --git a/StardewValley/Quests/FishingQuest.cs b/StardewValley/Quests/FishingQuest.cs index 4b1235e..5e45431 100644 --- a/StardewValley/Quests/FishingQuest.cs +++ b/StardewValley/Quests/FishingQuest.cs @@ -108,13 +108,12 @@ public void loadQuestInfo() } case "winter": { - int[] possiblefish8 = new int[10] + int[] possiblefish8 = new int[9] { 130, 131, 136, 141, - 143, 144, 146, 147, diff --git a/StardewValley/Quests/ItemDeliveryQuest.cs b/StardewValley/Quests/ItemDeliveryQuest.cs index 943e13d..f755886 100644 --- a/StardewValley/Quests/ItemDeliveryQuest.cs +++ b/StardewValley/Quests/ItemDeliveryQuest.cs @@ -535,13 +535,20 @@ public override void reloadDescription() } targetMessage = messageBuilder; } - else if ((int)id != 0) + else { + if ((int)id == 0) + { + return; + } Dictionary questData = Game1.temporaryContent.Load>("Data\\Quests"); if (questData != null && questData.ContainsKey(id)) { string[] rawData = questData[id].Split('/'); - targetMessage = rawData[9]; + if (rawData != null && rawData.Length >= 9) + { + targetMessage = rawData[9]; + } } } } diff --git a/StardewValley/Quests/SlayMonsterQuest.cs b/StardewValley/Quests/SlayMonsterQuest.cs index 5c08b5a..2fd3d68 100644 --- a/StardewValley/Quests/SlayMonsterQuest.cs +++ b/StardewValley/Quests/SlayMonsterQuest.cs @@ -244,13 +244,20 @@ public override void reloadDescription() } targetMessage = messageBuilder; } - else if ((int)id != 0) + else { + if ((int)id == 0) + { + return; + } Dictionary questData = Game1.temporaryContent.Load>("Data\\Quests"); if (questData != null && questData.ContainsKey(id)) { string[] rawData = questData[id].Split('/'); - targetMessage = rawData[9]; + if (rawData != null && rawData.Length >= 9) + { + targetMessage = rawData[9]; + } } } } diff --git a/StardewValley/SaveGame.cs b/StardewValley/SaveGame.cs index 7df7e45..f316e14 100644 --- a/StardewValley/SaveGame.cs +++ b/StardewValley/SaveGame.cs @@ -40,6 +40,7 @@ public enum SaveFixes Level9PuddingFishingRecipe, Level9PuddingFishingRecipe2, quarryMineBushes, + MissingQisChallenge, MAX } @@ -858,6 +859,22 @@ public static IEnumerator getLoadEnumerator(string file) Game1.updateWeatherIcon(); Game1.netWorldState.Value.LostBooksFound.Set(loaded.lostBooksFound); Game1.player.team.farmhandsCanMoveBuildings.Value = (FarmerTeam.RemoteBuildingPermissions)loaded.moveBuildingPermissionMode; + if (Game1.multiplayerMode == 2) + { + if (Program.sdk.Networking != null && Game1.options.serverPrivacy == ServerPrivacy.InviteOnly) + { + Game1.options.setServerMode("invite"); + } + else if (Program.sdk.Networking != null && Game1.options.serverPrivacy == ServerPrivacy.FriendsOnly) + { + Game1.options.setServerMode("friends"); + } + else + { + Game1.options.serverPrivacy = ServerPrivacy.Public; + Game1.options.setServerMode("online"); + } + } Game1.bannedUsers = loaded.bannedUsers; bool need_lost_book_recount = false; if (loaded.lostBooksFound < 0) @@ -924,7 +941,7 @@ public static IEnumerator getLoadEnumerator(string file) Game1.recalculateLostBookCount(); } int current_save_fix = (int)Game1.lastAppliedSaveFix; - while (current_save_fix < 13) + while (current_save_fix < 14) { if (Enum.IsDefined(typeof(SaveFixes), current_save_fix)) { diff --git a/StardewValley/TerrainFeatures/FruitTree.cs b/StardewValley/TerrainFeatures/FruitTree.cs index fd31794..132babc 100644 --- a/StardewValley/TerrainFeatures/FruitTree.cs +++ b/StardewValley/TerrainFeatures/FruitTree.cs @@ -425,8 +425,13 @@ public override void dayUpdate(GameLocation environment, Vector2 tileLocation) bool isClearHoeDirt = environment.terrainFeatures.ContainsKey(v) && environment.terrainFeatures[v] is HoeDirt && (environment.terrainFeatures[v] as HoeDirt).crop == null; if (environment.isTileOccupied(v, "", ignoreAllCharacters: true) && !isClearHoeDirt) { - Object o = environment.getObjectAt((int)v.X, (int)v.Y); - if (o == null || o.isPassable()) + Object o = environment.getObjectAtTile((int)v.X, (int)v.Y); + if (o == null) + { + foundSomething = true; + break; + } + if (!Utility.IsNormalObjectAtParentSheetIndex(o, 590)) { foundSomething = true; break; diff --git a/StardewValley/Tools/MeleeWeapon.cs b/StardewValley/Tools/MeleeWeapon.cs index 780665c..a689984 100644 --- a/StardewValley/Tools/MeleeWeapon.cs +++ b/StardewValley/Tools/MeleeWeapon.cs @@ -970,7 +970,10 @@ public void setFarmerAnimating(Farmer who) } else { - who.currentLocation.playSound("daggerswipe"); + if (who.IsLocalPlayer) + { + who.currentLocation.playSound("daggerswipe"); + } swipeSpeed /= 4f; switch (who.FacingDirection) { diff --git a/StardewValley/Utility.cs b/StardewValley/Utility.cs index 40825ed..3ec0fc9 100644 --- a/StardewValley/Utility.cs +++ b/StardewValley/Utility.cs @@ -1525,6 +1525,15 @@ public static bool highlightSmallObjects(Item i) return false; } + public static bool highlightSantaObjects(Item i) + { + if (!i.canBeTrashed() || !i.canBeGivenAsGift()) + { + return false; + } + return highlightSmallObjects(i); + } + public static bool highlightShippableObjects(Item i) { if (i is Object) @@ -6724,7 +6733,9 @@ public static void createOverflowChest(GameLocation destination, Vector2 overflo } if (!found_chest_to_stash_in) { - new Chest(playerChest: true).addItem(overflow_object); + Chest new_chest = new Chest(playerChest: true); + new_chest.addItem(overflow_object); + chests.Add(new_chest); } } for (int i = 0; i < chests.Count; i++)