public static void performDebrisPickup(int uniqueID, string locationName, long whichPlayer)
        {
            GameLocation locationFromName = Game1.getLocationFromName(locationName);

            for (int i = 0; i < locationFromName.debris.Count; i++)
            {
                if (locationFromName.debris[i].uniqueID == uniqueID)
                {
                    locationFromName.debris.RemoveAt(i);
                    break;
                }
            }
            if (Game1.IsServer)
            {
                MultiplayerUtility.broadcastDebrisPickup(uniqueID, locationName, whichPlayer);
            }
        }
Exemple #2
0
        public bool updateChunks(GameTime time)
        {
            this.timeSinceDoneBouncing = this.timeSinceDoneBouncing + (float)time.ElapsedGameTime.Milliseconds;
            if ((double)this.timeSinceDoneBouncing >= (this.floppingFish ? 2500.0 : (this.debrisType == Debris.DebrisType.SPRITECHUNKS || this.debrisType == Debris.DebrisType.NUMBERS ? 1800.0 : 600.0)))
            {
                if (this.debrisType == Debris.DebrisType.LETTERS || this.debrisType == Debris.DebrisType.NUMBERS || (this.debrisType == Debris.DebrisType.SQUARES || this.debrisType == Debris.DebrisType.SPRITECHUNKS) || this.debrisType == Debris.DebrisType.CHUNKS && this.chunks[0].debrisType - this.chunks[0].debrisType % 2 != 8)
                {
                    return(true);
                }
                if (this.debrisType == Debris.DebrisType.ARCHAEOLOGY || this.debrisType == Debris.DebrisType.OBJECT || (this.debrisType == Debris.DebrisType.RESOURCE || this.debrisType == Debris.DebrisType.CHUNKS))
                {
                    this.chunksMoveTowardPlayer = true;
                }
                this.timeSinceDoneBouncing = 0.0f;
            }
            for (int index = this.chunks.Count - 1; index >= 0; --index)
            {
                if ((double)this.chunks[index].alpha > 0.100000001490116 && (this.debrisType == Debris.DebrisType.SPRITECHUNKS || this.debrisType == Debris.DebrisType.NUMBERS) && (double)this.timeSinceDoneBouncing > 600.0)
                {
                    this.chunks[index].alpha = (float)((1800.0 - (double)this.timeSinceDoneBouncing) / 1000.0);
                }
                if ((double)this.chunks[index].position.X < (double)(-Game1.tileSize * 2) || (double)this.chunks[index].position.Y < (double)-Game1.tileSize || ((double)this.chunks[index].position.X >= (double)(Game1.currentLocation.map.DisplayWidth + Game1.tileSize) || (double)this.chunks[index].position.Y >= (double)(Game1.currentLocation.map.DisplayHeight + Game1.tileSize)))
                {
                    this.chunks.RemoveAt(index);
                }
                else
                {
                    bool flag1 = (double)Math.Abs(this.chunks[index].position.X + (float)(Game1.tileSize / 2) - (float)Game1.player.getStandingX()) <= (double)Game1.player.MagneticRadius && (double)Math.Abs(this.chunks[index].position.Y + (float)(Game1.tileSize / 2) - (float)Game1.player.getStandingY()) <= (double)Game1.player.MagneticRadius;
                    if (flag1)
                    {
                        switch (this.debrisType)
                        {
                        case Debris.DebrisType.ARCHAEOLOGY:
                        case Debris.DebrisType.OBJECT:
                            if (this.item != null)
                            {
                                flag1 = Game1.player.couldInventoryAcceptThisItem(this.item);
                                break;
                            }
                            flag1 = Game1.player.couldInventoryAcceptThisObject(this.chunks[index].debrisType, 1, this.itemQuality);
                            if (this.chunks[index].debrisType == 102 && Game1.activeClickableMenu != null)
                            {
                                flag1 = false;
                                break;
                            }
                            break;

                        case Debris.DebrisType.RESOURCE:
                            flag1 = Game1.player.couldInventoryAcceptThisObject(this.chunks[index].debrisType - this.chunks[index].debrisType % 2, 1, 0);
                            break;

                        default:
                            flag1 = true;
                            break;
                        }
                    }
                    if (((this.chunksMoveTowardPlayer ? 1 : (this.isFishable ? 1 : 0)) & (flag1 ? 1 : 0)) != 0)
                    {
                        if ((double)this.chunks[index].position.X < (double)Game1.player.position.X - 12.0)
                        {
                            this.chunks[index].xVelocity = Math.Min(this.chunks[index].xVelocity + 0.8f, 8f);
                        }
                        else if ((double)this.chunks[index].position.X > (double)Game1.player.position.X + 12.0)
                        {
                            this.chunks[index].xVelocity = Math.Max(this.chunks[index].xVelocity - 0.8f, -8f);
                        }
                        if ((double)this.chunks[index].position.Y + (double)(Game1.tileSize / 2) < (double)(Game1.player.getStandingY() - 12))
                        {
                            this.chunks[index].yVelocity = Math.Max(this.chunks[index].yVelocity - 0.8f, -8f);
                        }
                        else if ((double)this.chunks[index].position.Y + (double)(Game1.tileSize / 2) > (double)(Game1.player.getStandingY() + 12))
                        {
                            this.chunks[index].yVelocity = Math.Min(this.chunks[index].yVelocity + 0.8f, 8f);
                        }
                        this.chunks[index].position.X += this.chunks[index].xVelocity;
                        this.chunks[index].position.Y -= this.chunks[index].yVelocity;
                        if ((double)Math.Abs(this.chunks[index].position.X + (float)(Game1.tileSize / 2) - (float)Game1.player.getStandingX()) <= 64.0 && (double)Math.Abs(this.chunks[index].position.Y + (float)(Game1.tileSize / 2) - (float)Game1.player.getStandingY()) <= 64.0)
                        {
                            int num1 = this.debrisType == Debris.DebrisType.ARCHAEOLOGY || this.debrisType == Debris.DebrisType.OBJECT ? this.chunks[index].debrisType : this.chunks[index].debrisType - this.chunks[index].debrisType % 2;
                            if (this.debrisType == Debris.DebrisType.ARCHAEOLOGY)
                            {
                                Game1.farmerFindsArtifact(this.chunks[index].debrisType);
                            }
                            else if (this.item != null)
                            {
                                if (!Game1.player.addItemToInventoryBool(this.item, false))
                                {
                                    continue;
                                }
                            }
                            else if (this.debrisType != Debris.DebrisType.CHUNKS || num1 != 8)
                            {
                                if (num1 <= -10000)
                                {
                                    if (!Game1.player.addItemToInventoryBool((Item) new MeleeWeapon(num1), false))
                                    {
                                        continue;
                                    }
                                }
                                else if (num1 <= 0)
                                {
                                    if (!Game1.player.addItemToInventoryBool((Item) new Object(Vector2.Zero, -num1, false), false))
                                    {
                                        continue;
                                    }
                                }
                                else
                                {
                                    Farmer player = Game1.player;
                                    Object @object;
                                    if (num1 != 93 && num1 != 94)
                                    {
                                        @object = new Object(Vector2.Zero, num1, 1)
                                        {
                                            quality = this.itemQuality
                                        }
                                    }
                                    ;
                                    else
                                    {
                                        @object = (Object) new Torch(Vector2.Zero, 1, num1);
                                    }
                                    int num2 = 0;
                                    if (!player.addItemToInventoryBool((Item)@object, num2 != 0))
                                    {
                                        continue;
                                    }
                                }
                            }
                            if ((double)Game1.debrisSoundInterval <= 0.0)
                            {
                                Game1.debrisSoundInterval = 10f;
                                Game1.playSound("coin");
                            }
                            if (Game1.IsMultiplayer)
                            {
                                MultiplayerUtility.broadcastDebrisPickup(this.uniqueID, Game1.currentLocation.name, Game1.player.uniqueMultiplayerID);
                            }
                            this.chunks.RemoveAt(index);
                        }
                    }
                    else
                    {
                        if (this.debrisType == Debris.DebrisType.NUMBERS && this.toHover != null)
                        {
                            this.relativeXPosition        = this.relativeXPosition + this.chunks[index].xVelocity;
                            this.chunks[index].position.X = this.toHover.position.X + (float)(Game1.tileSize / 2) + this.relativeXPosition;
                            this.chunks[index].scale      = Math.Min(2f, Math.Max(1f, (float)(0.899999976158142 + (double)Math.Abs(this.chunks[index].position.Y - (float)this.chunkFinalYLevel) / ((double)Game1.tileSize * 2.0))));
                            this.chunkFinalYLevel         = this.toHover.getStandingY() + 8;
                            if ((double)this.timeSinceDoneBouncing > 250.0)
                            {
                                this.chunks[index].alpha = Math.Max(0.0f, this.chunks[index].alpha - 0.033f);
                            }
                            if (!this.toHover.Equals((object)Game1.player) && !this.nonSpriteChunkColor.Equals(Color.Yellow) && !this.nonSpriteChunkColor.Equals(Color.Green))
                            {
                                this.nonSpriteChunkColor.R = (byte)Math.Max((double)Math.Min((int)byte.MaxValue, 200 + this.chunkType), Math.Min((double)Math.Min((int)byte.MaxValue, 220 + this.chunkType), 400.0 * Math.Sin((double)this.timeSinceDoneBouncing / (256.0 * Math.PI) + Math.PI / 12.0)));
                                this.nonSpriteChunkColor.G = (byte)Math.Max((double)(150 - this.chunkType), Math.Min((double)((int)byte.MaxValue - this.chunkType), (int)this.nonSpriteChunkColor.R > 220 ? 300.0 * Math.Sin((double)this.timeSinceDoneBouncing / (256.0 * Math.PI) + Math.PI / 12.0) : 0.0));
                                this.nonSpriteChunkColor.B = (byte)Math.Max(0, Math.Min((int)byte.MaxValue, (int)this.nonSpriteChunkColor.G > 200 ? (int)this.nonSpriteChunkColor.G - 20 : 0));
                            }
                        }
                        this.chunks[index].position.X += this.chunks[index].xVelocity;
                        this.chunks[index].position.Y -= this.chunks[index].yVelocity;
                        if (this.movingFinalYLevel)
                        {
                            this.chunkFinalYLevel = this.chunkFinalYLevel - (int)Math.Ceiling((double)this.chunks[index].yVelocity / 2.0);
                            if (this.chunkFinalYLevel <= this.chunkFinalYTarget)
                            {
                                this.chunkFinalYLevel  = this.chunkFinalYTarget;
                                this.movingFinalYLevel = false;
                            }
                        }
                        if (this.debrisType == Debris.DebrisType.SQUARES && (double)this.chunks[index].position.Y < (double)(this.chunkFinalYLevel - Game1.tileSize * 3 / 2) && Game1.random.NextDouble() < 0.1)
                        {
                            this.chunks[index].position.Y = (float)(this.chunkFinalYLevel - Game1.random.Next(1, Game1.tileSize / 3));
                            this.chunks[index].yVelocity  = (float)Game1.random.Next(30, 80) / 40f;
                            this.chunks[index].position.X = (float)Game1.random.Next((int)((double)this.chunks[index].position.X - (double)this.chunks[index].position.X % (double)Game1.tileSize + 1.0), (int)((double)this.chunks[index].position.X - (double)this.chunks[index].position.X % (double)Game1.tileSize + 64.0));
                        }
                        if (this.debrisType != Debris.DebrisType.SQUARES)
                        {
                            this.chunks[index].yVelocity -= 0.4f;
                        }
                        bool flag2 = false;
                        if ((double)this.chunks[index].position.Y >= (double)this.chunkFinalYLevel && this.chunks[index].hasPassedRestingLineOnce && this.chunks[index].bounces <= (this.floppingFish ? 65 : 2))
                        {
                            if (this.debrisType != Debris.DebrisType.LETTERS && this.debrisType != Debris.DebrisType.NUMBERS && this.debrisType != Debris.DebrisType.SPRITECHUNKS && (this.debrisType != Debris.DebrisType.CHUNKS || this.chunks[index].debrisType - this.chunks[index].debrisType % 2 == 8))
                            {
                                Game1.playSound("shiny4");
                            }
                            ++this.chunks[index].bounces;
                            if (this.floppingFish)
                            {
                                this.chunks[index].yVelocity = Math.Abs(this.chunks[index].yVelocity) * (!this.movingUp || this.chunks[index].bounces >= 2 ? 0.9f : 0.6f);
                                this.chunks[index].xVelocity = (float)Game1.random.Next(-250, 250) / 100f;
                            }
                            else
                            {
                                this.chunks[index].yVelocity        = Math.Abs((float)((double)this.chunks[index].yVelocity * 2.0 / 3.0));
                                this.chunks[index].rotationVelocity = Game1.random.NextDouble() < 0.5 ? this.chunks[index].rotationVelocity / 2f : (float)(-(double)this.chunks[index].rotationVelocity * 2.0 / 3.0);
                                this.chunks[index].xVelocity       -= this.chunks[index].xVelocity / 2f;
                            }
                            if (this.debrisType != Debris.DebrisType.LETTERS && this.debrisType != Debris.DebrisType.SPRITECHUNKS && (this.debrisType != Debris.DebrisType.NUMBERS && Game1.currentLocation.doesTileHaveProperty((int)(((double)this.chunks[index].position.X + (double)(Game1.tileSize / 2)) / (double)Game1.tileSize), (int)(((double)this.chunks[index].position.Y + (double)(Game1.tileSize / 2)) / (double)Game1.tileSize), "Water", "Back") != null))
                            {
                                Game1.currentLocation.TemporarySprites.Add(new TemporaryAnimatedSprite(28, 300f, 2, 1, this.chunks[index].position, false, false));
                                Game1.playSound("dropItemInWater");
                                flag2 = true;
                            }
                        }
                        if (!this.chunks[index].hitWall && Game1.currentLocation.Map.GetLayer("Buildings").Tiles[(int)(((double)this.chunks[index].position.X + (double)(Game1.tileSize / 2)) / (double)Game1.tileSize), (int)(((double)this.chunks[index].position.Y + (double)(Game1.tileSize / 2)) / (double)Game1.tileSize)] != null || Game1.currentLocation.Map.GetLayer("Back").Tiles[(int)(((double)this.chunks[index].position.X + (double)(Game1.tileSize / 2)) / (double)Game1.tileSize), (int)(((double)this.chunks[index].position.Y + (double)(Game1.tileSize / 2)) / (double)Game1.tileSize)] == null)
                        {
                            this.chunks[index].xVelocity = -this.chunks[index].xVelocity;
                            this.chunks[index].hitWall   = true;
                        }
                        if ((double)this.chunks[index].position.Y < (double)this.chunkFinalYLevel)
                        {
                            this.chunks[index].hasPassedRestingLineOnce = true;
                        }
                        if (this.chunks[index].bounces > (this.floppingFish ? 65 : 2))
                        {
                            this.chunks[index].yVelocity        = 0.0f;
                            this.chunks[index].xVelocity        = 0.0f;
                            this.chunks[index].rotationVelocity = 0.0f;
                        }
                        this.chunks[index].rotation += this.chunks[index].rotationVelocity;
                        if (flag2)
                        {
                            this.chunks.RemoveAt(index);
                        }
                    }
                }
            }
            return(this.chunks.Count == 0);
        }
        // Token: 0x0600018E RID: 398 RVA: 0x00011DF8 File Offset: 0x0000FFF8
        public bool updateChunks(GameTime time)
        {
            this.timeSinceDoneBouncing += (float)time.ElapsedGameTime.Milliseconds;
            if (this.timeSinceDoneBouncing >= (this.floppingFish ? 2500f : ((this.debrisType == Debris.DebrisType.SPRITECHUNKS || this.debrisType == Debris.DebrisType.NUMBERS) ? 1800f : 600f)))
            {
                if (this.debrisType == Debris.DebrisType.LETTERS || this.debrisType == Debris.DebrisType.NUMBERS || this.debrisType == Debris.DebrisType.SQUARES || this.debrisType == Debris.DebrisType.SPRITECHUNKS || (this.debrisType == Debris.DebrisType.CHUNKS && this.chunks[0].debrisType - this.chunks[0].debrisType % 2 != 8))
                {
                    return(true);
                }
                if (this.debrisType == Debris.DebrisType.ARCHAEOLOGY || this.debrisType == Debris.DebrisType.OBJECT || this.debrisType == Debris.DebrisType.RESOURCE || this.debrisType == Debris.DebrisType.CHUNKS)
                {
                    this.chunksMoveTowardPlayer = true;
                }
                this.timeSinceDoneBouncing = 0f;
            }
            for (int i = this.chunks.Count - 1; i >= 0; i--)
            {
                if (this.chunks[i].alpha > 0.1f && (this.debrisType == Debris.DebrisType.SPRITECHUNKS || this.debrisType == Debris.DebrisType.NUMBERS) && this.timeSinceDoneBouncing > 600f)
                {
                    this.chunks[i].alpha = (1800f - this.timeSinceDoneBouncing) / 1000f;
                }
                if (this.chunks[i].position.X < (float)(-(float)Game1.tileSize * 2) || this.chunks[i].position.Y < (float)(-(float)Game1.tileSize) || this.chunks[i].position.X >= (float)(Game1.currentLocation.map.DisplayWidth + Game1.tileSize) || this.chunks[i].position.Y >= (float)(Game1.currentLocation.map.DisplayHeight + Game1.tileSize))
                {
                    this.chunks.RemoveAt(i);
                }
                else
                {
                    bool canMoveTowardPlayer = Math.Abs(this.chunks[i].position.X + (float)(Game1.tileSize / 2) - (float)Game1.player.getStandingX()) <= (float)Game1.player.MagneticRadius && Math.Abs(this.chunks[i].position.Y + (float)(Game1.tileSize / 2) - (float)Game1.player.getStandingY()) <= (float)Game1.player.MagneticRadius;
                    if (canMoveTowardPlayer)
                    {
                        switch (this.debrisType)
                        {
                        case Debris.DebrisType.ARCHAEOLOGY:
                        case Debris.DebrisType.OBJECT:
                            if (this.item != null)
                            {
                                canMoveTowardPlayer = Game1.player.couldInventoryAcceptThisItem(this.item);
                                goto IL_338;
                            }
                            canMoveTowardPlayer = Game1.player.couldInventoryAcceptThisObject(this.chunks[i].debrisType, 1, this.itemQuality);
                            if (this.chunks[i].debrisType == 102 && Game1.activeClickableMenu != null)
                            {
                                canMoveTowardPlayer = false;
                                goto IL_338;
                            }
                            goto IL_338;

                        case Debris.DebrisType.RESOURCE:
                            canMoveTowardPlayer = Game1.player.couldInventoryAcceptThisObject(this.chunks[i].debrisType - this.chunks[i].debrisType % 2, 1, 0);
                            goto IL_338;
                        }
                        canMoveTowardPlayer = true;
                    }
IL_338:
                    if ((this.chunksMoveTowardPlayer || this.isFishable) & canMoveTowardPlayer)
                    {
                        if (this.chunks[i].position.X < Game1.player.position.X - 12f)
                        {
                            this.chunks[i].xVelocity = Math.Min(this.chunks[i].xVelocity + 0.8f, 8f);
                        }
                        else if (this.chunks[i].position.X > Game1.player.position.X + 12f)
                        {
                            this.chunks[i].xVelocity = Math.Max(this.chunks[i].xVelocity - 0.8f, -8f);
                        }
                        if (this.chunks[i].position.Y + (float)(Game1.tileSize / 2) < (float)(Game1.player.getStandingY() - 12))
                        {
                            this.chunks[i].yVelocity = Math.Max(this.chunks[i].yVelocity - 0.8f, -8f);
                        }
                        else if (this.chunks[i].position.Y + (float)(Game1.tileSize / 2) > (float)(Game1.player.getStandingY() + 12))
                        {
                            this.chunks[i].yVelocity = Math.Min(this.chunks[i].yVelocity + 0.8f, 8f);
                        }
                        Chunk expr_4EA_cp_0_cp_0 = this.chunks[i];
                        expr_4EA_cp_0_cp_0.position.X = expr_4EA_cp_0_cp_0.position.X + this.chunks[i].xVelocity;
                        Chunk expr_515_cp_0_cp_0 = this.chunks[i];
                        expr_515_cp_0_cp_0.position.Y = expr_515_cp_0_cp_0.position.Y - this.chunks[i].yVelocity;
                        if (Math.Abs(this.chunks[i].position.X + (float)(Game1.tileSize / 2) - (float)Game1.player.getStandingX()) <= 64f && Math.Abs(this.chunks[i].position.Y + (float)(Game1.tileSize / 2) - (float)Game1.player.getStandingY()) <= 64f)
                        {
                            int switcher = (this.debrisType == Debris.DebrisType.ARCHAEOLOGY || this.debrisType == Debris.DebrisType.OBJECT) ? this.chunks[i].debrisType : (this.chunks[i].debrisType - this.chunks[i].debrisType % 2);
                            if (this.debrisType == Debris.DebrisType.ARCHAEOLOGY)
                            {
                                Game1.farmerFindsArtifact(this.chunks[i].debrisType);
                            }
                            else if (this.item != null)
                            {
                                if (!Game1.player.addItemToInventoryBool(this.item, false))
                                {
                                    goto IL_1077;
                                }
                            }
                            else if (this.debrisType != Debris.DebrisType.CHUNKS || switcher != 8)
                            {
                                if (switcher <= -10000)
                                {
                                    if (!Game1.player.addItemToInventoryBool(new MeleeWeapon(switcher), false))
                                    {
                                        goto IL_1077;
                                    }
                                }
                                else if (switcher <= 0)
                                {
                                    if (!Game1.player.addItemToInventoryBool(new Object(Vector2.Zero, -switcher, false), false))
                                    {
                                        goto IL_1077;
                                    }
                                }
                                else
                                {
                                    Farmer arg_6C2_0 = Game1.player;
                                    Object arg_6C2_1;
                                    if (switcher != 93 && switcher != 94)
                                    {
                                        (arg_6C2_1 = new Object(Vector2.Zero, switcher, 1)).quality = this.itemQuality;
                                    }
                                    else
                                    {
                                        arg_6C2_1 = new Torch(Vector2.Zero, 1, switcher);
                                    }
                                    if (!arg_6C2_0.addItemToInventoryBool(arg_6C2_1, false))
                                    {
                                        goto IL_1077;
                                    }
                                }
                            }
                            if (Game1.debrisSoundInterval <= 0f)
                            {
                                Game1.debrisSoundInterval = 10f;
                                Game1.playSound("coin");
                            }
                            if (Game1.IsMultiplayer)
                            {
                                MultiplayerUtility.broadcastDebrisPickup(this.uniqueID, Game1.currentLocation.name, Game1.player.uniqueMultiplayerID);
                            }
                            this.chunks.RemoveAt(i);
                        }
                    }
                    else
                    {
                        if (this.debrisType == Debris.DebrisType.NUMBERS && this.toHover != null)
                        {
                            this.relativeXPosition   += this.chunks[i].xVelocity;
                            this.chunks[i].position.X = this.toHover.position.X + (float)(Game1.tileSize / 2) + this.relativeXPosition;
                            this.chunks[i].scale      = Math.Min(2f, Math.Max(1f, 0.9f + Math.Abs(this.chunks[i].position.Y - (float)this.chunkFinalYLevel) / ((float)Game1.tileSize * 2f)));
                            this.chunkFinalYLevel     = this.toHover.getStandingY() + 8;
                            if (this.timeSinceDoneBouncing > 250f)
                            {
                                this.chunks[i].alpha = Math.Max(0f, this.chunks[i].alpha - 0.033f);
                            }
                            if (!this.toHover.Equals(Game1.player) && !this.nonSpriteChunkColor.Equals(Color.Yellow) && !this.nonSpriteChunkColor.Equals(Color.Green))
                            {
                                this.nonSpriteChunkColor.R = (byte)Math.Max((double)Math.Min(255, 200 + this.chunkType), Math.Min((double)Math.Min(255, 220 + this.chunkType), 400.0 * Math.Sin((double)this.timeSinceDoneBouncing / 804.247719318987 + 0.26179938779914941)));
                                this.nonSpriteChunkColor.G = (byte)Math.Max((double)(150 - this.chunkType), Math.Min((double)(255 - this.chunkType), (this.nonSpriteChunkColor.R > 220) ? (300.0 * Math.Sin((double)this.timeSinceDoneBouncing / 804.247719318987 + 0.26179938779914941)) : 0.0));
                                this.nonSpriteChunkColor.B = (byte)Math.Max(0, Math.Min(255, (int)((this.nonSpriteChunkColor.G > 200) ? (this.nonSpriteChunkColor.G - 20) : 0)));
                            }
                        }
                        Chunk expr_9B4_cp_0_cp_0 = this.chunks[i];
                        expr_9B4_cp_0_cp_0.position.X = expr_9B4_cp_0_cp_0.position.X + this.chunks[i].xVelocity;
                        Chunk expr_9DF_cp_0_cp_0 = this.chunks[i];
                        expr_9DF_cp_0_cp_0.position.Y = expr_9DF_cp_0_cp_0.position.Y - this.chunks[i].yVelocity;
                        if (this.movingFinalYLevel)
                        {
                            this.chunkFinalYLevel -= (int)Math.Ceiling((double)(this.chunks[i].yVelocity / 2f));
                            if (this.chunkFinalYLevel <= this.chunkFinalYTarget)
                            {
                                this.chunkFinalYLevel  = this.chunkFinalYTarget;
                                this.movingFinalYLevel = false;
                            }
                        }
                        if (this.debrisType == Debris.DebrisType.SQUARES && this.chunks[i].position.Y < (float)(this.chunkFinalYLevel - Game1.tileSize * 3 / 2) && Game1.random.NextDouble() < 0.1)
                        {
                            this.chunks[i].position.Y = (float)(this.chunkFinalYLevel - Game1.random.Next(1, Game1.tileSize / 3));
                            this.chunks[i].yVelocity  = (float)Game1.random.Next(30, 80) / 40f;
                            this.chunks[i].position.X = (float)Game1.random.Next((int)(this.chunks[i].position.X - this.chunks[i].position.X % (float)Game1.tileSize + 1f), (int)(this.chunks[i].position.X - this.chunks[i].position.X % (float)Game1.tileSize + 64f));
                        }
                        if (this.debrisType != Debris.DebrisType.SQUARES)
                        {
                            this.chunks[i].yVelocity -= 0.4f;
                        }
                        bool destroyThisChunk = false;
                        if (this.chunks[i].position.Y >= (float)this.chunkFinalYLevel && this.chunks[i].hasPassedRestingLineOnce && this.chunks[i].bounces <= (this.floppingFish ? 65 : 2))
                        {
                            if (this.debrisType != Debris.DebrisType.LETTERS && this.debrisType != Debris.DebrisType.NUMBERS && this.debrisType != Debris.DebrisType.SPRITECHUNKS && (this.debrisType != Debris.DebrisType.CHUNKS || this.chunks[i].debrisType - this.chunks[i].debrisType % 2 == 8))
                            {
                                Game1.playSound("shiny4");
                            }
                            this.chunks[i].bounces++;
                            if (this.floppingFish)
                            {
                                this.chunks[i].yVelocity = Math.Abs(this.chunks[i].yVelocity) * ((this.movingUp && this.chunks[i].bounces < 2) ? 0.6f : 0.9f);
                                this.chunks[i].xVelocity = (float)Game1.random.Next(-250, 250) / 100f;
                            }
                            else
                            {
                                this.chunks[i].yVelocity        = Math.Abs(this.chunks[i].yVelocity * 2f / 3f);
                                this.chunks[i].rotationVelocity = ((Game1.random.NextDouble() < 0.5) ? (this.chunks[i].rotationVelocity / 2f) : (-this.chunks[i].rotationVelocity * 2f / 3f));
                                this.chunks[i].xVelocity       -= this.chunks[i].xVelocity / 2f;
                            }
                            if (this.debrisType != Debris.DebrisType.LETTERS && this.debrisType != Debris.DebrisType.SPRITECHUNKS && this.debrisType != Debris.DebrisType.NUMBERS && Game1.currentLocation.doesTileHaveProperty((int)((this.chunks[i].position.X + (float)(Game1.tileSize / 2)) / (float)Game1.tileSize), (int)((this.chunks[i].position.Y + (float)(Game1.tileSize / 2)) / (float)Game1.tileSize), "Water", "Back") != null)
                            {
                                Game1.currentLocation.TemporarySprites.Add(new TemporaryAnimatedSprite(28, 300f, 2, 1, this.chunks[i].position, false, false));
                                Game1.playSound("dropItemInWater");
                                destroyThisChunk = true;
                            }
                        }
                        if ((!this.chunks[i].hitWall && Game1.currentLocation.Map.GetLayer("Buildings").Tiles[(int)((this.chunks[i].position.X + (float)(Game1.tileSize / 2)) / (float)Game1.tileSize), (int)((this.chunks[i].position.Y + (float)(Game1.tileSize / 2)) / (float)Game1.tileSize)] != null) || Game1.currentLocation.Map.GetLayer("Back").Tiles[(int)((this.chunks[i].position.X + (float)(Game1.tileSize / 2)) / (float)Game1.tileSize), (int)((this.chunks[i].position.Y + (float)(Game1.tileSize / 2)) / (float)Game1.tileSize)] == null)
                        {
                            this.chunks[i].xVelocity = -this.chunks[i].xVelocity;
                            this.chunks[i].hitWall   = true;
                        }
                        if (this.chunks[i].position.Y < (float)this.chunkFinalYLevel)
                        {
                            this.chunks[i].hasPassedRestingLineOnce = true;
                        }
                        if (this.chunks[i].bounces > (this.floppingFish ? 65 : 2))
                        {
                            this.chunks[i].yVelocity        = 0f;
                            this.chunks[i].xVelocity        = 0f;
                            this.chunks[i].rotationVelocity = 0f;
                        }
                        this.chunks[i].rotation += this.chunks[i].rotationVelocity;
                        if (destroyThisChunk)
                        {
                            this.chunks.RemoveAt(i);
                        }
                    }
                }
                IL_1077 :;
            }
            return(this.chunks.Count == 0);
        }