Skip to content

Commit

Permalink
Merge pull request #1 from veywrn/update-steam-145
Browse files Browse the repository at this point in the history
Decompile of Steam edition v1.4.5 with ILSpy 5.0.2
  • Loading branch information
veywrn authored Jun 21, 2020
2 parents 63dbe93 + d6beb46 commit 858c257
Show file tree
Hide file tree
Showing 32 changed files with 390 additions and 214 deletions.
4 changes: 3 additions & 1 deletion StardewValley/BellsAndWhistles/SpriteText.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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;
Expand All @@ -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] == '^')
Expand Down
5 changes: 3 additions & 2 deletions StardewValley/Characters/TrashBear.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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++;
Expand Down
17 changes: 13 additions & 4 deletions StardewValley/Debris.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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;
Expand Down
42 changes: 28 additions & 14 deletions StardewValley/Event.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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":
Expand All @@ -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":
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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":
Expand Down Expand Up @@ -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)
Expand All @@ -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);
}
Expand All @@ -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;
Expand Down
14 changes: 7 additions & 7 deletions StardewValley/Farmer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand All @@ -3005,7 +3005,7 @@ public void addItemsByMenuIfNecessary(List<Item> 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)
Expand Down Expand Up @@ -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();
}
Expand Down Expand Up @@ -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)
{
Expand Down Expand Up @@ -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();
}
Expand Down Expand Up @@ -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);
Expand Down
13 changes: 11 additions & 2 deletions StardewValley/Game1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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;
}
}

Expand Down Expand Up @@ -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;
Expand Down
Loading

0 comments on commit 858c257

Please sign in to comment.