Example #1
0
 public void GetData <T>(int level, Microsoft.Xna.Framework.Rectangle?rect, T[] data, int startIndex, int elementCount) where T : struct
 {
     if (data == null || data.Length == 0)
     {
         throw new ArgumentException("data cannot be null");
     }
     if (data.Length < startIndex + elementCount)
     {
         throw new ArgumentException("The data passed has a length of " + (object)data.Length + " but " + (string)(object)elementCount + " pixels have been requested.");
     }
     else
     {
         if (rect.HasValue)
         {
             throw new NotImplementedException();
         }
         if (this.glFormat == (OpenTK.Graphics.OpenGL.PixelFormat) 34467)
         {
             throw new NotImplementedException();
         }
         Threading.BlockOnUIThread((Action)(() =>
         {
             GL.BindTexture(TextureTarget.Texture2D, this.glTexture);
             GL.GetTexImage <T>(TextureTarget.Texture2D, level, this.glFormat, this.glType, data);
         }));
     }
 }
Example #2
0
        public override bool PreDraw(ref Color lightColor)
        {
            Microsoft.Xna.Framework.Color color25 = Color.White;
            float num150 = (float)(TextureAssets.Projectile[Projectile.type].Value.Width - Projectile.width) * 0.5f + (float)Projectile.width * 0.5f;

            Microsoft.Xna.Framework.Rectangle value7 = new Microsoft.Xna.Framework.Rectangle((int)Main.screenPosition.X - 500, (int)Main.screenPosition.Y - 500, Main.screenWidth + 1000, Main.screenHeight + 1000);
            if (Projectile.getRect().Intersects(value7))
            {
                Vector2 value8      = new Vector2(Projectile.position.X - Main.screenPosition.X + num150, Projectile.position.Y - Main.screenPosition.Y + (float)(Projectile.height / 2) + Projectile.gfxOffY);
                float   num176      = 100f * ((Projectile.ai[0] == 1) ? 1.5f : 1f);
                float   scaleFactor = 3f;
                if (Projectile.ai[1] == 1f)
                {
                    num176 = (float)((int)Projectile.localAI[0]);
                }
                int num43;
                for (int num177 = 1; num177 <= (int)Projectile.localAI[0]; num177 = num43 + 1)
                {
                    Vector2 value9 = Vector2.Normalize(Projectile.velocity) * (float)num177 * scaleFactor;
                    Microsoft.Xna.Framework.Color color32 = Projectile.GetAlpha(color25);
                    color32  *= (num176 - (float)num177) / num176;
                    color32.A = 0;
                    SpriteBatch arg_7727_0 = Main.spriteBatch;
                    Texture2D   arg_7727_1 = TextureAssets.Projectile[Projectile.type].Value;
                    Vector2     arg_7727_2 = value8 - value9;
                    Microsoft.Xna.Framework.Rectangle?sourceRectangle2 = null;
                    arg_7727_0.Draw(arg_7727_1, arg_7727_2, sourceRectangle2, color32, Projectile.rotation, new Vector2(num150, (float)(Projectile.height / 2)), Projectile.scale * ((Projectile.ai[0] == 1) ? 2f : 1f), SpriteEffects.None, 0);
                    num43 = num177;
                }
            }
            return(false);
        }
Example #3
0
        public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
        {
            Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0));
            float num150 = (float)(Main.projectileTexture[projectile.type].Width - projectile.width) * 0.5f + (float)projectile.width * 0.5f;

            Microsoft.Xna.Framework.Rectangle value7 = new Microsoft.Xna.Framework.Rectangle((int)Main.screenPosition.X - 500, (int)Main.screenPosition.Y - 500, Main.screenWidth + 1000, Main.screenHeight + 1000);
            if (projectile.getRect().Intersects(value7))
            {
                Vector2 value8      = new Vector2(projectile.position.X - Main.screenPosition.X + num150, projectile.position.Y - Main.screenPosition.Y + (float)(projectile.height / 2) + projectile.gfxOffY);
                float   num176      = 100f;
                float   scaleFactor = 3f;
                if (projectile.ai[1] == 1f)
                {
                    num176 = (float)((int)projectile.localAI[0]);
                }
                int num43;
                for (int num177 = 1; num177 <= (int)projectile.localAI[0]; num177 = num43 + 1)
                {
                    Vector2 value9 = Vector2.Normalize(projectile.velocity) * (float)num177 * scaleFactor;
                    Microsoft.Xna.Framework.Color color32 = projectile.GetAlpha(color25);
                    color32  *= (num176 - (float)num177) / num176;
                    color32.A = 0;
                    SpriteBatch arg_7727_0 = Main.spriteBatch;
                    Texture2D   arg_7727_1 = Main.projectileTexture[projectile.type];
                    Vector2     arg_7727_2 = value8 - value9;
                    Microsoft.Xna.Framework.Rectangle?sourceRectangle2 = null;
                    arg_7727_0.Draw(arg_7727_1, arg_7727_2, sourceRectangle2, color32, projectile.rotation, new Vector2(num150, (float)(projectile.height / 2)), projectile.scale, SpriteEffects.None, 0f);
                    num43 = num177;
                }
            }
            return(true);
        }
        public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
        {
            Microsoft.Xna.Framework.Color color25 = DrawColor;
            float num150 = (float)(Main.projectileTexture[projectile.type].Width - projectile.width) * 0.5f + (float)projectile.width * 0.5f;

            Microsoft.Xna.Framework.Rectangle value7 = new Microsoft.Xna.Framework.Rectangle((int)Main.screenPosition.X - 500, (int)Main.screenPosition.Y - 500, Main.screenWidth + 1000, Main.screenHeight + 1000);
            if (projectile.getRect().Intersects(value7))
            {
                Vector2 value8      = new Vector2(projectile.position.X - Main.screenPosition.X + num150, projectile.position.Y - Main.screenPosition.Y + (float)(projectile.height / 2) + projectile.gfxOffY);
                float   num176      = 100f * ((projectile.ai[0] == 1) ? 1.5f : 1f);
                float   scaleFactor = 3f;
                if (projectile.ai[1] == 1f)
                {
                    num176 = (float)((int)projectile.localAI[0]);
                }
                int num43;
                for (int num177 = 1; num177 <= (int)projectile.localAI[0]; num177 = num43 + 1)
                {
                    Vector2 value9 = Vector2.Normalize(projectile.velocity) * (float)num177 * scaleFactor;
                    Microsoft.Xna.Framework.Color color32 = color25;
                    color32 *= (num176 - (float)num177) / num176;
                    color32  = Color.Lerp(color32, Color.Transparent, (projectile.alpha) / 255);
                    SpriteBatch arg_7727_0 = Main.spriteBatch;
                    Texture2D   arg_7727_1 = Main.projectileTexture[projectile.type];
                    Vector2     arg_7727_2 = value8 - value9;
                    float       scale      = projectile.scale * (float)Math.Sin((num177 * 10 / projectile.localAI[0]) / MathHelper.Pi);
                    Microsoft.Xna.Framework.Rectangle?sourceRectangle2 = null;
                    arg_7727_0.Draw(arg_7727_1, arg_7727_2, sourceRectangle2, color32, projectile.rotation, new Vector2(num150, (float)(projectile.height / 2)),
                                    scale * ((projectile.ai[0] == 1) ? 2f : 1f), SpriteEffects.None, 0f);
                    num43 = num177;
                }
            }
            return(false);
        }
Example #5
0
        /// <summary>Draw the game object at a non-tile spot. Aka like debris.</summary>
        public override void draw(SpriteBatch spriteBatch, int xNonTile, int yNonTile, float layerDepth, float alpha = 1f)
        {
            if (Game1.eventUp && Game1.CurrentEvent.isTileWalkedOn(xNonTile / 64, yNonTile / 64))
            {
                return;
            }
            if ((int)(this.ParentSheetIndex) != 590 && (int)(this.Fragility) != 2)
            {
                spriteBatch.Draw(Game1.shadowTexture, Game1.GlobalToLocal(Game1.viewport, new Vector2((float)(xNonTile + 32), (float)(yNonTile + 51 + 4))), new Microsoft.Xna.Framework.Rectangle?(Game1.shadowTexture.Bounds), Color.White * alpha, 0.0f, new Vector2((float)Game1.shadowTexture.Bounds.Center.X, (float)Game1.shadowTexture.Bounds.Center.Y), 4f, SpriteEffects.None, layerDepth - 1E-06f);
            }
            SpriteBatch spriteBatch1      = spriteBatch;
            Texture2D   objectSpriteSheet = Game1.objectSpriteSheet;
            Vector2     local             = Game1.GlobalToLocal(Game1.viewport, new Vector2((float)(xNonTile + 32 + (this.shakeTimer > 0 ? Game1.random.Next(-1, 2) : 0)), (float)(yNonTile + 32 + (this.shakeTimer > 0 ? Game1.random.Next(-1, 2) : 0))));

            Microsoft.Xna.Framework.Rectangle?sourceRectangle = new Microsoft.Xna.Framework.Rectangle?(GameLocation.getSourceRectForObject(this.ParentSheetIndex));
            Color   color  = Color.White * alpha;
            double  num1   = 0.0;
            Vector2 origin = new Vector2(8f, 8f);
            Vector2 scale  = this.scale;
            double  num2   = (double)this.scale.Y > 1.0 ? (double)this.getScale().Y : 4.0;
            int     num3   = (bool)(this.flipped) ? 1 : 0;
            double  num4   = (double)layerDepth;

            spriteBatch1.Draw(this.displayTexture, local, this.animationManager.defaultDrawFrame.sourceRectangle, this.info.drawColor * alpha, (float)num1, origin, (float)4f, (SpriteEffects)num3, (float)num4);
        }
Example #6
0
        public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
        {
            Texture2D texture = Main.chain2Texture;

            Vector2 position      = projectile.Center;
            Vector2 mountedCenter = Main.player[projectile.owner].MountedCenter;

            Microsoft.Xna.Framework.Rectangle?sourceRectangle = new Microsoft.Xna.Framework.Rectangle?();
            Vector2 origin    = new Vector2((float)texture.Width * 0.5f, (float)texture.Height * 0.5f);
            float   num1      = (float)texture.Height;
            Vector2 vector2_4 = mountedCenter - position;
            float   rotation  = (float)Math.Atan2((double)vector2_4.Y, (double)vector2_4.X) - 1.57f;
            bool    flag      = true;

            if (float.IsNaN(position.X) && float.IsNaN(position.Y))
            {
                flag = false;
            }
            if (float.IsNaN(vector2_4.X) && float.IsNaN(vector2_4.Y))
            {
                flag = false;
            }
            while (flag)
            {
                if ((double)vector2_4.Length() < (double)num1 + 1.0)
                {
                    flag = false;
                }
                else
                {
                    Vector2 vector2_1 = vector2_4;
                    vector2_1.Normalize();
                    position += vector2_1 * num1;
                    vector2_4 = mountedCenter - position;
                    Microsoft.Xna.Framework.Color color2 = Lighting.GetColor((int)position.X / 16, (int)((double)position.Y / 16.0));
                    color2 = projectile.GetAlpha(color2);
                    Main.spriteBatch.Draw(texture, position - Main.screenPosition, sourceRectangle, color2, rotation, origin, 1.35f, SpriteEffects.None, 0.0f);
                }
            }

            Matrix dothematrx = Matrix.CreateRotationZ(projectile.rotation - MathHelper.ToRadians(90)) *
                                Matrix.CreateScale(1f, 1f, 1f) *
                                Matrix.CreateTranslation((new Vector3(projectile.Center.X, projectile.Center.Y, 0) - new Vector3(Main.screenPosition.X, Main.screenPosition.Y, 0)))
                                * Main.GameViewMatrix.ZoomMatrix;

            Main.spriteBatch.End();
            Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.LinearClamp, DepthStencilState.Default, RasterizerState.CullNone, null, dothematrx);
            for (int num315 = 0; num315 < angles.Length; num315 = num315 + 1)
            {
                Vector2   there = new Vector2((float)Math.Cos(angles[num315]), (float)Math.Sin(angles[num315])) * dist[num315];
                Texture2D tex2  = Main.itemTexture[ItemID.StickyGrenade];
                Main.spriteBatch.Draw(tex2, there, sourceRectangle, lightColor, 0, new Vector2(tex2.Width, tex2.Height) / 2, 1f, SpriteEffects.None, 0.0f);
            }
            Main.spriteBatch.End();
            Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, RasterizerState.CullCounterClockwise, null, Main.GameViewMatrix.ZoomMatrix);


            return(false);
        }
Example #7
0
 public void Draw(SpriteBatch spriteBatch, float Rotation, float Depth)
 {
     for (int i = 0; i < this.Count; i++)
     {
         Microsoft.Xna.Framework.Rectangle?sourceRectangle = null;
         spriteBatch.Draw(this.TextList[i].TextTexture, this.TextList[i].AlignedPosition, sourceRectangle, this.textColor, Rotation, Vector2.Zero, SpriteEffects.None, Depth + -0.0001f);
     }
 }
Example #8
0
 public void SetData <T>(int level, Microsoft.Xna.Framework.Rectangle?rect, T[] data, int startIndex, int elementCount) where T : struct
 {
     if (data == null)
     {
         throw new ArgumentNullException("data");
     }
     Threading.BlockOnUIThread((Action)(() =>
     {
         int local_0 = Marshal.SizeOf(typeof(T));
         GCHandle local_1 = GCHandle.Alloc((object)data, GCHandleType.Pinned);
         int local_2 = startIndex * local_0;
         IntPtr local_3 = (IntPtr)(local_1.AddrOfPinnedObject().ToInt64() + (long)local_2);
         int local_4;
         int local_5;
         int local_6;
         int local_7;
         if (rect.HasValue)
         {
             local_4 = rect.Value.X;
             local_5 = rect.Value.Y;
             local_6 = rect.Value.Width;
             local_7 = rect.Value.Height;
         }
         else
         {
             local_4 = 0;
             local_5 = 0;
             local_6 = Math.Max(this.width >> level, 1);
             local_7 = Math.Max(this.height >> level, 1);
         }
         int local_8 = GraphicsExtensions.GetBoundTexture2D();
         this.GenerateGLTextureIfRequired();
         GL.BindTexture(TextureTarget.Texture2D, this.glTexture);
         if (this.glFormat == (OpenTK.Graphics.OpenGL.PixelFormat) 34467)
         {
             if (rect.HasValue)
             {
                 GL.CompressedTexSubImage2D(TextureTarget.Texture2D, level, local_4, local_5, local_6, local_7, this.glFormat, data.Length - local_2, local_3);
             }
             else
             {
                 GL.CompressedTexImage2D(TextureTarget.Texture2D, level, this.glInternalFormat, local_6, local_7, 0, data.Length - local_2, local_3);
             }
         }
         else if (rect.HasValue)
         {
             GL.TexSubImage2D(TextureTarget.Texture2D, level, local_4, local_5, local_6, local_7, this.glFormat, this.glType, local_3);
         }
         else
         {
             GL.TexImage2D(TextureTarget.Texture2D, level, this.glInternalFormat, local_6, local_7, 0, this.glFormat, this.glType, local_3);
         }
         GL.Finish();
         GL.BindTexture(TextureTarget.Texture2D, local_8);
         local_1.Free();
         GL.Finish();
     }));
 }
Example #9
0
 public void ApplyUnsafeMapOverride(string override_map, Microsoft.Xna.Framework.Rectangle?source_rect, Microsoft.Xna.Framework.Rectangle dest_rect)
 {
     ApplyMapOverride(override_map, source_rect, dest_rect);
     Microsoft.Xna.Framework.Rectangle nontile_rect = new Microsoft.Xna.Framework.Rectangle(dest_rect.X * 64, dest_rect.Y * 64, dest_rect.Width * 64, dest_rect.Height * 64);
     if (this == Game1.player.currentLocation && nontile_rect.Intersects(Game1.player.GetBoundingBox()) && Game1.player.currentLocation.isCollidingPosition(Game1.player.GetBoundingBox(), Game1.viewport, isFarmer: true, 0, glider: false, Game1.player))
     {
         Game1.player.TemporaryPassableTiles.Add(nontile_rect);
     }
 }
        public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
        {
            Vector2   vector60    = projectile.Center + Vector2.UnitY * projectile.gfxOffY - Main.screenPosition;
            Texture2D texture2D31 = Main.projectileTexture[projectile.type];

            Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0));
            Microsoft.Xna.Framework.Color alpha4  = new Color(109, 255, 116, projectile.GetAlpha(color25).A);
            Microsoft.Xna.Framework.Color kys2    = new Color(216, 255, 150, alpha4.A);
            alpha4 = Microsoft.Xna.Framework.Color.Lerp(alpha4, kys2, (float)(1 / 240));
            Vector2       origin8       = new Vector2((float)texture2D31.Width, (float)texture2D31.Height) / 2f;
            SpriteEffects spriteEffects = SpriteEffects.None;
            //if (projectile.type == 578 || projectile.type == 579 || projectile.type == 641)
            {
                Microsoft.Xna.Framework.Color color55 = alpha4 * 0.8f;
                color55.A /= 2;
                Microsoft.Xna.Framework.Color color56 = Microsoft.Xna.Framework.Color.Lerp(projectile.GetAlpha(color25), Microsoft.Xna.Framework.Color.Green, 0.5f);
                color56.A = alpha4.A;
                float num278 = 0.95f + (projectile.rotation * 0.75f).ToRotationVector2().Y * 0.1f;
                color56 *= num278;
                float scale12 = 0.6f + projectile.scale * 0.6f * num278;
                projectile.height = (int)(60 * scale12);
                projectile.width  = (int)(60 * scale12);
                SpriteBatch arg_DCA2_0 = Main.spriteBatch;
                Texture2D   arg_DCA2_1 = Main.extraTexture[50];
                Vector2     arg_DCA2_2 = vector60;
                Microsoft.Xna.Framework.Rectangle?sourceRectangle2 = null;
                arg_DCA2_0.Draw(arg_DCA2_1, arg_DCA2_2, sourceRectangle2, color56, -projectile.rotation + 0.35f, origin8, scale12, spriteEffects ^ SpriteEffects.FlipHorizontally, 0f);
                SpriteBatch arg_DCEE_0 = Main.spriteBatch;
                Texture2D   arg_DCEE_1 = Main.extraTexture[50];
                Vector2     arg_DCEE_2 = vector60;
                sourceRectangle2 = null;
                arg_DCEE_0.Draw(arg_DCEE_1, arg_DCEE_2, sourceRectangle2, alpha4, -projectile.rotation, origin8, projectile.scale, spriteEffects ^ SpriteEffects.FlipHorizontally, 0f);
                SpriteBatch arg_DD3E_0 = Main.spriteBatch;
                Texture2D   arg_DD3E_1 = texture2D31;
                Vector2     arg_DD3E_2 = vector60;
                sourceRectangle2 = null;
                arg_DD3E_0.Draw(arg_DD3E_1, arg_DD3E_2, sourceRectangle2, color55, -projectile.rotation * 0.7f, origin8, projectile.scale, spriteEffects ^ SpriteEffects.FlipHorizontally, 0f);
                SpriteBatch arg_DD9D_0 = Main.spriteBatch;
                Texture2D   arg_DD9D_1 = Main.extraTexture[50];
                Vector2     arg_DD9D_2 = vector60;
                sourceRectangle2 = null;
                arg_DD9D_0.Draw(arg_DD9D_1, arg_DD9D_2, sourceRectangle2, alpha4 * 0.8f, projectile.rotation * 0.5f, origin8, projectile.scale * 0.9f, spriteEffects, 0f);
                alpha4.A = 0;
            }
            bool flag27 = false;

            if (!(flag27 | (projectile.type == 464 && projectile.ai[1] != 1f)))
            {
                SpriteBatch arg_E055_0 = Main.spriteBatch;
                Texture2D   arg_E055_1 = texture2D31;
                Vector2     arg_E055_2 = vector60;
                Microsoft.Xna.Framework.Rectangle?sourceRectangle2 = null;
                arg_E055_0.Draw(arg_E055_1, arg_E055_2, sourceRectangle2, alpha4, projectile.rotation, origin8, projectile.scale, spriteEffects, 0f);
            }
            return(false);
        }
Example #11
0
        /// <summary>Gets a copy of 2D texture data in an one-dimensional byte array, specifying a source rectangle, and start index.</summary>
        /// <param name="rect">The section of the texture to copy. <paramref name="null"/> indicates the data will be copied from the entire texture.</param>
        /// <param name="data">An one-dimensional byte array.</param>
        /// <param name="startIndex">Index within the array of the first element (pixel) to get.</param>
        public void GetData(Microsoft.Xna.Framework.Rectangle?rect, BytePixels data, int startIndex)
        {
            if (rect != null)
            {
                var r = (Microsoft.Xna.Framework.Rectangle)rect;
                GetData(r, data, startIndex, r.Width * r.Height);
                return;
            }

            GetData(data);
        }
Example #12
0
        public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
        {
            Texture2D texture = ModContent.GetTexture("Varia/Items/Optime/NiceyArm");

            if (projectile.ai[1] < 1)
            {
                mountedCenter       = projectile.Center;
                projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f;
                projectile.ai[1]++;
            }
            Vector2   position        = projectile.Center;
            Rectangle?sourceRectangle = new Microsoft.Xna.Framework.Rectangle?();
            Vector2   origin          = new Vector2((float)texture.Width * 0.5f, (float)texture.Height * 0.5f);
            float     num1            = (float)texture.Height;
            Vector2   vector2_4       = mountedCenter - position;
            float     rotation        = (float)Math.Atan2((double)vector2_4.Y, (double)vector2_4.X) - 1.57f;
            bool      flag            = true;

            if (float.IsNaN(position.X) && float.IsNaN(position.Y))
            {
                flag = false;
            }
            if (float.IsNaN(vector2_4.X) && float.IsNaN(vector2_4.Y))
            {
                flag = false;
            }
            while (flag)
            {
                if ((double)vector2_4.Length() < (double)num1 + 1.0)
                {
                    flag = false;
                }
                else
                {
                    Vector2 vector2_1 = vector2_4;
                    vector2_1.Normalize();
                    position += vector2_1 * num1;
                    vector2_4 = mountedCenter - position;
                    Color color2 = Lighting.GetColor((int)position.X / 16, (int)((double)position.Y / 16.0));
                    color2 = projectile.GetAlpha(color2);
                    Main.spriteBatch.Draw(texture, position - Main.screenPosition, sourceRectangle, color2, rotation, origin, 1f, SpriteEffects.None, 0.0f);
                }
            }
            if (Main.rand.NextFloat() < 1f)
            {
                Dust    dust;
                Vector2 ebip = mountedCenter;
                dust           = Main.dust[Terraria.Dust.NewDust(ebip, 0, 0, 109, 0f, 0f, 0, new Color(0, 92, 255), 2.171053f)];
                dust.noGravity = true;
                dust.shader    = GameShaders.Armor.GetSecondaryShader(50, Main.LocalPlayer);
            }

            return(true);
        }
Example #13
0
        /// <summary>Returns a copy of 2D texture data in an one-dimensional byte array, specifying a source rectangle.</summary>
        /// <param name="rect">The section of the texture to copy. <paramref name="null"/> indicates the data will be copied from the entire texture.</param>
        public BytePixels GetData(Microsoft.Xna.Framework.Rectangle?rect)
        {
            if (rect != null)
            {
                var r    = (Microsoft.Xna.Framework.Rectangle)rect;
                var data = new BytePixels(new SizeInt32(r.Width, r.Height), Bpp);
                GetData(r, data, 0, data.Size.Total);
                return(data);
            }

            return(GetData());
        }
Example #14
0
        public override void PostDraw(SpriteBatch spriteBatch, Color lightColor)
        {
            DrawGlist("Right", lightColor);

            if (projectile.frame < 8)
            {
                return;
            }

            /* Right arm */
            Texture2D texture = ModContent.GetTexture("cool_jojo_stands/Projectiles/Minions/StarPlatinumRequiem_ArmRight");

            Vector2 position;
            Vector2 mountedCenter = Main.player[projectile.owner].MountedCenter;

            Microsoft.Xna.Framework.Rectangle?sourceRectangle = new Microsoft.Xna.Framework.Rectangle?();
            Vector2 origin;
            float   rotation;

            if (projectile.spriteDirection == -1)
            {
                position = projectile.Center - new Vector2(-15f, 2f);
                origin   = new Vector2((float)texture.Width * 0.70f, (float)texture.Height * 0.45f);
                rotation = attackAngle - (float)Math.PI * Math.Sign(attackAngle);
                rotation = (rotation > invMaxAttackAngle) ? invMaxAttackAngle :
                           ((rotation < invMinAttackAngle) ? invMinAttackAngle : rotation);
            }
            else
            {
                position = projectile.Center - new Vector2(15f, 2f);
                origin   = new Vector2((float)texture.Width * 0.30f, (float)texture.Height * 0.45f);
                rotation = (attackAngle > maxAttackAngle) ? maxAttackAngle :
                           ((attackAngle < minAttackAngle) ? minAttackAngle : attackAngle);
            }

            lightColor = projectile.GetAlpha(lightColor);

            Main.spriteBatch.Draw(texture, position - Main.screenPosition, sourceRectangle, lightColor, rotation, origin, 1f, (projectile.spriteDirection == -1) ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0.0f);

            /* Scapular */
            texture = ModContent.GetTexture("cool_jojo_stands/Projectiles/Minions/StarPlatinumRequiem_Scapular");

            position        = projectile.Center;
            mountedCenter   = Main.player[projectile.owner].MountedCenter;
            sourceRectangle = new Microsoft.Xna.Framework.Rectangle?();
            origin          = new Vector2((float)texture.Width * 0.5f, (float)texture.Height * 0.5f);

            lightColor = projectile.GetAlpha(lightColor);

            Main.spriteBatch.Draw(texture, position - Main.screenPosition, sourceRectangle, lightColor, 0f, origin, 1f, (projectile.spriteDirection == -1) ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0.0f);

            return;
        }
Example #15
0
        public override bool PreDraw(Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch, Color lightColor)
        {
            Texture2D texture;

            if (!isTwisted)
            {
                texture = mod.GetTexture("GumGumFruit/RifleTwist");
            }
            else
            {
                texture = mod.GetTexture("GumGumFruit/RubberArm");
            }

            Vector2 position      = projectile.Center;
            Vector2 offset        = new Vector2(8, 0);
            Vector2 mountedCenter = Main.player[projectile.owner].MountedCenter - offset;

            Microsoft.Xna.Framework.Rectangle?sourceRectangle = new Microsoft.Xna.Framework.Rectangle?();
            Vector2 origin    = new Vector2((float)texture.Width * 0.5f, (float)texture.Height * 0.5f);
            float   num1      = (float)texture.Height;
            Vector2 vector2_4 = mountedCenter - position;
            float   rotation  = (float)Math.Atan2((double)vector2_4.Y, (double)vector2_4.X) - 1.57f;
            bool    flag      = true;

            if (float.IsNaN(position.X) && float.IsNaN(position.Y))
            {
                flag = false;
            }
            if (float.IsNaN(vector2_4.X) && float.IsNaN(vector2_4.Y))
            {
                flag = false;
            }
            while (flag)
            {
                if ((double)vector2_4.Length() < (double)num1 + 1.0)
                {
                    flag = false;
                }
                else
                {
                    Vector2 vector2_1 = vector2_4;
                    vector2_1.Normalize();
                    position += vector2_1 * num1;
                    vector2_4 = mountedCenter - position;
                    Microsoft.Xna.Framework.Color color2 = Lighting.GetColor((int)position.X / 16, (int)((double)position.Y / 16.0));
                    color2 = projectile.GetAlpha(color2);
                    Main.spriteBatch.Draw(texture, position - Main.screenPosition + offset, sourceRectangle, color2, rotation, origin, 1f, SpriteEffects.None, 0.0f);
                }
            }

            return(true);
        }
Example #16
0
        public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
        {
            if (projectile.velocity == Vector2.Zero)
            {
                return(false);
            }
            Texture2D texture2D19 = Main.projectileTexture[projectile.type];
            Texture2D texture2D20 = mod.GetTexture("Projectiles/Deathrays/" + texture + "2");
            Texture2D texture2D21 = mod.GetTexture("Projectiles/Deathrays/" + texture + "3");
            float     num223      = projectile.localAI[1];

            Microsoft.Xna.Framework.Color color44 = new Microsoft.Xna.Framework.Color(255, 50, 50, 50);
            color44 *= 0.75f;
            //color44 = Color.Lerp(color44, Color.Transparent, transparency);
            SpriteBatch arg_ABD8_0 = Main.spriteBatch;
            Texture2D   arg_ABD8_1 = texture2D19;
            Vector2     arg_ABD8_2 = projectile.Center - Main.screenPosition;

            Microsoft.Xna.Framework.Rectangle?sourceRectangle2 = null;
            arg_ABD8_0.Draw(arg_ABD8_1, arg_ABD8_2, sourceRectangle2, color44, projectile.rotation, texture2D19.Size() / 2f, projectile.scale, SpriteEffects.None, 1f);
            num223 -= (float)(texture2D19.Height / 2 + texture2D21.Height) * projectile.scale;
            Vector2 value20 = projectile.Center;

            value20 += projectile.velocity * projectile.scale * (float)texture2D19.Height / 2f;
            if (num223 > 0f)
            {
                float num224 = 0f;
                Microsoft.Xna.Framework.Rectangle rectangle7 = new Microsoft.Xna.Framework.Rectangle(0, 16 * (projectile.timeLeft / 3 % 5), texture2D20.Width, 16);
                while (num224 + 1f < num223)
                {
                    if (num223 - num224 < (float)rectangle7.Height)
                    {
                        rectangle7.Height = (int)(num223 - num224);
                    }
                    Main.spriteBatch.Draw(texture2D20, value20 - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(rectangle7), color44, projectile.rotation, new Vector2((float)(rectangle7.Width / 2), 0f), projectile.scale, SpriteEffects.None, 1f);
                    num224       += (float)rectangle7.Height * projectile.scale;
                    value20      += projectile.velocity * (float)rectangle7.Height * projectile.scale;
                    rectangle7.Y += 16;
                    if (rectangle7.Y + rectangle7.Height > texture2D20.Height)
                    {
                        rectangle7.Y = 0;
                    }
                }
            }
            SpriteBatch arg_AE2D_0 = Main.spriteBatch;
            Texture2D   arg_AE2D_1 = texture2D21;
            Vector2     arg_AE2D_2 = value20 - Main.screenPosition;

            sourceRectangle2 = null;
            arg_AE2D_0.Draw(arg_AE2D_1, arg_AE2D_2, sourceRectangle2, color44, projectile.rotation, texture2D21.Frame(1, 1, 0, 0).Top(), projectile.scale, SpriteEffects.None, 1f);
            return(false);
        }
Example #17
0
        public override bool PreDraw(ref Color lightColor)
        {
            if (Projectile.velocity == Vector2.Zero)
            {
                return(false);
            }
            Texture2D texture2D19 = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value;
            Texture2D texture2D20 = FargowiltasSouls.Instance.Assets.Request <Texture2D>("Projectiles/Deathrays/" + texture + "2", ReLogic.Content.AssetRequestMode.ImmediateLoad).Value;
            Texture2D texture2D21 = FargowiltasSouls.Instance.Assets.Request <Texture2D>("Projectiles/Deathrays/" + texture + "3", ReLogic.Content.AssetRequestMode.ImmediateLoad).Value;
            float     num223      = Projectile.localAI[1];

            Microsoft.Xna.Framework.Color color44 = new Microsoft.Xna.Framework.Color(255, 50, 50, 50);
            color44 *= 0.75f;
            //color44 = Color.Lerp(color44, Color.Transparent, transparency);
            SpriteBatch arg_ABD8_0 = Main.spriteBatch;
            Texture2D   arg_ABD8_1 = texture2D19;
            Vector2     arg_ABD8_2 = Projectile.Center - Main.screenPosition;

            Microsoft.Xna.Framework.Rectangle?sourceRectangle2 = null;
            arg_ABD8_0.Draw(arg_ABD8_1, arg_ABD8_2, sourceRectangle2, color44, Projectile.rotation, texture2D19.Size() / 2f, Projectile.scale, SpriteEffects.None, 1f);
            num223 -= (float)(texture2D19.Height / 2 + texture2D21.Height) * Projectile.scale;
            Vector2 value20 = Projectile.Center;

            value20 += Projectile.velocity * Projectile.scale * (float)texture2D19.Height / 2f;
            if (num223 > 0f)
            {
                float num224 = 0f;
                Microsoft.Xna.Framework.Rectangle rectangle7 = new Microsoft.Xna.Framework.Rectangle(0, 16 * (Projectile.timeLeft / 3 % 5), texture2D20.Width, 16);
                while (num224 + 1f < num223)
                {
                    if (num223 - num224 < (float)rectangle7.Height)
                    {
                        rectangle7.Height = (int)(num223 - num224);
                    }
                    Main.EntitySpriteDraw(texture2D20, value20 - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(rectangle7), color44, Projectile.rotation, new Vector2((float)(rectangle7.Width / 2), 0f), Projectile.scale, SpriteEffects.None, 1);
                    num224       += (float)rectangle7.Height * Projectile.scale;
                    value20      += Projectile.velocity * (float)rectangle7.Height * Projectile.scale;
                    rectangle7.Y += 16;
                    if (rectangle7.Y + rectangle7.Height > texture2D20.Height)
                    {
                        rectangle7.Y = 0;
                    }
                }
            }
            SpriteBatch arg_AE2D_0 = Main.spriteBatch;
            Texture2D   arg_AE2D_1 = texture2D21;
            Vector2     arg_AE2D_2 = value20 - Main.screenPosition;

            sourceRectangle2 = null;
            arg_AE2D_0.Draw(arg_AE2D_1, arg_AE2D_2, sourceRectangle2, color44, Projectile.rotation, texture2D21.Frame(1, 1, 0, 0).Top(), Projectile.scale, SpriteEffects.None, 1f);
            return(false);
        }
Example #18
0
        private void DrawGlist(string type, Color lightColor)
        {
            Texture2D texture = ModContent.GetTexture("cool_jojo_stands/Projectiles/Minions/StarPlatinumRequiem_Glist" + type);

            Vector2 position = projectile.Center;

            Microsoft.Xna.Framework.Rectangle?sourceRectangle =
                new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, 92 * GlistFrame, 92, 92));
            Vector2 origin        = new Vector2(46f, 46f);
            Vector2 mountedCenter = Main.player[projectile.owner].MountedCenter;

            Main.spriteBatch.Draw(texture, position - Main.screenPosition, sourceRectangle, lightColor, 0f, origin, 1f, (projectile.spriteDirection == -1) ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0.0f);
        }
Example #19
0
        public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
        {
            Texture2D texture = ModContent.GetTexture("ElementsAwoken/NPCs/Bosses/Volcanox/VolcanoxChain");
            NPC       parent  = Main.npc[0];

            for (int i = 0; i < Main.npc.Length; ++i)
            {
                if (Main.npc[i].type == mod.NPCType("Volcanox"))
                {
                    parent = Main.npc[i];
                    break;
                }
            }
            Vector2 position      = npc.Center;
            Vector2 mountedCenter = parent.Center;

            Microsoft.Xna.Framework.Rectangle?sourceRectangle = new Microsoft.Xna.Framework.Rectangle?();
            Vector2 origin    = new Vector2((float)texture.Width * 0.5f, (float)texture.Height * 0.5f);
            float   num1      = (float)texture.Height;
            Vector2 vector2_4 = mountedCenter - position;
            float   rotation  = (float)Math.Atan2((double)vector2_4.Y, (double)vector2_4.X) - 1.57f;
            bool    flag      = true;

            if (float.IsNaN(position.X) && float.IsNaN(position.Y))
            {
                flag = false;
            }
            if (float.IsNaN(vector2_4.X) && float.IsNaN(vector2_4.Y))
            {
                flag = false;
            }
            while (flag)
            {
                if ((double)vector2_4.Length() < (double)num1 + 1.0)
                {
                    flag = false;
                }
                else
                {
                    Vector2 vector2_1 = vector2_4;
                    vector2_1.Normalize();
                    position += vector2_1 * num1;
                    vector2_4 = mountedCenter - position;
                    Color color2 = Lighting.GetColor((int)position.X / 16, (int)((double)position.Y / 16.0));
                    color2 = npc.GetAlpha(color2);
                    Main.spriteBatch.Draw(texture, position - Main.screenPosition, sourceRectangle, color2, rotation, origin, 1f, SpriteEffects.None, 0.0f);
                }
            }

            return(true);
        }
Example #20
0
        public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
        {
            Texture2D texture = ModContent.GetTexture("ElementsAwoken/Projectiles/Flails/HungryFlailChain");

            Vector2   position        = projectile.Center;
            Vector2   mountedCenter   = Main.player[projectile.owner].MountedCenter;
            Rectangle?sourceRectangle = new Microsoft.Xna.Framework.Rectangle?();
            Vector2   origin          = new Vector2((float)texture.Width * 0.5f, (float)texture.Height * 0.5f);
            float     num1            = (float)texture.Height;
            Vector2   vector2_4       = mountedCenter - position;
            float     rotation        = (float)Math.Atan2((double)vector2_4.Y, (double)vector2_4.X) - 1.57f;
            bool      flag            = true;

            if (float.IsNaN(position.X) && float.IsNaN(position.Y))
            {
                flag = false;
            }
            if (float.IsNaN(vector2_4.X) && float.IsNaN(vector2_4.Y))
            {
                flag = false;
            }
            while (flag)
            {
                if ((double)vector2_4.Length() < (double)num1 + 1.0)
                {
                    flag = false;
                }
                else
                {
                    Vector2 vector2_1 = vector2_4;
                    vector2_1.Normalize();
                    position += vector2_1 * num1;
                    vector2_4 = mountedCenter - position;
                    Color color2 = Lighting.GetColor((int)position.X / 16, (int)((double)position.Y / 16.0));
                    color2 = projectile.GetAlpha(color2);
                    Main.spriteBatch.Draw(texture, position - Main.screenPosition, sourceRectangle, color2, rotation, origin, 1.35f, SpriteEffects.None, 0.0f);
                }
            }

            projectile.frameCounter++;
            if (projectile.frameCounter >= 6)
            {
                projectile.frame++;
                projectile.frameCounter = 0;
                if (projectile.frame > 2)
                {
                    projectile.frame = 0;
                }
            }
            return(true);
        }
        public override bool PreDraw(Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch, Color lightColor)
        {
            if (projectile.velocity == Vector2.Zero)
            {
                return(false);
            }
            Texture2D laserStartTexture = Main.projectileTexture[projectile.type];
            Texture2D texture2D14       = mod.GetTexture("Projectiles/InfernonSkull_LaserMid");
            Texture2D texture2D15       = mod.GetTexture("Projectiles/InfernonSkull_LaserEnd");
            float     num205            = projectile.localAI[1];

            Microsoft.Xna.Framework.Color color33 = new Microsoft.Xna.Framework.Color(255, 255, 255, 0) * 0.9f;
            SpriteBatch arg_95FF_0 = Main.spriteBatch;
            Texture2D   arg_95FF_1 = laserStartTexture;
            Vector2     arg_95FF_2 = projectile.Center - Main.screenPosition;

            Microsoft.Xna.Framework.Rectangle?sourceRectangle2 = null;
            arg_95FF_0.Draw(arg_95FF_1, arg_95FF_2, sourceRectangle2, color33, projectile.rotation, laserStartTexture.Size() / 2f, projectile.scale, SpriteEffects.None, 0f);
            num205 -= (float)(laserStartTexture.Height / 2 + texture2D15.Height) * projectile.scale;
            Vector2 value15 = projectile.Center;

            value15 += projectile.velocity * projectile.scale * (float)laserStartTexture.Height / 2f;
            if (num205 > 0f)
            {
                float num206 = 0f;
                Microsoft.Xna.Framework.Rectangle rectangle4 = new Microsoft.Xna.Framework.Rectangle(0, 16 * (projectile.timeLeft / 3 % 5), texture2D14.Width, 16);
                while (num206 + 1f < num205)
                {
                    if (num205 - num206 < (float)rectangle4.Height)
                    {
                        rectangle4.Height = (int)(num205 - num206);
                    }
                    Main.spriteBatch.Draw(texture2D14, value15 - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(rectangle4), color33, projectile.rotation, new Vector2((float)(rectangle4.Width / 2), 0f), projectile.scale, SpriteEffects.None, 0f);
                    num206       += (float)rectangle4.Height * projectile.scale;
                    value15      += projectile.velocity * (float)rectangle4.Height * projectile.scale;
                    rectangle4.Y += 16;
                    if (rectangle4.Y + rectangle4.Height > texture2D14.Height)
                    {
                        rectangle4.Y = 0;
                    }
                }
            }
            SpriteBatch arg_9865_0 = Main.spriteBatch;
            Texture2D   arg_9865_1 = texture2D15;
            Vector2     arg_9865_2 = value15 - Main.screenPosition;

            sourceRectangle2 = null;
            arg_9865_0.Draw(arg_9865_1, arg_9865_2, sourceRectangle2, color33, projectile.rotation, texture2D15.Frame(1, 1, 0, 0).Top(), projectile.scale, SpriteEffects.None, 0f);
            return(false);
        }
Example #22
0
        internal void Draw()
        {
            if (this.ShowingFaction != null)
            {
                CacheManager.Scale = Scale;

                Microsoft.Xna.Framework.Rectangle?sourceRectangle = null;
                CacheManager.Draw(this.BackgroundTexture, this.BackgroundDisplayPosition, sourceRectangle, Microsoft.Xna.Framework.Color.White, 0f, Vector2.Zero, SpriteEffects.None, 0.02f);  // 0.2f);
                foreach (LabelText text in this.LabelTexts)
                {
                    text.Label.Draw(0.01999f);
                    text.Text.Draw(0.01999f);
                }
                foreach (TechniqueItem item in this.AllTechniques)
                {
                    Microsoft.Xna.Framework.Color white = Microsoft.Xna.Framework.Color.White;
                    Microsoft.Xna.Framework.Color black = Microsoft.Xna.Framework.Color.Black;
                    if (item == this.current)
                    {
                        white = new Microsoft.Xna.Framework.Color((byte)150, (byte)150, (byte)150);
                        black = Microsoft.Xna.Framework.Color.White;
                    }
                    item.Text.Draw(black, 0.01989f);
                    if (this.ShowingFaction.IsTechniqueUpgrading(item.LinkedTechnique.ID))
                    {
                        sourceRectangle = null;
                        CacheManager.Draw(this.ButtonUpgradingTexture, item.Position, sourceRectangle, white, 0f, Vector2.Zero, SpriteEffects.None, 0.0199f);  // 0.199f);
                    }
                    else if (this.ShowingFaction.HasTechnique(item.LinkedTechnique.ID))
                    {
                        sourceRectangle = null;
                        CacheManager.Draw(this.ButtonUpgradedTexture, item.Position, sourceRectangle, white, 0f, Vector2.Zero, SpriteEffects.None, 0.0199f);
                    }
                    else if (this.Control && this.ShowingFaction.MatchTechnique(item.LinkedTechnique, this.UpgradingArchitecture))
                    {
                        sourceRectangle = null;
                        CacheManager.Draw(this.ButtonAvailableTexture, item.Position, sourceRectangle, white, 0f, Vector2.Zero, SpriteEffects.None, 0.0199f);
                    }
                    else
                    {
                        sourceRectangle = null;
                        CacheManager.Draw(this.ButtonBasicTexture, item.Position, sourceRectangle, white, 0f, Vector2.Zero, SpriteEffects.None, 0.0199f);
                    }
                }
                this.CommentsText.Draw(0.01999f);

                CacheManager.Scale = Vector2.One;
            }
        }
        public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
        {
            Texture2D texture = ModContent.GetTexture("Varia/Items/Miscellaneous/RainGuillotineChain");
            Texture2D baseTex = ModContent.GetTexture("Varia/Items/Miscellaneous/RainGuillotineBase");

            if (projectile.ai[1] < 1)
            {
                mountedCenter       = projectile.Center;
                projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f;
                projectile.ai[1]++;
            }
            Vector2   position        = projectile.Center;
            Rectangle?sourceRectangle = new Microsoft.Xna.Framework.Rectangle?();
            Vector2   origin          = new Vector2((float)texture.Width * 0.5f, (float)texture.Height * 0.5f);
            float     num1            = (float)texture.Height;
            Vector2   vector2_4       = mountedCenter - position;
            float     rotation        = (float)Math.Atan2((double)vector2_4.Y, (double)vector2_4.X) - 1.57f;
            bool      flag            = true;

            if (float.IsNaN(position.X) && float.IsNaN(position.Y))
            {
                flag = false;
            }
            if (float.IsNaN(vector2_4.X) && float.IsNaN(vector2_4.Y))
            {
                flag = false;
            }
            while (flag)
            {
                if ((double)vector2_4.Length() < (double)num1 + 1.0)
                {
                    flag = false;
                }
                else
                {
                    Vector2 vector2_1 = vector2_4;
                    vector2_1.Normalize();
                    position += vector2_1 * num1;
                    vector2_4 = mountedCenter - position;
                    Color color2 = Lighting.GetColor((int)position.X / 16, (int)((double)position.Y / 16.0));
                    color2 = projectile.GetAlpha(color2);
                    Main.spriteBatch.Draw(texture, position - Main.screenPosition, sourceRectangle, color2, rotation, origin, 1f, SpriteEffects.None, 0.0f);
                }
            }
            origin = new Vector2((float)baseTex.Width * 0.5f, (float)baseTex.Height * 0.5f);
            Main.spriteBatch.Draw(baseTex, mountedCenter - Main.screenPosition, sourceRectangle, Lighting.GetColor((int)position.X / 16, (int)((double)position.Y / 16.0)), 0f, origin, 1f, SpriteEffects.None, 0.0f);
            return(true);
        }
Example #24
0
 public void GetData <T>(int level, Microsoft.Xna.Framework.Rectangle?rect, T[] data, int startIndex, int elementCount) where T : struct
 {
     Threading.BlockOnUIThread((Action)(() =>
     {
         GL.BindTexture(TextureTarget.Texture2D, this.glTexture);
         if (rect.HasValue)
         {
             throw new NotImplementedException();
         }
         if (this.glFormat == (OpenTK.Graphics.OpenGL.PixelFormat) 34467)
         {
             throw new NotImplementedException();
         }
         GL.GetTexImage <T>(TextureTarget.Texture2D, level, this.glFormat, this.glType, data);
     }));
 }
Example #25
0
        public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor)
        {
            Texture2D texture1 = (Texture2D)null;
            Color     color1   = Color.White;
            Texture2D texture2 = ModLoader.GetTexture("Negadium/Projectiles/Summoner/HydraHeadMinion_Neck");

            Vector2 position      = projectile.Center;
            Vector2 mountedCenter = new Vector2(player.Center.X, player.Center.Y);

            Microsoft.Xna.Framework.Rectangle?sourceRectangle = new Microsoft.Xna.Framework.Rectangle?();
            Vector2 origin    = new Vector2((float)texture2.Width * 0.5f, (float)texture2.Height * 0.5f);
            float   num1      = (float)texture2.Height;
            Vector2 vector2_4 = mountedCenter - position;
            float   rotation  = (float)Math.Atan2((double)vector2_4.Y, (double)vector2_4.X) - 1.57f;
            bool    flag      = true;

            if (float.IsNaN(position.X) && float.IsNaN(position.Y))
            {
                flag = false;
            }
            if (float.IsNaN(vector2_4.X) && float.IsNaN(vector2_4.Y))
            {
                flag = false;
            }
            while (flag)
            {
                if ((double)vector2_4.Length() < (double)num1 + 1.0)
                {
                    flag = false;
                }
                else
                {
                    Vector2 vector2_1 = vector2_4;
                    vector2_1.Normalize();
                    position += vector2_1 * num1;
                    vector2_4 = mountedCenter - position;
                    Microsoft.Xna.Framework.Color color2 = Lighting.GetColor((int)position.X / 16, (int)((double)position.Y / 16.0));
                    color2 = projectile.GetAlpha(color2);
                    Main.spriteBatch.Draw(texture2, position - Main.screenPosition, sourceRectangle, color2, rotation, origin, 1f, SpriteEffects.None, 0.0f);
                    if (texture1 != null)
                    {
                        Main.spriteBatch.Draw(texture1, position - Main.screenPosition, sourceRectangle, color1, rotation, origin, 1f, SpriteEffects.None, 0.0f);
                    }
                }
            }
            return(true);
        }
Example #26
0
        public override void PostDraw(Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch, Color lightColor)
        {
            Texture2D texture1 = (Texture2D)null;
            Color     color1   = Color.White;
            Texture2D texture2 = ModLoader.GetTexture("Gyrolite/Projectiles/Magic/LifeDrain_Chain");

            Vector2 position      = projectile.Center;
            Vector2 mountedCenter = Main.player[projectile.owner].MountedCenter;

            Microsoft.Xna.Framework.Rectangle?sourceRectangle = new Microsoft.Xna.Framework.Rectangle?();
            Vector2 origin    = new Vector2((float)texture2.Width * 0.5f, (float)texture2.Height * 0.5f);
            float   num1      = (float)texture2.Height;
            Vector2 vector2_4 = mountedCenter - position;
            float   rotation  = (float)Math.Atan2((double)vector2_4.Y, (double)vector2_4.X) - 1.57f;
            bool    flag      = true;

            if (float.IsNaN(position.X) && float.IsNaN(position.Y))
            {
                flag = false;
            }
            if (float.IsNaN(vector2_4.X) && float.IsNaN(vector2_4.Y))
            {
                flag = false;
            }
            while (flag)
            {
                if ((double)vector2_4.Length() < (double)num1 + 1.0)
                {
                    flag = false;
                }
                else
                {
                    Vector2 vector2_1 = vector2_4;
                    vector2_1.Normalize();
                    position += vector2_1 * num1;
                    vector2_4 = mountedCenter - position;
                    Microsoft.Xna.Framework.Color color2 = Lighting.GetColor((int)position.X / 16, (int)((double)position.Y / 16.0));
                    color2 = projectile.GetAlpha(color2);
                    Main.spriteBatch.Draw(texture2, position - Main.screenPosition, sourceRectangle, color2, rotation, origin, 1f, SpriteEffects.None, 0.0f);
                    if (texture1 != null)
                    {
                        Main.spriteBatch.Draw(texture1, position - Main.screenPosition, sourceRectangle, color1, rotation, origin, 1f, SpriteEffects.None, 0.0f);
                    }
                }
            }
        }
Example #27
0
        public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
        {
            projectile.scale = Main.player[Main.myPlayer].HeldItem.scale;
            Color     color29  = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0));
            Vector2   vector43 = projectile.position + new Vector2(projectile.width, projectile.height) / 2f + Vector2.UnitY * projectile.gfxOffY - Main.screenPosition;
            Texture2D value107 = Main.projectileTexture[projectile.type];

            Microsoft.Xna.Framework.Color color68 = projectile.GetAlpha(color29);
            Vector2 origin17 = new Vector2(value107.Width, value107.Height) / 2f;
            float   num295   = projectile.rotation;
            Vector2 vector44 = Vector2.One * projectile.scale;

            Microsoft.Xna.Framework.Rectangle?sourceRectangle2 = null;
            num295 -= (float)System.Math.PI / 4f * (float)projectile.spriteDirection;
            spriteBatch.Draw(value107, vector43, sourceRectangle2, color68, num295, origin17, vector44, SpriteEffects.None, 0f);
            return(false);
        }
Example #28
0
        public void draw(SpriteBatch b)
        {
            b.Begin(SpriteSortMode.FrontToBack, BlendState.AlphaBlend, SamplerState.PointClamp, (DepthStencilState)null, (RasterizerState)null);
            SpriteBatch spriteBatch1 = b;
            Texture2D   background   = this.background;
            Viewport    viewport1    = Game1.graphics.GraphicsDevice.Viewport;
            double      num1         = (double)(viewport1.Width / 2 - this.background.Bounds.Width / 2 * Game1.pixelZoom);
            int         num2         = -(this.background.Bounds.Height * Game1.pixelZoom);

            viewport1 = Game1.graphics.GraphicsDevice.Viewport;
            int     height1   = viewport1.Height;
            double  num3      = (double)(num2 + height1);
            Vector2 position1 = new Vector2((float)num1, (float)num3);

            Microsoft.Xna.Framework.Rectangle?sourceRectangle1 = new Microsoft.Xna.Framework.Rectangle?(this.background.Bounds);
            Color   white1     = Color.White;
            double  num4       = 0.0;
            Vector2 zero1      = Vector2.Zero;
            double  pixelZoom1 = (double)Game1.pixelZoom;
            int     num5       = 0;
            double  num6       = 1.0 / 1000.0;

            spriteBatch1.Draw(background, position1, sourceRectangle1, white1, (float)num4, zero1, (float)pixelZoom1, (SpriteEffects)num5, (float)num6);
            SpriteBatch spriteBatch2 = b;
            Texture2D   trees        = this.trees;
            Viewport    viewport2    = Game1.graphics.GraphicsDevice.Viewport;
            double      num7         = (double)(viewport2.Width / 2 - this.trees.Bounds.Width / 2 * Game1.pixelZoom);
            int         num8         = -(this.trees.Bounds.Height * Game1.pixelZoom);

            viewport2 = Game1.graphics.GraphicsDevice.Viewport;
            int     height2   = viewport2.Height;
            double  num9      = (double)(num8 + height2);
            Vector2 position2 = new Vector2((float)num7, (float)num9);

            Microsoft.Xna.Framework.Rectangle?sourceRectangle2 = new Microsoft.Xna.Framework.Rectangle?(this.trees.Bounds);
            Color   white2     = Color.White;
            double  num10      = 0.0;
            Vector2 zero2      = Vector2.Zero;
            double  pixelZoom2 = (double)Game1.pixelZoom;
            int     num11      = 0;
            double  num12      = 1.0;

            spriteBatch2.Draw(trees, position2, sourceRectangle2, white2, (float)num10, zero2, (float)pixelZoom2, (SpriteEffects)num11, (float)num12);
            b.End();
        }
Example #29
0
        public void RenderSprite(Microsoft.Xna.Framework.Rectangle destination, Microsoft.Xna.Framework.Rectangle?source, float depth)
        {
            if (!isDrawing)
            {
                Console.WriteLine("Warning. Not currently drawing. Call StartDrawing() to render sprites!");
                Console.WriteLine();
                return;
            }

            if (boundTexture == null)
            {
                Console.WriteLine("No texture specified. Bind a texture or specify a texture name.");
                Console.WriteLine();
                return;
            }

            SpriteBatch.Draw(boundTexture, GetResizedRectangle(destination), source, Microsoft.Xna.Framework.Color.White);
        }
Example #30
0
 public override void draw(SpriteBatch spriteBatch, int xNonTile, int yNonTile, float layerDepth, float alpha = 1f)
 {
     if (!Game1.eventUp || !Game1.CurrentEvent.isTileWalkedOn(xNonTile / Game1.tileSize, yNonTile / Game1.tileSize))
     {
         if (drawShadow)
         {
             spriteBatch.Draw(Game1.shadowTexture, Game1.GlobalToLocal(Game1.viewport, new Vector2((float)(xNonTile + Game1.tileSize / 2), (float)(yNonTile + Game1.tileSize * 4 / 5 + Game1.pixelZoom))), new Microsoft.Xna.Framework.Rectangle?(Game1.shadowTexture.Bounds), Color.White * alpha, 0f, new Vector2((float)Game1.shadowTexture.Bounds.Center.X, (float)Game1.shadowTexture.Bounds.Center.Y), 4f, SpriteEffects.None, layerDepth);
         }
         Texture2D arg_39B_1 = SDVX3Mod.texture;
         Vector2   arg_39B_2 = Game1.GlobalToLocal(Game1.viewport, new Vector2((float)(xNonTile + Game1.tileSize / 2 + ((this.shakeTimer > 0) ? Game1.random.Next(-1, 2) : 0)), (float)(yNonTile + Game1.tileSize / 2 + ((this.shakeTimer > 0) ? Game1.random.Next(-1, 2) : 0))));
         Microsoft.Xna.Framework.Rectangle?arg_39B_3 = GetSpriteSourceRect();
         Color   arg_39B_4 = Color.White * alpha;
         float   arg_39B_5 = 0f;
         Vector2 arg_39B_6 = new Vector2(8f, 8f);
         Vector2 arg_367_0 = this.scale;
         spriteBatch.Draw(arg_39B_1, arg_39B_2, arg_39B_3, arg_39B_4, arg_39B_5, arg_39B_6, (this.scale.Y > 1f) ? this.getScale().Y : ((float)Game1.pixelZoom), this.flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, layerDepth);
     }
 }
Example #31
0
        public override void PostDraw(Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch, Color lightColor)
        {
            Texture2D texture1 = (Texture2D)null;
            Color color1 = Color.White;
            Texture2D texture2 = ModLoader.GetTexture("Gyrolite/Projectiles/Magic/LifeDrain_Chain");

            Vector2 position = projectile.Center;
            Vector2 mountedCenter = Main.player[projectile.owner].MountedCenter;
            Microsoft.Xna.Framework.Rectangle? sourceRectangle = new Microsoft.Xna.Framework.Rectangle?();
            Vector2 origin = new Vector2((float)texture2.Width * 0.5f, (float)texture2.Height * 0.5f);
            float num1 = (float)texture2.Height;
            Vector2 vector2_4 = mountedCenter - position;
            float rotation = (float)Math.Atan2((double)vector2_4.Y, (double)vector2_4.X) - 1.57f;
            bool flag = true;
            if (float.IsNaN(position.X) && float.IsNaN(position.Y))
                flag = false;
            if (float.IsNaN(vector2_4.X) && float.IsNaN(vector2_4.Y))
                flag = false;
            while (flag)
            {
                if ((double)vector2_4.Length() < (double)num1 + 1.0)
                {
                    flag = false;
                }
                else
                {
                    Vector2 vector2_1 = vector2_4;
                    vector2_1.Normalize();
                    position += vector2_1 * num1;
                    vector2_4 = mountedCenter - position;
                    Microsoft.Xna.Framework.Color color2 = Lighting.GetColor((int)position.X / 16, (int)((double)position.Y / 16.0));
                    color2 = projectile.GetAlpha(color2);
                    Main.spriteBatch.Draw(texture2, position - Main.screenPosition, sourceRectangle, color2, rotation, origin, 1f, SpriteEffects.None, 0.0f);
                    if (texture1 != null)
                        Main.spriteBatch.Draw(texture1, position - Main.screenPosition, sourceRectangle, color1, rotation, origin, 1f, SpriteEffects.None, 0.0f);
                }
            }
        }
Example #32
0
        protected void DrawTiles(bool solidOnly = true)
        {
            Stopwatch stopwatch = new Stopwatch();
            stopwatch.Start();
            int num = (int)(255f * (1f - Main.gfxQuality) + 30f * Main.gfxQuality);
            int num2 = (int)(50f * (1f - Main.gfxQuality) + 2f * Main.gfxQuality);
            Microsoft.Xna.Framework.Vector2 value = new Microsoft.Xna.Framework.Vector2((float)Main.offScreenRange, (float)Main.offScreenRange);
            if (Main.drawToScreen)
            {
                value = default(Microsoft.Xna.Framework.Vector2);
            }
            int num3 = 0;
            int[] array = new int[1000];
            int[] array2 = new int[1000];
            int num4 = (int)((Main.screenPosition.X - value.X) / 16f - 1f);
            int num5 = (int)((Main.screenPosition.X + (float)Main.screenWidth + value.X) / 16f) + 2;
            int num6 = (int)((Main.screenPosition.Y - value.Y) / 16f - 1f);
            int num7 = (int)((Main.screenPosition.Y + (float)Main.screenHeight + value.Y) / 16f) + 5;
            if (num4 < 0)
            {
                num4 = 0;
            }
            if (num5 > Main.maxTilesX)
            {
                num5 = Main.maxTilesX;
            }
            if (num6 < 0)
            {
                num6 = 0;
            }
            if (num7 > Main.maxTilesY)
            {
                num7 = Main.maxTilesY;
            }
            int height = 16;
            int num8 = 16;
            for (int i = num6; i < num7 + 4; i++)
            {
                for (int j = num4 - 2; j < num5 + 2; j++)
                {
                    if (Main.tile[j, i] == null)
                    {

                    }
                    bool flag = Main.tileSolid[(int)Main.tile[j, i].type];
                    if (Main.tile[j, i].type == 11)
                    {
                        flag = true;
                    }
                    if (Main.tile[j, i].active && flag == solidOnly)
                    {
                        Microsoft.Xna.Framework.Color color = Lighting.GetColor(j, i);
                        int num9 = 0;
                        if (Main.tile[j, i].type == 78 || Main.tile[j, i].type == 85)
                        {
                            num9 = 2;
                        }
                        if (Main.tile[j, i].type == 33 || Main.tile[j, i].type == 49)
                        {
                            num9 = -4;
                        }
                        if (Main.tile[j, i].type == 3 || Main.tile[j, i].type == 4 || Main.tile[j, i].type == 5 || Main.tile[j, i].type == 24 || Main.tile[j, i].type == 33 || Main.tile[j, i].type == 49 || Main.tile[j, i].type == 61 || Main.tile[j, i].type == 71 || Main.tile[j, i].type == 110)
                        {
                            height = 20;
                        }
                        else
                        {
                            if (Main.tile[j, i].type == 15 || Main.tile[j, i].type == 14 || Main.tile[j, i].type == 16 || Main.tile[j, i].type == 17 || Main.tile[j, i].type == 18 || Main.tile[j, i].type == 20 || Main.tile[j, i].type == 21 || Main.tile[j, i].type == 26 || Main.tile[j, i].type == 27 || Main.tile[j, i].type == 32 || Main.tile[j, i].type == 69 || Main.tile[j, i].type == 72 || Main.tile[j, i].type == 77 || Main.tile[j, i].type == 80)
                            {
                                height = 18;
                            }
                            else
                            {
                                if (Main.tile[j, i].type == 137)
                                {
                                    height = 18;
                                }
                                else
                                {
                                    if (Main.tile[j, i].type == 135)
                                    {
                                        num9 = 2;
                                        height = 18;
                                    }
                                    else
                                    {
                                        if (Main.tile[j, i].type == 132)
                                        {
                                            num9 = 2;
                                            height = 18;
                                        }
                                        else
                                        {
                                            height = 16;
                                        }
                                    }
                                }
                            }
                        }
                        if (Main.tile[j, i].type == 4 || Main.tile[j, i].type == 5)
                        {
                            num8 = 20;
                        }
                        else
                        {
                            num8 = 16;
                        }
                        if (Main.tile[j, i].type == 73 || Main.tile[j, i].type == 74 || Main.tile[j, i].type == 113)
                        {
                            num9 -= 12;
                            height = 32;
                        }
                        if (Main.tile[j, i].type == 81)
                        {
                            num9 -= 8;
                            height = 26;
                            num8 = 24;
                        }
                        if (Main.tile[j, i].type == 105)
                        {
                            num9 = 2;
                        }
                        if (Main.tile[j, i].type == 124)
                        {
                            height = 18;
                        }
                        if (Main.tile[j, i].type == 137)
                        {
                            height = 18;
                        }
                        if (Main.tile[j, i].type == 138)
                        {
                            height = 18;
                        }
                        if (Main.tile[j, i].type == 139 || Main.tile[j, i].type == 142 || Main.tile[j, i].type == 143)
                        {
                            num9 = 2;
                        }
                        if (Main.player[Main.myPlayer].findTreasure && (Main.tile[j, i].type == 6 || Main.tile[j, i].type == 7 || Main.tile[j, i].type == 8 || Main.tile[j, i].type == 9 || Main.tile[j, i].type == 12 || Main.tile[j, i].type == 21 || Main.tile[j, i].type == 22 || Main.tile[j, i].type == 28 || Main.tile[j, i].type == 107 || Main.tile[j, i].type == 108 || Main.tile[j, i].type == 111 || (Main.tile[j, i].type >= 63 && Main.tile[j, i].type <= 68) || Main.tileAlch[(int)Main.tile[j, i].type]))
                        {
                            if (color.R < Main.mouseTextColor / 2)
                            {
                                color.R = (byte)(Main.mouseTextColor / 2);
                            }
                            if (color.G < 70)
                            {
                                color.G = 70;
                            }
                            if (color.B < 210)
                            {
                                color.B = 210;
                            }
                            color.A = Main.mouseTextColor;
                            if (!Main.gamePaused && base.IsActive && Main.rand.Next(150) == 0)
                            {
                                Microsoft.Xna.Framework.Vector2 arg_87F_0 = new Microsoft.Xna.Framework.Vector2((float)(j * 16), (float)(i * 16));
                                int arg_87F_1 = 16;
                                int arg_87F_2 = 16;
                                int arg_87F_3 = 15;
                                float arg_87F_4 = 0f;
                                float arg_87F_5 = 0f;
                                int arg_87F_6 = 150;
                                Microsoft.Xna.Framework.Color newColor = default(Microsoft.Xna.Framework.Color);
                                int num10 = Dust.NewDust(arg_87F_0, arg_87F_1, arg_87F_2, arg_87F_3, arg_87F_4, arg_87F_5, arg_87F_6, newColor, 0.8f);
                                Dust expr_88E = Main.dust[num10];
                                expr_88E.velocity *= 0.1f;
                                Main.dust[num10].noLight = true;
                            }
                        }
                        if (!Main.gamePaused && base.IsActive)
                        {
                            if (Main.tile[j, i].type == 4 && Main.rand.Next(40) == 0 && Main.tile[j, i].frameX < 66)
                            {
                                int num11 = (int)(Main.tile[j, i].frameY / 22);
                                if (num11 == 0)
                                {
                                    num11 = 6;
                                }
                                else
                                {
                                    if (num11 == 8)
                                    {
                                        num11 = 75;
                                    }
                                    else
                                    {
                                        num11 = 58 + num11;
                                    }
                                }
                                if (Main.tile[j, i].frameX == 22)
                                {
                                    Microsoft.Xna.Framework.Vector2 arg_986_0 = new Microsoft.Xna.Framework.Vector2((float)(j * 16 + 6), (float)(i * 16));
                                    int arg_986_1 = 4;
                                    int arg_986_2 = 4;
                                    int arg_986_3 = num11;
                                    float arg_986_4 = 0f;
                                    float arg_986_5 = 0f;
                                    int arg_986_6 = 100;
                                    Microsoft.Xna.Framework.Color newColor = default(Microsoft.Xna.Framework.Color);
                                    Dust.NewDust(arg_986_0, arg_986_1, arg_986_2, arg_986_3, arg_986_4, arg_986_5, arg_986_6, newColor, 1f);
                                }
                                if (Main.tile[j, i].frameX == 44)
                                {
                                    Microsoft.Xna.Framework.Vector2 arg_9D5_0 = new Microsoft.Xna.Framework.Vector2((float)(j * 16 + 2), (float)(i * 16));
                                    int arg_9D5_1 = 4;
                                    int arg_9D5_2 = 4;
                                    int arg_9D5_3 = num11;
                                    float arg_9D5_4 = 0f;
                                    float arg_9D5_5 = 0f;
                                    int arg_9D5_6 = 100;
                                    Microsoft.Xna.Framework.Color newColor = default(Microsoft.Xna.Framework.Color);
                                    Dust.NewDust(arg_9D5_0, arg_9D5_1, arg_9D5_2, arg_9D5_3, arg_9D5_4, arg_9D5_5, arg_9D5_6, newColor, 1f);
                                }
                                else
                                {
                                    Microsoft.Xna.Framework.Vector2 arg_A0F_0 = new Microsoft.Xna.Framework.Vector2((float)(j * 16 + 4), (float)(i * 16));
                                    int arg_A0F_1 = 4;
                                    int arg_A0F_2 = 4;
                                    int arg_A0F_3 = num11;
                                    float arg_A0F_4 = 0f;
                                    float arg_A0F_5 = 0f;
                                    int arg_A0F_6 = 100;
                                    Microsoft.Xna.Framework.Color newColor = default(Microsoft.Xna.Framework.Color);
                                    Dust.NewDust(arg_A0F_0, arg_A0F_1, arg_A0F_2, arg_A0F_3, arg_A0F_4, arg_A0F_5, arg_A0F_6, newColor, 1f);
                                }
                            }
                            if (Main.tile[j, i].type == 33 && Main.rand.Next(40) == 0 && Main.tile[j, i].frameX == 0)
                            {
                                Microsoft.Xna.Framework.Vector2 arg_A82_0 = new Microsoft.Xna.Framework.Vector2((float)(j * 16 + 4), (float)(i * 16 - 4));
                                int arg_A82_1 = 4;
                                int arg_A82_2 = 4;
                                int arg_A82_3 = 6;
                                float arg_A82_4 = 0f;
                                float arg_A82_5 = 0f;
                                int arg_A82_6 = 100;
                                Microsoft.Xna.Framework.Color newColor = default(Microsoft.Xna.Framework.Color);
                                Dust.NewDust(arg_A82_0, arg_A82_1, arg_A82_2, arg_A82_3, arg_A82_4, arg_A82_5, arg_A82_6, newColor, 1f);
                            }
                            if (Main.tile[j, i].type == 93 && Main.rand.Next(40) == 0 && Main.tile[j, i].frameX == 0 && Main.tile[j, i].frameY == 0)
                            {
                                Microsoft.Xna.Framework.Vector2 arg_B0A_0 = new Microsoft.Xna.Framework.Vector2((float)(j * 16 + 4), (float)(i * 16 + 2));
                                int arg_B0A_1 = 4;
                                int arg_B0A_2 = 4;
                                int arg_B0A_3 = 6;
                                float arg_B0A_4 = 0f;
                                float arg_B0A_5 = 0f;
                                int arg_B0A_6 = 100;
                                Microsoft.Xna.Framework.Color newColor = default(Microsoft.Xna.Framework.Color);
                                Dust.NewDust(arg_B0A_0, arg_B0A_1, arg_B0A_2, arg_B0A_3, arg_B0A_4, arg_B0A_5, arg_B0A_6, newColor, 1f);
                            }
                            if (Main.tile[j, i].type == 100 && Main.rand.Next(40) == 0 && Main.tile[j, i].frameX < 36 && Main.tile[j, i].frameY == 0)
                            {
                                if (Main.tile[j, i].frameX == 0)
                                {
                                    if (Main.rand.Next(3) == 0)
                                    {
                                        Microsoft.Xna.Framework.Vector2 arg_BC5_0 = new Microsoft.Xna.Framework.Vector2((float)(j * 16 + 4), (float)(i * 16 + 2));
                                        int arg_BC5_1 = 4;
                                        int arg_BC5_2 = 4;
                                        int arg_BC5_3 = 6;
                                        float arg_BC5_4 = 0f;
                                        float arg_BC5_5 = 0f;
                                        int arg_BC5_6 = 100;
                                        Microsoft.Xna.Framework.Color newColor = default(Microsoft.Xna.Framework.Color);
                                        Dust.NewDust(arg_BC5_0, arg_BC5_1, arg_BC5_2, arg_BC5_3, arg_BC5_4, arg_BC5_5, arg_BC5_6, newColor, 1f);
                                    }
                                    else
                                    {
                                        Microsoft.Xna.Framework.Vector2 arg_C04_0 = new Microsoft.Xna.Framework.Vector2((float)(j * 16 + 14), (float)(i * 16 + 2));
                                        int arg_C04_1 = 4;
                                        int arg_C04_2 = 4;
                                        int arg_C04_3 = 6;
                                        float arg_C04_4 = 0f;
                                        float arg_C04_5 = 0f;
                                        int arg_C04_6 = 100;
                                        Microsoft.Xna.Framework.Color newColor = default(Microsoft.Xna.Framework.Color);
                                        Dust.NewDust(arg_C04_0, arg_C04_1, arg_C04_2, arg_C04_3, arg_C04_4, arg_C04_5, arg_C04_6, newColor, 1f);
                                    }
                                }
                                else
                                {
                                    if (Main.rand.Next(3) == 0)
                                    {
                                        Microsoft.Xna.Framework.Vector2 arg_C4C_0 = new Microsoft.Xna.Framework.Vector2((float)(j * 16 + 6), (float)(i * 16 + 2));
                                        int arg_C4C_1 = 4;
                                        int arg_C4C_2 = 4;
                                        int arg_C4C_3 = 6;
                                        float arg_C4C_4 = 0f;
                                        float arg_C4C_5 = 0f;
                                        int arg_C4C_6 = 100;
                                        Microsoft.Xna.Framework.Color newColor = default(Microsoft.Xna.Framework.Color);
                                        Dust.NewDust(arg_C4C_0, arg_C4C_1, arg_C4C_2, arg_C4C_3, arg_C4C_4, arg_C4C_5, arg_C4C_6, newColor, 1f);
                                    }
                                    else
                                    {
                                        Microsoft.Xna.Framework.Vector2 arg_C85_0 = new Microsoft.Xna.Framework.Vector2((float)(j * 16), (float)(i * 16 + 2));
                                        int arg_C85_1 = 4;
                                        int arg_C85_2 = 4;
                                        int arg_C85_3 = 6;
                                        float arg_C85_4 = 0f;
                                        float arg_C85_5 = 0f;
                                        int arg_C85_6 = 100;
                                        Microsoft.Xna.Framework.Color newColor = default(Microsoft.Xna.Framework.Color);
                                        Dust.NewDust(arg_C85_0, arg_C85_1, arg_C85_2, arg_C85_3, arg_C85_4, arg_C85_5, arg_C85_6, newColor, 1f);
                                    }
                                }
                            }
                            if (Main.tile[j, i].type == 98 && Main.rand.Next(40) == 0 && Main.tile[j, i].frameY == 0 && Main.tile[j, i].frameX == 0)
                            {
                                Microsoft.Xna.Framework.Vector2 arg_D0E_0 = new Microsoft.Xna.Framework.Vector2((float)(j * 16 + 12), (float)(i * 16 + 2));
                                int arg_D0E_1 = 4;
                                int arg_D0E_2 = 4;
                                int arg_D0E_3 = 6;
                                float arg_D0E_4 = 0f;
                                float arg_D0E_5 = 0f;
                                int arg_D0E_6 = 100;
                                Microsoft.Xna.Framework.Color newColor = default(Microsoft.Xna.Framework.Color);
                                Dust.NewDust(arg_D0E_0, arg_D0E_1, arg_D0E_2, arg_D0E_3, arg_D0E_4, arg_D0E_5, arg_D0E_6, newColor, 1f);
                            }
                            if (Main.tile[j, i].type == 49 && Main.rand.Next(20) == 0)
                            {
                                Microsoft.Xna.Framework.Vector2 arg_D6D_0 = new Microsoft.Xna.Framework.Vector2((float)(j * 16 + 4), (float)(i * 16 - 4));
                                int arg_D6D_1 = 4;
                                int arg_D6D_2 = 4;
                                int arg_D6D_3 = 29;
                                float arg_D6D_4 = 0f;
                                float arg_D6D_5 = 0f;
                                int arg_D6D_6 = 100;
                                Microsoft.Xna.Framework.Color newColor = default(Microsoft.Xna.Framework.Color);
                                Dust.NewDust(arg_D6D_0, arg_D6D_1, arg_D6D_2, arg_D6D_3, arg_D6D_4, arg_D6D_5, arg_D6D_6, newColor, 1f);
                            }
                            if ((Main.tile[j, i].type == 34 || Main.tile[j, i].type == 35 || Main.tile[j, i].type == 36) && Main.rand.Next(40) == 0 && Main.tile[j, i].frameX < 54 && Main.tile[j, i].frameY == 18 && (Main.tile[j, i].frameX == 0 || Main.tile[j, i].frameX == 36))
                            {
                                Microsoft.Xna.Framework.Vector2 arg_E58_0 = new Microsoft.Xna.Framework.Vector2((float)(j * 16), (float)(i * 16 + 2));
                                int arg_E58_1 = 14;
                                int arg_E58_2 = 6;
                                int arg_E58_3 = 6;
                                float arg_E58_4 = 0f;
                                float arg_E58_5 = 0f;
                                int arg_E58_6 = 100;
                                Microsoft.Xna.Framework.Color newColor = default(Microsoft.Xna.Framework.Color);
                                Dust.NewDust(arg_E58_0, arg_E58_1, arg_E58_2, arg_E58_3, arg_E58_4, arg_E58_5, arg_E58_6, newColor, 1f);
                            }
                            if (Main.tile[j, i].type == 22 && Main.rand.Next(400) == 0)
                            {
                                Microsoft.Xna.Framework.Vector2 arg_EB7_0 = new Microsoft.Xna.Framework.Vector2((float)(j * 16), (float)(i * 16));
                                int arg_EB7_1 = 16;
                                int arg_EB7_2 = 16;
                                int arg_EB7_3 = 14;
                                float arg_EB7_4 = 0f;
                                float arg_EB7_5 = 0f;
                                int arg_EB7_6 = 0;
                                Microsoft.Xna.Framework.Color newColor = default(Microsoft.Xna.Framework.Color);
                                Dust.NewDust(arg_EB7_0, arg_EB7_1, arg_EB7_2, arg_EB7_3, arg_EB7_4, arg_EB7_5, arg_EB7_6, newColor, 1f);
                            }
                            else
                            {
                                if ((Main.tile[j, i].type == 23 || Main.tile[j, i].type == 24 || Main.tile[j, i].type == 32) && Main.rand.Next(500) == 0)
                                {
                                    Microsoft.Xna.Framework.Vector2 arg_F49_0 = new Microsoft.Xna.Framework.Vector2((float)(j * 16), (float)(i * 16));
                                    int arg_F49_1 = 16;
                                    int arg_F49_2 = 16;
                                    int arg_F49_3 = 14;
                                    float arg_F49_4 = 0f;
                                    float arg_F49_5 = 0f;
                                    int arg_F49_6 = 0;
                                    Microsoft.Xna.Framework.Color newColor = default(Microsoft.Xna.Framework.Color);
                                    Dust.NewDust(arg_F49_0, arg_F49_1, arg_F49_2, arg_F49_3, arg_F49_4, arg_F49_5, arg_F49_6, newColor, 1f);
                                }
                                else
                                {
                                    if (Main.tile[j, i].type == 25 && Main.rand.Next(700) == 0)
                                    {
                                        Microsoft.Xna.Framework.Vector2 arg_FAD_0 = new Microsoft.Xna.Framework.Vector2((float)(j * 16), (float)(i * 16));
                                        int arg_FAD_1 = 16;
                                        int arg_FAD_2 = 16;
                                        int arg_FAD_3 = 14;
                                        float arg_FAD_4 = 0f;
                                        float arg_FAD_5 = 0f;
                                        int arg_FAD_6 = 0;
                                        Microsoft.Xna.Framework.Color newColor = default(Microsoft.Xna.Framework.Color);
                                        Dust.NewDust(arg_FAD_0, arg_FAD_1, arg_FAD_2, arg_FAD_3, arg_FAD_4, arg_FAD_5, arg_FAD_6, newColor, 1f);
                                    }
                                    else
                                    {
                                        if (Main.tile[j, i].type == 112 && Main.rand.Next(700) == 0)
                                        {
                                            Microsoft.Xna.Framework.Vector2 arg_1011_0 = new Microsoft.Xna.Framework.Vector2((float)(j * 16), (float)(i * 16));
                                            int arg_1011_1 = 16;
                                            int arg_1011_2 = 16;
                                            int arg_1011_3 = 14;
                                            float arg_1011_4 = 0f;
                                            float arg_1011_5 = 0f;
                                            int arg_1011_6 = 0;
                                            Microsoft.Xna.Framework.Color newColor = default(Microsoft.Xna.Framework.Color);
                                            Dust.NewDust(arg_1011_0, arg_1011_1, arg_1011_2, arg_1011_3, arg_1011_4, arg_1011_5, arg_1011_6, newColor, 1f);
                                        }
                                        else
                                        {
                                            if (Main.tile[j, i].type == 31 && Main.rand.Next(20) == 0)
                                            {
                                                Microsoft.Xna.Framework.Vector2 arg_1073_0 = new Microsoft.Xna.Framework.Vector2((float)(j * 16), (float)(i * 16));
                                                int arg_1073_1 = 16;
                                                int arg_1073_2 = 16;
                                                int arg_1073_3 = 14;
                                                float arg_1073_4 = 0f;
                                                float arg_1073_5 = 0f;
                                                int arg_1073_6 = 100;
                                                Microsoft.Xna.Framework.Color newColor = default(Microsoft.Xna.Framework.Color);
                                                Dust.NewDust(arg_1073_0, arg_1073_1, arg_1073_2, arg_1073_3, arg_1073_4, arg_1073_5, arg_1073_6, newColor, 1f);
                                            }
                                            else
                                            {
                                                if (Main.tile[j, i].type == 26 && Main.rand.Next(20) == 0)
                                                {
                                                    Microsoft.Xna.Framework.Vector2 arg_10D5_0 = new Microsoft.Xna.Framework.Vector2((float)(j * 16), (float)(i * 16));
                                                    int arg_10D5_1 = 16;
                                                    int arg_10D5_2 = 16;
                                                    int arg_10D5_3 = 14;
                                                    float arg_10D5_4 = 0f;
                                                    float arg_10D5_5 = 0f;
                                                    int arg_10D5_6 = 100;
                                                    Microsoft.Xna.Framework.Color newColor = default(Microsoft.Xna.Framework.Color);
                                                    Dust.NewDust(arg_10D5_0, arg_10D5_1, arg_10D5_2, arg_10D5_3, arg_10D5_4, arg_10D5_5, arg_10D5_6, newColor, 1f);
                                                }
                                                else
                                                {
                                                    if ((Main.tile[j, i].type == 71 || Main.tile[j, i].type == 72) && Main.rand.Next(500) == 0)
                                                    {
                                                        Microsoft.Xna.Framework.Vector2 arg_1154_0 = new Microsoft.Xna.Framework.Vector2((float)(j * 16), (float)(i * 16));
                                                        int arg_1154_1 = 16;
                                                        int arg_1154_2 = 16;
                                                        int arg_1154_3 = 41;
                                                        float arg_1154_4 = 0f;
                                                        float arg_1154_5 = 0f;
                                                        int arg_1154_6 = 250;
                                                        Microsoft.Xna.Framework.Color newColor = default(Microsoft.Xna.Framework.Color);
                                                        Dust.NewDust(arg_1154_0, arg_1154_1, arg_1154_2, arg_1154_3, arg_1154_4, arg_1154_5, arg_1154_6, newColor, 0.8f);
                                                    }
                                                    else
                                                    {
                                                        if ((Main.tile[j, i].type == 17 || Main.tile[j, i].type == 77 || Main.tile[j, i].type == 133) && Main.rand.Next(40) == 0)
                                                        {
                                                            if (Main.tile[j, i].frameX == 18 & Main.tile[j, i].frameY == 18)
                                                            {
                                                                Microsoft.Xna.Framework.Vector2 arg_121A_0 = new Microsoft.Xna.Framework.Vector2((float)(j * 16 + 2), (float)(i * 16));
                                                                int arg_121A_1 = 8;
                                                                int arg_121A_2 = 6;
                                                                int arg_121A_3 = 6;
                                                                float arg_121A_4 = 0f;
                                                                float arg_121A_5 = 0f;
                                                                int arg_121A_6 = 100;
                                                                Microsoft.Xna.Framework.Color newColor = default(Microsoft.Xna.Framework.Color);
                                                                Dust.NewDust(arg_121A_0, arg_121A_1, arg_121A_2, arg_121A_3, arg_121A_4, arg_121A_5, arg_121A_6, newColor, 1f);
                                                            }
                                                        }
                                                        else
                                                        {
                                                            if (Main.tile[j, i].type == 37 && Main.rand.Next(250) == 0)
                                                            {
                                                                Microsoft.Xna.Framework.Vector2 arg_1284_0 = new Microsoft.Xna.Framework.Vector2((float)(j * 16), (float)(i * 16));
                                                                int arg_1284_1 = 16;
                                                                int arg_1284_2 = 16;
                                                                int arg_1284_3 = 6;
                                                                float arg_1284_4 = 0f;
                                                                float arg_1284_5 = 0f;
                                                                int arg_1284_6 = 0;
                                                                Microsoft.Xna.Framework.Color newColor = default(Microsoft.Xna.Framework.Color);
                                                                int num12 = Dust.NewDust(arg_1284_0, arg_1284_1, arg_1284_2, arg_1284_3, arg_1284_4, arg_1284_5, arg_1284_6, newColor, (float)Main.rand.Next(3));
                                                                if (Main.dust[num12].scale > 1f)
                                                                {
                                                                    Main.dust[num12].noGravity = true;
                                                                }
                                                            }
                                                            else
                                                            {
                                                                if ((Main.tile[j, i].type == 58 || Main.tile[j, i].type == 76) && Main.rand.Next(250) == 0)
                                                                {
                                                                    Microsoft.Xna.Framework.Vector2 arg_132E_0 = new Microsoft.Xna.Framework.Vector2((float)(j * 16), (float)(i * 16));
                                                                    int arg_132E_1 = 16;
                                                                    int arg_132E_2 = 16;
                                                                    int arg_132E_3 = 6;
                                                                    float arg_132E_4 = 0f;
                                                                    float arg_132E_5 = 0f;
                                                                    int arg_132E_6 = 0;
                                                                    Microsoft.Xna.Framework.Color newColor = default(Microsoft.Xna.Framework.Color);
                                                                    int num13 = Dust.NewDust(arg_132E_0, arg_132E_1, arg_132E_2, arg_132E_3, arg_132E_4, arg_132E_5, arg_132E_6, newColor, (float)Main.rand.Next(3));
                                                                    if (Main.dust[num13].scale > 1f)
                                                                    {
                                                                        Main.dust[num13].noGravity = true;
                                                                    }
                                                                    Main.dust[num13].noLight = true;
                                                                }
                                                                else
                                                                {
                                                                    if (Main.tile[j, i].type == 61)
                                                                    {
                                                                        if (Main.tile[j, i].frameX == 144)
                                                                        {
                                                                            if (Main.rand.Next(60) == 0)
                                                                            {
                                                                                Microsoft.Xna.Framework.Vector2 arg_13E4_0 = new Microsoft.Xna.Framework.Vector2((float)(j * 16), (float)(i * 16));
                                                                                int arg_13E4_1 = 16;
                                                                                int arg_13E4_2 = 16;
                                                                                int arg_13E4_3 = 44;
                                                                                float arg_13E4_4 = 0f;
                                                                                float arg_13E4_5 = 0f;
                                                                                int arg_13E4_6 = 250;
                                                                                Microsoft.Xna.Framework.Color newColor = default(Microsoft.Xna.Framework.Color);
                                                                                int num14 = Dust.NewDust(arg_13E4_0, arg_13E4_1, arg_13E4_2, arg_13E4_3, arg_13E4_4, arg_13E4_5, arg_13E4_6, newColor, 0.4f);
                                                                                Main.dust[num14].fadeIn = 0.7f;
                                                                            }
                                                                            color.A = (byte)(245f - (float)Main.mouseTextColor * 1.5f);
                                                                            color.R = (byte)(245f - (float)Main.mouseTextColor * 1.5f);
                                                                            color.B = (byte)(245f - (float)Main.mouseTextColor * 1.5f);
                                                                            color.G = (byte)(245f - (float)Main.mouseTextColor * 1.5f);
                                                                        }
                                                                    }
                                                                    else
                                                                    {
                                                                        if (Main.tileShine[(int)Main.tile[j, i].type] > 0 && (color.R > 20 || color.B > 20 || color.G > 20))
                                                                        {
                                                                            int num15 = (int)color.R;
                                                                            if ((int)color.G > num15)
                                                                            {
                                                                                num15 = (int)color.G;
                                                                            }
                                                                            if ((int)color.B > num15)
                                                                            {
                                                                                num15 = (int)color.B;
                                                                            }
                                                                            num15 /= 30;
                                                                            if (Main.rand.Next(Main.tileShine[(int)Main.tile[j, i].type]) < num15 && (Main.tile[j, i].type != 21 || (Main.tile[j, i].frameX >= 36 && Main.tile[j, i].frameX < 180)))
                                                                            {
                                                                                Microsoft.Xna.Framework.Vector2 arg_158C_0 = new Microsoft.Xna.Framework.Vector2((float)(j * 16), (float)(i * 16));
                                                                                int arg_158C_1 = 16;
                                                                                int arg_158C_2 = 16;
                                                                                int arg_158C_3 = 43;
                                                                                float arg_158C_4 = 0f;
                                                                                float arg_158C_5 = 0f;
                                                                                int arg_158C_6 = 254;
                                                                                Microsoft.Xna.Framework.Color newColor = default(Microsoft.Xna.Framework.Color);
                                                                                int num16 = Dust.NewDust(arg_158C_0, arg_158C_1, arg_158C_2, arg_158C_3, arg_158C_4, arg_158C_5, arg_158C_6, newColor, 0.5f);
                                                                                Dust expr_159B = Main.dust[num16];
                                                                                expr_159B.velocity *= 0f;
                                                                            }
                                                                        }
                                                                    }
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                        if (Main.tile[j, i].type == 128 && Main.tile[j, i].frameX >= 100)
                        {
                            array[num3] = j;
                            array2[num3] = i;
                            num3++;
                        }
                        if (Main.tile[j, i].type == 5 && Main.tile[j, i].frameY >= 198 && Main.tile[j, i].frameX >= 22)
                        {
                            array[num3] = j;
                            array2[num3] = i;
                            num3++;
                        }
                        if (Main.tile[j, i].type == 72 && Main.tile[j, i].frameX >= 36)
                        {
                            int num17 = 0;
                            if (Main.tile[j, i].frameY == 18)
                            {
                                num17 = 1;
                            }
                            else
                            {
                                if (Main.tile[j, i].frameY == 36)
                                {
                                    num17 = 2;
                                }
                            }
                            SpriteBatch arg_1734_0 = this.spriteBatch;
                            Texture2D arg_1734_1 = Main.shroomCapTexture;
                            Microsoft.Xna.Framework.Vector2 arg_1734_2 = new Microsoft.Xna.Framework.Vector2((float)(j * 16 - (int)Main.screenPosition.X - 22), (float)(i * 16 - (int)Main.screenPosition.Y - 26)) + value;
                            Microsoft.Xna.Framework.Rectangle? arg_1734_3 = new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(num17 * 62, 0, 60, 42));
                            Microsoft.Xna.Framework.Color arg_1734_4 = Lighting.GetColor(j, i);
                            float arg_1734_5 = 0f;
                            Microsoft.Xna.Framework.Vector2 origin = default(Microsoft.Xna.Framework.Vector2);
                            arg_1734_0.Draw(arg_1734_1, arg_1734_2, arg_1734_3, arg_1734_4, arg_1734_5, origin, 1f, SpriteEffects.None, 0f);
                        }
                        if (color.R > 1 || color.G > 1 || color.B > 1)
                        {
                            if (Main.tile[j - 1, i] == null)
                            {

                            }
                            if (Main.tile[j + 1, i] == null)
                            {

                            }
                            if (Main.tile[j, i - 1] == null)
                            {

                            }
                            if (Main.tile[j, i + 1] == null)
                            {

                            }
                            if (solidOnly && flag && !Main.tileSolidTop[(int)Main.tile[j, i].type] && (Main.tile[j - 1, i].liquid > 0 || Main.tile[j + 1, i].liquid > 0 || Main.tile[j, i - 1].liquid > 0 || Main.tile[j, i + 1].liquid > 0))
                            {
                                Microsoft.Xna.Framework.Color color2 = Lighting.GetColor(j, i);
                                int num18 = 0;
                                bool flag2 = false;
                                bool flag3 = false;
                                bool flag4 = false;
                                bool flag5 = false;
                                int num19 = 0;
                                bool flag6 = false;
                                if ((int)Main.tile[j - 1, i].liquid > num18)
                                {
                                    num18 = (int)Main.tile[j - 1, i].liquid;
                                    flag2 = true;
                                }
                                else
                                {
                                    if (Main.tile[j - 1, i].liquid > 0)
                                    {
                                        flag2 = true;
                                    }
                                }
                                if ((int)Main.tile[j + 1, i].liquid > num18)
                                {
                                    num18 = (int)Main.tile[j + 1, i].liquid;
                                    flag3 = true;
                                }
                                else
                                {
                                    if (Main.tile[j + 1, i].liquid > 0)
                                    {
                                        num18 = (int)Main.tile[j + 1, i].liquid;
                                        flag3 = true;
                                    }
                                }
                                if (Main.tile[j, i - 1].liquid > 0)
                                {
                                    flag4 = true;
                                }
                                if (Main.tile[j, i + 1].liquid > 240)
                                {
                                    flag5 = true;
                                }
                                if (Main.tile[j - 1, i].liquid > 0)
                                {
                                    if (Main.tile[j - 1, i].lava)
                                    {
                                        num19 = 1;
                                    }
                                    else
                                    {
                                        flag6 = true;
                                    }
                                }
                                if (Main.tile[j + 1, i].liquid > 0)
                                {
                                    if (Main.tile[j + 1, i].lava)
                                    {
                                        num19 = 1;
                                    }
                                    else
                                    {
                                        flag6 = true;
                                    }
                                }
                                if (Main.tile[j, i - 1].liquid > 0)
                                {
                                    if (Main.tile[j, i - 1].lava)
                                    {
                                        num19 = 1;
                                    }
                                    else
                                    {
                                        flag6 = true;
                                    }
                                }
                                if (Main.tile[j, i + 1].liquid > 0)
                                {
                                    if (Main.tile[j, i + 1].lava)
                                    {
                                        num19 = 1;
                                    }
                                    else
                                    {
                                        flag6 = true;
                                    }
                                }
                                if (!flag6 || num19 != 1)
                                {
                                    Microsoft.Xna.Framework.Vector2 value2 = new Microsoft.Xna.Framework.Vector2((float)(j * 16), (float)(i * 16));
                                    Microsoft.Xna.Framework.Rectangle value3 = new Microsoft.Xna.Framework.Rectangle(0, 4, 16, 16);
                                    if (flag5 && (flag2 || flag3))
                                    {
                                        flag2 = true;
                                        flag3 = true;
                                    }
                                    if ((!flag4 || (!flag2 && !flag3)) && (!flag5 || !flag4))
                                    {
                                        if (flag4)
                                        {
                                            value3 = new Microsoft.Xna.Framework.Rectangle(0, 4, 16, 4);
                                        }
                                        else
                                        {
                                            if (flag5 && !flag2 && !flag3)
                                            {
                                                value2 = new Microsoft.Xna.Framework.Vector2((float)(j * 16), (float)(i * 16 + 12));
                                                value3 = new Microsoft.Xna.Framework.Rectangle(0, 4, 16, 4);
                                            }
                                            else
                                            {
                                                float num20 = (float)(256 - num18);
                                                num20 /= 32f;
                                                if (flag2 && flag3)
                                                {
                                                    value2 = new Microsoft.Xna.Framework.Vector2((float)(j * 16), (float)(i * 16 + (int)num20 * 2));
                                                    value3 = new Microsoft.Xna.Framework.Rectangle(0, 4, 16, 16 - (int)num20 * 2);
                                                }
                                                else
                                                {
                                                    if (flag2)
                                                    {
                                                        value2 = new Microsoft.Xna.Framework.Vector2((float)(j * 16), (float)(i * 16 + (int)num20 * 2));
                                                        value3 = new Microsoft.Xna.Framework.Rectangle(0, 4, 4, 16 - (int)num20 * 2);
                                                    }
                                                    else
                                                    {
                                                        value2 = new Microsoft.Xna.Framework.Vector2((float)(j * 16 + 12), (float)(i * 16 + (int)num20 * 2));
                                                        value3 = new Microsoft.Xna.Framework.Rectangle(0, 4, 4, 16 - (int)num20 * 2);
                                                    }
                                                }
                                            }
                                        }
                                    }
                                    float num21 = 0.5f;
                                    if (num19 == 1)
                                    {
                                        num21 *= 1.6f;
                                    }
                                    if ((double)i < Main.worldSurface || num21 > 1f)
                                    {
                                        num21 = 1f;
                                    }
                                    float num22 = (float)color2.R * num21;
                                    float num23 = (float)color2.G * num21;
                                    float num24 = (float)color2.B * num21;
                                    float num25 = (float)color2.A * num21;
                                    color2 = new Microsoft.Xna.Framework.Color((int)((byte)num22), (int)((byte)num23), (int)((byte)num24), (int)((byte)num25));
                                    SpriteBatch arg_1C7F_0 = this.spriteBatch;
                                    Texture2D arg_1C7F_1 = Main.liquidTexture[num19];
                                    Microsoft.Xna.Framework.Vector2 arg_1C7F_2 = value2 - Main.screenPosition + value;
                                    Microsoft.Xna.Framework.Rectangle? arg_1C7F_3 = new Microsoft.Xna.Framework.Rectangle?(value3);
                                    Microsoft.Xna.Framework.Color arg_1C7F_4 = color2;
                                    float arg_1C7F_5 = 0f;
                                    Microsoft.Xna.Framework.Vector2 origin = default(Microsoft.Xna.Framework.Vector2);
                                    arg_1C7F_0.Draw(arg_1C7F_1, arg_1C7F_2, arg_1C7F_3, arg_1C7F_4, arg_1C7F_5, origin, 1f, SpriteEffects.None, 0f);
                                }
                            }
                            if (Main.tile[j, i].type == 51)
                            {
                                Microsoft.Xna.Framework.Color color3 = Lighting.GetColor(j, i);
                                float num26 = 0.5f;
                                float num27 = (float)color3.R * num26;
                                float num28 = (float)color3.G * num26;
                                float num29 = (float)color3.B * num26;
                                float num30 = (float)color3.A * num26;
                                color3 = new Microsoft.Xna.Framework.Color((int)((byte)num27), (int)((byte)num28), (int)((byte)num29), (int)((byte)num30));
                                SpriteBatch arg_1DA8_0 = this.spriteBatch;
                                Texture2D arg_1DA8_1 = Main.tileTexture[(int)Main.tile[j, i].type];
                                Microsoft.Xna.Framework.Vector2 arg_1DA8_2 = new Microsoft.Xna.Framework.Vector2((float)(j * 16 - (int)Main.screenPosition.X) - ((float)num8 - 16f) / 2f, (float)(i * 16 - (int)Main.screenPosition.Y + num9)) + value;
                                Microsoft.Xna.Framework.Rectangle? arg_1DA8_3 = new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle((int)Main.tile[j, i].frameX, (int)Main.tile[j, i].frameY, num8, height));
                                Microsoft.Xna.Framework.Color arg_1DA8_4 = color3;
                                float arg_1DA8_5 = 0f;
                                Microsoft.Xna.Framework.Vector2 origin = default(Microsoft.Xna.Framework.Vector2);
                                arg_1DA8_0.Draw(arg_1DA8_1, arg_1DA8_2, arg_1DA8_3, arg_1DA8_4, arg_1DA8_5, origin, 1f, SpriteEffects.None, 0f);
                            }
                            else
                            {
                                if (Main.tile[j, i].type == 129)
                                {
                                    SpriteBatch arg_1E93_0 = this.spriteBatch;
                                    Texture2D arg_1E93_1 = Main.tileTexture[(int)Main.tile[j, i].type];
                                    Microsoft.Xna.Framework.Vector2 arg_1E93_2 = new Microsoft.Xna.Framework.Vector2((float)(j * 16 - (int)Main.screenPosition.X) - ((float)num8 - 16f) / 2f, (float)(i * 16 - (int)Main.screenPosition.Y + num9)) + value;
                                    Microsoft.Xna.Framework.Rectangle? arg_1E93_3 = new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle((int)Main.tile[j, i].frameX, (int)Main.tile[j, i].frameY, num8, height));
                                    Microsoft.Xna.Framework.Color arg_1E93_4 = new Microsoft.Xna.Framework.Color(200, 200, 200, 0);
                                    float arg_1E93_5 = 0f;
                                    Microsoft.Xna.Framework.Vector2 origin = default(Microsoft.Xna.Framework.Vector2);
                                    arg_1E93_0.Draw(arg_1E93_1, arg_1E93_2, arg_1E93_3, arg_1E93_4, arg_1E93_5, origin, 1f, SpriteEffects.None, 0f);
                                }
                                else
                                {
                                    if (Main.tileAlch[(int)Main.tile[j, i].type])
                                    {
                                        height = 20;
                                        num9 = -1;
                                        int num31 = (int)Main.tile[j, i].type;
                                        int num32 = (int)(Main.tile[j, i].frameX / 18);
                                        if (num31 > 82)
                                        {
                                            if (num32 == 0 && Main.dayTime)
                                            {
                                                num31 = 84;
                                            }
                                            if (num32 == 1 && !Main.dayTime)
                                            {
                                                num31 = 84;
                                            }
                                            if (num32 == 3 && Main.bloodMoon)
                                            {
                                                num31 = 84;
                                            }
                                        }
                                        if (num31 == 84)
                                        {
                                            if (num32 == 0 && Main.rand.Next(100) == 0)
                                            {
                                                Microsoft.Xna.Framework.Vector2 arg_1F7C_0 = new Microsoft.Xna.Framework.Vector2((float)(j * 16), (float)(i * 16 - 4));
                                                int arg_1F7C_1 = 16;
                                                int arg_1F7C_2 = 16;
                                                int arg_1F7C_3 = 19;
                                                float arg_1F7C_4 = 0f;
                                                float arg_1F7C_5 = 0f;
                                                int arg_1F7C_6 = 160;
                                                Microsoft.Xna.Framework.Color newColor = default(Microsoft.Xna.Framework.Color);
                                                int num33 = Dust.NewDust(arg_1F7C_0, arg_1F7C_1, arg_1F7C_2, arg_1F7C_3, arg_1F7C_4, arg_1F7C_5, arg_1F7C_6, newColor, 0.1f);
                                                Dust expr_1F90_cp_0 = Main.dust[num33];
                                                expr_1F90_cp_0.velocity.X = expr_1F90_cp_0.velocity.X / 2f;
                                                Dust expr_1FAE_cp_0 = Main.dust[num33];
                                                expr_1FAE_cp_0.velocity.Y = expr_1FAE_cp_0.velocity.Y / 2f;
                                                Main.dust[num33].noGravity = true;
                                                Main.dust[num33].fadeIn = 1f;
                                            }
                                            if (num32 == 1 && Main.rand.Next(100) == 0)
                                            {
                                                Microsoft.Xna.Framework.Vector2 arg_2027_0 = new Microsoft.Xna.Framework.Vector2((float)(j * 16), (float)(i * 16));
                                                int arg_2027_1 = 16;
                                                int arg_2027_2 = 16;
                                                int arg_2027_3 = 41;
                                                float arg_2027_4 = 0f;
                                                float arg_2027_5 = 0f;
                                                int arg_2027_6 = 250;
                                                Microsoft.Xna.Framework.Color newColor = default(Microsoft.Xna.Framework.Color);
                                                Dust.NewDust(arg_2027_0, arg_2027_1, arg_2027_2, arg_2027_3, arg_2027_4, arg_2027_5, arg_2027_6, newColor, 0.8f);
                                            }
                                            if (num32 == 3)
                                            {
                                                if (Main.rand.Next(200) == 0)
                                                {
                                                    Microsoft.Xna.Framework.Vector2 arg_2078_0 = new Microsoft.Xna.Framework.Vector2((float)(j * 16), (float)(i * 16));
                                                    int arg_2078_1 = 16;
                                                    int arg_2078_2 = 16;
                                                    int arg_2078_3 = 14;
                                                    float arg_2078_4 = 0f;
                                                    float arg_2078_5 = 0f;
                                                    int arg_2078_6 = 100;
                                                    Microsoft.Xna.Framework.Color newColor = default(Microsoft.Xna.Framework.Color);
                                                    int num34 = Dust.NewDust(arg_2078_0, arg_2078_1, arg_2078_2, arg_2078_3, arg_2078_4, arg_2078_5, arg_2078_6, newColor, 0.2f);
                                                    Main.dust[num34].fadeIn = 1.2f;
                                                }
                                                if (Main.rand.Next(75) == 0)
                                                {
                                                    Microsoft.Xna.Framework.Vector2 arg_20D1_0 = new Microsoft.Xna.Framework.Vector2((float)(j * 16), (float)(i * 16));
                                                    int arg_20D1_1 = 16;
                                                    int arg_20D1_2 = 16;
                                                    int arg_20D1_3 = 27;
                                                    float arg_20D1_4 = 0f;
                                                    float arg_20D1_5 = 0f;
                                                    int arg_20D1_6 = 100;
                                                    Microsoft.Xna.Framework.Color newColor = default(Microsoft.Xna.Framework.Color);
                                                    int num35 = Dust.NewDust(arg_20D1_0, arg_20D1_1, arg_20D1_2, arg_20D1_3, arg_20D1_4, arg_20D1_5, arg_20D1_6, newColor, 1f);
                                                    Dust expr_20E5_cp_0 = Main.dust[num35];
                                                    expr_20E5_cp_0.velocity.X = expr_20E5_cp_0.velocity.X / 2f;
                                                    Dust expr_2103_cp_0 = Main.dust[num35];
                                                    expr_2103_cp_0.velocity.Y = expr_2103_cp_0.velocity.Y / 2f;
                                                }
                                            }
                                            if (num32 == 4 && Main.rand.Next(150) == 0)
                                            {
                                                Microsoft.Xna.Framework.Vector2 arg_2160_0 = new Microsoft.Xna.Framework.Vector2((float)(j * 16), (float)(i * 16));
                                                int arg_2160_1 = 16;
                                                int arg_2160_2 = 8;
                                                int arg_2160_3 = 16;
                                                float arg_2160_4 = 0f;
                                                float arg_2160_5 = 0f;
                                                int arg_2160_6 = 0;
                                                Microsoft.Xna.Framework.Color newColor = default(Microsoft.Xna.Framework.Color);
                                                int num36 = Dust.NewDust(arg_2160_0, arg_2160_1, arg_2160_2, arg_2160_3, arg_2160_4, arg_2160_5, arg_2160_6, newColor, 1f);
                                                Dust expr_2174_cp_0 = Main.dust[num36];
                                                expr_2174_cp_0.velocity.X = expr_2174_cp_0.velocity.X / 3f;
                                                Dust expr_2192_cp_0 = Main.dust[num36];
                                                expr_2192_cp_0.velocity.Y = expr_2192_cp_0.velocity.Y / 3f;
                                                Dust expr_21B0_cp_0 = Main.dust[num36];
                                                expr_21B0_cp_0.velocity.Y = expr_21B0_cp_0.velocity.Y - 0.7f;
                                                Main.dust[num36].alpha = 50;
                                                Main.dust[num36].scale *= 0.1f;
                                                Main.dust[num36].fadeIn = 0.9f;
                                                Main.dust[num36].noGravity = true;
                                            }
                                            if (num32 == 5)
                                            {
                                                if (Main.rand.Next(40) == 0)
                                                {
                                                    Microsoft.Xna.Framework.Vector2 arg_2251_0 = new Microsoft.Xna.Framework.Vector2((float)(j * 16), (float)(i * 16 - 6));
                                                    int arg_2251_1 = 16;
                                                    int arg_2251_2 = 16;
                                                    int arg_2251_3 = 6;
                                                    float arg_2251_4 = 0f;
                                                    float arg_2251_5 = 0f;
                                                    int arg_2251_6 = 0;
                                                    Microsoft.Xna.Framework.Color newColor = default(Microsoft.Xna.Framework.Color);
                                                    int num37 = Dust.NewDust(arg_2251_0, arg_2251_1, arg_2251_2, arg_2251_3, arg_2251_4, arg_2251_5, arg_2251_6, newColor, 1.5f);
                                                    Dust expr_2265_cp_0 = Main.dust[num37];
                                                    expr_2265_cp_0.velocity.Y = expr_2265_cp_0.velocity.Y - 2f;
                                                    Main.dust[num37].noGravity = true;
                                                }
                                                color.A = (byte)(Main.mouseTextColor / 2);
                                                color.G = Main.mouseTextColor;
                                                color.B = Main.mouseTextColor;
                                            }
                                        }
                                        SpriteBatch arg_234B_0 = this.spriteBatch;
                                        Texture2D arg_234B_1 = Main.tileTexture[num31];
                                        Microsoft.Xna.Framework.Vector2 arg_234B_2 = new Microsoft.Xna.Framework.Vector2((float)(j * 16 - (int)Main.screenPosition.X) - ((float)num8 - 16f) / 2f, (float)(i * 16 - (int)Main.screenPosition.Y + num9)) + value;
                                        Microsoft.Xna.Framework.Rectangle? arg_234B_3 = new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle((int)Main.tile[j, i].frameX, (int)Main.tile[j, i].frameY, num8, height));
                                        Microsoft.Xna.Framework.Color arg_234B_4 = color;
                                        float arg_234B_5 = 0f;
                                        Microsoft.Xna.Framework.Vector2 origin = default(Microsoft.Xna.Framework.Vector2);
                                        arg_234B_0.Draw(arg_234B_1, arg_234B_2, arg_234B_3, arg_234B_4, arg_234B_5, origin, 1f, SpriteEffects.None, 0f);
                                    }
                                    else
                                    {
                                        if (Main.tile[j, i].type == 80)
                                        {
                                            bool flag7 = false;
                                            bool flag8 = false;
                                            int num38 = j;
                                            if (Main.tile[j, i].frameX == 36)
                                            {
                                                num38--;
                                            }
                                            if (Main.tile[j, i].frameX == 54)
                                            {
                                                num38++;
                                            }
                                            if (Main.tile[j, i].frameX == 108)
                                            {
                                                if (Main.tile[j, i].frameY == 16)
                                                {
                                                    num38--;
                                                }
                                                else
                                                {
                                                    num38++;
                                                }
                                            }
                                            int num39 = i;
                                            bool flag9 = false;
                                            if (Main.tile[num38, num39].type == 80 && Main.tile[num38, num39].active)
                                            {
                                                flag9 = true;
                                            }
                                            while (!Main.tile[num38, num39].active || !Main.tileSolid[(int)Main.tile[num38, num39].type] || !flag9)
                                            {
                                                if (Main.tile[num38, num39].type == 80 && Main.tile[num38, num39].active)
                                                {
                                                    flag9 = true;
                                                }
                                                num39++;
                                                if (num39 > i + 20)
                                                {
                                                    break;
                                                }
                                            }
                                            if (Main.tile[num38, num39].type == 112)
                                            {
                                                flag7 = true;
                                            }
                                            if (Main.tile[num38, num39].type == 116)
                                            {
                                                flag8 = true;
                                            }
                                            if (flag7)
                                            {
                                                SpriteBatch arg_2571_0 = this.spriteBatch;
                                                Texture2D arg_2571_1 = Main.evilCactusTexture;
                                                Microsoft.Xna.Framework.Vector2 arg_2571_2 = new Microsoft.Xna.Framework.Vector2((float)(j * 16 - (int)Main.screenPosition.X) - ((float)num8 - 16f) / 2f, (float)(i * 16 - (int)Main.screenPosition.Y + num9)) + value;
                                                Microsoft.Xna.Framework.Rectangle? arg_2571_3 = new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle((int)Main.tile[j, i].frameX, (int)Main.tile[j, i].frameY, num8, height));
                                                Microsoft.Xna.Framework.Color arg_2571_4 = color;
                                                float arg_2571_5 = 0f;
                                                Microsoft.Xna.Framework.Vector2 origin = default(Microsoft.Xna.Framework.Vector2);
                                                arg_2571_0.Draw(arg_2571_1, arg_2571_2, arg_2571_3, arg_2571_4, arg_2571_5, origin, 1f, SpriteEffects.None, 0f);
                                            }
                                            else
                                            {
                                                if (flag8)
                                                {
                                                    SpriteBatch arg_261F_0 = this.spriteBatch;
                                                    Texture2D arg_261F_1 = Main.goodCactusTexture;
                                                    Microsoft.Xna.Framework.Vector2 arg_261F_2 = new Microsoft.Xna.Framework.Vector2((float)(j * 16 - (int)Main.screenPosition.X) - ((float)num8 - 16f) / 2f, (float)(i * 16 - (int)Main.screenPosition.Y + num9)) + value;
                                                    Microsoft.Xna.Framework.Rectangle? arg_261F_3 = new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle((int)Main.tile[j, i].frameX, (int)Main.tile[j, i].frameY, num8, height));
                                                    Microsoft.Xna.Framework.Color arg_261F_4 = color;
                                                    float arg_261F_5 = 0f;
                                                    Microsoft.Xna.Framework.Vector2 origin = default(Microsoft.Xna.Framework.Vector2);
                                                    arg_261F_0.Draw(arg_261F_1, arg_261F_2, arg_261F_3, arg_261F_4, arg_261F_5, origin, 1f, SpriteEffects.None, 0f);
                                                }
                                                else
                                                {
                                                    SpriteBatch arg_26DA_0 = this.spriteBatch;
                                                    Texture2D arg_26DA_1 = Main.tileTexture[(int)Main.tile[j, i].type];
                                                    Microsoft.Xna.Framework.Vector2 arg_26DA_2 = new Microsoft.Xna.Framework.Vector2((float)(j * 16 - (int)Main.screenPosition.X) - ((float)num8 - 16f) / 2f, (float)(i * 16 - (int)Main.screenPosition.Y + num9)) + value;
                                                    Microsoft.Xna.Framework.Rectangle? arg_26DA_3 = new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle((int)Main.tile[j, i].frameX, (int)Main.tile[j, i].frameY, num8, height));
                                                    Microsoft.Xna.Framework.Color arg_26DA_4 = color;
                                                    float arg_26DA_5 = 0f;
                                                    Microsoft.Xna.Framework.Vector2 origin = default(Microsoft.Xna.Framework.Vector2);
                                                    arg_26DA_0.Draw(arg_26DA_1, arg_26DA_2, arg_26DA_3, arg_26DA_4, arg_26DA_5, origin, 1f, SpriteEffects.None, 0f);
                                                }
                                            }
                                        }
                                        else
                                        {
                                            if (Lighting.lightMode < 2 && Main.tileSolid[(int)Main.tile[j, i].type] && Main.tile[j, i].type != 137)
                                            {
                                                if ((int)color.R > num || (double)color.G > (double)num * 1.1 || (double)color.B > (double)num * 1.2)
                                                {
                                                    for (int k = 0; k < 9; k++)
                                                    {
                                                        int num40 = 0;
                                                        int num41 = 0;
                                                        int width = 4;
                                                        int height2 = 4;
                                                        Microsoft.Xna.Framework.Color color4 = color;
                                                        Microsoft.Xna.Framework.Color color5 = color;
                                                        if (k == 0)
                                                        {
                                                            color5 = Lighting.GetColor(j - 1, i - 1);
                                                        }
                                                        if (k == 1)
                                                        {
                                                            width = 8;
                                                            num40 = 4;
                                                            color5 = Lighting.GetColor(j, i - 1);
                                                        }
                                                        if (k == 2)
                                                        {
                                                            color5 = Lighting.GetColor(j + 1, i - 1);
                                                            num40 = 12;
                                                        }
                                                        if (k == 3)
                                                        {
                                                            color5 = Lighting.GetColor(j - 1, i);
                                                            height2 = 8;
                                                            num41 = 4;
                                                        }
                                                        if (k == 4)
                                                        {
                                                            width = 8;
                                                            height2 = 8;
                                                            num40 = 4;
                                                            num41 = 4;
                                                        }
                                                        if (k == 5)
                                                        {
                                                            num40 = 12;
                                                            num41 = 4;
                                                            height2 = 8;
                                                            color5 = Lighting.GetColor(j + 1, i);
                                                        }
                                                        if (k == 6)
                                                        {
                                                            color5 = Lighting.GetColor(j - 1, i + 1);
                                                            num41 = 12;
                                                        }
                                                        if (k == 7)
                                                        {
                                                            width = 8;
                                                            height2 = 4;
                                                            num40 = 4;
                                                            num41 = 12;
                                                            color5 = Lighting.GetColor(j, i + 1);
                                                        }
                                                        if (k == 8)
                                                        {
                                                            color5 = Lighting.GetColor(j + 1, i + 1);
                                                            num40 = 12;
                                                            num41 = 12;
                                                        }
                                                        color4.R = (byte)((color.R + color5.R) / 2);
                                                        color4.G = (byte)((color.G + color5.G) / 2);
                                                        color4.B = (byte)((color.B + color5.B) / 2);
                                                        if (Main.tileShine2[(int)Main.tile[j, i].type])
                                                        {
                                                            color4 = Main.shine(color4, (int)Main.tile[j, i].type);
                                                        }
                                                        SpriteBatch arg_299A_0 = this.spriteBatch;
                                                        Texture2D arg_299A_1 = Main.tileTexture[(int)Main.tile[j, i].type];
                                                        Microsoft.Xna.Framework.Vector2 arg_299A_2 = new Microsoft.Xna.Framework.Vector2((float)(j * 16 - (int)Main.screenPosition.X) - ((float)num8 - 16f) / 2f + (float)num40, (float)(i * 16 - (int)Main.screenPosition.Y + num9 + num41)) + value;
                                                        Microsoft.Xna.Framework.Rectangle? arg_299A_3 = new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle((int)Main.tile[j, i].frameX + num40, (int)Main.tile[j, i].frameY + num41, width, height2));
                                                        Microsoft.Xna.Framework.Color arg_299A_4 = color4;
                                                        float arg_299A_5 = 0f;
                                                        Microsoft.Xna.Framework.Vector2 origin = default(Microsoft.Xna.Framework.Vector2);
                                                        arg_299A_0.Draw(arg_299A_1, arg_299A_2, arg_299A_3, arg_299A_4, arg_299A_5, origin, 1f, SpriteEffects.None, 0f);
                                                    }
                                                }
                                                else
                                                {
                                                    if ((int)color.R > num2 || (double)color.G > (double)num2 * 1.1 || (double)color.B > (double)num2 * 1.2)
                                                    {
                                                        for (int l = 0; l < 4; l++)
                                                        {
                                                            int num42 = 0;
                                                            int num43 = 0;
                                                            Microsoft.Xna.Framework.Color color6 = color;
                                                            Microsoft.Xna.Framework.Color color7 = color;
                                                            if (l == 0)
                                                            {
                                                                if (Lighting.Brighter(j, i - 1, j - 1, i))
                                                                {
                                                                    color7 = Lighting.GetColor(j - 1, i);
                                                                }
                                                                else
                                                                {
                                                                    color7 = Lighting.GetColor(j, i - 1);
                                                                }
                                                            }
                                                            if (l == 1)
                                                            {
                                                                if (Lighting.Brighter(j, i - 1, j + 1, i))
                                                                {
                                                                    color7 = Lighting.GetColor(j + 1, i);
                                                                }
                                                                else
                                                                {
                                                                    color7 = Lighting.GetColor(j, i - 1);
                                                                }
                                                                num42 = 8;
                                                            }
                                                            if (l == 2)
                                                            {
                                                                if (Lighting.Brighter(j, i + 1, j - 1, i))
                                                                {
                                                                    color7 = Lighting.GetColor(j - 1, i);
                                                                }
                                                                else
                                                                {
                                                                    color7 = Lighting.GetColor(j, i + 1);
                                                                }
                                                                num43 = 8;
                                                            }
                                                            if (l == 3)
                                                            {
                                                                if (Lighting.Brighter(j, i + 1, j + 1, i))
                                                                {
                                                                    color7 = Lighting.GetColor(j + 1, i);
                                                                }
                                                                else
                                                                {
                                                                    color7 = Lighting.GetColor(j, i + 1);
                                                                }
                                                                num42 = 8;
                                                                num43 = 8;
                                                            }
                                                            color6.R = (byte)((color.R + color7.R) / 2);
                                                            color6.G = (byte)((color.G + color7.G) / 2);
                                                            color6.B = (byte)((color.B + color7.B) / 2);
                                                            if (Main.tileShine2[(int)Main.tile[j, i].type])
                                                            {
                                                                color6 = Main.shine(color6, (int)Main.tile[j, i].type);
                                                            }
                                                            SpriteBatch arg_2C1B_0 = this.spriteBatch;
                                                            Texture2D arg_2C1B_1 = Main.tileTexture[(int)Main.tile[j, i].type];
                                                            Microsoft.Xna.Framework.Vector2 arg_2C1B_2 = new Microsoft.Xna.Framework.Vector2((float)(j * 16 - (int)Main.screenPosition.X) - ((float)num8 - 16f) / 2f + (float)num42, (float)(i * 16 - (int)Main.screenPosition.Y + num9 + num43)) + value;
                                                            Microsoft.Xna.Framework.Rectangle? arg_2C1B_3 = new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle((int)Main.tile[j, i].frameX + num42, (int)Main.tile[j, i].frameY + num43, 8, 8));
                                                            Microsoft.Xna.Framework.Color arg_2C1B_4 = color6;
                                                            float arg_2C1B_5 = 0f;
                                                            Microsoft.Xna.Framework.Vector2 origin = default(Microsoft.Xna.Framework.Vector2);
                                                            arg_2C1B_0.Draw(arg_2C1B_1, arg_2C1B_2, arg_2C1B_3, arg_2C1B_4, arg_2C1B_5, origin, 1f, SpriteEffects.None, 0f);
                                                        }
                                                    }
                                                    else
                                                    {
                                                        if (Main.tileShine2[(int)Main.tile[j, i].type])
                                                        {
                                                            color = Main.shine(color, (int)Main.tile[j, i].type);
                                                        }
                                                        SpriteBatch arg_2D1B_0 = this.spriteBatch;
                                                        Texture2D arg_2D1B_1 = Main.tileTexture[(int)Main.tile[j, i].type];
                                                        Microsoft.Xna.Framework.Vector2 arg_2D1B_2 = new Microsoft.Xna.Framework.Vector2((float)(j * 16 - (int)Main.screenPosition.X) - ((float)num8 - 16f) / 2f, (float)(i * 16 - (int)Main.screenPosition.Y + num9)) + value;
                                                        Microsoft.Xna.Framework.Rectangle? arg_2D1B_3 = new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle((int)Main.tile[j, i].frameX, (int)Main.tile[j, i].frameY, num8, height));
                                                        Microsoft.Xna.Framework.Color arg_2D1B_4 = color;
                                                        float arg_2D1B_5 = 0f;
                                                        Microsoft.Xna.Framework.Vector2 origin = default(Microsoft.Xna.Framework.Vector2);
                                                        arg_2D1B_0.Draw(arg_2D1B_1, arg_2D1B_2, arg_2D1B_3, arg_2D1B_4, arg_2D1B_5, origin, 1f, SpriteEffects.None, 0f);
                                                    }
                                                }
                                            }
                                            else
                                            {
                                                if (Lighting.lightMode < 2 && Main.tileShine2[(int)Main.tile[j, i].type])
                                                {
                                                    if (Main.tile[j, i].type == 21)
                                                    {
                                                        if (Main.tile[j, i].frameX >= 36 && Main.tile[j, i].frameX < 178)
                                                        {
                                                            color = Main.shine(color, (int)Main.tile[j, i].type);
                                                        }
                                                    }
                                                    else
                                                    {
                                                        color = Main.shine(color, (int)Main.tile[j, i].type);
                                                    }
                                                }
                                                if (Main.tile[j, i].type == 128)
                                                {
                                                    int m;
                                                    for (m = (int)Main.tile[j, i].frameX; m >= 100; m -= 100)
                                                    {
                                                    }
                                                    SpriteBatch arg_2EB1_0 = this.spriteBatch;
                                                    Texture2D arg_2EB1_1 = Main.tileTexture[(int)Main.tile[j, i].type];
                                                    Microsoft.Xna.Framework.Vector2 arg_2EB1_2 = new Microsoft.Xna.Framework.Vector2((float)(j * 16 - (int)Main.screenPosition.X) - ((float)num8 - 16f) / 2f, (float)(i * 16 - (int)Main.screenPosition.Y + num9)) + value;
                                                    Microsoft.Xna.Framework.Rectangle? arg_2EB1_3 = new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(m, (int)Main.tile[j, i].frameY, num8, height));
                                                    Microsoft.Xna.Framework.Color arg_2EB1_4 = color;
                                                    float arg_2EB1_5 = 0f;
                                                    Microsoft.Xna.Framework.Vector2 origin = default(Microsoft.Xna.Framework.Vector2);
                                                    arg_2EB1_0.Draw(arg_2EB1_1, arg_2EB1_2, arg_2EB1_3, arg_2EB1_4, arg_2EB1_5, origin, 1f, SpriteEffects.None, 0f);
                                                }
                                                else
                                                {
                                                    SpriteBatch arg_2F6C_0 = this.spriteBatch;
                                                    Texture2D arg_2F6C_1 = Main.tileTexture[(int)Main.tile[j, i].type];
                                                    Microsoft.Xna.Framework.Vector2 arg_2F6C_2 = new Microsoft.Xna.Framework.Vector2((float)(j * 16 - (int)Main.screenPosition.X) - ((float)num8 - 16f) / 2f, (float)(i * 16 - (int)Main.screenPosition.Y + num9)) + value;
                                                    Microsoft.Xna.Framework.Rectangle? arg_2F6C_3 = new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle((int)Main.tile[j, i].frameX, (int)Main.tile[j, i].frameY, num8, height));
                                                    Microsoft.Xna.Framework.Color arg_2F6C_4 = color;
                                                    float arg_2F6C_5 = 0f;
                                                    Microsoft.Xna.Framework.Vector2 origin = default(Microsoft.Xna.Framework.Vector2);
                                                    arg_2F6C_0.Draw(arg_2F6C_1, arg_2F6C_2, arg_2F6C_3, arg_2F6C_4, arg_2F6C_5, origin, 1f, SpriteEffects.None, 0f);
                                                    if (Main.tile[j, i].type == 139)
                                                    {
                                                        SpriteBatch arg_303E_0 = this.spriteBatch;
                                                        Texture2D arg_303E_1 = Main.MusicBoxTexture;
                                                        Microsoft.Xna.Framework.Vector2 arg_303E_2 = new Microsoft.Xna.Framework.Vector2((float)(j * 16 - (int)Main.screenPosition.X) - ((float)num8 - 16f) / 2f, (float)(i * 16 - (int)Main.screenPosition.Y + num9)) + value;
                                                        Microsoft.Xna.Framework.Rectangle? arg_303E_3 = new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle((int)Main.tile[j, i].frameX, (int)Main.tile[j, i].frameY, num8, height));
                                                        Microsoft.Xna.Framework.Color arg_303E_4 = new Microsoft.Xna.Framework.Color(200, 200, 200, 0);
                                                        float arg_303E_5 = 0f;
                                                        origin = default(Microsoft.Xna.Framework.Vector2);
                                                        arg_303E_0.Draw(arg_303E_1, arg_303E_2, arg_303E_3, arg_303E_4, arg_303E_5, origin, 1f, SpriteEffects.None, 0f);
                                                    }
                                                    if (Main.tile[j, i].type == 144)
                                                    {
                                                        SpriteBatch arg_3110_0 = this.spriteBatch;
                                                        Texture2D arg_3110_1 = Main.timerTexture;
                                                        Microsoft.Xna.Framework.Vector2 arg_3110_2 = new Microsoft.Xna.Framework.Vector2((float)(j * 16 - (int)Main.screenPosition.X) - ((float)num8 - 16f) / 2f, (float)(i * 16 - (int)Main.screenPosition.Y + num9)) + value;
                                                        Microsoft.Xna.Framework.Rectangle? arg_3110_3 = new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle((int)Main.tile[j, i].frameX, (int)Main.tile[j, i].frameY, num8, height));
                                                        Microsoft.Xna.Framework.Color arg_3110_4 = new Microsoft.Xna.Framework.Color(200, 200, 200, 0);
                                                        float arg_3110_5 = 0f;
                                                        origin = default(Microsoft.Xna.Framework.Vector2);
                                                        arg_3110_0.Draw(arg_3110_1, arg_3110_2, arg_3110_3, arg_3110_4, arg_3110_5, origin, 1f, SpriteEffects.None, 0f);
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
            for (int n = 0; n < num3; n++)
            {
                int num44 = array[n];
                int num45 = array2[n];
                if (Main.tile[num44, num45].type == 128 && Main.tile[num44, num45].frameX >= 100)
                {
                    int num46 = (int)(Main.tile[num44, num45].frameY / 18);
                    int num47 = (int)Main.tile[num44, num45].frameX;
                    int num48 = 0;
                    while (num47 >= 100)
                    {
                        num48++;
                        num47 -= 100;
                    }
                    int num49 = -4;
                    SpriteEffects effects = SpriteEffects.FlipHorizontally;
                    if (num47 >= 36)
                    {
                        effects = SpriteEffects.None;
                        num49 = -4;
                    }
                    if (num46 == 0)
                    {
                        SpriteBatch arg_325B_0 = this.spriteBatch;
                        Texture2D arg_325B_1 = Main.armorHeadTexture[num48];
                        Microsoft.Xna.Framework.Vector2 arg_325B_2 = new Microsoft.Xna.Framework.Vector2((float)(num44 * 16 - (int)Main.screenPosition.X + num49), (float)(num45 * 16 - (int)Main.screenPosition.Y - 12)) + value;
                        Microsoft.Xna.Framework.Rectangle? arg_325B_3 = new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, 40, 36));
                        Microsoft.Xna.Framework.Color arg_325B_4 = Lighting.GetColor(num44, num45);
                        float arg_325B_5 = 0f;
                        Microsoft.Xna.Framework.Vector2 origin = default(Microsoft.Xna.Framework.Vector2);
                        arg_325B_0.Draw(arg_325B_1, arg_325B_2, arg_325B_3, arg_325B_4, arg_325B_5, origin, 1f, effects, 0f);
                    }
                    else
                    {
                        if (num46 == 1)
                        {
                            SpriteBatch arg_32E4_0 = this.spriteBatch;
                            Texture2D arg_32E4_1 = Main.armorBodyTexture[num48];
                            Microsoft.Xna.Framework.Vector2 arg_32E4_2 = new Microsoft.Xna.Framework.Vector2((float)(num44 * 16 - (int)Main.screenPosition.X + num49), (float)(num45 * 16 - (int)Main.screenPosition.Y - 28)) + value;
                            Microsoft.Xna.Framework.Rectangle? arg_32E4_3 = new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, 40, 54));
                            Microsoft.Xna.Framework.Color arg_32E4_4 = Lighting.GetColor(num44, num45);
                            float arg_32E4_5 = 0f;
                            Microsoft.Xna.Framework.Vector2 origin = default(Microsoft.Xna.Framework.Vector2);
                            arg_32E4_0.Draw(arg_32E4_1, arg_32E4_2, arg_32E4_3, arg_32E4_4, arg_32E4_5, origin, 1f, effects, 0f);
                        }
                        else
                        {
                            if (num46 == 2)
                            {
                                SpriteBatch arg_336A_0 = this.spriteBatch;
                                Texture2D arg_336A_1 = Main.armorLegTexture[num48];
                                Microsoft.Xna.Framework.Vector2 arg_336A_2 = new Microsoft.Xna.Framework.Vector2((float)(num44 * 16 - (int)Main.screenPosition.X + num49), (float)(num45 * 16 - (int)Main.screenPosition.Y - 44)) + value;
                                Microsoft.Xna.Framework.Rectangle? arg_336A_3 = new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, 40, 54));
                                Microsoft.Xna.Framework.Color arg_336A_4 = Lighting.GetColor(num44, num45);
                                float arg_336A_5 = 0f;
                                Microsoft.Xna.Framework.Vector2 origin = default(Microsoft.Xna.Framework.Vector2);
                                arg_336A_0.Draw(arg_336A_1, arg_336A_2, arg_336A_3, arg_336A_4, arg_336A_5, origin, 1f, effects, 0f);
                            }
                        }
                    }
                }
                if (Main.tile[num44, num45].type == 5 && Main.tile[num44, num45].frameY >= 198 && Main.tile[num44, num45].frameX >= 22)
                {
                    int num50 = 0;
                    if (Main.tile[num44, num45].frameX == 22)
                    {
                        if (Main.tile[num44, num45].frameY == 220)
                        {
                            num50 = 1;
                        }
                        else
                        {
                            if (Main.tile[num44, num45].frameY == 242)
                            {
                                num50 = 2;
                            }
                        }
                        int num51 = 0;
                        int num52 = 80;
                        int num53 = 80;
                        int num54 = 32;
                        int num55 = 0;
                        int num56 = num45;
                        while (num56 < num45 + 100)
                        {
                            if (Main.tile[num44, num56].type == 2)
                            {
                                num51 = 0;
                                break;
                            }
                            if (Main.tile[num44, num56].type == 23)
                            {
                                num51 = 1;
                                break;
                            }
                            if (Main.tile[num44, num56].type == 60)
                            {
                                num51 = 2;
                                num52 = 114;
                                num53 = 96;
                                num54 = 48;
                                break;
                            }
                            if (Main.tile[num44, num56].type == 109)
                            {
                                num51 = 3;
                                num53 = 140;
                                if (num44 % 3 == 1)
                                {
                                    num50 += 3;
                                    break;
                                }
                                if (num44 % 3 == 2)
                                {
                                    num50 += 6;
                                    break;
                                }
                                break;
                            }
                            else
                            {
                                num56++;
                            }
                        }
                        SpriteBatch arg_3568_0 = this.spriteBatch;
                        Texture2D arg_3568_1 = Main.treeTopTexture[num51];
                        Microsoft.Xna.Framework.Vector2 arg_3568_2 = new Microsoft.Xna.Framework.Vector2((float)(num44 * 16 - (int)Main.screenPosition.X - num54), (float)(num45 * 16 - (int)Main.screenPosition.Y - num53 + 16 + num55)) + value;
                        Microsoft.Xna.Framework.Rectangle? arg_3568_3 = new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(num50 * (num52 + 2), 0, num52, num53));
                        Microsoft.Xna.Framework.Color arg_3568_4 = Lighting.GetColor(num44, num45);
                        float arg_3568_5 = 0f;
                        Microsoft.Xna.Framework.Vector2 origin = default(Microsoft.Xna.Framework.Vector2);
                        arg_3568_0.Draw(arg_3568_1, arg_3568_2, arg_3568_3, arg_3568_4, arg_3568_5, origin, 1f, SpriteEffects.None, 0f);
                    }
                    else
                    {
                        if (Main.tile[num44, num45].frameX == 44)
                        {
                            if (Main.tile[num44, num45].frameY == 220)
                            {
                                num50 = 1;
                            }
                            else
                            {
                                if (Main.tile[num44, num45].frameY == 242)
                                {
                                    num50 = 2;
                                }
                            }
                            int num57 = 0;
                            int num58 = num45;
                            while (num58 < num45 + 100)
                            {
                                if (Main.tile[num44 + 1, num58].type == 2)
                                {
                                    num57 = 0;
                                    break;
                                }
                                if (Main.tile[num44 + 1, num58].type == 23)
                                {
                                    num57 = 1;
                                    break;
                                }
                                if (Main.tile[num44 + 1, num58].type == 60)
                                {
                                    num57 = 2;
                                    break;
                                }
                                if (Main.tile[num44 + 1, num58].type == 109)
                                {
                                    num57 = 3;
                                    if (num44 % 3 == 1)
                                    {
                                        num50 += 3;
                                        break;
                                    }
                                    if (num44 % 3 == 2)
                                    {
                                        num50 += 6;
                                        break;
                                    }
                                    break;
                                }
                                else
                                {
                                    num58++;
                                }
                            }
                            SpriteBatch arg_36F6_0 = this.spriteBatch;
                            Texture2D arg_36F6_1 = Main.treeBranchTexture[num57];
                            Microsoft.Xna.Framework.Vector2 arg_36F6_2 = new Microsoft.Xna.Framework.Vector2((float)(num44 * 16 - (int)Main.screenPosition.X - 24), (float)(num45 * 16 - (int)Main.screenPosition.Y - 12)) + value;
                            Microsoft.Xna.Framework.Rectangle? arg_36F6_3 = new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, num50 * 42, 40, 40));
                            Microsoft.Xna.Framework.Color arg_36F6_4 = Lighting.GetColor(num44, num45);
                            float arg_36F6_5 = 0f;
                            Microsoft.Xna.Framework.Vector2 origin = default(Microsoft.Xna.Framework.Vector2);
                            arg_36F6_0.Draw(arg_36F6_1, arg_36F6_2, arg_36F6_3, arg_36F6_4, arg_36F6_5, origin, 1f, SpriteEffects.None, 0f);
                        }
                        else
                        {
                            if (Main.tile[num44, num45].frameX == 66)
                            {
                                if (Main.tile[num44, num45].frameY == 220)
                                {
                                    num50 = 1;
                                }
                                else
                                {
                                    if (Main.tile[num44, num45].frameY == 242)
                                    {
                                        num50 = 2;
                                    }
                                }
                                int num59 = 0;
                                int num60 = num45;
                                while (num60 < num45 + 100)
                                {
                                    if (Main.tile[num44 - 1, num60].type == 2)
                                    {
                                        num59 = 0;
                                        break;
                                    }
                                    if (Main.tile[num44 - 1, num60].type == 23)
                                    {
                                        num59 = 1;
                                        break;
                                    }
                                    if (Main.tile[num44 - 1, num60].type == 60)
                                    {
                                        num59 = 2;
                                        break;
                                    }
                                    if (Main.tile[num44 - 1, num60].type == 109)
                                    {
                                        num59 = 3;
                                        if (num44 % 3 == 1)
                                        {
                                            num50 += 3;
                                            break;
                                        }
                                        if (num44 % 3 == 2)
                                        {
                                            num50 += 6;
                                            break;
                                        }
                                        break;
                                    }
                                    else
                                    {
                                        num60++;
                                    }
                                }
                                SpriteBatch arg_3882_0 = this.spriteBatch;
                                Texture2D arg_3882_1 = Main.treeBranchTexture[num59];
                                Microsoft.Xna.Framework.Vector2 arg_3882_2 = new Microsoft.Xna.Framework.Vector2((float)(num44 * 16 - (int)Main.screenPosition.X), (float)(num45 * 16 - (int)Main.screenPosition.Y - 12)) + value;
                                Microsoft.Xna.Framework.Rectangle? arg_3882_3 = new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(42, num50 * 42, 40, 40));
                                Microsoft.Xna.Framework.Color arg_3882_4 = Lighting.GetColor(num44, num45);
                                float arg_3882_5 = 0f;
                                Microsoft.Xna.Framework.Vector2 origin = default(Microsoft.Xna.Framework.Vector2);
                                arg_3882_0.Draw(arg_3882_1, arg_3882_2, arg_3882_3, arg_3882_4, arg_3882_5, origin, 1f, SpriteEffects.None, 0f);
                            }
                        }
                    }
                }
            }
            if (solidOnly)
            {
                Main.renderTimer[0] = (float)stopwatch.ElapsedMilliseconds;
                return;
            }
            Main.renderTimer[1] = (float)stopwatch.ElapsedMilliseconds;
        }
Example #33
0
 protected void DrawInterface()
 {
     if (this.showNPCs)
     {
         this.DrawNPCHouse();
     }
     if (Main.player[Main.myPlayer].selectedItem == 48 && Main.player[Main.myPlayer].itemAnimation > 0)
     {
         Main.mouseLeftRelease = false;
     }
     Main.mouseHC = false;
     if (Main.hideUI)
     {
         Main.maxQ = true;
         return;
     }
     Microsoft.Xna.Framework.Vector2 origin;
     if (Main.player[Main.myPlayer].rulerAcc)
     {
         int num = (int)((float)((int)(Main.screenPosition.X / 16f) * 16) - Main.screenPosition.X);
         int num2 = (int)((float)((int)(Main.screenPosition.Y / 16f) * 16) - Main.screenPosition.Y);
         int num3 = Main.screenWidth / Main.gridTexture.Width;
         int num4 = Main.screenHeight / Main.gridTexture.Height;
         for (int i = 0; i <= num3 + 1; i++)
         {
             for (int j = 0; j <= num4 + 1; j++)
             {
                 SpriteBatch arg_155_0 = this.spriteBatch;
                 Texture2D arg_155_1 = Main.gridTexture;
                 Microsoft.Xna.Framework.Vector2 arg_155_2 = new Microsoft.Xna.Framework.Vector2((float)(i * Main.gridTexture.Width + num), (float)(j * Main.gridTexture.Height + num2));
                 Microsoft.Xna.Framework.Rectangle? arg_155_3 = new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.gridTexture.Width, Main.gridTexture.Height));
                 Microsoft.Xna.Framework.Color arg_155_4 = new Microsoft.Xna.Framework.Color(100, 100, 100, 15);
                 float arg_155_5 = 0f;
                 origin = default(Microsoft.Xna.Framework.Vector2);
                 arg_155_0.Draw(arg_155_1, arg_155_2, arg_155_3, arg_155_4, arg_155_5, origin, 1f, SpriteEffects.None, 0f);
             }
         }
     }
     if (Main.netDiag)
     {
         for (int k = 0; k < 4; k++)
         {
             string text = "";
             int num5 = 20;
             int num6 = 220;
             if (k == 0)
             {
                 text = "RX Msgs: " + string.Format("{0:0,0}", Main.rxMsg);
                 num6 += k * 20;
             }
             else
             {
                 if (k == 1)
                 {
                     text = "RX Bytes: " + string.Format("{0:0,0}", Main.rxData);
                     num6 += k * 20;
                 }
                 else
                 {
                     if (k == 2)
                     {
                         text = "TX Msgs: " + string.Format("{0:0,0}", Main.txMsg);
                         num6 += k * 20;
                     }
                     else
                     {
                         if (k == 3)
                         {
                             text = "TX Bytes: " + string.Format("{0:0,0}", Main.txData);
                             num6 += k * 20;
                         }
                     }
                 }
             }
             SpriteBatch arg_29D_0 = this.spriteBatch;
             SpriteFont arg_29D_1 = Main.fontMouseText;
             string arg_29D_2 = text;
             Microsoft.Xna.Framework.Vector2 arg_29D_3 = new Microsoft.Xna.Framework.Vector2((float)num5, (float)num6);
             Microsoft.Xna.Framework.Color arg_29D_4 = Microsoft.Xna.Framework.Color.White;
             float arg_29D_5 = 0f;
             origin = default(Microsoft.Xna.Framework.Vector2);
             arg_29D_0.DrawString(arg_29D_1, arg_29D_2, arg_29D_3, arg_29D_4, arg_29D_5, origin, 1f, SpriteEffects.None, 0f);
         }
         for (int l = 0; l < Main.maxMsg; l++)
         {
             int num7 = 200;
             int num8 = 120;
             num8 += l * 15;
             string text2 = l + ": ";
             SpriteBatch arg_322_0 = this.spriteBatch;
             SpriteFont arg_322_1 = Main.fontMouseText;
             string arg_322_2 = text2;
             Microsoft.Xna.Framework.Vector2 arg_322_3 = new Microsoft.Xna.Framework.Vector2((float)num7, (float)num8);
             Microsoft.Xna.Framework.Color arg_322_4 = Microsoft.Xna.Framework.Color.White;
             float arg_322_5 = 0f;
             origin = default(Microsoft.Xna.Framework.Vector2);
             arg_322_0.DrawString(arg_322_1, arg_322_2, arg_322_3, arg_322_4, arg_322_5, origin, 0.8f, SpriteEffects.None, 0f);
             num7 += 30;
             text2 = "rx:" + string.Format("{0:0,0}", Main.rxMsgType[l]);
             SpriteBatch arg_38C_0 = this.spriteBatch;
             SpriteFont arg_38C_1 = Main.fontMouseText;
             string arg_38C_2 = text2;
             Microsoft.Xna.Framework.Vector2 arg_38C_3 = new Microsoft.Xna.Framework.Vector2((float)num7, (float)num8);
             Microsoft.Xna.Framework.Color arg_38C_4 = Microsoft.Xna.Framework.Color.White;
             float arg_38C_5 = 0f;
             origin = default(Microsoft.Xna.Framework.Vector2);
             arg_38C_0.DrawString(arg_38C_1, arg_38C_2, arg_38C_3, arg_38C_4, arg_38C_5, origin, 0.8f, SpriteEffects.None, 0f);
             num7 += 70;
             text2 = string.Format("{0:0,0}", Main.rxDataType[l]);
             SpriteBatch arg_3EC_0 = this.spriteBatch;
             SpriteFont arg_3EC_1 = Main.fontMouseText;
             string arg_3EC_2 = text2;
             Microsoft.Xna.Framework.Vector2 arg_3EC_3 = new Microsoft.Xna.Framework.Vector2((float)num7, (float)num8);
             Microsoft.Xna.Framework.Color arg_3EC_4 = Microsoft.Xna.Framework.Color.White;
             float arg_3EC_5 = 0f;
             origin = default(Microsoft.Xna.Framework.Vector2);
             arg_3EC_0.DrawString(arg_3EC_1, arg_3EC_2, arg_3EC_3, arg_3EC_4, arg_3EC_5, origin, 0.8f, SpriteEffects.None, 0f);
             num7 += 70;
             text2 = l + ": ";
             SpriteBatch arg_446_0 = this.spriteBatch;
             SpriteFont arg_446_1 = Main.fontMouseText;
             string arg_446_2 = text2;
             Microsoft.Xna.Framework.Vector2 arg_446_3 = new Microsoft.Xna.Framework.Vector2((float)num7, (float)num8);
             Microsoft.Xna.Framework.Color arg_446_4 = Microsoft.Xna.Framework.Color.White;
             float arg_446_5 = 0f;
             origin = default(Microsoft.Xna.Framework.Vector2);
             arg_446_0.DrawString(arg_446_1, arg_446_2, arg_446_3, arg_446_4, arg_446_5, origin, 0.8f, SpriteEffects.None, 0f);
             num7 += 30;
             text2 = "tx:" + string.Format("{0:0,0}", Main.txMsgType[l]);
             SpriteBatch arg_4B0_0 = this.spriteBatch;
             SpriteFont arg_4B0_1 = Main.fontMouseText;
             string arg_4B0_2 = text2;
             Microsoft.Xna.Framework.Vector2 arg_4B0_3 = new Microsoft.Xna.Framework.Vector2((float)num7, (float)num8);
             Microsoft.Xna.Framework.Color arg_4B0_4 = Microsoft.Xna.Framework.Color.White;
             float arg_4B0_5 = 0f;
             origin = default(Microsoft.Xna.Framework.Vector2);
             arg_4B0_0.DrawString(arg_4B0_1, arg_4B0_2, arg_4B0_3, arg_4B0_4, arg_4B0_5, origin, 0.8f, SpriteEffects.None, 0f);
             num7 += 70;
             text2 = string.Format("{0:0,0}", Main.txDataType[l]);
             SpriteBatch arg_510_0 = this.spriteBatch;
             SpriteFont arg_510_1 = Main.fontMouseText;
             string arg_510_2 = text2;
             Microsoft.Xna.Framework.Vector2 arg_510_3 = new Microsoft.Xna.Framework.Vector2((float)num7, (float)num8);
             Microsoft.Xna.Framework.Color arg_510_4 = Microsoft.Xna.Framework.Color.White;
             float arg_510_5 = 0f;
             origin = default(Microsoft.Xna.Framework.Vector2);
             arg_510_0.DrawString(arg_510_1, arg_510_2, arg_510_3, arg_510_4, arg_510_5, origin, 0.8f, SpriteEffects.None, 0f);
         }
     }
     if (Main.drawDiag)
     {
         for (int m = 0; m < 7; m++)
         {
             string text3 = "";
             int num9 = 20;
             int num10 = 220;
             num10 += m * 16;
             if (m == 0)
             {
                 text3 = "Solid Tiles:";
             }
             if (m == 1)
             {
                 text3 = "Misc. Tiles:";
             }
             if (m == 2)
             {
                 text3 = "Walls Tiles:";
             }
             if (m == 3)
             {
                 text3 = "Background Tiles:";
             }
             if (m == 4)
             {
                 text3 = "Water Tiles:";
             }
             if (m == 5)
             {
                 text3 = "Black Tiles:";
             }
             if (m == 6)
             {
                 text3 = "Total Render:";
             }
             SpriteBatch arg_5E3_0 = this.spriteBatch;
             SpriteFont arg_5E3_1 = Main.fontMouseText;
             string arg_5E3_2 = text3;
             Microsoft.Xna.Framework.Vector2 arg_5E3_3 = new Microsoft.Xna.Framework.Vector2((float)num9, (float)num10);
             Microsoft.Xna.Framework.Color arg_5E3_4 = Microsoft.Xna.Framework.Color.White;
             float arg_5E3_5 = 0f;
             origin = default(Microsoft.Xna.Framework.Vector2);
             arg_5E3_0.DrawString(arg_5E3_1, arg_5E3_2, arg_5E3_3, arg_5E3_4, arg_5E3_5, origin, 1f, SpriteEffects.None, 0f);
         }
         for (int n = 0; n < 7; n++)
         {
             string text4 = "";
             int num11 = 180;
             int num12 = 220;
             num12 += n * 16;
             if (n == 0)
             {
                 text4 = Main.renderTimer[n] + "ms";
             }
             if (n == 1)
             {
                 text4 = Main.renderTimer[n] + "ms";
             }
             if (n == 2)
             {
                 text4 = Main.renderTimer[n] + "ms";
             }
             if (n == 3)
             {
                 text4 = Main.renderTimer[n] + "ms";
             }
             if (n == 4)
             {
                 text4 = Main.renderTimer[n] + "ms";
             }
             if (n == 5)
             {
                 text4 = Main.renderTimer[n] + "ms";
             }
             if (n == 6)
             {
                 text4 = Main.renderTimer[0] + Main.renderTimer[1] + Main.renderTimer[2] + Main.renderTimer[3] + Main.renderTimer[4] + Main.renderTimer[5] + "ms";
             }
             SpriteBatch arg_750_0 = this.spriteBatch;
             SpriteFont arg_750_1 = Main.fontMouseText;
             string arg_750_2 = text4;
             Microsoft.Xna.Framework.Vector2 arg_750_3 = new Microsoft.Xna.Framework.Vector2((float)num11, (float)num12);
             Microsoft.Xna.Framework.Color arg_750_4 = Microsoft.Xna.Framework.Color.White;
             float arg_750_5 = 0f;
             origin = default(Microsoft.Xna.Framework.Vector2);
             arg_750_0.DrawString(arg_750_1, arg_750_2, arg_750_3, arg_750_4, arg_750_5, origin, 1f, SpriteEffects.None, 0f);
         }
         for (int num13 = 0; num13 < 6; num13++)
         {
             string text5 = "";
             int num14 = 20;
             int num15 = 346;
             num15 += num13 * 16;
             if (num13 == 0)
             {
                 text5 = "Lighting Init:";
             }
             if (num13 == 1)
             {
                 text5 = "Lighting Phase #1:";
             }
             if (num13 == 2)
             {
                 text5 = "Lighting Phase #2:";
             }
             if (num13 == 3)
             {
                 text5 = "Lighting Phase #3";
             }
             if (num13 == 4)
             {
                 text5 = "Lighting Phase #4";
             }
             if (num13 == 5)
             {
                 text5 = "Total Lighting:";
             }
             SpriteBatch arg_809_0 = this.spriteBatch;
             SpriteFont arg_809_1 = Main.fontMouseText;
             string arg_809_2 = text5;
             Microsoft.Xna.Framework.Vector2 arg_809_3 = new Microsoft.Xna.Framework.Vector2((float)num14, (float)num15);
             Microsoft.Xna.Framework.Color arg_809_4 = Microsoft.Xna.Framework.Color.White;
             float arg_809_5 = 0f;
             origin = default(Microsoft.Xna.Framework.Vector2);
             arg_809_0.DrawString(arg_809_1, arg_809_2, arg_809_3, arg_809_4, arg_809_5, origin, 1f, SpriteEffects.None, 0f);
         }
         for (int num16 = 0; num16 < 6; num16++)
         {
             string text6 = "";
             int num17 = 180;
             int num18 = 346;
             num18 += num16 * 16;
             if (num16 == 0)
             {
                 text6 = Main.lightTimer[num16] + "ms";
             }
             if (num16 == 1)
             {
                 text6 = Main.lightTimer[num16] + "ms";
             }
             if (num16 == 2)
             {
                 text6 = Main.lightTimer[num16] + "ms";
             }
             if (num16 == 3)
             {
                 text6 = Main.lightTimer[num16] + "ms";
             }
             if (num16 == 4)
             {
                 text6 = Main.lightTimer[num16] + "ms";
             }
             if (num16 == 5)
             {
                 text6 = Main.lightTimer[0] + Main.lightTimer[1] + Main.lightTimer[2] + Main.lightTimer[3] + Main.lightTimer[4] + "ms";
             }
             SpriteBatch arg_950_0 = this.spriteBatch;
             SpriteFont arg_950_1 = Main.fontMouseText;
             string arg_950_2 = text6;
             Microsoft.Xna.Framework.Vector2 arg_950_3 = new Microsoft.Xna.Framework.Vector2((float)num17, (float)num18);
             Microsoft.Xna.Framework.Color arg_950_4 = Microsoft.Xna.Framework.Color.White;
             float arg_950_5 = 0f;
             origin = default(Microsoft.Xna.Framework.Vector2);
             arg_950_0.DrawString(arg_950_1, arg_950_2, arg_950_3, arg_950_4, arg_950_5, origin, 1f, SpriteEffects.None, 0f);
         }
         int num19 = 5;
         for (int num20 = 0; num20 < num19; num20++)
         {
             int num21 = 20;
             int num22 = 456;
             num22 += num20 * 16;
             string text7 = "Render #" + num20 + ":";
             SpriteBatch arg_9DA_0 = this.spriteBatch;
             SpriteFont arg_9DA_1 = Main.fontMouseText;
             string arg_9DA_2 = text7;
             Microsoft.Xna.Framework.Vector2 arg_9DA_3 = new Microsoft.Xna.Framework.Vector2((float)num21, (float)num22);
             Microsoft.Xna.Framework.Color arg_9DA_4 = Microsoft.Xna.Framework.Color.White;
             float arg_9DA_5 = 0f;
             origin = default(Microsoft.Xna.Framework.Vector2);
             arg_9DA_0.DrawString(arg_9DA_1, arg_9DA_2, arg_9DA_3, arg_9DA_4, arg_9DA_5, origin, 1f, SpriteEffects.None, 0f);
         }
         for (int num23 = 0; num23 < num19; num23++)
         {
             int num24 = 180;
             int num25 = 456;
             num25 += num23 * 16;
             string text8 = Main.drawTimer[num23] + "ms";
             SpriteBatch arg_A63_0 = this.spriteBatch;
             SpriteFont arg_A63_1 = Main.fontMouseText;
             string arg_A63_2 = text8;
             Microsoft.Xna.Framework.Vector2 arg_A63_3 = new Microsoft.Xna.Framework.Vector2((float)num24, (float)num25);
             Microsoft.Xna.Framework.Color arg_A63_4 = Microsoft.Xna.Framework.Color.White;
             float arg_A63_5 = 0f;
             origin = default(Microsoft.Xna.Framework.Vector2);
             arg_A63_0.DrawString(arg_A63_1, arg_A63_2, arg_A63_3, arg_A63_4, arg_A63_5, origin, 1f, SpriteEffects.None, 0f);
         }
         for (int num26 = 0; num26 < num19; num26++)
         {
             int num27 = 230;
             int num28 = 456;
             num28 += num26 * 16;
             string text9 = Main.drawTimerMax[num26] + "ms";
             SpriteBatch arg_AEF_0 = this.spriteBatch;
             SpriteFont arg_AEF_1 = Main.fontMouseText;
             string arg_AEF_2 = text9;
             Microsoft.Xna.Framework.Vector2 arg_AEF_3 = new Microsoft.Xna.Framework.Vector2((float)num27, (float)num28);
             Microsoft.Xna.Framework.Color arg_AEF_4 = Microsoft.Xna.Framework.Color.White;
             float arg_AEF_5 = 0f;
             origin = default(Microsoft.Xna.Framework.Vector2);
             arg_AEF_0.DrawString(arg_AEF_1, arg_AEF_2, arg_AEF_3, arg_AEF_4, arg_AEF_5, origin, 1f, SpriteEffects.None, 0f);
         }
         int num29 = 20;
         int num30 = 456 + 16 * num19 + 16;
         string text10 = "Update:";
         SpriteBatch arg_B60_0 = this.spriteBatch;
         SpriteFont arg_B60_1 = Main.fontMouseText;
         string arg_B60_2 = text10;
         Microsoft.Xna.Framework.Vector2 arg_B60_3 = new Microsoft.Xna.Framework.Vector2((float)num29, (float)num30);
         Microsoft.Xna.Framework.Color arg_B60_4 = Microsoft.Xna.Framework.Color.White;
         float arg_B60_5 = 0f;
         origin = default(Microsoft.Xna.Framework.Vector2);
         arg_B60_0.DrawString(arg_B60_1, arg_B60_2, arg_B60_3, arg_B60_4, arg_B60_5, origin, 1f, SpriteEffects.None, 0f);
         num29 = 180;
         text10 = Main.upTimer + "ms";
         SpriteBatch arg_BC4_0 = this.spriteBatch;
         SpriteFont arg_BC4_1 = Main.fontMouseText;
         string arg_BC4_2 = text10;
         Microsoft.Xna.Framework.Vector2 arg_BC4_3 = new Microsoft.Xna.Framework.Vector2((float)num29, (float)num30);
         Microsoft.Xna.Framework.Color arg_BC4_4 = Microsoft.Xna.Framework.Color.White;
         float arg_BC4_5 = 0f;
         origin = default(Microsoft.Xna.Framework.Vector2);
         arg_BC4_0.DrawString(arg_BC4_1, arg_BC4_2, arg_BC4_3, arg_BC4_4, arg_BC4_5, origin, 1f, SpriteEffects.None, 0f);
         num29 = 230;
         text10 = Main.upTimerMax + "ms";
         SpriteBatch arg_C28_0 = this.spriteBatch;
         SpriteFont arg_C28_1 = Main.fontMouseText;
         string arg_C28_2 = text10;
         Microsoft.Xna.Framework.Vector2 arg_C28_3 = new Microsoft.Xna.Framework.Vector2((float)num29, (float)num30);
         Microsoft.Xna.Framework.Color arg_C28_4 = Microsoft.Xna.Framework.Color.White;
         float arg_C28_5 = 0f;
         origin = default(Microsoft.Xna.Framework.Vector2);
         arg_C28_0.DrawString(arg_C28_1, arg_C28_2, arg_C28_3, arg_C28_4, arg_C28_5, origin, 1f, SpriteEffects.None, 0f);
     }
     if (Main.signBubble)
     {
         int num31 = (int)((float)Main.signX - Main.screenPosition.X);
         int num32 = (int)((float)Main.signY - Main.screenPosition.Y);
         SpriteEffects effects = SpriteEffects.None;
         if ((float)Main.signX > Main.player[Main.myPlayer].position.X + (float)Main.player[Main.myPlayer].width)
         {
             effects = SpriteEffects.FlipHorizontally;
             num31 += -8 - Main.chat2Texture.Width;
         }
         else
         {
             num31 += 8;
         }
         num32 -= 22;
         SpriteBatch arg_D23_0 = this.spriteBatch;
         Texture2D arg_D23_1 = Main.chat2Texture;
         Microsoft.Xna.Framework.Vector2 arg_D23_2 = new Microsoft.Xna.Framework.Vector2((float)num31, (float)num32);
         Microsoft.Xna.Framework.Rectangle? arg_D23_3 = new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.chat2Texture.Width, Main.chat2Texture.Height));
         Microsoft.Xna.Framework.Color arg_D23_4 = new Microsoft.Xna.Framework.Color((int)Main.mouseTextColor, (int)Main.mouseTextColor, (int)Main.mouseTextColor, (int)Main.mouseTextColor);
         float arg_D23_5 = 0f;
         origin = default(Microsoft.Xna.Framework.Vector2);
         arg_D23_0.Draw(arg_D23_1, arg_D23_2, arg_D23_3, arg_D23_4, arg_D23_5, origin, 1f, effects, 0f);
         Main.signBubble = false;
     }
     for (int num33 = 0; num33 < 255; num33++)
     {
         if (Main.player[num33].active && Main.myPlayer != num33 && !Main.player[num33].dead)
         {
             new Microsoft.Xna.Framework.Rectangle((int)((double)Main.player[num33].position.X + (double)Main.player[num33].width * 0.5 - 16.0), (int)(Main.player[num33].position.Y + (float)Main.player[num33].height - 48f), 32, 48);
             if (Main.player[Main.myPlayer].team > 0 && Main.player[Main.myPlayer].team == Main.player[num33].team)
             {
                 new Microsoft.Xna.Framework.Rectangle((int)Main.screenPosition.X, (int)Main.screenPosition.Y, Main.screenWidth, Main.screenHeight);
                 string text11 = Main.player[num33].name;
                 if (Main.player[num33].statLife < Main.player[num33].statLifeMax)
                 {
                     object obj = text11;
                     text11 = string.Concat(new object[]
                     {
                         obj,
                         ": ",
                         Main.player[num33].statLife,
                         "/",
                         Main.player[num33].statLifeMax
                     });
                 }
                 Microsoft.Xna.Framework.Vector2 vector = Main.fontMouseText.MeasureString(text11);
                 float num34 = 0f;
                 if (Main.player[num33].chatShowTime > 0)
                 {
                     num34 = -vector.Y;
                 }
                 float num35 = 0f;
                 float num36 = (float)Main.mouseTextColor / 255f;
                 Microsoft.Xna.Framework.Color color = new Microsoft.Xna.Framework.Color((int)((byte)((float)Main.teamColor[Main.player[num33].team].R * num36)), (int)((byte)((float)Main.teamColor[Main.player[num33].team].G * num36)), (int)((byte)((float)Main.teamColor[Main.player[num33].team].B * num36)), (int)Main.mouseTextColor);
                 Microsoft.Xna.Framework.Vector2 vector2 = new Microsoft.Xna.Framework.Vector2((float)(Main.screenWidth / 2) + Main.screenPosition.X, (float)(Main.screenHeight / 2) + Main.screenPosition.Y);
                 float num37 = Main.player[num33].position.X + (float)(Main.player[num33].width / 2) - vector2.X;
                 float num38 = Main.player[num33].position.Y - vector.Y - 2f + num34 - vector2.Y;
                 float num39 = (float)Math.Sqrt((double)(num37 * num37 + num38 * num38));
                 int num40 = Main.screenHeight;
                 if (Main.screenHeight > Main.screenWidth)
                 {
                     num40 = Main.screenWidth;
                 }
                 num40 = num40 / 2 - 30;
                 if (num40 < 100)
                 {
                     num40 = 100;
                 }
                 if (num39 < (float)num40)
                 {
                     vector.X = Main.player[num33].position.X + (float)(Main.player[num33].width / 2) - vector.X / 2f - Main.screenPosition.X;
                     vector.Y = Main.player[num33].position.Y - vector.Y - 2f + num34 - Main.screenPosition.Y;
                 }
                 else
                 {
                     num35 = num39;
                     num39 = (float)num40 / num39;
                     vector.X = (float)(Main.screenWidth / 2) + num37 * num39 - vector.X / 2f;
                     vector.Y = (float)(Main.screenHeight / 2) + num38 * num39;
                 }
                 if (num35 > 0f)
                 {
                     string text12 = "(" + (int)(num35 / 16f * 2f) + " ft)";
                     Microsoft.Xna.Framework.Vector2 vector3 = Main.fontMouseText.MeasureString(text12);
                     vector3.X = vector.X + Main.fontMouseText.MeasureString(text11).X / 2f - vector3.X / 2f;
                     vector3.Y = vector.Y + Main.fontMouseText.MeasureString(text11).Y / 2f - vector3.Y / 2f - 20f;
                     SpriteBatch arg_11F9_0 = this.spriteBatch;
                     SpriteFont arg_11F9_1 = Main.fontMouseText;
                     string arg_11F9_2 = text12;
                     Microsoft.Xna.Framework.Vector2 arg_11F9_3 = new Microsoft.Xna.Framework.Vector2(vector3.X - 2f, vector3.Y);
                     Microsoft.Xna.Framework.Color arg_11F9_4 = Microsoft.Xna.Framework.Color.Black;
                     float arg_11F9_5 = 0f;
                     origin = default(Microsoft.Xna.Framework.Vector2);
                     arg_11F9_0.DrawString(arg_11F9_1, arg_11F9_2, arg_11F9_3, arg_11F9_4, arg_11F9_5, origin, 1f, SpriteEffects.None, 0f);
                     SpriteBatch arg_1247_0 = this.spriteBatch;
                     SpriteFont arg_1247_1 = Main.fontMouseText;
                     string arg_1247_2 = text12;
                     Microsoft.Xna.Framework.Vector2 arg_1247_3 = new Microsoft.Xna.Framework.Vector2(vector3.X + 2f, vector3.Y);
                     Microsoft.Xna.Framework.Color arg_1247_4 = Microsoft.Xna.Framework.Color.Black;
                     float arg_1247_5 = 0f;
                     origin = default(Microsoft.Xna.Framework.Vector2);
                     arg_1247_0.DrawString(arg_1247_1, arg_1247_2, arg_1247_3, arg_1247_4, arg_1247_5, origin, 1f, SpriteEffects.None, 0f);
                     SpriteBatch arg_1295_0 = this.spriteBatch;
                     SpriteFont arg_1295_1 = Main.fontMouseText;
                     string arg_1295_2 = text12;
                     Microsoft.Xna.Framework.Vector2 arg_1295_3 = new Microsoft.Xna.Framework.Vector2(vector3.X, vector3.Y - 2f);
                     Microsoft.Xna.Framework.Color arg_1295_4 = Microsoft.Xna.Framework.Color.Black;
                     float arg_1295_5 = 0f;
                     origin = default(Microsoft.Xna.Framework.Vector2);
                     arg_1295_0.DrawString(arg_1295_1, arg_1295_2, arg_1295_3, arg_1295_4, arg_1295_5, origin, 1f, SpriteEffects.None, 0f);
                     SpriteBatch arg_12E3_0 = this.spriteBatch;
                     SpriteFont arg_12E3_1 = Main.fontMouseText;
                     string arg_12E3_2 = text12;
                     Microsoft.Xna.Framework.Vector2 arg_12E3_3 = new Microsoft.Xna.Framework.Vector2(vector3.X, vector3.Y + 2f);
                     Microsoft.Xna.Framework.Color arg_12E3_4 = Microsoft.Xna.Framework.Color.Black;
                     float arg_12E3_5 = 0f;
                     origin = default(Microsoft.Xna.Framework.Vector2);
                     arg_12E3_0.DrawString(arg_12E3_1, arg_12E3_2, arg_12E3_3, arg_12E3_4, arg_12E3_5, origin, 1f, SpriteEffects.None, 0f);
                     SpriteBatch arg_1317_0 = this.spriteBatch;
                     SpriteFont arg_1317_1 = Main.fontMouseText;
                     string arg_1317_2 = text12;
                     Microsoft.Xna.Framework.Vector2 arg_1317_3 = vector3;
                     Microsoft.Xna.Framework.Color arg_1317_4 = color;
                     float arg_1317_5 = 0f;
                     origin = default(Microsoft.Xna.Framework.Vector2);
                     arg_1317_0.DrawString(arg_1317_1, arg_1317_2, arg_1317_3, arg_1317_4, arg_1317_5, origin, 1f, SpriteEffects.None, 0f);
                 }
                 SpriteBatch arg_1365_0 = this.spriteBatch;
                 SpriteFont arg_1365_1 = Main.fontMouseText;
                 string arg_1365_2 = text11;
                 Microsoft.Xna.Framework.Vector2 arg_1365_3 = new Microsoft.Xna.Framework.Vector2(vector.X - 2f, vector.Y);
                 Microsoft.Xna.Framework.Color arg_1365_4 = Microsoft.Xna.Framework.Color.Black;
                 float arg_1365_5 = 0f;
                 origin = default(Microsoft.Xna.Framework.Vector2);
                 arg_1365_0.DrawString(arg_1365_1, arg_1365_2, arg_1365_3, arg_1365_4, arg_1365_5, origin, 1f, SpriteEffects.None, 0f);
                 SpriteBatch arg_13B3_0 = this.spriteBatch;
                 SpriteFont arg_13B3_1 = Main.fontMouseText;
                 string arg_13B3_2 = text11;
                 Microsoft.Xna.Framework.Vector2 arg_13B3_3 = new Microsoft.Xna.Framework.Vector2(vector.X + 2f, vector.Y);
                 Microsoft.Xna.Framework.Color arg_13B3_4 = Microsoft.Xna.Framework.Color.Black;
                 float arg_13B3_5 = 0f;
                 origin = default(Microsoft.Xna.Framework.Vector2);
                 arg_13B3_0.DrawString(arg_13B3_1, arg_13B3_2, arg_13B3_3, arg_13B3_4, arg_13B3_5, origin, 1f, SpriteEffects.None, 0f);
                 SpriteBatch arg_1401_0 = this.spriteBatch;
                 SpriteFont arg_1401_1 = Main.fontMouseText;
                 string arg_1401_2 = text11;
                 Microsoft.Xna.Framework.Vector2 arg_1401_3 = new Microsoft.Xna.Framework.Vector2(vector.X, vector.Y - 2f);
                 Microsoft.Xna.Framework.Color arg_1401_4 = Microsoft.Xna.Framework.Color.Black;
                 float arg_1401_5 = 0f;
                 origin = default(Microsoft.Xna.Framework.Vector2);
                 arg_1401_0.DrawString(arg_1401_1, arg_1401_2, arg_1401_3, arg_1401_4, arg_1401_5, origin, 1f, SpriteEffects.None, 0f);
                 SpriteBatch arg_144F_0 = this.spriteBatch;
                 SpriteFont arg_144F_1 = Main.fontMouseText;
                 string arg_144F_2 = text11;
                 Microsoft.Xna.Framework.Vector2 arg_144F_3 = new Microsoft.Xna.Framework.Vector2(vector.X, vector.Y + 2f);
                 Microsoft.Xna.Framework.Color arg_144F_4 = Microsoft.Xna.Framework.Color.Black;
                 float arg_144F_5 = 0f;
                 origin = default(Microsoft.Xna.Framework.Vector2);
                 arg_144F_0.DrawString(arg_144F_1, arg_144F_2, arg_144F_3, arg_144F_4, arg_144F_5, origin, 1f, SpriteEffects.None, 0f);
                 SpriteBatch arg_1483_0 = this.spriteBatch;
                 SpriteFont arg_1483_1 = Main.fontMouseText;
                 string arg_1483_2 = text11;
                 Microsoft.Xna.Framework.Vector2 arg_1483_3 = vector;
                 Microsoft.Xna.Framework.Color arg_1483_4 = color;
                 float arg_1483_5 = 0f;
                 origin = default(Microsoft.Xna.Framework.Vector2);
                 arg_1483_0.DrawString(arg_1483_1, arg_1483_2, arg_1483_3, arg_1483_4, arg_1483_5, origin, 1f, SpriteEffects.None, 0f);
             }
         }
     }
     if (Main.playerInventory)
     {
         Main.npcChatText = "";
         Main.player[Main.myPlayer].sign = -1;
     }
     if (Main.ignoreErrors)
     {
         try
         {
             if (Main.npcChatText != "" || Main.player[Main.myPlayer].sign != -1)
             {
                 this.DrawChat();
             }
             goto IL_151C;
         }
         catch
         {
             goto IL_151C;
         }
     }
     if (Main.npcChatText != "" || Main.player[Main.myPlayer].sign != -1)
     {
         this.DrawChat();
     }
     IL_151C:
     Microsoft.Xna.Framework.Color color2 = new Microsoft.Xna.Framework.Color(220, 220, 220, 220);
     Main.invAlpha += Main.invDir * 0.2f;
     if (Main.invAlpha > 240f)
     {
         Main.invAlpha = 240f;
         Main.invDir = -1f;
     }
     if (Main.invAlpha < 180f)
     {
         Main.invAlpha = 180f;
         Main.invDir = 1f;
     }
     color2 = new Microsoft.Xna.Framework.Color((int)((byte)Main.invAlpha), (int)((byte)Main.invAlpha), (int)((byte)Main.invAlpha), (int)((byte)Main.invAlpha));
     bool flag = false;
     int rare = 0;
     int num41 = Main.screenWidth - 800;
     int num42 = Main.player[Main.myPlayer].statLifeMax / 20;
     if (num42 >= 10)
     {
         num42 = 10;
     }
     string text13 = string.Concat(new object[]
     {
         "Life: ",
         Main.player[Main.myPlayer].statLifeMax,
         "/",
         Main.player[Main.myPlayer].statLifeMax
     });
     Microsoft.Xna.Framework.Vector2 vector4 = Main.fontMouseText.MeasureString(text13);
     if (!Main.player[Main.myPlayer].ghost)
     {
         SpriteBatch arg_16D1_0 = this.spriteBatch;
         SpriteFont arg_16D1_1 = Main.fontMouseText;
         string arg_16D1_2 = "Life: ";
         Microsoft.Xna.Framework.Vector2 arg_16D1_3 = new Microsoft.Xna.Framework.Vector2((float)(500 + 13 * num42) - vector4.X * 0.5f + (float)num41, 6f);
         Microsoft.Xna.Framework.Color arg_16D1_4 = new Microsoft.Xna.Framework.Color((int)Main.mouseTextColor, (int)Main.mouseTextColor, (int)Main.mouseTextColor, (int)Main.mouseTextColor);
         float arg_16D1_5 = 0f;
         origin = default(Microsoft.Xna.Framework.Vector2);
         arg_16D1_0.DrawString(arg_16D1_1, arg_16D1_2, arg_16D1_3, arg_16D1_4, arg_16D1_5, origin, 1f, SpriteEffects.None, 0f);
         this.spriteBatch.DrawString(Main.fontMouseText, Main.player[Main.myPlayer].statLife + "/" + Main.player[Main.myPlayer].statLifeMax, new Microsoft.Xna.Framework.Vector2((float)(500 + 13 * num42) + vector4.X * 0.5f + (float)num41, 6f), new Microsoft.Xna.Framework.Color((int)Main.mouseTextColor, (int)Main.mouseTextColor, (int)Main.mouseTextColor, (int)Main.mouseTextColor), 0f, new Microsoft.Xna.Framework.Vector2(Main.fontMouseText.MeasureString(Main.player[Main.myPlayer].statLife + "/" + Main.player[Main.myPlayer].statLifeMax).X, 0f), 1f, SpriteEffects.None, 0f);
     }
     int num43 = 20;
     for (int num44 = 1; num44 < Main.player[Main.myPlayer].statLifeMax / num43 + 1; num44++)
     {
         int num45 = 255;
         float num46 = 1f;
         bool flag2 = false;
         if (Main.player[Main.myPlayer].statLife >= num44 * num43)
         {
             num45 = 255;
             if (Main.player[Main.myPlayer].statLife == num44 * num43)
             {
                 flag2 = true;
             }
         }
         else
         {
             float num47 = (float)(Main.player[Main.myPlayer].statLife - (num44 - 1) * num43) / (float)num43;
             num45 = (int)(30f + 225f * num47);
             if (num45 < 30)
             {
                 num45 = 30;
             }
             num46 = num47 / 4f + 0.75f;
             if ((double)num46 < 0.75)
             {
                 num46 = 0.75f;
             }
             if (num47 > 0f)
             {
                 flag2 = true;
             }
         }
         if (flag2)
         {
             num46 += Main.cursorScale - 1f;
         }
         int num48 = 0;
         int num49 = 0;
         if (num44 > 10)
         {
             num48 -= 260;
             num49 += 26;
         }
         int a = (int)((double)((float)num45) * 0.9);
         if (!Main.player[Main.myPlayer].ghost)
         {
             this.spriteBatch.Draw(Main.heartTexture, new Microsoft.Xna.Framework.Vector2((float)(500 + 26 * (num44 - 1) + num48 + num41 + Main.heartTexture.Width / 2), 32f + ((float)Main.heartTexture.Height - (float)Main.heartTexture.Height * num46) / 2f + (float)num49 + (float)(Main.heartTexture.Height / 2)), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.heartTexture.Width, Main.heartTexture.Height)), new Microsoft.Xna.Framework.Color(num45, num45, num45, a), 0f, new Microsoft.Xna.Framework.Vector2((float)(Main.heartTexture.Width / 2), (float)(Main.heartTexture.Height / 2)), num46, SpriteEffects.None, 0f);
         }
     }
     int num50 = 20;
     if (Main.player[Main.myPlayer].statManaMax2 > 0)
     {
         int arg_19E7_0 = Main.player[Main.myPlayer].statManaMax2 / 20;
         SpriteBatch arg_1A42_0 = this.spriteBatch;
         SpriteFont arg_1A42_1 = Main.fontMouseText;
         string arg_1A42_2 = "Mana";
         Microsoft.Xna.Framework.Vector2 arg_1A42_3 = new Microsoft.Xna.Framework.Vector2((float)(750 + num41), 6f);
         Microsoft.Xna.Framework.Color arg_1A42_4 = new Microsoft.Xna.Framework.Color((int)Main.mouseTextColor, (int)Main.mouseTextColor, (int)Main.mouseTextColor, (int)Main.mouseTextColor);
         float arg_1A42_5 = 0f;
         origin = default(Microsoft.Xna.Framework.Vector2);
         arg_1A42_0.DrawString(arg_1A42_1, arg_1A42_2, arg_1A42_3, arg_1A42_4, arg_1A42_5, origin, 1f, SpriteEffects.None, 0f);
         for (int num51 = 1; num51 < Main.player[Main.myPlayer].statManaMax2 / num50 + 1; num51++)
         {
             int num52 = 255;
             bool flag3 = false;
             float num53 = 1f;
             if (Main.player[Main.myPlayer].statMana >= num51 * num50)
             {
                 num52 = 255;
                 if (Main.player[Main.myPlayer].statMana == num51 * num50)
                 {
                     flag3 = true;
                 }
             }
             else
             {
                 float num54 = (float)(Main.player[Main.myPlayer].statMana - (num51 - 1) * num50) / (float)num50;
                 num52 = (int)(30f + 225f * num54);
                 if (num52 < 30)
                 {
                     num52 = 30;
                 }
                 num53 = num54 / 4f + 0.75f;
                 if ((double)num53 < 0.75)
                 {
                     num53 = 0.75f;
                 }
                 if (num54 > 0f)
                 {
                     flag3 = true;
                 }
             }
             if (flag3)
             {
                 num53 += Main.cursorScale - 1f;
             }
             int a2 = (int)((double)((float)num52) * 0.9);
             this.spriteBatch.Draw(Main.manaTexture, new Microsoft.Xna.Framework.Vector2((float)(775 + num41), (float)(30 + Main.manaTexture.Height / 2) + ((float)Main.manaTexture.Height - (float)Main.manaTexture.Height * num53) / 2f + (float)(28 * (num51 - 1))), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.manaTexture.Width, Main.manaTexture.Height)), new Microsoft.Xna.Framework.Color(num52, num52, num52, a2), 0f, new Microsoft.Xna.Framework.Vector2((float)(Main.manaTexture.Width / 2), (float)(Main.manaTexture.Height / 2)), num53, SpriteEffects.None, 0f);
         }
     }
     if (Main.player[Main.myPlayer].breath < Main.player[Main.myPlayer].breathMax && !Main.player[Main.myPlayer].ghost)
     {
         int num55 = 76;
         int arg_1C4E_0 = Main.player[Main.myPlayer].breathMax / 20;
         SpriteBatch arg_1CCB_0 = this.spriteBatch;
         SpriteFont arg_1CCB_1 = Main.fontMouseText;
         string arg_1CCB_2 = "Breath";
         Microsoft.Xna.Framework.Vector2 arg_1CCB_3 = new Microsoft.Xna.Framework.Vector2((float)(500 + 13 * num42) - Main.fontMouseText.MeasureString("Breath").X * 0.5f + (float)num41, (float)(6 + num55));
         Microsoft.Xna.Framework.Color arg_1CCB_4 = new Microsoft.Xna.Framework.Color((int)Main.mouseTextColor, (int)Main.mouseTextColor, (int)Main.mouseTextColor, (int)Main.mouseTextColor);
         float arg_1CCB_5 = 0f;
         origin = default(Microsoft.Xna.Framework.Vector2);
         arg_1CCB_0.DrawString(arg_1CCB_1, arg_1CCB_2, arg_1CCB_3, arg_1CCB_4, arg_1CCB_5, origin, 1f, SpriteEffects.None, 0f);
         int num56 = 20;
         for (int num57 = 1; num57 < Main.player[Main.myPlayer].breathMax / num56 + 1; num57++)
         {
             int num58 = 255;
             float num59 = 1f;
             if (Main.player[Main.myPlayer].breath >= num57 * num56)
             {
                 num58 = 255;
             }
             else
             {
                 float num60 = (float)(Main.player[Main.myPlayer].breath - (num57 - 1) * num56) / (float)num56;
                 num58 = (int)(30f + 225f * num60);
                 if (num58 < 30)
                 {
                     num58 = 30;
                 }
                 num59 = num60 / 4f + 0.75f;
                 if ((double)num59 < 0.75)
                 {
                     num59 = 0.75f;
                 }
             }
             int num61 = 0;
             int num62 = 0;
             if (num57 > 10)
             {
                 num61 -= 260;
                 num62 += 26;
             }
             SpriteBatch arg_1E20_0 = this.spriteBatch;
             Texture2D arg_1E20_1 = Main.bubbleTexture;
             Microsoft.Xna.Framework.Vector2 arg_1E20_2 = new Microsoft.Xna.Framework.Vector2((float)(500 + 26 * (num57 - 1) + num61 + num41), 32f + ((float)Main.bubbleTexture.Height - (float)Main.bubbleTexture.Height * num59) / 2f + (float)num62 + (float)num55);
             Microsoft.Xna.Framework.Rectangle? arg_1E20_3 = new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.bubbleTexture.Width, Main.bubbleTexture.Height));
             Microsoft.Xna.Framework.Color arg_1E20_4 = new Microsoft.Xna.Framework.Color(num58, num58, num58, num58);
             float arg_1E20_5 = 0f;
             origin = default(Microsoft.Xna.Framework.Vector2);
             arg_1E20_0.Draw(arg_1E20_1, arg_1E20_2, arg_1E20_3, arg_1E20_4, arg_1E20_5, origin, num59, SpriteEffects.None, 0f);
         }
     }
     Main.buffString = "";
     if (!Main.playerInventory)
     {
         int num63 = -1;
         for (int num64 = 0; num64 < 10; num64++)
         {
             if (Main.player[Main.myPlayer].buffType[num64] > 0)
             {
                 int num65 = Main.player[Main.myPlayer].buffType[num64];
                 int num66 = 32 + num64 * 38;
                 int num67 = 76;
                 Microsoft.Xna.Framework.Color color3 = new Microsoft.Xna.Framework.Color(Main.buffAlpha[num64], Main.buffAlpha[num64], Main.buffAlpha[num64], Main.buffAlpha[num64]);
                 SpriteBatch arg_1F28_0 = this.spriteBatch;
                 Texture2D arg_1F28_1 = Main.buffTexture[num65];
                 Microsoft.Xna.Framework.Vector2 arg_1F28_2 = new Microsoft.Xna.Framework.Vector2((float)num66, (float)num67);
                 Microsoft.Xna.Framework.Rectangle? arg_1F28_3 = new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.buffTexture[num65].Width, Main.buffTexture[num65].Height));
                 Microsoft.Xna.Framework.Color arg_1F28_4 = color3;
                 float arg_1F28_5 = 0f;
                 origin = default(Microsoft.Xna.Framework.Vector2);
                 arg_1F28_0.Draw(arg_1F28_1, arg_1F28_2, arg_1F28_3, arg_1F28_4, arg_1F28_5, origin, 1f, SpriteEffects.None, 0f);
                 if (num65 != 28 && num65 != 34 && num65 != 37 && num65 != 38)
                 {
                     string text14 = "0 s";
                     if (Main.player[Main.myPlayer].buffTime[num64] / 60 >= 60)
                     {
                         text14 = Math.Round((double)(Main.player[Main.myPlayer].buffTime[num64] / 60) / 60.0) + " m";
                     }
                     else
                     {
                         text14 = Math.Round((double)Main.player[Main.myPlayer].buffTime[num64] / 60.0) + " s";
                     }
                     SpriteBatch arg_2025_0 = this.spriteBatch;
                     SpriteFont arg_2025_1 = Main.fontItemStack;
                     string arg_2025_2 = text14;
                     Microsoft.Xna.Framework.Vector2 arg_2025_3 = new Microsoft.Xna.Framework.Vector2((float)num66, (float)(num67 + Main.buffTexture[num65].Height));
                     Microsoft.Xna.Framework.Color arg_2025_4 = color3;
                     float arg_2025_5 = 0f;
                     origin = default(Microsoft.Xna.Framework.Vector2);
                     arg_2025_0.DrawString(arg_2025_1, arg_2025_2, arg_2025_3, arg_2025_4, arg_2025_5, origin, 0.8f, SpriteEffects.None, 0f);
                 }
                 if (Main.mouseX < num66 + Main.buffTexture[num65].Width && Main.mouseY < num67 + Main.buffTexture[num65].Height && Main.mouseX > num66 && Main.mouseY > num67)
                 {
                     num63 = num64;
                     Main.buffAlpha[num64] += 0.1f;
                     if (Main.mouseRight && Main.mouseRightRelease && !Main.debuff[num65])
                     {
                         Main.PlaySound(12, -1, -1, 1);
                         Main.player[Main.myPlayer].DelBuff(num64);
                     }
                 }
                 else
                 {
                     Main.buffAlpha[num64] -= 0.05f;
                 }
                 if (Main.buffAlpha[num64] > 1f)
                 {
                     Main.buffAlpha[num64] = 1f;
                 }
                 else
                 {
                     if ((double)Main.buffAlpha[num64] < 0.4)
                     {
                         Main.buffAlpha[num64] = 0.4f;
                     }
                 }
             }
             else
             {
                 Main.buffAlpha[num64] = 0.4f;
             }
         }
         if (num63 >= 0)
         {
             int num68 = Main.player[Main.myPlayer].buffType[num63];
             if (num68 > 0)
             {
                 Main.buffString = Main.buffTip[num68];
                 this.MouseText(Main.buffName[num68], 0, 0);
             }
         }
     }
     if (Main.player[Main.myPlayer].dead)
     {
         Main.playerInventory = false;
     }
     if (!Main.playerInventory)
     {
         Main.player[Main.myPlayer].chest = -1;
         Main.craftGuide = false;
         Main.reforge = false;
     }
     string text15 = "";
     if (Main.playerInventory)
     {
         if (Main.netMode == 1)
         {
             int num69 = 675 + Main.screenWidth - 800;
             int num70 = 114;
             if (Main.player[Main.myPlayer].hostile)
             {
                 SpriteBatch arg_2279_0 = this.spriteBatch;
                 Texture2D arg_2279_1 = Main.itemTexture[4];
                 Microsoft.Xna.Framework.Vector2 arg_2279_2 = new Microsoft.Xna.Framework.Vector2((float)(num69 - 2), (float)num70);
                 Microsoft.Xna.Framework.Rectangle? arg_2279_3 = new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.itemTexture[4].Width, Main.itemTexture[4].Height));
                 Microsoft.Xna.Framework.Color arg_2279_4 = Main.teamColor[Main.player[Main.myPlayer].team];
                 float arg_2279_5 = 0f;
                 origin = default(Microsoft.Xna.Framework.Vector2);
                 arg_2279_0.Draw(arg_2279_1, arg_2279_2, arg_2279_3, arg_2279_4, arg_2279_5, origin, 1f, SpriteEffects.None, 0f);
                 SpriteBatch arg_22F9_0 = this.spriteBatch;
                 Texture2D arg_22F9_1 = Main.itemTexture[4];
                 Microsoft.Xna.Framework.Vector2 arg_22F9_2 = new Microsoft.Xna.Framework.Vector2((float)(num69 + 2), (float)num70);
                 Microsoft.Xna.Framework.Rectangle? arg_22F9_3 = new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.itemTexture[4].Width, Main.itemTexture[4].Height));
                 Microsoft.Xna.Framework.Color arg_22F9_4 = Main.teamColor[Main.player[Main.myPlayer].team];
                 float arg_22F9_5 = 0f;
                 origin = default(Microsoft.Xna.Framework.Vector2);
                 arg_22F9_0.Draw(arg_22F9_1, arg_22F9_2, arg_22F9_3, arg_22F9_4, arg_22F9_5, origin, 1f, SpriteEffects.FlipHorizontally, 0f);
             }
             else
             {
                 SpriteBatch arg_2382_0 = this.spriteBatch;
                 Texture2D arg_2382_1 = Main.itemTexture[4];
                 Microsoft.Xna.Framework.Vector2 arg_2382_2 = new Microsoft.Xna.Framework.Vector2((float)(num69 - 16), (float)(num70 + 14));
                 Microsoft.Xna.Framework.Rectangle? arg_2382_3 = new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.itemTexture[4].Width, Main.itemTexture[4].Height));
                 Microsoft.Xna.Framework.Color arg_2382_4 = Main.teamColor[Main.player[Main.myPlayer].team];
                 float arg_2382_5 = -0.785f;
                 origin = default(Microsoft.Xna.Framework.Vector2);
                 arg_2382_0.Draw(arg_2382_1, arg_2382_2, arg_2382_3, arg_2382_4, arg_2382_5, origin, 1f, SpriteEffects.None, 0f);
                 SpriteBatch arg_2405_0 = this.spriteBatch;
                 Texture2D arg_2405_1 = Main.itemTexture[4];
                 Microsoft.Xna.Framework.Vector2 arg_2405_2 = new Microsoft.Xna.Framework.Vector2((float)(num69 + 2), (float)(num70 + 14));
                 Microsoft.Xna.Framework.Rectangle? arg_2405_3 = new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.itemTexture[4].Width, Main.itemTexture[4].Height));
                 Microsoft.Xna.Framework.Color arg_2405_4 = Main.teamColor[Main.player[Main.myPlayer].team];
                 float arg_2405_5 = -0.785f;
                 origin = default(Microsoft.Xna.Framework.Vector2);
                 arg_2405_0.Draw(arg_2405_1, arg_2405_2, arg_2405_3, arg_2405_4, arg_2405_5, origin, 1f, SpriteEffects.None, 0f);
             }
             if (Main.mouseX > num69 && Main.mouseX < num69 + 34 && Main.mouseY > num70 - 2 && Main.mouseY < num70 + 34)
             {
                 Main.player[Main.myPlayer].mouseInterface = true;
                 if (Main.mouseLeft && Main.mouseLeftRelease)
                 {
                     if (Main.teamCooldown == 0)
                     {
                         Main.teamCooldown = Main.teamCooldownLen;
                         Main.PlaySound(12, -1, -1, 1);
                         if (Main.player[Main.myPlayer].hostile)
                         {
                             Main.player[Main.myPlayer].hostile = false;
                         }
                         else
                         {
                             Main.player[Main.myPlayer].hostile = true;
                         }
                         NetMessage.SendData(30, -1, -1, "", Main.myPlayer, 0f, 0f, 0f, 0);
                     }
                     else
                     {
                         Main.NewText("You must wait " + (Main.teamCooldown / 60 + 1) + " seconds.", 255, 0, 0);
                     }
                 }
             }
             num69 -= 3;
             Microsoft.Xna.Framework.Rectangle value = new Microsoft.Xna.Framework.Rectangle(Main.mouseX, Main.mouseY, 1, 1);
             int width = Main.teamTexture.Width;
             int height = Main.teamTexture.Height;
             for (int num71 = 0; num71 < 5; num71++)
             {
                 Microsoft.Xna.Framework.Rectangle rectangle = default(Microsoft.Xna.Framework.Rectangle);
                 if (num71 == 0)
                 {
                     rectangle = new Microsoft.Xna.Framework.Rectangle(num69 + 50, num70 - 20, width, height);
                 }
                 if (num71 == 1)
                 {
                     rectangle = new Microsoft.Xna.Framework.Rectangle(num69 + 40, num70, width, height);
                 }
                 if (num71 == 2)
                 {
                     rectangle = new Microsoft.Xna.Framework.Rectangle(num69 + 60, num70, width, height);
                 }
                 if (num71 == 3)
                 {
                     rectangle = new Microsoft.Xna.Framework.Rectangle(num69 + 40, num70 + 20, width, height);
                 }
                 if (num71 == 4)
                 {
                     rectangle = new Microsoft.Xna.Framework.Rectangle(num69 + 60, num70 + 20, width, height);
                 }
                 if (rectangle.Intersects(value))
                 {
                     Main.player[Main.myPlayer].mouseInterface = true;
                     if (Main.mouseLeft && Main.mouseLeftRelease && Main.player[Main.myPlayer].team != num71)
                     {
                         if (Main.teamCooldown == 0)
                         {
                             Main.teamCooldown = Main.teamCooldownLen;
                             Main.PlaySound(12, -1, -1, 1);
                             Main.player[Main.myPlayer].team = num71;
                             NetMessage.SendData(45, -1, -1, "", Main.myPlayer, 0f, 0f, 0f, 0);
                         }
                         else
                         {
                             Main.NewText("You must wait " + (Main.teamCooldown / 60 + 1) + " seconds.", 255, 0, 0);
                         }
                     }
                 }
             }
             SpriteBatch arg_26FE_0 = this.spriteBatch;
             Texture2D arg_26FE_1 = Main.teamTexture;
             Microsoft.Xna.Framework.Vector2 arg_26FE_2 = new Microsoft.Xna.Framework.Vector2((float)(num69 + 50), (float)(num70 - 20));
             Microsoft.Xna.Framework.Rectangle? arg_26FE_3 = new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.teamTexture.Width, Main.teamTexture.Height));
             Microsoft.Xna.Framework.Color arg_26FE_4 = Main.teamColor[0];
             float arg_26FE_5 = 0f;
             origin = default(Microsoft.Xna.Framework.Vector2);
             arg_26FE_0.Draw(arg_26FE_1, arg_26FE_2, arg_26FE_3, arg_26FE_4, arg_26FE_5, origin, 1f, SpriteEffects.None, 0f);
             SpriteBatch arg_276A_0 = this.spriteBatch;
             Texture2D arg_276A_1 = Main.teamTexture;
             Microsoft.Xna.Framework.Vector2 arg_276A_2 = new Microsoft.Xna.Framework.Vector2((float)(num69 + 40), (float)num70);
             Microsoft.Xna.Framework.Rectangle? arg_276A_3 = new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.teamTexture.Width, Main.teamTexture.Height));
             Microsoft.Xna.Framework.Color arg_276A_4 = Main.teamColor[1];
             float arg_276A_5 = 0f;
             origin = default(Microsoft.Xna.Framework.Vector2);
             arg_276A_0.Draw(arg_276A_1, arg_276A_2, arg_276A_3, arg_276A_4, arg_276A_5, origin, 1f, SpriteEffects.None, 0f);
             SpriteBatch arg_27D6_0 = this.spriteBatch;
             Texture2D arg_27D6_1 = Main.teamTexture;
             Microsoft.Xna.Framework.Vector2 arg_27D6_2 = new Microsoft.Xna.Framework.Vector2((float)(num69 + 60), (float)num70);
             Microsoft.Xna.Framework.Rectangle? arg_27D6_3 = new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.teamTexture.Width, Main.teamTexture.Height));
             Microsoft.Xna.Framework.Color arg_27D6_4 = Main.teamColor[2];
             float arg_27D6_5 = 0f;
             origin = default(Microsoft.Xna.Framework.Vector2);
             arg_27D6_0.Draw(arg_27D6_1, arg_27D6_2, arg_27D6_3, arg_27D6_4, arg_27D6_5, origin, 1f, SpriteEffects.None, 0f);
             SpriteBatch arg_2845_0 = this.spriteBatch;
             Texture2D arg_2845_1 = Main.teamTexture;
             Microsoft.Xna.Framework.Vector2 arg_2845_2 = new Microsoft.Xna.Framework.Vector2((float)(num69 + 40), (float)(num70 + 20));
             Microsoft.Xna.Framework.Rectangle? arg_2845_3 = new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.teamTexture.Width, Main.teamTexture.Height));
             Microsoft.Xna.Framework.Color arg_2845_4 = Main.teamColor[3];
             float arg_2845_5 = 0f;
             origin = default(Microsoft.Xna.Framework.Vector2);
             arg_2845_0.Draw(arg_2845_1, arg_2845_2, arg_2845_3, arg_2845_4, arg_2845_5, origin, 1f, SpriteEffects.None, 0f);
             SpriteBatch arg_28B4_0 = this.spriteBatch;
             Texture2D arg_28B4_1 = Main.teamTexture;
             Microsoft.Xna.Framework.Vector2 arg_28B4_2 = new Microsoft.Xna.Framework.Vector2((float)(num69 + 60), (float)(num70 + 20));
             Microsoft.Xna.Framework.Rectangle? arg_28B4_3 = new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.teamTexture.Width, Main.teamTexture.Height));
             Microsoft.Xna.Framework.Color arg_28B4_4 = Main.teamColor[4];
             float arg_28B4_5 = 0f;
             origin = default(Microsoft.Xna.Framework.Vector2);
             arg_28B4_0.Draw(arg_28B4_1, arg_28B4_2, arg_28B4_3, arg_28B4_4, arg_28B4_5, origin, 1f, SpriteEffects.None, 0f);
         }
         bool flag4 = false;
         Main.inventoryScale = 0.85f;
         int num72 = 448;
         int num73 = 210;
         Microsoft.Xna.Framework.Color white = new Microsoft.Xna.Framework.Color(150, 150, 150, 150);
         if (Main.mouseX >= num72 && (float)Main.mouseX <= (float)num72 + (float)Main.inventoryBackTexture.Width * Main.inventoryScale && Main.mouseY >= num73 && (float)Main.mouseY <= (float)num73 + (float)Main.inventoryBackTexture.Height * Main.inventoryScale)
         {
             Main.player[Main.myPlayer].mouseInterface = true;
             if (Main.mouseLeftRelease && Main.mouseLeft)
             {
                 if (Main.mouseItem.type != 0)
                 {
                     Main.trashItem.SetDefaults(0, false);
                 }
                 Item item = Main.mouseItem;
                 Main.mouseItem = Main.trashItem;
                 Main.trashItem = item;
                 if (Main.trashItem.type == 0 || Main.trashItem.stack < 1)
                 {
                     Main.trashItem = new Item();
                 }
                 if (Main.mouseItem.IsTheSameAs(Main.trashItem) && Main.trashItem.stack != Main.trashItem.maxStack && Main.mouseItem.stack != Main.mouseItem.maxStack)
                 {
                     if (Main.mouseItem.stack + Main.trashItem.stack <= Main.mouseItem.maxStack)
                     {
                         Main.trashItem.stack += Main.mouseItem.stack;
                         Main.mouseItem.stack = 0;
                     }
                     else
                     {
                         int num74 = Main.mouseItem.maxStack - Main.trashItem.stack;
                         Main.trashItem.stack += num74;
                         Main.mouseItem.stack -= num74;
                     }
                 }
                 if (Main.mouseItem.type == 0 || Main.mouseItem.stack < 1)
                 {
                     Main.mouseItem = new Item();
                 }
                 if (Main.mouseItem.type > 0 || Main.trashItem.type > 0)
                 {
                     Main.PlaySound(7, -1, -1, 1);
                 }
             }
             if (!flag4)
             {
                 text15 = Main.trashItem.name;
                 if (Main.trashItem.stack > 1)
                 {
                     object obj = text15;
                     text15 = string.Concat(new object[]
                     {
                         obj,
                         " (",
                         Main.trashItem.stack,
                         ")"
                     });
                 }
                 Main.toolTip = (Item)Main.trashItem.Clone();
                 if (text15 == null)
                 {
                     text15 = "Trash Can";
                 }
             }
             else
             {
                 text15 = "Trash Can";
             }
         }
         SpriteBatch arg_2BBF_0 = this.spriteBatch;
         Texture2D arg_2BBF_1 = Main.inventoryBack7Texture;
         Microsoft.Xna.Framework.Vector2 arg_2BBF_2 = new Microsoft.Xna.Framework.Vector2((float)num72, (float)num73);
         Microsoft.Xna.Framework.Rectangle? arg_2BBF_3 = new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.inventoryBackTexture.Width, Main.inventoryBackTexture.Height));
         Microsoft.Xna.Framework.Color arg_2BBF_4 = color2;
         float arg_2BBF_5 = 0f;
         origin = default(Microsoft.Xna.Framework.Vector2);
         arg_2BBF_0.Draw(arg_2BBF_1, arg_2BBF_2, arg_2BBF_3, arg_2BBF_4, arg_2BBF_5, origin, Main.inventoryScale, SpriteEffects.None, 0f);
         white = Microsoft.Xna.Framework.Color.White;
         if (Main.trashItem.type == 0 || Main.trashItem.stack == 0 || flag4)
         {
             white = new Microsoft.Xna.Framework.Color(100, 100, 100, 100);
             float num75 = Main.inventoryScale;
             SpriteBatch arg_2C95_0 = this.spriteBatch;
             Texture2D arg_2C95_1 = Main.trashTexture;
             Microsoft.Xna.Framework.Vector2 arg_2C95_2 = new Microsoft.Xna.Framework.Vector2((float)num72 + 26f * Main.inventoryScale - (float)Main.trashTexture.Width * 0.5f * num75, (float)num73 + 26f * Main.inventoryScale - (float)Main.trashTexture.Height * 0.5f * num75);
             Microsoft.Xna.Framework.Rectangle? arg_2C95_3 = new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.trashTexture.Width, Main.trashTexture.Height));
             Microsoft.Xna.Framework.Color arg_2C95_4 = white;
             float arg_2C95_5 = 0f;
             origin = default(Microsoft.Xna.Framework.Vector2);
             arg_2C95_0.Draw(arg_2C95_1, arg_2C95_2, arg_2C95_3, arg_2C95_4, arg_2C95_5, origin, num75, SpriteEffects.None, 0f);
         }
         else
         {
             float num76 = 1f;
             if (Main.itemTexture[Main.trashItem.type].Width > 32 || Main.itemTexture[Main.trashItem.type].Height > 32)
             {
                 if (Main.itemTexture[Main.trashItem.type].Width > Main.itemTexture[Main.trashItem.type].Height)
                 {
                     num76 = 32f / (float)Main.itemTexture[Main.trashItem.type].Width;
                 }
                 else
                 {
                     num76 = 32f / (float)Main.itemTexture[Main.trashItem.type].Height;
                 }
             }
             num76 *= Main.inventoryScale;
             SpriteBatch arg_2E22_0 = this.spriteBatch;
             Texture2D arg_2E22_1 = Main.itemTexture[Main.trashItem.type];
             Microsoft.Xna.Framework.Vector2 arg_2E22_2 = new Microsoft.Xna.Framework.Vector2((float)num72 + 26f * Main.inventoryScale - (float)Main.itemTexture[Main.trashItem.type].Width * 0.5f * num76, (float)num73 + 26f * Main.inventoryScale - (float)Main.itemTexture[Main.trashItem.type].Height * 0.5f * num76);
             Microsoft.Xna.Framework.Rectangle? arg_2E22_3 = new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.itemTexture[Main.trashItem.type].Width, Main.itemTexture[Main.trashItem.type].Height));
             Microsoft.Xna.Framework.Color arg_2E22_4 = Main.trashItem.GetAlpha(white);
             float arg_2E22_5 = 0f;
             origin = default(Microsoft.Xna.Framework.Vector2);
             arg_2E22_0.Draw(arg_2E22_1, arg_2E22_2, arg_2E22_3, arg_2E22_4, arg_2E22_5, origin, num76, SpriteEffects.None, 0f);
             Microsoft.Xna.Framework.Color arg_2E3F_0 = Main.trashItem.color;
             Microsoft.Xna.Framework.Color b = default(Microsoft.Xna.Framework.Color);
             if (arg_2E3F_0 != b)
             {
                 SpriteBatch arg_2F1F_0 = this.spriteBatch;
                 Texture2D arg_2F1F_1 = Main.itemTexture[Main.trashItem.type];
                 Microsoft.Xna.Framework.Vector2 arg_2F1F_2 = new Microsoft.Xna.Framework.Vector2((float)num72 + 26f * Main.inventoryScale - (float)Main.itemTexture[Main.trashItem.type].Width * 0.5f * num76, (float)num73 + 26f * Main.inventoryScale - (float)Main.itemTexture[Main.trashItem.type].Height * 0.5f * num76);
                 Microsoft.Xna.Framework.Rectangle? arg_2F1F_3 = new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.itemTexture[Main.trashItem.type].Width, Main.itemTexture[Main.trashItem.type].Height));
                 Microsoft.Xna.Framework.Color arg_2F1F_4 = Main.trashItem.GetColor(white);
                 float arg_2F1F_5 = 0f;
                 origin = default(Microsoft.Xna.Framework.Vector2);
                 arg_2F1F_0.Draw(arg_2F1F_1, arg_2F1F_2, arg_2F1F_3, arg_2F1F_4, arg_2F1F_5, origin, num76, SpriteEffects.None, 0f);
             }
             if (Main.trashItem.stack > 1)
             {
                 SpriteBatch arg_2F90_0 = this.spriteBatch;
                 SpriteFont arg_2F90_1 = Main.fontItemStack;
                 string arg_2F90_2 = string.Concat(Main.trashItem.stack);
                 Microsoft.Xna.Framework.Vector2 arg_2F90_3 = new Microsoft.Xna.Framework.Vector2((float)num72 + 10f * Main.inventoryScale, (float)num73 + 26f * Main.inventoryScale);
                 Microsoft.Xna.Framework.Color arg_2F90_4 = white;
                 float arg_2F90_5 = 0f;
                 origin = default(Microsoft.Xna.Framework.Vector2);
                 arg_2F90_0.DrawString(arg_2F90_1, arg_2F90_2, arg_2F90_3, arg_2F90_4, arg_2F90_5, origin, num76, SpriteEffects.None, 0f);
             }
         }
         SpriteBatch arg_2FEB_0 = this.spriteBatch;
         SpriteFont arg_2FEB_1 = Main.fontMouseText;
         string arg_2FEB_2 = "Inventory";
         Microsoft.Xna.Framework.Vector2 arg_2FEB_3 = new Microsoft.Xna.Framework.Vector2(40f, 0f);
         Microsoft.Xna.Framework.Color arg_2FEB_4 = new Microsoft.Xna.Framework.Color((int)Main.mouseTextColor, (int)Main.mouseTextColor, (int)Main.mouseTextColor, (int)Main.mouseTextColor);
         float arg_2FEB_5 = 0f;
         origin = default(Microsoft.Xna.Framework.Vector2);
         arg_2FEB_0.DrawString(arg_2FEB_1, arg_2FEB_2, arg_2FEB_3, arg_2FEB_4, arg_2FEB_5, origin, 1f, SpriteEffects.None, 0f);
         Main.inventoryScale = 0.85f;
         if (Main.mouseX > 20 && Main.mouseX < (int)(20f + 560f * Main.inventoryScale) && Main.mouseY > 20 && Main.mouseY < (int)(20f + 224f * Main.inventoryScale))
         {
             Main.player[Main.myPlayer].mouseInterface = true;
         }
         for (int num77 = 0; num77 < 10; num77++)
         {
             for (int num78 = 0; num78 < 4; num78++)
             {
                 int num79 = (int)(20f + (float)(num77 * 56) * Main.inventoryScale);
                 int num80 = (int)(20f + (float)(num78 * 56) * Main.inventoryScale);
                 int num81 = num77 + num78 * 10;
                 Microsoft.Xna.Framework.Color white2 = new Microsoft.Xna.Framework.Color(100, 100, 100, 100);
                 if (Main.mouseX >= num79 && (float)Main.mouseX <= (float)num79 + (float)Main.inventoryBackTexture.Width * Main.inventoryScale && Main.mouseY >= num80 && (float)Main.mouseY <= (float)num80 + (float)Main.inventoryBackTexture.Height * Main.inventoryScale)
                 {
                     Main.player[Main.myPlayer].mouseInterface = true;
                     if (Main.mouseLeftRelease && Main.mouseLeft)
                     {
                         if (Main.keyState.IsKeyDown(Keys.LeftShift))
                         {
                             if (Main.player[Main.myPlayer].inventory[num81].type > 0)
                             {
                                 if (Main.npcShop > 0)
                                 {
                                     if (Main.player[Main.myPlayer].SellItem(Main.player[Main.myPlayer].inventory[num81].value, Main.player[Main.myPlayer].inventory[num81].stack))
                                     {
                                         this.shop[Main.npcShop].AddShop(Main.player[Main.myPlayer].inventory[num81]);
                                         Main.player[Main.myPlayer].inventory[num81].SetDefaults(0, false);
                                         Main.PlaySound(18, -1, -1, 1);
                                     }
                                     else
                                     {
                                         if (Main.player[Main.myPlayer].inventory[num81].value == 0)
                                         {
                                             this.shop[Main.npcShop].AddShop(Main.player[Main.myPlayer].inventory[num81]);
                                             Main.player[Main.myPlayer].inventory[num81].SetDefaults(0, false);
                                             Main.PlaySound(7, -1, -1, 1);
                                         }
                                     }
                                 }
                                 else
                                 {
                                     Recipe.FindRecipes();
                                     Main.PlaySound(7, -1, -1, 1);
                                     Main.trashItem = (Item)Main.player[Main.myPlayer].inventory[num81].Clone();
                                     Main.player[Main.myPlayer].inventory[num81].SetDefaults(0, false);
                                 }
                             }
                         }
                         else
                         {
                             if (Main.player[Main.myPlayer].selectedItem != num81 || Main.player[Main.myPlayer].itemAnimation <= 0)
                             {
                                 Item item2 = Main.mouseItem;
                                 Main.mouseItem = Main.player[Main.myPlayer].inventory[num81];
                                 Main.player[Main.myPlayer].inventory[num81] = item2;
                                 if (Main.player[Main.myPlayer].inventory[num81].type == 0 || Main.player[Main.myPlayer].inventory[num81].stack < 1)
                                 {
                                     Main.player[Main.myPlayer].inventory[num81] = new Item();
                                 }
                                 if (Main.mouseItem.IsTheSameAs(Main.player[Main.myPlayer].inventory[num81]) && Main.player[Main.myPlayer].inventory[num81].stack != Main.player[Main.myPlayer].inventory[num81].maxStack && Main.mouseItem.stack != Main.mouseItem.maxStack)
                                 {
                                     if (Main.mouseItem.stack + Main.player[Main.myPlayer].inventory[num81].stack <= Main.mouseItem.maxStack)
                                     {
                                         Main.player[Main.myPlayer].inventory[num81].stack += Main.mouseItem.stack;
                                         Main.mouseItem.stack = 0;
                                     }
                                     else
                                     {
                                         int num82 = Main.mouseItem.maxStack - Main.player[Main.myPlayer].inventory[num81].stack;
                                         Main.player[Main.myPlayer].inventory[num81].stack += num82;
                                         Main.mouseItem.stack -= num82;
                                     }
                                 }
                                 if (Main.mouseItem.type == 0 || Main.mouseItem.stack < 1)
                                 {
                                     Main.mouseItem = new Item();
                                 }
                                 if (Main.mouseItem.type > 0 || Main.player[Main.myPlayer].inventory[num81].type > 0)
                                 {
                                     Recipe.FindRecipes();
                                     Main.PlaySound(7, -1, -1, 1);
                                 }
                             }
                         }
                     }
                     else
                     {
                         if (Main.mouseRight && Main.mouseRightRelease && Main.player[Main.myPlayer].inventory[num81].maxStack == 1)
                         {
                             Main.player[Main.myPlayer].inventory[num81] = Main.armorSwap(Main.player[Main.myPlayer].inventory[num81]);
                         }
                         else
                         {
                             if (Main.stackSplit <= 1 && Main.mouseRight && Main.player[Main.myPlayer].inventory[num81].maxStack > 1 && Main.player[Main.myPlayer].inventory[num81].type > 0 && (Main.mouseItem.IsTheSameAs(Main.player[Main.myPlayer].inventory[num81]) || Main.mouseItem.type == 0) && (Main.mouseItem.stack < Main.mouseItem.maxStack || Main.mouseItem.type == 0))
                             {
                                 if (Main.mouseItem.type == 0)
                                 {
                                     Main.mouseItem = (Item)Main.player[Main.myPlayer].inventory[num81].Clone();
                                     Main.mouseItem.stack = 0;
                                 }
                                 Main.mouseItem.stack++;
                                 Main.player[Main.myPlayer].inventory[num81].stack--;
                                 if (Main.player[Main.myPlayer].inventory[num81].stack <= 0)
                                 {
                                     Main.player[Main.myPlayer].inventory[num81] = new Item();
                                 }
                                 Recipe.FindRecipes();
                                 Main.soundInstanceMenuTick.Stop();
                                 Main.soundInstanceMenuTick = Main.soundMenuTick.CreateInstance();
                                 Main.PlaySound(12, -1, -1, 1);
                                 if (Main.stackSplit == 0)
                                 {
                                     Main.stackSplit = 15;
                                 }
                                 else
                                 {
                                     Main.stackSplit = Main.stackDelay;
                                 }
                             }
                         }
                     }
                     text15 = Main.player[Main.myPlayer].inventory[num81].name;
                     Main.toolTip = (Item)Main.player[Main.myPlayer].inventory[num81].Clone();
                     if (Main.player[Main.myPlayer].inventory[num81].stack > 1)
                     {
                         object obj = text15;
                         text15 = string.Concat(new object[]
                         {
                             obj,
                             " (",
                             Main.player[Main.myPlayer].inventory[num81].stack,
                             ")"
                         });
                     }
                 }
                 if (num78 != 0)
                 {
                     SpriteBatch arg_37C9_0 = this.spriteBatch;
                     Texture2D arg_37C9_1 = Main.inventoryBackTexture;
                     Microsoft.Xna.Framework.Vector2 arg_37C9_2 = new Microsoft.Xna.Framework.Vector2((float)num79, (float)num80);
                     Microsoft.Xna.Framework.Rectangle? arg_37C9_3 = new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.inventoryBackTexture.Width, Main.inventoryBackTexture.Height));
                     Microsoft.Xna.Framework.Color arg_37C9_4 = color2;
                     float arg_37C9_5 = 0f;
                     origin = default(Microsoft.Xna.Framework.Vector2);
                     arg_37C9_0.Draw(arg_37C9_1, arg_37C9_2, arg_37C9_3, arg_37C9_4, arg_37C9_5, origin, Main.inventoryScale, SpriteEffects.None, 0f);
                 }
                 else
                 {
                     SpriteBatch arg_3826_0 = this.spriteBatch;
                     Texture2D arg_3826_1 = Main.inventoryBack9Texture;
                     Microsoft.Xna.Framework.Vector2 arg_3826_2 = new Microsoft.Xna.Framework.Vector2((float)num79, (float)num80);
                     Microsoft.Xna.Framework.Rectangle? arg_3826_3 = new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.inventoryBackTexture.Width, Main.inventoryBackTexture.Height));
                     Microsoft.Xna.Framework.Color arg_3826_4 = color2;
                     float arg_3826_5 = 0f;
                     origin = default(Microsoft.Xna.Framework.Vector2);
                     arg_3826_0.Draw(arg_3826_1, arg_3826_2, arg_3826_3, arg_3826_4, arg_3826_5, origin, Main.inventoryScale, SpriteEffects.None, 0f);
                 }
                 white2 = Microsoft.Xna.Framework.Color.White;
                 if (Main.player[Main.myPlayer].inventory[num81].type > 0 && Main.player[Main.myPlayer].inventory[num81].stack > 0)
                 {
                     float num83 = 1f;
                     if (Main.itemTexture[Main.player[Main.myPlayer].inventory[num81].type].Width > 32 || Main.itemTexture[Main.player[Main.myPlayer].inventory[num81].type].Height > 32)
                     {
                         if (Main.itemTexture[Main.player[Main.myPlayer].inventory[num81].type].Width > Main.itemTexture[Main.player[Main.myPlayer].inventory[num81].type].Height)
                         {
                             num83 = 32f / (float)Main.itemTexture[Main.player[Main.myPlayer].inventory[num81].type].Width;
                         }
                         else
                         {
                             num83 = 32f / (float)Main.itemTexture[Main.player[Main.myPlayer].inventory[num81].type].Height;
                         }
                     }
                     num83 *= Main.inventoryScale;
                     SpriteBatch arg_3A9C_0 = this.spriteBatch;
                     Texture2D arg_3A9C_1 = Main.itemTexture[Main.player[Main.myPlayer].inventory[num81].type];
                     Microsoft.Xna.Framework.Vector2 arg_3A9C_2 = new Microsoft.Xna.Framework.Vector2((float)num79 + 26f * Main.inventoryScale - (float)Main.itemTexture[Main.player[Main.myPlayer].inventory[num81].type].Width * 0.5f * num83, (float)num80 + 26f * Main.inventoryScale - (float)Main.itemTexture[Main.player[Main.myPlayer].inventory[num81].type].Height * 0.5f * num83);
                     Microsoft.Xna.Framework.Rectangle? arg_3A9C_3 = new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.itemTexture[Main.player[Main.myPlayer].inventory[num81].type].Width, Main.itemTexture[Main.player[Main.myPlayer].inventory[num81].type].Height));
                     Microsoft.Xna.Framework.Color arg_3A9C_4 = Main.player[Main.myPlayer].inventory[num81].GetAlpha(white2);
                     float arg_3A9C_5 = 0f;
                     origin = default(Microsoft.Xna.Framework.Vector2);
                     arg_3A9C_0.Draw(arg_3A9C_1, arg_3A9C_2, arg_3A9C_3, arg_3A9C_4, arg_3A9C_5, origin, num83, SpriteEffects.None, 0f);
                     Microsoft.Xna.Framework.Color arg_3AC7_0 = Main.player[Main.myPlayer].inventory[num81].color;
                     Microsoft.Xna.Framework.Color b = default(Microsoft.Xna.Framework.Color);
                     if (arg_3AC7_0 != b)
                     {
                         SpriteBatch arg_3BFB_0 = this.spriteBatch;
                         Texture2D arg_3BFB_1 = Main.itemTexture[Main.player[Main.myPlayer].inventory[num81].type];
                         Microsoft.Xna.Framework.Vector2 arg_3BFB_2 = new Microsoft.Xna.Framework.Vector2((float)num79 + 26f * Main.inventoryScale - (float)Main.itemTexture[Main.player[Main.myPlayer].inventory[num81].type].Width * 0.5f * num83, (float)num80 + 26f * Main.inventoryScale - (float)Main.itemTexture[Main.player[Main.myPlayer].inventory[num81].type].Height * 0.5f * num83);
                         Microsoft.Xna.Framework.Rectangle? arg_3BFB_3 = new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.itemTexture[Main.player[Main.myPlayer].inventory[num81].type].Width, Main.itemTexture[Main.player[Main.myPlayer].inventory[num81].type].Height));
                         Microsoft.Xna.Framework.Color arg_3BFB_4 = Main.player[Main.myPlayer].inventory[num81].GetColor(white2);
                         float arg_3BFB_5 = 0f;
                         origin = default(Microsoft.Xna.Framework.Vector2);
                         arg_3BFB_0.Draw(arg_3BFB_1, arg_3BFB_2, arg_3BFB_3, arg_3BFB_4, arg_3BFB_5, origin, num83, SpriteEffects.None, 0f);
                     }
                     if (Main.player[Main.myPlayer].inventory[num81].stack > 1)
                     {
                         SpriteBatch arg_3C88_0 = this.spriteBatch;
                         SpriteFont arg_3C88_1 = Main.fontItemStack;
                         string arg_3C88_2 = string.Concat(Main.player[Main.myPlayer].inventory[num81].stack);
                         Microsoft.Xna.Framework.Vector2 arg_3C88_3 = new Microsoft.Xna.Framework.Vector2((float)num79 + 10f * Main.inventoryScale, (float)num80 + 26f * Main.inventoryScale);
                         Microsoft.Xna.Framework.Color arg_3C88_4 = white2;
                         float arg_3C88_5 = 0f;
                         origin = default(Microsoft.Xna.Framework.Vector2);
                         arg_3C88_0.DrawString(arg_3C88_1, arg_3C88_2, arg_3C88_3, arg_3C88_4, arg_3C88_5, origin, num83, SpriteEffects.None, 0f);
                     }
                 }
                 if (num78 == 0)
                 {
                     string text16 = string.Concat(num81 + 1);
                     if (text16 == "10")
                     {
                         text16 = "0";
                     }
                     Microsoft.Xna.Framework.Color color4 = color2;
                     if (Main.player[Main.myPlayer].selectedItem == num81)
                     {
                         color4.R = 0;
                         color4.B = 0;
                         color4.G = 255;
                         color4.A = 50;
                     }
                     SpriteBatch arg_3D38_0 = this.spriteBatch;
                     SpriteFont arg_3D38_1 = Main.fontItemStack;
                     string arg_3D38_2 = text16;
                     Microsoft.Xna.Framework.Vector2 arg_3D38_3 = new Microsoft.Xna.Framework.Vector2((float)(num79 + 6), (float)(num80 + 4));
                     Microsoft.Xna.Framework.Color arg_3D38_4 = color4;
                     float arg_3D38_5 = 0f;
                     origin = default(Microsoft.Xna.Framework.Vector2);
                     arg_3D38_0.DrawString(arg_3D38_1, arg_3D38_2, arg_3D38_3, arg_3D38_4, arg_3D38_5, origin, Main.inventoryScale * 0.8f, SpriteEffects.None, 0f);
                 }
             }
         }
         int num84 = 0;
         int num85 = 2;
         int num86 = 32;
         if (!Main.player[Main.myPlayer].hbLocked)
         {
             num84 = 1;
         }
         SpriteBatch arg_3DD8_0 = this.spriteBatch;
         Texture2D arg_3DD8_1 = Main.HBLockTexture[num84];
         Microsoft.Xna.Framework.Vector2 arg_3DD8_2 = new Microsoft.Xna.Framework.Vector2((float)num85, (float)num86);
         Microsoft.Xna.Framework.Rectangle? arg_3DD8_3 = new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.HBLockTexture[num84].Width, Main.HBLockTexture[num84].Height));
         Microsoft.Xna.Framework.Color arg_3DD8_4 = color2;
         float arg_3DD8_5 = 0f;
         origin = default(Microsoft.Xna.Framework.Vector2);
         arg_3DD8_0.Draw(arg_3DD8_1, arg_3DD8_2, arg_3DD8_3, arg_3DD8_4, arg_3DD8_5, origin, 0.9f, SpriteEffects.None, 0f);
         if (Main.mouseX > num85 && (float)Main.mouseX < (float)num85 + (float)Main.HBLockTexture[num84].Width * 0.9f && Main.mouseY > num86 && (float)Main.mouseY < (float)num86 + (float)Main.HBLockTexture[num84].Height * 0.9f)
         {
             Main.player[Main.myPlayer].mouseInterface = true;
             if (!Main.player[Main.myPlayer].hbLocked)
             {
                 this.MouseText("Hotbar unlocked", 0, 0);
                 flag = true;
             }
             else
             {
                 this.MouseText("Hotbar locked", 0, 0);
                 flag = true;
             }
             if (Main.mouseLeft && Main.mouseLeftRelease)
             {
                 Main.PlaySound(22, -1, -1, 1);
                 if (!Main.player[Main.myPlayer].hbLocked)
                 {
                     Main.player[Main.myPlayer].hbLocked = true;
                 }
                 else
                 {
                     Main.player[Main.myPlayer].hbLocked = false;
                 }
             }
         }
         if (Main.armorHide)
         {
             Main.armorAlpha -= 0.1f;
             if (Main.armorAlpha < 0f)
             {
                 Main.armorAlpha = 0f;
             }
         }
         else
         {
             Main.armorAlpha += 0.025f;
             if (Main.armorAlpha > 1f)
             {
                 Main.armorAlpha = 1f;
             }
         }
         Microsoft.Xna.Framework.Color color5 = new Microsoft.Xna.Framework.Color((int)((byte)((float)Main.mouseTextColor * Main.armorAlpha)), (int)((byte)((float)Main.mouseTextColor * Main.armorAlpha)), (int)((byte)((float)Main.mouseTextColor * Main.armorAlpha)), (int)((byte)((float)Main.mouseTextColor * Main.armorAlpha)));
         Main.armorHide = false;
         int num87 = 1;
         int num88 = Main.screenWidth - 152;
         int num89 = 128;
         if (Main.netMode == 0)
         {
             num88 += 72;
         }
         if (this.showNPCs)
         {
             num87 = 0;
         }
         SpriteBatch arg_3FF6_0 = this.spriteBatch;
         Texture2D arg_3FF6_1 = Main.npcToggleTexture[num87];
         Microsoft.Xna.Framework.Vector2 arg_3FF6_2 = new Microsoft.Xna.Framework.Vector2((float)num88, (float)num89);
         Microsoft.Xna.Framework.Rectangle? arg_3FF6_3 = new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.npcToggleTexture[num87].Width, Main.npcToggleTexture[num87].Height));
         Microsoft.Xna.Framework.Color arg_3FF6_4 = Microsoft.Xna.Framework.Color.White;
         float arg_3FF6_5 = 0f;
         origin = default(Microsoft.Xna.Framework.Vector2);
         arg_3FF6_0.Draw(arg_3FF6_1, arg_3FF6_2, arg_3FF6_3, arg_3FF6_4, arg_3FF6_5, origin, 0.9f, SpriteEffects.None, 0f);
         if (Main.mouseX > num88 && (float)Main.mouseX < (float)num88 + (float)Main.npcToggleTexture[num87].Width * 0.9f && Main.mouseY > num89 && (float)Main.mouseY < (float)num89 + (float)Main.npcToggleTexture[num87].Height * 0.9f)
         {
             Main.player[Main.myPlayer].mouseInterface = true;
             if (Main.mouseLeft && Main.mouseLeftRelease)
             {
                 Main.PlaySound(12, -1, -1, 1);
                 if (!this.showNPCs)
                 {
                     this.showNPCs = true;
                 }
                 else
                 {
                     this.showNPCs = false;
                 }
             }
         }
         if (this.showNPCs)
         {
             SpriteBatch arg_40FB_0 = this.spriteBatch;
             SpriteFont arg_40FB_1 = Main.fontMouseText;
             string arg_40FB_2 = "Housing";
             Microsoft.Xna.Framework.Vector2 arg_40FB_3 = new Microsoft.Xna.Framework.Vector2((float)(Main.screenWidth - 64 - 28 - 3), 152f);
             Microsoft.Xna.Framework.Color arg_40FB_4 = new Microsoft.Xna.Framework.Color((int)Main.mouseTextColor, (int)Main.mouseTextColor, (int)Main.mouseTextColor, (int)Main.mouseTextColor);
             float arg_40FB_5 = 0f;
             origin = default(Microsoft.Xna.Framework.Vector2);
             arg_40FB_0.DrawString(arg_40FB_1, arg_40FB_2, arg_40FB_3, arg_40FB_4, arg_40FB_5, origin, 0.8f, SpriteEffects.None, 0f);
             if (Main.mouseX > Main.screenWidth - 64 - 28 && Main.mouseX < (int)((float)(Main.screenWidth - 64 - 28) + 56f * Main.inventoryScale) && Main.mouseY > 174 && Main.mouseY < (int)(174f + 448f * Main.inventoryScale))
             {
                 Main.player[Main.myPlayer].mouseInterface = true;
             }
             int num90 = 0;
             string text17 = "";
             for (int num91 = 0; num91 < 11; num91++)
             {
                 bool flag5 = false;
                 int num92 = 0;
                 if (num91 == 0)
                 {
                     flag5 = true;
                 }
                 else
                 {
                     for (int num93 = 0; num93 < 200; num93++)
                     {
                         if (Main.npc[num93].active && NPC.TypeToNum(Main.npc[num93].type) == num91)
                         {
                             flag5 = true;
                             num92 = num93;
                             break;
                         }
                     }
                 }
                 if (flag5)
                 {
                     int num94 = Main.screenWidth - 64 - 28;
                     int num95 = (int)(174f + (float)(num90 * 56) * Main.inventoryScale);
                     Microsoft.Xna.Framework.Color white3 = new Microsoft.Xna.Framework.Color(100, 100, 100, 100);
                     if (Main.screenHeight < 768 && num90 > 5)
                     {
                         num95 -= (int)(280f * Main.inventoryScale);
                         num94 -= 48;
                     }
                     if (Main.mouseX >= num94 && (float)Main.mouseX <= (float)num94 + (float)Main.inventoryBackTexture.Width * Main.inventoryScale && Main.mouseY >= num95 && (float)Main.mouseY <= (float)num95 + (float)Main.inventoryBackTexture.Height * Main.inventoryScale)
                     {
                         flag = true;
                         if (num91 == 0)
                         {
                             text17 = "Housing Query";
                         }
                         else
                         {
                             text17 = Main.npc[num92].displayName + " the " + Main.npc[num92].name;
                         }
                         Main.player[Main.myPlayer].mouseInterface = true;
                         if (Main.mouseLeftRelease && Main.mouseLeft && Main.mouseItem.type == 0)
                         {
                             Main.PlaySound(12, -1, -1, 1);
                             this.mouseNPC = num91;
                             Main.mouseLeftRelease = false;
                         }
                     }
                     SpriteBatch arg_4350_0 = this.spriteBatch;
                     Texture2D arg_4350_1 = Main.inventoryBack11Texture;
                     Microsoft.Xna.Framework.Vector2 arg_4350_2 = new Microsoft.Xna.Framework.Vector2((float)num94, (float)num95);
                     Microsoft.Xna.Framework.Rectangle? arg_4350_3 = new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.inventoryBackTexture.Width, Main.inventoryBackTexture.Height));
                     Microsoft.Xna.Framework.Color arg_4350_4 = color2;
                     float arg_4350_5 = 0f;
                     origin = default(Microsoft.Xna.Framework.Vector2);
                     arg_4350_0.Draw(arg_4350_1, arg_4350_2, arg_4350_3, arg_4350_4, arg_4350_5, origin, Main.inventoryScale, SpriteEffects.None, 0f);
                     white3 = Microsoft.Xna.Framework.Color.White;
                     int num96 = num91;
                     float scale = 1f;
                     float num97 = 0f;
                     if (Main.npcHeadTexture[num96].Width > Main.npcHeadTexture[num96].Height)
                     {
                         num97 = (float)Main.npcHeadTexture[num96].Width;
                     }
                     else
                     {
                         num97 = (float)Main.npcHeadTexture[num96].Height;
                     }
                     if (num97 > 36f)
                     {
                         scale = 36f / num97;
                     }
                     this.spriteBatch.Draw(Main.npcHeadTexture[num96], new Microsoft.Xna.Framework.Vector2((float)num94 + 26f * Main.inventoryScale, (float)num95 + 26f * Main.inventoryScale), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.npcHeadTexture[num96].Width, Main.npcHeadTexture[num96].Height)), white3, 0f, new Microsoft.Xna.Framework.Vector2((float)(Main.npcHeadTexture[num96].Width / 2), (float)(Main.npcHeadTexture[num96].Height / 2)), scale, SpriteEffects.None, 0f);
                     num90++;
                 }
             }
             if (text17 != "" && Main.mouseItem.type == 0)
             {
                 this.MouseText(text17, 0, 0);
             }
         }
         else
         {
             SpriteBatch arg_44F2_0 = this.spriteBatch;
             SpriteFont arg_44F2_1 = Main.fontMouseText;
             string arg_44F2_2 = "Equip";
             Microsoft.Xna.Framework.Vector2 arg_44F2_3 = new Microsoft.Xna.Framework.Vector2((float)(Main.screenWidth - 64 - 28 + 4), 152f);
             Microsoft.Xna.Framework.Color arg_44F2_4 = new Microsoft.Xna.Framework.Color((int)Main.mouseTextColor, (int)Main.mouseTextColor, (int)Main.mouseTextColor, (int)Main.mouseTextColor);
             float arg_44F2_5 = 0f;
             origin = default(Microsoft.Xna.Framework.Vector2);
             arg_44F2_0.DrawString(arg_44F2_1, arg_44F2_2, arg_44F2_3, arg_44F2_4, arg_44F2_5, origin, 0.8f, SpriteEffects.None, 0f);
             if (Main.mouseX > Main.screenWidth - 64 - 28 && Main.mouseX < (int)((float)(Main.screenWidth - 64 - 28) + 56f * Main.inventoryScale) && Main.mouseY > 174 && Main.mouseY < (int)(174f + 448f * Main.inventoryScale))
             {
                 Main.player[Main.myPlayer].mouseInterface = true;
             }
             for (int num98 = 0; num98 < 8; num98++)
             {
                 int num99 = Main.screenWidth - 64 - 28;
                 int num100 = (int)(174f + (float)(num98 * 56) * Main.inventoryScale);
                 Microsoft.Xna.Framework.Color white4 = new Microsoft.Xna.Framework.Color(100, 100, 100, 100);
                 string text18 = "";
                 if (num98 == 3)
                 {
                     text18 = "Accessories";
                 }
                 if (num98 == 7)
                 {
                     text18 = Main.player[Main.myPlayer].statDefense + " Defense";
                 }
                 Microsoft.Xna.Framework.Vector2 vector5 = Main.fontMouseText.MeasureString(text18);
                 SpriteBatch arg_4645_0 = this.spriteBatch;
                 SpriteFont arg_4645_1 = Main.fontMouseText;
                 string arg_4645_2 = text18;
                 Microsoft.Xna.Framework.Vector2 arg_4645_3 = new Microsoft.Xna.Framework.Vector2((float)num99 - vector5.X - 10f, (float)num100 + (float)Main.inventoryBackTexture.Height * 0.5f - vector5.Y * 0.5f);
                 Microsoft.Xna.Framework.Color arg_4645_4 = color5;
                 float arg_4645_5 = 0f;
                 origin = default(Microsoft.Xna.Framework.Vector2);
                 arg_4645_0.DrawString(arg_4645_1, arg_4645_2, arg_4645_3, arg_4645_4, arg_4645_5, origin, 1f, SpriteEffects.None, 0f);
                 if (Main.mouseX >= num99 && (float)Main.mouseX <= (float)num99 + (float)Main.inventoryBackTexture.Width * Main.inventoryScale && Main.mouseY >= num100 && (float)Main.mouseY <= (float)num100 + (float)Main.inventoryBackTexture.Height * Main.inventoryScale)
                 {
                     Main.armorHide = true;
                     Main.player[Main.myPlayer].mouseInterface = true;
                     if (Main.mouseLeftRelease && Main.mouseLeft && (Main.mouseItem.type == 0 || (Main.mouseItem.headSlot > -1 && num98 == 0) || (Main.mouseItem.bodySlot > -1 && num98 == 1) || (Main.mouseItem.legSlot > -1 && num98 == 2) || (Main.mouseItem.accessory && num98 > 2 && !Main.AccCheck(Main.mouseItem, num98))))
                     {
                         Item item3 = Main.mouseItem;
                         Main.mouseItem = Main.player[Main.myPlayer].armor[num98];
                         Main.player[Main.myPlayer].armor[num98] = item3;
                         if (Main.player[Main.myPlayer].armor[num98].type == 0 || Main.player[Main.myPlayer].armor[num98].stack < 1)
                         {
                             Main.player[Main.myPlayer].armor[num98] = new Item();
                         }
                         if (Main.mouseItem.type == 0 || Main.mouseItem.stack < 1)
                         {
                             Main.mouseItem = new Item();
                         }
                         if (Main.mouseItem.type > 0 || Main.player[Main.myPlayer].armor[num98].type > 0)
                         {
                             Recipe.FindRecipes();
                             Main.PlaySound(7, -1, -1, 1);
                         }
                     }
                     text15 = Main.player[Main.myPlayer].armor[num98].name;
                     Main.toolTip = (Item)Main.player[Main.myPlayer].armor[num98].Clone();
                     if (num98 <= 2)
                     {
                         Main.toolTip.wornArmor = true;
                     }
                     if (Main.player[Main.myPlayer].armor[num98].stack > 1)
                     {
                         object obj = text15;
                         text15 = string.Concat(new object[]
                         {
                             obj,
                             " (",
                             Main.player[Main.myPlayer].armor[num98].stack,
                             ")"
                         });
                     }
                 }
                 SpriteBatch arg_492B_0 = this.spriteBatch;
                 Texture2D arg_492B_1 = Main.inventoryBack3Texture;
                 Microsoft.Xna.Framework.Vector2 arg_492B_2 = new Microsoft.Xna.Framework.Vector2((float)num99, (float)num100);
                 Microsoft.Xna.Framework.Rectangle? arg_492B_3 = new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.inventoryBackTexture.Width, Main.inventoryBackTexture.Height));
                 Microsoft.Xna.Framework.Color arg_492B_4 = color2;
                 float arg_492B_5 = 0f;
                 origin = default(Microsoft.Xna.Framework.Vector2);
                 arg_492B_0.Draw(arg_492B_1, arg_492B_2, arg_492B_3, arg_492B_4, arg_492B_5, origin, Main.inventoryScale, SpriteEffects.None, 0f);
                 white4 = Microsoft.Xna.Framework.Color.White;
                 if (Main.player[Main.myPlayer].armor[num98].type > 0 && Main.player[Main.myPlayer].armor[num98].stack > 0)
                 {
                     float num101 = 1f;
                     if (Main.itemTexture[Main.player[Main.myPlayer].armor[num98].type].Width > 32 || Main.itemTexture[Main.player[Main.myPlayer].armor[num98].type].Height > 32)
                     {
                         if (Main.itemTexture[Main.player[Main.myPlayer].armor[num98].type].Width > Main.itemTexture[Main.player[Main.myPlayer].armor[num98].type].Height)
                         {
                             num101 = 32f / (float)Main.itemTexture[Main.player[Main.myPlayer].armor[num98].type].Width;
                         }
                         else
                         {
                             num101 = 32f / (float)Main.itemTexture[Main.player[Main.myPlayer].armor[num98].type].Height;
                         }
                     }
                     num101 *= Main.inventoryScale;
                     SpriteBatch arg_4BA1_0 = this.spriteBatch;
                     Texture2D arg_4BA1_1 = Main.itemTexture[Main.player[Main.myPlayer].armor[num98].type];
                     Microsoft.Xna.Framework.Vector2 arg_4BA1_2 = new Microsoft.Xna.Framework.Vector2((float)num99 + 26f * Main.inventoryScale - (float)Main.itemTexture[Main.player[Main.myPlayer].armor[num98].type].Width * 0.5f * num101, (float)num100 + 26f * Main.inventoryScale - (float)Main.itemTexture[Main.player[Main.myPlayer].armor[num98].type].Height * 0.5f * num101);
                     Microsoft.Xna.Framework.Rectangle? arg_4BA1_3 = new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.itemTexture[Main.player[Main.myPlayer].armor[num98].type].Width, Main.itemTexture[Main.player[Main.myPlayer].armor[num98].type].Height));
                     Microsoft.Xna.Framework.Color arg_4BA1_4 = Main.player[Main.myPlayer].armor[num98].GetAlpha(white4);
                     float arg_4BA1_5 = 0f;
                     origin = default(Microsoft.Xna.Framework.Vector2);
                     arg_4BA1_0.Draw(arg_4BA1_1, arg_4BA1_2, arg_4BA1_3, arg_4BA1_4, arg_4BA1_5, origin, num101, SpriteEffects.None, 0f);
                     Microsoft.Xna.Framework.Color arg_4BCC_0 = Main.player[Main.myPlayer].armor[num98].color;
                     Microsoft.Xna.Framework.Color b = default(Microsoft.Xna.Framework.Color);
                     if (arg_4BCC_0 != b)
                     {
                         SpriteBatch arg_4D00_0 = this.spriteBatch;
                         Texture2D arg_4D00_1 = Main.itemTexture[Main.player[Main.myPlayer].armor[num98].type];
                         Microsoft.Xna.Framework.Vector2 arg_4D00_2 = new Microsoft.Xna.Framework.Vector2((float)num99 + 26f * Main.inventoryScale - (float)Main.itemTexture[Main.player[Main.myPlayer].armor[num98].type].Width * 0.5f * num101, (float)num100 + 26f * Main.inventoryScale - (float)Main.itemTexture[Main.player[Main.myPlayer].armor[num98].type].Height * 0.5f * num101);
                         Microsoft.Xna.Framework.Rectangle? arg_4D00_3 = new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.itemTexture[Main.player[Main.myPlayer].armor[num98].type].Width, Main.itemTexture[Main.player[Main.myPlayer].armor[num98].type].Height));
                         Microsoft.Xna.Framework.Color arg_4D00_4 = Main.player[Main.myPlayer].armor[num98].GetColor(white4);
                         float arg_4D00_5 = 0f;
                         origin = default(Microsoft.Xna.Framework.Vector2);
                         arg_4D00_0.Draw(arg_4D00_1, arg_4D00_2, arg_4D00_3, arg_4D00_4, arg_4D00_5, origin, num101, SpriteEffects.None, 0f);
                     }
                     if (Main.player[Main.myPlayer].armor[num98].stack > 1)
                     {
                         SpriteBatch arg_4D8D_0 = this.spriteBatch;
                         SpriteFont arg_4D8D_1 = Main.fontItemStack;
                         string arg_4D8D_2 = string.Concat(Main.player[Main.myPlayer].armor[num98].stack);
                         Microsoft.Xna.Framework.Vector2 arg_4D8D_3 = new Microsoft.Xna.Framework.Vector2((float)num99 + 10f * Main.inventoryScale, (float)num100 + 26f * Main.inventoryScale);
                         Microsoft.Xna.Framework.Color arg_4D8D_4 = white4;
                         float arg_4D8D_5 = 0f;
                         origin = default(Microsoft.Xna.Framework.Vector2);
                         arg_4D8D_0.DrawString(arg_4D8D_1, arg_4D8D_2, arg_4D8D_3, arg_4D8D_4, arg_4D8D_5, origin, num101, SpriteEffects.None, 0f);
                     }
                 }
             }
             SpriteBatch arg_4E00_0 = this.spriteBatch;
             SpriteFont arg_4E00_1 = Main.fontMouseText;
             string arg_4E00_2 = "Social";
             Microsoft.Xna.Framework.Vector2 arg_4E00_3 = new Microsoft.Xna.Framework.Vector2((float)(Main.screenWidth - 64 - 28 - 44), 152f);
             Microsoft.Xna.Framework.Color arg_4E00_4 = new Microsoft.Xna.Framework.Color((int)Main.mouseTextColor, (int)Main.mouseTextColor, (int)Main.mouseTextColor, (int)Main.mouseTextColor);
             float arg_4E00_5 = 0f;
             origin = default(Microsoft.Xna.Framework.Vector2);
             arg_4E00_0.DrawString(arg_4E00_1, arg_4E00_2, arg_4E00_3, arg_4E00_4, arg_4E00_5, origin, 0.8f, SpriteEffects.None, 0f);
             if (Main.mouseX > Main.screenWidth - 64 - 28 - 47 && Main.mouseX < (int)((float)(Main.screenWidth - 64 - 20 - 47) + 56f * Main.inventoryScale) && Main.mouseY > 174 && Main.mouseY < (int)(174f + 168f * Main.inventoryScale))
             {
                 Main.player[Main.myPlayer].mouseInterface = true;
             }
             for (int num102 = 8; num102 < 11; num102++)
             {
                 int num103 = Main.screenWidth - 64 - 28 - 47;
                 int num104 = (int)(174f + (float)((num102 - 8) * 56) * Main.inventoryScale);
                 Microsoft.Xna.Framework.Color white5 = new Microsoft.Xna.Framework.Color(100, 100, 100, 100);
                 string text19 = "";
                 if (num102 == 8)
                 {
                     text19 = "Helmet";
                 }
                 else
                 {
                     if (num102 == 9)
                     {
                         text19 = "Shirt";
                     }
                     else
                     {
                         if (num102 == 10)
                         {
                             text19 = "Pants";
                         }
                     }
                 }
                 Microsoft.Xna.Framework.Vector2 vector6 = Main.fontMouseText.MeasureString(text19);
                 SpriteBatch arg_4F56_0 = this.spriteBatch;
                 SpriteFont arg_4F56_1 = Main.fontMouseText;
                 string arg_4F56_2 = text19;
                 Microsoft.Xna.Framework.Vector2 arg_4F56_3 = new Microsoft.Xna.Framework.Vector2((float)num103 - vector6.X - 10f, (float)num104 + (float)Main.inventoryBackTexture.Height * 0.5f - vector6.Y * 0.5f);
                 Microsoft.Xna.Framework.Color arg_4F56_4 = color5;
                 float arg_4F56_5 = 0f;
                 origin = default(Microsoft.Xna.Framework.Vector2);
                 arg_4F56_0.DrawString(arg_4F56_1, arg_4F56_2, arg_4F56_3, arg_4F56_4, arg_4F56_5, origin, 1f, SpriteEffects.None, 0f);
                 if (Main.mouseX >= num103 && (float)Main.mouseX <= (float)num103 + (float)Main.inventoryBackTexture.Width * Main.inventoryScale && Main.mouseY >= num104 && (float)Main.mouseY <= (float)num104 + (float)Main.inventoryBackTexture.Height * Main.inventoryScale)
                 {
                     Main.player[Main.myPlayer].mouseInterface = true;
                     Main.armorHide = true;
                     if (Main.mouseLeftRelease && Main.mouseLeft)
                     {
                         if (Main.mouseItem.type == 0 || (Main.mouseItem.headSlot > -1 && num102 == 8) || (Main.mouseItem.bodySlot > -1 && num102 == 9) || (Main.mouseItem.legSlot > -1 && num102 == 10))
                         {
                             Item item4 = Main.mouseItem;
                             Main.mouseItem = Main.player[Main.myPlayer].armor[num102];
                             Main.player[Main.myPlayer].armor[num102] = item4;
                             if (Main.player[Main.myPlayer].armor[num102].type == 0 || Main.player[Main.myPlayer].armor[num102].stack < 1)
                             {
                                 Main.player[Main.myPlayer].armor[num102] = new Item();
                             }
                             if (Main.mouseItem.type == 0 || Main.mouseItem.stack < 1)
                             {
                                 Main.mouseItem = new Item();
                             }
                             if (Main.mouseItem.type > 0 || Main.player[Main.myPlayer].armor[num102].type > 0)
                             {
                                 Recipe.FindRecipes();
                                 Main.PlaySound(7, -1, -1, 1);
                             }
                         }
                     }
                     else
                     {
                         if (Main.mouseRight && Main.mouseRightRelease && Main.player[Main.myPlayer].armor[num102].maxStack == 1)
                         {
                             Main.player[Main.myPlayer].armor[num102] = Main.armorSwap(Main.player[Main.myPlayer].armor[num102]);
                         }
                     }
                     text15 = Main.player[Main.myPlayer].armor[num102].name;
                     Main.toolTip = (Item)Main.player[Main.myPlayer].armor[num102].Clone();
                     Main.toolTip.social = true;
                     if (num102 <= 2)
                     {
                         Main.toolTip.wornArmor = true;
                     }
                     if (Main.player[Main.myPlayer].armor[num102].stack > 1)
                     {
                         object obj = text15;
                         text15 = string.Concat(new object[]
                         {
                             obj,
                             " (",
                             Main.player[Main.myPlayer].armor[num102].stack,
                             ")"
                         });
                     }
                 }
                 SpriteBatch arg_527E_0 = this.spriteBatch;
                 Texture2D arg_527E_1 = Main.inventoryBack8Texture;
                 Microsoft.Xna.Framework.Vector2 arg_527E_2 = new Microsoft.Xna.Framework.Vector2((float)num103, (float)num104);
                 Microsoft.Xna.Framework.Rectangle? arg_527E_3 = new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.inventoryBackTexture.Width, Main.inventoryBackTexture.Height));
                 Microsoft.Xna.Framework.Color arg_527E_4 = color2;
                 float arg_527E_5 = 0f;
                 origin = default(Microsoft.Xna.Framework.Vector2);
                 arg_527E_0.Draw(arg_527E_1, arg_527E_2, arg_527E_3, arg_527E_4, arg_527E_5, origin, Main.inventoryScale, SpriteEffects.None, 0f);
                 white5 = Microsoft.Xna.Framework.Color.White;
                 if (Main.player[Main.myPlayer].armor[num102].type > 0 && Main.player[Main.myPlayer].armor[num102].stack > 0)
                 {
                     float num105 = 1f;
                     if (Main.itemTexture[Main.player[Main.myPlayer].armor[num102].type].Width > 32 || Main.itemTexture[Main.player[Main.myPlayer].armor[num102].type].Height > 32)
                     {
                         if (Main.itemTexture[Main.player[Main.myPlayer].armor[num102].type].Width > Main.itemTexture[Main.player[Main.myPlayer].armor[num102].type].Height)
                         {
                             num105 = 32f / (float)Main.itemTexture[Main.player[Main.myPlayer].armor[num102].type].Width;
                         }
                         else
                         {
                             num105 = 32f / (float)Main.itemTexture[Main.player[Main.myPlayer].armor[num102].type].Height;
                         }
                     }
                     num105 *= Main.inventoryScale;
                     SpriteBatch arg_54F4_0 = this.spriteBatch;
                     Texture2D arg_54F4_1 = Main.itemTexture[Main.player[Main.myPlayer].armor[num102].type];
                     Microsoft.Xna.Framework.Vector2 arg_54F4_2 = new Microsoft.Xna.Framework.Vector2((float)num103 + 26f * Main.inventoryScale - (float)Main.itemTexture[Main.player[Main.myPlayer].armor[num102].type].Width * 0.5f * num105, (float)num104 + 26f * Main.inventoryScale - (float)Main.itemTexture[Main.player[Main.myPlayer].armor[num102].type].Height * 0.5f * num105);
                     Microsoft.Xna.Framework.Rectangle? arg_54F4_3 = new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.itemTexture[Main.player[Main.myPlayer].armor[num102].type].Width, Main.itemTexture[Main.player[Main.myPlayer].armor[num102].type].Height));
                     Microsoft.Xna.Framework.Color arg_54F4_4 = Main.player[Main.myPlayer].armor[num102].GetAlpha(white5);
                     float arg_54F4_5 = 0f;
                     origin = default(Microsoft.Xna.Framework.Vector2);
                     arg_54F4_0.Draw(arg_54F4_1, arg_54F4_2, arg_54F4_3, arg_54F4_4, arg_54F4_5, origin, num105, SpriteEffects.None, 0f);
                     Microsoft.Xna.Framework.Color arg_551F_0 = Main.player[Main.myPlayer].armor[num102].color;
                     Microsoft.Xna.Framework.Color b = default(Microsoft.Xna.Framework.Color);
                     if (arg_551F_0 != b)
                     {
                         SpriteBatch arg_5653_0 = this.spriteBatch;
                         Texture2D arg_5653_1 = Main.itemTexture[Main.player[Main.myPlayer].armor[num102].type];
                         Microsoft.Xna.Framework.Vector2 arg_5653_2 = new Microsoft.Xna.Framework.Vector2((float)num103 + 26f * Main.inventoryScale - (float)Main.itemTexture[Main.player[Main.myPlayer].armor[num102].type].Width * 0.5f * num105, (float)num104 + 26f * Main.inventoryScale - (float)Main.itemTexture[Main.player[Main.myPlayer].armor[num102].type].Height * 0.5f * num105);
                         Microsoft.Xna.Framework.Rectangle? arg_5653_3 = new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.itemTexture[Main.player[Main.myPlayer].armor[num102].type].Width, Main.itemTexture[Main.player[Main.myPlayer].armor[num102].type].Height));
                         Microsoft.Xna.Framework.Color arg_5653_4 = Main.player[Main.myPlayer].armor[num102].GetColor(white5);
                         float arg_5653_5 = 0f;
                         origin = default(Microsoft.Xna.Framework.Vector2);
                         arg_5653_0.Draw(arg_5653_1, arg_5653_2, arg_5653_3, arg_5653_4, arg_5653_5, origin, num105, SpriteEffects.None, 0f);
                     }
                     if (Main.player[Main.myPlayer].armor[num102].stack > 1)
                     {
                         SpriteBatch arg_56E0_0 = this.spriteBatch;
                         SpriteFont arg_56E0_1 = Main.fontItemStack;
                         string arg_56E0_2 = string.Concat(Main.player[Main.myPlayer].armor[num102].stack);
                         Microsoft.Xna.Framework.Vector2 arg_56E0_3 = new Microsoft.Xna.Framework.Vector2((float)num103 + 10f * Main.inventoryScale, (float)num104 + 26f * Main.inventoryScale);
                         Microsoft.Xna.Framework.Color arg_56E0_4 = white5;
                         float arg_56E0_5 = 0f;
                         origin = default(Microsoft.Xna.Framework.Vector2);
                         arg_56E0_0.DrawString(arg_56E0_1, arg_56E0_2, arg_56E0_3, arg_56E0_4, arg_56E0_5, origin, num105, SpriteEffects.None, 0f);
                     }
                 }
             }
         }
         int num106 = (Main.screenHeight - 600) / 2;
         int num107 = (int)((float)Main.screenHeight / 600f * 250f);
         if (Main.craftingHide)
         {
             Main.craftingAlpha -= 0.1f;
             if (Main.craftingAlpha < 0f)
             {
                 Main.craftingAlpha = 0f;
             }
         }
         else
         {
             Main.craftingAlpha += 0.025f;
             if (Main.craftingAlpha > 1f)
             {
                 Main.craftingAlpha = 1f;
             }
         }
         Microsoft.Xna.Framework.Color color6 = new Microsoft.Xna.Framework.Color((int)((byte)((float)Main.mouseTextColor * Main.craftingAlpha)), (int)((byte)((float)Main.mouseTextColor * Main.craftingAlpha)), (int)((byte)((float)Main.mouseTextColor * Main.craftingAlpha)), (int)((byte)((float)Main.mouseTextColor * Main.craftingAlpha)));
         Main.craftingHide = false;
         if (Main.reforge)
         {
             if (Main.mouseReforge)
             {
                 if ((double)Main.reforgeScale < 1.3)
                 {
                     Main.reforgeScale += 0.02f;
                 }
             }
             else
             {
                 if (Main.reforgeScale > 1f)
                 {
                     Main.reforgeScale -= 0.02f;
                 }
             }
             if (Main.player[Main.myPlayer].chest != -1 || Main.npcShop != 0 || Main.player[Main.myPlayer].talkNPC == -1 || Main.craftGuide)
             {
                 Main.reforge = false;
                 Main.player[Main.myPlayer].dropItemCheck();
                 Recipe.FindRecipes();
             }
             else
             {
                 int num108 = 101;
                 int num109 = 241;
                 string text20 = "Cost: ";
                 if (Main.reforgeItem.type > 0)
                 {
                     int value2 = Main.reforgeItem.value;
                     string text21 = "";
                     int num110 = 0;
                     int num111 = 0;
                     int num112 = 0;
                     int num113 = 0;
                     int num114 = value2;
                     if (num114 < 1)
                     {
                         num114 = 1;
                     }
                     if (num114 >= 1000000)
                     {
                         num110 = num114 / 1000000;
                         num114 -= num110 * 1000000;
                     }
                     if (num114 >= 10000)
                     {
                         num111 = num114 / 10000;
                         num114 -= num111 * 10000;
                     }
                     if (num114 >= 100)
                     {
                         num112 = num114 / 100;
                         num114 -= num112 * 100;
                     }
                     if (num114 >= 1)
                     {
                         num113 = num114;
                     }
                     if (num110 > 0)
                     {
                         text21 = text21 + num110 + " platinum ";
                     }
                     if (num111 > 0)
                     {
                         text21 = text21 + num111 + " gold ";
                     }
                     if (num112 > 0)
                     {
                         text21 = text21 + num112 + " silver ";
                     }
                     if (num113 > 0)
                     {
                         text21 = text21 + num113 + " copper ";
                     }
                     float num115 = (float)Main.mouseTextColor / 255f;
                     Microsoft.Xna.Framework.Color white6 = Microsoft.Xna.Framework.Color.White;
                     if (num110 > 0)
                     {
                         white6 = new Microsoft.Xna.Framework.Color((int)((byte)(220f * num115)), (int)((byte)(220f * num115)), (int)((byte)(198f * num115)), (int)Main.mouseTextColor);
                     }
                     else
                     {
                         if (num111 > 0)
                         {
                             white6 = new Microsoft.Xna.Framework.Color((int)((byte)(224f * num115)), (int)((byte)(201f * num115)), (int)((byte)(92f * num115)), (int)Main.mouseTextColor);
                         }
                         else
                         {
                             if (num112 > 0)
                             {
                                 white6 = new Microsoft.Xna.Framework.Color((int)((byte)(181f * num115)), (int)((byte)(192f * num115)), (int)((byte)(193f * num115)), (int)Main.mouseTextColor);
                             }
                             else
                             {
                                 if (num113 > 0)
                                 {
                                     white6 = new Microsoft.Xna.Framework.Color((int)((byte)(246f * num115)), (int)((byte)(138f * num115)), (int)((byte)(96f * num115)), (int)Main.mouseTextColor);
                                 }
                             }
                         }
                     }
                     SpriteBatch arg_5A82_0 = this.spriteBatch;
                     SpriteFont arg_5A82_1 = Main.fontMouseText;
                     string arg_5A82_2 = text21;
                     Microsoft.Xna.Framework.Vector2 arg_5A82_3 = new Microsoft.Xna.Framework.Vector2((float)(num108 + 50) + Main.fontMouseText.MeasureString(text20).X, (float)num109);
                     Microsoft.Xna.Framework.Color arg_5A82_4 = white6;
                     float arg_5A82_5 = 0f;
                     origin = default(Microsoft.Xna.Framework.Vector2);
                     arg_5A82_0.DrawString(arg_5A82_1, arg_5A82_2, arg_5A82_3, arg_5A82_4, arg_5A82_5, origin, 1f, SpriteEffects.None, 0f);
                     int num116 = num108 + 70;
                     int num117 = num109 + 40;
                     this.spriteBatch.Draw(Main.reforgeTexture, new Microsoft.Xna.Framework.Vector2((float)num116, (float)num117), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.reforgeTexture.Width, Main.reforgeTexture.Height)), Microsoft.Xna.Framework.Color.White, 0f, new Microsoft.Xna.Framework.Vector2((float)(Main.reforgeTexture.Width / 2), (float)(Main.reforgeTexture.Height / 2)), Main.reforgeScale, SpriteEffects.None, 0f);
                     if (Main.mouseX > num116 - Main.reforgeTexture.Width / 2 && Main.mouseX < num116 + Main.reforgeTexture.Width / 2 && Main.mouseY > num117 - Main.reforgeTexture.Height / 2 && Main.mouseY < num117 + Main.reforgeTexture.Height / 2)
                     {
                         text15 = "Reforge";
                         if (!Main.mouseReforge)
                         {
                             Main.PlaySound(12, -1, -1, 1);
                         }
                         Main.mouseReforge = true;
                         Main.player[Main.myPlayer].mouseInterface = true;
                         if (Main.mouseLeftRelease && Main.mouseLeft && Main.player[Main.myPlayer].BuyItem(value2))
                         {
                             Main.reforgeItem.SetDefaults(Main.reforgeItem.name);
                             Main.reforgeItem.Prefix(-2);
                             Main.reforgeItem.position.X = Main.player[Main.myPlayer].position.X + (float)(Main.player[Main.myPlayer].width / 2) - (float)(Main.reforgeItem.width / 2);
                             Main.reforgeItem.position.Y = Main.player[Main.myPlayer].position.Y + (float)(Main.player[Main.myPlayer].height / 2) - (float)(Main.reforgeItem.height / 2);
                             ItemText.NewText(Main.reforgeItem, Main.reforgeItem.stack);
                             Main.PlaySound(2, -1, -1, 37);
                         }
                     }
                     else
                     {
                         Main.mouseReforge = false;
                     }
                 }
                 else
                 {
                     text20 = "Place an item here to reforge";
                 }
                 SpriteBatch arg_5CF0_0 = this.spriteBatch;
                 SpriteFont arg_5CF0_1 = Main.fontMouseText;
                 string arg_5CF0_2 = text20;
                 Microsoft.Xna.Framework.Vector2 arg_5CF0_3 = new Microsoft.Xna.Framework.Vector2((float)(num108 + 50), (float)num109);
                 Microsoft.Xna.Framework.Color arg_5CF0_4 = new Microsoft.Xna.Framework.Color((int)Main.mouseTextColor, (int)Main.mouseTextColor, (int)Main.mouseTextColor, (int)Main.mouseTextColor);
                 float arg_5CF0_5 = 0f;
                 origin = default(Microsoft.Xna.Framework.Vector2);
                 arg_5CF0_0.DrawString(arg_5CF0_1, arg_5CF0_2, arg_5CF0_3, arg_5CF0_4, arg_5CF0_5, origin, 1f, SpriteEffects.None, 0f);
                 Microsoft.Xna.Framework.Color white7 = new Microsoft.Xna.Framework.Color(100, 100, 100, 100);
                 if (Main.mouseX >= num108 && (float)Main.mouseX <= (float)num108 + (float)Main.inventoryBackTexture.Width * Main.inventoryScale && Main.mouseY >= num109 && (float)Main.mouseY <= (float)num109 + (float)Main.inventoryBackTexture.Height * Main.inventoryScale)
                 {
                     Main.player[Main.myPlayer].mouseInterface = true;
                     Main.craftingHide = true;
                     if (Main.mouseItem.Prefix(-3) || Main.mouseItem.type == 0)
                     {
                         if (Main.mouseLeftRelease && Main.mouseLeft)
                         {
                             Item item5 = Main.mouseItem;
                             Main.mouseItem = Main.reforgeItem;
                             Main.reforgeItem = item5;
                             if (Main.reforgeItem.type == 0 || Main.reforgeItem.stack < 1)
                             {
                                 Main.reforgeItem = new Item();
                             }
                             if (Main.mouseItem.IsTheSameAs(Main.reforgeItem) && Main.reforgeItem.stack != Main.reforgeItem.maxStack && Main.mouseItem.stack != Main.mouseItem.maxStack)
                             {
                                 if (Main.mouseItem.stack + Main.reforgeItem.stack <= Main.mouseItem.maxStack)
                                 {
                                     Main.reforgeItem.stack += Main.mouseItem.stack;
                                     Main.mouseItem.stack = 0;
                                 }
                                 else
                                 {
                                     int num118 = Main.mouseItem.maxStack - Main.reforgeItem.stack;
                                     Main.reforgeItem.stack += num118;
                                     Main.mouseItem.stack -= num118;
                                 }
                             }
                             if (Main.mouseItem.type == 0 || Main.mouseItem.stack < 1)
                             {
                                 Main.mouseItem = new Item();
                             }
                             if (Main.mouseItem.type > 0 || Main.reforgeItem.type > 0)
                             {
                                 Recipe.FindRecipes();
                                 Main.PlaySound(7, -1, -1, 1);
                             }
                         }
                         else
                         {
                             if (Main.stackSplit <= 1 && Main.mouseRight && (Main.mouseItem.IsTheSameAs(Main.reforgeItem) || Main.mouseItem.type == 0) && (Main.mouseItem.stack < Main.mouseItem.maxStack || Main.mouseItem.type == 0))
                             {
                                 if (Main.mouseItem.type == 0)
                                 {
                                     Main.mouseItem = (Item)Main.reforgeItem.Clone();
                                     Main.mouseItem.stack = 0;
                                 }
                                 Main.mouseItem.stack++;
                                 Main.reforgeItem.stack--;
                                 if (Main.reforgeItem.stack <= 0)
                                 {
                                     Main.reforgeItem = new Item();
                                 }
                                 Recipe.FindRecipes();
                                 Main.soundInstanceMenuTick.Stop();
                                 Main.soundInstanceMenuTick = Main.soundMenuTick.CreateInstance();
                                 Main.PlaySound(12, -1, -1, 1);
                                 if (Main.stackSplit == 0)
                                 {
                                     Main.stackSplit = 15;
                                 }
                                 else
                                 {
                                     Main.stackSplit = Main.stackDelay;
                                 }
                             }
                         }
                     }
                     text15 = Main.reforgeItem.name;
                     Main.toolTip = (Item)Main.reforgeItem.Clone();
                     if (Main.reforgeItem.stack > 1)
                     {
                         object obj = text15;
                         text15 = string.Concat(new object[]
                         {
                             obj,
                             " (",
                             Main.reforgeItem.stack,
                             ")"
                         });
                     }
                 }
                 SpriteBatch arg_60D3_0 = this.spriteBatch;
                 Texture2D arg_60D3_1 = Main.inventoryBack4Texture;
                 Microsoft.Xna.Framework.Vector2 arg_60D3_2 = new Microsoft.Xna.Framework.Vector2((float)num108, (float)num109);
                 Microsoft.Xna.Framework.Rectangle? arg_60D3_3 = new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.inventoryBackTexture.Width, Main.inventoryBackTexture.Height));
                 Microsoft.Xna.Framework.Color arg_60D3_4 = color2;
                 float arg_60D3_5 = 0f;
                 origin = default(Microsoft.Xna.Framework.Vector2);
                 arg_60D3_0.Draw(arg_60D3_1, arg_60D3_2, arg_60D3_3, arg_60D3_4, arg_60D3_5, origin, Main.inventoryScale, SpriteEffects.None, 0f);
                 white7 = Microsoft.Xna.Framework.Color.White;
                 if (Main.reforgeItem.type > 0 && Main.reforgeItem.stack > 0)
                 {
                     float num119 = 1f;
                     if (Main.itemTexture[Main.reforgeItem.type].Width > 32 || Main.itemTexture[Main.reforgeItem.type].Height > 32)
                     {
                         if (Main.itemTexture[Main.reforgeItem.type].Width > Main.itemTexture[Main.reforgeItem.type].Height)
                         {
                             num119 = 32f / (float)Main.itemTexture[Main.reforgeItem.type].Width;
                         }
                         else
                         {
                             num119 = 32f / (float)Main.itemTexture[Main.reforgeItem.type].Height;
                         }
                     }
                     num119 *= Main.inventoryScale;
                     SpriteBatch arg_6282_0 = this.spriteBatch;
                     Texture2D arg_6282_1 = Main.itemTexture[Main.reforgeItem.type];
                     Microsoft.Xna.Framework.Vector2 arg_6282_2 = new Microsoft.Xna.Framework.Vector2((float)num108 + 26f * Main.inventoryScale - (float)Main.itemTexture[Main.reforgeItem.type].Width * 0.5f * num119, (float)num109 + 26f * Main.inventoryScale - (float)Main.itemTexture[Main.reforgeItem.type].Height * 0.5f * num119);
                     Microsoft.Xna.Framework.Rectangle? arg_6282_3 = new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.itemTexture[Main.reforgeItem.type].Width, Main.itemTexture[Main.reforgeItem.type].Height));
                     Microsoft.Xna.Framework.Color arg_6282_4 = Main.reforgeItem.GetAlpha(white7);
                     float arg_6282_5 = 0f;
                     origin = default(Microsoft.Xna.Framework.Vector2);
                     arg_6282_0.Draw(arg_6282_1, arg_6282_2, arg_6282_3, arg_6282_4, arg_6282_5, origin, num119, SpriteEffects.None, 0f);
                     Microsoft.Xna.Framework.Color arg_629F_0 = Main.reforgeItem.color;
                     Microsoft.Xna.Framework.Color b = default(Microsoft.Xna.Framework.Color);
                     if (arg_629F_0 != b)
                     {
                         SpriteBatch arg_637F_0 = this.spriteBatch;
                         Texture2D arg_637F_1 = Main.itemTexture[Main.reforgeItem.type];
                         Microsoft.Xna.Framework.Vector2 arg_637F_2 = new Microsoft.Xna.Framework.Vector2((float)num108 + 26f * Main.inventoryScale - (float)Main.itemTexture[Main.reforgeItem.type].Width * 0.5f * num119, (float)num109 + 26f * Main.inventoryScale - (float)Main.itemTexture[Main.reforgeItem.type].Height * 0.5f * num119);
                         Microsoft.Xna.Framework.Rectangle? arg_637F_3 = new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.itemTexture[Main.reforgeItem.type].Width, Main.itemTexture[Main.reforgeItem.type].Height));
                         Microsoft.Xna.Framework.Color arg_637F_4 = Main.reforgeItem.GetColor(white7);
                         float arg_637F_5 = 0f;
                         origin = default(Microsoft.Xna.Framework.Vector2);
                         arg_637F_0.Draw(arg_637F_1, arg_637F_2, arg_637F_3, arg_637F_4, arg_637F_5, origin, num119, SpriteEffects.None, 0f);
                     }
                     if (Main.reforgeItem.stack > 1)
                     {
                         SpriteBatch arg_63F3_0 = this.spriteBatch;
                         SpriteFont arg_63F3_1 = Main.fontItemStack;
                         string arg_63F3_2 = string.Concat(Main.reforgeItem.stack);
                         Microsoft.Xna.Framework.Vector2 arg_63F3_3 = new Microsoft.Xna.Framework.Vector2((float)num108 + 10f * Main.inventoryScale, (float)num109 + 26f * Main.inventoryScale);
                         Microsoft.Xna.Framework.Color arg_63F3_4 = white7;
                         float arg_63F3_5 = 0f;
                         origin = default(Microsoft.Xna.Framework.Vector2);
                         arg_63F3_0.DrawString(arg_63F3_1, arg_63F3_2, arg_63F3_3, arg_63F3_4, arg_63F3_5, origin, num119, SpriteEffects.None, 0f);
                     }
                 }
             }
         }
         else
         {
             if (Main.craftGuide)
             {
                 if (Main.player[Main.myPlayer].chest != -1 || Main.npcShop != 0 || Main.player[Main.myPlayer].talkNPC == -1 || Main.reforge)
                 {
                     Main.craftGuide = false;
                     Main.player[Main.myPlayer].dropItemCheck();
                     Recipe.FindRecipes();
                 }
                 else
                 {
                     int num120 = 73;
                     int num121 = 331;
                     num121 += num106;
                     string text22;
                     if (Main.guideItem.type > 0)
                     {
                         text22 = "Showing recipes that use " + Main.guideItem.name;
                         SpriteBatch arg_64D1_0 = this.spriteBatch;
                         SpriteFont arg_64D1_1 = Main.fontMouseText;
                         string arg_64D1_2 = "Required objects:";
                         Microsoft.Xna.Framework.Vector2 arg_64D1_3 = new Microsoft.Xna.Framework.Vector2((float)num120, (float)(num121 + 118));
                         Microsoft.Xna.Framework.Color arg_64D1_4 = color6;
                         float arg_64D1_5 = 0f;
                         origin = default(Microsoft.Xna.Framework.Vector2);
                         arg_64D1_0.DrawString(arg_64D1_1, arg_64D1_2, arg_64D1_3, arg_64D1_4, arg_64D1_5, origin, 1f, SpriteEffects.None, 0f);
                         int num122 = Main.focusRecipe;
                         int num123 = 0;
                         int num124 = 0;
                         while (num124 < Recipe.maxRequirements)
                         {
                             int num125 = (num124 + 1) * 26;
                             if (Main.recipe[Main.availableRecipe[num122]].requiredTile[num124] == -1)
                             {
                                 if (num124 == 0 && !Main.recipe[Main.availableRecipe[num122]].needWater)
                                 {
                                     SpriteBatch arg_656A_0 = this.spriteBatch;
                                     SpriteFont arg_656A_1 = Main.fontMouseText;
                                     string arg_656A_2 = "None";
                                     Microsoft.Xna.Framework.Vector2 arg_656A_3 = new Microsoft.Xna.Framework.Vector2((float)num120, (float)(num121 + 118 + num125));
                                     Microsoft.Xna.Framework.Color arg_656A_4 = color6;
                                     float arg_656A_5 = 0f;
                                     origin = default(Microsoft.Xna.Framework.Vector2);
                                     arg_656A_0.DrawString(arg_656A_1, arg_656A_2, arg_656A_3, arg_656A_4, arg_656A_5, origin, 1f, SpriteEffects.None, 0f);
                                     break;
                                 }
                                 break;
                             }
                             else
                             {
                                 num123++;
                                 SpriteBatch arg_65CF_0 = this.spriteBatch;
                                 SpriteFont arg_65CF_1 = Main.fontMouseText;
                                 string arg_65CF_2 = Main.tileName[Main.recipe[Main.availableRecipe[num122]].requiredTile[num124]];
                                 Microsoft.Xna.Framework.Vector2 arg_65CF_3 = new Microsoft.Xna.Framework.Vector2((float)num120, (float)(num121 + 118 + num125));
                                 Microsoft.Xna.Framework.Color arg_65CF_4 = color6;
                                 float arg_65CF_5 = 0f;
                                 origin = default(Microsoft.Xna.Framework.Vector2);
                                 arg_65CF_0.DrawString(arg_65CF_1, arg_65CF_2, arg_65CF_3, arg_65CF_4, arg_65CF_5, origin, 1f, SpriteEffects.None, 0f);
                                 num124++;
                             }
                         }
                         if (Main.recipe[Main.availableRecipe[num122]].needWater)
                         {
                             int num126 = (num123 + 1) * 26;
                             SpriteBatch arg_6645_0 = this.spriteBatch;
                             SpriteFont arg_6645_1 = Main.fontMouseText;
                             string arg_6645_2 = "None";
                             Microsoft.Xna.Framework.Vector2 arg_6645_3 = new Microsoft.Xna.Framework.Vector2((float)num120, (float)(num121 + 118 + num126));
                             Microsoft.Xna.Framework.Color arg_6645_4 = color6;
                             float arg_6645_5 = 0f;
                             origin = default(Microsoft.Xna.Framework.Vector2);
                             arg_6645_0.DrawString(arg_6645_1, arg_6645_2, arg_6645_3, arg_6645_4, arg_6645_5, origin, 1f, SpriteEffects.None, 0f);
                         }
                     }
                     else
                     {
                         text22 = "Place a material here to show recipes";
                     }
                     SpriteBatch arg_66A8_0 = this.spriteBatch;
                     SpriteFont arg_66A8_1 = Main.fontMouseText;
                     string arg_66A8_2 = text22;
                     Microsoft.Xna.Framework.Vector2 arg_66A8_3 = new Microsoft.Xna.Framework.Vector2((float)(num120 + 50), (float)(num121 + 12));
                     Microsoft.Xna.Framework.Color arg_66A8_4 = new Microsoft.Xna.Framework.Color((int)Main.mouseTextColor, (int)Main.mouseTextColor, (int)Main.mouseTextColor, (int)Main.mouseTextColor);
                     float arg_66A8_5 = 0f;
                     origin = default(Microsoft.Xna.Framework.Vector2);
                     arg_66A8_0.DrawString(arg_66A8_1, arg_66A8_2, arg_66A8_3, arg_66A8_4, arg_66A8_5, origin, 1f, SpriteEffects.None, 0f);
                     Microsoft.Xna.Framework.Color white8 = new Microsoft.Xna.Framework.Color(100, 100, 100, 100);
                     if (Main.mouseX >= num120 && (float)Main.mouseX <= (float)num120 + (float)Main.inventoryBackTexture.Width * Main.inventoryScale && Main.mouseY >= num121 && (float)Main.mouseY <= (float)num121 + (float)Main.inventoryBackTexture.Height * Main.inventoryScale)
                     {
                         Main.player[Main.myPlayer].mouseInterface = true;
                         Main.craftingHide = true;
                         if (Main.mouseItem.material || Main.mouseItem.type == 0)
                         {
                             if (Main.mouseLeftRelease && Main.mouseLeft)
                             {
                                 Item item6 = Main.mouseItem;
                                 Main.mouseItem = Main.guideItem;
                                 Main.guideItem = item6;
                                 if (Main.guideItem.type == 0 || Main.guideItem.stack < 1)
                                 {
                                     Main.guideItem = new Item();
                                 }
                                 if (Main.mouseItem.IsTheSameAs(Main.guideItem) && Main.guideItem.stack != Main.guideItem.maxStack && Main.mouseItem.stack != Main.mouseItem.maxStack)
                                 {
                                     if (Main.mouseItem.stack + Main.guideItem.stack <= Main.mouseItem.maxStack)
                                     {
                                         Main.guideItem.stack += Main.mouseItem.stack;
                                         Main.mouseItem.stack = 0;
                                     }
                                     else
                                     {
                                         int num127 = Main.mouseItem.maxStack - Main.guideItem.stack;
                                         Main.guideItem.stack += num127;
                                         Main.mouseItem.stack -= num127;
                                     }
                                 }
                                 if (Main.mouseItem.type == 0 || Main.mouseItem.stack < 1)
                                 {
                                     Main.mouseItem = new Item();
                                 }
                                 if (Main.mouseItem.type > 0 || Main.guideItem.type > 0)
                                 {
                                     Recipe.FindRecipes();
                                     Main.PlaySound(7, -1, -1, 1);
                                 }
                             }
                             else
                             {
                                 if (Main.stackSplit <= 1 && Main.mouseRight && (Main.mouseItem.IsTheSameAs(Main.guideItem) || Main.mouseItem.type == 0) && (Main.mouseItem.stack < Main.mouseItem.maxStack || Main.mouseItem.type == 0))
                                 {
                                     if (Main.mouseItem.type == 0)
                                     {
                                         Main.mouseItem = (Item)Main.guideItem.Clone();
                                         Main.mouseItem.stack = 0;
                                     }
                                     Main.mouseItem.stack++;
                                     Main.guideItem.stack--;
                                     if (Main.guideItem.stack <= 0)
                                     {
                                         Main.guideItem = new Item();
                                     }
                                     Recipe.FindRecipes();
                                     Main.soundInstanceMenuTick.Stop();
                                     Main.soundInstanceMenuTick = Main.soundMenuTick.CreateInstance();
                                     Main.PlaySound(12, -1, -1, 1);
                                     if (Main.stackSplit == 0)
                                     {
                                         Main.stackSplit = 15;
                                     }
                                     else
                                     {
                                         Main.stackSplit = Main.stackDelay;
                                     }
                                 }
                             }
                         }
                         text15 = Main.guideItem.name;
                         Main.toolTip = (Item)Main.guideItem.Clone();
                         if (Main.guideItem.stack > 1)
                         {
                             object obj = text15;
                             text15 = string.Concat(new object[]
                             {
                                 obj,
                                 " (",
                                 Main.guideItem.stack,
                                 ")"
                             });
                         }
                     }
                     SpriteBatch arg_6A89_0 = this.spriteBatch;
                     Texture2D arg_6A89_1 = Main.inventoryBack4Texture;
                     Microsoft.Xna.Framework.Vector2 arg_6A89_2 = new Microsoft.Xna.Framework.Vector2((float)num120, (float)num121);
                     Microsoft.Xna.Framework.Rectangle? arg_6A89_3 = new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.inventoryBackTexture.Width, Main.inventoryBackTexture.Height));
                     Microsoft.Xna.Framework.Color arg_6A89_4 = color2;
                     float arg_6A89_5 = 0f;
                     origin = default(Microsoft.Xna.Framework.Vector2);
                     arg_6A89_0.Draw(arg_6A89_1, arg_6A89_2, arg_6A89_3, arg_6A89_4, arg_6A89_5, origin, Main.inventoryScale, SpriteEffects.None, 0f);
                     white8 = Microsoft.Xna.Framework.Color.White;
                     if (Main.guideItem.type > 0 && Main.guideItem.stack > 0)
                     {
                         float num128 = 1f;
                         if (Main.itemTexture[Main.guideItem.type].Width > 32 || Main.itemTexture[Main.guideItem.type].Height > 32)
                         {
                             if (Main.itemTexture[Main.guideItem.type].Width > Main.itemTexture[Main.guideItem.type].Height)
                             {
                                 num128 = 32f / (float)Main.itemTexture[Main.guideItem.type].Width;
                             }
                             else
                             {
                                 num128 = 32f / (float)Main.itemTexture[Main.guideItem.type].Height;
                             }
                         }
                         num128 *= Main.inventoryScale;
                         SpriteBatch arg_6C38_0 = this.spriteBatch;
                         Texture2D arg_6C38_1 = Main.itemTexture[Main.guideItem.type];
                         Microsoft.Xna.Framework.Vector2 arg_6C38_2 = new Microsoft.Xna.Framework.Vector2((float)num120 + 26f * Main.inventoryScale - (float)Main.itemTexture[Main.guideItem.type].Width * 0.5f * num128, (float)num121 + 26f * Main.inventoryScale - (float)Main.itemTexture[Main.guideItem.type].Height * 0.5f * num128);
                         Microsoft.Xna.Framework.Rectangle? arg_6C38_3 = new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.itemTexture[Main.guideItem.type].Width, Main.itemTexture[Main.guideItem.type].Height));
                         Microsoft.Xna.Framework.Color arg_6C38_4 = Main.guideItem.GetAlpha(white8);
                         float arg_6C38_5 = 0f;
                         origin = default(Microsoft.Xna.Framework.Vector2);
                         arg_6C38_0.Draw(arg_6C38_1, arg_6C38_2, arg_6C38_3, arg_6C38_4, arg_6C38_5, origin, num128, SpriteEffects.None, 0f);
                         Microsoft.Xna.Framework.Color arg_6C55_0 = Main.guideItem.color;
                         Microsoft.Xna.Framework.Color b = default(Microsoft.Xna.Framework.Color);
                         if (arg_6C55_0 != b)
                         {
                             SpriteBatch arg_6D35_0 = this.spriteBatch;
                             Texture2D arg_6D35_1 = Main.itemTexture[Main.guideItem.type];
                             Microsoft.Xna.Framework.Vector2 arg_6D35_2 = new Microsoft.Xna.Framework.Vector2((float)num120 + 26f * Main.inventoryScale - (float)Main.itemTexture[Main.guideItem.type].Width * 0.5f * num128, (float)num121 + 26f * Main.inventoryScale - (float)Main.itemTexture[Main.guideItem.type].Height * 0.5f * num128);
                             Microsoft.Xna.Framework.Rectangle? arg_6D35_3 = new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.itemTexture[Main.guideItem.type].Width, Main.itemTexture[Main.guideItem.type].Height));
                             Microsoft.Xna.Framework.Color arg_6D35_4 = Main.guideItem.GetColor(white8);
                             float arg_6D35_5 = 0f;
                             origin = default(Microsoft.Xna.Framework.Vector2);
                             arg_6D35_0.Draw(arg_6D35_1, arg_6D35_2, arg_6D35_3, arg_6D35_4, arg_6D35_5, origin, num128, SpriteEffects.None, 0f);
                         }
                         if (Main.guideItem.stack > 1)
                         {
                             SpriteBatch arg_6DA6_0 = this.spriteBatch;
                             SpriteFont arg_6DA6_1 = Main.fontItemStack;
                             string arg_6DA6_2 = string.Concat(Main.guideItem.stack);
                             Microsoft.Xna.Framework.Vector2 arg_6DA6_3 = new Microsoft.Xna.Framework.Vector2((float)num120 + 10f * Main.inventoryScale, (float)num121 + 26f * Main.inventoryScale);
                             Microsoft.Xna.Framework.Color arg_6DA6_4 = white8;
                             float arg_6DA6_5 = 0f;
                             origin = default(Microsoft.Xna.Framework.Vector2);
                             arg_6DA6_0.DrawString(arg_6DA6_1, arg_6DA6_2, arg_6DA6_3, arg_6DA6_4, arg_6DA6_5, origin, num128, SpriteEffects.None, 0f);
                         }
                     }
                 }
             }
         }
         if (!Main.reforge)
         {
             if (Main.numAvailableRecipes > 0)
             {
                 SpriteBatch arg_6E00_0 = this.spriteBatch;
                 SpriteFont arg_6E00_1 = Main.fontMouseText;
                 string arg_6E00_2 = "Crafting";
                 Microsoft.Xna.Framework.Vector2 arg_6E00_3 = new Microsoft.Xna.Framework.Vector2(76f, (float)(414 + num106));
                 Microsoft.Xna.Framework.Color arg_6E00_4 = color6;
                 float arg_6E00_5 = 0f;
                 origin = default(Microsoft.Xna.Framework.Vector2);
                 arg_6E00_0.DrawString(arg_6E00_1, arg_6E00_2, arg_6E00_3, arg_6E00_4, arg_6E00_5, origin, 1f, SpriteEffects.None, 0f);
             }
             for (int num129 = 0; num129 < Recipe.maxRecipes; num129++)
             {
                 Main.inventoryScale = 100f / (Math.Abs(Main.availableRecipeY[num129]) + 100f);
                 if ((double)Main.inventoryScale < 0.75)
                 {
                     Main.inventoryScale = 0.75f;
                 }
                 if (Main.availableRecipeY[num129] < (float)((num129 - Main.focusRecipe) * 65))
                 {
                     if (Main.availableRecipeY[num129] == 0f)
                     {
                         Main.PlaySound(12, -1, -1, 1);
                     }
                     Main.availableRecipeY[num129] += 6.5f;
                 }
                 else
                 {
                     if (Main.availableRecipeY[num129] > (float)((num129 - Main.focusRecipe) * 65))
                     {
                         if (Main.availableRecipeY[num129] == 0f)
                         {
                             Main.PlaySound(12, -1, -1, 1);
                         }
                         Main.availableRecipeY[num129] -= 6.5f;
                     }
                 }
                 if (num129 < Main.numAvailableRecipes && Math.Abs(Main.availableRecipeY[num129]) <= (float)num107)
                 {
                     int num130 = (int)(46f - 26f * Main.inventoryScale);
                     int num131 = (int)(410f + Main.availableRecipeY[num129] * Main.inventoryScale - 30f * Main.inventoryScale + (float)num106);
                     double num132 = (double)(color2.A + 50);
                     double num133 = 255.0;
                     if (Math.Abs(Main.availableRecipeY[num129]) > (float)(num107 - 100))
                     {
                         num132 = (double)(150f * (100f - (Math.Abs(Main.availableRecipeY[num129]) - (float)(num107 - 100)))) * 0.01;
                         num133 = (double)(255f * (100f - (Math.Abs(Main.availableRecipeY[num129]) - (float)(num107 - 100)))) * 0.01;
                     }
                     new Microsoft.Xna.Framework.Color((int)((byte)num132), (int)((byte)num132), (int)((byte)num132), (int)((byte)num132));
                     Microsoft.Xna.Framework.Color color7 = new Microsoft.Xna.Framework.Color((int)((byte)num133), (int)((byte)num133), (int)((byte)num133), (int)((byte)num133));
                     if (Main.mouseX >= num130 && (float)Main.mouseX <= (float)num130 + (float)Main.inventoryBackTexture.Width * Main.inventoryScale && Main.mouseY >= num131 && (float)Main.mouseY <= (float)num131 + (float)Main.inventoryBackTexture.Height * Main.inventoryScale)
                     {
                         Main.player[Main.myPlayer].mouseInterface = true;
                         if (Main.focusRecipe == num129 && Main.guideItem.type == 0)
                         {
                             if (Main.mouseItem.type == 0 || (Main.mouseItem.IsTheSameAs(Main.recipe[Main.availableRecipe[num129]].createItem) && Main.mouseItem.stack + Main.recipe[Main.availableRecipe[num129]].createItem.stack <= Main.mouseItem.maxStack))
                             {
                                 if (Main.mouseLeftRelease && Main.mouseLeft)
                                 {
                                     int stack = Main.mouseItem.stack;
                                     Main.mouseItem = (Item)Main.recipe[Main.availableRecipe[num129]].createItem.Clone();
                                     Main.mouseItem.Prefix(-1);
                                     Main.mouseItem.stack += stack;
                                     Main.mouseItem.position.X = Main.player[Main.myPlayer].position.X + (float)(Main.player[Main.myPlayer].width / 2) - (float)(Main.mouseItem.width / 2);
                                     Main.mouseItem.position.Y = Main.player[Main.myPlayer].position.Y + (float)(Main.player[Main.myPlayer].height / 2) - (float)(Main.mouseItem.height / 2);
                                     ItemText.NewText(Main.mouseItem, Main.recipe[Main.availableRecipe[num129]].createItem.stack);
                                     Main.recipe[Main.availableRecipe[num129]].Create();
                                     if (Main.mouseItem.type > 0 || Main.recipe[Main.availableRecipe[num129]].createItem.type > 0)
                                     {
                                         Main.PlaySound(7, -1, -1, 1);
                                     }
                                 }
                                 else
                                 {
                                     if (Main.stackSplit <= 1 && Main.mouseRight && (Main.mouseItem.stack < Main.mouseItem.maxStack || Main.mouseItem.type == 0))
                                     {
                                         if (Main.stackSplit == 0)
                                         {
                                             Main.stackSplit = 15;
                                         }
                                         else
                                         {
                                             Main.stackSplit = Main.stackDelay;
                                         }
                                         int stack2 = Main.mouseItem.stack;
                                         Main.mouseItem = (Item)Main.recipe[Main.availableRecipe[num129]].createItem.Clone();
                                         Main.mouseItem.stack += stack2;
                                         Main.mouseItem.position.X = Main.player[Main.myPlayer].position.X + (float)(Main.player[Main.myPlayer].width / 2) - (float)(Main.mouseItem.width / 2);
                                         Main.mouseItem.position.Y = Main.player[Main.myPlayer].position.Y + (float)(Main.player[Main.myPlayer].height / 2) - (float)(Main.mouseItem.height / 2);
                                         ItemText.NewText(Main.mouseItem, Main.recipe[Main.availableRecipe[num129]].createItem.stack);
                                         Main.recipe[Main.availableRecipe[num129]].Create();
                                         if (Main.mouseItem.type > 0 || Main.recipe[Main.availableRecipe[num129]].createItem.type > 0)
                                         {
                                             Main.PlaySound(7, -1, -1, 1);
                                         }
                                     }
                                 }
                             }
                         }
                         else
                         {
                             if (Main.mouseLeftRelease && Main.mouseLeft)
                             {
                                 Main.focusRecipe = num129;
                             }
                         }
                         Main.craftingHide = true;
                         text15 = Main.recipe[Main.availableRecipe[num129]].createItem.name;
                         Main.toolTip = (Item)Main.recipe[Main.availableRecipe[num129]].createItem.Clone();
                         if (Main.recipe[Main.availableRecipe[num129]].createItem.stack > 1)
                         {
                             object obj = text15;
                             text15 = string.Concat(new object[]
                             {
                                 obj,
                                 " (",
                                 Main.recipe[Main.availableRecipe[num129]].createItem.stack,
                                 ")"
                             });
                         }
                     }
                     if (Main.numAvailableRecipes > 0)
                     {
                         num132 -= 50.0;
                         if (num132 < 0.0)
                         {
                             num132 = 0.0;
                         }
                         SpriteBatch arg_7516_0 = this.spriteBatch;
                         Texture2D arg_7516_1 = Main.inventoryBack4Texture;
                         Microsoft.Xna.Framework.Vector2 arg_7516_2 = new Microsoft.Xna.Framework.Vector2((float)num130, (float)num131);
                         Microsoft.Xna.Framework.Rectangle? arg_7516_3 = new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.inventoryBackTexture.Width, Main.inventoryBackTexture.Height));
                         Microsoft.Xna.Framework.Color arg_7516_4 = new Microsoft.Xna.Framework.Color((int)((byte)num132), (int)((byte)num132), (int)((byte)num132), (int)((byte)num132));
                         float arg_7516_5 = 0f;
                         origin = default(Microsoft.Xna.Framework.Vector2);
                         arg_7516_0.Draw(arg_7516_1, arg_7516_2, arg_7516_3, arg_7516_4, arg_7516_5, origin, Main.inventoryScale, SpriteEffects.None, 0f);
                         if (Main.recipe[Main.availableRecipe[num129]].createItem.type > 0 && Main.recipe[Main.availableRecipe[num129]].createItem.stack > 0)
                         {
                             float num134 = 1f;
                             if (Main.itemTexture[Main.recipe[Main.availableRecipe[num129]].createItem.type].Width > 32 || Main.itemTexture[Main.recipe[Main.availableRecipe[num129]].createItem.type].Height > 32)
                             {
                                 if (Main.itemTexture[Main.recipe[Main.availableRecipe[num129]].createItem.type].Width > Main.itemTexture[Main.recipe[Main.availableRecipe[num129]].createItem.type].Height)
                                 {
                                     num134 = 32f / (float)Main.itemTexture[Main.recipe[Main.availableRecipe[num129]].createItem.type].Width;
                                 }
                                 else
                                 {
                                     num134 = 32f / (float)Main.itemTexture[Main.recipe[Main.availableRecipe[num129]].createItem.type].Height;
                                 }
                             }
                             num134 *= Main.inventoryScale;
                             SpriteBatch arg_7785_0 = this.spriteBatch;
                             Texture2D arg_7785_1 = Main.itemTexture[Main.recipe[Main.availableRecipe[num129]].createItem.type];
                             Microsoft.Xna.Framework.Vector2 arg_7785_2 = new Microsoft.Xna.Framework.Vector2((float)num130 + 26f * Main.inventoryScale - (float)Main.itemTexture[Main.recipe[Main.availableRecipe[num129]].createItem.type].Width * 0.5f * num134, (float)num131 + 26f * Main.inventoryScale - (float)Main.itemTexture[Main.recipe[Main.availableRecipe[num129]].createItem.type].Height * 0.5f * num134);
                             Microsoft.Xna.Framework.Rectangle? arg_7785_3 = new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.itemTexture[Main.recipe[Main.availableRecipe[num129]].createItem.type].Width, Main.itemTexture[Main.recipe[Main.availableRecipe[num129]].createItem.type].Height));
                             Microsoft.Xna.Framework.Color arg_7785_4 = Main.recipe[Main.availableRecipe[num129]].createItem.GetAlpha(color7);
                             float arg_7785_5 = 0f;
                             origin = default(Microsoft.Xna.Framework.Vector2);
                             arg_7785_0.Draw(arg_7785_1, arg_7785_2, arg_7785_3, arg_7785_4, arg_7785_5, origin, num134, SpriteEffects.None, 0f);
                             Microsoft.Xna.Framework.Color arg_77B0_0 = Main.recipe[Main.availableRecipe[num129]].createItem.color;
                             Microsoft.Xna.Framework.Color b = default(Microsoft.Xna.Framework.Color);
                             if (arg_77B0_0 != b)
                             {
                                 SpriteBatch arg_78E4_0 = this.spriteBatch;
                                 Texture2D arg_78E4_1 = Main.itemTexture[Main.recipe[Main.availableRecipe[num129]].createItem.type];
                                 Microsoft.Xna.Framework.Vector2 arg_78E4_2 = new Microsoft.Xna.Framework.Vector2((float)num130 + 26f * Main.inventoryScale - (float)Main.itemTexture[Main.recipe[Main.availableRecipe[num129]].createItem.type].Width * 0.5f * num134, (float)num131 + 26f * Main.inventoryScale - (float)Main.itemTexture[Main.recipe[Main.availableRecipe[num129]].createItem.type].Height * 0.5f * num134);
                                 Microsoft.Xna.Framework.Rectangle? arg_78E4_3 = new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.itemTexture[Main.recipe[Main.availableRecipe[num129]].createItem.type].Width, Main.itemTexture[Main.recipe[Main.availableRecipe[num129]].createItem.type].Height));
                                 Microsoft.Xna.Framework.Color arg_78E4_4 = Main.recipe[Main.availableRecipe[num129]].createItem.GetColor(color7);
                                 float arg_78E4_5 = 0f;
                                 origin = default(Microsoft.Xna.Framework.Vector2);
                                 arg_78E4_0.Draw(arg_78E4_1, arg_78E4_2, arg_78E4_3, arg_78E4_4, arg_78E4_5, origin, num134, SpriteEffects.None, 0f);
                             }
                             if (Main.recipe[Main.availableRecipe[num129]].createItem.stack > 1)
                             {
                                 SpriteBatch arg_7971_0 = this.spriteBatch;
                                 SpriteFont arg_7971_1 = Main.fontItemStack;
                                 string arg_7971_2 = string.Concat(Main.recipe[Main.availableRecipe[num129]].createItem.stack);
                                 Microsoft.Xna.Framework.Vector2 arg_7971_3 = new Microsoft.Xna.Framework.Vector2((float)num130 + 10f * Main.inventoryScale, (float)num131 + 26f * Main.inventoryScale);
                                 Microsoft.Xna.Framework.Color arg_7971_4 = color7;
                                 float arg_7971_5 = 0f;
                                 origin = default(Microsoft.Xna.Framework.Vector2);
                                 arg_7971_0.DrawString(arg_7971_1, arg_7971_2, arg_7971_3, arg_7971_4, arg_7971_5, origin, num134, SpriteEffects.None, 0f);
                             }
                         }
                     }
                 }
             }
             if (Main.numAvailableRecipes > 0)
             {
                 int num135 = 0;
                 while (num135 < Recipe.maxRequirements && Main.recipe[Main.availableRecipe[Main.focusRecipe]].requiredItem[num135].type != 0)
                 {
                     int num136 = 80 + num135 * 40;
                     int num137 = 380 + num106;
                     double num138 = (double)(color2.A + 50);
                     double num139 = 255.0;
                     Microsoft.Xna.Framework.Color white9 = Microsoft.Xna.Framework.Color.White;
                     Microsoft.Xna.Framework.Color white10 = Microsoft.Xna.Framework.Color.White;
                     num138 = (double)((float)(color2.A + 50) - Math.Abs(Main.availableRecipeY[Main.focusRecipe]) * 2f);
                     num139 = (double)(255f - Math.Abs(Main.availableRecipeY[Main.focusRecipe]) * 2f);
                     if (num138 < 0.0)
                     {
                         num138 = 0.0;
                     }
                     if (num139 < 0.0)
                     {
                         num139 = 0.0;
                     }
                     white9.R = (byte)num138;
                     white9.G = (byte)num138;
                     white9.B = (byte)num138;
                     white9.A = (byte)num138;
                     white10.R = (byte)num139;
                     white10.G = (byte)num139;
                     white10.B = (byte)num139;
                     white10.A = (byte)num139;
                     Main.inventoryScale = 0.6f;
                     if (num138 == 0.0)
                     {
                         break;
                     }
                     if (Main.mouseX >= num136 && (float)Main.mouseX <= (float)num136 + (float)Main.inventoryBackTexture.Width * Main.inventoryScale && Main.mouseY >= num137 && (float)Main.mouseY <= (float)num137 + (float)Main.inventoryBackTexture.Height * Main.inventoryScale)
                     {
                         Main.craftingHide = true;
                         Main.player[Main.myPlayer].mouseInterface = true;
                         text15 = Main.recipe[Main.availableRecipe[Main.focusRecipe]].requiredItem[num135].name;
                         Main.toolTip = (Item)Main.recipe[Main.availableRecipe[Main.focusRecipe]].requiredItem[num135].Clone();
                         if (Main.recipe[Main.availableRecipe[Main.focusRecipe]].requiredItem[num135].stack > 1)
                         {
                             object obj = text15;
                             text15 = string.Concat(new object[]
                             {
                                 obj,
                                 " (",
                                 Main.recipe[Main.availableRecipe[Main.focusRecipe]].requiredItem[num135].stack,
                                 ")"
                             });
                         }
                     }
                     num138 -= 50.0;
                     if (num138 < 0.0)
                     {
                         num138 = 0.0;
                     }
                     SpriteBatch arg_7C9D_0 = this.spriteBatch;
                     Texture2D arg_7C9D_1 = Main.inventoryBack4Texture;
                     Microsoft.Xna.Framework.Vector2 arg_7C9D_2 = new Microsoft.Xna.Framework.Vector2((float)num136, (float)num137);
                     Microsoft.Xna.Framework.Rectangle? arg_7C9D_3 = new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.inventoryBackTexture.Width, Main.inventoryBackTexture.Height));
                     Microsoft.Xna.Framework.Color arg_7C9D_4 = new Microsoft.Xna.Framework.Color((int)((byte)num138), (int)((byte)num138), (int)((byte)num138), (int)((byte)num138));
                     float arg_7C9D_5 = 0f;
                     origin = default(Microsoft.Xna.Framework.Vector2);
                     arg_7C9D_0.Draw(arg_7C9D_1, arg_7C9D_2, arg_7C9D_3, arg_7C9D_4, arg_7C9D_5, origin, Main.inventoryScale, SpriteEffects.None, 0f);
                     if (Main.recipe[Main.availableRecipe[Main.focusRecipe]].requiredItem[num135].type > 0 && Main.recipe[Main.availableRecipe[Main.focusRecipe]].requiredItem[num135].stack > 0)
                     {
                         float num140 = 1f;
                         if (Main.itemTexture[Main.recipe[Main.availableRecipe[Main.focusRecipe]].requiredItem[num135].type].Width > 32 || Main.itemTexture[Main.recipe[Main.availableRecipe[Main.focusRecipe]].requiredItem[num135].type].Height > 32)
                         {
                             if (Main.itemTexture[Main.recipe[Main.availableRecipe[Main.focusRecipe]].requiredItem[num135].type].Width > Main.itemTexture[Main.recipe[Main.availableRecipe[Main.focusRecipe]].requiredItem[num135].type].Height)
                             {
                                 num140 = 32f / (float)Main.itemTexture[Main.recipe[Main.availableRecipe[Main.focusRecipe]].requiredItem[num135].type].Width;
                             }
                             else
                             {
                                 num140 = 32f / (float)Main.itemTexture[Main.recipe[Main.availableRecipe[Main.focusRecipe]].requiredItem[num135].type].Height;
                             }
                         }
                         num140 *= Main.inventoryScale;
                         SpriteBatch arg_7F60_0 = this.spriteBatch;
                         Texture2D arg_7F60_1 = Main.itemTexture[Main.recipe[Main.availableRecipe[Main.focusRecipe]].requiredItem[num135].type];
                         Microsoft.Xna.Framework.Vector2 arg_7F60_2 = new Microsoft.Xna.Framework.Vector2((float)num136 + 26f * Main.inventoryScale - (float)Main.itemTexture[Main.recipe[Main.availableRecipe[Main.focusRecipe]].requiredItem[num135].type].Width * 0.5f * num140, (float)num137 + 26f * Main.inventoryScale - (float)Main.itemTexture[Main.recipe[Main.availableRecipe[Main.focusRecipe]].requiredItem[num135].type].Height * 0.5f * num140);
                         Microsoft.Xna.Framework.Rectangle? arg_7F60_3 = new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.itemTexture[Main.recipe[Main.availableRecipe[Main.focusRecipe]].requiredItem[num135].type].Width, Main.itemTexture[Main.recipe[Main.availableRecipe[Main.focusRecipe]].requiredItem[num135].type].Height));
                         Microsoft.Xna.Framework.Color arg_7F60_4 = Main.recipe[Main.availableRecipe[Main.focusRecipe]].requiredItem[num135].GetAlpha(white10);
                         float arg_7F60_5 = 0f;
                         origin = default(Microsoft.Xna.Framework.Vector2);
                         arg_7F60_0.Draw(arg_7F60_1, arg_7F60_2, arg_7F60_3, arg_7F60_4, arg_7F60_5, origin, num140, SpriteEffects.None, 0f);
                         Microsoft.Xna.Framework.Color arg_7F91_0 = Main.recipe[Main.availableRecipe[Main.focusRecipe]].requiredItem[num135].color;
                         Microsoft.Xna.Framework.Color b = default(Microsoft.Xna.Framework.Color);
                         if (arg_7F91_0 != b)
                         {
                             SpriteBatch arg_80E9_0 = this.spriteBatch;
                             Texture2D arg_80E9_1 = Main.itemTexture[Main.recipe[Main.availableRecipe[Main.focusRecipe]].requiredItem[num135].type];
                             Microsoft.Xna.Framework.Vector2 arg_80E9_2 = new Microsoft.Xna.Framework.Vector2((float)num136 + 26f * Main.inventoryScale - (float)Main.itemTexture[Main.recipe[Main.availableRecipe[Main.focusRecipe]].requiredItem[num135].type].Width * 0.5f * num140, (float)num137 + 26f * Main.inventoryScale - (float)Main.itemTexture[Main.recipe[Main.availableRecipe[Main.focusRecipe]].requiredItem[num135].type].Height * 0.5f * num140);
                             Microsoft.Xna.Framework.Rectangle? arg_80E9_3 = new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.itemTexture[Main.recipe[Main.availableRecipe[Main.focusRecipe]].requiredItem[num135].type].Width, Main.itemTexture[Main.recipe[Main.availableRecipe[Main.focusRecipe]].requiredItem[num135].type].Height));
                             Microsoft.Xna.Framework.Color arg_80E9_4 = Main.recipe[Main.availableRecipe[Main.focusRecipe]].requiredItem[num135].GetColor(white10);
                             float arg_80E9_5 = 0f;
                             origin = default(Microsoft.Xna.Framework.Vector2);
                             arg_80E9_0.Draw(arg_80E9_1, arg_80E9_2, arg_80E9_3, arg_80E9_4, arg_80E9_5, origin, num140, SpriteEffects.None, 0f);
                         }
                         if (Main.recipe[Main.availableRecipe[Main.focusRecipe]].requiredItem[num135].stack > 1)
                         {
                             SpriteBatch arg_8182_0 = this.spriteBatch;
                             SpriteFont arg_8182_1 = Main.fontItemStack;
                             string arg_8182_2 = string.Concat(Main.recipe[Main.availableRecipe[Main.focusRecipe]].requiredItem[num135].stack);
                             Microsoft.Xna.Framework.Vector2 arg_8182_3 = new Microsoft.Xna.Framework.Vector2((float)num136 + 10f * Main.inventoryScale, (float)num137 + 26f * Main.inventoryScale);
                             Microsoft.Xna.Framework.Color arg_8182_4 = white10;
                             float arg_8182_5 = 0f;
                             origin = default(Microsoft.Xna.Framework.Vector2);
                             arg_8182_0.DrawString(arg_8182_1, arg_8182_2, arg_8182_3, arg_8182_4, arg_8182_5, origin, num140, SpriteEffects.None, 0f);
                         }
                     }
                     num135++;
                 }
             }
         }
         SpriteBatch arg_81EF_0 = this.spriteBatch;
         SpriteFont arg_81EF_1 = Main.fontMouseText;
         string arg_81EF_2 = "Coins";
         Microsoft.Xna.Framework.Vector2 arg_81EF_3 = new Microsoft.Xna.Framework.Vector2(496f, 84f);
         Microsoft.Xna.Framework.Color arg_81EF_4 = new Microsoft.Xna.Framework.Color((int)Main.mouseTextColor, (int)Main.mouseTextColor, (int)Main.mouseTextColor, (int)Main.mouseTextColor);
         float arg_81EF_5 = 0f;
         origin = default(Microsoft.Xna.Framework.Vector2);
         arg_81EF_0.DrawString(arg_81EF_1, arg_81EF_2, arg_81EF_3, arg_81EF_4, arg_81EF_5, origin, 0.75f, SpriteEffects.None, 0f);
         Main.inventoryScale = 0.6f;
         for (int num141 = 0; num141 < 4; num141++)
         {
             int num142 = 497;
             int num143 = (int)(85f + (float)(num141 * 56) * Main.inventoryScale + 20f);
             int num144 = num141 + 40;
             Microsoft.Xna.Framework.Color white11 = new Microsoft.Xna.Framework.Color(100, 100, 100, 100);
             if (Main.mouseX >= num142 && (float)Main.mouseX <= (float)num142 + (float)Main.inventoryBackTexture.Width * Main.inventoryScale && Main.mouseY >= num143 && (float)Main.mouseY <= (float)num143 + (float)Main.inventoryBackTexture.Height * Main.inventoryScale)
             {
                 Main.player[Main.myPlayer].mouseInterface = true;
                 if (Main.mouseLeftRelease && Main.mouseLeft)
                 {
                     if (Main.keyState.IsKeyDown(Keys.LeftShift))
                     {
                         if (Main.player[Main.myPlayer].inventory[num144].type > 0)
                         {
                             if (Main.npcShop > 0)
                             {
                                 if (Main.player[Main.myPlayer].SellItem(Main.player[Main.myPlayer].inventory[num144].value, Main.player[Main.myPlayer].inventory[num144].stack))
                                 {
                                     this.shop[Main.npcShop].AddShop(Main.player[Main.myPlayer].inventory[num144]);
                                     Main.player[Main.myPlayer].inventory[num144].SetDefaults(0, false);
                                     Main.PlaySound(18, -1, -1, 1);
                                 }
                                 else
                                 {
                                     if (Main.player[Main.myPlayer].inventory[num144].value == 0)
                                     {
                                         this.shop[Main.npcShop].AddShop(Main.player[Main.myPlayer].inventory[num144]);
                                         Main.player[Main.myPlayer].inventory[num144].SetDefaults(0, false);
                                         Main.PlaySound(7, -1, -1, 1);
                                     }
                                 }
                             }
                             else
                             {
                                 Recipe.FindRecipes();
                                 Main.PlaySound(7, -1, -1, 1);
                                 Main.trashItem = (Item)Main.player[Main.myPlayer].inventory[num144].Clone();
                                 Main.player[Main.myPlayer].inventory[num144].SetDefaults(0, false);
                             }
                         }
                     }
                     else
                     {
                         if ((Main.player[Main.myPlayer].selectedItem != num144 || Main.player[Main.myPlayer].itemAnimation <= 0) && (Main.mouseItem.type == 0 || Main.mouseItem.type == 71 || Main.mouseItem.type == 72 || Main.mouseItem.type == 73 || Main.mouseItem.type == 74))
                         {
                             Item item7 = Main.mouseItem;
                             Main.mouseItem = Main.player[Main.myPlayer].inventory[num144];
                             Main.player[Main.myPlayer].inventory[num144] = item7;
                             if (Main.player[Main.myPlayer].inventory[num144].type == 0 || Main.player[Main.myPlayer].inventory[num144].stack < 1)
                             {
                                 Main.player[Main.myPlayer].inventory[num144] = new Item();
                             }
                             if (Main.mouseItem.IsTheSameAs(Main.player[Main.myPlayer].inventory[num144]) && Main.player[Main.myPlayer].inventory[num144].stack != Main.player[Main.myPlayer].inventory[num144].maxStack && Main.mouseItem.stack != Main.mouseItem.maxStack)
                             {
                                 if (Main.mouseItem.stack + Main.player[Main.myPlayer].inventory[num144].stack <= Main.mouseItem.maxStack)
                                 {
                                     Main.player[Main.myPlayer].inventory[num144].stack += Main.mouseItem.stack;
                                     Main.mouseItem.stack = 0;
                                 }
                                 else
                                 {
                                     int num145 = Main.mouseItem.maxStack - Main.player[Main.myPlayer].inventory[num144].stack;
                                     Main.player[Main.myPlayer].inventory[num144].stack += num145;
                                     Main.mouseItem.stack -= num145;
                                 }
                             }
                             if (Main.mouseItem.type == 0 || Main.mouseItem.stack < 1)
                             {
                                 Main.mouseItem = new Item();
                             }
                             if (Main.mouseItem.type > 0 || Main.player[Main.myPlayer].inventory[num144].type > 0)
                             {
                                 Main.PlaySound(7, -1, -1, 1);
                             }
                             Recipe.FindRecipes();
                         }
                     }
                 }
                 else
                 {
                     if (Main.stackSplit <= 1 && Main.mouseRight && (Main.mouseItem.IsTheSameAs(Main.player[Main.myPlayer].inventory[num144]) || Main.mouseItem.type == 0) && (Main.mouseItem.stack < Main.mouseItem.maxStack || Main.mouseItem.type == 0))
                     {
                         if (Main.mouseItem.type == 0)
                         {
                             Main.mouseItem = (Item)Main.player[Main.myPlayer].inventory[num144].Clone();
                             Main.mouseItem.stack = 0;
                         }
                         Main.mouseItem.stack++;
                         Main.player[Main.myPlayer].inventory[num144].stack--;
                         if (Main.player[Main.myPlayer].inventory[num144].stack <= 0)
                         {
                             Main.player[Main.myPlayer].inventory[num144] = new Item();
                         }
                         Recipe.FindRecipes();
                         Main.soundInstanceMenuTick.Stop();
                         Main.soundInstanceMenuTick = Main.soundMenuTick.CreateInstance();
                         Main.PlaySound(12, -1, -1, 1);
                         if (Main.stackSplit == 0)
                         {
                             Main.stackSplit = 15;
                         }
                         else
                         {
                             Main.stackSplit = Main.stackDelay;
                         }
                     }
                 }
                 text15 = Main.player[Main.myPlayer].inventory[num144].name;
                 Main.toolTip = (Item)Main.player[Main.myPlayer].inventory[num144].Clone();
                 if (Main.player[Main.myPlayer].inventory[num144].stack > 1)
                 {
                     object obj = text15;
                     text15 = string.Concat(new object[]
                     {
                         obj,
                         " (",
                         Main.player[Main.myPlayer].inventory[num144].stack,
                         ")"
                     });
                 }
             }
             SpriteBatch arg_8910_0 = this.spriteBatch;
             Texture2D arg_8910_1 = Main.inventoryBackTexture;
             Microsoft.Xna.Framework.Vector2 arg_8910_2 = new Microsoft.Xna.Framework.Vector2((float)num142, (float)num143);
             Microsoft.Xna.Framework.Rectangle? arg_8910_3 = new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.inventoryBackTexture.Width, Main.inventoryBackTexture.Height));
             Microsoft.Xna.Framework.Color arg_8910_4 = color2;
             float arg_8910_5 = 0f;
             origin = default(Microsoft.Xna.Framework.Vector2);
             arg_8910_0.Draw(arg_8910_1, arg_8910_2, arg_8910_3, arg_8910_4, arg_8910_5, origin, Main.inventoryScale, SpriteEffects.None, 0f);
             white11 = Microsoft.Xna.Framework.Color.White;
             if (Main.player[Main.myPlayer].inventory[num144].type > 0 && Main.player[Main.myPlayer].inventory[num144].stack > 0)
             {
                 float num146 = 1f;
                 if (Main.itemTexture[Main.player[Main.myPlayer].inventory[num144].type].Width > 32 || Main.itemTexture[Main.player[Main.myPlayer].inventory[num144].type].Height > 32)
                 {
                     if (Main.itemTexture[Main.player[Main.myPlayer].inventory[num144].type].Width > Main.itemTexture[Main.player[Main.myPlayer].inventory[num144].type].Height)
                     {
                         num146 = 32f / (float)Main.itemTexture[Main.player[Main.myPlayer].inventory[num144].type].Width;
                     }
                     else
                     {
                         num146 = 32f / (float)Main.itemTexture[Main.player[Main.myPlayer].inventory[num144].type].Height;
                     }
                 }
                 num146 *= Main.inventoryScale;
                 SpriteBatch arg_8B86_0 = this.spriteBatch;
                 Texture2D arg_8B86_1 = Main.itemTexture[Main.player[Main.myPlayer].inventory[num144].type];
                 Microsoft.Xna.Framework.Vector2 arg_8B86_2 = new Microsoft.Xna.Framework.Vector2((float)num142 + 26f * Main.inventoryScale - (float)Main.itemTexture[Main.player[Main.myPlayer].inventory[num144].type].Width * 0.5f * num146, (float)num143 + 26f * Main.inventoryScale - (float)Main.itemTexture[Main.player[Main.myPlayer].inventory[num144].type].Height * 0.5f * num146);
                 Microsoft.Xna.Framework.Rectangle? arg_8B86_3 = new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.itemTexture[Main.player[Main.myPlayer].inventory[num144].type].Width, Main.itemTexture[Main.player[Main.myPlayer].inventory[num144].type].Height));
                 Microsoft.Xna.Framework.Color arg_8B86_4 = Main.player[Main.myPlayer].inventory[num144].GetAlpha(white11);
                 float arg_8B86_5 = 0f;
                 origin = default(Microsoft.Xna.Framework.Vector2);
                 arg_8B86_0.Draw(arg_8B86_1, arg_8B86_2, arg_8B86_3, arg_8B86_4, arg_8B86_5, origin, num146, SpriteEffects.None, 0f);
                 Microsoft.Xna.Framework.Color arg_8BB1_0 = Main.player[Main.myPlayer].inventory[num144].color;
                 Microsoft.Xna.Framework.Color b = default(Microsoft.Xna.Framework.Color);
                 if (arg_8BB1_0 != b)
                 {
                     SpriteBatch arg_8CE5_0 = this.spriteBatch;
                     Texture2D arg_8CE5_1 = Main.itemTexture[Main.player[Main.myPlayer].inventory[num144].type];
                     Microsoft.Xna.Framework.Vector2 arg_8CE5_2 = new Microsoft.Xna.Framework.Vector2((float)num142 + 26f * Main.inventoryScale - (float)Main.itemTexture[Main.player[Main.myPlayer].inventory[num144].type].Width * 0.5f * num146, (float)num143 + 26f * Main.inventoryScale - (float)Main.itemTexture[Main.player[Main.myPlayer].inventory[num144].type].Height * 0.5f * num146);
                     Microsoft.Xna.Framework.Rectangle? arg_8CE5_3 = new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.itemTexture[Main.player[Main.myPlayer].inventory[num144].type].Width, Main.itemTexture[Main.player[Main.myPlayer].inventory[num144].type].Height));
                     Microsoft.Xna.Framework.Color arg_8CE5_4 = Main.player[Main.myPlayer].inventory[num144].GetColor(white11);
                     float arg_8CE5_5 = 0f;
                     origin = default(Microsoft.Xna.Framework.Vector2);
                     arg_8CE5_0.Draw(arg_8CE5_1, arg_8CE5_2, arg_8CE5_3, arg_8CE5_4, arg_8CE5_5, origin, num146, SpriteEffects.None, 0f);
                 }
                 if (Main.player[Main.myPlayer].inventory[num144].stack > 1)
                 {
                     SpriteBatch arg_8D72_0 = this.spriteBatch;
                     SpriteFont arg_8D72_1 = Main.fontItemStack;
                     string arg_8D72_2 = string.Concat(Main.player[Main.myPlayer].inventory[num144].stack);
                     Microsoft.Xna.Framework.Vector2 arg_8D72_3 = new Microsoft.Xna.Framework.Vector2((float)num142 + 10f * Main.inventoryScale, (float)num143 + 26f * Main.inventoryScale);
                     Microsoft.Xna.Framework.Color arg_8D72_4 = white11;
                     float arg_8D72_5 = 0f;
                     origin = default(Microsoft.Xna.Framework.Vector2);
                     arg_8D72_0.DrawString(arg_8D72_1, arg_8D72_2, arg_8D72_3, arg_8D72_4, arg_8D72_5, origin, num146, SpriteEffects.None, 0f);
                 }
             }
         }
         SpriteBatch arg_8DDB_0 = this.spriteBatch;
         SpriteFont arg_8DDB_1 = Main.fontMouseText;
         string arg_8DDB_2 = "Ammo";
         Microsoft.Xna.Framework.Vector2 arg_8DDB_3 = new Microsoft.Xna.Framework.Vector2(532f, 84f);
         Microsoft.Xna.Framework.Color arg_8DDB_4 = new Microsoft.Xna.Framework.Color((int)Main.mouseTextColor, (int)Main.mouseTextColor, (int)Main.mouseTextColor, (int)Main.mouseTextColor);
         float arg_8DDB_5 = 0f;
         origin = default(Microsoft.Xna.Framework.Vector2);
         arg_8DDB_0.DrawString(arg_8DDB_1, arg_8DDB_2, arg_8DDB_3, arg_8DDB_4, arg_8DDB_5, origin, 0.75f, SpriteEffects.None, 0f);
         Main.inventoryScale = 0.6f;
         for (int num147 = 0; num147 < 4; num147++)
         {
             int num148 = 534;
             int num149 = (int)(85f + (float)(num147 * 56) * Main.inventoryScale + 20f);
             int num150 = 44 + num147;
             Microsoft.Xna.Framework.Color white12 = new Microsoft.Xna.Framework.Color(100, 100, 100, 100);
             if (Main.mouseX >= num148 && (float)Main.mouseX <= (float)num148 + (float)Main.inventoryBackTexture.Width * Main.inventoryScale && Main.mouseY >= num149 && (float)Main.mouseY <= (float)num149 + (float)Main.inventoryBackTexture.Height * Main.inventoryScale)
             {
                 Main.player[Main.myPlayer].mouseInterface = true;
                 if (Main.mouseLeftRelease && Main.mouseLeft)
                 {
                     if (Main.keyState.IsKeyDown(Keys.LeftShift))
                     {
                         if (Main.player[Main.myPlayer].inventory[num150].type > 0)
                         {
                             if (Main.npcShop > 0)
                             {
                                 if (Main.player[Main.myPlayer].SellItem(Main.player[Main.myPlayer].inventory[num150].value, Main.player[Main.myPlayer].inventory[num150].stack))
                                 {
                                     this.shop[Main.npcShop].AddShop(Main.player[Main.myPlayer].inventory[num150]);
                                     Main.player[Main.myPlayer].inventory[num150].SetDefaults(0, false);
                                     Main.PlaySound(18, -1, -1, 1);
                                 }
                                 else
                                 {
                                     if (Main.player[Main.myPlayer].inventory[num150].value == 0)
                                     {
                                         this.shop[Main.npcShop].AddShop(Main.player[Main.myPlayer].inventory[num150]);
                                         Main.player[Main.myPlayer].inventory[num150].SetDefaults(0, false);
                                         Main.PlaySound(7, -1, -1, 1);
                                     }
                                 }
                             }
                             else
                             {
                                 Recipe.FindRecipes();
                                 Main.PlaySound(7, -1, -1, 1);
                                 Main.trashItem = (Item)Main.player[Main.myPlayer].inventory[num150].Clone();
                                 Main.player[Main.myPlayer].inventory[num150].SetDefaults(0, false);
                             }
                         }
                     }
                     else
                     {
                         if ((Main.player[Main.myPlayer].selectedItem != num150 || Main.player[Main.myPlayer].itemAnimation <= 0) && (Main.mouseItem.type == 0 || Main.mouseItem.ammo > 0 || Main.mouseItem.type == 530))
                         {
                             Item item8 = Main.mouseItem;
                             Main.mouseItem = Main.player[Main.myPlayer].inventory[num150];
                             Main.player[Main.myPlayer].inventory[num150] = item8;
                             if (Main.player[Main.myPlayer].inventory[num150].type == 0 || Main.player[Main.myPlayer].inventory[num150].stack < 1)
                             {
                                 Main.player[Main.myPlayer].inventory[num150] = new Item();
                             }
                             if (Main.mouseItem.IsTheSameAs(Main.player[Main.myPlayer].inventory[num150]) && Main.player[Main.myPlayer].inventory[num150].stack != Main.player[Main.myPlayer].inventory[num150].maxStack && Main.mouseItem.stack != Main.mouseItem.maxStack)
                             {
                                 if (Main.mouseItem.stack + Main.player[Main.myPlayer].inventory[num150].stack <= Main.mouseItem.maxStack)
                                 {
                                     Main.player[Main.myPlayer].inventory[num150].stack += Main.mouseItem.stack;
                                     Main.mouseItem.stack = 0;
                                 }
                                 else
                                 {
                                     int num151 = Main.mouseItem.maxStack - Main.player[Main.myPlayer].inventory[num150].stack;
                                     Main.player[Main.myPlayer].inventory[num150].stack += num151;
                                     Main.mouseItem.stack -= num151;
                                 }
                             }
                             if (Main.mouseItem.type == 0 || Main.mouseItem.stack < 1)
                             {
                                 Main.mouseItem = new Item();
                             }
                             if (Main.mouseItem.type > 0 || Main.player[Main.myPlayer].inventory[num150].type > 0)
                             {
                                 Main.PlaySound(7, -1, -1, 1);
                             }
                             Recipe.FindRecipes();
                         }
                     }
                 }
                 else
                 {
                     if (Main.stackSplit <= 1 && Main.mouseRight && (Main.mouseItem.IsTheSameAs(Main.player[Main.myPlayer].inventory[num150]) || Main.mouseItem.type == 0) && (Main.mouseItem.stack < Main.mouseItem.maxStack || Main.mouseItem.type == 0))
                     {
                         if (Main.mouseItem.type == 0)
                         {
                             Main.mouseItem = (Item)Main.player[Main.myPlayer].inventory[num150].Clone();
                             Main.mouseItem.stack = 0;
                         }
                         Main.mouseItem.stack++;
                         Main.player[Main.myPlayer].inventory[num150].stack--;
                         if (Main.player[Main.myPlayer].inventory[num150].stack <= 0)
                         {
                             Main.player[Main.myPlayer].inventory[num150] = new Item();
                         }
                         Recipe.FindRecipes();
                         Main.soundInstanceMenuTick.Stop();
                         Main.soundInstanceMenuTick = Main.soundMenuTick.CreateInstance();
                         Main.PlaySound(12, -1, -1, 1);
                         if (Main.stackSplit == 0)
                         {
                             Main.stackSplit = 15;
                         }
                         else
                         {
                             Main.stackSplit = Main.stackDelay;
                         }
                     }
                 }
                 text15 = Main.player[Main.myPlayer].inventory[num150].name;
                 Main.toolTip = (Item)Main.player[Main.myPlayer].inventory[num150].Clone();
                 if (Main.player[Main.myPlayer].inventory[num150].stack > 1)
                 {
                     object obj = text15;
                     text15 = string.Concat(new object[]
                     {
                         obj,
                         " (",
                         Main.player[Main.myPlayer].inventory[num150].stack,
                         ")"
                     });
                 }
             }
             SpriteBatch arg_94E2_0 = this.spriteBatch;
             Texture2D arg_94E2_1 = Main.inventoryBackTexture;
             Microsoft.Xna.Framework.Vector2 arg_94E2_2 = new Microsoft.Xna.Framework.Vector2((float)num148, (float)num149);
             Microsoft.Xna.Framework.Rectangle? arg_94E2_3 = new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.inventoryBackTexture.Width, Main.inventoryBackTexture.Height));
             Microsoft.Xna.Framework.Color arg_94E2_4 = color2;
             float arg_94E2_5 = 0f;
             origin = default(Microsoft.Xna.Framework.Vector2);
             arg_94E2_0.Draw(arg_94E2_1, arg_94E2_2, arg_94E2_3, arg_94E2_4, arg_94E2_5, origin, Main.inventoryScale, SpriteEffects.None, 0f);
             white12 = Microsoft.Xna.Framework.Color.White;
             if (Main.player[Main.myPlayer].inventory[num150].type > 0 && Main.player[Main.myPlayer].inventory[num150].stack > 0)
             {
                 float num152 = 1f;
                 if (Main.itemTexture[Main.player[Main.myPlayer].inventory[num150].type].Width > 32 || Main.itemTexture[Main.player[Main.myPlayer].inventory[num150].type].Height > 32)
                 {
                     if (Main.itemTexture[Main.player[Main.myPlayer].inventory[num150].type].Width > Main.itemTexture[Main.player[Main.myPlayer].inventory[num150].type].Height)
                     {
                         num152 = 32f / (float)Main.itemTexture[Main.player[Main.myPlayer].inventory[num150].type].Width;
                     }
                     else
                     {
                         num152 = 32f / (float)Main.itemTexture[Main.player[Main.myPlayer].inventory[num150].type].Height;
                     }
                 }
                 num152 *= Main.inventoryScale;
                 SpriteBatch arg_9758_0 = this.spriteBatch;
                 Texture2D arg_9758_1 = Main.itemTexture[Main.player[Main.myPlayer].inventory[num150].type];
                 Microsoft.Xna.Framework.Vector2 arg_9758_2 = new Microsoft.Xna.Framework.Vector2((float)num148 + 26f * Main.inventoryScale - (float)Main.itemTexture[Main.player[Main.myPlayer].inventory[num150].type].Width * 0.5f * num152, (float)num149 + 26f * Main.inventoryScale - (float)Main.itemTexture[Main.player[Main.myPlayer].inventory[num150].type].Height * 0.5f * num152);
                 Microsoft.Xna.Framework.Rectangle? arg_9758_3 = new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.itemTexture[Main.player[Main.myPlayer].inventory[num150].type].Width, Main.itemTexture[Main.player[Main.myPlayer].inventory[num150].type].Height));
                 Microsoft.Xna.Framework.Color arg_9758_4 = Main.player[Main.myPlayer].inventory[num150].GetAlpha(white12);
                 float arg_9758_5 = 0f;
                 origin = default(Microsoft.Xna.Framework.Vector2);
                 arg_9758_0.Draw(arg_9758_1, arg_9758_2, arg_9758_3, arg_9758_4, arg_9758_5, origin, num152, SpriteEffects.None, 0f);
                 Microsoft.Xna.Framework.Color arg_9783_0 = Main.player[Main.myPlayer].inventory[num150].color;
                 Microsoft.Xna.Framework.Color b = default(Microsoft.Xna.Framework.Color);
                 if (arg_9783_0 != b)
                 {
                     SpriteBatch arg_98B7_0 = this.spriteBatch;
                     Texture2D arg_98B7_1 = Main.itemTexture[Main.player[Main.myPlayer].inventory[num150].type];
                     Microsoft.Xna.Framework.Vector2 arg_98B7_2 = new Microsoft.Xna.Framework.Vector2((float)num148 + 26f * Main.inventoryScale - (float)Main.itemTexture[Main.player[Main.myPlayer].inventory[num150].type].Width * 0.5f * num152, (float)num149 + 26f * Main.inventoryScale - (float)Main.itemTexture[Main.player[Main.myPlayer].inventory[num150].type].Height * 0.5f * num152);
                     Microsoft.Xna.Framework.Rectangle? arg_98B7_3 = new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.itemTexture[Main.player[Main.myPlayer].inventory[num150].type].Width, Main.itemTexture[Main.player[Main.myPlayer].inventory[num150].type].Height));
                     Microsoft.Xna.Framework.Color arg_98B7_4 = Main.player[Main.myPlayer].inventory[num150].GetColor(white12);
                     float arg_98B7_5 = 0f;
                     origin = default(Microsoft.Xna.Framework.Vector2);
                     arg_98B7_0.Draw(arg_98B7_1, arg_98B7_2, arg_98B7_3, arg_98B7_4, arg_98B7_5, origin, num152, SpriteEffects.None, 0f);
                 }
                 if (Main.player[Main.myPlayer].inventory[num150].stack > 1)
                 {
                     SpriteBatch arg_9944_0 = this.spriteBatch;
                     SpriteFont arg_9944_1 = Main.fontItemStack;
                     string arg_9944_2 = string.Concat(Main.player[Main.myPlayer].inventory[num150].stack);
                     Microsoft.Xna.Framework.Vector2 arg_9944_3 = new Microsoft.Xna.Framework.Vector2((float)num148 + 10f * Main.inventoryScale, (float)num149 + 26f * Main.inventoryScale);
                     Microsoft.Xna.Framework.Color arg_9944_4 = white12;
                     float arg_9944_5 = 0f;
                     origin = default(Microsoft.Xna.Framework.Vector2);
                     arg_9944_0.DrawString(arg_9944_1, arg_9944_2, arg_9944_3, arg_9944_4, arg_9944_5, origin, num152, SpriteEffects.None, 0f);
                 }
             }
         }
         if (Main.npcShop > 0 && (!Main.playerInventory || Main.player[Main.myPlayer].talkNPC == -1))
         {
             Main.npcShop = 0;
         }
         if (Main.npcShop > 0)
         {
             SpriteBatch arg_99E0_0 = this.spriteBatch;
             SpriteFont arg_99E0_1 = Main.fontMouseText;
             string arg_99E0_2 = "Shop";
             Microsoft.Xna.Framework.Vector2 arg_99E0_3 = new Microsoft.Xna.Framework.Vector2(284f, 210f);
             Microsoft.Xna.Framework.Color arg_99E0_4 = new Microsoft.Xna.Framework.Color((int)Main.mouseTextColor, (int)Main.mouseTextColor, (int)Main.mouseTextColor, (int)Main.mouseTextColor);
             float arg_99E0_5 = 0f;
             origin = default(Microsoft.Xna.Framework.Vector2);
             arg_99E0_0.DrawString(arg_99E0_1, arg_99E0_2, arg_99E0_3, arg_99E0_4, arg_99E0_5, origin, 1f, SpriteEffects.None, 0f);
             Main.inventoryScale = 0.75f;
             if (Main.mouseX > 73 && Main.mouseX < (int)(73f + 280f * Main.inventoryScale) && Main.mouseY > 210 && Main.mouseY < (int)(210f + 224f * Main.inventoryScale))
             {
                 Main.player[Main.myPlayer].mouseInterface = true;
             }
             for (int num153 = 0; num153 < 5; num153++)
             {
                 for (int num154 = 0; num154 < 4; num154++)
                 {
                     int num155 = (int)(73f + (float)(num153 * 56) * Main.inventoryScale);
                     int num156 = (int)(210f + (float)(num154 * 56) * Main.inventoryScale);
                     int num157 = num153 + num154 * 5;
                     Microsoft.Xna.Framework.Color white13 = new Microsoft.Xna.Framework.Color(100, 100, 100, 100);
                     if (Main.mouseX >= num155 && (float)Main.mouseX <= (float)num155 + (float)Main.inventoryBackTexture.Width * Main.inventoryScale && Main.mouseY >= num156 && (float)Main.mouseY <= (float)num156 + (float)Main.inventoryBackTexture.Height * Main.inventoryScale)
                     {
                         Main.player[Main.myPlayer].mouseInterface = true;
                         if (Main.mouseLeftRelease && Main.mouseLeft)
                         {
                             if (Main.mouseItem.type == 0)
                             {
                                 if ((Main.player[Main.myPlayer].selectedItem != num157 || Main.player[Main.myPlayer].itemAnimation <= 0) && Main.player[Main.myPlayer].BuyItem(this.shop[Main.npcShop].item[num157].value))
                                 {
                                     if (this.shop[Main.npcShop].item[num157].buyOnce)
                                     {
                                         int prefix = (int)this.shop[Main.npcShop].item[num157].prefix;
                                         Main.mouseItem.SetDefaults(this.shop[Main.npcShop].item[num157].name);
                                         Main.mouseItem.Prefix(prefix);
                                     }
                                     else
                                     {
                                         Main.mouseItem.SetDefaults(this.shop[Main.npcShop].item[num157].name);
                                         Main.mouseItem.Prefix(-1);
                                     }
                                     Main.mouseItem.position.X = Main.player[Main.myPlayer].position.X + (float)(Main.player[Main.myPlayer].width / 2) - (float)(Main.mouseItem.width / 2);
                                     Main.mouseItem.position.Y = Main.player[Main.myPlayer].position.Y + (float)(Main.player[Main.myPlayer].height / 2) - (float)(Main.mouseItem.height / 2);
                                     ItemText.NewText(Main.mouseItem, Main.mouseItem.stack);
                                     if (this.shop[Main.npcShop].item[num157].buyOnce)
                                     {
                                         this.shop[Main.npcShop].item[num157].stack--;
                                         if (this.shop[Main.npcShop].item[num157].stack <= 0)
                                         {
                                             this.shop[Main.npcShop].item[num157].SetDefaults(0, false);
                                         }
                                     }
                                     Main.PlaySound(18, -1, -1, 1);
                                 }
                             }
                             else
                             {
                                 if (this.shop[Main.npcShop].item[num157].type == 0)
                                 {
                                     if (Main.player[Main.myPlayer].SellItem(Main.mouseItem.value, Main.mouseItem.stack))
                                     {
                                         this.shop[Main.npcShop].AddShop(Main.mouseItem);
                                         Main.mouseItem.stack = 0;
                                         Main.mouseItem.type = 0;
                                         Main.PlaySound(18, -1, -1, 1);
                                     }
                                     else
                                     {
                                         if (Main.mouseItem.value == 0)
                                         {
                                             this.shop[Main.npcShop].AddShop(Main.mouseItem);
                                             Main.mouseItem.stack = 0;
                                             Main.mouseItem.type = 0;
                                             Main.PlaySound(7, -1, -1, 1);
                                         }
                                     }
                                 }
                             }
                         }
                         else
                         {
                             if (Main.stackSplit <= 1 && Main.mouseRight && (Main.mouseItem.IsTheSameAs(this.shop[Main.npcShop].item[num157]) || Main.mouseItem.type == 0) && (Main.mouseItem.stack < Main.mouseItem.maxStack || Main.mouseItem.type == 0) && Main.player[Main.myPlayer].BuyItem(this.shop[Main.npcShop].item[num157].value))
                             {
                                 Main.PlaySound(18, -1, -1, 1);
                                 if (Main.mouseItem.type == 0)
                                 {
                                     Main.mouseItem.SetDefaults(this.shop[Main.npcShop].item[num157].name);
                                     Main.mouseItem.stack = 0;
                                 }
                                 Main.mouseItem.stack++;
                                 if (Main.stackSplit == 0)
                                 {
                                     Main.stackSplit = 15;
                                 }
                                 else
                                 {
                                     Main.stackSplit = Main.stackDelay;
                                 }
                                 if (this.shop[Main.npcShop].item[num157].buyOnce)
                                 {
                                     this.shop[Main.npcShop].item[num157].stack--;
                                     if (this.shop[Main.npcShop].item[num157].stack <= 0)
                                     {
                                         this.shop[Main.npcShop].item[num157].SetDefaults(0, false);
                                     }
                                 }
                             }
                         }
                         text15 = this.shop[Main.npcShop].item[num157].name;
                         Main.toolTip = (Item)this.shop[Main.npcShop].item[num157].Clone();
                         Main.toolTip.buy = true;
                         if (this.shop[Main.npcShop].item[num157].stack > 1)
                         {
                             object obj = text15;
                             text15 = string.Concat(new object[]
                             {
                                 obj,
                                 " (",
                                 this.shop[Main.npcShop].item[num157].stack,
                                 ")"
                             });
                         }
                     }
                     SpriteBatch arg_A092_0 = this.spriteBatch;
                     Texture2D arg_A092_1 = Main.inventoryBack6Texture;
                     Microsoft.Xna.Framework.Vector2 arg_A092_2 = new Microsoft.Xna.Framework.Vector2((float)num155, (float)num156);
                     Microsoft.Xna.Framework.Rectangle? arg_A092_3 = new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.inventoryBackTexture.Width, Main.inventoryBackTexture.Height));
                     Microsoft.Xna.Framework.Color arg_A092_4 = color2;
                     float arg_A092_5 = 0f;
                     origin = default(Microsoft.Xna.Framework.Vector2);
                     arg_A092_0.Draw(arg_A092_1, arg_A092_2, arg_A092_3, arg_A092_4, arg_A092_5, origin, Main.inventoryScale, SpriteEffects.None, 0f);
                     white13 = Microsoft.Xna.Framework.Color.White;
                     if (this.shop[Main.npcShop].item[num157].type > 0 && this.shop[Main.npcShop].item[num157].stack > 0)
                     {
                         float num158 = 1f;
                         if (Main.itemTexture[this.shop[Main.npcShop].item[num157].type].Width > 32 || Main.itemTexture[this.shop[Main.npcShop].item[num157].type].Height > 32)
                         {
                             if (Main.itemTexture[this.shop[Main.npcShop].item[num157].type].Width > Main.itemTexture[this.shop[Main.npcShop].item[num157].type].Height)
                             {
                                 num158 = 32f / (float)Main.itemTexture[this.shop[Main.npcShop].item[num157].type].Width;
                             }
                             else
                             {
                                 num158 = 32f / (float)Main.itemTexture[this.shop[Main.npcShop].item[num157].type].Height;
                             }
                         }
                         num158 *= Main.inventoryScale;
                         SpriteBatch arg_A316_0 = this.spriteBatch;
                         Texture2D arg_A316_1 = Main.itemTexture[this.shop[Main.npcShop].item[num157].type];
                         Microsoft.Xna.Framework.Vector2 arg_A316_2 = new Microsoft.Xna.Framework.Vector2((float)num155 + 26f * Main.inventoryScale - (float)Main.itemTexture[this.shop[Main.npcShop].item[num157].type].Width * 0.5f * num158, (float)num156 + 26f * Main.inventoryScale - (float)Main.itemTexture[this.shop[Main.npcShop].item[num157].type].Height * 0.5f * num158);
                         Microsoft.Xna.Framework.Rectangle? arg_A316_3 = new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.itemTexture[this.shop[Main.npcShop].item[num157].type].Width, Main.itemTexture[this.shop[Main.npcShop].item[num157].type].Height));
                         Microsoft.Xna.Framework.Color arg_A316_4 = this.shop[Main.npcShop].item[num157].GetAlpha(white13);
                         float arg_A316_5 = 0f;
                         origin = default(Microsoft.Xna.Framework.Vector2);
                         arg_A316_0.Draw(arg_A316_1, arg_A316_2, arg_A316_3, arg_A316_4, arg_A316_5, origin, num158, SpriteEffects.None, 0f);
                         Microsoft.Xna.Framework.Color arg_A342_0 = this.shop[Main.npcShop].item[num157].color;
                         Microsoft.Xna.Framework.Color b = default(Microsoft.Xna.Framework.Color);
                         if (arg_A342_0 != b)
                         {
                             SpriteBatch arg_A47C_0 = this.spriteBatch;
                             Texture2D arg_A47C_1 = Main.itemTexture[this.shop[Main.npcShop].item[num157].type];
                             Microsoft.Xna.Framework.Vector2 arg_A47C_2 = new Microsoft.Xna.Framework.Vector2((float)num155 + 26f * Main.inventoryScale - (float)Main.itemTexture[this.shop[Main.npcShop].item[num157].type].Width * 0.5f * num158, (float)num156 + 26f * Main.inventoryScale - (float)Main.itemTexture[this.shop[Main.npcShop].item[num157].type].Height * 0.5f * num158);
                             Microsoft.Xna.Framework.Rectangle? arg_A47C_3 = new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.itemTexture[this.shop[Main.npcShop].item[num157].type].Width, Main.itemTexture[this.shop[Main.npcShop].item[num157].type].Height));
                             Microsoft.Xna.Framework.Color arg_A47C_4 = this.shop[Main.npcShop].item[num157].GetColor(white13);
                             float arg_A47C_5 = 0f;
                             origin = default(Microsoft.Xna.Framework.Vector2);
                             arg_A47C_0.Draw(arg_A47C_1, arg_A47C_2, arg_A47C_3, arg_A47C_4, arg_A47C_5, origin, num158, SpriteEffects.None, 0f);
                         }
                         if (this.shop[Main.npcShop].item[num157].stack > 1)
                         {
                             SpriteBatch arg_A50B_0 = this.spriteBatch;
                             SpriteFont arg_A50B_1 = Main.fontItemStack;
                             string arg_A50B_2 = string.Concat(this.shop[Main.npcShop].item[num157].stack);
                             Microsoft.Xna.Framework.Vector2 arg_A50B_3 = new Microsoft.Xna.Framework.Vector2((float)num155 + 10f * Main.inventoryScale, (float)num156 + 26f * Main.inventoryScale);
                             Microsoft.Xna.Framework.Color arg_A50B_4 = white13;
                             float arg_A50B_5 = 0f;
                             origin = default(Microsoft.Xna.Framework.Vector2);
                             arg_A50B_0.DrawString(arg_A50B_1, arg_A50B_2, arg_A50B_3, arg_A50B_4, arg_A50B_5, origin, num158, SpriteEffects.None, 0f);
                         }
                     }
                 }
             }
         }
         if (Main.player[Main.myPlayer].chest > -1 && Main.tile[Main.player[Main.myPlayer].chestX, Main.player[Main.myPlayer].chestY].type != 21)
         {
             Main.player[Main.myPlayer].chest = -1;
         }
         if (Main.player[Main.myPlayer].chest != -1)
         {
             Main.inventoryScale = 0.75f;
             if (Main.mouseX > 73 && Main.mouseX < (int)(73f + 280f * Main.inventoryScale) && Main.mouseY > 210 && Main.mouseY < (int)(210f + 224f * Main.inventoryScale))
             {
                 Main.player[Main.myPlayer].mouseInterface = true;
             }
             for (int num159 = 0; num159 < 3; num159++)
             {
                 int num160 = 286;
                 int num161 = 250;
                 float num162 = this.chestLootScale;
                 string text23 = "Loot All";
                 if (num159 == 1)
                 {
                     num161 += 26;
                     num162 = this.chestDepositScale;
                     text23 = "Deposit All";
                 }
                 else
                 {
                     if (num159 == 2)
                     {
                         num161 += 52;
                         num162 = this.chestStackScale;
                         text23 = "Quick Stack";
                     }
                 }
                 Microsoft.Xna.Framework.Vector2 vector7 = Main.fontMouseText.MeasureString(text23) / 2f;
                 Microsoft.Xna.Framework.Color color8 = new Microsoft.Xna.Framework.Color((int)((byte)((float)Main.mouseTextColor * num162)), (int)((byte)((float)Main.mouseTextColor * num162)), (int)((byte)((float)Main.mouseTextColor * num162)), (int)((byte)((float)Main.mouseTextColor * num162)));
                 num160 += (int)(vector7.X * num162);
                 this.spriteBatch.DrawString(Main.fontMouseText, text23, new Microsoft.Xna.Framework.Vector2((float)num160, (float)num161), color8, 0f, vector7, num162, SpriteEffects.None, 0f);
                 vector7 *= num162;
                 if ((float)Main.mouseX > (float)num160 - vector7.X && (float)Main.mouseX < (float)num160 + vector7.X && (float)Main.mouseY > (float)num161 - vector7.Y && (float)Main.mouseY < (float)num161 + vector7.Y)
                 {
                     if (num159 == 0)
                     {
                         if (!this.chestLootHover)
                         {
                             Main.PlaySound(12, -1, -1, 1);
                         }
                         this.chestLootHover = true;
                     }
                     else
                     {
                         if (num159 == 1)
                         {
                             if (!this.chestDepositHover)
                             {
                                 Main.PlaySound(12, -1, -1, 1);
                             }
                             this.chestDepositHover = true;
                         }
                         else
                         {
                             if (!this.chestStackHover)
                             {
                                 Main.PlaySound(12, -1, -1, 1);
                             }
                             this.chestStackHover = true;
                         }
                     }
                     Main.player[Main.myPlayer].mouseInterface = true;
                     num162 += 0.05f;
                     if (Main.mouseLeft && Main.mouseLeftRelease)
                     {
                         if (num159 == 0)
                         {
                             if (Main.player[Main.myPlayer].chest > -1)
                             {
                                 for (int num163 = 0; num163 < 20; num163++)
                                 {
                                     if (Main.chest[Main.player[Main.myPlayer].chest].item[num163].type > 0)
                                     {
                                         Main.chest[Main.player[Main.myPlayer].chest].item[num163] = Main.player[Main.myPlayer].GetItem(Main.myPlayer, Main.chest[Main.player[Main.myPlayer].chest].item[num163]);
                                         if (Main.netMode == 1)
                                         {
                                             NetMessage.SendData(32, -1, -1, "", Main.player[Main.myPlayer].chest, (float)num163, 0f, 0f, 0);
                                         }
                                     }
                                 }
                             }
                             else
                             {
                                 if (Main.player[Main.myPlayer].chest == -3)
                                 {
                                     for (int num164 = 0; num164 < 20; num164++)
                                     {
                                         if (Main.player[Main.myPlayer].bank2[num164].type > 0)
                                         {
                                             Main.player[Main.myPlayer].bank2[num164] = Main.player[Main.myPlayer].GetItem(Main.myPlayer, Main.player[Main.myPlayer].bank2[num164]);
                                         }
                                     }
                                 }
                                 else
                                 {
                                     for (int num165 = 0; num165 < 20; num165++)
                                     {
                                         if (Main.player[Main.myPlayer].bank[num165].type > 0)
                                         {
                                             Main.player[Main.myPlayer].bank[num165] = Main.player[Main.myPlayer].GetItem(Main.myPlayer, Main.player[Main.myPlayer].bank[num165]);
                                         }
                                     }
                                 }
                             }
                         }
                         else
                         {
                             if (num159 == 1)
                             {
                                 for (int num166 = 40; num166 >= 10; num166--)
                                 {
                                     if (Main.player[Main.myPlayer].inventory[num166].stack > 0 && Main.player[Main.myPlayer].inventory[num166].type > 0)
                                     {
                                         if (Main.player[Main.myPlayer].inventory[num166].maxStack > 1)
                                         {
                                             for (int num167 = 0; num167 < 20; num167++)
                                             {
                                                 if (Main.player[Main.myPlayer].chest > -1)
                                                 {
                                                     if (Main.chest[Main.player[Main.myPlayer].chest].item[num167].stack < Main.chest[Main.player[Main.myPlayer].chest].item[num167].maxStack && Main.player[Main.myPlayer].inventory[num166].IsTheSameAs(Main.chest[Main.player[Main.myPlayer].chest].item[num167]))
                                                     {
                                                         int num168 = Main.player[Main.myPlayer].inventory[num166].stack;
                                                         if (Main.player[Main.myPlayer].inventory[num166].stack + Main.chest[Main.player[Main.myPlayer].chest].item[num167].stack > Main.chest[Main.player[Main.myPlayer].chest].item[num167].maxStack)
                                                         {
                                                             num168 = Main.chest[Main.player[Main.myPlayer].chest].item[num167].maxStack - Main.chest[Main.player[Main.myPlayer].chest].item[num167].stack;
                                                         }
                                                         Main.player[Main.myPlayer].inventory[num166].stack -= num168;
                                                         Main.chest[Main.player[Main.myPlayer].chest].item[num167].stack += num168;
                                                         Main.ChestCoins();
                                                         Main.PlaySound(7, -1, -1, 1);
                                                         if (Main.player[Main.myPlayer].inventory[num166].stack <= 0)
                                                         {
                                                             Main.player[Main.myPlayer].inventory[num166].SetDefaults(0, false);
                                                             if (Main.netMode == 1)
                                                             {
                                                                 NetMessage.SendData(32, -1, -1, "", Main.player[Main.myPlayer].chest, (float)num167, 0f, 0f, 0);
                                                                 break;
                                                             }
                                                             break;
                                                         }
                                                         else
                                                         {
                                                             if (Main.chest[Main.player[Main.myPlayer].chest].item[num167].type == 0)
                                                             {
                                                                 Main.chest[Main.player[Main.myPlayer].chest].item[num167] = (Item)Main.player[Main.myPlayer].inventory[num166].Clone();
                                                                 Main.player[Main.myPlayer].inventory[num166].SetDefaults(0, false);
                                                             }
                                                             if (Main.netMode == 1)
                                                             {
                                                                 NetMessage.SendData(32, -1, -1, "", Main.player[Main.myPlayer].chest, (float)num167, 0f, 0f, 0);
                                                             }
                                                         }
                                                     }
                                                 }
                                                 else
                                                 {
                                                     if (Main.player[Main.myPlayer].chest == -3)
                                                     {
                                                         if (Main.player[Main.myPlayer].bank2[num167].stack < Main.player[Main.myPlayer].bank2[num167].maxStack && Main.player[Main.myPlayer].inventory[num166].IsTheSameAs(Main.player[Main.myPlayer].bank2[num167]))
                                                         {
                                                             int num169 = Main.player[Main.myPlayer].inventory[num166].stack;
                                                             if (Main.player[Main.myPlayer].inventory[num166].stack + Main.player[Main.myPlayer].bank2[num167].stack > Main.player[Main.myPlayer].bank2[num167].maxStack)
                                                             {
                                                                 num169 = Main.player[Main.myPlayer].bank2[num167].maxStack - Main.player[Main.myPlayer].bank2[num167].stack;
                                                             }
                                                             Main.player[Main.myPlayer].inventory[num166].stack -= num169;
                                                             Main.player[Main.myPlayer].bank2[num167].stack += num169;
                                                             Main.PlaySound(7, -1, -1, 1);
                                                             Main.BankCoins();
                                                             if (Main.player[Main.myPlayer].inventory[num166].stack <= 0)
                                                             {
                                                                 Main.player[Main.myPlayer].inventory[num166].SetDefaults(0, false);
                                                                 break;
                                                             }
                                                             if (Main.player[Main.myPlayer].bank2[num167].type == 0)
                                                             {
                                                                 Main.player[Main.myPlayer].bank2[num167] = (Item)Main.player[Main.myPlayer].inventory[num166].Clone();
                                                                 Main.player[Main.myPlayer].inventory[num166].SetDefaults(0, false);
                                                             }
                                                         }
                                                     }
                                                     else
                                                     {
                                                         if (Main.player[Main.myPlayer].bank[num167].stack < Main.player[Main.myPlayer].bank[num167].maxStack && Main.player[Main.myPlayer].inventory[num166].IsTheSameAs(Main.player[Main.myPlayer].bank[num167]))
                                                         {
                                                             int num170 = Main.player[Main.myPlayer].inventory[num166].stack;
                                                             if (Main.player[Main.myPlayer].inventory[num166].stack + Main.player[Main.myPlayer].bank[num167].stack > Main.player[Main.myPlayer].bank[num167].maxStack)
                                                             {
                                                                 num170 = Main.player[Main.myPlayer].bank[num167].maxStack - Main.player[Main.myPlayer].bank[num167].stack;
                                                             }
                                                             Main.player[Main.myPlayer].inventory[num166].stack -= num170;
                                                             Main.player[Main.myPlayer].bank[num167].stack += num170;
                                                             Main.PlaySound(7, -1, -1, 1);
                                                             Main.BankCoins();
                                                             if (Main.player[Main.myPlayer].inventory[num166].stack <= 0)
                                                             {
                                                                 Main.player[Main.myPlayer].inventory[num166].SetDefaults(0, false);
                                                                 break;
                                                             }
                                                             if (Main.player[Main.myPlayer].bank[num167].type == 0)
                                                             {
                                                                 Main.player[Main.myPlayer].bank[num167] = (Item)Main.player[Main.myPlayer].inventory[num166].Clone();
                                                                 Main.player[Main.myPlayer].inventory[num166].SetDefaults(0, false);
                                                             }
                                                         }
                                                     }
                                                 }
                                             }
                                         }
                                         if (Main.player[Main.myPlayer].inventory[num166].stack > 0)
                                         {
                                             if (Main.player[Main.myPlayer].chest > -1)
                                             {
                                                 int num171 = 0;
                                                 while (num171 < 20)
                                                 {
                                                     if (Main.chest[Main.player[Main.myPlayer].chest].item[num171].stack == 0)
                                                     {
                                                         Main.PlaySound(7, -1, -1, 1);
                                                         Main.chest[Main.player[Main.myPlayer].chest].item[num171] = (Item)Main.player[Main.myPlayer].inventory[num166].Clone();
                                                         Main.player[Main.myPlayer].inventory[num166].SetDefaults(0, false);
                                                         if (Main.netMode == 1)
                                                         {
                                                             NetMessage.SendData(32, -1, -1, "", Main.player[Main.myPlayer].chest, (float)num171, 0f, 0f, 0);
                                                             break;
                                                         }
                                                         break;
                                                     }
                                                     else
                                                     {
                                                         num171++;
                                                     }
                                                 }
                                             }
                                             else
                                             {
                                                 if (Main.player[Main.myPlayer].chest == -3)
                                                 {
                                                     for (int num172 = 0; num172 < 20; num172++)
                                                     {
                                                         if (Main.player[Main.myPlayer].bank2[num172].stack == 0)
                                                         {
                                                             Main.PlaySound(7, -1, -1, 1);
                                                             Main.player[Main.myPlayer].bank2[num172] = (Item)Main.player[Main.myPlayer].inventory[num166].Clone();
                                                             Main.player[Main.myPlayer].inventory[num166].SetDefaults(0, false);
                                                             break;
                                                         }
                                                     }
                                                 }
                                                 else
                                                 {
                                                     for (int num173 = 0; num173 < 20; num173++)
                                                     {
                                                         if (Main.player[Main.myPlayer].bank[num173].stack == 0)
                                                         {
                                                             Main.PlaySound(7, -1, -1, 1);
                                                             Main.player[Main.myPlayer].bank[num173] = (Item)Main.player[Main.myPlayer].inventory[num166].Clone();
                                                             Main.player[Main.myPlayer].inventory[num166].SetDefaults(0, false);
                                                             break;
                                                         }
                                                     }
                                                 }
                                             }
                                         }
                                     }
                                 }
                             }
                             else
                             {
                                 if (Main.player[Main.myPlayer].chest > -1)
                                 {
                                     for (int num174 = 0; num174 < 20; num174++)
                                     {
                                         if (Main.chest[Main.player[Main.myPlayer].chest].item[num174].type > 0 && Main.chest[Main.player[Main.myPlayer].chest].item[num174].stack < Main.chest[Main.player[Main.myPlayer].chest].item[num174].maxStack)
                                         {
                                             for (int num175 = 0; num175 < 48; num175++)
                                             {
                                                 if (Main.chest[Main.player[Main.myPlayer].chest].item[num174].IsTheSameAs(Main.player[Main.myPlayer].inventory[num175]))
                                                 {
                                                     int num176 = Main.player[Main.myPlayer].inventory[num175].stack;
                                                     if (Main.chest[Main.player[Main.myPlayer].chest].item[num174].stack + num176 > Main.chest[Main.player[Main.myPlayer].chest].item[num174].maxStack)
                                                     {
                                                         num176 = Main.chest[Main.player[Main.myPlayer].chest].item[num174].maxStack - Main.chest[Main.player[Main.myPlayer].chest].item[num174].stack;
                                                     }
                                                     Main.PlaySound(7, -1, -1, 1);
                                                     Main.chest[Main.player[Main.myPlayer].chest].item[num174].stack += num176;
                                                     Main.player[Main.myPlayer].inventory[num175].stack -= num176;
                                                     Main.ChestCoins();
                                                     if (Main.player[Main.myPlayer].inventory[num175].stack == 0)
                                                     {
                                                         Main.player[Main.myPlayer].inventory[num175].SetDefaults(0, false);
                                                     }
                                                     else
                                                     {
                                                         if (Main.chest[Main.player[Main.myPlayer].chest].item[num174].type == 0)
                                                         {
                                                             Main.chest[Main.player[Main.myPlayer].chest].item[num174] = (Item)Main.player[Main.myPlayer].inventory[num175].Clone();
                                                             Main.player[Main.myPlayer].inventory[num175].SetDefaults(0, false);
                                                         }
                                                     }
                                                     if (Main.netMode == 1)
                                                     {
                                                         NetMessage.SendData(32, -1, -1, "", Main.player[Main.myPlayer].chest, (float)num174, 0f, 0f, 0);
                                                     }
                                                 }
                                             }
                                         }
                                     }
                                 }
                                 else
                                 {
                                     if (Main.player[Main.myPlayer].chest == -3)
                                     {
                                         for (int num177 = 0; num177 < 20; num177++)
                                         {
                                             if (Main.player[Main.myPlayer].bank2[num177].type > 0 && Main.player[Main.myPlayer].bank2[num177].stack < Main.player[Main.myPlayer].bank2[num177].maxStack)
                                             {
                                                 for (int num178 = 0; num178 < 48; num178++)
                                                 {
                                                     if (Main.player[Main.myPlayer].bank2[num177].IsTheSameAs(Main.player[Main.myPlayer].inventory[num178]))
                                                     {
                                                         int num179 = Main.player[Main.myPlayer].inventory[num178].stack;
                                                         if (Main.player[Main.myPlayer].bank2[num177].stack + num179 > Main.player[Main.myPlayer].bank2[num177].maxStack)
                                                         {
                                                             num179 = Main.player[Main.myPlayer].bank2[num177].maxStack - Main.player[Main.myPlayer].bank2[num177].stack;
                                                         }
                                                         Main.PlaySound(7, -1, -1, 1);
                                                         Main.player[Main.myPlayer].bank2[num177].stack += num179;
                                                         Main.player[Main.myPlayer].inventory[num178].stack -= num179;
                                                         Main.BankCoins();
                                                         if (Main.player[Main.myPlayer].inventory[num178].stack == 0)
                                                         {
                                                             Main.player[Main.myPlayer].inventory[num178].SetDefaults(0, false);
                                                         }
                                                         else
                                                         {
                                                             if (Main.player[Main.myPlayer].bank2[num177].type == 0)
                                                             {
                                                                 Main.player[Main.myPlayer].bank2[num177] = (Item)Main.player[Main.myPlayer].inventory[num178].Clone();
                                                                 Main.player[Main.myPlayer].inventory[num178].SetDefaults(0, false);
                                                             }
                                                         }
                                                     }
                                                 }
                                             }
                                         }
                                     }
                                     else
                                     {
                                         for (int num180 = 0; num180 < 20; num180++)
                                         {
                                             if (Main.player[Main.myPlayer].bank[num180].type > 0 && Main.player[Main.myPlayer].bank[num180].stack < Main.player[Main.myPlayer].bank[num180].maxStack)
                                             {
                                                 for (int num181 = 0; num181 < 48; num181++)
                                                 {
                                                     if (Main.player[Main.myPlayer].bank[num180].IsTheSameAs(Main.player[Main.myPlayer].inventory[num181]))
                                                     {
                                                         int num182 = Main.player[Main.myPlayer].inventory[num181].stack;
                                                         if (Main.player[Main.myPlayer].bank[num180].stack + num182 > Main.player[Main.myPlayer].bank[num180].maxStack)
                                                         {
                                                             num182 = Main.player[Main.myPlayer].bank[num180].maxStack - Main.player[Main.myPlayer].bank[num180].stack;
                                                         }
                                                         Main.PlaySound(7, -1, -1, 1);
                                                         Main.player[Main.myPlayer].bank[num180].stack += num182;
                                                         Main.player[Main.myPlayer].inventory[num181].stack -= num182;
                                                         Main.BankCoins();
                                                         if (Main.player[Main.myPlayer].inventory[num181].stack == 0)
                                                         {
                                                             Main.player[Main.myPlayer].inventory[num181].SetDefaults(0, false);
                                                         }
                                                         else
                                                         {
                                                             if (Main.player[Main.myPlayer].bank[num180].type == 0)
                                                             {
                                                                 Main.player[Main.myPlayer].bank[num180] = (Item)Main.player[Main.myPlayer].inventory[num181].Clone();
                                                                 Main.player[Main.myPlayer].inventory[num181].SetDefaults(0, false);
                                                             }
                                                         }
                                                     }
                                                 }
                                             }
                                         }
                                     }
                                 }
                             }
                         }
                         Recipe.FindRecipes();
                     }
                 }
                 else
                 {
                     num162 -= 0.05f;
                     if (num159 == 0)
                     {
                         this.chestLootHover = false;
                     }
                     else
                     {
                         if (num159 == 1)
                         {
                             this.chestDepositHover = false;
                         }
                         else
                         {
                             this.chestStackHover = false;
                         }
                     }
                 }
                 if ((double)num162 < 0.75)
                 {
                     num162 = 0.75f;
                 }
                 if (num162 > 1f)
                 {
                     num162 = 1f;
                 }
                 if (num159 == 0)
                 {
                     this.chestLootScale = num162;
                 }
                 else
                 {
                     if (num159 == 1)
                     {
                         this.chestDepositScale = num162;
                     }
                     else
                     {
                         this.chestStackScale = num162;
                     }
                 }
             }
         }
         else
         {
             this.chestLootScale = 0.75f;
             this.chestDepositScale = 0.75f;
             this.chestStackScale = 0.75f;
             this.chestLootHover = false;
             this.chestDepositHover = false;
             this.chestStackHover = false;
         }
         if (Main.player[Main.myPlayer].chest > -1)
         {
             SpriteBatch arg_BC5E_0 = this.spriteBatch;
             SpriteFont arg_BC5E_1 = Main.fontMouseText;
             string arg_BC5E_2 = Main.chestText;
             Microsoft.Xna.Framework.Vector2 arg_BC5E_3 = new Microsoft.Xna.Framework.Vector2(284f, 210f);
             Microsoft.Xna.Framework.Color arg_BC5E_4 = new Microsoft.Xna.Framework.Color((int)Main.mouseTextColor, (int)Main.mouseTextColor, (int)Main.mouseTextColor, (int)Main.mouseTextColor);
             float arg_BC5E_5 = 0f;
             origin = default(Microsoft.Xna.Framework.Vector2);
             arg_BC5E_0.DrawString(arg_BC5E_1, arg_BC5E_2, arg_BC5E_3, arg_BC5E_4, arg_BC5E_5, origin, 1f, SpriteEffects.None, 0f);
             Main.inventoryScale = 0.75f;
             if (Main.mouseX > 73 && Main.mouseX < (int)(73f + 280f * Main.inventoryScale) && Main.mouseY > 210 && Main.mouseY < (int)(210f + 224f * Main.inventoryScale))
             {
                 Main.player[Main.myPlayer].mouseInterface = true;
             }
             for (int num183 = 0; num183 < 5; num183++)
             {
                 for (int num184 = 0; num184 < 4; num184++)
                 {
                     int num185 = (int)(73f + (float)(num183 * 56) * Main.inventoryScale);
                     int num186 = (int)(210f + (float)(num184 * 56) * Main.inventoryScale);
                     int num187 = num183 + num184 * 5;
                     Microsoft.Xna.Framework.Color white14 = new Microsoft.Xna.Framework.Color(100, 100, 100, 100);
                     if (Main.mouseX >= num185 && (float)Main.mouseX <= (float)num185 + (float)Main.inventoryBackTexture.Width * Main.inventoryScale && Main.mouseY >= num186 && (float)Main.mouseY <= (float)num186 + (float)Main.inventoryBackTexture.Height * Main.inventoryScale)
                     {
                         Main.player[Main.myPlayer].mouseInterface = true;
                         if (Main.mouseLeftRelease && Main.mouseLeft)
                         {
                             if (Main.player[Main.myPlayer].selectedItem != num187 || Main.player[Main.myPlayer].itemAnimation <= 0)
                             {
                                 Item item9 = Main.mouseItem;
                                 Main.mouseItem = Main.chest[Main.player[Main.myPlayer].chest].item[num187];
                                 Main.chest[Main.player[Main.myPlayer].chest].item[num187] = item9;
                                 if (Main.chest[Main.player[Main.myPlayer].chest].item[num187].type == 0 || Main.chest[Main.player[Main.myPlayer].chest].item[num187].stack < 1)
                                 {
                                     Main.chest[Main.player[Main.myPlayer].chest].item[num187] = new Item();
                                 }
                                 if (Main.mouseItem.IsTheSameAs(Main.chest[Main.player[Main.myPlayer].chest].item[num187]) && Main.chest[Main.player[Main.myPlayer].chest].item[num187].stack != Main.chest[Main.player[Main.myPlayer].chest].item[num187].maxStack && Main.mouseItem.stack != Main.mouseItem.maxStack)
                                 {
                                     if (Main.mouseItem.stack + Main.chest[Main.player[Main.myPlayer].chest].item[num187].stack <= Main.mouseItem.maxStack)
                                     {
                                         Main.chest[Main.player[Main.myPlayer].chest].item[num187].stack += Main.mouseItem.stack;
                                         Main.mouseItem.stack = 0;
                                     }
                                     else
                                     {
                                         int num188 = Main.mouseItem.maxStack - Main.chest[Main.player[Main.myPlayer].chest].item[num187].stack;
                                         Main.chest[Main.player[Main.myPlayer].chest].item[num187].stack += num188;
                                         Main.mouseItem.stack -= num188;
                                     }
                                 }
                                 if (Main.mouseItem.type == 0 || Main.mouseItem.stack < 1)
                                 {
                                     Main.mouseItem = new Item();
                                 }
                                 if (Main.mouseItem.type > 0 || Main.chest[Main.player[Main.myPlayer].chest].item[num187].type > 0)
                                 {
                                     Recipe.FindRecipes();
                                     Main.PlaySound(7, -1, -1, 1);
                                 }
                                 if (Main.netMode == 1)
                                 {
                                     NetMessage.SendData(32, -1, -1, "", Main.player[Main.myPlayer].chest, (float)num187, 0f, 0f, 0);
                                 }
                             }
                         }
                         else
                         {
                             if (Main.mouseRight && Main.mouseRightRelease && Main.chest[Main.player[Main.myPlayer].chest].item[num187].maxStack == 1)
                             {
                                 Main.chest[Main.player[Main.myPlayer].chest].item[num187] = Main.armorSwap(Main.chest[Main.player[Main.myPlayer].chest].item[num187]);
                                 if (Main.netMode == 1)
                                 {
                                     NetMessage.SendData(32, -1, -1, "", Main.player[Main.myPlayer].chest, (float)num187, 0f, 0f, 0);
                                 }
                             }
                             else
                             {
                                 if (Main.stackSplit <= 1 && Main.mouseRight && Main.chest[Main.player[Main.myPlayer].chest].item[num187].maxStack > 1 && (Main.mouseItem.IsTheSameAs(Main.chest[Main.player[Main.myPlayer].chest].item[num187]) || Main.mouseItem.type == 0) && (Main.mouseItem.stack < Main.mouseItem.maxStack || Main.mouseItem.type == 0))
                                 {
                                     if (Main.mouseItem.type == 0)
                                     {
                                         Main.mouseItem = (Item)Main.chest[Main.player[Main.myPlayer].chest].item[num187].Clone();
                                         Main.mouseItem.stack = 0;
                                     }
                                     Main.mouseItem.stack++;
                                     Main.chest[Main.player[Main.myPlayer].chest].item[num187].stack--;
                                     if (Main.chest[Main.player[Main.myPlayer].chest].item[num187].stack <= 0)
                                     {
                                         Main.chest[Main.player[Main.myPlayer].chest].item[num187] = new Item();
                                     }
                                     Recipe.FindRecipes();
                                     Main.soundInstanceMenuTick.Stop();
                                     Main.soundInstanceMenuTick = Main.soundMenuTick.CreateInstance();
                                     Main.PlaySound(12, -1, -1, 1);
                                     if (Main.stackSplit == 0)
                                     {
                                         Main.stackSplit = 15;
                                     }
                                     else
                                     {
                                         Main.stackSplit = Main.stackDelay;
                                     }
                                     if (Main.netMode == 1)
                                     {
                                         NetMessage.SendData(32, -1, -1, "", Main.player[Main.myPlayer].chest, (float)num187, 0f, 0f, 0);
                                     }
                                 }
                             }
                         }
                         text15 = Main.chest[Main.player[Main.myPlayer].chest].item[num187].name;
                         Main.toolTip = (Item)Main.chest[Main.player[Main.myPlayer].chest].item[num187].Clone();
                         if (Main.chest[Main.player[Main.myPlayer].chest].item[num187].stack > 1)
                         {
                             object obj = text15;
                             text15 = string.Concat(new object[]
                             {
                                 obj,
                                 " (",
                                 Main.chest[Main.player[Main.myPlayer].chest].item[num187].stack,
                                 ")"
                             });
                         }
                     }
                     SpriteBatch arg_C4C4_0 = this.spriteBatch;
                     Texture2D arg_C4C4_1 = Main.inventoryBack5Texture;
                     Microsoft.Xna.Framework.Vector2 arg_C4C4_2 = new Microsoft.Xna.Framework.Vector2((float)num185, (float)num186);
                     Microsoft.Xna.Framework.Rectangle? arg_C4C4_3 = new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.inventoryBackTexture.Width, Main.inventoryBackTexture.Height));
                     Microsoft.Xna.Framework.Color arg_C4C4_4 = color2;
                     float arg_C4C4_5 = 0f;
                     origin = default(Microsoft.Xna.Framework.Vector2);
                     arg_C4C4_0.Draw(arg_C4C4_1, arg_C4C4_2, arg_C4C4_3, arg_C4C4_4, arg_C4C4_5, origin, Main.inventoryScale, SpriteEffects.None, 0f);
                     white14 = Microsoft.Xna.Framework.Color.White;
                     if (Main.chest[Main.player[Main.myPlayer].chest].item[num187].type > 0 && Main.chest[Main.player[Main.myPlayer].chest].item[num187].stack > 0)
                     {
                         float num189 = 1f;
                         if (Main.itemTexture[Main.chest[Main.player[Main.myPlayer].chest].item[num187].type].Width > 32 || Main.itemTexture[Main.chest[Main.player[Main.myPlayer].chest].item[num187].type].Height > 32)
                         {
                             if (Main.itemTexture[Main.chest[Main.player[Main.myPlayer].chest].item[num187].type].Width > Main.itemTexture[Main.chest[Main.player[Main.myPlayer].chest].item[num187].type].Height)
                             {
                                 num189 = 32f / (float)Main.itemTexture[Main.chest[Main.player[Main.myPlayer].chest].item[num187].type].Width;
                             }
                             else
                             {
                                 num189 = 32f / (float)Main.itemTexture[Main.chest[Main.player[Main.myPlayer].chest].item[num187].type].Height;
                             }
                         }
                         num189 *= Main.inventoryScale;
                         SpriteBatch arg_C808_0 = this.spriteBatch;
                         Texture2D arg_C808_1 = Main.itemTexture[Main.chest[Main.player[Main.myPlayer].chest].item[num187].type];
                         Microsoft.Xna.Framework.Vector2 arg_C808_2 = new Microsoft.Xna.Framework.Vector2((float)num185 + 26f * Main.inventoryScale - (float)Main.itemTexture[Main.chest[Main.player[Main.myPlayer].chest].item[num187].type].Width * 0.5f * num189, (float)num186 + 26f * Main.inventoryScale - (float)Main.itemTexture[Main.chest[Main.player[Main.myPlayer].chest].item[num187].type].Height * 0.5f * num189);
                         Microsoft.Xna.Framework.Rectangle? arg_C808_3 = new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.itemTexture[Main.chest[Main.player[Main.myPlayer].chest].item[num187].type].Width, Main.itemTexture[Main.chest[Main.player[Main.myPlayer].chest].item[num187].type].Height));
                         Microsoft.Xna.Framework.Color arg_C808_4 = Main.chest[Main.player[Main.myPlayer].chest].item[num187].GetAlpha(white14);
                         float arg_C808_5 = 0f;
                         origin = default(Microsoft.Xna.Framework.Vector2);
                         arg_C808_0.Draw(arg_C808_1, arg_C808_2, arg_C808_3, arg_C808_4, arg_C808_5, origin, num189, SpriteEffects.None, 0f);
                         Microsoft.Xna.Framework.Color arg_C840_0 = Main.chest[Main.player[Main.myPlayer].chest].item[num187].color;
                         Microsoft.Xna.Framework.Color b = default(Microsoft.Xna.Framework.Color);
                         if (arg_C840_0 != b)
                         {
                             SpriteBatch arg_C9CE_0 = this.spriteBatch;
                             Texture2D arg_C9CE_1 = Main.itemTexture[Main.chest[Main.player[Main.myPlayer].chest].item[num187].type];
                             Microsoft.Xna.Framework.Vector2 arg_C9CE_2 = new Microsoft.Xna.Framework.Vector2((float)num185 + 26f * Main.inventoryScale - (float)Main.itemTexture[Main.chest[Main.player[Main.myPlayer].chest].item[num187].type].Width * 0.5f * num189, (float)num186 + 26f * Main.inventoryScale - (float)Main.itemTexture[Main.chest[Main.player[Main.myPlayer].chest].item[num187].type].Height * 0.5f * num189);
                             Microsoft.Xna.Framework.Rectangle? arg_C9CE_3 = new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.itemTexture[Main.chest[Main.player[Main.myPlayer].chest].item[num187].type].Width, Main.itemTexture[Main.chest[Main.player[Main.myPlayer].chest].item[num187].type].Height));
                             Microsoft.Xna.Framework.Color arg_C9CE_4 = Main.chest[Main.player[Main.myPlayer].chest].item[num187].GetColor(white14);
                             float arg_C9CE_5 = 0f;
                             origin = default(Microsoft.Xna.Framework.Vector2);
                             arg_C9CE_0.Draw(arg_C9CE_1, arg_C9CE_2, arg_C9CE_3, arg_C9CE_4, arg_C9CE_5, origin, num189, SpriteEffects.None, 0f);
                         }
                         if (Main.chest[Main.player[Main.myPlayer].chest].item[num187].stack > 1)
                         {
                             SpriteBatch arg_CA80_0 = this.spriteBatch;
                             SpriteFont arg_CA80_1 = Main.fontItemStack;
                             string arg_CA80_2 = string.Concat(Main.chest[Main.player[Main.myPlayer].chest].item[num187].stack);
                             Microsoft.Xna.Framework.Vector2 arg_CA80_3 = new Microsoft.Xna.Framework.Vector2((float)num185 + 10f * Main.inventoryScale, (float)num186 + 26f * Main.inventoryScale);
                             Microsoft.Xna.Framework.Color arg_CA80_4 = white14;
                             float arg_CA80_5 = 0f;
                             origin = default(Microsoft.Xna.Framework.Vector2);
                             arg_CA80_0.DrawString(arg_CA80_1, arg_CA80_2, arg_CA80_3, arg_CA80_4, arg_CA80_5, origin, num189, SpriteEffects.None, 0f);
                         }
                     }
                 }
             }
         }
         if (Main.player[Main.myPlayer].chest == -2)
         {
             SpriteBatch arg_CB1A_0 = this.spriteBatch;
             SpriteFont arg_CB1A_1 = Main.fontMouseText;
             string arg_CB1A_2 = "Piggy Bank";
             Microsoft.Xna.Framework.Vector2 arg_CB1A_3 = new Microsoft.Xna.Framework.Vector2(284f, 210f);
             Microsoft.Xna.Framework.Color arg_CB1A_4 = new Microsoft.Xna.Framework.Color((int)Main.mouseTextColor, (int)Main.mouseTextColor, (int)Main.mouseTextColor, (int)Main.mouseTextColor);
             float arg_CB1A_5 = 0f;
             origin = default(Microsoft.Xna.Framework.Vector2);
             arg_CB1A_0.DrawString(arg_CB1A_1, arg_CB1A_2, arg_CB1A_3, arg_CB1A_4, arg_CB1A_5, origin, 1f, SpriteEffects.None, 0f);
             Main.inventoryScale = 0.75f;
             if (Main.mouseX > 73 && Main.mouseX < (int)(73f + 280f * Main.inventoryScale) && Main.mouseY > 210 && Main.mouseY < (int)(210f + 224f * Main.inventoryScale))
             {
                 Main.player[Main.myPlayer].mouseInterface = true;
             }
             for (int num190 = 0; num190 < 5; num190++)
             {
                 for (int num191 = 0; num191 < 4; num191++)
                 {
                     int num192 = (int)(73f + (float)(num190 * 56) * Main.inventoryScale);
                     int num193 = (int)(210f + (float)(num191 * 56) * Main.inventoryScale);
                     int num194 = num190 + num191 * 5;
                     Microsoft.Xna.Framework.Color white15 = new Microsoft.Xna.Framework.Color(100, 100, 100, 100);
                     if (Main.mouseX >= num192 && (float)Main.mouseX <= (float)num192 + (float)Main.inventoryBackTexture.Width * Main.inventoryScale && Main.mouseY >= num193 && (float)Main.mouseY <= (float)num193 + (float)Main.inventoryBackTexture.Height * Main.inventoryScale)
                     {
                         Main.player[Main.myPlayer].mouseInterface = true;
                         if (Main.mouseLeftRelease && Main.mouseLeft)
                         {
                             if (Main.player[Main.myPlayer].selectedItem != num194 || Main.player[Main.myPlayer].itemAnimation <= 0)
                             {
                                 Item item10 = Main.mouseItem;
                                 Main.mouseItem = Main.player[Main.myPlayer].bank[num194];
                                 Main.player[Main.myPlayer].bank[num194] = item10;
                                 if (Main.player[Main.myPlayer].bank[num194].type == 0 || Main.player[Main.myPlayer].bank[num194].stack < 1)
                                 {
                                     Main.player[Main.myPlayer].bank[num194] = new Item();
                                 }
                                 if (Main.mouseItem.IsTheSameAs(Main.player[Main.myPlayer].bank[num194]) && Main.player[Main.myPlayer].bank[num194].stack != Main.player[Main.myPlayer].bank[num194].maxStack && Main.mouseItem.stack != Main.mouseItem.maxStack)
                                 {
                                     if (Main.mouseItem.stack + Main.player[Main.myPlayer].bank[num194].stack <= Main.mouseItem.maxStack)
                                     {
                                         Main.player[Main.myPlayer].bank[num194].stack += Main.mouseItem.stack;
                                         Main.mouseItem.stack = 0;
                                     }
                                     else
                                     {
                                         int num195 = Main.mouseItem.maxStack - Main.player[Main.myPlayer].bank[num194].stack;
                                         Main.player[Main.myPlayer].bank[num194].stack += num195;
                                         Main.mouseItem.stack -= num195;
                                     }
                                 }
                                 if (Main.mouseItem.type == 0 || Main.mouseItem.stack < 1)
                                 {
                                     Main.mouseItem = new Item();
                                 }
                                 if (Main.mouseItem.type > 0 || Main.player[Main.myPlayer].bank[num194].type > 0)
                                 {
                                     Recipe.FindRecipes();
                                     Main.PlaySound(7, -1, -1, 1);
                                 }
                             }
                         }
                         else
                         {
                             if (Main.mouseRight && Main.mouseRightRelease && Main.player[Main.myPlayer].bank[num194].maxStack == 1)
                             {
                                 Main.player[Main.myPlayer].bank[num194] = Main.armorSwap(Main.player[Main.myPlayer].bank[num194]);
                             }
                             else
                             {
                                 if (Main.stackSplit <= 1 && Main.mouseRight && Main.player[Main.myPlayer].bank[num194].maxStack > 1 && (Main.mouseItem.IsTheSameAs(Main.player[Main.myPlayer].bank[num194]) || Main.mouseItem.type == 0) && (Main.mouseItem.stack < Main.mouseItem.maxStack || Main.mouseItem.type == 0))
                                 {
                                     if (Main.mouseItem.type == 0)
                                     {
                                         Main.mouseItem = (Item)Main.player[Main.myPlayer].bank[num194].Clone();
                                         Main.mouseItem.stack = 0;
                                     }
                                     Main.mouseItem.stack++;
                                     Main.player[Main.myPlayer].bank[num194].stack--;
                                     if (Main.player[Main.myPlayer].bank[num194].stack <= 0)
                                     {
                                         Main.player[Main.myPlayer].bank[num194] = new Item();
                                     }
                                     Recipe.FindRecipes();
                                     Main.soundInstanceMenuTick.Stop();
                                     Main.soundInstanceMenuTick = Main.soundMenuTick.CreateInstance();
                                     Main.PlaySound(12, -1, -1, 1);
                                     if (Main.stackSplit == 0)
                                     {
                                         Main.stackSplit = 15;
                                     }
                                     else
                                     {
                                         Main.stackSplit = Main.stackDelay;
                                     }
                                 }
                             }
                         }
                         text15 = Main.player[Main.myPlayer].bank[num194].name;
                         Main.toolTip = (Item)Main.player[Main.myPlayer].bank[num194].Clone();
                         if (Main.player[Main.myPlayer].bank[num194].stack > 1)
                         {
                             object obj = text15;
                             text15 = string.Concat(new object[]
                             {
                                 obj,
                                 " (",
                                 Main.player[Main.myPlayer].bank[num194].stack,
                                 ")"
                             });
                         }
                     }
                     SpriteBatch arg_D1B4_0 = this.spriteBatch;
                     Texture2D arg_D1B4_1 = Main.inventoryBack2Texture;
                     Microsoft.Xna.Framework.Vector2 arg_D1B4_2 = new Microsoft.Xna.Framework.Vector2((float)num192, (float)num193);
                     Microsoft.Xna.Framework.Rectangle? arg_D1B4_3 = new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.inventoryBackTexture.Width, Main.inventoryBackTexture.Height));
                     Microsoft.Xna.Framework.Color arg_D1B4_4 = color2;
                     float arg_D1B4_5 = 0f;
                     origin = default(Microsoft.Xna.Framework.Vector2);
                     arg_D1B4_0.Draw(arg_D1B4_1, arg_D1B4_2, arg_D1B4_3, arg_D1B4_4, arg_D1B4_5, origin, Main.inventoryScale, SpriteEffects.None, 0f);
                     white15 = Microsoft.Xna.Framework.Color.White;
                     if (Main.player[Main.myPlayer].bank[num194].type > 0 && Main.player[Main.myPlayer].bank[num194].stack > 0)
                     {
                         float num196 = 1f;
                         if (Main.itemTexture[Main.player[Main.myPlayer].bank[num194].type].Width > 32 || Main.itemTexture[Main.player[Main.myPlayer].bank[num194].type].Height > 32)
                         {
                             if (Main.itemTexture[Main.player[Main.myPlayer].bank[num194].type].Width > Main.itemTexture[Main.player[Main.myPlayer].bank[num194].type].Height)
                             {
                                 num196 = 32f / (float)Main.itemTexture[Main.player[Main.myPlayer].bank[num194].type].Width;
                             }
                             else
                             {
                                 num196 = 32f / (float)Main.itemTexture[Main.player[Main.myPlayer].bank[num194].type].Height;
                             }
                         }
                         num196 *= Main.inventoryScale;
                         SpriteBatch arg_D45E_0 = this.spriteBatch;
                         Texture2D arg_D45E_1 = Main.itemTexture[Main.player[Main.myPlayer].bank[num194].type];
                         Microsoft.Xna.Framework.Vector2 arg_D45E_2 = new Microsoft.Xna.Framework.Vector2((float)num192 + 26f * Main.inventoryScale - (float)Main.itemTexture[Main.player[Main.myPlayer].bank[num194].type].Width * 0.5f * num196, (float)num193 + 26f * Main.inventoryScale - (float)Main.itemTexture[Main.player[Main.myPlayer].bank[num194].type].Height * 0.5f * num196);
                         Microsoft.Xna.Framework.Rectangle? arg_D45E_3 = new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.itemTexture[Main.player[Main.myPlayer].bank[num194].type].Width, Main.itemTexture[Main.player[Main.myPlayer].bank[num194].type].Height));
                         Microsoft.Xna.Framework.Color arg_D45E_4 = Main.player[Main.myPlayer].bank[num194].GetAlpha(white15);
                         float arg_D45E_5 = 0f;
                         origin = default(Microsoft.Xna.Framework.Vector2);
                         arg_D45E_0.Draw(arg_D45E_1, arg_D45E_2, arg_D45E_3, arg_D45E_4, arg_D45E_5, origin, num196, SpriteEffects.None, 0f);
                         Microsoft.Xna.Framework.Color arg_D48B_0 = Main.player[Main.myPlayer].bank[num194].color;
                         Microsoft.Xna.Framework.Color b = default(Microsoft.Xna.Framework.Color);
                         if (arg_D48B_0 != b)
                         {
                             SpriteBatch arg_D5D7_0 = this.spriteBatch;
                             Texture2D arg_D5D7_1 = Main.itemTexture[Main.player[Main.myPlayer].bank[num194].type];
                             Microsoft.Xna.Framework.Vector2 arg_D5D7_2 = new Microsoft.Xna.Framework.Vector2((float)num192 + 26f * Main.inventoryScale - (float)Main.itemTexture[Main.player[Main.myPlayer].bank[num194].type].Width * 0.5f * num196, (float)num193 + 26f * Main.inventoryScale - (float)Main.itemTexture[Main.player[Main.myPlayer].bank[num194].type].Height * 0.5f * num196);
                             Microsoft.Xna.Framework.Rectangle? arg_D5D7_3 = new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.itemTexture[Main.player[Main.myPlayer].bank[num194].type].Width, Main.itemTexture[Main.player[Main.myPlayer].bank[num194].type].Height));
                             Microsoft.Xna.Framework.Color arg_D5D7_4 = Main.player[Main.myPlayer].bank[num194].GetColor(white15);
                             float arg_D5D7_5 = 0f;
                             origin = default(Microsoft.Xna.Framework.Vector2);
                             arg_D5D7_0.Draw(arg_D5D7_1, arg_D5D7_2, arg_D5D7_3, arg_D5D7_4, arg_D5D7_5, origin, num196, SpriteEffects.None, 0f);
                         }
                         if (Main.player[Main.myPlayer].bank[num194].stack > 1)
                         {
                             SpriteBatch arg_D670_0 = this.spriteBatch;
                             SpriteFont arg_D670_1 = Main.fontItemStack;
                             string arg_D670_2 = string.Concat(Main.player[Main.myPlayer].bank[num194].stack);
                             Microsoft.Xna.Framework.Vector2 arg_D670_3 = new Microsoft.Xna.Framework.Vector2((float)num192 + 10f * Main.inventoryScale, (float)num193 + 26f * Main.inventoryScale);
                             Microsoft.Xna.Framework.Color arg_D670_4 = white15;
                             float arg_D670_5 = 0f;
                             origin = default(Microsoft.Xna.Framework.Vector2);
                             arg_D670_0.DrawString(arg_D670_1, arg_D670_2, arg_D670_3, arg_D670_4, arg_D670_5, origin, num196, SpriteEffects.None, 0f);
                         }
                     }
                 }
             }
         }
         if (Main.player[Main.myPlayer].chest == -3)
         {
             SpriteBatch arg_D70A_0 = this.spriteBatch;
             SpriteFont arg_D70A_1 = Main.fontMouseText;
             string arg_D70A_2 = "Safe";
             Microsoft.Xna.Framework.Vector2 arg_D70A_3 = new Microsoft.Xna.Framework.Vector2(284f, 210f);
             Microsoft.Xna.Framework.Color arg_D70A_4 = new Microsoft.Xna.Framework.Color((int)Main.mouseTextColor, (int)Main.mouseTextColor, (int)Main.mouseTextColor, (int)Main.mouseTextColor);
             float arg_D70A_5 = 0f;
             origin = default(Microsoft.Xna.Framework.Vector2);
             arg_D70A_0.DrawString(arg_D70A_1, arg_D70A_2, arg_D70A_3, arg_D70A_4, arg_D70A_5, origin, 1f, SpriteEffects.None, 0f);
             Main.inventoryScale = 0.75f;
             if (Main.mouseX > 73 && Main.mouseX < (int)(73f + 280f * Main.inventoryScale) && Main.mouseY > 210 && Main.mouseY < (int)(210f + 224f * Main.inventoryScale))
             {
                 Main.player[Main.myPlayer].mouseInterface = true;
             }
             for (int num197 = 0; num197 < 5; num197++)
             {
                 for (int num198 = 0; num198 < 4; num198++)
                 {
                     int num199 = (int)(73f + (float)(num197 * 56) * Main.inventoryScale);
                     int num200 = (int)(210f + (float)(num198 * 56) * Main.inventoryScale);
                     int num201 = num197 + num198 * 5;
                     Microsoft.Xna.Framework.Color white16 = new Microsoft.Xna.Framework.Color(100, 100, 100, 100);
                     if (Main.mouseX >= num199 && (float)Main.mouseX <= (float)num199 + (float)Main.inventoryBackTexture.Width * Main.inventoryScale && Main.mouseY >= num200 && (float)Main.mouseY <= (float)num200 + (float)Main.inventoryBackTexture.Height * Main.inventoryScale)
                     {
                         Main.player[Main.myPlayer].mouseInterface = true;
                         if (Main.mouseLeftRelease && Main.mouseLeft)
                         {
                             if (Main.player[Main.myPlayer].selectedItem != num201 || Main.player[Main.myPlayer].itemAnimation <= 0)
                             {
                                 Item item11 = Main.mouseItem;
                                 Main.mouseItem = Main.player[Main.myPlayer].bank2[num201];
                                 Main.player[Main.myPlayer].bank2[num201] = item11;
                                 if (Main.player[Main.myPlayer].bank2[num201].type == 0 || Main.player[Main.myPlayer].bank2[num201].stack < 1)
                                 {
                                     Main.player[Main.myPlayer].bank2[num201] = new Item();
                                 }
                                 if (Main.mouseItem.IsTheSameAs(Main.player[Main.myPlayer].bank2[num201]) && Main.player[Main.myPlayer].bank2[num201].stack != Main.player[Main.myPlayer].bank2[num201].maxStack && Main.mouseItem.stack != Main.mouseItem.maxStack)
                                 {
                                     if (Main.mouseItem.stack + Main.player[Main.myPlayer].bank2[num201].stack <= Main.mouseItem.maxStack)
                                     {
                                         Main.player[Main.myPlayer].bank2[num201].stack += Main.mouseItem.stack;
                                         Main.mouseItem.stack = 0;
                                     }
                                     else
                                     {
                                         int num202 = Main.mouseItem.maxStack - Main.player[Main.myPlayer].bank2[num201].stack;
                                         Main.player[Main.myPlayer].bank2[num201].stack += num202;
                                         Main.mouseItem.stack -= num202;
                                     }
                                 }
                                 if (Main.mouseItem.type == 0 || Main.mouseItem.stack < 1)
                                 {
                                     Main.mouseItem = new Item();
                                 }
                                 if (Main.mouseItem.type > 0 || Main.player[Main.myPlayer].bank2[num201].type > 0)
                                 {
                                     Recipe.FindRecipes();
                                     Main.PlaySound(7, -1, -1, 1);
                                 }
                             }
                         }
                         else
                         {
                             if (Main.mouseRight && Main.mouseRightRelease && Main.player[Main.myPlayer].bank2[num201].maxStack == 1)
                             {
                                 Main.player[Main.myPlayer].bank2[num201] = Main.armorSwap(Main.player[Main.myPlayer].bank2[num201]);
                             }
                             else
                             {
                                 if (Main.stackSplit <= 1 && Main.mouseRight && Main.player[Main.myPlayer].bank2[num201].maxStack > 1 && (Main.mouseItem.IsTheSameAs(Main.player[Main.myPlayer].bank2[num201]) || Main.mouseItem.type == 0) && (Main.mouseItem.stack < Main.mouseItem.maxStack || Main.mouseItem.type == 0))
                                 {
                                     if (Main.mouseItem.type == 0)
                                     {
                                         Main.mouseItem = (Item)Main.player[Main.myPlayer].bank2[num201].Clone();
                                         Main.mouseItem.stack = 0;
                                     }
                                     Main.mouseItem.stack++;
                                     Main.player[Main.myPlayer].bank2[num201].stack--;
                                     if (Main.player[Main.myPlayer].bank2[num201].stack <= 0)
                                     {
                                         Main.player[Main.myPlayer].bank2[num201] = new Item();
                                     }
                                     Recipe.FindRecipes();
                                     Main.soundInstanceMenuTick.Stop();
                                     Main.soundInstanceMenuTick = Main.soundMenuTick.CreateInstance();
                                     Main.PlaySound(12, -1, -1, 1);
                                     if (Main.stackSplit == 0)
                                     {
                                         Main.stackSplit = 15;
                                     }
                                     else
                                     {
                                         Main.stackSplit = Main.stackDelay;
                                     }
                                 }
                             }
                         }
                         text15 = Main.player[Main.myPlayer].bank2[num201].name;
                         Main.toolTip = (Item)Main.player[Main.myPlayer].bank2[num201].Clone();
                         if (Main.player[Main.myPlayer].bank2[num201].stack > 1)
                         {
                             object obj = text15;
                             text15 = string.Concat(new object[]
                             {
                                 obj,
                                 " (",
                                 Main.player[Main.myPlayer].bank2[num201].stack,
                                 ")"
                             });
                         }
                     }
                     SpriteBatch arg_DDA4_0 = this.spriteBatch;
                     Texture2D arg_DDA4_1 = Main.inventoryBack2Texture;
                     Microsoft.Xna.Framework.Vector2 arg_DDA4_2 = new Microsoft.Xna.Framework.Vector2((float)num199, (float)num200);
                     Microsoft.Xna.Framework.Rectangle? arg_DDA4_3 = new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.inventoryBackTexture.Width, Main.inventoryBackTexture.Height));
                     Microsoft.Xna.Framework.Color arg_DDA4_4 = color2;
                     float arg_DDA4_5 = 0f;
                     origin = default(Microsoft.Xna.Framework.Vector2);
                     arg_DDA4_0.Draw(arg_DDA4_1, arg_DDA4_2, arg_DDA4_3, arg_DDA4_4, arg_DDA4_5, origin, Main.inventoryScale, SpriteEffects.None, 0f);
                     white16 = Microsoft.Xna.Framework.Color.White;
                     if (Main.player[Main.myPlayer].bank2[num201].type > 0 && Main.player[Main.myPlayer].bank2[num201].stack > 0)
                     {
                         float num203 = 1f;
                         if (Main.itemTexture[Main.player[Main.myPlayer].bank2[num201].type].Width > 32 || Main.itemTexture[Main.player[Main.myPlayer].bank2[num201].type].Height > 32)
                         {
                             if (Main.itemTexture[Main.player[Main.myPlayer].bank2[num201].type].Width > Main.itemTexture[Main.player[Main.myPlayer].bank2[num201].type].Height)
                             {
                                 num203 = 32f / (float)Main.itemTexture[Main.player[Main.myPlayer].bank2[num201].type].Width;
                             }
                             else
                             {
                                 num203 = 32f / (float)Main.itemTexture[Main.player[Main.myPlayer].bank2[num201].type].Height;
                             }
                         }
                         num203 *= Main.inventoryScale;
                         SpriteBatch arg_E04E_0 = this.spriteBatch;
                         Texture2D arg_E04E_1 = Main.itemTexture[Main.player[Main.myPlayer].bank2[num201].type];
                         Microsoft.Xna.Framework.Vector2 arg_E04E_2 = new Microsoft.Xna.Framework.Vector2((float)num199 + 26f * Main.inventoryScale - (float)Main.itemTexture[Main.player[Main.myPlayer].bank2[num201].type].Width * 0.5f * num203, (float)num200 + 26f * Main.inventoryScale - (float)Main.itemTexture[Main.player[Main.myPlayer].bank2[num201].type].Height * 0.5f * num203);
                         Microsoft.Xna.Framework.Rectangle? arg_E04E_3 = new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.itemTexture[Main.player[Main.myPlayer].bank2[num201].type].Width, Main.itemTexture[Main.player[Main.myPlayer].bank2[num201].type].Height));
                         Microsoft.Xna.Framework.Color arg_E04E_4 = Main.player[Main.myPlayer].bank2[num201].GetAlpha(white16);
                         float arg_E04E_5 = 0f;
                         origin = default(Microsoft.Xna.Framework.Vector2);
                         arg_E04E_0.Draw(arg_E04E_1, arg_E04E_2, arg_E04E_3, arg_E04E_4, arg_E04E_5, origin, num203, SpriteEffects.None, 0f);
                         Microsoft.Xna.Framework.Color arg_E07B_0 = Main.player[Main.myPlayer].bank2[num201].color;
                         Microsoft.Xna.Framework.Color b = default(Microsoft.Xna.Framework.Color);
                         if (arg_E07B_0 != b)
                         {
                             SpriteBatch arg_E1C7_0 = this.spriteBatch;
                             Texture2D arg_E1C7_1 = Main.itemTexture[Main.player[Main.myPlayer].bank2[num201].type];
                             Microsoft.Xna.Framework.Vector2 arg_E1C7_2 = new Microsoft.Xna.Framework.Vector2((float)num199 + 26f * Main.inventoryScale - (float)Main.itemTexture[Main.player[Main.myPlayer].bank2[num201].type].Width * 0.5f * num203, (float)num200 + 26f * Main.inventoryScale - (float)Main.itemTexture[Main.player[Main.myPlayer].bank2[num201].type].Height * 0.5f * num203);
                             Microsoft.Xna.Framework.Rectangle? arg_E1C7_3 = new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.itemTexture[Main.player[Main.myPlayer].bank2[num201].type].Width, Main.itemTexture[Main.player[Main.myPlayer].bank2[num201].type].Height));
                             Microsoft.Xna.Framework.Color arg_E1C7_4 = Main.player[Main.myPlayer].bank2[num201].GetColor(white16);
                             float arg_E1C7_5 = 0f;
                             origin = default(Microsoft.Xna.Framework.Vector2);
                             arg_E1C7_0.Draw(arg_E1C7_1, arg_E1C7_2, arg_E1C7_3, arg_E1C7_4, arg_E1C7_5, origin, num203, SpriteEffects.None, 0f);
                         }
                         if (Main.player[Main.myPlayer].bank2[num201].stack > 1)
                         {
                             SpriteBatch arg_E260_0 = this.spriteBatch;
                             SpriteFont arg_E260_1 = Main.fontItemStack;
                             string arg_E260_2 = string.Concat(Main.player[Main.myPlayer].bank2[num201].stack);
                             Microsoft.Xna.Framework.Vector2 arg_E260_3 = new Microsoft.Xna.Framework.Vector2((float)num199 + 10f * Main.inventoryScale, (float)num200 + 26f * Main.inventoryScale);
                             Microsoft.Xna.Framework.Color arg_E260_4 = white16;
                             float arg_E260_5 = 0f;
                             origin = default(Microsoft.Xna.Framework.Vector2);
                             arg_E260_0.DrawString(arg_E260_1, arg_E260_2, arg_E260_3, arg_E260_4, arg_E260_5, origin, num203, SpriteEffects.None, 0f);
                         }
                     }
                 }
             }
         }
     }
     else
     {
         if (Main.npcChatText == null || Main.npcChatText == "")
         {
             bool flag6 = false;
             bool flag7 = false;
             bool flag8 = false;
             for (int num204 = 0; num204 < 3; num204++)
             {
                 string text24 = "";
                 if (Main.player[Main.myPlayer].accCompass > 0 && !flag8)
                 {
                     int num205 = (int)((Main.player[Main.myPlayer].position.X + (float)(Main.player[Main.myPlayer].width / 2)) * 2f / 16f - (float)Main.maxTilesX);
                     if (num205 > 0)
                     {
                         text24 = "Position: " + num205 + " feet east";
                         if (num205 == 1)
                         {
                             text24 = "Position: " + num205 + " foot east";
                         }
                     }
                     else
                     {
                         if (num205 < 0)
                         {
                             num205 *= -1;
                             text24 = "Position: " + num205 + " feet west";
                             if (num205 == 1)
                             {
                                 text24 = "Position: " + num205 + " foot west";
                             }
                         }
                         else
                         {
                             text24 = "Position: center";
                         }
                     }
                     flag8 = true;
                 }
                 else
                 {
                     if (Main.player[Main.myPlayer].accDepthMeter > 0 && !flag7)
                     {
                         int num206 = (int)((double)((Main.player[Main.myPlayer].position.Y + (float)Main.player[Main.myPlayer].height) * 2f / 16f) - Main.worldSurface * 2.0);
                         if (num206 > 0)
                         {
                             text24 = "Depth: " + num206 + " feet below";
                             if (num206 == 1)
                             {
                                 text24 = "Depth: " + num206 + " foot below";
                             }
                         }
                         else
                         {
                             if (num206 < 0)
                             {
                                 num206 *= -1;
                                 text24 = "Depth: " + num206 + " feet above";
                                 if (num206 == 1)
                                 {
                                     text24 = "Depth: " + num206 + " foot above";
                                 }
                             }
                             else
                             {
                                 text24 = "Depth: Level";
                             }
                         }
                         flag7 = true;
                     }
                     else
                     {
                         if (Main.player[Main.myPlayer].accWatch > 0 && !flag6)
                         {
                             string text25 = "AM";
                             double num207 = Main.time;
                             if (!Main.dayTime)
                             {
                                 num207 += 54000.0;
                             }
                             num207 = num207 / 86400.0 * 24.0;
                             double num208 = 7.5;
                             num207 = num207 - num208 - 12.0;
                             if (num207 < 0.0)
                             {
                                 num207 += 24.0;
                             }
                             if (num207 >= 12.0)
                             {
                                 text25 = "PM";
                             }
                             int num209 = (int)num207;
                             double num210 = num207 - (double)num209;
                             num210 = (double)((int)(num210 * 60.0));
                             string text26 = string.Concat(num210);
                             if (num210 < 10.0)
                             {
                                 text26 = "0" + text26;
                             }
                             if (num209 > 12)
                             {
                                 num209 -= 12;
                             }
                             if (num209 == 0)
                             {
                                 num209 = 12;
                             }
                             if (Main.player[Main.myPlayer].accWatch == 1)
                             {
                                 text26 = "00";
                             }
                             else
                             {
                                 if (Main.player[Main.myPlayer].accWatch == 2)
                                 {
                                     if (num210 < 30.0)
                                     {
                                         text26 = "00";
                                     }
                                     else
                                     {
                                         text26 = "30";
                                     }
                                 }
                             }
                             text24 = string.Concat(new object[]
                             {
                                 "Time: ",
                                 num209,
                                 ":",
                                 text26,
                                 " ",
                                 text25
                             });
                             flag6 = true;
                         }
                     }
                 }
                 if (text24 != "")
                 {
                     for (int num211 = 0; num211 < 5; num211++)
                     {
                         int num212 = 0;
                         int num213 = 0;
                         Microsoft.Xna.Framework.Color black = Microsoft.Xna.Framework.Color.Black;
                         if (num211 == 0)
                         {
                             num212 = -2;
                         }
                         if (num211 == 1)
                         {
                             num212 = 2;
                         }
                         if (num211 == 2)
                         {
                             num213 = -2;
                         }
                         if (num211 == 3)
                         {
                             num213 = 2;
                         }
                         if (num211 == 4)
                         {
                             black = new Microsoft.Xna.Framework.Color((int)Main.mouseTextColor, (int)Main.mouseTextColor, (int)Main.mouseTextColor, (int)Main.mouseTextColor);
                         }
                         SpriteBatch arg_E7BB_0 = this.spriteBatch;
                         SpriteFont arg_E7BB_1 = Main.fontMouseText;
                         string arg_E7BB_2 = text24;
                         Microsoft.Xna.Framework.Vector2 arg_E7BB_3 = new Microsoft.Xna.Framework.Vector2((float)(22 + num212), (float)(110 + 22 * num204 + num213 + 48));
                         Microsoft.Xna.Framework.Color arg_E7BB_4 = black;
                         float arg_E7BB_5 = 0f;
                         origin = default(Microsoft.Xna.Framework.Vector2);
                         arg_E7BB_0.DrawString(arg_E7BB_1, arg_E7BB_2, arg_E7BB_3, arg_E7BB_4, arg_E7BB_5, origin, 1f, SpriteEffects.None, 0f);
                     }
                 }
             }
         }
     }
     if (Main.playerInventory || Main.player[Main.myPlayer].ghost)
     {
         string text27 = "Save & Exit";
         if (Main.netMode != 0)
         {
             text27 = "Disconnect";
         }
         Microsoft.Xna.Framework.Vector2 vector8 = Main.fontDeathText.MeasureString(text27);
         int num214 = Main.screenWidth - 110;
         int num215 = Main.screenHeight - 20;
         if (Main.mouseExit)
         {
             if (Main.exitScale < 1f)
             {
                 Main.exitScale += 0.02f;
             }
         }
         else
         {
             if ((double)Main.exitScale > 0.8)
             {
                 Main.exitScale -= 0.02f;
             }
         }
         for (int num216 = 0; num216 < 5; num216++)
         {
             int num217 = 0;
             int num218 = 0;
             Microsoft.Xna.Framework.Color color9 = Microsoft.Xna.Framework.Color.Black;
             if (num216 == 0)
             {
                 num217 = -2;
             }
             if (num216 == 1)
             {
                 num217 = 2;
             }
             if (num216 == 2)
             {
                 num218 = -2;
             }
             if (num216 == 3)
             {
                 num218 = 2;
             }
             if (num216 == 4)
             {
                 color9 = Microsoft.Xna.Framework.Color.White;
             }
             this.spriteBatch.DrawString(Main.fontDeathText, text27, new Microsoft.Xna.Framework.Vector2((float)(num214 + num217), (float)(num215 + num218)), color9, 0f, new Microsoft.Xna.Framework.Vector2(vector8.X / 2f, vector8.Y / 2f), Main.exitScale - 0.2f, SpriteEffects.None, 0f);
         }
         if ((float)Main.mouseX > (float)num214 - vector8.X / 2f && (float)Main.mouseX < (float)num214 + vector8.X / 2f && (float)Main.mouseY > (float)num215 - vector8.Y / 2f && (float)Main.mouseY < (float)num215 + vector8.Y / 2f - 10f)
         {
             if (!Main.mouseExit)
             {
                 Main.PlaySound(12, -1, -1, 1);
             }
             Main.mouseExit = true;
             Main.player[Main.myPlayer].mouseInterface = true;
             if (Main.mouseLeftRelease && Main.mouseLeft)
             {
                 Main.menuMode = 10;
                 WorldGen.SaveAndQuit();
             }
         }
         else
         {
             Main.mouseExit = false;
         }
     }
     if (!Main.playerInventory && !Main.player[Main.myPlayer].ghost)
     {
         string text28 = "Items";
         if (Main.player[Main.myPlayer].inventory[Main.player[Main.myPlayer].selectedItem].name != "" && Main.player[Main.myPlayer].inventory[Main.player[Main.myPlayer].selectedItem].name != null)
         {
             text28 = Main.player[Main.myPlayer].inventory[Main.player[Main.myPlayer].selectedItem].AffixName();
         }
         Microsoft.Xna.Framework.Vector2 vector9 = Main.fontMouseText.MeasureString(text28) / 2f;
         SpriteBatch arg_EB5A_0 = this.spriteBatch;
         SpriteFont arg_EB5A_1 = Main.fontMouseText;
         string arg_EB5A_2 = text28;
         Microsoft.Xna.Framework.Vector2 arg_EB5A_3 = new Microsoft.Xna.Framework.Vector2(236f - vector9.X, 0f);
         Microsoft.Xna.Framework.Color arg_EB5A_4 = new Microsoft.Xna.Framework.Color((int)Main.mouseTextColor, (int)Main.mouseTextColor, (int)Main.mouseTextColor, (int)Main.mouseTextColor);
         float arg_EB5A_5 = 0f;
         origin = default(Microsoft.Xna.Framework.Vector2);
         arg_EB5A_0.DrawString(arg_EB5A_1, arg_EB5A_2, arg_EB5A_3, arg_EB5A_4, arg_EB5A_5, origin, 1f, SpriteEffects.None, 0f);
         int num219 = 20;
         float num220 = 1f;
         for (int num221 = 0; num221 < 10; num221++)
         {
             if (num221 == Main.player[Main.myPlayer].selectedItem)
             {
                 if (Main.hotbarScale[num221] < 1f)
                 {
                     Main.hotbarScale[num221] += 0.05f;
                 }
             }
             else
             {
                 if ((double)Main.hotbarScale[num221] > 0.75)
                 {
                     Main.hotbarScale[num221] -= 0.05f;
                 }
             }
             float num222 = Main.hotbarScale[num221];
             int num223 = (int)(20f + 22f * (1f - num222));
             int a3 = (int)(75f + 150f * num222);
             Microsoft.Xna.Framework.Color color10 = new Microsoft.Xna.Framework.Color(255, 255, 255, a3);
             SpriteBatch arg_ECB3_0 = this.spriteBatch;
             Texture2D arg_ECB3_1 = Main.inventoryBackTexture;
             Microsoft.Xna.Framework.Vector2 arg_ECB3_2 = new Microsoft.Xna.Framework.Vector2((float)num219, (float)num223);
             Microsoft.Xna.Framework.Rectangle? arg_ECB3_3 = new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.inventoryBackTexture.Width, Main.inventoryBackTexture.Height));
             Microsoft.Xna.Framework.Color arg_ECB3_4 = new Microsoft.Xna.Framework.Color(100, 100, 100, 100);
             float arg_ECB3_5 = 0f;
             origin = default(Microsoft.Xna.Framework.Vector2);
             arg_ECB3_0.Draw(arg_ECB3_1, arg_ECB3_2, arg_ECB3_3, arg_ECB3_4, arg_ECB3_5, origin, num222, SpriteEffects.None, 0f);
             if (!Main.player[Main.myPlayer].hbLocked && Main.mouseX >= num219 && (float)Main.mouseX <= (float)num219 + (float)Main.inventoryBackTexture.Width * Main.hotbarScale[num221] && Main.mouseY >= num223 && (float)Main.mouseY <= (float)num223 + (float)Main.inventoryBackTexture.Height * Main.hotbarScale[num221] && !Main.player[Main.myPlayer].channel)
             {
                 Main.player[Main.myPlayer].mouseInterface = true;
                 if (Main.mouseLeft && !Main.player[Main.myPlayer].hbLocked)
                 {
                     Main.player[Main.myPlayer].changeItem = num221;
                 }
                 Main.player[Main.myPlayer].showItemIcon = false;
                 text15 = Main.player[Main.myPlayer].inventory[num221].AffixName();
                 if (Main.player[Main.myPlayer].inventory[num221].stack > 1)
                 {
                     object obj = text15;
                     text15 = string.Concat(new object[]
                     {
                         obj,
                         " (",
                         Main.player[Main.myPlayer].inventory[num221].stack,
                         ")"
                     });
                 }
                 rare = Main.player[Main.myPlayer].inventory[num221].rare;
             }
             if (Main.player[Main.myPlayer].inventory[num221].type > 0 && Main.player[Main.myPlayer].inventory[num221].stack > 0)
             {
                 num220 = 1f;
                 if (Main.itemTexture[Main.player[Main.myPlayer].inventory[num221].type].Width > 32 || Main.itemTexture[Main.player[Main.myPlayer].inventory[num221].type].Height > 32)
                 {
                     if (Main.itemTexture[Main.player[Main.myPlayer].inventory[num221].type].Width > Main.itemTexture[Main.player[Main.myPlayer].inventory[num221].type].Height)
                     {
                         num220 = 32f / (float)Main.itemTexture[Main.player[Main.myPlayer].inventory[num221].type].Width;
                     }
                     else
                     {
                         num220 = 32f / (float)Main.itemTexture[Main.player[Main.myPlayer].inventory[num221].type].Height;
                     }
                 }
                 num220 *= num222;
                 SpriteBatch arg_F0E9_0 = this.spriteBatch;
                 Texture2D arg_F0E9_1 = Main.itemTexture[Main.player[Main.myPlayer].inventory[num221].type];
                 Microsoft.Xna.Framework.Vector2 arg_F0E9_2 = new Microsoft.Xna.Framework.Vector2((float)num219 + 26f * num222 - (float)Main.itemTexture[Main.player[Main.myPlayer].inventory[num221].type].Width * 0.5f * num220, (float)num223 + 26f * num222 - (float)Main.itemTexture[Main.player[Main.myPlayer].inventory[num221].type].Height * 0.5f * num220);
                 Microsoft.Xna.Framework.Rectangle? arg_F0E9_3 = new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.itemTexture[Main.player[Main.myPlayer].inventory[num221].type].Width, Main.itemTexture[Main.player[Main.myPlayer].inventory[num221].type].Height));
                 Microsoft.Xna.Framework.Color arg_F0E9_4 = Main.player[Main.myPlayer].inventory[num221].GetAlpha(color10);
                 float arg_F0E9_5 = 0f;
                 origin = default(Microsoft.Xna.Framework.Vector2);
                 arg_F0E9_0.Draw(arg_F0E9_1, arg_F0E9_2, arg_F0E9_3, arg_F0E9_4, arg_F0E9_5, origin, num220, SpriteEffects.None, 0f);
                 Microsoft.Xna.Framework.Color arg_F116_0 = Main.player[Main.myPlayer].inventory[num221].color;
                 Microsoft.Xna.Framework.Color b = default(Microsoft.Xna.Framework.Color);
                 if (arg_F116_0 != b)
                 {
                     SpriteBatch arg_F260_0 = this.spriteBatch;
                     Texture2D arg_F260_1 = Main.itemTexture[Main.player[Main.myPlayer].inventory[num221].type];
                     Microsoft.Xna.Framework.Vector2 arg_F260_2 = new Microsoft.Xna.Framework.Vector2((float)num219 + 26f * num222 - (float)Main.itemTexture[Main.player[Main.myPlayer].inventory[num221].type].Width * 0.5f * num220, (float)num223 + 26f * num222 - (float)Main.itemTexture[Main.player[Main.myPlayer].inventory[num221].type].Height * 0.5f * num220);
                     Microsoft.Xna.Framework.Rectangle? arg_F260_3 = new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.itemTexture[Main.player[Main.myPlayer].inventory[num221].type].Width, Main.itemTexture[Main.player[Main.myPlayer].inventory[num221].type].Height));
                     Microsoft.Xna.Framework.Color arg_F260_4 = Main.player[Main.myPlayer].inventory[num221].GetColor(color10);
                     float arg_F260_5 = 0f;
                     origin = default(Microsoft.Xna.Framework.Vector2);
                     arg_F260_0.Draw(arg_F260_1, arg_F260_2, arg_F260_3, arg_F260_4, arg_F260_5, origin, num220, SpriteEffects.None, 0f);
                 }
                 if (Main.player[Main.myPlayer].inventory[num221].stack > 1)
                 {
                     SpriteBatch arg_F2F7_0 = this.spriteBatch;
                     SpriteFont arg_F2F7_1 = Main.fontItemStack;
                     string arg_F2F7_2 = string.Concat(Main.player[Main.myPlayer].inventory[num221].stack);
                     Microsoft.Xna.Framework.Vector2 arg_F2F7_3 = new Microsoft.Xna.Framework.Vector2((float)num219 + 10f * num222, (float)num223 + 26f * num222);
                     Microsoft.Xna.Framework.Color arg_F2F7_4 = color10;
                     float arg_F2F7_5 = 0f;
                     origin = default(Microsoft.Xna.Framework.Vector2);
                     arg_F2F7_0.DrawString(arg_F2F7_1, arg_F2F7_2, arg_F2F7_3, arg_F2F7_4, arg_F2F7_5, origin, num220, SpriteEffects.None, 0f);
                 }
                 if (Main.player[Main.myPlayer].inventory[num221].useAmmo > 0)
                 {
                     int useAmmo = Main.player[Main.myPlayer].inventory[num221].useAmmo;
                     int num224 = 0;
                     for (int num225 = 0; num225 < 48; num225++)
                     {
                         if (Main.player[Main.myPlayer].inventory[num225].ammo == useAmmo)
                         {
                             num224 += Main.player[Main.myPlayer].inventory[num225].stack;
                         }
                     }
                     SpriteBatch arg_F400_0 = this.spriteBatch;
                     SpriteFont arg_F400_1 = Main.fontItemStack;
                     string arg_F400_2 = string.Concat(num224);
                     Microsoft.Xna.Framework.Vector2 arg_F400_3 = new Microsoft.Xna.Framework.Vector2((float)num219 + 8f * num222, (float)num223 + 30f * num222);
                     Microsoft.Xna.Framework.Color arg_F400_4 = color10;
                     float arg_F400_5 = 0f;
                     origin = default(Microsoft.Xna.Framework.Vector2);
                     arg_F400_0.DrawString(arg_F400_1, arg_F400_2, arg_F400_3, arg_F400_4, arg_F400_5, origin, num222 * 0.8f, SpriteEffects.None, 0f);
                 }
                 else
                 {
                     if (Main.player[Main.myPlayer].inventory[num221].type == 509)
                     {
                         int num226 = 0;
                         for (int num227 = 0; num227 < 48; num227++)
                         {
                             if (Main.player[Main.myPlayer].inventory[num227].type == 530)
                             {
                                 num226 += Main.player[Main.myPlayer].inventory[num227].stack;
                             }
                         }
                         SpriteBatch arg_F4F5_0 = this.spriteBatch;
                         SpriteFont arg_F4F5_1 = Main.fontItemStack;
                         string arg_F4F5_2 = string.Concat(num226);
                         Microsoft.Xna.Framework.Vector2 arg_F4F5_3 = new Microsoft.Xna.Framework.Vector2((float)num219 + 8f * num222, (float)num223 + 30f * num222);
                         Microsoft.Xna.Framework.Color arg_F4F5_4 = color10;
                         float arg_F4F5_5 = 0f;
                         origin = default(Microsoft.Xna.Framework.Vector2);
                         arg_F4F5_0.DrawString(arg_F4F5_1, arg_F4F5_2, arg_F4F5_3, arg_F4F5_4, arg_F4F5_5, origin, num222 * 0.8f, SpriteEffects.None, 0f);
                     }
                 }
                 string text29 = string.Concat(num221 + 1);
                 if (text29 == "10")
                 {
                     text29 = "0";
                 }
                 SpriteBatch arg_F5B5_0 = this.spriteBatch;
                 SpriteFont arg_F5B5_1 = Main.fontItemStack;
                 string arg_F5B5_2 = text29;
                 Microsoft.Xna.Framework.Vector2 arg_F5B5_3 = new Microsoft.Xna.Framework.Vector2((float)num219 + 8f * Main.hotbarScale[num221], (float)num223 + 4f * Main.hotbarScale[num221]);
                 Microsoft.Xna.Framework.Color arg_F5B5_4 = new Microsoft.Xna.Framework.Color((int)(color10.R / 2), (int)(color10.G / 2), (int)(color10.B / 2), (int)(color10.A / 2));
                 float arg_F5B5_5 = 0f;
                 origin = default(Microsoft.Xna.Framework.Vector2);
                 arg_F5B5_0.DrawString(arg_F5B5_1, arg_F5B5_2, arg_F5B5_3, arg_F5B5_4, arg_F5B5_5, origin, num220, SpriteEffects.None, 0f);
                 if (Main.player[Main.myPlayer].inventory[num221].potion)
                 {
                     Microsoft.Xna.Framework.Color alpha = Main.player[Main.myPlayer].inventory[num221].GetAlpha(color10);
                     float num228 = (float)Main.player[Main.myPlayer].potionDelay / (float)Main.player[Main.myPlayer].potionDelayTime;
                     float num229 = (float)alpha.R * num228;
                     float num230 = (float)alpha.G * num228;
                     float num231 = (float)alpha.B * num228;
                     float num232 = (float)alpha.A * num228;
                     alpha = new Microsoft.Xna.Framework.Color((int)((byte)num229), (int)((byte)num230), (int)((byte)num231), (int)((byte)num232));
                     SpriteBatch arg_F736_0 = this.spriteBatch;
                     Texture2D arg_F736_1 = Main.cdTexture;
                     Microsoft.Xna.Framework.Vector2 arg_F736_2 = new Microsoft.Xna.Framework.Vector2((float)num219 + 26f * Main.hotbarScale[num221] - (float)Main.cdTexture.Width * 0.5f * num220, (float)num223 + 26f * Main.hotbarScale[num221] - (float)Main.cdTexture.Height * 0.5f * num220);
                     Microsoft.Xna.Framework.Rectangle? arg_F736_3 = new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.cdTexture.Width, Main.cdTexture.Height));
                     Microsoft.Xna.Framework.Color arg_F736_4 = alpha;
                     float arg_F736_5 = 0f;
                     origin = default(Microsoft.Xna.Framework.Vector2);
                     arg_F736_0.Draw(arg_F736_1, arg_F736_2, arg_F736_3, arg_F736_4, arg_F736_5, origin, num220, SpriteEffects.None, 0f);
                 }
             }
             num219 += (int)((float)Main.inventoryBackTexture.Width * Main.hotbarScale[num221]) + 4;
         }
     }
     if (Main.mouseItem.stack <= 0)
     {
         Main.mouseItem.type = 0;
     }
     if (text15 != null && text15 != "" && Main.mouseItem.type == 0)
     {
         Main.player[Main.myPlayer].showItemIcon = false;
         this.MouseText(text15, rare, 0);
         flag = true;
     }
     if (Main.chatMode)
     {
         this.textBlinkerCount++;
         if (this.textBlinkerCount >= 20)
         {
             if (this.textBlinkerState == 0)
             {
                 this.textBlinkerState = 1;
             }
             else
             {
                 this.textBlinkerState = 0;
             }
             this.textBlinkerCount = 0;
         }
         string text30 = Main.chatText;
         if (this.textBlinkerState == 1)
         {
             text30 += "|";
         }
         SpriteBatch arg_F895_0 = this.spriteBatch;
         Texture2D arg_F895_1 = Main.textBackTexture;
         Microsoft.Xna.Framework.Vector2 arg_F895_2 = new Microsoft.Xna.Framework.Vector2(78f, (float)(Main.screenHeight - 36));
         Microsoft.Xna.Framework.Rectangle? arg_F895_3 = new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.textBackTexture.Width, Main.textBackTexture.Height));
         Microsoft.Xna.Framework.Color arg_F895_4 = new Microsoft.Xna.Framework.Color(100, 100, 100, 100);
         float arg_F895_5 = 0f;
         origin = default(Microsoft.Xna.Framework.Vector2);
         arg_F895_0.Draw(arg_F895_1, arg_F895_2, arg_F895_3, arg_F895_4, arg_F895_5, origin, 1f, SpriteEffects.None, 0f);
         for (int num233 = 0; num233 < 5; num233++)
         {
             int num234 = 0;
             int num235 = 0;
             Microsoft.Xna.Framework.Color black2 = Microsoft.Xna.Framework.Color.Black;
             if (num233 == 0)
             {
                 num234 = -2;
             }
             if (num233 == 1)
             {
                 num234 = 2;
             }
             if (num233 == 2)
             {
                 num235 = -2;
             }
             if (num233 == 3)
             {
                 num235 = 2;
             }
             if (num233 == 4)
             {
                 black2 = new Microsoft.Xna.Framework.Color((int)Main.mouseTextColor, (int)Main.mouseTextColor, (int)Main.mouseTextColor, (int)Main.mouseTextColor);
             }
             SpriteBatch arg_F958_0 = this.spriteBatch;
             SpriteFont arg_F958_1 = Main.fontMouseText;
             string arg_F958_2 = text30;
             Microsoft.Xna.Framework.Vector2 arg_F958_3 = new Microsoft.Xna.Framework.Vector2((float)(88 + num234), (float)(Main.screenHeight - 30 + num235));
             Microsoft.Xna.Framework.Color arg_F958_4 = black2;
             float arg_F958_5 = 0f;
             origin = default(Microsoft.Xna.Framework.Vector2);
             arg_F958_0.DrawString(arg_F958_1, arg_F958_2, arg_F958_3, arg_F958_4, arg_F958_5, origin, 1f, SpriteEffects.None, 0f);
         }
     }
     for (int num236 = 0; num236 < Main.numChatLines; num236++)
     {
         if (Main.chatMode || Main.chatLine[num236].showTime > 0)
         {
             float num237 = (float)Main.mouseTextColor / 255f;
             for (int num238 = 0; num238 < 5; num238++)
             {
                 int num239 = 0;
                 int num240 = 0;
                 Microsoft.Xna.Framework.Color black3 = Microsoft.Xna.Framework.Color.Black;
                 if (num238 == 0)
                 {
                     num239 = -2;
                 }
                 if (num238 == 1)
                 {
                     num239 = 2;
                 }
                 if (num238 == 2)
                 {
                     num240 = -2;
                 }
                 if (num238 == 3)
                 {
                     num240 = 2;
                 }
                 if (num238 == 4)
                 {
                     black3 = new Microsoft.Xna.Framework.Color((int)((byte)((float)Main.chatLine[num236].color.R * num237)), (int)((byte)((float)Main.chatLine[num236].color.G * num237)), (int)((byte)((float)Main.chatLine[num236].color.B * num237)), (int)Main.mouseTextColor);
                 }
                 SpriteBatch arg_FABD_0 = this.spriteBatch;
                 SpriteFont arg_FABD_1 = Main.fontMouseText;
                 string arg_FABD_2 = Main.chatLine[num236].text;
                 Microsoft.Xna.Framework.Vector2 arg_FABD_3 = new Microsoft.Xna.Framework.Vector2((float)(88 + num239), (float)(Main.screenHeight - 30 + num240 - 28 - num236 * 21));
                 Microsoft.Xna.Framework.Color arg_FABD_4 = black3;
                 float arg_FABD_5 = 0f;
                 origin = default(Microsoft.Xna.Framework.Vector2);
                 arg_FABD_0.DrawString(arg_FABD_1, arg_FABD_2, arg_FABD_3, arg_FABD_4, arg_FABD_5, origin, 1f, SpriteEffects.None, 0f);
             }
         }
     }
     if (Main.player[Main.myPlayer].dead)
     {
         string text31 = "You were slain...";
         SpriteBatch arg_FB74_0 = this.spriteBatch;
         SpriteFont arg_FB74_1 = Main.fontDeathText;
         string arg_FB74_2 = text31;
         Microsoft.Xna.Framework.Vector2 arg_FB74_3 = new Microsoft.Xna.Framework.Vector2((float)(Main.screenWidth / 2 - text31.Length * 10), (float)(Main.screenHeight / 2 - 20));
         Microsoft.Xna.Framework.Color arg_FB74_4 = Main.player[Main.myPlayer].GetDeathAlpha(new Microsoft.Xna.Framework.Color(0, 0, 0, 0));
         float arg_FB74_5 = 0f;
         origin = default(Microsoft.Xna.Framework.Vector2);
         arg_FB74_0.DrawString(arg_FB74_1, arg_FB74_2, arg_FB74_3, arg_FB74_4, arg_FB74_5, origin, 1f, SpriteEffects.None, 0f);
     }
     SpriteBatch arg_FC2A_0 = this.spriteBatch;
     Texture2D arg_FC2A_1 = Main.cursorTexture;
     Microsoft.Xna.Framework.Vector2 arg_FC2A_2 = new Microsoft.Xna.Framework.Vector2((float)(Main.mouseX + 1), (float)(Main.mouseY + 1));
     Microsoft.Xna.Framework.Rectangle? arg_FC2A_3 = new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.cursorTexture.Width, Main.cursorTexture.Height));
     Microsoft.Xna.Framework.Color arg_FC2A_4 = new Microsoft.Xna.Framework.Color((int)((float)Main.cursorColor.R * 0.2f), (int)((float)Main.cursorColor.G * 0.2f), (int)((float)Main.cursorColor.B * 0.2f), (int)((float)Main.cursorColor.A * 0.5f));
     float arg_FC2A_5 = 0f;
     origin = default(Microsoft.Xna.Framework.Vector2);
     arg_FC2A_0.Draw(arg_FC2A_1, arg_FC2A_2, arg_FC2A_3, arg_FC2A_4, arg_FC2A_5, origin, Main.cursorScale * 1.1f, SpriteEffects.None, 0f);
     SpriteBatch arg_FC8E_0 = this.spriteBatch;
     Texture2D arg_FC8E_1 = Main.cursorTexture;
     Microsoft.Xna.Framework.Vector2 arg_FC8E_2 = new Microsoft.Xna.Framework.Vector2((float)Main.mouseX, (float)Main.mouseY);
     Microsoft.Xna.Framework.Rectangle? arg_FC8E_3 = new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.cursorTexture.Width, Main.cursorTexture.Height));
     Microsoft.Xna.Framework.Color arg_FC8E_4 = Main.cursorColor;
     float arg_FC8E_5 = 0f;
     origin = default(Microsoft.Xna.Framework.Vector2);
     arg_FC8E_0.Draw(arg_FC8E_1, arg_FC8E_2, arg_FC8E_3, arg_FC8E_4, arg_FC8E_5, origin, Main.cursorScale, SpriteEffects.None, 0f);
     if (Main.mouseItem.type > 0 && Main.mouseItem.stack > 0)
     {
         this.mouseNPC = -1;
         Main.player[Main.myPlayer].showItemIcon = false;
         Main.player[Main.myPlayer].showItemIcon2 = 0;
         flag = true;
         float num241 = 1f;
         if (Main.itemTexture[Main.mouseItem.type].Width > 32 || Main.itemTexture[Main.mouseItem.type].Height > 32)
         {
             if (Main.itemTexture[Main.mouseItem.type].Width > Main.itemTexture[Main.mouseItem.type].Height)
             {
                 num241 = 32f / (float)Main.itemTexture[Main.mouseItem.type].Width;
             }
             else
             {
                 num241 = 32f / (float)Main.itemTexture[Main.mouseItem.type].Height;
             }
         }
         float num242 = 1f;
         num242 *= Main.cursorScale;
         Microsoft.Xna.Framework.Color white17 = Microsoft.Xna.Framework.Color.White;
         num241 *= num242;
         SpriteBatch arg_FE97_0 = this.spriteBatch;
         Texture2D arg_FE97_1 = Main.itemTexture[Main.mouseItem.type];
         Microsoft.Xna.Framework.Vector2 arg_FE97_2 = new Microsoft.Xna.Framework.Vector2((float)Main.mouseX + 26f * num242 - (float)Main.itemTexture[Main.mouseItem.type].Width * 0.5f * num241, (float)Main.mouseY + 26f * num242 - (float)Main.itemTexture[Main.mouseItem.type].Height * 0.5f * num241);
         Microsoft.Xna.Framework.Rectangle? arg_FE97_3 = new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.itemTexture[Main.mouseItem.type].Width, Main.itemTexture[Main.mouseItem.type].Height));
         Microsoft.Xna.Framework.Color arg_FE97_4 = Main.mouseItem.GetAlpha(white17);
         float arg_FE97_5 = 0f;
         origin = default(Microsoft.Xna.Framework.Vector2);
         arg_FE97_0.Draw(arg_FE97_1, arg_FE97_2, arg_FE97_3, arg_FE97_4, arg_FE97_5, origin, num241, SpriteEffects.None, 0f);
         Microsoft.Xna.Framework.Color arg_FEB4_0 = Main.mouseItem.color;
         Microsoft.Xna.Framework.Color b = default(Microsoft.Xna.Framework.Color);
         if (arg_FEB4_0 != b)
         {
             SpriteBatch arg_FFA0_0 = this.spriteBatch;
             Texture2D arg_FFA0_1 = Main.itemTexture[Main.mouseItem.type];
             Microsoft.Xna.Framework.Vector2 arg_FFA0_2 = new Microsoft.Xna.Framework.Vector2((float)Main.mouseX + 26f * num242 - (float)Main.itemTexture[Main.mouseItem.type].Width * 0.5f * num241, (float)Main.mouseY + 26f * num242 - (float)Main.itemTexture[Main.mouseItem.type].Height * 0.5f * num241);
             Microsoft.Xna.Framework.Rectangle? arg_FFA0_3 = new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.itemTexture[Main.mouseItem.type].Width, Main.itemTexture[Main.mouseItem.type].Height));
             Microsoft.Xna.Framework.Color arg_FFA0_4 = Main.mouseItem.GetColor(white17);
             float arg_FFA0_5 = 0f;
             origin = default(Microsoft.Xna.Framework.Vector2);
             arg_FFA0_0.Draw(arg_FFA0_1, arg_FFA0_2, arg_FFA0_3, arg_FFA0_4, arg_FFA0_5, origin, num241, SpriteEffects.None, 0f);
         }
         if (Main.mouseItem.stack > 1)
         {
             SpriteBatch arg_1001C_0 = this.spriteBatch;
             SpriteFont arg_1001C_1 = Main.fontItemStack;
             string arg_1001C_2 = string.Concat(Main.mouseItem.stack);
             Microsoft.Xna.Framework.Vector2 arg_1001C_3 = new Microsoft.Xna.Framework.Vector2((float)Main.mouseX + 10f * num242, (float)Main.mouseY + 26f * num242);
             Microsoft.Xna.Framework.Color arg_1001C_4 = white17;
             float arg_1001C_5 = 0f;
             origin = default(Microsoft.Xna.Framework.Vector2);
             arg_1001C_0.DrawString(arg_1001C_1, arg_1001C_2, arg_1001C_3, arg_1001C_4, arg_1001C_5, origin, num241, SpriteEffects.None, 0f);
         }
     }
     else
     {
         if (this.mouseNPC > -1)
         {
             Main.player[Main.myPlayer].mouseInterface = true;
             flag = false;
             float num243 = 1f;
             num243 *= Main.cursorScale;
             SpriteBatch arg_10122_0 = this.spriteBatch;
             Texture2D arg_10122_1 = Main.npcHeadTexture[this.mouseNPC];
             Microsoft.Xna.Framework.Vector2 arg_10122_2 = new Microsoft.Xna.Framework.Vector2((float)Main.mouseX + 26f * num243 - (float)Main.npcHeadTexture[this.mouseNPC].Width * 0.5f * num243, (float)Main.mouseY + 26f * num243 - (float)Main.npcHeadTexture[this.mouseNPC].Height * 0.5f * num243);
             Microsoft.Xna.Framework.Rectangle? arg_10122_3 = new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.npcHeadTexture[this.mouseNPC].Width, Main.npcHeadTexture[this.mouseNPC].Height));
             Microsoft.Xna.Framework.Color arg_10122_4 = Microsoft.Xna.Framework.Color.White;
             float arg_10122_5 = 0f;
             origin = default(Microsoft.Xna.Framework.Vector2);
             arg_10122_0.Draw(arg_10122_1, arg_10122_2, arg_10122_3, arg_10122_4, arg_10122_5, origin, num243, SpriteEffects.None, 0f);
             if (Main.mouseRight && Main.mouseRightRelease)
             {
                 Main.PlaySound(12, -1, -1, 1);
                 this.mouseNPC = -1;
             }
             if (Main.mouseLeft && Main.mouseLeftRelease)
             {
                 if (this.mouseNPC == 0)
                 {
                     int x = (int)(((float)Main.mouseX + Main.screenPosition.X) / 16f);
                     int y = (int)(((float)Main.mouseY + Main.screenPosition.Y) / 16f);
                     int n2 = -1;
                     if (WorldGen.MoveNPC(x, y, n2))
                     {
                         Main.NewText("This housing is suitable.", 255, 240, 20);
                     }
                 }
                 else
                 {
                     int num244 = 0;
                     for (int num245 = 0; num245 < 200; num245++)
                     {
                         if (Main.npc[num245].active && Main.npc[num245].type == NPC.NumToType(this.mouseNPC))
                         {
                             num244 = num245;
                             break;
                         }
                     }
                     if (num244 >= 0)
                     {
                         int x2 = (int)(((float)Main.mouseX + Main.screenPosition.X) / 16f);
                         int y2 = (int)(((float)Main.mouseY + Main.screenPosition.Y) / 16f);
                         if (WorldGen.MoveNPC(x2, y2, num244))
                         {
                             this.mouseNPC = -1;
                             WorldGen.moveRoom(x2, y2, num244);
                             Main.PlaySound(12, -1, -1, 1);
                         }
                     }
                     else
                     {
                         this.mouseNPC = 0;
                     }
                 }
             }
         }
     }
     Microsoft.Xna.Framework.Rectangle rectangle2 = new Microsoft.Xna.Framework.Rectangle((int)((float)Main.mouseX + Main.screenPosition.X), (int)((float)Main.mouseY + Main.screenPosition.Y), 1, 1);
     if (!flag)
     {
         int num246 = 26 * Main.player[Main.myPlayer].statLifeMax / num43;
         int num247 = 0;
         if (Main.player[Main.myPlayer].statLifeMax > 200)
         {
             num246 = 260;
             num247 += 26;
         }
         if (Main.mouseX > 500 + num41 && Main.mouseX < 500 + num246 + num41 && Main.mouseY > 32 && Main.mouseY < 32 + Main.heartTexture.Height + num247)
         {
             Main.player[Main.myPlayer].showItemIcon = false;
             string cursorText = Main.player[Main.myPlayer].statLife + "/" + Main.player[Main.myPlayer].statLifeMax;
             this.MouseText(cursorText, 0, 0);
             flag = true;
         }
     }
     if (!flag)
     {
         int num248 = 24;
         int num249 = 28 * Main.player[Main.myPlayer].statManaMax2 / num50;
         if (Main.mouseX > 762 + num41 && Main.mouseX < 762 + num248 + num41 && Main.mouseY > 30 && Main.mouseY < 30 + num249)
         {
             Main.player[Main.myPlayer].showItemIcon = false;
             string cursorText2 = Main.player[Main.myPlayer].statMana + "/" + Main.player[Main.myPlayer].statManaMax2;
             this.MouseText(cursorText2, 0, 0);
             flag = true;
         }
     }
     if (!flag)
     {
         for (int num250 = 0; num250 < 200; num250++)
         {
             if (Main.item[num250].active)
             {
                 Microsoft.Xna.Framework.Rectangle value3 = new Microsoft.Xna.Framework.Rectangle((int)((double)Main.item[num250].position.X + (double)Main.item[num250].width * 0.5 - (double)Main.itemTexture[Main.item[num250].type].Width * 0.5), (int)(Main.item[num250].position.Y + (float)Main.item[num250].height - (float)Main.itemTexture[Main.item[num250].type].Height), Main.itemTexture[Main.item[num250].type].Width, Main.itemTexture[Main.item[num250].type].Height);
                 if (rectangle2.Intersects(value3))
                 {
                     Main.player[Main.myPlayer].showItemIcon = false;
                     string text32 = Main.item[num250].AffixName();
                     if (Main.item[num250].stack > 1)
                     {
                         object obj = text32;
                         text32 = string.Concat(new object[]
                         {
                             obj,
                             " (",
                             Main.item[num250].stack,
                             ")"
                         });
                     }
                     if (Main.item[num250].owner < 255 && Main.showItemOwner)
                     {
                         text32 = text32 + " <" + Main.player[Main.item[num250].owner].name + ">";
                     }
                     rare = Main.item[num250].rare;
                     this.MouseText(text32, rare, 0);
                     flag = true;
                     break;
                 }
             }
         }
     }
     for (int num251 = 0; num251 < 255; num251++)
     {
         if (Main.player[num251].active && Main.myPlayer != num251 && !Main.player[num251].dead)
         {
             Microsoft.Xna.Framework.Rectangle value4 = new Microsoft.Xna.Framework.Rectangle((int)((double)Main.player[num251].position.X + (double)Main.player[num251].width * 0.5 - 16.0), (int)(Main.player[num251].position.Y + (float)Main.player[num251].height - 48f), 32, 48);
             if (!flag && rectangle2.Intersects(value4))
             {
                 Main.player[Main.myPlayer].showItemIcon = false;
                 int num252 = Main.player[num251].statLife;
                 if (num252 < 0)
                 {
                     num252 = 0;
                 }
                 string text33 = string.Concat(new object[]
                 {
                     Main.player[num251].name,
                     ": ",
                     num252,
                     "/",
                     Main.player[num251].statLifeMax
                 });
                 if (Main.player[num251].hostile)
                 {
                     text33 += " (PvP)";
                 }
                 this.MouseText(text33, 0, Main.player[num251].difficulty);
             }
         }
     }
     if (!flag)
     {
         for (int num253 = 0; num253 < 200; num253++)
         {
             if (Main.npc[num253].active)
             {
                 Microsoft.Xna.Framework.Rectangle value5 = new Microsoft.Xna.Framework.Rectangle((int)((double)Main.npc[num253].position.X + (double)Main.npc[num253].width * 0.5 - (double)Main.npcTexture[Main.npc[num253].type].Width * 0.5), (int)(Main.npc[num253].position.Y + (float)Main.npc[num253].height - (float)(Main.npcTexture[Main.npc[num253].type].Height / Main.npcFrameCount[Main.npc[num253].type])), Main.npcTexture[Main.npc[num253].type].Width, Main.npcTexture[Main.npc[num253].type].Height / Main.npcFrameCount[Main.npc[num253].type]);
                 if (Main.npc[num253].type >= 87 && Main.npc[num253].type <= 92)
                 {
                     value5 = new Microsoft.Xna.Framework.Rectangle((int)((double)Main.npc[num253].position.X + (double)Main.npc[num253].width * 0.5 - 32.0), (int)((double)Main.npc[num253].position.Y + (double)Main.npc[num253].height * 0.5 - 32.0), 64, 64);
                 }
                 if (rectangle2.Intersects(value5) && (Main.npc[num253].type != 85 || Main.npc[num253].ai[0] != 0f))
                 {
                     bool flag9 = false;
                     if (Main.npc[num253].townNPC || Main.npc[num253].type == 105 || Main.npc[num253].type == 106 || Main.npc[num253].type == 123)
                     {
                         Microsoft.Xna.Framework.Rectangle rectangle3 = new Microsoft.Xna.Framework.Rectangle((int)(Main.player[Main.myPlayer].position.X + (float)(Main.player[Main.myPlayer].width / 2) - (float)(Player.tileRangeX * 16)), (int)(Main.player[Main.myPlayer].position.Y + (float)(Main.player[Main.myPlayer].height / 2) - (float)(Player.tileRangeY * 16)), Player.tileRangeX * 16 * 2, Player.tileRangeY * 16 * 2);
                         Microsoft.Xna.Framework.Rectangle value6 = new Microsoft.Xna.Framework.Rectangle((int)Main.npc[num253].position.X, (int)Main.npc[num253].position.Y, Main.npc[num253].width, Main.npc[num253].height);
                         if (rectangle3.Intersects(value6))
                         {
                             flag9 = true;
                         }
                     }
                     if (flag9 && !Main.player[Main.myPlayer].dead)
                     {
                         int num254 = -(Main.npc[num253].width / 2 + 8);
                         SpriteEffects effects2 = SpriteEffects.None;
                         if (Main.npc[num253].spriteDirection == -1)
                         {
                             effects2 = SpriteEffects.FlipHorizontally;
                             num254 = Main.npc[num253].width / 2 + 8;
                         }
                         SpriteBatch arg_10CF9_0 = this.spriteBatch;
                         Texture2D arg_10CF9_1 = Main.chatTexture;
                         Microsoft.Xna.Framework.Vector2 arg_10CF9_2 = new Microsoft.Xna.Framework.Vector2(Main.npc[num253].position.X + (float)(Main.npc[num253].width / 2) - Main.screenPosition.X - (float)(Main.chatTexture.Width / 2) - (float)num254, Main.npc[num253].position.Y - (float)Main.chatTexture.Height - Main.screenPosition.Y);
                         Microsoft.Xna.Framework.Rectangle? arg_10CF9_3 = new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.chatTexture.Width, Main.chatTexture.Height));
                         Microsoft.Xna.Framework.Color arg_10CF9_4 = new Microsoft.Xna.Framework.Color((int)Main.mouseTextColor, (int)Main.mouseTextColor, (int)Main.mouseTextColor, (int)Main.mouseTextColor);
                         float arg_10CF9_5 = 0f;
                         origin = default(Microsoft.Xna.Framework.Vector2);
                         arg_10CF9_0.Draw(arg_10CF9_1, arg_10CF9_2, arg_10CF9_3, arg_10CF9_4, arg_10CF9_5, origin, 1f, effects2, 0f);
                         if (Main.mouseRight && Main.npcChatRelease)
                         {
                             Main.npcChatRelease = false;
                             if (Main.player[Main.myPlayer].talkNPC != num253)
                             {
                                 Main.player[Main.myPlayer].sign = -1;
                                 Main.editSign = false;
                                 Main.player[Main.myPlayer].talkNPC = num253;
                                 Main.playerInventory = false;
                                 Main.player[Main.myPlayer].chest = -1;
                                 Main.npcChatText = Main.npc[num253].GetChat();
                                 Main.PlaySound(24, -1, -1, 1);
                             }
                         }
                     }
                     Main.player[Main.myPlayer].showItemIcon = false;
                     string text34 = Main.npc[num253].displayName;
                     int num255 = num253;
                     if (Main.npc[num253].realLife >= 0)
                     {
                         num255 = Main.npc[num253].realLife;
                     }
                     if (Main.npc[num255].lifeMax > 1 && !Main.npc[num255].dontTakeDamage)
                     {
                         object obj = text34;
                         text34 = string.Concat(new object[]
                         {
                             obj,
                             ": ",
                             Main.npc[num255].life,
                             "/",
                             Main.npc[num255].lifeMax
                         });
                     }
                     this.MouseText(text34, 0, 0);
                     break;
                 }
             }
         }
     }
     if (Main.mouseRight)
     {
         Main.npcChatRelease = false;
     }
     else
     {
         Main.npcChatRelease = true;
     }
     if (Main.player[Main.myPlayer].showItemIcon && (Main.player[Main.myPlayer].inventory[Main.player[Main.myPlayer].selectedItem].type > 0 || Main.player[Main.myPlayer].showItemIcon2 > 0))
     {
         int num256 = Main.player[Main.myPlayer].inventory[Main.player[Main.myPlayer].selectedItem].type;
         Microsoft.Xna.Framework.Color color11 = Main.player[Main.myPlayer].inventory[Main.player[Main.myPlayer].selectedItem].GetAlpha(Microsoft.Xna.Framework.Color.White);
         Microsoft.Xna.Framework.Color color12 = Main.player[Main.myPlayer].inventory[Main.player[Main.myPlayer].selectedItem].GetColor(Microsoft.Xna.Framework.Color.White);
         if (Main.player[Main.myPlayer].showItemIcon2 > 0)
         {
             num256 = Main.player[Main.myPlayer].showItemIcon2;
             color11 = Microsoft.Xna.Framework.Color.White;
             color12 = default(Microsoft.Xna.Framework.Color);
         }
         float scale2 = Main.cursorScale;
         SpriteBatch arg_1104A_0 = this.spriteBatch;
         Texture2D arg_1104A_1 = Main.itemTexture[num256];
         Microsoft.Xna.Framework.Vector2 arg_1104A_2 = new Microsoft.Xna.Framework.Vector2((float)(Main.mouseX + 10), (float)(Main.mouseY + 10));
         Microsoft.Xna.Framework.Rectangle? arg_1104A_3 = new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.itemTexture[num256].Width, Main.itemTexture[num256].Height));
         Microsoft.Xna.Framework.Color arg_1104A_4 = color11;
         float arg_1104A_5 = 0f;
         origin = default(Microsoft.Xna.Framework.Vector2);
         arg_1104A_0.Draw(arg_1104A_1, arg_1104A_2, arg_1104A_3, arg_1104A_4, arg_1104A_5, origin, scale2, SpriteEffects.None, 0f);
         if (Main.player[Main.myPlayer].showItemIcon2 == 0)
         {
             Microsoft.Xna.Framework.Color arg_11098_0 = Main.player[Main.myPlayer].inventory[Main.player[Main.myPlayer].selectedItem].color;
             Microsoft.Xna.Framework.Color b = default(Microsoft.Xna.Framework.Color);
             if (arg_11098_0 != b)
             {
                 SpriteBatch arg_1117A_0 = this.spriteBatch;
                 Texture2D arg_1117A_1 = Main.itemTexture[Main.player[Main.myPlayer].inventory[Main.player[Main.myPlayer].selectedItem].type];
                 Microsoft.Xna.Framework.Vector2 arg_1117A_2 = new Microsoft.Xna.Framework.Vector2((float)(Main.mouseX + 10), (float)(Main.mouseY + 10));
                 Microsoft.Xna.Framework.Rectangle? arg_1117A_3 = new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.itemTexture[Main.player[Main.myPlayer].inventory[Main.player[Main.myPlayer].selectedItem].type].Width, Main.itemTexture[Main.player[Main.myPlayer].inventory[Main.player[Main.myPlayer].selectedItem].type].Height));
                 Microsoft.Xna.Framework.Color arg_1117A_4 = color12;
                 float arg_1117A_5 = 0f;
                 origin = default(Microsoft.Xna.Framework.Vector2);
                 arg_1117A_0.Draw(arg_1117A_1, arg_1117A_2, arg_1117A_3, arg_1117A_4, arg_1117A_5, origin, scale2, SpriteEffects.None, 0f);
             }
         }
     }
     Main.player[Main.myPlayer].showItemIcon = false;
     Main.player[Main.myPlayer].showItemIcon2 = 0;
 }
Example #34
0
        protected void DrawBackground()
        {
            Stopwatch stopwatch = new Stopwatch();
            stopwatch.Start();
            int num = (int)(255f * (1f - Main.gfxQuality) + 140f * Main.gfxQuality);
            int num2 = (int)(200f * (1f - Main.gfxQuality) + 40f * Main.gfxQuality);
            int num3 = 96;
            Microsoft.Xna.Framework.Vector2 value = new Microsoft.Xna.Framework.Vector2((float)Main.offScreenRange, (float)Main.offScreenRange);
            if (Main.drawToScreen)
            {
                value = default(Microsoft.Xna.Framework.Vector2);
            }
            float num4 = 0.9f;
            float num5 = num4;
            float num6 = num4;
            float num7 = num4;
            float num8 = 0f;
            if (Main.holyTiles > Main.evilTiles)
            {
                num8 = (float)Main.holyTiles / 800f;
            }
            else
            {
                if (Main.evilTiles > Main.holyTiles)
                {
                    num8 = (float)Main.evilTiles / 800f;
                }
            }
            if (num8 > 1f)
            {
                num8 = 1f;
            }
            if (num8 < 0f)
            {
                num8 = 0f;
            }
            float num9 = (float)((double)Main.screenPosition.Y - Main.worldSurface * 16.0) / 300f;
            if (num9 < 0f)
            {
                num9 = 0f;
            }
            else
            {
                if (num9 > 1f)
                {
                    num9 = 1f;
                }
            }
            float num10 = 1f * (1f - num9) + num5 * num9;
            Lighting.brightness = Lighting.defBrightness * (1f - num9) + 1f * num9;
            float num11 = (float)((double)(Main.screenPosition.Y - (float)(Main.screenHeight / 2) + 200f) - Main.rockLayer * 16.0) / 300f;
            if (num11 < 0f)
            {
                num11 = 0f;
            }
            else
            {
                if (num11 > 1f)
                {
                    num11 = 1f;
                }
            }
            if (Main.evilTiles > 0)
            {
                num5 = 0.8f * num8 + num5 * (1f - num8);
                num6 = 0.75f * num8 + num6 * (1f - num8);
                num7 = 1.1f * num8 + num7 * (1f - num8);
            }
            else
            {
                if (Main.holyTiles > 0)
                {
                    num5 = 1f * num8 + num5 * (1f - num8);
                    num6 = 0.7f * num8 + num6 * (1f - num8);
                    num7 = 0.9f * num8 + num7 * (1f - num8);
                }
            }
            num5 = 1f * (num10 - num11) + num5 * num11;
            num6 = 1f * (num10 - num11) + num6 * num11;
            num7 = 1f * (num10 - num11) + num7 * num11;
            Lighting.defBrightness = 1.2f * (1f - num11) + 1f * num11;
            this.bgParrallax = (double)Main.caveParrallax;
            this.bgStart = (int)(-Math.IEEERemainder((double)Main.screenPosition.X * this.bgParrallax, (double)num3) - (double)(num3 / 2));
            this.bgLoops = Main.screenWidth / num3 + 2;
            this.bgTop = (int)((float)((int)Main.worldSurface * 16 - Main.backgroundHeight[1]) - Main.screenPosition.Y + 16f);
            for (int i = 0; i < this.bgLoops; i++)
            {
                for (int j = 0; j < 6; j++)
                {
                    float num12 = (float)this.bgStart + Main.screenPosition.X;
                    num12 = -(float)Math.IEEERemainder((double)num12, 16.0);
                    num12 = (float)Math.Round((double)num12);
                    int num13 = (int)num12;
                    if (num13 == -8)
                    {
                        num13 = 8;
                    }
                    float num14 = (float)(this.bgStart + num3 * i + j * 16 + 8);
                    float num15 = (float)this.bgTop;
                    Microsoft.Xna.Framework.Color color = Lighting.GetColor((int)((num14 + Main.screenPosition.X) / 16f), (int)((Main.screenPosition.Y + num15) / 16f));
                    color.R = (byte)((float)color.R * num5);
                    color.G = (byte)((float)color.G * num6);
                    color.B = (byte)((float)color.B * num7);
                    this.spriteBatch.Draw(Main.backgroundTexture[1], new Microsoft.Xna.Framework.Vector2((float)(this.bgStart + num3 * i + 16 * j + num13), (float)this.bgTop) + value, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(16 * j + num13 + 16, 0, 16, 16)), color);
                }
            }
            double num16 = (double)(Main.maxTilesY - 230);
            double num17 = (double)((int)((num16 - Main.worldSurface) / 6.0) * 6);
            num16 = Main.worldSurface + num17 - 5.0;
            bool flag = false;
            bool flag2 = false;
            this.bgTop = (int)((float)((int)Main.worldSurface * 16) - Main.screenPosition.Y + 16f);
            if (Main.worldSurface * 16.0 <= (double)(Main.screenPosition.Y + (float)Main.screenHeight + (float)Main.offScreenRange))
            {
                this.bgParrallax = (double)Main.caveParrallax;
                this.bgStart = (int)(-Math.IEEERemainder(96.0 + (double)Main.screenPosition.X * this.bgParrallax, (double)num3) - (double)(num3 / 2)) - (int)value.X;
                this.bgLoops = (Main.screenWidth + (int)value.X * 2) / num3 + 2;
                if (Main.worldSurface * 16.0 < (double)(Main.screenPosition.Y - 16f))
                {
                    this.bgStartY = (int)(Math.IEEERemainder((double)this.bgTop, (double)Main.backgroundHeight[2]) - (double)Main.backgroundHeight[2]);
                    this.bgLoopsY = (Main.screenHeight - this.bgStartY + (int)value.Y * 2) / Main.backgroundHeight[2] + 1;
                }
                else
                {
                    this.bgStartY = this.bgTop;
                    this.bgLoopsY = (Main.screenHeight - this.bgTop + (int)value.Y * 2) / Main.backgroundHeight[2] + 1;
                }
                if (Main.rockLayer * 16.0 < (double)(Main.screenPosition.Y + 600f))
                {
                    this.bgLoopsY = (int)(Main.rockLayer * 16.0 - (double)Main.screenPosition.Y + 600.0 - (double)this.bgStartY) / Main.backgroundHeight[2];
                    flag2 = true;
                }
                float num18 = (float)this.bgStart + Main.screenPosition.X;
                num18 = -(float)Math.IEEERemainder((double)num18, 16.0);
                num18 = (float)Math.Round((double)num18);
                int num19 = (int)num18;
                if (num19 == -8)
                {
                    num19 = 8;
                }
                for (int k = 0; k < this.bgLoops; k++)
                {
                    for (int l = 0; l < this.bgLoopsY; l++)
                    {
                        for (int m = 0; m < 6; m++)
                        {
                            for (int n = 0; n < 6; n++)
                            {
                                float num20 = (float)(this.bgStartY + l * 96 + n * 16 + 8);
                                float num21 = (float)(this.bgStart + num3 * k + m * 16 + 8);
                                int num22 = (int)((num21 + Main.screenPosition.X) / 16f);
                                int num23 = (int)((num20 + Main.screenPosition.Y) / 16f);
                                Microsoft.Xna.Framework.Color color2 = Lighting.GetColor(num22, num23);
                                if (Main.tile[num22, num23] == null)
                                {

                                }
                                if (color2.R > 0 || color2.G > 0 || color2.B > 0)
                                {
                                    if (((int)color2.R > num || (double)color2.G > (double)num * 1.1 || (double)color2.B > (double)num * 1.2) && !Main.tile[num22, num23].active)
                                    {
                                        if (Main.tile[num22, num23].wall != 0)
                                        {
                                            if (Main.tile[num22, num23].wall != 21)
                                            {
                                                goto IL_B68;
                                            }
                                        }
                                        try
                                        {
                                            for (int num24 = 0; num24 < 9; num24++)
                                            {
                                                int num25 = 0;
                                                int num26 = 0;
                                                int width = 4;
                                                int height = 4;
                                                Microsoft.Xna.Framework.Color color3 = color2;
                                                Microsoft.Xna.Framework.Color color4 = color2;
                                                if (num24 == 0 && !Main.tile[num22 - 1, num23 - 1].active)
                                                {
                                                    color4 = Lighting.GetColor(num22 - 1, num23 - 1);
                                                }
                                                if (num24 == 1)
                                                {
                                                    width = 8;
                                                    num25 = 4;
                                                    if (!Main.tile[num22, num23 - 1].active)
                                                    {
                                                        color4 = Lighting.GetColor(num22, num23 - 1);
                                                    }
                                                }
                                                if (num24 == 2)
                                                {
                                                    if (!Main.tile[num22 + 1, num23 - 1].active)
                                                    {
                                                        color4 = Lighting.GetColor(num22 + 1, num23 - 1);
                                                    }
                                                    if (Main.tile[num22 + 1, num23 - 1] == null)
                                                    {

                                                    }
                                                    num25 = 12;
                                                }
                                                if (num24 == 3)
                                                {
                                                    if (!Main.tile[num22 - 1, num23].active)
                                                    {
                                                        color4 = Lighting.GetColor(num22 - 1, num23);
                                                    }
                                                    height = 8;
                                                    num26 = 4;
                                                }
                                                if (num24 == 4)
                                                {
                                                    width = 8;
                                                    height = 8;
                                                    num25 = 4;
                                                    num26 = 4;
                                                }
                                                if (num24 == 5)
                                                {
                                                    num25 = 12;
                                                    num26 = 4;
                                                    height = 8;
                                                    if (!Main.tile[num22 + 1, num23].active)
                                                    {
                                                        color4 = Lighting.GetColor(num22 + 1, num23);
                                                    }
                                                }
                                                if (num24 == 6)
                                                {
                                                    if (!Main.tile[num22 - 1, num23 + 1].active)
                                                    {
                                                        color4 = Lighting.GetColor(num22 - 1, num23 + 1);
                                                    }
                                                    num26 = 12;
                                                }
                                                if (num24 == 7)
                                                {
                                                    width = 8;
                                                    height = 4;
                                                    num25 = 4;
                                                    num26 = 12;
                                                    if (!Main.tile[num22, num23 + 1].active)
                                                    {
                                                        color4 = Lighting.GetColor(num22, num23 + 1);
                                                    }
                                                }
                                                if (num24 == 8)
                                                {
                                                    if (!Main.tile[num22 + 1, num23 + 1].active)
                                                    {
                                                        color4 = Lighting.GetColor(num22 + 1, num23 + 1);
                                                    }
                                                    num25 = 12;
                                                    num26 = 12;
                                                }
                                                color3.R = (byte)((color2.R + color4.R) / 2);
                                                color3.G = (byte)((color2.G + color4.G) / 2);
                                                color3.B = (byte)((color2.B + color4.B) / 2);
                                                color3.R = (byte)((float)color3.R * num5);
                                                color3.G = (byte)((float)color3.G * num6);
                                                color3.B = (byte)((float)color3.B * num7);
                                                this.spriteBatch.Draw(Main.backgroundTexture[2], new Microsoft.Xna.Framework.Vector2((float)(this.bgStart + num3 * k + 16 * m + num25 + num19), (float)(this.bgStartY + Main.backgroundHeight[2] * l + 16 * n + num26)) + value, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(16 * m + num25 + num19 + 16, 16 * n + num26, width, height)), color3);
                                            }
                                            goto IL_EEB;
                                        }
                                        catch
                                        {
                                            color2.R = (byte)((float)color2.R * num5);
                                            color2.G = (byte)((float)color2.G * num6);
                                            color2.B = (byte)((float)color2.B * num7);
                                            this.spriteBatch.Draw(Main.backgroundTexture[2], new Microsoft.Xna.Framework.Vector2((float)(this.bgStart + num3 * k + 16 * m + num19), (float)(this.bgStartY + Main.backgroundHeight[2] * l + 16 * n)) + value, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(16 * m + num19 + 16, 16 * n, 16, 16)), color2);
                                            goto IL_EEB;
                                        }
                                    }
                                    IL_B68:
                                    if ((int)color2.R > num2 || (double)color2.G > (double)num2 * 1.1 || (double)color2.B > (double)num2 * 1.2)
                                    {
                                        for (int num27 = 0; num27 < 4; num27++)
                                        {
                                            int num28 = 0;
                                            int num29 = 0;
                                            Microsoft.Xna.Framework.Color color5 = color2;
                                            Microsoft.Xna.Framework.Color color6 = color2;
                                            if (num27 == 0)
                                            {
                                                if (Lighting.Brighter(num22, num23 - 1, num22 - 1, num23))
                                                {
                                                    color6 = Lighting.GetColor(num22 - 1, num23);
                                                }
                                                else
                                                {
                                                    color6 = Lighting.GetColor(num22, num23 - 1);
                                                }
                                            }
                                            if (num27 == 1)
                                            {
                                                if (Lighting.Brighter(num22, num23 - 1, num22 + 1, num23))
                                                {
                                                    color6 = Lighting.GetColor(num22 + 1, num23);
                                                }
                                                else
                                                {
                                                    color6 = Lighting.GetColor(num22, num23 - 1);
                                                }
                                                num28 = 8;
                                            }
                                            if (num27 == 2)
                                            {
                                                if (Lighting.Brighter(num22, num23 + 1, num22 - 1, num23))
                                                {
                                                    color6 = Lighting.GetColor(num22 - 1, num23);
                                                }
                                                else
                                                {
                                                    color6 = Lighting.GetColor(num22, num23 + 1);
                                                }
                                                num29 = 8;
                                            }
                                            if (num27 == 3)
                                            {
                                                if (Lighting.Brighter(num22, num23 + 1, num22 + 1, num23))
                                                {
                                                    color6 = Lighting.GetColor(num22 + 1, num23);
                                                }
                                                else
                                                {
                                                    color6 = Lighting.GetColor(num22, num23 + 1);
                                                }
                                                num28 = 8;
                                                num29 = 8;
                                            }
                                            color5.R = (byte)((color2.R + color6.R) / 2);
                                            color5.G = (byte)((color2.G + color6.G) / 2);
                                            color5.B = (byte)((color2.B + color6.B) / 2);
                                            color5.R = (byte)((float)color5.R * num5);
                                            color5.G = (byte)((float)color5.G * num6);
                                            color5.B = (byte)((float)color5.B * num7);
                                            this.spriteBatch.Draw(Main.backgroundTexture[2], new Microsoft.Xna.Framework.Vector2((float)(this.bgStart + num3 * k + 16 * m + num28 + num19), (float)(this.bgStartY + Main.backgroundHeight[2] * l + 16 * n + num29)) + value, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(16 * m + num28 + num19 + 16, 16 * n + num29, 8, 8)), color5);
                                        }
                                    }
                                    else
                                    {
                                        color2.R = (byte)((float)color2.R * num5);
                                        color2.G = (byte)((float)color2.G * num6);
                                        color2.B = (byte)((float)color2.B * num7);
                                        this.spriteBatch.Draw(Main.backgroundTexture[2], new Microsoft.Xna.Framework.Vector2((float)(this.bgStart + num3 * k + 16 * m + num19), (float)(this.bgStartY + Main.backgroundHeight[2] * l + 16 * n)) + value, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(16 * m + num19 + 16, 16 * n, 16, 16)), color2);
                                    }
                                }
                                else
                                {
                                    color2.R = (byte)((float)color2.R * num5);
                                    color2.G = (byte)((float)color2.G * num6);
                                    color2.B = (byte)((float)color2.B * num7);
                                    this.spriteBatch.Draw(Main.backgroundTexture[2], new Microsoft.Xna.Framework.Vector2((float)(this.bgStart + num3 * k + 16 * m + num19), (float)(this.bgStartY + Main.backgroundHeight[2] * l + 16 * n)) + value, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(16 * m + num19 + 16, 16 * n, 16, 16)), color2);
                                }
                                IL_EEB:;
                            }
                        }
                    }
                }
                if (flag2)
                {
                    this.bgParrallax = (double)Main.caveParrallax;
                    this.bgStart = (int)(-Math.IEEERemainder((double)Main.screenPosition.X * this.bgParrallax, (double)num3) - (double)(num3 / 2));
                    this.bgLoops = (Main.screenWidth + (int)value.X * 2) / num3 + 2;
                    this.bgTop = this.bgStartY + this.bgLoopsY * Main.backgroundHeight[2];
                    if (this.bgTop > -32)
                    {
                        for (int num30 = 0; num30 < this.bgLoops; num30++)
                        {
                            for (int num31 = 0; num31 < 6; num31++)
                            {
                                float num32 = (float)(this.bgStart + num3 * num30 + num31 * 16 + 8);
                                float num33 = (float)this.bgTop;
                                Microsoft.Xna.Framework.Color color7 = Lighting.GetColor((int)((num32 + Main.screenPosition.X) / 16f), (int)((Main.screenPosition.Y + num33) / 16f));
                                color7.R = (byte)((float)color7.R * num5);
                                color7.G = (byte)((float)color7.G * num6);
                                color7.B = (byte)((float)color7.B * num7);
                                this.spriteBatch.Draw(Main.backgroundTexture[4], new Microsoft.Xna.Framework.Vector2((float)(this.bgStart + num3 * num30 + 16 * num31 + num19), (float)this.bgTop) + value, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(16 * num31 + num19 + 16, 0, 16, 16)), color7);
                            }
                        }
                    }
                }
            }
            this.bgTop = (int)((float)((int)Main.rockLayer * 16) - Main.screenPosition.Y + 16f + 600f - 8f);
            if (Main.rockLayer * 16.0 <= (double)(Main.screenPosition.Y + 600f))
            {
                this.bgParrallax = (double)Main.caveParrallax;
                this.bgStart = (int)(-Math.IEEERemainder(96.0 + (double)Main.screenPosition.X * this.bgParrallax, (double)num3) - (double)(num3 / 2)) - (int)value.X;
                this.bgLoops = (Main.screenWidth + (int)value.X * 2) / num3 + 2;
                if (Main.rockLayer * 16.0 + (double)Main.screenHeight < (double)(Main.screenPosition.Y - 16f))
                {
                    this.bgStartY = (int)(Math.IEEERemainder((double)this.bgTop, (double)Main.backgroundHeight[3]) - (double)Main.backgroundHeight[3]);
                    this.bgLoopsY = (Main.screenHeight - this.bgStartY + (int)value.Y * 2) / Main.backgroundHeight[2] + 1;
                }
                else
                {
                    this.bgStartY = this.bgTop;
                    this.bgLoopsY = (Main.screenHeight - this.bgTop + (int)value.Y * 2) / Main.backgroundHeight[2] + 1;
                }
                if (num16 * 16.0 < (double)(Main.screenPosition.Y + 600f))
                {
                    this.bgLoopsY = (int)(num16 * 16.0 - (double)Main.screenPosition.Y + 600.0 - (double)this.bgStartY) / Main.backgroundHeight[2];
                    flag = true;
                }
                float num34 = (float)this.bgStart + Main.screenPosition.X;
                num34 = -(float)Math.IEEERemainder((double)num34, 16.0);
                num34 = (float)Math.Round((double)num34);
                int num35 = (int)num34;
                if (num35 == -8)
                {
                    num35 = 8;
                }
                for (int num36 = 0; num36 < this.bgLoops; num36++)
                {
                    for (int num37 = 0; num37 < this.bgLoopsY; num37++)
                    {
                        for (int num38 = 0; num38 < 6; num38++)
                        {
                            for (int num39 = 0; num39 < 6; num39++)
                            {
                                float num40 = (float)(this.bgStartY + num37 * 96 + num39 * 16 + 8);
                                float num41 = (float)(this.bgStart + num3 * num36 + num38 * 16 + 8);
                                int num42 = (int)((num41 + Main.screenPosition.X) / 16f);
                                int num43 = (int)((num40 + Main.screenPosition.Y) / 16f);
                                Microsoft.Xna.Framework.Color color8 = Lighting.GetColor(num42, num43);
                                if (Main.tile[num42, num43] == null)
                                {

                                }
                                bool flag3 = false;
                                if (Main.caveParrallax != 0f)
                                {
                                    if (Main.tile[num42 - 1, num43] == null)
                                    {

                                    }
                                    if (Main.tile[num42 + 1, num43] == null)
                                    {

                                    }
                                    if (Main.tile[num42, num43].wall == 0 || Main.tile[num42, num43].wall == 21 || Main.tile[num42 - 1, num43].wall == 0 || Main.tile[num42 - 1, num43].wall == 21 || Main.tile[num42 + 1, num43].wall == 0 || Main.tile[num42 + 1, num43].wall == 21)
                                    {
                                        flag3 = true;
                                    }
                                }
                                else
                                {
                                    if (Main.tile[num42, num43].wall == 0 || Main.tile[num42, num43].wall == 21)
                                    {
                                        flag3 = true;
                                    }
                                }
                                if ((flag3 || color8.R == 0 || color8.G == 0 || color8.B == 0) && (color8.R > 0 || color8.G > 0 || color8.B > 0) && (Main.tile[num42, num43].wall == 0 || Main.tile[num42, num43].wall == 21 || Main.caveParrallax != 0f))
                                {
                                    if (Lighting.lightMode < 2 && color8.R < 230 && color8.G < 230 && color8.B < 230)
                                    {
                                        if (((int)color8.R > num || (double)color8.G > (double)num * 1.1 || (double)color8.B > (double)num * 1.2) && !Main.tile[num42, num43].active)
                                        {
                                            for (int num44 = 0; num44 < 9; num44++)
                                            {
                                                int num45 = 0;
                                                int num46 = 0;
                                                int width2 = 4;
                                                int height2 = 4;
                                                Microsoft.Xna.Framework.Color color9 = color8;
                                                Microsoft.Xna.Framework.Color color10 = color8;
                                                if (num44 == 0 && !Main.tile[num42 - 1, num43 - 1].active)
                                                {
                                                    color10 = Lighting.GetColor(num42 - 1, num43 - 1);
                                                }
                                                if (num44 == 1)
                                                {
                                                    width2 = 8;
                                                    num45 = 4;
                                                    if (!Main.tile[num42, num43 - 1].active)
                                                    {
                                                        color10 = Lighting.GetColor(num42, num43 - 1);
                                                    }
                                                }
                                                if (num44 == 2)
                                                {
                                                    if (!Main.tile[num42 + 1, num43 - 1].active)
                                                    {
                                                        color10 = Lighting.GetColor(num42 + 1, num43 - 1);
                                                    }
                                                    num45 = 12;
                                                }
                                                if (num44 == 3)
                                                {
                                                    if (!Main.tile[num42 - 1, num43].active)
                                                    {
                                                        color10 = Lighting.GetColor(num42 - 1, num43);
                                                    }
                                                    height2 = 8;
                                                    num46 = 4;
                                                }
                                                if (num44 == 4)
                                                {
                                                    width2 = 8;
                                                    height2 = 8;
                                                    num45 = 4;
                                                    num46 = 4;
                                                }
                                                if (num44 == 5)
                                                {
                                                    num45 = 12;
                                                    num46 = 4;
                                                    height2 = 8;
                                                    if (!Main.tile[num42 + 1, num43].active)
                                                    {
                                                        color10 = Lighting.GetColor(num42 + 1, num43);
                                                    }
                                                }
                                                if (num44 == 6)
                                                {
                                                    if (!Main.tile[num42 - 1, num43 + 1].active)
                                                    {
                                                        color10 = Lighting.GetColor(num42 - 1, num43 + 1);
                                                    }
                                                    num46 = 12;
                                                }
                                                if (num44 == 7)
                                                {
                                                    width2 = 8;
                                                    height2 = 4;
                                                    num45 = 4;
                                                    num46 = 12;
                                                    if (!Main.tile[num42, num43 + 1].active)
                                                    {
                                                        color10 = Lighting.GetColor(num42, num43 + 1);
                                                    }
                                                }
                                                if (num44 == 8)
                                                {
                                                    if (!Main.tile[num42 + 1, num43 + 1].active)
                                                    {
                                                        color10 = Lighting.GetColor(num42 + 1, num43 + 1);
                                                    }
                                                    num45 = 12;
                                                    num46 = 12;
                                                }
                                                color9.R = (byte)((color8.R + color10.R) / 2);
                                                color9.G = (byte)((color8.G + color10.G) / 2);
                                                color9.B = (byte)((color8.B + color10.B) / 2);
                                                color9.R = (byte)((float)color9.R * num5);
                                                color9.G = (byte)((float)color9.G * num6);
                                                color9.B = (byte)((float)color9.B * num7);
                                                this.spriteBatch.Draw(Main.backgroundTexture[3], new Microsoft.Xna.Framework.Vector2((float)(this.bgStart + num3 * num36 + 16 * num38 + num45 + num35), (float)(this.bgStartY + Main.backgroundHeight[2] * num37 + 16 * num39 + num46)) + value, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(16 * num38 + num45 + num35 + 16, 16 * num39 + num46, width2, height2)), color9);
                                            }
                                        }
                                        else
                                        {
                                            if ((int)color8.R > num2 || (double)color8.G > (double)num2 * 1.1 || (double)color8.B > (double)num2 * 1.2)
                                            {
                                                for (int num47 = 0; num47 < 4; num47++)
                                                {
                                                    int num48 = 0;
                                                    int num49 = 0;
                                                    Microsoft.Xna.Framework.Color color11 = color8;
                                                    Microsoft.Xna.Framework.Color color12 = color8;
                                                    if (num47 == 0)
                                                    {
                                                        if (Lighting.Brighter(num42, num43 - 1, num42 - 1, num43))
                                                        {
                                                            color12 = Lighting.GetColor(num42 - 1, num43);
                                                        }
                                                        else
                                                        {
                                                            color12 = Lighting.GetColor(num42, num43 - 1);
                                                        }
                                                    }
                                                    if (num47 == 1)
                                                    {
                                                        if (Lighting.Brighter(num42, num43 - 1, num42 + 1, num43))
                                                        {
                                                            color12 = Lighting.GetColor(num42 + 1, num43);
                                                        }
                                                        else
                                                        {
                                                            color12 = Lighting.GetColor(num42, num43 - 1);
                                                        }
                                                        num48 = 8;
                                                    }
                                                    if (num47 == 2)
                                                    {
                                                        if (Lighting.Brighter(num42, num43 + 1, num42 - 1, num43))
                                                        {
                                                            color12 = Lighting.GetColor(num42 - 1, num43);
                                                        }
                                                        else
                                                        {
                                                            color12 = Lighting.GetColor(num42, num43 + 1);
                                                        }
                                                        num49 = 8;
                                                    }
                                                    if (num47 == 3)
                                                    {
                                                        if (Lighting.Brighter(num42, num43 + 1, num42 + 1, num43))
                                                        {
                                                            color12 = Lighting.GetColor(num42 + 1, num43);
                                                        }
                                                        else
                                                        {
                                                            color12 = Lighting.GetColor(num42, num43 + 1);
                                                        }
                                                        num48 = 8;
                                                        num49 = 8;
                                                    }
                                                    color11.R = (byte)((color8.R + color12.R) / 2);
                                                    color11.G = (byte)((color8.G + color12.G) / 2);
                                                    color11.B = (byte)((color8.B + color12.B) / 2);
                                                    color11.R = (byte)((float)color11.R * num5);
                                                    color11.G = (byte)((float)color11.G * num6);
                                                    color11.B = (byte)((float)color11.B * num7);
                                                    this.spriteBatch.Draw(Main.backgroundTexture[3], new Microsoft.Xna.Framework.Vector2((float)(this.bgStart + num3 * num36 + 16 * num38 + num48 + num35), (float)(this.bgStartY + Main.backgroundHeight[2] * num37 + 16 * num39 + num49)) + value, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(16 * num38 + num48 + num35 + 16, 16 * num39 + num49, 8, 8)), color11);
                                                }
                                            }
                                            else
                                            {
                                                color8.R = (byte)((float)color8.R * num5);
                                                color8.G = (byte)((float)color8.G * num6);
                                                color8.B = (byte)((float)color8.B * num7);
                                                this.spriteBatch.Draw(Main.backgroundTexture[3], new Microsoft.Xna.Framework.Vector2((float)(this.bgStart + num3 * num36 + 16 * num38 + num35), (float)(this.bgStartY + Main.backgroundHeight[2] * num37 + 16 * num39)) + value, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(16 * num38 + num35 + 16, 16 * num39, 16, 16)), color8);
                                            }
                                        }
                                    }
                                    else
                                    {
                                        color8.R = (byte)((float)color8.R * num5);
                                        color8.G = (byte)((float)color8.G * num6);
                                        color8.B = (byte)((float)color8.B * num7);
                                        this.spriteBatch.Draw(Main.backgroundTexture[3], new Microsoft.Xna.Framework.Vector2((float)(this.bgStart + num3 * num36 + 16 * num38 + num35), (float)(this.bgStartY + Main.backgroundHeight[2] * num37 + 16 * num39)) + value, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(16 * num38 + num35 + 16, 16 * num39, 16, 16)), color8);
                                    }
                                }
                            }
                        }
                    }
                }
                if (flag)
                {
                    this.bgParrallax = (double)Main.caveParrallax;
                    this.bgStart = (int)(-Math.IEEERemainder((double)Main.screenPosition.X * this.bgParrallax, (double)num3) - (double)(num3 / 2));
                    this.bgLoops = Main.screenWidth / num3 + 2;
                    this.bgTop = this.bgStartY + this.bgLoopsY * Main.backgroundHeight[2];
                    for (int num50 = 0; num50 < this.bgLoops; num50++)
                    {
                        for (int num51 = 0; num51 < 6; num51++)
                        {
                            float num52 = (float)(this.bgStart + num3 * num50 + num51 * 16 + 8);
                            float num53 = (float)this.bgTop;
                            Microsoft.Xna.Framework.Color color13 = Lighting.GetColor((int)((num52 + Main.screenPosition.X) / 16f), (int)((Main.screenPosition.Y + num53) / 16f));
                            color13.R = (byte)((float)color13.R * num5);
                            color13.G = (byte)((float)color13.G * num6);
                            color13.B = (byte)((float)color13.B * num7);
                            this.spriteBatch.Draw(Main.backgroundTexture[6], new Microsoft.Xna.Framework.Vector2((float)(this.bgStart + num3 * num50 + 16 * num51 + num35), (float)this.bgTop) + value, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(16 * num51 + num35 + 16, Main.magmaBGFrame * 16, 16, 16)), color13);
                        }
                    }
                }
            }
            this.bgTop = (int)((float)((int)num16 * 16) - Main.screenPosition.Y + 16f + 600f) - 8;
            if (num16 * 16.0 <= (double)(Main.screenPosition.Y + 600f))
            {
                this.bgStart = (int)(-Math.IEEERemainder(96.0 + (double)Main.screenPosition.X * this.bgParrallax, (double)num3) - (double)(num3 / 2)) - (int)value.X;
                this.bgLoops = (Main.screenWidth + (int)value.X * 2) / num3 + 2;
                if (num16 * 16.0 + (double)Main.screenHeight < (double)(Main.screenPosition.Y - 16f))
                {
                    this.bgStartY = (int)(Math.IEEERemainder((double)this.bgTop, (double)Main.backgroundHeight[2]) - (double)Main.backgroundHeight[2]);
                    this.bgLoopsY = (Main.screenHeight - this.bgStartY + (int)value.Y * 2) / Main.backgroundHeight[2] + 1;
                }
                else
                {
                    this.bgStartY = this.bgTop;
                    this.bgLoopsY = (Main.screenHeight - this.bgTop + (int)value.Y * 2) / Main.backgroundHeight[2] + 1;
                }
                num = (int)((double)num * 1.5);
                num2 = (int)((double)num2 * 1.5);
                float num54 = (float)this.bgStart + Main.screenPosition.X;
                num54 = -(float)Math.IEEERemainder((double)num54, 16.0);
                num54 = (float)Math.Round((double)num54);
                int num55 = (int)num54;
                if (num55 == -8)
                {
                    num55 = 8;
                }
                for (int num56 = 0; num56 < this.bgLoops; num56++)
                {
                    for (int num57 = 0; num57 < this.bgLoopsY; num57++)
                    {
                        for (int num58 = 0; num58 < 6; num58++)
                        {
                            for (int num59 = 0; num59 < 6; num59++)
                            {
                                float num60 = (float)(this.bgStartY + num57 * 96 + num59 * 16 + 8);
                                float num61 = (float)(this.bgStart + num3 * num56 + num58 * 16 + 8);
                                int num62 = (int)((num61 + Main.screenPosition.X) / 16f);
                                int num63 = (int)((num60 + Main.screenPosition.Y) / 16f);
                                Microsoft.Xna.Framework.Color color14 = Lighting.GetColor(num62, num63);
                                if (Main.tile[num62, num63] == null)
                                {

                                }
                                bool flag4 = false;
                                if (Main.caveParrallax != 0f)
                                {
                                    if (Main.tile[num62 - 1, num63] == null)
                                    {

                                    }
                                    if (Main.tile[num62 + 1, num63] == null)
                                    {

                                    }
                                    if (Main.tile[num62, num63].wall == 0 || Main.tile[num62, num63].wall == 21 || Main.tile[num62 - 1, num63].wall == 0 || Main.tile[num62 - 1, num63].wall == 21 || Main.tile[num62 + 1, num63].wall == 0 || Main.tile[num62 + 1, num63].wall == 21)
                                    {
                                        flag4 = true;
                                    }
                                }
                                else
                                {
                                    if (Main.tile[num62, num63].wall == 0 || Main.tile[num62, num63].wall == 21)
                                    {
                                        flag4 = true;
                                    }
                                }
                                if ((flag4 || color14.R == 0 || color14.G == 0 || color14.B == 0) && (color14.R > 0 || color14.G > 0 || color14.B > 0) && (Main.tile[num62, num63].wall == 0 || Main.tile[num62, num63].wall == 21 || Main.caveParrallax != 0f))
                                {
                                    if (Lighting.lightMode < 2 && color14.R < 230 && color14.G < 230 && color14.B < 230)
                                    {
                                        if (((int)color14.R > num || (double)color14.G > (double)num * 1.1 || (double)color14.B > (double)num * 1.2) && !Main.tile[num62, num63].active)
                                        {
                                            for (int num64 = 0; num64 < 9; num64++)
                                            {
                                                int num65 = 0;
                                                int num66 = 0;
                                                int width3 = 4;
                                                int height3 = 4;
                                                Microsoft.Xna.Framework.Color color15 = color14;
                                                Microsoft.Xna.Framework.Color color16 = color14;
                                                if (num64 == 0 && !Main.tile[num62 - 1, num63 - 1].active)
                                                {
                                                    color16 = Lighting.GetColor(num62 - 1, num63 - 1);
                                                }
                                                if (num64 == 1)
                                                {
                                                    width3 = 8;
                                                    num65 = 4;
                                                    if (!Main.tile[num62, num63 - 1].active)
                                                    {
                                                        color16 = Lighting.GetColor(num62, num63 - 1);
                                                    }
                                                }
                                                if (num64 == 2)
                                                {
                                                    if (!Main.tile[num62 + 1, num63 - 1].active)
                                                    {
                                                        color16 = Lighting.GetColor(num62 + 1, num63 - 1);
                                                    }
                                                    num65 = 12;
                                                }
                                                if (num64 == 3)
                                                {
                                                    if (!Main.tile[num62 - 1, num63].active)
                                                    {
                                                        color16 = Lighting.GetColor(num62 - 1, num63);
                                                    }
                                                    height3 = 8;
                                                    num66 = 4;
                                                }
                                                if (num64 == 4)
                                                {
                                                    width3 = 8;
                                                    height3 = 8;
                                                    num65 = 4;
                                                    num66 = 4;
                                                }
                                                if (num64 == 5)
                                                {
                                                    num65 = 12;
                                                    num66 = 4;
                                                    height3 = 8;
                                                    if (!Main.tile[num62 + 1, num63].active)
                                                    {
                                                        color16 = Lighting.GetColor(num62 + 1, num63);
                                                    }
                                                }
                                                if (num64 == 6)
                                                {
                                                    if (!Main.tile[num62 - 1, num63 + 1].active)
                                                    {
                                                        color16 = Lighting.GetColor(num62 - 1, num63 + 1);
                                                    }
                                                    num66 = 12;
                                                }
                                                if (num64 == 7)
                                                {
                                                    width3 = 8;
                                                    height3 = 4;
                                                    num65 = 4;
                                                    num66 = 12;
                                                    if (!Main.tile[num62, num63 + 1].active)
                                                    {
                                                        color16 = Lighting.GetColor(num62, num63 + 1);
                                                    }
                                                }
                                                if (num64 == 8)
                                                {
                                                    if (!Main.tile[num62 + 1, num63 + 1].active)
                                                    {
                                                        color16 = Lighting.GetColor(num62 + 1, num63 + 1);
                                                    }
                                                    num65 = 12;
                                                    num66 = 12;
                                                }
                                                color15.R = (byte)((color14.R + color16.R) / 2);
                                                color15.G = (byte)((color14.G + color16.G) / 2);
                                                color15.B = (byte)((color14.B + color16.B) / 2);
                                                color15.R = (byte)((float)color15.R * num5);
                                                color15.G = (byte)((float)color15.G * num6);
                                                color15.B = (byte)((float)color15.B * num7);
                                                SpriteBatch arg_24CE_0 = this.spriteBatch;
                                                Texture2D arg_24CE_1 = Main.backgroundTexture[5];
                                                Microsoft.Xna.Framework.Vector2 arg_24CE_2 = new Microsoft.Xna.Framework.Vector2((float)(this.bgStart + num3 * num56 + 16 * num58 + num65 + num55), (float)(this.bgStartY + Main.backgroundHeight[2] * num57 + 16 * num59 + num66)) + value;
                                                Microsoft.Xna.Framework.Rectangle? arg_24CE_3 = new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(16 * num58 + num65 + num55 + 16, 16 * num59 + Main.backgroundHeight[2] * Main.magmaBGFrame + num66, width3, height3));
                                                Microsoft.Xna.Framework.Color arg_24CE_4 = color15;
                                                float arg_24CE_5 = 0f;
                                                Microsoft.Xna.Framework.Vector2 origin = default(Microsoft.Xna.Framework.Vector2);
                                                arg_24CE_0.Draw(arg_24CE_1, arg_24CE_2, arg_24CE_3, arg_24CE_4, arg_24CE_5, origin, 1f, SpriteEffects.None, 0f);
                                            }
                                        }
                                        else
                                        {
                                            if ((int)color14.R > num2 || (double)color14.G > (double)num2 * 1.1 || (double)color14.B > (double)num2 * 1.2)
                                            {
                                                for (int num67 = 0; num67 < 4; num67++)
                                                {
                                                    int num68 = 0;
                                                    int num69 = 0;
                                                    Microsoft.Xna.Framework.Color color17 = color14;
                                                    Microsoft.Xna.Framework.Color color18 = color14;
                                                    if (num67 == 0)
                                                    {
                                                        if (Lighting.Brighter(num62, num63 - 1, num62 - 1, num63))
                                                        {
                                                            color18 = Lighting.GetColor(num62 - 1, num63);
                                                        }
                                                        else
                                                        {
                                                            color18 = Lighting.GetColor(num62, num63 - 1);
                                                        }
                                                    }
                                                    if (num67 == 1)
                                                    {
                                                        if (Lighting.Brighter(num62, num63 - 1, num62 + 1, num63))
                                                        {
                                                            color18 = Lighting.GetColor(num62 + 1, num63);
                                                        }
                                                        else
                                                        {
                                                            color18 = Lighting.GetColor(num62, num63 - 1);
                                                        }
                                                        num68 = 8;
                                                    }
                                                    if (num67 == 2)
                                                    {
                                                        if (Lighting.Brighter(num62, num63 + 1, num62 - 1, num63))
                                                        {
                                                            color18 = Lighting.GetColor(num62 - 1, num63);
                                                        }
                                                        else
                                                        {
                                                            color18 = Lighting.GetColor(num62, num63 + 1);
                                                        }
                                                        num69 = 8;
                                                    }
                                                    if (num67 == 3)
                                                    {
                                                        if (Lighting.Brighter(num62, num63 + 1, num62 + 1, num63))
                                                        {
                                                            color18 = Lighting.GetColor(num62 + 1, num63);
                                                        }
                                                        else
                                                        {
                                                            color18 = Lighting.GetColor(num62, num63 + 1);
                                                        }
                                                        num68 = 8;
                                                        num69 = 8;
                                                    }
                                                    color17.R = (byte)((color14.R + color18.R) / 2);
                                                    color17.G = (byte)((color14.G + color18.G) / 2);
                                                    color17.B = (byte)((color14.B + color18.B) / 2);
                                                    color17.R = (byte)((float)color17.R * num5);
                                                    color17.G = (byte)((float)color17.G * num6);
                                                    color17.B = (byte)((float)color17.B * num7);
                                                    SpriteBatch arg_272D_0 = this.spriteBatch;
                                                    Texture2D arg_272D_1 = Main.backgroundTexture[5];
                                                    Microsoft.Xna.Framework.Vector2 arg_272D_2 = new Microsoft.Xna.Framework.Vector2((float)(this.bgStart + num3 * num56 + 16 * num58 + num68 + num55), (float)(this.bgStartY + Main.backgroundHeight[2] * num57 + 16 * num59 + num69)) + value;
                                                    Microsoft.Xna.Framework.Rectangle? arg_272D_3 = new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(16 * num58 + num68 + num55 + 16, 16 * num59 + Main.backgroundHeight[2] * Main.magmaBGFrame + num69, 8, 8));
                                                    Microsoft.Xna.Framework.Color arg_272D_4 = color17;
                                                    float arg_272D_5 = 0f;
                                                    Microsoft.Xna.Framework.Vector2 origin = default(Microsoft.Xna.Framework.Vector2);
                                                    arg_272D_0.Draw(arg_272D_1, arg_272D_2, arg_272D_3, arg_272D_4, arg_272D_5, origin, 1f, SpriteEffects.None, 0f);
                                                }
                                            }
                                            else
                                            {
                                                color14.R = (byte)((float)color14.R * num5);
                                                color14.G = (byte)((float)color14.G * num6);
                                                color14.B = (byte)((float)color14.B * num7);
                                                SpriteBatch arg_280C_0 = this.spriteBatch;
                                                Texture2D arg_280C_1 = Main.backgroundTexture[5];
                                                Microsoft.Xna.Framework.Vector2 arg_280C_2 = new Microsoft.Xna.Framework.Vector2((float)(this.bgStart + num3 * num56 + 16 * num58 + num55), (float)(this.bgStartY + Main.backgroundHeight[2] * num57 + 16 * num59)) + value;
                                                Microsoft.Xna.Framework.Rectangle? arg_280C_3 = new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(16 * num58 + num55 + 16, 16 * num59 + Main.backgroundHeight[2] * Main.magmaBGFrame, 16, 16));
                                                Microsoft.Xna.Framework.Color arg_280C_4 = color14;
                                                float arg_280C_5 = 0f;
                                                Microsoft.Xna.Framework.Vector2 origin = default(Microsoft.Xna.Framework.Vector2);
                                                arg_280C_0.Draw(arg_280C_1, arg_280C_2, arg_280C_3, arg_280C_4, arg_280C_5, origin, 1f, SpriteEffects.None, 0f);
                                            }
                                        }
                                    }
                                    else
                                    {
                                        color14.R = (byte)((float)color14.R * num5);
                                        color14.G = (byte)((float)color14.G * num6);
                                        color14.B = (byte)((float)color14.B * num7);
                                        SpriteBatch arg_28DD_0 = this.spriteBatch;
                                        Texture2D arg_28DD_1 = Main.backgroundTexture[5];
                                        Microsoft.Xna.Framework.Vector2 arg_28DD_2 = new Microsoft.Xna.Framework.Vector2((float)(this.bgStart + num3 * num56 + 16 * num58 + num55), (float)(this.bgStartY + Main.backgroundHeight[2] * num57 + 16 * num59)) + value;
                                        Microsoft.Xna.Framework.Rectangle? arg_28DD_3 = new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(16 * num58 + num55 + 16, 16 * num59 + Main.backgroundHeight[2] * Main.magmaBGFrame, 16, 16));
                                        Microsoft.Xna.Framework.Color arg_28DD_4 = color14;
                                        float arg_28DD_5 = 0f;
                                        Microsoft.Xna.Framework.Vector2 origin = default(Microsoft.Xna.Framework.Vector2);
                                        arg_28DD_0.Draw(arg_28DD_1, arg_28DD_2, arg_28DD_3, arg_28DD_4, arg_28DD_5, origin, 1f, SpriteEffects.None, 0f);
                                    }
                                }
                            }
                        }
                    }
                }
            }
            Lighting.brightness = Lighting.defBrightness;
            Main.renderTimer[3] = (float)stopwatch.ElapsedMilliseconds;
        }
Example #35
0
 protected override void Draw(GameTime gameTime)
 {
     if (Lighting.lightMode >= 2)
     {
         Main.drawToScreen = true;
     }
     else
     {
         Main.drawToScreen = false;
     }
     if (Main.drawToScreen)
     {
         bool arg_22_0 = Main.targetSet;
     }
     if (!Main.drawToScreen && !Main.targetSet)
     {
         this.InitTargets();
     }
     Stopwatch stopwatch = new Stopwatch();
     stopwatch.Start();
     Main.fpsCount++;
     if (!base.IsActive)
     {
         Main.maxQ = true;
     }
     if (!Main.dedServ)
     {
         bool flag = false;
         int arg_82_0 = Main.screenWidth;
         Viewport viewport = base.GraphicsDevice.Viewport;
         if (arg_82_0 == viewport.Width)
         {
             int arg_9D_0 = Main.screenHeight;
             viewport = base.GraphicsDevice.Viewport;
             if (arg_9D_0 == viewport.Height)
             {
                 goto IL_AE;
             }
         }
         flag = true;
         if (Main.gamePaused)
         {
             Main.renderNow = true;
         }
         IL_AE:
         viewport = base.GraphicsDevice.Viewport;
         Main.screenWidth = viewport.Width;
         viewport = base.GraphicsDevice.Viewport;
         Main.screenHeight = viewport.Height;
         if (Main.screenWidth > Main.maxScreenW)
         {
             Main.screenWidth = Main.maxScreenW;
             flag = true;
         }
         if (Main.screenHeight > Main.maxScreenH)
         {
             Main.screenHeight = Main.maxScreenH;
             flag = true;
         }
         if (Main.screenWidth < Main.minScreenW)
         {
             Main.screenWidth = Main.minScreenW;
             flag = true;
         }
         if (Main.screenHeight < Main.minScreenH)
         {
             Main.screenHeight = Main.minScreenH;
             flag = true;
         }
         if (flag)
         {
             this.graphics.PreferredBackBufferWidth = Main.screenWidth;
             this.graphics.PreferredBackBufferHeight = Main.screenHeight;
             this.graphics.ApplyChanges();
             if (!Main.drawToScreen)
             {
                 this.InitTargets();
             }
         }
     }
     Main.CursorColor();
     Main.drawTime++;
     Main.screenLastPosition = Main.screenPosition;
     if (Main.stackSplit == 0)
     {
         Main.stackCounter = 0;
         Main.stackDelay = 7;
     }
     else
     {
         Main.stackCounter++;
         if (Main.stackCounter >= 30)
         {
             Main.stackDelay--;
             if (Main.stackDelay < 2)
             {
                 Main.stackDelay = 2;
             }
             Main.stackCounter = 0;
         }
     }
     Main.mouseTextColor += (byte)Main.mouseTextColorChange;
     if (Main.mouseTextColor >= 250)
     {
         Main.mouseTextColorChange = -4;
     }
     if (Main.mouseTextColor <= 175)
     {
         Main.mouseTextColorChange = 4;
     }
     if (Main.myPlayer >= 0)
     {
         Main.player[Main.myPlayer].mouseInterface = false;
     }
     Main.toolTip = new Item();
     if (!Main.gameMenu && Main.netMode != 2)
     {
         Main.screenPosition.X = Main.player[Main.myPlayer].position.X + (float)Main.player[Main.myPlayer].width * 0.5f - (float)Main.screenWidth * 0.5f;
         Main.screenPosition.Y = Main.player[Main.myPlayer].position.Y + (float)Main.player[Main.myPlayer].height * 0.5f - (float)Main.screenHeight * 0.5f;
         Main.screenPosition.X = (float)((int)Main.screenPosition.X);
         Main.screenPosition.Y = (float)((int)Main.screenPosition.Y);
     }
     if (!Main.gameMenu && Main.netMode != 2)
     {
         if (Main.screenPosition.X < Main.leftWorld + (float)(Lighting.offScreenTiles * 16) + 16f)
         {
             Main.screenPosition.X = Main.leftWorld + (float)(Lighting.offScreenTiles * 16) + 16f;
         }
         else
         {
             if (Main.screenPosition.X + (float)Main.screenWidth > Main.rightWorld - (float)(Lighting.offScreenTiles * 16) - 32f)
             {
                 Main.screenPosition.X = Main.rightWorld - (float)Main.screenWidth - (float)(Lighting.offScreenTiles * 16) - 32f;
             }
         }
         if (Main.screenPosition.Y < Main.topWorld + (float)(Lighting.offScreenTiles * 16) + 16f)
         {
             Main.screenPosition.Y = Main.topWorld + (float)(Lighting.offScreenTiles * 16) + 16f;
         }
         else
         {
             if (Main.screenPosition.Y + (float)Main.screenHeight > Main.bottomWorld - (float)(Lighting.offScreenTiles * 16) - 32f)
             {
                 Main.screenPosition.Y = Main.bottomWorld - (float)Main.screenHeight - (float)(Lighting.offScreenTiles * 16) - 32f;
             }
         }
     }
     if (Main.showSplash)
     {
         this.DrawSplash(gameTime);
         return;
     }
     if (!Main.gameMenu)
     {
         if (Main.renderNow)
         {
             Main.screenLastPosition = Main.screenPosition;
             Main.renderNow = false;
             Main.renderCount = 99;
             int tempLightCount = Lighting.tempLightCount;
             this.Draw(gameTime);
             Lighting.tempLightCount = tempLightCount;
             Lighting.LightTiles(this.firstTileX, this.lastTileX, this.firstTileY, this.lastTileY);
             Lighting.LightTiles(this.firstTileX, this.lastTileX, this.firstTileY, this.lastTileY);
             this.RenderTiles();
             Main.sceneTilePos.X = Main.screenPosition.X - (float)Main.offScreenRange;
             Main.sceneTilePos.Y = Main.screenPosition.Y - (float)Main.offScreenRange;
             this.RenderBackground();
             Main.sceneBackgroundPos.X = Main.screenPosition.X - (float)Main.offScreenRange;
             Main.sceneBackgroundPos.Y = Main.screenPosition.Y - (float)Main.offScreenRange;
             this.RenderWalls();
             Main.sceneWallPos.X = Main.screenPosition.X - (float)Main.offScreenRange;
             Main.sceneWallPos.Y = Main.screenPosition.Y - (float)Main.offScreenRange;
             this.RenderTiles2();
             Main.sceneTile2Pos.X = Main.screenPosition.X - (float)Main.offScreenRange;
             Main.sceneTile2Pos.Y = Main.screenPosition.Y - (float)Main.offScreenRange;
             this.RenderWater();
             Main.sceneWaterPos.X = Main.screenPosition.X - (float)Main.offScreenRange;
             Main.sceneWaterPos.Y = Main.screenPosition.Y - (float)Main.offScreenRange;
             Main.renderCount = 99;
         }
         else
         {
             if (Main.renderCount == 3)
             {
                 this.RenderTiles();
                 Main.sceneTilePos.X = Main.screenPosition.X - (float)Main.offScreenRange;
                 Main.sceneTilePos.Y = Main.screenPosition.Y - (float)Main.offScreenRange;
             }
             if (Main.renderCount == 2)
             {
                 this.RenderBackground();
                 Main.sceneBackgroundPos.X = Main.screenPosition.X - (float)Main.offScreenRange;
                 Main.sceneBackgroundPos.Y = Main.screenPosition.Y - (float)Main.offScreenRange;
             }
             if (Main.renderCount == 2)
             {
                 this.RenderWalls();
                 Main.sceneWallPos.X = Main.screenPosition.X - (float)Main.offScreenRange;
                 Main.sceneWallPos.Y = Main.screenPosition.Y - (float)Main.offScreenRange;
             }
             if (Main.renderCount == 3)
             {
                 this.RenderTiles2();
                 Main.sceneTile2Pos.X = Main.screenPosition.X - (float)Main.offScreenRange;
                 Main.sceneTile2Pos.Y = Main.screenPosition.Y - (float)Main.offScreenRange;
             }
             if (Main.renderCount == 1)
             {
                 this.RenderWater();
                 Main.sceneWaterPos.X = Main.screenPosition.X - (float)Main.offScreenRange;
                 Main.sceneWaterPos.Y = Main.screenPosition.Y - (float)Main.offScreenRange;
             }
         }
         if (Main.render && !Main.gameMenu)
         {
             if (Math.Abs(Main.sceneTilePos.X - (Main.screenPosition.X - (float)Main.offScreenRange)) > (float)Main.offScreenRange || Math.Abs(Main.sceneTilePos.Y - (Main.screenPosition.Y - (float)Main.offScreenRange)) > (float)Main.offScreenRange)
             {
                 this.RenderTiles();
                 Main.sceneTilePos.X = Main.screenPosition.X - (float)Main.offScreenRange;
                 Main.sceneTilePos.Y = Main.screenPosition.Y - (float)Main.offScreenRange;
             }
             if (Math.Abs(Main.sceneTile2Pos.X - (Main.screenPosition.X - (float)Main.offScreenRange)) > (float)Main.offScreenRange || Math.Abs(Main.sceneTile2Pos.Y - (Main.screenPosition.Y - (float)Main.offScreenRange)) > (float)Main.offScreenRange)
             {
                 this.RenderTiles2();
                 Main.sceneTile2Pos.X = Main.screenPosition.X - (float)Main.offScreenRange;
                 Main.sceneTile2Pos.Y = Main.screenPosition.Y - (float)Main.offScreenRange;
             }
             if (Math.Abs(Main.sceneBackgroundPos.X - (Main.screenPosition.X - (float)Main.offScreenRange)) > (float)Main.offScreenRange || Math.Abs(Main.sceneBackgroundPos.Y - (Main.screenPosition.Y - (float)Main.offScreenRange)) > (float)Main.offScreenRange)
             {
                 this.RenderBackground();
                 Main.sceneBackgroundPos.X = Main.screenPosition.X - (float)Main.offScreenRange;
                 Main.sceneBackgroundPos.Y = Main.screenPosition.Y - (float)Main.offScreenRange;
             }
             if (Math.Abs(Main.sceneWallPos.X - (Main.screenPosition.X - (float)Main.offScreenRange)) > (float)Main.offScreenRange || Math.Abs(Main.sceneWallPos.Y - (Main.screenPosition.Y - (float)Main.offScreenRange)) > (float)Main.offScreenRange)
             {
                 this.RenderWalls();
                 Main.sceneWallPos.X = Main.screenPosition.X - (float)Main.offScreenRange;
                 Main.sceneWallPos.Y = Main.screenPosition.Y - (float)Main.offScreenRange;
             }
             if (Math.Abs(Main.sceneWaterPos.X - (Main.screenPosition.X - (float)Main.offScreenRange)) > (float)Main.offScreenRange || Math.Abs(Main.sceneWaterPos.Y - (Main.screenPosition.Y - (float)Main.offScreenRange)) > (float)Main.offScreenRange)
             {
                 this.RenderWater();
                 Main.sceneWaterPos.X = Main.screenPosition.X - (float)Main.offScreenRange;
                 Main.sceneWaterPos.Y = Main.screenPosition.Y - (float)Main.offScreenRange;
             }
         }
     }
     this.bgParrallax = 0.1;
     this.bgStart = (int)(-Math.IEEERemainder((double)Main.screenPosition.X * this.bgParrallax, (double)Main.backgroundWidth[Main.background]) - (double)(Main.backgroundWidth[Main.background] / 2));
     this.bgLoops = Main.screenWidth / Main.backgroundWidth[Main.background] + 2;
     this.bgStartY = 0;
     this.bgLoopsY = 0;
     this.bgTop = (int)((double)(-(double)Main.screenPosition.Y) / (Main.worldSurface * 16.0 - 600.0) * 200.0);
     Main.bgColor = Microsoft.Xna.Framework.Color.White;
     if (Main.gameMenu || Main.netMode == 2)
     {
         this.bgTop = -200;
     }
     int num = (int)(Main.time / 54000.0 * (double)(Main.screenWidth + Main.sunTexture.Width * 2)) - Main.sunTexture.Width;
     int num2 = 0;
     Microsoft.Xna.Framework.Color white = Microsoft.Xna.Framework.Color.White;
     float num3 = 1f;
     float rotation = (float)(Main.time / 54000.0) * 2f - 7.3f;
     int num4 = (int)(Main.time / 32400.0 * (double)(Main.screenWidth + Main.moonTexture.Width * 2)) - Main.moonTexture.Width;
     int num5 = 0;
     Microsoft.Xna.Framework.Color white2 = Microsoft.Xna.Framework.Color.White;
     float num6 = 1f;
     float rotation2 = (float)(Main.time / 32400.0) * 2f - 7.3f;
     if (Main.dayTime)
     {
         double num7;
         if (Main.time < 27000.0)
         {
             num7 = Math.Pow(1.0 - Main.time / 54000.0 * 2.0, 2.0);
             num2 = (int)((double)this.bgTop + num7 * 250.0 + 180.0);
         }
         else
         {
             num7 = Math.Pow((Main.time / 54000.0 - 0.5) * 2.0, 2.0);
             num2 = (int)((double)this.bgTop + num7 * 250.0 + 180.0);
         }
         num3 = (float)(1.2 - num7 * 0.4);
     }
     else
     {
         double num8;
         if (Main.time < 16200.0)
         {
             num8 = Math.Pow(1.0 - Main.time / 32400.0 * 2.0, 2.0);
             num5 = (int)((double)this.bgTop + num8 * 250.0 + 180.0);
         }
         else
         {
             num8 = Math.Pow((Main.time / 32400.0 - 0.5) * 2.0, 2.0);
             num5 = (int)((double)this.bgTop + num8 * 250.0 + 180.0);
         }
         num6 = (float)(1.2 - num8 * 0.4);
     }
     if (Main.dayTime)
     {
         if (Main.time < 13500.0)
         {
             float num9 = (float)(Main.time / 13500.0);
             white.R = (byte)(num9 * 200f + 55f);
             white.G = (byte)(num9 * 180f + 75f);
             white.B = (byte)(num9 * 250f + 5f);
             Main.bgColor.R = (byte)(num9 * 230f + 25f);
             Main.bgColor.G = (byte)(num9 * 220f + 35f);
             Main.bgColor.B = (byte)(num9 * 220f + 35f);
         }
         if (Main.time > 45900.0)
         {
             float num9 = (float)(1.0 - (Main.time / 54000.0 - 0.85) * 6.666666666666667);
             white.R = (byte)(num9 * 120f + 55f);
             white.G = (byte)(num9 * 100f + 25f);
             white.B = (byte)(num9 * 120f + 55f);
             Main.bgColor.R = (byte)(num9 * 200f + 35f);
             Main.bgColor.G = (byte)(num9 * 85f + 35f);
             Main.bgColor.B = (byte)(num9 * 135f + 35f);
         }
         else
         {
             if (Main.time > 37800.0)
             {
                 float num9 = (float)(1.0 - (Main.time / 54000.0 - 0.7) * 6.666666666666667);
                 white.R = (byte)(num9 * 80f + 175f);
                 white.G = (byte)(num9 * 130f + 125f);
                 white.B = (byte)(num9 * 100f + 155f);
                 Main.bgColor.R = (byte)(num9 * 20f + 235f);
                 Main.bgColor.G = (byte)(num9 * 135f + 120f);
                 Main.bgColor.B = (byte)(num9 * 85f + 170f);
             }
         }
     }
     if (!Main.dayTime)
     {
         if (Main.bloodMoon)
         {
             if (Main.time < 16200.0)
             {
                 float num9 = (float)(1.0 - Main.time / 16200.0);
                 white2.R = (byte)(num9 * 10f + 205f);
                 white2.G = (byte)(num9 * 170f + 55f);
                 white2.B = (byte)(num9 * 200f + 55f);
                 Main.bgColor.R = (byte)(40f - num9 * 40f + 35f);
                 Main.bgColor.G = (byte)(num9 * 20f + 15f);
                 Main.bgColor.B = (byte)(num9 * 20f + 15f);
             }
             else
             {
                 if (Main.time >= 16200.0)
                 {
                     float num9 = (float)((Main.time / 32400.0 - 0.5) * 2.0);
                     white2.R = (byte)(num9 * 50f + 205f);
                     white2.G = (byte)(num9 * 100f + 155f);
                     white2.B = (byte)(num9 * 100f + 155f);
                     white2.R = (byte)(num9 * 10f + 205f);
                     white2.G = (byte)(num9 * 170f + 55f);
                     white2.B = (byte)(num9 * 200f + 55f);
                     Main.bgColor.R = (byte)(40f - num9 * 40f + 35f);
                     Main.bgColor.G = (byte)(num9 * 20f + 15f);
                     Main.bgColor.B = (byte)(num9 * 20f + 15f);
                 }
             }
         }
         else
         {
             if (Main.time < 16200.0)
             {
                 float num9 = (float)(1.0 - Main.time / 16200.0);
                 white2.R = (byte)(num9 * 10f + 205f);
                 white2.G = (byte)(num9 * 70f + 155f);
                 white2.B = (byte)(num9 * 100f + 155f);
                 Main.bgColor.R = (byte)(num9 * 20f + 15f);
                 Main.bgColor.G = (byte)(num9 * 20f + 15f);
                 Main.bgColor.B = (byte)(num9 * 20f + 15f);
             }
             else
             {
                 if (Main.time >= 16200.0)
                 {
                     float num9 = (float)((Main.time / 32400.0 - 0.5) * 2.0);
                     white2.R = (byte)(num9 * 50f + 205f);
                     white2.G = (byte)(num9 * 100f + 155f);
                     white2.B = (byte)(num9 * 100f + 155f);
                     Main.bgColor.R = (byte)(num9 * 10f + 15f);
                     Main.bgColor.G = (byte)(num9 * 20f + 15f);
                     Main.bgColor.B = (byte)(num9 * 20f + 15f);
                 }
             }
         }
     }
     if (Main.gameMenu || Main.netMode == 2)
     {
         this.bgTop = 0;
         if (!Main.dayTime)
         {
             Main.bgColor.R = 35;
             Main.bgColor.G = 35;
             Main.bgColor.B = 35;
         }
     }
     if (Main.gameMenu)
     {
         Main.bgDelay = 1000;
         Main.evilTiles = (int)(Main.bgAlpha[1] * 500f);
     }
     if (Main.evilTiles > 0)
     {
         float num10 = (float)Main.evilTiles / 500f;
         if (num10 > 1f)
         {
             num10 = 1f;
         }
         int num11 = (int)Main.bgColor.R;
         int num12 = (int)Main.bgColor.G;
         int num13 = (int)Main.bgColor.B;
         num11 -= (int)(100f * num10 * ((float)Main.bgColor.R / 255f));
         num12 -= (int)(140f * num10 * ((float)Main.bgColor.G / 255f));
         num13 -= (int)(80f * num10 * ((float)Main.bgColor.B / 255f));
         if (num11 < 15)
         {
             num11 = 15;
         }
         if (num12 < 15)
         {
             num12 = 15;
         }
         if (num13 < 15)
         {
             num13 = 15;
         }
         Main.bgColor.R = (byte)num11;
         Main.bgColor.G = (byte)num12;
         Main.bgColor.B = (byte)num13;
         num11 = (int)white.R;
         num12 = (int)white.G;
         num13 = (int)white.B;
         num11 -= (int)(100f * num10 * ((float)white.R / 255f));
         num12 -= (int)(100f * num10 * ((float)white.G / 255f));
         num13 -= (int)(0f * num10 * ((float)white.B / 255f));
         if (num11 < 15)
         {
             num11 = 15;
         }
         if (num12 < 15)
         {
             num12 = 15;
         }
         if (num13 < 15)
         {
             num13 = 15;
         }
         white.R = (byte)num11;
         white.G = (byte)num12;
         white.B = (byte)num13;
         num11 = (int)white2.R;
         num12 = (int)white2.G;
         num13 = (int)white2.B;
         num11 -= (int)(140f * num10 * ((float)white2.R / 255f));
         num12 -= (int)(190f * num10 * ((float)white2.G / 255f));
         num13 -= (int)(170f * num10 * ((float)white2.B / 255f));
         if (num11 < 15)
         {
             num11 = 15;
         }
         if (num12 < 15)
         {
             num12 = 15;
         }
         if (num13 < 15)
         {
             num13 = 15;
         }
         white2.R = (byte)num11;
         white2.G = (byte)num12;
         white2.B = (byte)num13;
     }
     if (Main.jungleTiles > 0)
     {
         float num14 = (float)Main.jungleTiles / 200f;
         if (num14 > 1f)
         {
             num14 = 1f;
         }
         int num15 = (int)Main.bgColor.R;
         int num16 = (int)Main.bgColor.G;
         int num17 = (int)Main.bgColor.B;
         num15 -= (int)(20f * num14 * ((float)Main.bgColor.R / 255f));
         num17 -= (int)(90f * num14 * ((float)Main.bgColor.B / 255f));
         if (num16 > 255)
         {
             num16 = 255;
         }
         if (num16 < 15)
         {
             num16 = 15;
         }
         if (num15 > 255)
         {
             num15 = 255;
         }
         if (num15 < 15)
         {
             num15 = 15;
         }
         if (num17 < 15)
         {
             num17 = 15;
         }
         Main.bgColor.R = (byte)num15;
         Main.bgColor.G = (byte)num16;
         Main.bgColor.B = (byte)num17;
         num15 = (int)white.R;
         num16 = (int)white.G;
         num17 = (int)white.B;
         num15 -= (int)(30f * num14 * ((float)white.R / 255f));
         num17 -= (int)(10f * num14 * ((float)white.B / 255f));
         if (num15 < 15)
         {
             num15 = 15;
         }
         if (num16 < 15)
         {
             num16 = 15;
         }
         if (num17 < 15)
         {
             num17 = 15;
         }
         white.R = (byte)num15;
         white.G = (byte)num16;
         white.B = (byte)num17;
         num15 = (int)white2.R;
         num16 = (int)white2.G;
         num17 = (int)white2.B;
         num16 -= (int)(140f * num14 * ((float)white2.R / 255f));
         num15 -= (int)(170f * num14 * ((float)white2.G / 255f));
         num17 -= (int)(190f * num14 * ((float)white2.B / 255f));
         if (num15 < 15)
         {
             num15 = 15;
         }
         if (num16 < 15)
         {
             num16 = 15;
         }
         if (num17 < 15)
         {
             num17 = 15;
         }
         white2.R = (byte)num15;
         white2.G = (byte)num16;
         white2.B = (byte)num17;
     }
     if (Main.bgColor.R < 15)
     {
         Main.bgColor.R = 15;
     }
     if (Main.bgColor.G < 15)
     {
         Main.bgColor.G = 15;
     }
     if (Main.bgColor.B < 15)
     {
         Main.bgColor.B = 15;
     }
     if (Main.bloodMoon)
     {
         if (Main.bgColor.R < 25)
         {
             Main.bgColor.R = 25;
         }
         if (Main.bgColor.G < 25)
         {
             Main.bgColor.G = 25;
         }
         if (Main.bgColor.B < 25)
         {
             Main.bgColor.B = 25;
         }
     }
     Main.tileColor.A = 255;
     Main.tileColor.R = (byte)((Main.bgColor.R + Main.bgColor.B + Main.bgColor.G) / 3);
     Main.tileColor.G = (byte)((Main.bgColor.R + Main.bgColor.B + Main.bgColor.G) / 3);
     Main.tileColor.B = (byte)((Main.bgColor.R + Main.bgColor.B + Main.bgColor.G) / 3);
     Main.tileColor.R = (byte)((Main.bgColor.R + Main.bgColor.G + Main.bgColor.B + Main.bgColor.R * 7) / 10);
     Main.tileColor.G = (byte)((Main.bgColor.R + Main.bgColor.G + Main.bgColor.B + Main.bgColor.G * 7) / 10);
     Main.tileColor.B = (byte)((Main.bgColor.R + Main.bgColor.G + Main.bgColor.B + Main.bgColor.B * 7) / 10);
     if (Main.tileColor.R >= 255 && Main.tileColor.G >= 255)
     {
         byte arg_1A41_0 = Main.tileColor.B;
     }
     float num18 = (float)(Main.maxTilesX / 4200);
     num18 *= num18;
     float num19 = (float)((double)((Main.screenPosition.Y + (float)(Main.screenHeight / 2)) / 16f - (65f + 10f * num18)) / (Main.worldSurface / 5.0));
     if (num19 < 0f)
     {
         num19 = 0f;
     }
     if (num19 > 1f)
     {
         num19 = 1f;
     }
     if (Main.gameMenu)
     {
         num19 = 1f;
     }
     Main.bgColor.R = (byte)((float)Main.bgColor.R * num19);
     Main.bgColor.G = (byte)((float)Main.bgColor.G * num19);
     Main.bgColor.B = (byte)((float)Main.bgColor.B * num19);
     base.GraphicsDevice.Clear(Microsoft.Xna.Framework.Color.Black);
     base.Draw(gameTime);
     this.spriteBatch.Begin();
     if ((double)Main.screenPosition.Y < Main.worldSurface * 16.0 + 16.0)
     {
         for (int i = 0; i < this.bgLoops; i++)
         {
             this.spriteBatch.Draw(Main.backgroundTexture[Main.background], new Microsoft.Xna.Framework.Rectangle(this.bgStart + Main.backgroundWidth[Main.background] * i, this.bgTop, Main.backgroundWidth[Main.background], Main.backgroundHeight[Main.background]), Main.bgColor);
         }
     }
     if ((double)Main.screenPosition.Y < Main.worldSurface * 16.0 + 16.0 && 255 - Main.bgColor.R - 100 > 0 && Main.netMode != 2)
     {
         for (int j = 0; j < Main.numStars; j++)
         {
             Microsoft.Xna.Framework.Color color = default(Microsoft.Xna.Framework.Color);
             float num20 = (float)Main.evilTiles / 500f;
             if (num20 > 1f)
             {
                 num20 = 1f;
             }
             num20 = 1f - num20 * 0.5f;
             if (Main.evilTiles <= 0)
             {
                 num20 = 1f;
             }
             int num21 = (int)((float)(255 - Main.bgColor.R - 100) * Main.star[j].twinkle * num20);
             int num22 = (int)((float)(255 - Main.bgColor.G - 100) * Main.star[j].twinkle * num20);
             int num23 = (int)((float)(255 - Main.bgColor.B - 100) * Main.star[j].twinkle * num20);
             if (num21 < 0)
             {
                 num21 = 0;
             }
             if (num22 < 0)
             {
                 num22 = 0;
             }
             if (num23 < 0)
             {
                 num23 = 0;
             }
             color.R = (byte)num21;
             color.G = (byte)((float)num22 * num20);
             color.B = (byte)((float)num23 * num20);
             float num24 = Main.star[j].position.X * ((float)Main.screenWidth / 800f);
             float num25 = Main.star[j].position.Y * ((float)Main.screenHeight / 600f);
             this.spriteBatch.Draw(Main.starTexture[Main.star[j].type], new Microsoft.Xna.Framework.Vector2(num24 + (float)Main.starTexture[Main.star[j].type].Width * 0.5f, num25 + (float)Main.starTexture[Main.star[j].type].Height * 0.5f + (float)this.bgTop), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.starTexture[Main.star[j].type].Width, Main.starTexture[Main.star[j].type].Height)), color, Main.star[j].rotation, new Microsoft.Xna.Framework.Vector2((float)Main.starTexture[Main.star[j].type].Width * 0.5f, (float)Main.starTexture[Main.star[j].type].Height * 0.5f), Main.star[j].scale * Main.star[j].twinkle, SpriteEffects.None, 0f);
         }
     }
     if ((double)(Main.screenPosition.Y / 16f) < Main.worldSurface + 2.0)
     {
         if (Main.dayTime)
         {
             num3 *= 1.1f;
             if (!Main.gameMenu && Main.player[Main.myPlayer].head == 12)
             {
                 this.spriteBatch.Draw(Main.sun2Texture, new Microsoft.Xna.Framework.Vector2((float)num, (float)(num2 + (int)Main.sunModY)), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.sunTexture.Width, Main.sunTexture.Height)), white, rotation, new Microsoft.Xna.Framework.Vector2((float)(Main.sunTexture.Width / 2), (float)(Main.sunTexture.Height / 2)), num3, SpriteEffects.None, 0f);
             }
             else
             {
                 this.spriteBatch.Draw(Main.sunTexture, new Microsoft.Xna.Framework.Vector2((float)num, (float)(num2 + (int)Main.sunModY)), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.sunTexture.Width, Main.sunTexture.Height)), white, rotation, new Microsoft.Xna.Framework.Vector2((float)(Main.sunTexture.Width / 2), (float)(Main.sunTexture.Height / 2)), num3, SpriteEffects.None, 0f);
             }
         }
         if (!Main.dayTime)
         {
             this.spriteBatch.Draw(Main.moonTexture, new Microsoft.Xna.Framework.Vector2((float)num4, (float)(num5 + (int)Main.moonModY)), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, Main.moonTexture.Width * Main.moonPhase, Main.moonTexture.Width, Main.moonTexture.Width)), white2, rotation2, new Microsoft.Xna.Framework.Vector2((float)(Main.moonTexture.Width / 2), (float)(Main.moonTexture.Width / 2)), num6, SpriteEffects.None, 0f);
         }
     }
     Microsoft.Xna.Framework.Rectangle value;
     if (Main.dayTime)
     {
         value = new Microsoft.Xna.Framework.Rectangle((int)((double)num - (double)Main.sunTexture.Width * 0.5 * (double)num3), (int)((double)num2 - (double)Main.sunTexture.Height * 0.5 * (double)num3 + (double)Main.sunModY), (int)((float)Main.sunTexture.Width * num3), (int)((float)Main.sunTexture.Width * num3));
     }
     else
     {
         value = new Microsoft.Xna.Framework.Rectangle((int)((double)num4 - (double)Main.moonTexture.Width * 0.5 * (double)num6), (int)((double)num5 - (double)Main.moonTexture.Width * 0.5 * (double)num6 + (double)Main.moonModY), (int)((float)Main.moonTexture.Width * num6), (int)((float)Main.moonTexture.Width * num6));
     }
     Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle(Main.mouseX, Main.mouseY, 1, 1);
     Main.sunModY = (short)((double)Main.sunModY * 0.999);
     Main.moonModY = (short)((double)Main.moonModY * 0.999);
     if (Main.gameMenu && Main.netMode != 1)
     {
         if (Main.mouseLeft && Main.hasFocus)
         {
             if (rectangle.Intersects(value) || Main.grabSky)
             {
                 if (Main.dayTime)
                 {
                     Main.time = 54000.0 * (double)((float)(Main.mouseX + Main.sunTexture.Width) / ((float)Main.screenWidth + (float)(Main.sunTexture.Width * 2)));
                     Main.sunModY = (short)(Main.mouseY - num2);
                     if (Main.time > 53990.0)
                     {
                         Main.time = 53990.0;
                     }
                 }
                 else
                 {
                     Main.time = 32400.0 * (double)((float)(Main.mouseX + Main.moonTexture.Width) / ((float)Main.screenWidth + (float)(Main.moonTexture.Width * 2)));
                     Main.moonModY = (short)(Main.mouseY - num5);
                     if (Main.time > 32390.0)
                     {
                         Main.time = 32390.0;
                     }
                 }
                 if (Main.time < 10.0)
                 {
                     Main.time = 10.0;
                 }
                 if (Main.netMode != 0)
                 {
                     NetMessage.SendData(18, -1, -1, "", 0, 0f, 0f, 0f, 0);
                 }
                 Main.grabSky = true;
             }
         }
         else
         {
             Main.grabSky = false;
         }
     }
     float num26 = (float)(Main.screenHeight - 600);
     this.bgTop = (int)((double)(-(double)Main.screenPosition.Y + num26 / 2f) / (Main.worldSurface * 16.0) * 1200.0 + 1190.0);
     float num27 = (float)(this.bgTop - 50);
     if (Main.resetClouds)
     {
         Cloud.resetClouds();
         Main.resetClouds = false;
     }
     if (base.IsActive || Main.netMode != 0)
     {
         Main.windSpeedSpeed += (float)Main.rand.Next(-10, 11) * 0.0001f;
         if (!Main.dayTime)
         {
             Main.windSpeedSpeed += (float)Main.rand.Next(-10, 11) * 0.0002f;
         }
         if ((double)Main.windSpeedSpeed < -0.002)
         {
             Main.windSpeedSpeed = -0.002f;
         }
         if ((double)Main.windSpeedSpeed > 0.002)
         {
             Main.windSpeedSpeed = 0.002f;
         }
         Main.windSpeed += Main.windSpeedSpeed;
         if ((double)Main.windSpeed < -0.3)
         {
             Main.windSpeed = -0.3f;
         }
         if ((double)Main.windSpeed > 0.3)
         {
             Main.windSpeed = 0.3f;
         }
         Main.numClouds += Main.rand.Next(-1, 2);
         if (Main.numClouds < 0)
         {
             Main.numClouds = 0;
         }
         if (Main.numClouds > Main.cloudLimit)
         {
             Main.numClouds = Main.cloudLimit;
         }
     }
     if ((double)Main.screenPosition.Y < Main.worldSurface * 16.0 + 16.0)
     {
         for (int k = 0; k < 100; k++)
         {
             if (Main.cloud[k].active && Main.cloud[k].scale < 1f)
             {
                 Microsoft.Xna.Framework.Color color2 = Main.cloud[k].cloudColor(Main.bgColor);
                 if (num19 < 1f)
                 {
                     color2.R = (byte)((float)color2.R * num19);
                     color2.G = (byte)((float)color2.G * num19);
                     color2.B = (byte)((float)color2.B * num19);
                     color2.A = (byte)((float)color2.A * num19);
                 }
                 float num28 = Main.cloud[k].position.Y * ((float)Main.screenHeight / 600f);
                 float num29 = (float)((double)(Main.screenPosition.Y / 16f - 24f) / Main.worldSurface);
                 if (num29 < 0f)
                 {
                     num29 = 0f;
                 }
                 if (num29 > 1f)
                 {
                     num29 = 1f;
                 }
                 if (Main.gameMenu)
                 {
                     num29 = 1f;
                 }
                 this.spriteBatch.Draw(Main.cloudTexture[Main.cloud[k].type], new Microsoft.Xna.Framework.Vector2(Main.cloud[k].position.X + (float)Main.cloudTexture[Main.cloud[k].type].Width * 0.5f, num28 + (float)Main.cloudTexture[Main.cloud[k].type].Height * 0.5f + num27), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.cloudTexture[Main.cloud[k].type].Width, Main.cloudTexture[Main.cloud[k].type].Height)), color2, Main.cloud[k].rotation, new Microsoft.Xna.Framework.Vector2((float)Main.cloudTexture[Main.cloud[k].type].Width * 0.5f, (float)Main.cloudTexture[Main.cloud[k].type].Height * 0.5f), Main.cloud[k].scale, SpriteEffects.None, 0f);
             }
         }
     }
     num19 = 1f;
     float num30 = 1f;
     this.bgParrallax = 0.15;
     int num31 = (int)((float)Main.backgroundWidth[7] * num30);
     Microsoft.Xna.Framework.Color color3 = Main.bgColor;
     Microsoft.Xna.Framework.Color color4 = color3;
     if (num19 < 1f)
     {
         color3.R = (byte)((float)color3.R * num19);
         color3.G = (byte)((float)color3.G * num19);
         color3.B = (byte)((float)color3.B * num19);
         color3.A = (byte)((float)color3.A * num19);
     }
     this.bgStart = (int)(-Math.IEEERemainder((double)Main.screenPosition.X * this.bgParrallax, (double)num31) - (double)(num31 / 2));
     this.bgLoops = Main.screenWidth / num31 + 2;
     this.bgTop = (int)((double)(-(double)Main.screenPosition.Y + num26 / 2f) / (Main.worldSurface * 16.0) * 1300.0 + 1090.0);
     if (Main.gameMenu)
     {
         this.bgTop = 100;
     }
     if ((double)Main.screenPosition.Y < Main.worldSurface * 16.0 + 16.0)
     {
         color3 = color4;
         color3.R = (byte)((float)color3.R * Main.bgAlpha2[0]);
         color3.G = (byte)((float)color3.G * Main.bgAlpha2[0]);
         color3.B = (byte)((float)color3.B * Main.bgAlpha2[0]);
         color3.A = (byte)((float)color3.A * Main.bgAlpha2[0]);
         if (Main.bgAlpha2[0] > 0f)
         {
             for (int l = 0; l < this.bgLoops; l++)
             {
                 SpriteBatch arg_2884_0 = this.spriteBatch;
                 Texture2D arg_2884_1 = Main.backgroundTexture[7];
                 Microsoft.Xna.Framework.Vector2 arg_2884_2 = new Microsoft.Xna.Framework.Vector2((float)(this.bgStart + num31 * l), (float)this.bgTop);
                 Microsoft.Xna.Framework.Rectangle? arg_2884_3 = new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.backgroundWidth[7], Main.backgroundHeight[7]));
                 Microsoft.Xna.Framework.Color arg_2884_4 = color3;
                 float arg_2884_5 = 0f;
                 Microsoft.Xna.Framework.Vector2 origin = default(Microsoft.Xna.Framework.Vector2);
                 arg_2884_0.Draw(arg_2884_1, arg_2884_2, arg_2884_3, arg_2884_4, arg_2884_5, origin, num30, SpriteEffects.None, 0f);
             }
         }
         color3 = color4;
         color3.R = (byte)((float)color3.R * Main.bgAlpha2[1]);
         color3.G = (byte)((float)color3.G * Main.bgAlpha2[1]);
         color3.B = (byte)((float)color3.B * Main.bgAlpha2[1]);
         color3.A = (byte)((float)color3.A * Main.bgAlpha2[1]);
         if (Main.bgAlpha2[1] > 0f)
         {
             for (int m = 0; m < this.bgLoops; m++)
             {
                 SpriteBatch arg_296A_0 = this.spriteBatch;
                 Texture2D arg_296A_1 = Main.backgroundTexture[23];
                 Microsoft.Xna.Framework.Vector2 arg_296A_2 = new Microsoft.Xna.Framework.Vector2((float)(this.bgStart + num31 * m), (float)this.bgTop);
                 Microsoft.Xna.Framework.Rectangle? arg_296A_3 = new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.backgroundWidth[7], Main.backgroundHeight[7]));
                 Microsoft.Xna.Framework.Color arg_296A_4 = color3;
                 float arg_296A_5 = 0f;
                 Microsoft.Xna.Framework.Vector2 origin = default(Microsoft.Xna.Framework.Vector2);
                 arg_296A_0.Draw(arg_296A_1, arg_296A_2, arg_296A_3, arg_296A_4, arg_296A_5, origin, num30, SpriteEffects.None, 0f);
             }
         }
         color3 = color4;
         color3.R = (byte)((float)color3.R * Main.bgAlpha2[2]);
         color3.G = (byte)((float)color3.G * Main.bgAlpha2[2]);
         color3.B = (byte)((float)color3.B * Main.bgAlpha2[2]);
         color3.A = (byte)((float)color3.A * Main.bgAlpha2[2]);
         if (Main.bgAlpha2[2] > 0f)
         {
             for (int n = 0; n < this.bgLoops; n++)
             {
                 SpriteBatch arg_2A50_0 = this.spriteBatch;
                 Texture2D arg_2A50_1 = Main.backgroundTexture[24];
                 Microsoft.Xna.Framework.Vector2 arg_2A50_2 = new Microsoft.Xna.Framework.Vector2((float)(this.bgStart + num31 * n), (float)this.bgTop);
                 Microsoft.Xna.Framework.Rectangle? arg_2A50_3 = new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.backgroundWidth[7], Main.backgroundHeight[7]));
                 Microsoft.Xna.Framework.Color arg_2A50_4 = color3;
                 float arg_2A50_5 = 0f;
                 Microsoft.Xna.Framework.Vector2 origin = default(Microsoft.Xna.Framework.Vector2);
                 arg_2A50_0.Draw(arg_2A50_1, arg_2A50_2, arg_2A50_3, arg_2A50_4, arg_2A50_5, origin, num30, SpriteEffects.None, 0f);
             }
         }
     }
     num27 = (float)(this.bgTop - 50);
     if ((double)Main.screenPosition.Y < Main.worldSurface * 16.0 + 16.0)
     {
         for (int num32 = 0; num32 < 100; num32++)
         {
             if (Main.cloud[num32].active && (double)Main.cloud[num32].scale < 1.15 && Main.cloud[num32].scale >= 1f)
             {
                 Microsoft.Xna.Framework.Color color5 = Main.cloud[num32].cloudColor(Main.bgColor);
                 if (num19 < 1f)
                 {
                     color5.R = (byte)((float)color5.R * num19);
                     color5.G = (byte)((float)color5.G * num19);
                     color5.B = (byte)((float)color5.B * num19);
                     color5.A = (byte)((float)color5.A * num19);
                 }
                 float num33 = Main.cloud[num32].position.Y * ((float)Main.screenHeight / 600f);
                 float num34 = (float)((double)(Main.screenPosition.Y / 16f - 24f) / Main.worldSurface);
                 if (num34 < 0f)
                 {
                     num34 = 0f;
                 }
                 if (num34 > 1f)
                 {
                     num34 = 1f;
                 }
                 if (Main.gameMenu)
                 {
                     num34 = 1f;
                 }
                 this.spriteBatch.Draw(Main.cloudTexture[Main.cloud[num32].type], new Microsoft.Xna.Framework.Vector2(Main.cloud[num32].position.X + (float)Main.cloudTexture[Main.cloud[num32].type].Width * 0.5f, num33 + (float)Main.cloudTexture[Main.cloud[num32].type].Height * 0.5f + num27), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.cloudTexture[Main.cloud[num32].type].Width, Main.cloudTexture[Main.cloud[num32].type].Height)), color5, Main.cloud[num32].rotation, new Microsoft.Xna.Framework.Vector2((float)Main.cloudTexture[Main.cloud[num32].type].Width * 0.5f, (float)Main.cloudTexture[Main.cloud[num32].type].Height * 0.5f), Main.cloud[num32].scale, SpriteEffects.None, 0f);
             }
         }
     }
     if (Main.holyTiles > 0)
     {
         this.bgParrallax = 0.17;
         num30 = 1.1f;
         num31 = (int)((double)(3500f * num30) * 1.05);
         this.bgStart = (int)(-Math.IEEERemainder((double)Main.screenPosition.X * this.bgParrallax, (double)num31) - (double)(num31 / 2));
         this.bgLoops = Main.screenWidth / num31 + 2;
         this.bgTop = (int)((double)(-(double)Main.screenPosition.Y + num26 / 2f) / (Main.worldSurface * 16.0) * 1400.0 + 900.0);
         if (Main.gameMenu)
         {
             this.bgTop = 230;
             this.bgStart -= 500;
         }
         Microsoft.Xna.Framework.Color color6 = color4;
         float num35 = (float)Main.holyTiles / 400f;
         if (num35 > 0.5f)
         {
             num35 = 0.5f;
         }
         color6.R = (byte)((float)color6.R * num35);
         color6.G = (byte)((float)color6.G * num35);
         color6.B = (byte)((float)color6.B * num35);
         color6.A = (byte)((float)color6.A * num35 * 0.8f);
         if ((double)Main.screenPosition.Y < Main.worldSurface * 16.0 + 16.0)
         {
             for (int num36 = 0; num36 < this.bgLoops; num36++)
             {
                 SpriteBatch arg_2EBD_0 = this.spriteBatch;
                 Texture2D arg_2EBD_1 = Main.backgroundTexture[18];
                 Microsoft.Xna.Framework.Vector2 arg_2EBD_2 = new Microsoft.Xna.Framework.Vector2((float)(this.bgStart + num31 * num36), (float)this.bgTop);
                 Microsoft.Xna.Framework.Rectangle? arg_2EBD_3 = new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.backgroundWidth[18], Main.backgroundHeight[18]));
                 Microsoft.Xna.Framework.Color arg_2EBD_4 = color6;
                 float arg_2EBD_5 = 0f;
                 Microsoft.Xna.Framework.Vector2 origin = default(Microsoft.Xna.Framework.Vector2);
                 arg_2EBD_0.Draw(arg_2EBD_1, arg_2EBD_2, arg_2EBD_3, arg_2EBD_4, arg_2EBD_5, origin, num30, SpriteEffects.None, 0f);
                 SpriteBatch arg_2F2D_0 = this.spriteBatch;
                 Texture2D arg_2F2D_1 = Main.backgroundTexture[19];
                 Microsoft.Xna.Framework.Vector2 arg_2F2D_2 = new Microsoft.Xna.Framework.Vector2((float)(this.bgStart + num31 * num36 + 1700), (float)(this.bgTop + 100));
                 Microsoft.Xna.Framework.Rectangle? arg_2F2D_3 = new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.backgroundWidth[19], Main.backgroundHeight[19]));
                 Microsoft.Xna.Framework.Color arg_2F2D_4 = color6;
                 float arg_2F2D_5 = 0f;
                 origin = default(Microsoft.Xna.Framework.Vector2);
                 arg_2F2D_0.Draw(arg_2F2D_1, arg_2F2D_2, arg_2F2D_3, arg_2F2D_4, arg_2F2D_5, origin, num30 * 0.9f, SpriteEffects.None, 0f);
             }
         }
     }
     this.bgParrallax = 0.2;
     num30 = 1.15f;
     num31 = (int)((float)Main.backgroundWidth[7] * num30);
     this.bgStart = (int)(-Math.IEEERemainder((double)Main.screenPosition.X * this.bgParrallax, (double)num31) - (double)(num31 / 2));
     this.bgLoops = Main.screenWidth / num31 + 2;
     this.bgTop = (int)((double)(-(double)Main.screenPosition.Y + num26 / 2f) / (Main.worldSurface * 16.0) * 1400.0 + 1260.0);
     if (Main.gameMenu)
     {
         this.bgTop = 230;
         this.bgStart -= 500;
     }
     if ((double)Main.screenPosition.Y < Main.worldSurface * 16.0 + 16.0)
     {
         color3 = color4;
         color3.R = (byte)((float)color3.R * Main.bgAlpha2[0]);
         color3.G = (byte)((float)color3.G * Main.bgAlpha2[0]);
         color3.B = (byte)((float)color3.B * Main.bgAlpha2[0]);
         color3.A = (byte)((float)color3.A * Main.bgAlpha2[0]);
         if (Main.bgAlpha2[0] > 0f)
         {
             for (int num37 = 0; num37 < this.bgLoops; num37++)
             {
                 SpriteBatch arg_30FE_0 = this.spriteBatch;
                 Texture2D arg_30FE_1 = Main.backgroundTexture[8];
                 Microsoft.Xna.Framework.Vector2 arg_30FE_2 = new Microsoft.Xna.Framework.Vector2((float)(this.bgStart + num31 * num37), (float)this.bgTop);
                 Microsoft.Xna.Framework.Rectangle? arg_30FE_3 = new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.backgroundWidth[7], Main.backgroundHeight[7]));
                 Microsoft.Xna.Framework.Color arg_30FE_4 = color3;
                 float arg_30FE_5 = 0f;
                 Microsoft.Xna.Framework.Vector2 origin = default(Microsoft.Xna.Framework.Vector2);
                 arg_30FE_0.Draw(arg_30FE_1, arg_30FE_2, arg_30FE_3, arg_30FE_4, arg_30FE_5, origin, num30, SpriteEffects.None, 0f);
             }
         }
         color3 = color4;
         color3.R = (byte)((float)color3.R * Main.bgAlpha2[1]);
         color3.G = (byte)((float)color3.G * Main.bgAlpha2[1]);
         color3.B = (byte)((float)color3.B * Main.bgAlpha2[1]);
         color3.A = (byte)((float)color3.A * Main.bgAlpha2[1]);
         if (Main.bgAlpha2[1] > 0f)
         {
             for (int num38 = 0; num38 < this.bgLoops; num38++)
             {
                 SpriteBatch arg_31E4_0 = this.spriteBatch;
                 Texture2D arg_31E4_1 = Main.backgroundTexture[22];
                 Microsoft.Xna.Framework.Vector2 arg_31E4_2 = new Microsoft.Xna.Framework.Vector2((float)(this.bgStart + num31 * num38), (float)this.bgTop);
                 Microsoft.Xna.Framework.Rectangle? arg_31E4_3 = new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.backgroundWidth[7], Main.backgroundHeight[7]));
                 Microsoft.Xna.Framework.Color arg_31E4_4 = color3;
                 float arg_31E4_5 = 0f;
                 Microsoft.Xna.Framework.Vector2 origin = default(Microsoft.Xna.Framework.Vector2);
                 arg_31E4_0.Draw(arg_31E4_1, arg_31E4_2, arg_31E4_3, arg_31E4_4, arg_31E4_5, origin, num30, SpriteEffects.None, 0f);
             }
         }
         color3 = color4;
         color3.R = (byte)((float)color3.R * Main.bgAlpha2[2]);
         color3.G = (byte)((float)color3.G * Main.bgAlpha2[2]);
         color3.B = (byte)((float)color3.B * Main.bgAlpha2[2]);
         color3.A = (byte)((float)color3.A * Main.bgAlpha2[2]);
         if (Main.bgAlpha2[2] > 0f)
         {
             for (int num39 = 0; num39 < this.bgLoops; num39++)
             {
                 SpriteBatch arg_32CA_0 = this.spriteBatch;
                 Texture2D arg_32CA_1 = Main.backgroundTexture[25];
                 Microsoft.Xna.Framework.Vector2 arg_32CA_2 = new Microsoft.Xna.Framework.Vector2((float)(this.bgStart + num31 * num39), (float)this.bgTop);
                 Microsoft.Xna.Framework.Rectangle? arg_32CA_3 = new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.backgroundWidth[7], Main.backgroundHeight[7]));
                 Microsoft.Xna.Framework.Color arg_32CA_4 = color3;
                 float arg_32CA_5 = 0f;
                 Microsoft.Xna.Framework.Vector2 origin = default(Microsoft.Xna.Framework.Vector2);
                 arg_32CA_0.Draw(arg_32CA_1, arg_32CA_2, arg_32CA_3, arg_32CA_4, arg_32CA_5, origin, num30, SpriteEffects.None, 0f);
             }
         }
         color3 = color4;
         color3.R = (byte)((float)color3.R * Main.bgAlpha2[3]);
         color3.G = (byte)((float)color3.G * Main.bgAlpha2[3]);
         color3.B = (byte)((float)color3.B * Main.bgAlpha2[3]);
         color3.A = (byte)((float)color3.A * Main.bgAlpha2[3]);
         if (Main.bgAlpha2[3] > 0f)
         {
             for (int num40 = 0; num40 < this.bgLoops; num40++)
             {
                 SpriteBatch arg_33B0_0 = this.spriteBatch;
                 Texture2D arg_33B0_1 = Main.backgroundTexture[28];
                 Microsoft.Xna.Framework.Vector2 arg_33B0_2 = new Microsoft.Xna.Framework.Vector2((float)(this.bgStart + num31 * num40), (float)this.bgTop);
                 Microsoft.Xna.Framework.Rectangle? arg_33B0_3 = new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.backgroundWidth[7], Main.backgroundHeight[7]));
                 Microsoft.Xna.Framework.Color arg_33B0_4 = color3;
                 float arg_33B0_5 = 0f;
                 Microsoft.Xna.Framework.Vector2 origin = default(Microsoft.Xna.Framework.Vector2);
                 arg_33B0_0.Draw(arg_33B0_1, arg_33B0_2, arg_33B0_3, arg_33B0_4, arg_33B0_5, origin, num30, SpriteEffects.None, 0f);
             }
         }
     }
     num27 = (float)this.bgTop * 1.01f - 150f;
     if ((double)Main.screenPosition.Y < Main.worldSurface * 16.0 + 16.0)
     {
         for (int num41 = 0; num41 < 100; num41++)
         {
             if (Main.cloud[num41].active && Main.cloud[num41].scale > num30)
             {
                 Microsoft.Xna.Framework.Color color7 = Main.cloud[num41].cloudColor(Main.bgColor);
                 if (num19 < 1f)
                 {
                     color7.R = (byte)((float)color7.R * num19);
                     color7.G = (byte)((float)color7.G * num19);
                     color7.B = (byte)((float)color7.B * num19);
                     color7.A = (byte)((float)color7.A * num19);
                 }
                 float num42 = Main.cloud[num41].position.Y * ((float)Main.screenHeight / 600f);
                 float num43 = (float)((double)(Main.screenPosition.Y / 16f - 24f) / Main.worldSurface);
                 if (num43 < 0f)
                 {
                     num43 = 0f;
                 }
                 if (num43 > 1f)
                 {
                     num43 = 1f;
                 }
                 if (Main.gameMenu)
                 {
                     num43 = 1f;
                 }
                 this.spriteBatch.Draw(Main.cloudTexture[Main.cloud[num41].type], new Microsoft.Xna.Framework.Vector2(Main.cloud[num41].position.X + (float)Main.cloudTexture[Main.cloud[num41].type].Width * 0.5f, num42 + (float)Main.cloudTexture[Main.cloud[num41].type].Height * 0.5f + num27), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.cloudTexture[Main.cloud[num41].type].Width, Main.cloudTexture[Main.cloud[num41].type].Height)), color7, Main.cloud[num41].rotation, new Microsoft.Xna.Framework.Vector2((float)Main.cloudTexture[Main.cloud[num41].type].Width * 0.5f, (float)Main.cloudTexture[Main.cloud[num41].type].Height * 0.5f), Main.cloud[num41].scale, SpriteEffects.None, 0f);
             }
         }
     }
     int num44 = Main.bgStyle;
     int num45 = (int)((Main.screenPosition.X + (float)(Main.screenWidth / 2)) / 16f);
     if (num45 < 380 || num45 > Main.maxTilesX - 380)
     {
         num44 = 4;
     }
     else
     {
         if (Main.sandTiles > 1000)
         {
             if (Main.player[Main.myPlayer].zoneEvil)
             {
                 num44 = 5;
             }
             else
             {
                 if (Main.player[Main.myPlayer].zoneHoly)
                 {
                     num44 = 5;
                 }
                 else
                 {
                     num44 = 2;
                 }
             }
         }
         else
         {
             if (Main.player[Main.myPlayer].zoneHoly)
             {
                 num44 = 6;
             }
             else
             {
                 if (Main.player[Main.myPlayer].zoneEvil)
                 {
                     num44 = 1;
                 }
                 else
                 {
                     if (Main.player[Main.myPlayer].zoneJungle)
                     {
                         num44 = 3;
                     }
                     else
                     {
                         num44 = 0;
                     }
                 }
             }
         }
     }
     float num46 = 0.05f;
     int num47 = 30;
     if (num44 == 0)
     {
         num47 = 120;
     }
     if (Main.bgDelay < 0)
     {
         Main.bgDelay++;
     }
     else
     {
         if (num44 != Main.bgStyle)
         {
             Main.bgDelay++;
             if (Main.bgDelay > num47)
             {
                 Main.bgDelay = -60;
                 Main.bgStyle = num44;
                 if (num44 == 0)
                 {
                     Main.bgDelay = 0;
                 }
             }
         }
         else
         {
             if (Main.bgDelay > 0)
             {
                 Main.bgDelay--;
             }
         }
     }
     if (Main.gameMenu)
     {
         num46 = 0.02f;
         if (!Main.dayTime)
         {
             Main.bgStyle = 1;
         }
         else
         {
             Main.bgStyle = 0;
         }
         num44 = Main.bgStyle;
     }
     if (Main.quickBG > 0)
     {
         Main.quickBG--;
         Main.bgStyle = num44;
         num46 = 1f;
     }
     if (Main.bgStyle == 2)
     {
         Main.bgAlpha2[0] -= num46;
         if (Main.bgAlpha2[0] < 0f)
         {
             Main.bgAlpha2[0] = 0f;
         }
         Main.bgAlpha2[1] += num46;
         if (Main.bgAlpha2[1] > 1f)
         {
             Main.bgAlpha2[1] = 1f;
         }
         Main.bgAlpha2[2] -= num46;
         if (Main.bgAlpha2[2] < 0f)
         {
             Main.bgAlpha2[2] = 0f;
         }
         Main.bgAlpha2[3] -= num46;
         if (Main.bgAlpha2[3] < 0f)
         {
             Main.bgAlpha2[3] = 0f;
         }
     }
     else
     {
         if (Main.bgStyle == 5 || Main.bgStyle == 1 || Main.bgStyle == 6)
         {
             Main.bgAlpha2[0] -= num46;
             if (Main.bgAlpha2[0] < 0f)
             {
                 Main.bgAlpha2[0] = 0f;
             }
             Main.bgAlpha2[1] -= num46;
             if (Main.bgAlpha2[1] < 0f)
             {
                 Main.bgAlpha2[1] = 0f;
             }
             Main.bgAlpha2[2] += num46;
             if (Main.bgAlpha2[2] > 1f)
             {
                 Main.bgAlpha2[2] = 1f;
             }
             Main.bgAlpha2[3] -= num46;
             if (Main.bgAlpha2[3] < 0f)
             {
                 Main.bgAlpha2[3] = 0f;
             }
         }
         else
         {
             if (Main.bgStyle == 4)
             {
                 Main.bgAlpha2[0] -= num46;
                 if (Main.bgAlpha2[0] < 0f)
                 {
                     Main.bgAlpha2[0] = 0f;
                 }
                 Main.bgAlpha2[1] -= num46;
                 if (Main.bgAlpha2[1] < 0f)
                 {
                     Main.bgAlpha2[1] = 0f;
                 }
                 Main.bgAlpha2[2] -= num46;
                 if (Main.bgAlpha2[2] < 0f)
                 {
                     Main.bgAlpha2[2] = 0f;
                 }
                 Main.bgAlpha2[3] += num46;
                 if (Main.bgAlpha2[3] > 1f)
                 {
                     Main.bgAlpha2[3] = 1f;
                 }
             }
             else
             {
                 Main.bgAlpha2[0] += num46;
                 if (Main.bgAlpha2[0] > 1f)
                 {
                     Main.bgAlpha2[0] = 1f;
                 }
                 Main.bgAlpha2[1] -= num46;
                 if (Main.bgAlpha2[1] < 0f)
                 {
                     Main.bgAlpha2[1] = 0f;
                 }
                 Main.bgAlpha2[2] -= num46;
                 if (Main.bgAlpha2[2] < 0f)
                 {
                     Main.bgAlpha2[2] = 0f;
                 }
                 Main.bgAlpha2[3] -= num46;
                 if (Main.bgAlpha2[3] < 0f)
                 {
                     Main.bgAlpha2[3] = 0f;
                 }
             }
         }
     }
     for (int num48 = 0; num48 < 7; num48++)
     {
         if (Main.bgStyle == num48)
         {
             Main.bgAlpha[num48] += num46;
             if (Main.bgAlpha[num48] > 1f)
             {
                 Main.bgAlpha[num48] = 1f;
             }
         }
         else
         {
             Main.bgAlpha[num48] -= num46;
             if (Main.bgAlpha[num48] < 0f)
             {
                 Main.bgAlpha[num48] = 0f;
             }
         }
         color3 = color4;
         color3.R = (byte)((float)color3.R * Main.bgAlpha[num48]);
         color3.G = (byte)((float)color3.G * Main.bgAlpha[num48]);
         color3.B = (byte)((float)color3.B * Main.bgAlpha[num48]);
         color3.A = (byte)((float)color3.A * Main.bgAlpha[num48]);
         if (Main.bgAlpha[num48] > 0f && num48 == 3)
         {
             num30 = 1.25f;
             num31 = (int)((float)Main.backgroundWidth[8] * num30);
             this.bgParrallax = 0.4;
             this.bgStart = (int)(-Math.IEEERemainder((double)Main.screenPosition.X * this.bgParrallax, (double)num31) - (double)(num31 / 2));
             this.bgTop = (int)((double)(-(double)Main.screenPosition.Y + num26 / 2f) / (Main.worldSurface * 16.0) * 1800.0 + 1660.0);
             if (Main.gameMenu)
             {
                 this.bgTop = 320;
             }
             this.bgLoops = Main.screenWidth / num31 + 2;
             if ((double)Main.screenPosition.Y < Main.worldSurface * 16.0 + 16.0)
             {
                 for (int num49 = 0; num49 < this.bgLoops; num49++)
                 {
                     SpriteBatch arg_3D6B_0 = this.spriteBatch;
                     Texture2D arg_3D6B_1 = Main.backgroundTexture[15];
                     Microsoft.Xna.Framework.Vector2 arg_3D6B_2 = new Microsoft.Xna.Framework.Vector2((float)(this.bgStart + num31 * num49), (float)this.bgTop);
                     Microsoft.Xna.Framework.Rectangle? arg_3D6B_3 = new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.backgroundWidth[8], Main.backgroundHeight[8]));
                     Microsoft.Xna.Framework.Color arg_3D6B_4 = color3;
                     float arg_3D6B_5 = 0f;
                     Microsoft.Xna.Framework.Vector2 origin = default(Microsoft.Xna.Framework.Vector2);
                     arg_3D6B_0.Draw(arg_3D6B_1, arg_3D6B_2, arg_3D6B_3, arg_3D6B_4, arg_3D6B_5, origin, num30, SpriteEffects.None, 0f);
                 }
             }
             num30 = 1.31f;
             num31 = (int)((float)Main.backgroundWidth[8] * num30);
             this.bgParrallax = 0.43;
             this.bgStart = (int)(-Math.IEEERemainder((double)Main.screenPosition.X * this.bgParrallax, (double)num31) - (double)(num31 / 2));
             this.bgTop = (int)((double)(-(double)Main.screenPosition.Y + num26 / 2f) / (Main.worldSurface * 16.0) * 1950.0 + 1840.0);
             if (Main.gameMenu)
             {
                 this.bgTop = 400;
                 this.bgStart -= 80;
             }
             this.bgLoops = Main.screenWidth / num31 + 2;
             if ((double)Main.screenPosition.Y < Main.worldSurface * 16.0 + 16.0)
             {
                 for (int num50 = 0; num50 < this.bgLoops; num50++)
                 {
                     SpriteBatch arg_3EC2_0 = this.spriteBatch;
                     Texture2D arg_3EC2_1 = Main.backgroundTexture[16];
                     Microsoft.Xna.Framework.Vector2 arg_3EC2_2 = new Microsoft.Xna.Framework.Vector2((float)(this.bgStart + num31 * num50), (float)this.bgTop);
                     Microsoft.Xna.Framework.Rectangle? arg_3EC2_3 = new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.backgroundWidth[8], Main.backgroundHeight[8]));
                     Microsoft.Xna.Framework.Color arg_3EC2_4 = color3;
                     float arg_3EC2_5 = 0f;
                     Microsoft.Xna.Framework.Vector2 origin = default(Microsoft.Xna.Framework.Vector2);
                     arg_3EC2_0.Draw(arg_3EC2_1, arg_3EC2_2, arg_3EC2_3, arg_3EC2_4, arg_3EC2_5, origin, num30, SpriteEffects.None, 0f);
                 }
             }
             num30 = 1.34f;
             num31 = (int)((float)Main.backgroundWidth[8] * num30);
             this.bgParrallax = 0.49;
             this.bgStart = (int)(-Math.IEEERemainder((double)Main.screenPosition.X * this.bgParrallax, (double)num31) - (double)(num31 / 2));
             this.bgTop = (int)((double)(-(double)Main.screenPosition.Y + num26 / 2f) / (Main.worldSurface * 16.0) * 2100.0 + 2060.0);
             if (Main.gameMenu)
             {
                 this.bgTop = 480;
                 this.bgStart -= 120;
             }
             this.bgLoops = Main.screenWidth / num31 + 2;
             if ((double)Main.screenPosition.Y < Main.worldSurface * 16.0 + 16.0)
             {
                 for (int num51 = 0; num51 < this.bgLoops; num51++)
                 {
                     SpriteBatch arg_4019_0 = this.spriteBatch;
                     Texture2D arg_4019_1 = Main.backgroundTexture[17];
                     Microsoft.Xna.Framework.Vector2 arg_4019_2 = new Microsoft.Xna.Framework.Vector2((float)(this.bgStart + num31 * num51), (float)this.bgTop);
                     Microsoft.Xna.Framework.Rectangle? arg_4019_3 = new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.backgroundWidth[8], Main.backgroundHeight[8]));
                     Microsoft.Xna.Framework.Color arg_4019_4 = color3;
                     float arg_4019_5 = 0f;
                     Microsoft.Xna.Framework.Vector2 origin = default(Microsoft.Xna.Framework.Vector2);
                     arg_4019_0.Draw(arg_4019_1, arg_4019_2, arg_4019_3, arg_4019_4, arg_4019_5, origin, num30, SpriteEffects.None, 0f);
                 }
             }
         }
         if (Main.bgAlpha[num48] > 0f && num48 == 2)
         {
             num30 = 1.25f;
             num31 = (int)((float)Main.backgroundWidth[8] * num30);
             this.bgParrallax = 0.37;
             this.bgStart = (int)(-Math.IEEERemainder((double)Main.screenPosition.X * this.bgParrallax, (double)num31) - (double)(num31 / 2));
             this.bgTop = (int)((double)(-(double)Main.screenPosition.Y + num26 / 2f) / (Main.worldSurface * 16.0) * 1800.0 + 1750.0);
             if (Main.gameMenu)
             {
                 this.bgTop = 320;
             }
             this.bgLoops = Main.screenWidth / num31 + 2;
             if ((double)Main.screenPosition.Y < Main.worldSurface * 16.0 + 16.0)
             {
                 for (int num52 = 0; num52 < this.bgLoops; num52++)
                 {
                     SpriteBatch arg_417C_0 = this.spriteBatch;
                     Texture2D arg_417C_1 = Main.backgroundTexture[21];
                     Microsoft.Xna.Framework.Vector2 arg_417C_2 = new Microsoft.Xna.Framework.Vector2((float)(this.bgStart + num31 * num52), (float)this.bgTop);
                     Microsoft.Xna.Framework.Rectangle? arg_417C_3 = new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.backgroundWidth[8], Main.backgroundHeight[20]));
                     Microsoft.Xna.Framework.Color arg_417C_4 = color3;
                     float arg_417C_5 = 0f;
                     Microsoft.Xna.Framework.Vector2 origin = default(Microsoft.Xna.Framework.Vector2);
                     arg_417C_0.Draw(arg_417C_1, arg_417C_2, arg_417C_3, arg_417C_4, arg_417C_5, origin, num30, SpriteEffects.None, 0f);
                 }
             }
             num30 = 1.34f;
             num31 = (int)((float)Main.backgroundWidth[8] * num30);
             this.bgParrallax = 0.49;
             this.bgStart = (int)(-Math.IEEERemainder((double)Main.screenPosition.X * this.bgParrallax, (double)num31) - (double)(num31 / 2));
             this.bgTop = (int)((double)(-(double)Main.screenPosition.Y + num26 / 2f) / (Main.worldSurface * 16.0) * 2100.0 + 2150.0);
             if (Main.gameMenu)
             {
                 this.bgTop = 480;
                 this.bgStart -= 120;
             }
             this.bgLoops = Main.screenWidth / num31 + 2;
             if ((double)Main.screenPosition.Y < Main.worldSurface * 16.0 + 16.0)
             {
                 for (int num53 = 0; num53 < this.bgLoops; num53++)
                 {
                     SpriteBatch arg_42D4_0 = this.spriteBatch;
                     Texture2D arg_42D4_1 = Main.backgroundTexture[20];
                     Microsoft.Xna.Framework.Vector2 arg_42D4_2 = new Microsoft.Xna.Framework.Vector2((float)(this.bgStart + num31 * num53), (float)this.bgTop);
                     Microsoft.Xna.Framework.Rectangle? arg_42D4_3 = new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.backgroundWidth[8], Main.backgroundHeight[20]));
                     Microsoft.Xna.Framework.Color arg_42D4_4 = color3;
                     float arg_42D4_5 = 0f;
                     Microsoft.Xna.Framework.Vector2 origin = default(Microsoft.Xna.Framework.Vector2);
                     arg_42D4_0.Draw(arg_42D4_1, arg_42D4_2, arg_42D4_3, arg_42D4_4, arg_42D4_5, origin, num30, SpriteEffects.None, 0f);
                 }
             }
         }
         if (Main.bgAlpha[num48] > 0f && num48 == 5)
         {
             num30 = 1.25f;
             num31 = (int)((float)Main.backgroundWidth[8] * num30);
             this.bgParrallax = 0.37;
             this.bgStart = (int)(-Math.IEEERemainder((double)Main.screenPosition.X * this.bgParrallax, (double)num31) - (double)(num31 / 2));
             this.bgTop = (int)((double)(-(double)Main.screenPosition.Y + num26 / 2f) / (Main.worldSurface * 16.0) * 1800.0 + 1750.0);
             if (Main.gameMenu)
             {
                 this.bgTop = 320;
             }
             this.bgLoops = Main.screenWidth / num31 + 2;
             if ((double)Main.screenPosition.Y < Main.worldSurface * 16.0 + 16.0)
             {
                 for (int num54 = 0; num54 < this.bgLoops; num54++)
                 {
                     SpriteBatch arg_4437_0 = this.spriteBatch;
                     Texture2D arg_4437_1 = Main.backgroundTexture[26];
                     Microsoft.Xna.Framework.Vector2 arg_4437_2 = new Microsoft.Xna.Framework.Vector2((float)(this.bgStart + num31 * num54), (float)this.bgTop);
                     Microsoft.Xna.Framework.Rectangle? arg_4437_3 = new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.backgroundWidth[8], Main.backgroundHeight[20]));
                     Microsoft.Xna.Framework.Color arg_4437_4 = color3;
                     float arg_4437_5 = 0f;
                     Microsoft.Xna.Framework.Vector2 origin = default(Microsoft.Xna.Framework.Vector2);
                     arg_4437_0.Draw(arg_4437_1, arg_4437_2, arg_4437_3, arg_4437_4, arg_4437_5, origin, num30, SpriteEffects.None, 0f);
                 }
             }
             num30 = 1.34f;
             num31 = (int)((float)Main.backgroundWidth[8] * num30);
             this.bgParrallax = 0.49;
             this.bgStart = (int)(-Math.IEEERemainder((double)Main.screenPosition.X * this.bgParrallax, (double)num31) - (double)(num31 / 2));
             this.bgTop = (int)((double)(-(double)Main.screenPosition.Y + num26 / 2f) / (Main.worldSurface * 16.0) * 2100.0 + 2150.0);
             if (Main.gameMenu)
             {
                 this.bgTop = 480;
                 this.bgStart -= 120;
             }
             this.bgLoops = Main.screenWidth / num31 + 2;
             if ((double)Main.screenPosition.Y < Main.worldSurface * 16.0 + 16.0)
             {
                 for (int num55 = 0; num55 < this.bgLoops; num55++)
                 {
                     SpriteBatch arg_458F_0 = this.spriteBatch;
                     Texture2D arg_458F_1 = Main.backgroundTexture[27];
                     Microsoft.Xna.Framework.Vector2 arg_458F_2 = new Microsoft.Xna.Framework.Vector2((float)(this.bgStart + num31 * num55), (float)this.bgTop);
                     Microsoft.Xna.Framework.Rectangle? arg_458F_3 = new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.backgroundWidth[8], Main.backgroundHeight[20]));
                     Microsoft.Xna.Framework.Color arg_458F_4 = color3;
                     float arg_458F_5 = 0f;
                     Microsoft.Xna.Framework.Vector2 origin = default(Microsoft.Xna.Framework.Vector2);
                     arg_458F_0.Draw(arg_458F_1, arg_458F_2, arg_458F_3, arg_458F_4, arg_458F_5, origin, num30, SpriteEffects.None, 0f);
                 }
             }
         }
         if (Main.bgAlpha[num48] > 0f && num48 == 1)
         {
             num30 = 1.25f;
             num31 = (int)((float)Main.backgroundWidth[8] * num30);
             this.bgParrallax = 0.4;
             this.bgStart = (int)(-Math.IEEERemainder((double)Main.screenPosition.X * this.bgParrallax, (double)num31) - (double)(num31 / 2));
             this.bgTop = (int)((double)(-(double)Main.screenPosition.Y + num26 / 2f) / (Main.worldSurface * 16.0) * 1800.0 + 1500.0);
             if (Main.gameMenu)
             {
                 this.bgTop = 320;
             }
             this.bgLoops = Main.screenWidth / num31 + 2;
             if ((double)Main.screenPosition.Y < Main.worldSurface * 16.0 + 16.0)
             {
                 for (int num56 = 0; num56 < this.bgLoops; num56++)
                 {
                     SpriteBatch arg_46F1_0 = this.spriteBatch;
                     Texture2D arg_46F1_1 = Main.backgroundTexture[12];
                     Microsoft.Xna.Framework.Vector2 arg_46F1_2 = new Microsoft.Xna.Framework.Vector2((float)(this.bgStart + num31 * num56), (float)this.bgTop);
                     Microsoft.Xna.Framework.Rectangle? arg_46F1_3 = new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.backgroundWidth[8], Main.backgroundHeight[8]));
                     Microsoft.Xna.Framework.Color arg_46F1_4 = color3;
                     float arg_46F1_5 = 0f;
                     Microsoft.Xna.Framework.Vector2 origin = default(Microsoft.Xna.Framework.Vector2);
                     arg_46F1_0.Draw(arg_46F1_1, arg_46F1_2, arg_46F1_3, arg_46F1_4, arg_46F1_5, origin, num30, SpriteEffects.None, 0f);
                 }
             }
             num30 = 1.31f;
             num31 = (int)((float)Main.backgroundWidth[8] * num30);
             this.bgParrallax = 0.43;
             this.bgStart = (int)(-Math.IEEERemainder((double)Main.screenPosition.X * this.bgParrallax, (double)num31) - (double)(num31 / 2));
             this.bgTop = (int)((double)(-(double)Main.screenPosition.Y + num26 / 2f) / (Main.worldSurface * 16.0) * 1950.0 + 1750.0);
             if (Main.gameMenu)
             {
                 this.bgTop = 400;
                 this.bgStart -= 80;
             }
             this.bgLoops = Main.screenWidth / num31 + 2;
             if ((double)Main.screenPosition.Y < Main.worldSurface * 16.0 + 16.0)
             {
                 for (int num57 = 0; num57 < this.bgLoops; num57++)
                 {
                     SpriteBatch arg_4848_0 = this.spriteBatch;
                     Texture2D arg_4848_1 = Main.backgroundTexture[13];
                     Microsoft.Xna.Framework.Vector2 arg_4848_2 = new Microsoft.Xna.Framework.Vector2((float)(this.bgStart + num31 * num57), (float)this.bgTop);
                     Microsoft.Xna.Framework.Rectangle? arg_4848_3 = new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.backgroundWidth[8], Main.backgroundHeight[8]));
                     Microsoft.Xna.Framework.Color arg_4848_4 = color3;
                     float arg_4848_5 = 0f;
                     Microsoft.Xna.Framework.Vector2 origin = default(Microsoft.Xna.Framework.Vector2);
                     arg_4848_0.Draw(arg_4848_1, arg_4848_2, arg_4848_3, arg_4848_4, arg_4848_5, origin, num30, SpriteEffects.None, 0f);
                 }
             }
             num30 = 1.34f;
             num31 = (int)((float)Main.backgroundWidth[8] * num30);
             this.bgParrallax = 0.49;
             this.bgStart = (int)(-Math.IEEERemainder((double)Main.screenPosition.X * this.bgParrallax, (double)num31) - (double)(num31 / 2));
             this.bgTop = (int)((double)(-(double)Main.screenPosition.Y + num26 / 2f) / (Main.worldSurface * 16.0) * 2100.0 + 2000.0);
             if (Main.gameMenu)
             {
                 this.bgTop = 480;
                 this.bgStart -= 120;
             }
             this.bgLoops = Main.screenWidth / num31 + 2;
             if ((double)Main.screenPosition.Y < Main.worldSurface * 16.0 + 16.0)
             {
                 for (int num58 = 0; num58 < this.bgLoops; num58++)
                 {
                     SpriteBatch arg_499F_0 = this.spriteBatch;
                     Texture2D arg_499F_1 = Main.backgroundTexture[14];
                     Microsoft.Xna.Framework.Vector2 arg_499F_2 = new Microsoft.Xna.Framework.Vector2((float)(this.bgStart + num31 * num58), (float)this.bgTop);
                     Microsoft.Xna.Framework.Rectangle? arg_499F_3 = new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.backgroundWidth[8], Main.backgroundHeight[8]));
                     Microsoft.Xna.Framework.Color arg_499F_4 = color3;
                     float arg_499F_5 = 0f;
                     Microsoft.Xna.Framework.Vector2 origin = default(Microsoft.Xna.Framework.Vector2);
                     arg_499F_0.Draw(arg_499F_1, arg_499F_2, arg_499F_3, arg_499F_4, arg_499F_5, origin, num30, SpriteEffects.None, 0f);
                 }
             }
         }
         if (Main.bgAlpha[num48] > 0f && num48 == 6)
         {
             num30 = 1.25f;
             num31 = (int)((float)Main.backgroundWidth[8] * num30);
             this.bgParrallax = 0.4;
             this.bgStart = (int)(-Math.IEEERemainder((double)Main.screenPosition.X * this.bgParrallax, (double)num31) - (double)(num31 / 2));
             this.bgTop = (int)((double)(-(double)Main.screenPosition.Y + num26 / 2f) / (Main.worldSurface * 16.0) * 1800.0 + 1500.0);
             if (Main.gameMenu)
             {
                 this.bgTop = 320;
             }
             this.bgLoops = Main.screenWidth / num31 + 2;
             if ((double)Main.screenPosition.Y < Main.worldSurface * 16.0 + 16.0)
             {
                 for (int num59 = 0; num59 < this.bgLoops; num59++)
                 {
                     SpriteBatch arg_4B01_0 = this.spriteBatch;
                     Texture2D arg_4B01_1 = Main.backgroundTexture[29];
                     Microsoft.Xna.Framework.Vector2 arg_4B01_2 = new Microsoft.Xna.Framework.Vector2((float)(this.bgStart + num31 * num59), (float)this.bgTop);
                     Microsoft.Xna.Framework.Rectangle? arg_4B01_3 = new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.backgroundWidth[8], Main.backgroundHeight[8]));
                     Microsoft.Xna.Framework.Color arg_4B01_4 = color3;
                     float arg_4B01_5 = 0f;
                     Microsoft.Xna.Framework.Vector2 origin = default(Microsoft.Xna.Framework.Vector2);
                     arg_4B01_0.Draw(arg_4B01_1, arg_4B01_2, arg_4B01_3, arg_4B01_4, arg_4B01_5, origin, num30, SpriteEffects.None, 0f);
                 }
             }
             num30 = 1.31f;
             num31 = (int)((float)Main.backgroundWidth[8] * num30);
             this.bgParrallax = 0.43;
             this.bgStart = (int)(-Math.IEEERemainder((double)Main.screenPosition.X * this.bgParrallax, (double)num31) - (double)(num31 / 2));
             this.bgTop = (int)((double)(-(double)Main.screenPosition.Y + num26 / 2f) / (Main.worldSurface * 16.0) * 1950.0 + 1750.0);
             if (Main.gameMenu)
             {
                 this.bgTop = 400;
                 this.bgStart -= 80;
             }
             this.bgLoops = Main.screenWidth / num31 + 2;
             if ((double)Main.screenPosition.Y < Main.worldSurface * 16.0 + 16.0)
             {
                 for (int num60 = 0; num60 < this.bgLoops; num60++)
                 {
                     SpriteBatch arg_4C58_0 = this.spriteBatch;
                     Texture2D arg_4C58_1 = Main.backgroundTexture[30];
                     Microsoft.Xna.Framework.Vector2 arg_4C58_2 = new Microsoft.Xna.Framework.Vector2((float)(this.bgStart + num31 * num60), (float)this.bgTop);
                     Microsoft.Xna.Framework.Rectangle? arg_4C58_3 = new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.backgroundWidth[8], Main.backgroundHeight[8]));
                     Microsoft.Xna.Framework.Color arg_4C58_4 = color3;
                     float arg_4C58_5 = 0f;
                     Microsoft.Xna.Framework.Vector2 origin = default(Microsoft.Xna.Framework.Vector2);
                     arg_4C58_0.Draw(arg_4C58_1, arg_4C58_2, arg_4C58_3, arg_4C58_4, arg_4C58_5, origin, num30, SpriteEffects.None, 0f);
                 }
             }
             num30 = 1.34f;
             num31 = (int)((float)Main.backgroundWidth[8] * num30);
             this.bgParrallax = 0.49;
             this.bgStart = (int)(-Math.IEEERemainder((double)Main.screenPosition.X * this.bgParrallax, (double)num31) - (double)(num31 / 2));
             this.bgTop = (int)((double)(-(double)Main.screenPosition.Y + num26 / 2f) / (Main.worldSurface * 16.0) * 2100.0 + 2000.0);
             if (Main.gameMenu)
             {
                 this.bgTop = 480;
                 this.bgStart -= 120;
             }
             this.bgLoops = Main.screenWidth / num31 + 2;
             if ((double)Main.screenPosition.Y < Main.worldSurface * 16.0 + 16.0)
             {
                 for (int num61 = 0; num61 < this.bgLoops; num61++)
                 {
                     SpriteBatch arg_4DAF_0 = this.spriteBatch;
                     Texture2D arg_4DAF_1 = Main.backgroundTexture[31];
                     Microsoft.Xna.Framework.Vector2 arg_4DAF_2 = new Microsoft.Xna.Framework.Vector2((float)(this.bgStart + num31 * num61), (float)this.bgTop);
                     Microsoft.Xna.Framework.Rectangle? arg_4DAF_3 = new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.backgroundWidth[8], Main.backgroundHeight[8]));
                     Microsoft.Xna.Framework.Color arg_4DAF_4 = color3;
                     float arg_4DAF_5 = 0f;
                     Microsoft.Xna.Framework.Vector2 origin = default(Microsoft.Xna.Framework.Vector2);
                     arg_4DAF_0.Draw(arg_4DAF_1, arg_4DAF_2, arg_4DAF_3, arg_4DAF_4, arg_4DAF_5, origin, num30, SpriteEffects.None, 0f);
                 }
             }
         }
         if (Main.bgAlpha[num48] > 0f && num48 == 0)
         {
             num30 = 1.25f;
             num31 = (int)((float)Main.backgroundWidth[8] * num30);
             this.bgParrallax = 0.4;
             this.bgStart = (int)(-Math.IEEERemainder((double)Main.screenPosition.X * this.bgParrallax, (double)num31) - (double)(num31 / 2));
             this.bgTop = (int)((double)(-(double)Main.screenPosition.Y + num26 / 2f) / (Main.worldSurface * 16.0) * 1800.0 + 1500.0);
             if (Main.gameMenu)
             {
                 this.bgTop = 320;
             }
             this.bgLoops = Main.screenWidth / num31 + 2;
             if ((double)Main.screenPosition.Y < Main.worldSurface * 16.0 + 16.0)
             {
                 for (int num62 = 0; num62 < this.bgLoops; num62++)
                 {
                     SpriteBatch arg_4F10_0 = this.spriteBatch;
                     Texture2D arg_4F10_1 = Main.backgroundTexture[9];
                     Microsoft.Xna.Framework.Vector2 arg_4F10_2 = new Microsoft.Xna.Framework.Vector2((float)(this.bgStart + num31 * num62), (float)this.bgTop);
                     Microsoft.Xna.Framework.Rectangle? arg_4F10_3 = new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.backgroundWidth[8], Main.backgroundHeight[8]));
                     Microsoft.Xna.Framework.Color arg_4F10_4 = color3;
                     float arg_4F10_5 = 0f;
                     Microsoft.Xna.Framework.Vector2 origin = default(Microsoft.Xna.Framework.Vector2);
                     arg_4F10_0.Draw(arg_4F10_1, arg_4F10_2, arg_4F10_3, arg_4F10_4, arg_4F10_5, origin, num30, SpriteEffects.None, 0f);
                 }
             }
             num30 = 1.31f;
             num31 = (int)((float)Main.backgroundWidth[8] * num30);
             this.bgParrallax = 0.43;
             this.bgStart = (int)(-Math.IEEERemainder((double)Main.screenPosition.X * this.bgParrallax, (double)num31) - (double)(num31 / 2));
             this.bgTop = (int)((double)(-(double)Main.screenPosition.Y + num26 / 2f) / (Main.worldSurface * 16.0) * 1950.0 + 1750.0);
             if (Main.gameMenu)
             {
                 this.bgTop = 400;
                 this.bgStart -= 80;
             }
             this.bgLoops = Main.screenWidth / num31 + 2;
             if ((double)Main.screenPosition.Y < Main.worldSurface * 16.0 + 16.0)
             {
                 for (int num63 = 0; num63 < this.bgLoops; num63++)
                 {
                     SpriteBatch arg_5067_0 = this.spriteBatch;
                     Texture2D arg_5067_1 = Main.backgroundTexture[10];
                     Microsoft.Xna.Framework.Vector2 arg_5067_2 = new Microsoft.Xna.Framework.Vector2((float)(this.bgStart + num31 * num63), (float)this.bgTop);
                     Microsoft.Xna.Framework.Rectangle? arg_5067_3 = new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.backgroundWidth[8], Main.backgroundHeight[8]));
                     Microsoft.Xna.Framework.Color arg_5067_4 = color3;
                     float arg_5067_5 = 0f;
                     Microsoft.Xna.Framework.Vector2 origin = default(Microsoft.Xna.Framework.Vector2);
                     arg_5067_0.Draw(arg_5067_1, arg_5067_2, arg_5067_3, arg_5067_4, arg_5067_5, origin, num30, SpriteEffects.None, 0f);
                 }
             }
             num30 = 1.34f;
             num31 = (int)((float)Main.backgroundWidth[8] * num30);
             this.bgParrallax = 0.49;
             this.bgStart = (int)(-Math.IEEERemainder((double)Main.screenPosition.X * this.bgParrallax, (double)num31) - (double)(num31 / 2));
             this.bgTop = (int)((double)(-(double)Main.screenPosition.Y + num26 / 2f) / (Main.worldSurface * 16.0) * 2100.0 + 2000.0);
             if (Main.gameMenu)
             {
                 this.bgTop = 480;
                 this.bgStart -= 120;
             }
             this.bgLoops = Main.screenWidth / num31 + 2;
             if ((double)Main.screenPosition.Y < Main.worldSurface * 16.0 + 16.0)
             {
                 for (int num64 = 0; num64 < this.bgLoops; num64++)
                 {
                     SpriteBatch arg_51BE_0 = this.spriteBatch;
                     Texture2D arg_51BE_1 = Main.backgroundTexture[11];
                     Microsoft.Xna.Framework.Vector2 arg_51BE_2 = new Microsoft.Xna.Framework.Vector2((float)(this.bgStart + num31 * num64), (float)this.bgTop);
                     Microsoft.Xna.Framework.Rectangle? arg_51BE_3 = new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.backgroundWidth[8], Main.backgroundHeight[8]));
                     Microsoft.Xna.Framework.Color arg_51BE_4 = color3;
                     float arg_51BE_5 = 0f;
                     Microsoft.Xna.Framework.Vector2 origin = default(Microsoft.Xna.Framework.Vector2);
                     arg_51BE_0.Draw(arg_51BE_1, arg_51BE_2, arg_51BE_3, arg_51BE_4, arg_51BE_5, origin, num30, SpriteEffects.None, 0f);
                 }
             }
         }
     }
     if (Main.gameMenu || Main.netMode == 2)
     {
         this.DrawMenu();
         return;
     }
     this.firstTileX = (int)(Main.screenPosition.X / 16f - 1f);
     this.lastTileX = (int)((Main.screenPosition.X + (float)Main.screenWidth) / 16f) + 2;
     this.firstTileY = (int)(Main.screenPosition.Y / 16f - 1f);
     this.lastTileY = (int)((Main.screenPosition.Y + (float)Main.screenHeight) / 16f) + 2;
     if (this.firstTileX < 0)
     {
         this.firstTileX = 0;
     }
     if (this.lastTileX > Main.maxTilesX)
     {
         this.lastTileX = Main.maxTilesX;
     }
     if (this.firstTileY < 0)
     {
         this.firstTileY = 0;
     }
     if (this.lastTileY > Main.maxTilesY)
     {
         this.lastTileY = Main.maxTilesY;
     }
     if (!Main.drawSkip)
     {
         Lighting.LightTiles(this.firstTileX, this.lastTileX, this.firstTileY, this.lastTileY);
     }
     Microsoft.Xna.Framework.Color arg_52EA_0 = Microsoft.Xna.Framework.Color.White;
     if (Main.drawToScreen)
     {
         this.DrawWater(true);
     }
     else
     {
         this.spriteBatch.Draw(this.backWaterTarget, Main.sceneBackgroundPos - Main.screenPosition, Microsoft.Xna.Framework.Color.White);
     }
     float x = (Main.sceneBackgroundPos.X - Main.screenPosition.X + (float)Main.offScreenRange) * Main.caveParrallax - (float)Main.offScreenRange;
     if (Main.drawToScreen)
     {
         this.DrawBackground();
     }
     else
     {
         this.spriteBatch.Draw(this.backgroundTarget, new Microsoft.Xna.Framework.Vector2(x, Main.sceneBackgroundPos.Y - Main.screenPosition.Y), Microsoft.Xna.Framework.Color.White);
     }
     Main.magmaBGFrameCounter++;
     if (Main.magmaBGFrameCounter >= 8)
     {
         Main.magmaBGFrameCounter = 0;
         Main.magmaBGFrame++;
         if (Main.magmaBGFrame >= 3)
         {
             Main.magmaBGFrame = 0;
         }
     }
     try
     {
         if (Main.drawToScreen)
         {
             this.DrawBlack();
             this.DrawWalls();
         }
         else
         {
             this.spriteBatch.Draw(this.blackTarget, Main.sceneTilePos - Main.screenPosition, Microsoft.Xna.Framework.Color.White);
             this.spriteBatch.Draw(this.wallTarget, Main.sceneWallPos - Main.screenPosition, Microsoft.Xna.Framework.Color.White);
         }
         this.DrawWoF();
         if (Main.player[Main.myPlayer].detectCreature)
         {
             if (Main.drawToScreen)
             {
                 this.DrawTiles(false);
                 this.DrawTiles(true);
             }
             else
             {
                 this.spriteBatch.Draw(this.tile2Target, Main.sceneTile2Pos - Main.screenPosition, Microsoft.Xna.Framework.Color.White);
                 this.spriteBatch.Draw(this.tileTarget, Main.sceneTilePos - Main.screenPosition, Microsoft.Xna.Framework.Color.White);
             }
             this.DrawGore();
             this.DrawNPCs(true);
             this.DrawNPCs(false);
         }
         else
         {
             if (Main.drawToScreen)
             {
                 this.DrawTiles(false);
                 this.DrawNPCs(true);
                 this.DrawTiles(true);
             }
             else
             {
                 this.spriteBatch.Draw(this.tile2Target, Main.sceneTile2Pos - Main.screenPosition, Microsoft.Xna.Framework.Color.White);
                 this.DrawNPCs(true);
                 this.spriteBatch.Draw(this.tileTarget, Main.sceneTilePos - Main.screenPosition, Microsoft.Xna.Framework.Color.White);
             }
             this.DrawGore();
             this.DrawNPCs(false);
         }
     }
     catch
     {
     }
     for (int num65 = 0; num65 < 1000; num65++)
     {
         if (Main.projectile[num65].active && Main.projectile[num65].type > 0 && !Main.projectile[num65].hide)
         {
             this.DrawProj(num65);
         }
     }
     for (int num66 = 0; num66 < 255; num66++)
     {
         if (Main.player[num66].active)
         {
             if (Main.player[num66].ghost)
             {
                 Microsoft.Xna.Framework.Vector2 position = Main.player[num66].position;
                 Main.player[num66].position = Main.player[num66].shadowPos[0];
                 Main.player[num66].shadow = 0.5f;
                 this.DrawGhost(Main.player[num66]);
                 Main.player[num66].position = Main.player[num66].shadowPos[1];
                 Main.player[num66].shadow = 0.7f;
                 this.DrawGhost(Main.player[num66]);
                 Main.player[num66].position = Main.player[num66].shadowPos[2];
                 Main.player[num66].shadow = 0.9f;
                 this.DrawGhost(Main.player[num66]);
                 Main.player[num66].position = position;
                 Main.player[num66].shadow = 0f;
                 this.DrawGhost(Main.player[num66]);
             }
             else
             {
                 bool flag2 = false;
                 bool flag3 = false;
                 if (Main.player[num66].head == 5 && Main.player[num66].body == 5 && Main.player[num66].legs == 5)
                 {
                     flag2 = true;
                 }
                 if (Main.player[num66].head == 7 && Main.player[num66].body == 7 && Main.player[num66].legs == 7)
                 {
                     flag2 = true;
                 }
                 if (Main.player[num66].head == 22 && Main.player[num66].body == 14 && Main.player[num66].legs == 14)
                 {
                     flag2 = true;
                 }
                 if (Main.player[num66].body == 17 && Main.player[num66].legs == 16 && (Main.player[num66].head == 29 || Main.player[num66].head == 30 || Main.player[num66].head == 31))
                 {
                     flag2 = true;
                 }
                 if (Main.player[num66].body == 19 && Main.player[num66].legs == 18 && (Main.player[num66].head == 35 || Main.player[num66].head == 36 || Main.player[num66].head == 37))
                 {
                     flag3 = true;
                 }
                 if (Main.player[num66].body == 24 && Main.player[num66].legs == 23)
                 {
                     flag3 = true;
                     flag2 = true;
                 }
                 if (flag3)
                 {
                     Microsoft.Xna.Framework.Vector2 position2 = Main.player[num66].position;
                     if (!Main.gamePaused)
                     {
                         Main.player[num66].ghostFade += Main.player[num66].ghostDir * 0.075f;
                     }
                     if ((double)Main.player[num66].ghostFade < 0.1)
                     {
                         Main.player[num66].ghostDir = 1f;
                         Main.player[num66].ghostFade = 0.1f;
                     }
                     if ((double)Main.player[num66].ghostFade > 0.9)
                     {
                         Main.player[num66].ghostDir = -1f;
                         Main.player[num66].ghostFade = 0.9f;
                     }
                     Main.player[num66].position.X = position2.X - Main.player[num66].ghostFade * 5f;
                     Main.player[num66].shadow = Main.player[num66].ghostFade;
                     this.DrawPlayer(Main.player[num66]);
                     Main.player[num66].position.X = position2.X + Main.player[num66].ghostFade * 5f;
                     Main.player[num66].shadow = Main.player[num66].ghostFade;
                     this.DrawPlayer(Main.player[num66]);
                     Main.player[num66].position = position2;
                     Main.player[num66].position.Y = position2.Y - Main.player[num66].ghostFade * 5f;
                     Main.player[num66].shadow = Main.player[num66].ghostFade;
                     this.DrawPlayer(Main.player[num66]);
                     Main.player[num66].position.Y = position2.Y + Main.player[num66].ghostFade * 5f;
                     Main.player[num66].shadow = Main.player[num66].ghostFade;
                     this.DrawPlayer(Main.player[num66]);
                     Main.player[num66].position = position2;
                     Main.player[num66].shadow = 0f;
                 }
                 if (flag2)
                 {
                     Microsoft.Xna.Framework.Vector2 position3 = Main.player[num66].position;
                     Main.player[num66].position = Main.player[num66].shadowPos[0];
                     Main.player[num66].shadow = 0.5f;
                     this.DrawPlayer(Main.player[num66]);
                     Main.player[num66].position = Main.player[num66].shadowPos[1];
                     Main.player[num66].shadow = 0.7f;
                     this.DrawPlayer(Main.player[num66]);
                     Main.player[num66].position = Main.player[num66].shadowPos[2];
                     Main.player[num66].shadow = 0.9f;
                     this.DrawPlayer(Main.player[num66]);
                     Main.player[num66].position = position3;
                     Main.player[num66].shadow = 0f;
                 }
                 this.DrawPlayer(Main.player[num66]);
             }
         }
     }
     if (!Main.gamePaused)
     {
         Main.essScale += (float)Main.essDir * 0.01f;
         if (Main.essScale > 1f)
         {
             Main.essDir = -1;
             Main.essScale = 1f;
         }
         if ((double)Main.essScale < 0.7)
         {
             Main.essDir = 1;
             Main.essScale = 0.7f;
         }
     }
     for (int num67 = 0; num67 < 200; num67++)
     {
         if (Main.item[num67].active && Main.item[num67].type > 0)
         {
             int arg_5C51_0 = (int)((double)Main.item[num67].position.X + (double)Main.item[num67].width * 0.5) / 16;
             int arg_5C57_0 = Lighting.offScreenTiles;
             int arg_5C88_0 = (int)((double)Main.item[num67].position.Y + (double)Main.item[num67].height * 0.5) / 16;
             int arg_5C8E_0 = Lighting.offScreenTiles;
             Microsoft.Xna.Framework.Color color8 = Lighting.GetColor((int)((double)Main.item[num67].position.X + (double)Main.item[num67].width * 0.5) / 16, (int)((double)Main.item[num67].position.Y + (double)Main.item[num67].height * 0.5) / 16);
             Microsoft.Xna.Framework.Color color9;
             if (!Main.gamePaused && base.IsActive && ((Main.item[num67].type >= 71 && Main.item[num67].type <= 74) || Main.item[num67].type == 58 || Main.item[num67].type == 109) && color8.R > 60)
             {
                 float num68 = (float)Main.rand.Next(500) - (Math.Abs(Main.item[num67].velocity.X) + Math.Abs(Main.item[num67].velocity.Y)) * 10f;
                 if (num68 < (float)(color8.R / 50))
                 {
                     Microsoft.Xna.Framework.Vector2 arg_5DFE_0 = Main.item[num67].position;
                     int arg_5DFE_1 = Main.item[num67].width;
                     int arg_5DFE_2 = Main.item[num67].height;
                     int arg_5DFE_3 = 43;
                     float arg_5DFE_4 = 0f;
                     float arg_5DFE_5 = 0f;
                     int arg_5DFE_6 = 254;
                     color9 = default(Microsoft.Xna.Framework.Color);
                     int num69 = Dust.NewDust(arg_5DFE_0, arg_5DFE_1, arg_5DFE_2, arg_5DFE_3, arg_5DFE_4, arg_5DFE_5, arg_5DFE_6, color9, 0.5f);
                     Dust expr_5E0D = Main.dust[num69];
                     expr_5E0D.velocity *= 0f;
                 }
             }
             float rotation3 = Main.item[num67].velocity.X * 0.2f;
             float num70 = 1f;
             Microsoft.Xna.Framework.Color alpha = Main.item[num67].GetAlpha(color8);
             if (Main.item[num67].type == 520 || Main.item[num67].type == 521 || Main.item[num67].type == 547 || Main.item[num67].type == 548 || Main.item[num67].type == 549)
             {
                 num70 = Main.essScale;
                 alpha.R = (byte)((float)alpha.R * num70);
                 alpha.G = (byte)((float)alpha.G * num70);
                 alpha.B = (byte)((float)alpha.B * num70);
                 alpha.A = (byte)((float)alpha.A * num70);
             }
             else
             {
                 if (Main.item[num67].type == 58 || Main.item[num67].type == 184)
                 {
                     num70 = Main.essScale * 0.25f + 0.75f;
                     alpha.R = (byte)((float)alpha.R * num70);
                     alpha.G = (byte)((float)alpha.G * num70);
                     alpha.B = (byte)((float)alpha.B * num70);
                     alpha.A = (byte)((float)alpha.A * num70);
                 }
             }
             float num71 = (float)(Main.item[num67].height - Main.itemTexture[Main.item[num67].type].Height);
             float num72 = (float)(Main.item[num67].width / 2 - Main.itemTexture[Main.item[num67].type].Width / 2);
             this.spriteBatch.Draw(Main.itemTexture[Main.item[num67].type], new Microsoft.Xna.Framework.Vector2(Main.item[num67].position.X - Main.screenPosition.X + (float)(Main.itemTexture[Main.item[num67].type].Width / 2) + num72, Main.item[num67].position.Y - Main.screenPosition.Y + (float)(Main.itemTexture[Main.item[num67].type].Height / 2) + num71 + 2f), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.itemTexture[Main.item[num67].type].Width, Main.itemTexture[Main.item[num67].type].Height)), alpha, rotation3, new Microsoft.Xna.Framework.Vector2((float)(Main.itemTexture[Main.item[num67].type].Width / 2), (float)(Main.itemTexture[Main.item[num67].type].Height / 2)), num70, SpriteEffects.None, 0f);
             Microsoft.Xna.Framework.Color arg_6125_0 = Main.item[num67].color;
             color9 = default(Microsoft.Xna.Framework.Color);
             if (arg_6125_0 != color9)
             {
                 this.spriteBatch.Draw(Main.itemTexture[Main.item[num67].type], new Microsoft.Xna.Framework.Vector2(Main.item[num67].position.X - Main.screenPosition.X + (float)(Main.itemTexture[Main.item[num67].type].Width / 2) + num72, Main.item[num67].position.Y - Main.screenPosition.Y + (float)(Main.itemTexture[Main.item[num67].type].Height / 2) + num71 + 2f), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.itemTexture[Main.item[num67].type].Width, Main.itemTexture[Main.item[num67].type].Height)), Main.item[num67].GetColor(color8), rotation3, new Microsoft.Xna.Framework.Vector2((float)(Main.itemTexture[Main.item[num67].type].Width / 2), (float)(Main.itemTexture[Main.item[num67].type].Height / 2)), num70, SpriteEffects.None, 0f);
             }
         }
     }
     Microsoft.Xna.Framework.Rectangle value2 = new Microsoft.Xna.Framework.Rectangle((int)Main.screenPosition.X - 50, (int)Main.screenPosition.Y - 50, Main.screenWidth + 100, Main.screenHeight + 100);
     for (int num73 = 0; num73 < Main.numDust; num73++)
     {
         if (Main.dust[num73].active)
         {
             if (new Microsoft.Xna.Framework.Rectangle((int)Main.dust[num73].position.X, (int)Main.dust[num73].position.Y, 4, 4).Intersects(value2))
             {
                 Microsoft.Xna.Framework.Color color10 = Lighting.GetColor((int)((double)Main.dust[num73].position.X + 4.0) / 16, (int)((double)Main.dust[num73].position.Y + 4.0) / 16);
                 if (Main.dust[num73].type == 6 || Main.dust[num73].type == 15 || Main.dust[num73].noLight || (Main.dust[num73].type >= 59 && Main.dust[num73].type <= 64))
                 {
                     color10 = Microsoft.Xna.Framework.Color.White;
                 }
                 color10 = Main.dust[num73].GetAlpha(color10);
                 this.spriteBatch.Draw(Main.dustTexture, Main.dust[num73].position - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(Main.dust[num73].frame), color10, Main.dust[num73].rotation, new Microsoft.Xna.Framework.Vector2(4f, 4f), Main.dust[num73].scale, SpriteEffects.None, 0f);
                 Microsoft.Xna.Framework.Color arg_6430_0 = Main.dust[num73].color;
                 Microsoft.Xna.Framework.Color color9 = default(Microsoft.Xna.Framework.Color);
                 if (arg_6430_0 != color9)
                 {
                     this.spriteBatch.Draw(Main.dustTexture, Main.dust[num73].position - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(Main.dust[num73].frame), Main.dust[num73].GetColor(color10), Main.dust[num73].rotation, new Microsoft.Xna.Framework.Vector2(4f, 4f), Main.dust[num73].scale, SpriteEffects.None, 0f);
                 }
                 if (color10 == Microsoft.Xna.Framework.Color.Black)
                 {
                     Main.dust[num73].active = false;
                 }
             }
             else
             {
                 Main.dust[num73].active = false;
             }
         }
     }
     if (Main.drawToScreen)
     {
         this.DrawWater(false);
         if (Main.player[Main.myPlayer].inventory[Main.player[Main.myPlayer].selectedItem].mech)
         {
             this.DrawWires();
         }
     }
     else
     {
         this.spriteBatch.Draw(this.waterTarget, Main.sceneWaterPos - Main.screenPosition, Microsoft.Xna.Framework.Color.White);
     }
     if (!Main.hideUI)
     {
         for (int num74 = 0; num74 < 255; num74++)
         {
             if (Main.player[num74].active && Main.player[num74].chatShowTime > 0 && num74 != Main.myPlayer && !Main.player[num74].dead)
             {
                 Microsoft.Xna.Framework.Vector2 vector = Main.fontMouseText.MeasureString(Main.player[num74].chatText);
                 Microsoft.Xna.Framework.Vector2 vector2;
                 vector2.X = Main.player[num74].position.X + (float)(Main.player[num74].width / 2) - vector.X / 2f;
                 vector2.Y = Main.player[num74].position.Y - vector.Y - 2f;
                 for (int num75 = 0; num75 < 5; num75++)
                 {
                     int num76 = 0;
                     int num77 = 0;
                     Microsoft.Xna.Framework.Color black = Microsoft.Xna.Framework.Color.Black;
                     if (num75 == 0)
                     {
                         num76 = -2;
                     }
                     if (num75 == 1)
                     {
                         num76 = 2;
                     }
                     if (num75 == 2)
                     {
                         num77 = -2;
                     }
                     if (num75 == 3)
                     {
                         num77 = 2;
                     }
                     if (num75 == 4)
                     {
                         black = new Microsoft.Xna.Framework.Color((int)Main.mouseTextColor, (int)Main.mouseTextColor, (int)Main.mouseTextColor, (int)Main.mouseTextColor);
                     }
                     SpriteBatch arg_66D7_0 = this.spriteBatch;
                     SpriteFont arg_66D7_1 = Main.fontMouseText;
                     string arg_66D7_2 = Main.player[num74].chatText;
                     Microsoft.Xna.Framework.Vector2 arg_66D7_3 = new Microsoft.Xna.Framework.Vector2(vector2.X + (float)num76 - Main.screenPosition.X, vector2.Y + (float)num77 - Main.screenPosition.Y);
                     Microsoft.Xna.Framework.Color arg_66D7_4 = black;
                     float arg_66D7_5 = 0f;
                     Microsoft.Xna.Framework.Vector2 origin = default(Microsoft.Xna.Framework.Vector2);
                     arg_66D7_0.DrawString(arg_66D7_1, arg_66D7_2, arg_66D7_3, arg_66D7_4, arg_66D7_5, origin, 1f, SpriteEffects.None, 0f);
                 }
             }
         }
         for (int num78 = 0; num78 < 100; num78++)
         {
             if (Main.combatText[num78].active)
             {
                 int num79 = 0;
                 if (Main.combatText[num78].crit)
                 {
                     num79 = 1;
                 }
                 Microsoft.Xna.Framework.Vector2 vector3 = Main.fontCombatText[num79].MeasureString(Main.combatText[num78].text);
                 Microsoft.Xna.Framework.Vector2 origin2 = new Microsoft.Xna.Framework.Vector2(vector3.X * 0.5f, vector3.Y * 0.5f);
                 float arg_6775_0 = Main.combatText[num78].scale;
                 float num80 = (float)Main.combatText[num78].color.R;
                 float num81 = (float)Main.combatText[num78].color.G;
                 float num82 = (float)Main.combatText[num78].color.B;
                 float num83 = (float)Main.combatText[num78].color.A;
                 num80 *= Main.combatText[num78].scale * Main.combatText[num78].alpha * 0.3f;
                 num82 *= Main.combatText[num78].scale * Main.combatText[num78].alpha * 0.3f;
                 num81 *= Main.combatText[num78].scale * Main.combatText[num78].alpha * 0.3f;
                 num83 *= Main.combatText[num78].scale * Main.combatText[num78].alpha;
                 Microsoft.Xna.Framework.Color color11 = new Microsoft.Xna.Framework.Color((int)num80, (int)num81, (int)num82, (int)num83);
                 for (int num84 = 0; num84 < 5; num84++)
                 {
                     int num85 = 0;
                     int num86 = 0;
                     if (num84 == 0)
                     {
                         num85--;
                     }
                     else
                     {
                         if (num84 == 1)
                         {
                             num85++;
                         }
                         else
                         {
                             if (num84 == 2)
                             {
                                 num86--;
                             }
                             else
                             {
                                 if (num84 == 3)
                                 {
                                     num86++;
                                 }
                                 else
                                 {
                                     num80 = (float)Main.combatText[num78].color.R * Main.combatText[num78].scale * Main.combatText[num78].alpha;
                                     num82 = (float)Main.combatText[num78].color.B * Main.combatText[num78].scale * Main.combatText[num78].alpha;
                                     num81 = (float)Main.combatText[num78].color.G * Main.combatText[num78].scale * Main.combatText[num78].alpha;
                                     num83 = (float)Main.combatText[num78].color.A * Main.combatText[num78].scale * Main.combatText[num78].alpha;
                                     color11 = new Microsoft.Xna.Framework.Color((int)num80, (int)num81, (int)num82, (int)num83);
                                 }
                             }
                         }
                     }
                     this.spriteBatch.DrawString(Main.fontCombatText[num79], Main.combatText[num78].text, new Microsoft.Xna.Framework.Vector2(Main.combatText[num78].position.X - Main.screenPosition.X + (float)num85 + origin2.X, Main.combatText[num78].position.Y - Main.screenPosition.Y + (float)num86 + origin2.Y), color11, Main.combatText[num78].rotation, origin2, Main.combatText[num78].scale, SpriteEffects.None, 0f);
                 }
             }
         }
         for (int num87 = 0; num87 < 20; num87++)
         {
             if (Main.itemText[num87].active)
             {
                 string text = Main.itemText[num87].name;
                 if (Main.itemText[num87].stack > 1)
                 {
                     text = string.Concat(new object[]
                     {
                         text,
                         " (",
                         Main.itemText[num87].stack,
                         ")"
                     });
                 }
                 Microsoft.Xna.Framework.Vector2 vector4 = Main.fontMouseText.MeasureString(text);
                 Microsoft.Xna.Framework.Vector2 origin3 = new Microsoft.Xna.Framework.Vector2(vector4.X * 0.5f, vector4.Y * 0.5f);
                 float arg_6AFF_0 = Main.itemText[num87].scale;
                 float num88 = (float)Main.itemText[num87].color.R;
                 float num89 = (float)Main.itemText[num87].color.G;
                 float num90 = (float)Main.itemText[num87].color.B;
                 float num91 = (float)Main.itemText[num87].color.A;
                 num88 *= Main.itemText[num87].scale * Main.itemText[num87].alpha * 0.3f;
                 num90 *= Main.itemText[num87].scale * Main.itemText[num87].alpha * 0.3f;
                 num89 *= Main.itemText[num87].scale * Main.itemText[num87].alpha * 0.3f;
                 num91 *= Main.itemText[num87].scale * Main.itemText[num87].alpha;
                 Microsoft.Xna.Framework.Color color12 = new Microsoft.Xna.Framework.Color((int)num88, (int)num89, (int)num90, (int)num91);
                 for (int num92 = 0; num92 < 5; num92++)
                 {
                     int num93 = 0;
                     int num94 = 0;
                     if (num92 == 0)
                     {
                         num93 -= 2;
                     }
                     else
                     {
                         if (num92 == 1)
                         {
                             num93 += 2;
                         }
                         else
                         {
                             if (num92 == 2)
                             {
                                 num94 -= 2;
                             }
                             else
                             {
                                 if (num92 == 3)
                                 {
                                     num94 += 2;
                                 }
                                 else
                                 {
                                     num88 = (float)Main.itemText[num87].color.R * Main.itemText[num87].scale * Main.itemText[num87].alpha;
                                     num90 = (float)Main.itemText[num87].color.B * Main.itemText[num87].scale * Main.itemText[num87].alpha;
                                     num89 = (float)Main.itemText[num87].color.G * Main.itemText[num87].scale * Main.itemText[num87].alpha;
                                     num91 = (float)Main.itemText[num87].color.A * Main.itemText[num87].scale * Main.itemText[num87].alpha;
                                     color12 = new Microsoft.Xna.Framework.Color((int)num88, (int)num89, (int)num90, (int)num91);
                                 }
                             }
                         }
                     }
                     if (num92 < 4)
                     {
                         num91 = (float)Main.itemText[num87].color.A * Main.itemText[num87].scale * Main.itemText[num87].alpha;
                         color12 = new Microsoft.Xna.Framework.Color(0, 0, 0, (int)num91);
                     }
                     this.spriteBatch.DrawString(Main.fontMouseText, text, new Microsoft.Xna.Framework.Vector2(Main.itemText[num87].position.X - Main.screenPosition.X + (float)num93 + origin3.X, Main.itemText[num87].position.Y - Main.screenPosition.Y + (float)num94 + origin3.Y), color12, Main.itemText[num87].rotation, origin3, Main.itemText[num87].scale, SpriteEffects.None, 0f);
                 }
             }
         }
         if (Main.netMode == 1 && Netplay.clientSock.statusText != "" && Netplay.clientSock.statusText != null)
         {
             string text2 = string.Concat(new object[]
             {
                 Netplay.clientSock.statusText,
                 ": ",
                 (int)((float)Netplay.clientSock.statusCount / (float)Netplay.clientSock.statusMax * 100f),
                 "%"
             });
             SpriteBatch arg_6F09_0 = this.spriteBatch;
             SpriteFont arg_6F09_1 = Main.fontMouseText;
             string arg_6F09_2 = text2;
             Microsoft.Xna.Framework.Vector2 arg_6F09_3 = new Microsoft.Xna.Framework.Vector2(628f - Main.fontMouseText.MeasureString(text2).X * 0.5f + (float)(Main.screenWidth - 800), 84f);
             Microsoft.Xna.Framework.Color arg_6F09_4 = new Microsoft.Xna.Framework.Color((int)Main.mouseTextColor, (int)Main.mouseTextColor, (int)Main.mouseTextColor, (int)Main.mouseTextColor);
             float arg_6F09_5 = 0f;
             Microsoft.Xna.Framework.Vector2 origin = default(Microsoft.Xna.Framework.Vector2);
             arg_6F09_0.DrawString(arg_6F09_1, arg_6F09_2, arg_6F09_3, arg_6F09_4, arg_6F09_5, origin, 1f, SpriteEffects.None, 0f);
         }
         this.DrawFPS();
         this.DrawInterface();
     }
     else
     {
         Main.maxQ = true;
     }
     this.spriteBatch.End();
     if (Main.mouseLeft)
     {
         Main.mouseLeftRelease = false;
     }
     else
     {
         Main.mouseLeftRelease = true;
     }
     if (Main.mouseRight)
     {
         Main.mouseRightRelease = false;
     }
     else
     {
         Main.mouseRightRelease = true;
     }
     if (Main.mouseState.RightButton != ButtonState.Pressed)
     {
         Main.stackSplit = 0;
     }
     if (Main.stackSplit > 0)
     {
         Main.stackSplit--;
     }
     if (Main.renderCount < 10)
     {
         Main.drawTimer[Main.renderCount] = (float)stopwatch.ElapsedMilliseconds;
         if (Main.drawTimerMaxDelay[Main.renderCount] > 0f)
         {
             Main.drawTimerMaxDelay[Main.renderCount] -= 1f;
         }
         else
         {
             Main.drawTimerMax[Main.renderCount] = 0f;
         }
         if (Main.drawTimer[Main.renderCount] > Main.drawTimerMax[Main.renderCount])
         {
             Main.drawTimerMax[Main.renderCount] = Main.drawTimer[Main.renderCount];
             Main.drawTimerMaxDelay[Main.renderCount] = 100f;
         }
     }
 }
Example #36
0
 protected void DrawMenu()
 {
     Main.render = false;
     Star.UpdateStars();
     Cloud.UpdateClouds();
     Main.holyTiles = 0;
     Main.evilTiles = 0;
     Main.jungleTiles = 0;
     Main.chatMode = false;
     for (int i = 0; i < Main.numChatLines; i++)
     {
         Main.chatLine[i] = new ChatLine();
     }
     this.DrawFPS();
     Main.screenLastPosition = Main.screenPosition;
     Main.screenPosition.Y = (float)(Main.worldSurface * 16.0 - (double)Main.screenHeight);
     if (Main.grabSky)
     {
         Main.screenPosition.X = Main.screenPosition.X + (float)(Main.mouseX - Main.screenWidth / 2) * 0.02f;
     }
     else
     {
         Main.screenPosition.X = Main.screenPosition.X + 2f;
     }
     if (Main.screenPosition.X > 2.14748352E+09f)
     {
         Main.screenPosition.X = 0f;
     }
     if (Main.screenPosition.X < -2.14748352E+09f)
     {
         Main.screenPosition.X = 0f;
     }
     Main.background = 0;
     byte b = (byte)((255 + Main.tileColor.R * 2) / 3);
     Microsoft.Xna.Framework.Color color = new Microsoft.Xna.Framework.Color((int)b, (int)b, (int)b, 255);
     this.logoRotation += this.logoRotationSpeed * 3E-05f;
     if ((double)this.logoRotation > 0.1)
     {
         this.logoRotationDirection = -1f;
     }
     else
     {
         if ((double)this.logoRotation < -0.1)
         {
             this.logoRotationDirection = 1f;
         }
     }
     if (this.logoRotationSpeed < 20f & this.logoRotationDirection == 1f)
     {
         this.logoRotationSpeed += 1f;
     }
     else
     {
         if (this.logoRotationSpeed > -20f & this.logoRotationDirection == -1f)
         {
             this.logoRotationSpeed -= 1f;
         }
     }
     this.logoScale += this.logoScaleSpeed * 1E-05f;
     if ((double)this.logoScale > 1.1)
     {
         this.logoScaleDirection = -1f;
     }
     else
     {
         if ((double)this.logoScale < 0.9)
         {
             this.logoScaleDirection = 1f;
         }
     }
     if (this.logoScaleSpeed < 50f & this.logoScaleDirection == 1f)
     {
         this.logoScaleSpeed += 1f;
     }
     else
     {
         if (this.logoScaleSpeed > -50f & this.logoScaleDirection == -1f)
         {
             this.logoScaleSpeed -= 1f;
         }
     }
     Microsoft.Xna.Framework.Color color2 = new Microsoft.Xna.Framework.Color((int)((byte)((float)color.R * ((float)Main.LogoA / 255f))), (int)((byte)((float)color.G * ((float)Main.LogoA / 255f))), (int)((byte)((float)color.B * ((float)Main.LogoA / 255f))), (int)((byte)((float)color.A * ((float)Main.LogoA / 255f))));
     Microsoft.Xna.Framework.Color color3 = new Microsoft.Xna.Framework.Color((int)((byte)((float)color.R * ((float)Main.LogoB / 255f))), (int)((byte)((float)color.G * ((float)Main.LogoB / 255f))), (int)((byte)((float)color.B * ((float)Main.LogoB / 255f))), (int)((byte)((float)color.A * ((float)Main.LogoB / 255f))));
     Main.LogoT = false;
     if (!Main.LogoT)
     {
         this.spriteBatch.Draw(Main.logoTexture, new Microsoft.Xna.Framework.Vector2((float)(Main.screenWidth / 2), 100f), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.logoTexture.Width, Main.logoTexture.Height)), color2, this.logoRotation, new Microsoft.Xna.Framework.Vector2((float)(Main.logoTexture.Width / 2), (float)(Main.logoTexture.Height / 2)), this.logoScale, SpriteEffects.None, 0f);
     }
     else
     {
         this.spriteBatch.Draw(Main.logo3Texture, new Microsoft.Xna.Framework.Vector2((float)(Main.screenWidth / 2), 100f), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.logoTexture.Width, Main.logoTexture.Height)), color2, this.logoRotation, new Microsoft.Xna.Framework.Vector2((float)(Main.logoTexture.Width / 2), (float)(Main.logoTexture.Height / 2)), this.logoScale, SpriteEffects.None, 0f);
     }
     this.spriteBatch.Draw(Main.logo2Texture, new Microsoft.Xna.Framework.Vector2((float)(Main.screenWidth / 2), 100f), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.logoTexture.Width, Main.logoTexture.Height)), color3, this.logoRotation, new Microsoft.Xna.Framework.Vector2((float)(Main.logoTexture.Width / 2), (float)(Main.logoTexture.Height / 2)), this.logoScale, SpriteEffects.None, 0f);
     if (Main.dayTime)
     {
         Main.LogoA += 2;
         if (Main.LogoA > 255)
         {
             Main.LogoA = 255;
         }
         Main.LogoB--;
         if (Main.LogoB < 0)
         {
             Main.LogoB = 0;
         }
     }
     else
     {
         Main.LogoB += 2;
         if (Main.LogoB > 255)
         {
             Main.LogoB = 255;
         }
         Main.LogoA--;
         if (Main.LogoA < 0)
         {
             Main.LogoA = 0;
             Main.LogoT = true;
         }
     }
     int num = 250;
     int num2 = Main.screenWidth / 2;
     int num3 = 80;
     int num4 = 0;
     int num5 = Main.menuMode;
     int num6 = -1;
     int num7 = 0;
     int num8 = 0;
     bool flag = false;
     bool flag2 = false;
     bool flag3 = false;
     int num9 = 0;
     bool[] array = new bool[Main.maxMenuItems];
     bool[] array2 = new bool[Main.maxMenuItems];
     int[] array3 = new int[Main.maxMenuItems];
     int[] array4 = new int[Main.maxMenuItems];
     byte[] array5 = new byte[Main.maxMenuItems];
     float[] array6 = new float[Main.maxMenuItems];
     bool[] array7 = new bool[Main.maxMenuItems];
     for (int j = 0; j < Main.maxMenuItems; j++)
     {
         array[j] = false;
         array2[j] = false;
         array3[j] = 0;
         array4[j] = 0;
         array6[j] = 1f;
     }
     string[] array8 = new string[Main.maxMenuItems];
     if (Main.menuMode == -1)
     {
         Main.menuMode = 0;
     }
     if (Main.netMode == 2)
     {
         bool flag4 = true;
         for (int k = 0; k < 8; k++)
         {
             if (k < 255)
             {
                 try
                 {
                     array8[k] = Netplay.serverSock[k].statusText;
                     if (Netplay.serverSock[k].active && Main.showSpam)
                     {
                         string[] array9;
                         string[] expr_662 = array9 = array8;
                         IntPtr intPtr;
                         int expr_667 = (int)(intPtr = (IntPtr)k);
                         object obj = array9[(int)intPtr];
                         expr_662[expr_667] = string.Concat(new object[]
                         {
                             obj,
                             " (",
                             NetMessage.buffer[k].spamCount,
                             ")"
                         });
                     }
                 }
                 catch
                 {
                     array8[k] = "";
                 }
                 array[k] = true;
                 if (array8[k] != "" && array8[k] != null)
                 {
                     flag4 = false;
                 }
             }
         }
         if (flag4)
         {
             array8[0] = "Start a new instance of Terraria to join!";
             array8[1] = "Running on port " + Netplay.serverPort + ".";
         }
         num4 = 11;
         array8[9] = Main.statusText;
         array[9] = true;
         num = 170;
         num3 = 30;
         array3[10] = 20;
         array3[10] = 40;
         array8[10] = "Disconnect";
         if (this.selectedMenu == 10)
         {
             Netplay.disconnect = true;
             Main.PlaySound(11, -1, -1, 1);
         }
     }
     else
     {
         if (Main.menuMode == 31)
         {
             string password = Netplay.password;
             Netplay.password = Main.GetInputText(Netplay.password);
             if (password != Netplay.password)
             {
                 Main.PlaySound(12, -1, -1, 1);
             }
             array8[0] = "Server Requires Password:"******"|";
                 array4[1] = 1;
             }
             else
             {
                 string[] array9;
                 (array9 = array8)[1] = array9[1] + " ";
             }
             array[0] = true;
             array[1] = true;
             array3[1] = -20;
             array3[2] = 20;
             array8[2] = "Accept";
             array8[3] = "Back";
             num4 = 4;
             if (this.selectedMenu == 3)
             {
                 Main.PlaySound(11, -1, -1, 1);
                 Main.menuMode = 0;
                 Netplay.disconnect = true;
                 Netplay.password = "";
             }
             else
             {
                 if (this.selectedMenu == 2 || Main.inputTextEnter)
                 {
                     NetMessage.SendData(38, -1, -1, Netplay.password, 0, 0f, 0f, 0f, 0);
                     Main.menuMode = 14;
                 }
             }
         }
         else
         {
             if (Main.netMode == 1 || Main.menuMode == 14)
             {
                 num4 = 2;
                 array8[0] = Main.statusText;
                 array[0] = true;
                 num = 300;
                 array8[1] = "Cancel";
                 if (this.selectedMenu != 1)
                 {
                     goto IL_3687;
                 }
                 Netplay.disconnect = true;
                 Netplay.clientSock.tcpClient.Close();
                 Main.PlaySound(11, -1, -1, 1);
                 Main.menuMode = 0;
                 Main.netMode = 0;
                 try
                 {
                     this.tServer.Kill();
                     goto IL_3687;
                 }
                 catch
                 {
                     goto IL_3687;
                 }
             }
             if (Main.menuMode == 30)
             {
                 string password2 = Netplay.password;
                 Netplay.password = Main.GetInputText(Netplay.password);
                 if (password2 != Netplay.password)
                 {
                     Main.PlaySound(12, -1, -1, 1);
                 }
                 array8[0] = "Enter Server Password:"******"|";
                     array4[1] = 1;
                 }
                 else
                 {
                     string[] array9;
                     (array9 = array8)[1] = array9[1] + " ";
                 }
                 array[0] = true;
                 array[1] = true;
                 array3[1] = -20;
                 array3[2] = 20;
                 array8[2] = "Accept";
                 array8[3] = "Back";
                 num4 = 4;
                 if (this.selectedMenu == 3)
                 {
                     Main.PlaySound(11, -1, -1, 1);
                     Main.menuMode = 6;
                     Netplay.password = "";
                 }
                 else
                 {
                     if (this.selectedMenu == 2 || Main.inputTextEnter || Main.autoPass)
                     {
                         this.tServer.StartInfo.FileName = "TerrariaServer.exe";
                         this.tServer.StartInfo.Arguments = string.Concat(new string[]
                         {
                             "-autoshutdown -world \"",
                             Main.worldPathName,
                             "\" -password \"",
                             Netplay.password,
                             "\""
                         });
                         if (Main.libPath != "")
                         {
                             ProcessStartInfo expr_AEA = this.tServer.StartInfo;
                             expr_AEA.Arguments = expr_AEA.Arguments + " -loadlib " + Main.libPath;
                         }
                         this.tServer.StartInfo.UseShellExecute = false;
                         this.tServer.StartInfo.CreateNoWindow = true;
                         this.tServer.Start();
                         Netplay.SetIP("127.0.0.1");
                         Main.autoPass = true;
                         Main.statusText = "Starting server...";
                         Netplay.StartClient();
                         Main.menuMode = 10;
                     }
                 }
             }
             else
             {
                 if (Main.menuMode == 15)
                 {
                     num4 = 2;
                     array8[0] = Main.statusText;
                     array[0] = true;
                     num = 80;
                     num3 = 400;
                     array8[1] = "Back";
                     if (this.selectedMenu == 1)
                     {
                         Netplay.disconnect = true;
                         Main.PlaySound(11, -1, -1, 1);
                         Main.menuMode = 0;
                         Main.netMode = 0;
                     }
                 }
                 else
                 {
                     if (Main.menuMode == 200)
                     {
                         num4 = 3;
                         array8[0] = "Load failed!";
                         array[0] = true;
                         num -= 30;
                         array3[1] = 70;
                         array3[2] = 50;
                         array8[1] = "Load Backup";
                         array8[2] = "Cancel";
                         if (this.selectedMenu == 1)
                         {
                             if (File.Exists(Main.worldPathName + ".bak"))
                             {
                                 File.Copy(Main.worldPathName + ".bak", Main.worldPathName, true);
                                 File.Delete(Main.worldPathName + ".bak");
                                 Main.PlaySound(10, -1, -1, 1);
                                 WorldGen.playWorld();
                                 Main.menuMode = 10;
                             }
                             else
                             {
                                 Main.PlaySound(11, -1, -1, 1);
                                 Main.menuMode = 0;
                                 Main.netMode = 0;
                             }
                         }
                         if (this.selectedMenu == 2)
                         {
                             Main.PlaySound(11, -1, -1, 1);
                             Main.menuMode = 0;
                             Main.netMode = 0;
                         }
                     }
                     else
                     {
                         if (Main.menuMode == 201)
                         {
                             num4 = 3;
                             array8[0] = "Load failed!";
                             array[0] = true;
                             array[1] = true;
                             num -= 30;
                             array3[1] = -30;
                             array3[2] = 50;
                             array8[1] = "No backup found";
                             array8[2] = "Back";
                             if (this.selectedMenu == 2)
                             {
                                 Main.PlaySound(11, -1, -1, 1);
                                 Main.menuMode = 0;
                                 Main.netMode = 0;
                             }
                         }
                         else
                         {
                             if (Main.menuMode == 10)
                             {
                                 num4 = 1;
                                 array8[0] = Main.statusText;
                                 array[0] = true;
                                 num = 300;
                             }
                             else
                             {
                                 if (Main.menuMode == 100)
                                 {
                                     num4 = 1;
                                     array8[0] = Main.statusText;
                                     array[0] = true;
                                     num = 300;
                                 }
                                 else
                                 {
                                     if (Main.menuMode == 0)
                                     {
                                         Main.menuMultiplayer = false;
                                         Main.menuServer = false;
                                         Main.netMode = 0;
                                         array8[0] = "Single Player";
                                         array8[1] = "Multiplayer";
                                         array8[2] = "Settings";
                                         array8[3] = "Exit";
                                         num4 = 4;
                                         if (this.selectedMenu == 3)
                                         {
                                             this.QuitGame();
                                         }
                                         if (this.selectedMenu == 1)
                                         {
                                             Main.PlaySound(10, -1, -1, 1);
                                             Main.menuMode = 12;
                                         }
                                         if (this.selectedMenu == 2)
                                         {
                                             Main.PlaySound(10, -1, -1, 1);
                                             Main.menuMode = 11;
                                         }
                                         if (this.selectedMenu == 0)
                                         {
                                             Main.PlaySound(10, -1, -1, 1);
                                             Main.menuMode = 1;
                                             Main.LoadPlayers();
                                         }
                                     }
                                     else
                                     {
                                         if (Main.menuMode == 1)
                                         {
                                             Main.myPlayer = 0;
                                             num = 190;
                                             num3 = 50;
                                             array8[5] = "Create Character";
                                             array8[6] = "Delete";
                                             if (Main.numLoadPlayers == 5)
                                             {
                                                 array2[5] = true;
                                                 array8[5] = "";
                                             }
                                             else
                                             {
                                                 if (Main.numLoadPlayers == 0)
                                                 {
                                                     array2[6] = true;
                                                     array8[6] = "";
                                                 }
                                             }
                                             array8[7] = "Back";
                                             for (int l = 0; l < 5; l++)
                                             {
                                                 if (l < Main.numLoadPlayers)
                                                 {
                                                     array8[l] = Main.loadPlayer[l].name;
                                                     array5[l] = Main.loadPlayer[l].difficulty;
                                                 }
                                                 else
                                                 {
                                                     array8[l] = null;
                                                 }
                                             }
                                             num4 = 8;
                                             if (this.focusMenu >= 0 && this.focusMenu < Main.numLoadPlayers)
                                             {
                                                 num6 = this.focusMenu;
                                                 Microsoft.Xna.Framework.Vector2 vector = Main.fontDeathText.MeasureString(array8[num6]);
                                                 num7 = (int)((double)(Main.screenWidth / 2) + (double)vector.X * 0.5 + 10.0);
                                                 num8 = num + num3 * this.focusMenu + 4;
                                             }
                                             if (this.selectedMenu == 7)
                                             {
                                                 Main.autoJoin = false;
                                                 Main.autoPass = false;
                                                 Main.PlaySound(11, -1, -1, 1);
                                                 if (Main.menuMultiplayer)
                                                 {
                                                     Main.menuMode = 12;
                                                     Main.menuMultiplayer = false;
                                                     Main.menuServer = false;
                                                 }
                                                 else
                                                 {
                                                     Main.menuMode = 0;
                                                 }
                                             }
                                             else
                                             {
                                                 if (this.selectedMenu == 5)
                                                 {
                                                     Main.loadPlayer[Main.numLoadPlayers] = new Player();
                                                     Main.loadPlayer[Main.numLoadPlayers].inventory[0].SetDefaults("Copper Shortsword");
                                                     Main.loadPlayer[Main.numLoadPlayers].inventory[0].Prefix(-1);
                                                     Main.loadPlayer[Main.numLoadPlayers].inventory[1].SetDefaults("Copper Pickaxe");
                                                     Main.loadPlayer[Main.numLoadPlayers].inventory[1].Prefix(-1);
                                                     Main.loadPlayer[Main.numLoadPlayers].inventory[2].SetDefaults("Copper Axe");
                                                     Main.loadPlayer[Main.numLoadPlayers].inventory[2].Prefix(-1);
                                                     Main.PlaySound(10, -1, -1, 1);
                                                     Main.menuMode = 2;
                                                 }
                                                 else
                                                 {
                                                     if (this.selectedMenu == 6)
                                                     {
                                                         Main.PlaySound(10, -1, -1, 1);
                                                         Main.menuMode = 4;
                                                     }
                                                     else
                                                     {
                                                         if (this.selectedMenu >= 0)
                                                         {
                                                             if (Main.menuMultiplayer)
                                                             {
                                                                 this.selectedPlayer = this.selectedMenu;
                                                                 Main.player[Main.myPlayer] = (Player)Main.loadPlayer[this.selectedPlayer].Clone();
                                                                 Main.playerPathName = Main.loadPlayerPath[this.selectedPlayer];
                                                                 Main.PlaySound(10, -1, -1, 1);
                                                                 if (Main.autoJoin)
                                                                 {
                                                                     if (Netplay.SetIP(Main.getIP))
                                                                     {
                                                                         Main.menuMode = 10;
                                                                         Netplay.StartClient();
                                                                     }
                                                                     else
                                                                     {
                                                                         if (Netplay.SetIP2(Main.getIP))
                                                                         {
                                                                             Main.menuMode = 10;
                                                                             Netplay.StartClient();
                                                                         }
                                                                     }
                                                                     Main.autoJoin = false;
                                                                 }
                                                                 else
                                                                 {
                                                                     if (Main.menuServer)
                                                                     {
                                                                         Main.LoadWorlds();
                                                                         Main.menuMode = 6;
                                                                     }
                                                                     else
                                                                     {
                                                                         Main.menuMode = 13;
                                                                     }
                                                                 }
                                                             }
                                                             else
                                                             {
                                                                 Main.myPlayer = 0;
                                                                 this.selectedPlayer = this.selectedMenu;
                                                                 Main.player[Main.myPlayer] = (Player)Main.loadPlayer[this.selectedPlayer].Clone();
                                                                 Main.playerPathName = Main.loadPlayerPath[this.selectedPlayer];
                                                                 Main.LoadWorlds();
                                                                 Main.PlaySound(10, -1, -1, 1);
                                                                 Main.menuMode = 6;
                                                             }
                                                         }
                                                     }
                                                 }
                                             }
                                         }
                                         else
                                         {
                                             if (Main.menuMode == 2)
                                             {
                                                 if (this.selectedMenu == 0)
                                                 {
                                                     Main.menuMode = 17;
                                                     Main.PlaySound(10, -1, -1, 1);
                                                     this.selColor = Main.loadPlayer[Main.numLoadPlayers].hairColor;
                                                 }
                                                 if (this.selectedMenu == 1)
                                                 {
                                                     Main.menuMode = 18;
                                                     Main.PlaySound(10, -1, -1, 1);
                                                     this.selColor = Main.loadPlayer[Main.numLoadPlayers].eyeColor;
                                                 }
                                                 if (this.selectedMenu == 2)
                                                 {
                                                     Main.menuMode = 19;
                                                     Main.PlaySound(10, -1, -1, 1);
                                                     this.selColor = Main.loadPlayer[Main.numLoadPlayers].skinColor;
                                                 }
                                                 if (this.selectedMenu == 3)
                                                 {
                                                     Main.menuMode = 20;
                                                     Main.PlaySound(10, -1, -1, 1);
                                                 }
                                                 array8[0] = "Hair";
                                                 array8[1] = "Eyes";
                                                 array8[2] = "Skin";
                                                 array8[3] = "Clothes";
                                                 num = 220;
                                                 for (int m = 0; m < 9; m++)
                                                 {
                                                     if (m < 6)
                                                     {
                                                         array6[m] = 0.75f;
                                                     }
                                                     else
                                                     {
                                                         array6[m] = 0.9f;
                                                     }
                                                 }
                                                 num3 = 38;
                                                 array3[6] = 6;
                                                 array3[7] = 12;
                                                 array3[8] = 18;
                                                 num6 = Main.numLoadPlayers;
                                                 num7 = Main.screenWidth / 2 - 16;
                                                 num8 = 176;
                                                 if (Main.loadPlayer[num6].male)
                                                 {
                                                     array8[4] = "Male";
                                                 }
                                                 else
                                                 {
                                                     array8[4] = "Female";
                                                 }
                                                 if (this.selectedMenu == 4)
                                                 {
                                                     if (Main.loadPlayer[num6].male)
                                                     {
                                                         Main.PlaySound(20, -1, -1, 1);
                                                         Main.loadPlayer[num6].male = false;
                                                     }
                                                     else
                                                     {
                                                         Main.PlaySound(1, -1, -1, 1);
                                                         Main.loadPlayer[num6].male = true;
                                                     }
                                                 }
                                                 if (Main.loadPlayer[num6].difficulty == 2)
                                                 {
                                                     array8[5] = "Hardcore";
                                                     array5[5] = Main.loadPlayer[num6].difficulty;
                                                 }
                                                 else
                                                 {
                                                     if (Main.loadPlayer[num6].difficulty == 1)
                                                     {
                                                         array8[5] = "Mediumcore";
                                                         array5[5] = Main.loadPlayer[num6].difficulty;
                                                     }
                                                     else
                                                     {
                                                         array8[5] = "Softcore";
                                                     }
                                                 }
                                                 if (this.selectedMenu == 5)
                                                 {
                                                     Main.PlaySound(10, -1, -1, 1);
                                                     Main.menuMode = 222;
                                                 }
                                                 if (this.selectedMenu == 7)
                                                 {
                                                     Main.PlaySound(12, -1, -1, 1);
                                                     Main.loadPlayer[num6].hair = Main.rand.Next(36);
                                                     Main.loadPlayer[num6].eyeColor = this.randColor();
                                                     while ((int)(Main.loadPlayer[num6].eyeColor.R + Main.loadPlayer[num6].eyeColor.G + Main.loadPlayer[num6].eyeColor.B) > 300)
                                                     {
                                                         Main.loadPlayer[num6].eyeColor = this.randColor();
                                                     }
                                                     Main.loadPlayer[num6].hairColor = this.randColor();
                                                     Main.loadPlayer[num6].pantsColor = this.randColor();
                                                     Main.loadPlayer[num6].shirtColor = this.randColor();
                                                     Main.loadPlayer[num6].shoeColor = this.randColor();
                                                     Main.loadPlayer[num6].skinColor = this.randColor();
                                                     float num10 = (float)Main.rand.Next(60, 120) * 0.01f;
                                                     if (num10 > 1f)
                                                     {
                                                         num10 = 1f;
                                                     }
                                                     Main.loadPlayer[num6].skinColor.R = (byte)((float)Main.rand.Next(240, 255) * num10);
                                                     Main.loadPlayer[num6].skinColor.G = (byte)((float)Main.rand.Next(110, 140) * num10);
                                                     Main.loadPlayer[num6].skinColor.B = (byte)((float)Main.rand.Next(75, 110) * num10);
                                                     Main.loadPlayer[num6].underShirtColor = this.randColor();
                                                     int num11 = Main.loadPlayer[num6].hair + 1;
                                                     if (num11 == 5 || num11 == 6 || num11 == 7 || num11 == 10 || num11 == 12 || num11 == 19 || num11 == 22 || num11 == 23 || num11 == 26 || num11 == 27 || num11 == 30 || num11 == 33)
                                                     {
                                                         Main.loadPlayer[num6].male = false;
                                                     }
                                                     else
                                                     {
                                                         Main.loadPlayer[num6].male = true;
                                                     }
                                                 }
                                                 array8[7] = "Random";
                                                 array8[6] = "Create";
                                                 array8[8] = "Back";
                                                 num4 = 9;
                                                 if (this.selectedMenu == 8)
                                                 {
                                                     Main.PlaySound(11, -1, -1, 1);
                                                     Main.menuMode = 1;
                                                 }
                                                 else
                                                 {
                                                     if (this.selectedMenu == 6)
                                                     {
                                                         Main.PlaySound(10, -1, -1, 1);
                                                         Main.loadPlayer[Main.numLoadPlayers].name = "";
                                                         Main.menuMode = 3;
                                                     }
                                                 }
                                             }
                                             else
                                             {
                                                 if (Main.menuMode == 222)
                                                 {
                                                     if (this.focusMenu == 3)
                                                     {
                                                         array8[0] = "Hardcore characters die for good";
                                                     }
                                                     else
                                                     {
                                                         if (this.focusMenu == 2)
                                                         {
                                                             array8[0] = "Mediumcore characters drop items on death";
                                                         }
                                                         else
                                                         {
                                                             if (this.focusMenu == 1)
                                                             {
                                                                 array8[0] = "Softcore characters drop money on death";
                                                             }
                                                             else
                                                             {
                                                                 array8[0] = "Select difficulty";
                                                             }
                                                         }
                                                     }
                                                     num3 = 50;
                                                     array3[1] = 25;
                                                     array3[2] = 25;
                                                     array3[3] = 25;
                                                     array[0] = true;
                                                     array8[1] = "Softcore";
                                                     array8[2] = "Mediumcore";
                                                     array5[2] = 1;
                                                     array8[3] = "Hardcore";
                                                     array5[3] = 2;
                                                     num4 = 4;
                                                     if (this.selectedMenu == 1)
                                                     {
                                                         Main.loadPlayer[Main.numLoadPlayers].difficulty = 0;
                                                         Main.menuMode = 2;
                                                     }
                                                     else
                                                     {
                                                         if (this.selectedMenu == 2)
                                                         {
                                                             Main.menuMode = 2;
                                                             Main.loadPlayer[Main.numLoadPlayers].difficulty = 1;
                                                         }
                                                         else
                                                         {
                                                             if (this.selectedMenu == 3)
                                                             {
                                                                 Main.loadPlayer[Main.numLoadPlayers].difficulty = 2;
                                                                 Main.menuMode = 2;
                                                             }
                                                         }
                                                     }
                                                 }
                                                 else
                                                 {
                                                     if (Main.menuMode == 20)
                                                     {
                                                         if (this.selectedMenu == 0)
                                                         {
                                                             Main.menuMode = 21;
                                                             Main.PlaySound(10, -1, -1, 1);
                                                             this.selColor = Main.loadPlayer[Main.numLoadPlayers].shirtColor;
                                                         }
                                                         if (this.selectedMenu == 1)
                                                         {
                                                             Main.menuMode = 22;
                                                             Main.PlaySound(10, -1, -1, 1);
                                                             this.selColor = Main.loadPlayer[Main.numLoadPlayers].underShirtColor;
                                                         }
                                                         if (this.selectedMenu == 2)
                                                         {
                                                             Main.menuMode = 23;
                                                             Main.PlaySound(10, -1, -1, 1);
                                                             this.selColor = Main.loadPlayer[Main.numLoadPlayers].pantsColor;
                                                         }
                                                         if (this.selectedMenu == 3)
                                                         {
                                                             this.selColor = Main.loadPlayer[Main.numLoadPlayers].shoeColor;
                                                             Main.menuMode = 24;
                                                             Main.PlaySound(10, -1, -1, 1);
                                                         }
                                                         array8[0] = "Shirt";
                                                         array8[1] = "Undershirt";
                                                         array8[2] = "Pants";
                                                         array8[3] = "Shoes";
                                                         num = 260;
                                                         num3 = 50;
                                                         array3[5] = 20;
                                                         array8[5] = "Back";
                                                         num4 = 6;
                                                         num6 = Main.numLoadPlayers;
                                                         num7 = Main.screenWidth / 2 - 16;
                                                         num8 = 210;
                                                         if (this.selectedMenu == 5)
                                                         {
                                                             Main.PlaySound(11, -1, -1, 1);
                                                             Main.menuMode = 2;
                                                         }
                                                     }
                                                     else
                                                     {
                                                         if (Main.menuMode == 17)
                                                         {
                                                             num6 = Main.numLoadPlayers;
                                                             num7 = Main.screenWidth / 2 - 16;
                                                             num8 = 210;
                                                             flag = true;
                                                             num9 = 390;
                                                             num = 260;
                                                             num3 = 60;
                                                             Main.loadPlayer[num6].hairColor = this.selColor;
                                                             num4 = 3;
                                                             array8[0] = "Hair " + (Main.loadPlayer[num6].hair + 1);
                                                             array8[1] = "Hair Microsoft.Xna.Framework.Color";
                                                             array[1] = true;
                                                             array3[2] = 150;
                                                             array3[1] = 10;
                                                             array8[2] = "Back";
                                                             if (this.selectedMenu == 0)
                                                             {
                                                                 Main.PlaySound(12, -1, -1, 1);
                                                                 Main.loadPlayer[num6].hair++;
                                                                 if (Main.loadPlayer[num6].hair >= 36)
                                                                 {
                                                                     Main.loadPlayer[num6].hair = 0;
                                                                 }
                                                             }
                                                             else
                                                             {
                                                                 if (this.selectedMenu2 == 0)
                                                                 {
                                                                     Main.PlaySound(12, -1, -1, 1);
                                                                     Main.loadPlayer[num6].hair--;
                                                                     if (Main.loadPlayer[num6].hair < 0)
                                                                     {
                                                                         Main.loadPlayer[num6].hair = 35;
                                                                     }
                                                                 }
                                                             }
                                                             if (this.selectedMenu == 2)
                                                             {
                                                                 Main.menuMode = 2;
                                                                 Main.PlaySound(11, -1, -1, 1);
                                                             }
                                                         }
                                                         else
                                                         {
                                                             if (Main.menuMode == 18)
                                                             {
                                                                 num6 = Main.numLoadPlayers;
                                                                 num7 = Main.screenWidth / 2 - 16;
                                                                 num8 = 210;
                                                                 flag = true;
                                                                 num9 = 370;
                                                                 num = 240;
                                                                 num3 = 60;
                                                                 Main.loadPlayer[num6].eyeColor = this.selColor;
                                                                 num4 = 3;
                                                                 array8[0] = "";
                                                                 array8[1] = "Eye Microsoft.Xna.Framework.Color";
                                                                 array[1] = true;
                                                                 array3[2] = 170;
                                                                 array3[1] = 10;
                                                                 array8[2] = "Back";
                                                                 if (this.selectedMenu == 2)
                                                                 {
                                                                     Main.menuMode = 2;
                                                                     Main.PlaySound(11, -1, -1, 1);
                                                                 }
                                                             }
                                                             else
                                                             {
                                                                 if (Main.menuMode == 19)
                                                                 {
                                                                     num6 = Main.numLoadPlayers;
                                                                     num7 = Main.screenWidth / 2 - 16;
                                                                     num8 = 210;
                                                                     flag = true;
                                                                     num9 = 370;
                                                                     num = 240;
                                                                     num3 = 60;
                                                                     Main.loadPlayer[num6].skinColor = this.selColor;
                                                                     num4 = 3;
                                                                     array8[0] = "";
                                                                     array8[1] = "Skin Microsoft.Xna.Framework.Color";
                                                                     array[1] = true;
                                                                     array3[2] = 170;
                                                                     array3[1] = 10;
                                                                     array8[2] = "Back";
                                                                     if (this.selectedMenu == 2)
                                                                     {
                                                                         Main.menuMode = 2;
                                                                         Main.PlaySound(11, -1, -1, 1);
                                                                     }
                                                                 }
                                                                 else
                                                                 {
                                                                     if (Main.menuMode == 21)
                                                                     {
                                                                         num6 = Main.numLoadPlayers;
                                                                         num7 = Main.screenWidth / 2 - 16;
                                                                         num8 = 210;
                                                                         flag = true;
                                                                         num9 = 370;
                                                                         num = 240;
                                                                         num3 = 60;
                                                                         Main.loadPlayer[num6].shirtColor = this.selColor;
                                                                         num4 = 3;
                                                                         array8[0] = "";
                                                                         array8[1] = "Shirt Microsoft.Xna.Framework.Color";
                                                                         array[1] = true;
                                                                         array3[2] = 170;
                                                                         array3[1] = 10;
                                                                         array8[2] = "Back";
                                                                         if (this.selectedMenu == 2)
                                                                         {
                                                                             Main.menuMode = 20;
                                                                             Main.PlaySound(11, -1, -1, 1);
                                                                         }
                                                                     }
                                                                     else
                                                                     {
                                                                         if (Main.menuMode == 22)
                                                                         {
                                                                             num6 = Main.numLoadPlayers;
                                                                             num7 = Main.screenWidth / 2 - 16;
                                                                             num8 = 210;
                                                                             flag = true;
                                                                             num9 = 370;
                                                                             num = 240;
                                                                             num3 = 60;
                                                                             Main.loadPlayer[num6].underShirtColor = this.selColor;
                                                                             num4 = 3;
                                                                             array8[0] = "";
                                                                             array8[1] = "Undershirt Microsoft.Xna.Framework.Color";
                                                                             array[1] = true;
                                                                             array3[2] = 170;
                                                                             array3[1] = 10;
                                                                             array8[2] = "Back";
                                                                             if (this.selectedMenu == 2)
                                                                             {
                                                                                 Main.menuMode = 20;
                                                                                 Main.PlaySound(11, -1, -1, 1);
                                                                             }
                                                                         }
                                                                         else
                                                                         {
                                                                             if (Main.menuMode == 23)
                                                                             {
                                                                                 num6 = Main.numLoadPlayers;
                                                                                 num7 = Main.screenWidth / 2 - 16;
                                                                                 num8 = 210;
                                                                                 flag = true;
                                                                                 num9 = 370;
                                                                                 num = 240;
                                                                                 num3 = 60;
                                                                                 Main.loadPlayer[num6].pantsColor = this.selColor;
                                                                                 num4 = 3;
                                                                                 array8[0] = "";
                                                                                 array8[1] = "Pants Microsoft.Xna.Framework.Color";
                                                                                 array[1] = true;
                                                                                 array3[2] = 170;
                                                                                 array3[1] = 10;
                                                                                 array8[2] = "Back";
                                                                                 if (this.selectedMenu == 2)
                                                                                 {
                                                                                     Main.menuMode = 20;
                                                                                     Main.PlaySound(11, -1, -1, 1);
                                                                                 }
                                                                             }
                                                                             else
                                                                             {
                                                                                 if (Main.menuMode == 24)
                                                                                 {
                                                                                     num6 = Main.numLoadPlayers;
                                                                                     num7 = Main.screenWidth / 2 - 16;
                                                                                     num8 = 210;
                                                                                     flag = true;
                                                                                     num9 = 370;
                                                                                     num = 240;
                                                                                     num3 = 60;
                                                                                     Main.loadPlayer[num6].shoeColor = this.selColor;
                                                                                     num4 = 3;
                                                                                     array8[0] = "";
                                                                                     array8[1] = "Shoe Microsoft.Xna.Framework.Color";
                                                                                     array[1] = true;
                                                                                     array3[2] = 170;
                                                                                     array3[1] = 10;
                                                                                     array8[2] = "Back";
                                                                                     if (this.selectedMenu == 2)
                                                                                     {
                                                                                         Main.menuMode = 20;
                                                                                         Main.PlaySound(11, -1, -1, 1);
                                                                                     }
                                                                                 }
                                                                                 else
                                                                                 {
                                                                                     if (Main.menuMode == 3)
                                                                                     {
                                                                                         string name = Main.loadPlayer[Main.numLoadPlayers].name;
                                                                                         Main.loadPlayer[Main.numLoadPlayers].name = Main.GetInputText(Main.loadPlayer[Main.numLoadPlayers].name);
                                                                                         if (Main.loadPlayer[Main.numLoadPlayers].name.Length > Player.nameLen)
                                                                                         {
                                                                                             Main.loadPlayer[Main.numLoadPlayers].name = Main.loadPlayer[Main.numLoadPlayers].name.Substring(0, Player.nameLen);
                                                                                         }
                                                                                         if (name != Main.loadPlayer[Main.numLoadPlayers].name)
                                                                                         {
                                                                                             Main.PlaySound(12, -1, -1, 1);
                                                                                         }
                                                                                         array8[0] = "Enter Character Name:";
                                                                                         array2[2] = true;
                                                                                         if (Main.loadPlayer[Main.numLoadPlayers].name != "")
                                                                                         {
                                                                                             if (Main.loadPlayer[Main.numLoadPlayers].name.Substring(0, 1) == " ")
                                                                                             {
                                                                                                 Main.loadPlayer[Main.numLoadPlayers].name = "";
                                                                                             }
                                                                                             for (int n = 0; n < Main.loadPlayer[Main.numLoadPlayers].name.Length; n++)
                                                                                             {
                                                                                                 if (Main.loadPlayer[Main.numLoadPlayers].name.Substring(n, 1) != " ")
                                                                                                 {
                                                                                                     array2[2] = false;
                                                                                                 }
                                                                                             }
                                                                                         }
                                                                                         this.textBlinkerCount++;
                                                                                         if (this.textBlinkerCount >= 20)
                                                                                         {
                                                                                             if (this.textBlinkerState == 0)
                                                                                             {
                                                                                                 this.textBlinkerState = 1;
                                                                                             }
                                                                                             else
                                                                                             {
                                                                                                 this.textBlinkerState = 0;
                                                                                             }
                                                                                             this.textBlinkerCount = 0;
                                                                                         }
                                                                                         array8[1] = Main.loadPlayer[Main.numLoadPlayers].name;
                                                                                         if (this.textBlinkerState == 1)
                                                                                         {
                                                                                             string[] array9;
                                                                                             (array9 = array8)[1] = array9[1] + "|";
                                                                                             array4[1] = 1;
                                                                                         }
                                                                                         else
                                                                                         {
                                                                                             string[] array9;
                                                                                             (array9 = array8)[1] = array9[1] + " ";
                                                                                         }
                                                                                         array[0] = true;
                                                                                         array[1] = true;
                                                                                         array3[1] = -20;
                                                                                         array3[2] = 20;
                                                                                         array8[2] = "Accept";
                                                                                         array8[3] = "Back";
                                                                                         num4 = 4;
                                                                                         if (this.selectedMenu == 3)
                                                                                         {
                                                                                             Main.PlaySound(11, -1, -1, 1);
                                                                                             Main.menuMode = 2;
                                                                                         }
                                                                                         if (this.selectedMenu == 2 || (!array2[2] && Main.inputTextEnter))
                                                                                         {
                                                                                             Main.loadPlayer[Main.numLoadPlayers].name.Trim();
                                                                                             Main.loadPlayerPath[Main.numLoadPlayers] = Main.nextLoadPlayer();
                                                                                             Player.SavePlayer(Main.loadPlayer[Main.numLoadPlayers], Main.loadPlayerPath[Main.numLoadPlayers]);
                                                                                             Main.LoadPlayers();
                                                                                             Main.PlaySound(10, -1, -1, 1);
                                                                                             Main.menuMode = 1;
                                                                                         }
                                                                                     }
                                                                                     else
                                                                                     {
                                                                                         if (Main.menuMode == 4)
                                                                                         {
                                                                                             num = 220;
                                                                                             num3 = 60;
                                                                                             array8[5] = "Back";
                                                                                             for (int num12 = 0; num12 < 5; num12++)
                                                                                             {
                                                                                                 if (num12 < Main.numLoadPlayers)
                                                                                                 {
                                                                                                     array8[num12] = Main.loadPlayer[num12].name;
                                                                                                     array5[num12] = Main.loadPlayer[num12].difficulty;
                                                                                                 }
                                                                                                 else
                                                                                                 {
                                                                                                     array8[num12] = null;
                                                                                                 }
                                                                                             }
                                                                                             num4 = 6;
                                                                                             if (this.focusMenu >= 0 && this.focusMenu < Main.numLoadPlayers)
                                                                                             {
                                                                                                 num6 = this.focusMenu;
                                                                                                 Microsoft.Xna.Framework.Vector2 vector2 = Main.fontDeathText.MeasureString(array8[num6]);
                                                                                                 num7 = (int)((double)(Main.screenWidth / 2) + (double)vector2.X * 0.5 + 10.0);
                                                                                                 num8 = num + num3 * this.focusMenu + 4;
                                                                                             }
                                                                                             if (this.selectedMenu == 5)
                                                                                             {
                                                                                                 Main.PlaySound(11, -1, -1, 1);
                                                                                                 Main.menuMode = 1;
                                                                                             }
                                                                                             else
                                                                                             {
                                                                                                 if (this.selectedMenu >= 0)
                                                                                                 {
                                                                                                     this.selectedPlayer = this.selectedMenu;
                                                                                                     Main.PlaySound(10, -1, -1, 1);
                                                                                                     Main.menuMode = 5;
                                                                                                 }
                                                                                             }
                                                                                         }
                                                                                         else
                                                                                         {
                                                                                             if (Main.menuMode == 5)
                                                                                             {
                                                                                                 array8[0] = "Delete " + Main.loadPlayer[this.selectedPlayer].name + "?";
                                                                                                 array[0] = true;
                                                                                                 array8[1] = "Yes";
                                                                                                 array8[2] = "No";
                                                                                                 num4 = 3;
                                                                                                 if (this.selectedMenu == 1)
                                                                                                 {
                                                                                                     Main.ErasePlayer(this.selectedPlayer);
                                                                                                     Main.PlaySound(10, -1, -1, 1);
                                                                                                     Main.menuMode = 1;
                                                                                                 }
                                                                                                 else
                                                                                                 {
                                                                                                     if (this.selectedMenu == 2)
                                                                                                     {
                                                                                                         Main.PlaySound(11, -1, -1, 1);
                                                                                                         Main.menuMode = 1;
                                                                                                     }
                                                                                                 }
                                                                                             }
                                                                                             else
                                                                                             {
                                                                                                 if (Main.menuMode == 6)
                                                                                                 {
                                                                                                     num = 190;
                                                                                                     num3 = 50;
                                                                                                     array8[5] = "Create World";
                                                                                                     array8[6] = "Delete";
                                                                                                     if (Main.numLoadWorlds == 5)
                                                                                                     {
                                                                                                         array2[5] = true;
                                                                                                         array8[5] = "";
                                                                                                     }
                                                                                                     else
                                                                                                     {
                                                                                                         if (Main.numLoadWorlds == 0)
                                                                                                         {
                                                                                                             array2[6] = true;
                                                                                                             array8[6] = "";
                                                                                                         }
                                                                                                     }
                                                                                                     array8[7] = "Back";
                                                                                                     for (int num13 = 0; num13 < 5; num13++)
                                                                                                     {
                                                                                                         if (num13 < Main.numLoadWorlds)
                                                                                                         {
                                                                                                             array8[num13] = Main.loadWorld[num13];
                                                                                                         }
                                                                                                         else
                                                                                                         {
                                                                                                             array8[num13] = null;
                                                                                                         }
                                                                                                     }
                                                                                                     num4 = 8;
                                                                                                     if (this.selectedMenu == 7)
                                                                                                     {
                                                                                                         if (Main.menuMultiplayer)
                                                                                                         {
                                                                                                             Main.menuMode = 12;
                                                                                                         }
                                                                                                         else
                                                                                                         {
                                                                                                             Main.menuMode = 1;
                                                                                                         }
                                                                                                         Main.PlaySound(11, -1, -1, 1);
                                                                                                     }
                                                                                                     else
                                                                                                     {
                                                                                                         if (this.selectedMenu == 5)
                                                                                                         {
                                                                                                             Main.PlaySound(10, -1, -1, 1);
                                                                                                             Main.menuMode = 16;
                                                                                                             Main.newWorldName = "World " + (Main.numLoadWorlds + 1);
                                                                                                         }
                                                                                                         else
                                                                                                         {
                                                                                                             if (this.selectedMenu == 6)
                                                                                                             {
                                                                                                                 Main.PlaySound(10, -1, -1, 1);
                                                                                                                 Main.menuMode = 8;
                                                                                                             }
                                                                                                             else
                                                                                                             {
                                                                                                                 if (this.selectedMenu >= 0)
                                                                                                                 {
                                                                                                                     if (Main.menuMultiplayer)
                                                                                                                     {
                                                                                                                         Main.PlaySound(10, -1, -1, 1);
                                                                                                                         Main.worldPathName = Main.loadWorldPath[this.selectedMenu];
                                                                                                                         Main.menuMode = 30;
                                                                                                                     }
                                                                                                                     else
                                                                                                                     {
                                                                                                                         Main.PlaySound(10, -1, -1, 1);
                                                                                                                         Main.worldPathName = Main.loadWorldPath[this.selectedMenu];
                                                                                                                         WorldGen.playWorld();
                                                                                                                         Main.menuMode = 10;
                                                                                                                     }
                                                                                                                 }
                                                                                                             }
                                                                                                         }
                                                                                                     }
                                                                                                 }
                                                                                                 else
                                                                                                 {
                                                                                                     if (Main.menuMode == 7)
                                                                                                     {
                                                                                                         string a = Main.newWorldName;
                                                                                                         Main.newWorldName = Main.GetInputText(Main.newWorldName);
                                                                                                         if (Main.newWorldName.Length > 20)
                                                                                                         {
                                                                                                             Main.newWorldName = Main.newWorldName.Substring(0, 20);
                                                                                                         }
                                                                                                         if (a != Main.newWorldName)
                                                                                                         {
                                                                                                             Main.PlaySound(12, -1, -1, 1);
                                                                                                         }
                                                                                                         array8[0] = "Enter World Name:";
                                                                                                         array2[2] = true;
                                                                                                         if (Main.newWorldName != "")
                                                                                                         {
                                                                                                             if (Main.newWorldName.Substring(0, 1) == " ")
                                                                                                             {
                                                                                                                 Main.newWorldName = "";
                                                                                                             }
                                                                                                             for (int num14 = 0; num14 < Main.newWorldName.Length; num14++)
                                                                                                             {
                                                                                                                 if (Main.newWorldName != " ")
                                                                                                                 {
                                                                                                                     array2[2] = false;
                                                                                                                 }
                                                                                                             }
                                                                                                         }
                                                                                                         this.textBlinkerCount++;
                                                                                                         if (this.textBlinkerCount >= 20)
                                                                                                         {
                                                                                                             if (this.textBlinkerState == 0)
                                                                                                             {
                                                                                                                 this.textBlinkerState = 1;
                                                                                                             }
                                                                                                             else
                                                                                                             {
                                                                                                                 this.textBlinkerState = 0;
                                                                                                             }
                                                                                                             this.textBlinkerCount = 0;
                                                                                                         }
                                                                                                         array8[1] = Main.newWorldName;
                                                                                                         if (this.textBlinkerState == 1)
                                                                                                         {
                                                                                                             string[] array9;
                                                                                                             (array9 = array8)[1] = array9[1] + "|";
                                                                                                             array4[1] = 1;
                                                                                                         }
                                                                                                         else
                                                                                                         {
                                                                                                             string[] array9;
                                                                                                             (array9 = array8)[1] = array9[1] + " ";
                                                                                                         }
                                                                                                         array[0] = true;
                                                                                                         array[1] = true;
                                                                                                         array3[1] = -20;
                                                                                                         array3[2] = 20;
                                                                                                         array8[2] = "Accept";
                                                                                                         array8[3] = "Back";
                                                                                                         num4 = 4;
                                                                                                         if (this.selectedMenu == 3)
                                                                                                         {
                                                                                                             Main.PlaySound(11, -1, -1, 1);
                                                                                                             Main.menuMode = 16;
                                                                                                         }
                                                                                                         if (this.selectedMenu == 2 || (!array2[2] && Main.inputTextEnter))
                                                                                                         {
                                                                                                             Main.menuMode = 10;
                                                                                                             Main.worldName = Main.newWorldName;
                                                                                                             Main.worldPathName = Main.nextLoadWorld();
                                                                                                             WorldGen.CreateNewWorld();
                                                                                                         }
                                                                                                     }
                                                                                                     else
                                                                                                     {
                                                                                                         if (Main.menuMode == 8)
                                                                                                         {
                                                                                                             num = 220;
                                                                                                             num3 = 60;
                                                                                                             array8[5] = "Back";
                                                                                                             for (int num15 = 0; num15 < 5; num15++)
                                                                                                             {
                                                                                                                 if (num15 < Main.numLoadWorlds)
                                                                                                                 {
                                                                                                                     array8[num15] = Main.loadWorld[num15];
                                                                                                                 }
                                                                                                                 else
                                                                                                                 {
                                                                                                                     array8[num15] = null;
                                                                                                                 }
                                                                                                             }
                                                                                                             num4 = 6;
                                                                                                             if (this.selectedMenu == 5)
                                                                                                             {
                                                                                                                 Main.PlaySound(11, -1, -1, 1);
                                                                                                                 Main.menuMode = 1;
                                                                                                             }
                                                                                                             else
                                                                                                             {
                                                                                                                 if (this.selectedMenu >= 0)
                                                                                                                 {
                                                                                                                     this.selectedWorld = this.selectedMenu;
                                                                                                                     Main.PlaySound(10, -1, -1, 1);
                                                                                                                     Main.menuMode = 9;
                                                                                                                 }
                                                                                                             }
                                                                                                         }
                                                                                                         else
                                                                                                         {
                                                                                                             if (Main.menuMode == 9)
                                                                                                             {
                                                                                                                 array8[0] = "Delete " + Main.loadWorld[this.selectedWorld] + "?";
                                                                                                                 array[0] = true;
                                                                                                                 array8[1] = "Yes";
                                                                                                                 array8[2] = "No";
                                                                                                                 num4 = 3;
                                                                                                                 if (this.selectedMenu == 1)
                                                                                                                 {
                                                                                                                     Main.EraseWorld(this.selectedWorld);
                                                                                                                     Main.PlaySound(10, -1, -1, 1);
                                                                                                                     Main.menuMode = 6;
                                                                                                                 }
                                                                                                                 else
                                                                                                                 {
                                                                                                                     if (this.selectedMenu == 2)
                                                                                                                     {
                                                                                                                         Main.PlaySound(11, -1, -1, 1);
                                                                                                                         Main.menuMode = 6;
                                                                                                                     }
                                                                                                                 }
                                                                                                             }
                                                                                                             else
                                                                                                             {
                                                                                                                 if (Main.menuMode == 1111)
                                                                                                                 {
                                                                                                                     num = 220;
                                                                                                                     num3 = 50;
                                                                                                                     array3[6] = 10;
                                                                                                                     num4 = 7;
                                                                                                                     if (this.graphics.IsFullScreen)
                                                                                                                     {
                                                                                                                         array8[0] = "Go Windowed";
                                                                                                                     }
                                                                                                                     else
                                                                                                                     {
                                                                                                                         array8[0] = "Go Fullscreen";
                                                                                                                     }
                                                                                                                     this.bgScroll = (int)Math.Round((double)((1f - Main.caveParrallax) * 500f));
                                                                                                                     array8[1] = "Resolution";
                                                                                                                     array8[2] = "Parallax";
                                                                                                                     if (Main.fixedTiming)
                                                                                                                     {
                                                                                                                         array8[3] = "Frame Skip Off (Not Recommended)";
                                                                                                                     }
                                                                                                                     else
                                                                                                                     {
                                                                                                                         array8[3] = "Frame Skip On (Recommended)";
                                                                                                                     }
                                                                                                                     if (Lighting.lightMode == 0)
                                                                                                                     {
                                                                                                                         array8[4] = "Lighting: Microsoft.Xna.Framework.Color";
                                                                                                                     }
                                                                                                                     else
                                                                                                                     {
                                                                                                                         if (Lighting.lightMode == 1)
                                                                                                                         {
                                                                                                                             array8[4] = "Lighting: White";
                                                                                                                         }
                                                                                                                         else
                                                                                                                         {
                                                                                                                             if (Lighting.lightMode == 2)
                                                                                                                             {
                                                                                                                                 array8[4] = "Lighting: Retro";
                                                                                                                             }
                                                                                                                             else
                                                                                                                             {
                                                                                                                                 if (Lighting.lightMode == 3)
                                                                                                                                 {
                                                                                                                                     array8[4] = "Lighting: Trippy";
                                                                                                                                 }
                                                                                                                             }
                                                                                                                         }
                                                                                                                     }
                                                                                                                     if (Main.qaStyle == 0)
                                                                                                                     {
                                                                                                                         array8[5] = "Quality: Auto";
                                                                                                                     }
                                                                                                                     else
                                                                                                                     {
                                                                                                                         if (Main.qaStyle == 1)
                                                                                                                         {
                                                                                                                             array8[5] = "Quality: High";
                                                                                                                         }
                                                                                                                         else
                                                                                                                         {
                                                                                                                             if (Main.qaStyle == 2)
                                                                                                                             {
                                                                                                                                 array8[5] = "Quality: Medium";
                                                                                                                             }
                                                                                                                             else
                                                                                                                             {
                                                                                                                                 array8[5] = "Quality: Low";
                                                                                                                             }
                                                                                                                         }
                                                                                                                     }
                                                                                                                     array8[6] = "Back";
                                                                                                                     if (this.selectedMenu == 6)
                                                                                                                     {
                                                                                                                         Main.PlaySound(11, -1, -1, 1);
                                                                                                                         this.SaveSettings();
                                                                                                                         Main.menuMode = 11;
                                                                                                                     }
                                                                                                                     if (this.selectedMenu == 5)
                                                                                                                     {
                                                                                                                         Main.PlaySound(12, -1, -1, 1);
                                                                                                                         Main.qaStyle++;
                                                                                                                         if (Main.qaStyle > 3)
                                                                                                                         {
                                                                                                                             Main.qaStyle = 0;
                                                                                                                         }
                                                                                                                     }
                                                                                                                     if (this.selectedMenu == 4)
                                                                                                                     {
                                                                                                                         Main.PlaySound(12, -1, -1, 1);
                                                                                                                         Lighting.lightMode++;
                                                                                                                         if (Lighting.lightMode >= 4)
                                                                                                                         {
                                                                                                                             Lighting.lightMode = 0;
                                                                                                                         }
                                                                                                                     }
                                                                                                                     if (this.selectedMenu == 3)
                                                                                                                     {
                                                                                                                         Main.PlaySound(12, -1, -1, 1);
                                                                                                                         if (Main.fixedTiming)
                                                                                                                         {
                                                                                                                             Main.fixedTiming = false;
                                                                                                                         }
                                                                                                                         else
                                                                                                                         {
                                                                                                                             Main.fixedTiming = true;
                                                                                                                         }
                                                                                                                     }
                                                                                                                     if (this.selectedMenu == 2)
                                                                                                                     {
                                                                                                                         Main.PlaySound(11, -1, -1, 1);
                                                                                                                         Main.menuMode = 28;
                                                                                                                     }
                                                                                                                     if (this.selectedMenu == 1)
                                                                                                                     {
                                                                                                                         Main.PlaySound(10, -1, -1, 1);
                                                                                                                         Main.menuMode = 111;
                                                                                                                     }
                                                                                                                     if (this.selectedMenu == 0)
                                                                                                                     {
                                                                                                                         this.graphics.ToggleFullScreen();
                                                                                                                     }
                                                                                                                 }
                                                                                                                 else
                                                                                                                 {
                                                                                                                     if (Main.menuMode == 11)
                                                                                                                     {
                                                                                                                         num = 180;
                                                                                                                         num3 = 48;
                                                                                                                         array3[7] = 10;
                                                                                                                         num4 = 8;
                                                                                                                         array8[0] = "Video";
                                                                                                                         array8[1] = "Cursor Microsoft.Xna.Framework.Color";
                                                                                                                         array8[2] = "Volume";
                                                                                                                         array8[3] = "Controls";
                                                                                                                         if (Main.autoSave)
                                                                                                                         {
                                                                                                                             array8[4] = "Autosave On";
                                                                                                                         }
                                                                                                                         else
                                                                                                                         {
                                                                                                                             array8[4] = "Autosave Off";
                                                                                                                         }
                                                                                                                         if (Main.autoPause)
                                                                                                                         {
                                                                                                                             array8[5] = "Autopause On";
                                                                                                                         }
                                                                                                                         else
                                                                                                                         {
                                                                                                                             array8[5] = "Autopause Off";
                                                                                                                         }
                                                                                                                         if (Main.showItemText)
                                                                                                                         {
                                                                                                                             array8[6] = "Pickup Text On";
                                                                                                                         }
                                                                                                                         else
                                                                                                                         {
                                                                                                                             array8[6] = "Pickup Text Off";
                                                                                                                         }
                                                                                                                         array8[7] = "Back";
                                                                                                                         if (this.selectedMenu == 7)
                                                                                                                         {
                                                                                                                             Main.PlaySound(11, -1, -1, 1);
                                                                                                                             this.SaveSettings();
                                                                                                                             Main.menuMode = 0;
                                                                                                                         }
                                                                                                                         if (this.selectedMenu == 6)
                                                                                                                         {
                                                                                                                             Main.PlaySound(12, -1, -1, 1);
                                                                                                                             if (Main.showItemText)
                                                                                                                             {
                                                                                                                                 Main.showItemText = false;
                                                                                                                             }
                                                                                                                             else
                                                                                                                             {
                                                                                                                                 Main.showItemText = true;
                                                                                                                             }
                                                                                                                         }
                                                                                                                         if (this.selectedMenu == 5)
                                                                                                                         {
                                                                                                                             Main.PlaySound(12, -1, -1, 1);
                                                                                                                             if (Main.autoPause)
                                                                                                                             {
                                                                                                                                 Main.autoPause = false;
                                                                                                                             }
                                                                                                                             else
                                                                                                                             {
                                                                                                                                 Main.autoPause = true;
                                                                                                                             }
                                                                                                                         }
                                                                                                                         if (this.selectedMenu == 4)
                                                                                                                         {
                                                                                                                             Main.PlaySound(12, -1, -1, 1);
                                                                                                                             if (Main.autoSave)
                                                                                                                             {
                                                                                                                                 Main.autoSave = false;
                                                                                                                             }
                                                                                                                             else
                                                                                                                             {
                                                                                                                                 Main.autoSave = true;
                                                                                                                             }
                                                                                                                         }
                                                                                                                         if (this.selectedMenu == 3)
                                                                                                                         {
                                                                                                                             Main.PlaySound(11, -1, -1, 1);
                                                                                                                             Main.menuMode = 27;
                                                                                                                         }
                                                                                                                         if (this.selectedMenu == 2)
                                                                                                                         {
                                                                                                                             Main.PlaySound(11, -1, -1, 1);
                                                                                                                             Main.menuMode = 26;
                                                                                                                         }
                                                                                                                         if (this.selectedMenu == 1)
                                                                                                                         {
                                                                                                                             Main.PlaySound(10, -1, -1, 1);
                                                                                                                             this.selColor = Main.mouseColor;
                                                                                                                             Main.menuMode = 25;
                                                                                                                         }
                                                                                                                         if (this.selectedMenu == 0)
                                                                                                                         {
                                                                                                                             Main.PlaySound(10, -1, -1, 1);
                                                                                                                             Main.menuMode = 1111;
                                                                                                                         }
                                                                                                                     }
                                                                                                                     else
                                                                                                                     {
                                                                                                                         if (Main.menuMode == 111)
                                                                                                                         {
                                                                                                                             num = 240;
                                                                                                                             num3 = 60;
                                                                                                                             num4 = 3;
                                                                                                                             array8[0] = "Fullscreen Resolution";
                                                                                                                             array8[1] = this.graphics.PreferredBackBufferWidth + "x" + this.graphics.PreferredBackBufferHeight;
                                                                                                                             array[0] = true;
                                                                                                                             array3[2] = 170;
                                                                                                                             array3[1] = 10;
                                                                                                                             array8[2] = "Back";
                                                                                                                             if (this.selectedMenu == 1)
                                                                                                                             {
                                                                                                                                 Main.PlaySound(12, -1, -1, 1);
                                                                                                                                 int num16 = 0;
                                                                                                                                 for (int num17 = 0; num17 < this.numDisplayModes; num17++)
                                                                                                                                 {
                                                                                                                                     if (this.displayWidth[num17] == this.graphics.PreferredBackBufferWidth && this.displayHeight[num17] == this.graphics.PreferredBackBufferHeight)
                                                                                                                                     {
                                                                                                                                         num16 = num17;
                                                                                                                                         break;
                                                                                                                                     }
                                                                                                                                 }
                                                                                                                                 num16++;
                                                                                                                                 if (num16 >= this.numDisplayModes)
                                                                                                                                 {
                                                                                                                                     num16 = 0;
                                                                                                                                 }
                                                                                                                                 this.graphics.PreferredBackBufferWidth = this.displayWidth[num16];
                                                                                                                                 this.graphics.PreferredBackBufferHeight = this.displayHeight[num16];
                                                                                                                             }
                                                                                                                             if (this.selectedMenu == 2)
                                                                                                                             {
                                                                                                                                 if (this.graphics.IsFullScreen)
                                                                                                                                 {
                                                                                                                                     this.graphics.ApplyChanges();
                                                                                                                                 }
                                                                                                                                 Main.menuMode = 1111;
                                                                                                                                 Main.PlaySound(11, -1, -1, 1);
                                                                                                                             }
                                                                                                                         }
                                                                                                                         else
                                                                                                                         {
                                                                                                                             if (Main.menuMode == 25)
                                                                                                                             {
                                                                                                                                 flag = true;
                                                                                                                                 num9 = 370;
                                                                                                                                 num = 240;
                                                                                                                                 num3 = 60;
                                                                                                                                 Main.mouseColor = this.selColor;
                                                                                                                                 num4 = 3;
                                                                                                                                 array8[0] = "";
                                                                                                                                 array8[1] = "Cursor Microsoft.Xna.Framework.Color";
                                                                                                                                 array[1] = true;
                                                                                                                                 array3[2] = 170;
                                                                                                                                 array3[1] = 10;
                                                                                                                                 array8[2] = "Back";
                                                                                                                                 if (this.selectedMenu == 2)
                                                                                                                                 {
                                                                                                                                     Main.menuMode = 11;
                                                                                                                                     Main.PlaySound(11, -1, -1, 1);
                                                                                                                                 }
                                                                                                                             }
                                                                                                                             else
                                                                                                                             {
                                                                                                                                 if (Main.menuMode == 26)
                                                                                                                                 {
                                                                                                                                     flag2 = true;
                                                                                                                                     num = 240;
                                                                                                                                     num3 = 60;
                                                                                                                                     num4 = 3;
                                                                                                                                     array8[0] = "";
                                                                                                                                     array8[1] = "Volume";
                                                                                                                                     array[1] = true;
                                                                                                                                     array3[2] = 170;
                                                                                                                                     array3[1] = 10;
                                                                                                                                     array8[2] = "Back";
                                                                                                                                     if (this.selectedMenu == 2)
                                                                                                                                     {
                                                                                                                                         Main.menuMode = 11;
                                                                                                                                         Main.PlaySound(11, -1, -1, 1);
                                                                                                                                     }
                                                                                                                                 }
                                                                                                                                 else
                                                                                                                                 {
                                                                                                                                     if (Main.menuMode == 28)
                                                                                                                                     {
                                                                                                                                         Main.caveParrallax = 1f - (float)this.bgScroll / 500f;
                                                                                                                                         flag3 = true;
                                                                                                                                         num = 240;
                                                                                                                                         num3 = 60;
                                                                                                                                         num4 = 3;
                                                                                                                                         array8[0] = "";
                                                                                                                                         array8[1] = "Parallax";
                                                                                                                                         array[1] = true;
                                                                                                                                         array3[2] = 170;
                                                                                                                                         array3[1] = 10;
                                                                                                                                         array8[2] = "Back";
                                                                                                                                         if (this.selectedMenu == 2)
                                                                                                                                         {
                                                                                                                                             Main.menuMode = 1111;
                                                                                                                                             Main.PlaySound(11, -1, -1, 1);
                                                                                                                                         }
                                                                                                                                     }
                                                                                                                                     else
                                                                                                                                     {
                                                                                                                                         if (Main.menuMode == 27)
                                                                                                                                         {
                                                                                                                                             num = 176;
                                                                                                                                             num3 = 28;
                                                                                                                                             num4 = 14;
                                                                                                                                             string[] array10 = new string[]
                                                                                                                                             {
                                                                                                                                                 Main.cUp,
                                                                                                                                                 Main.cDown,
                                                                                                                                                 Main.cLeft,
                                                                                                                                                 Main.cRight,
                                                                                                                                                 Main.cJump,
                                                                                                                                                 Main.cThrowItem,
                                                                                                                                                 Main.cInv,
                                                                                                                                                 Main.cHeal,
                                                                                                                                                 Main.cMana,
                                                                                                                                                 Main.cBuff,
                                                                                                                                                 Main.cHook,
                                                                                                                                                 Main.cTorch
                                                                                                                                             };
                                                                                                                                             if (this.setKey >= 0)
                                                                                                                                             {
                                                                                                                                                 array10[this.setKey] = "_";
                                                                                                                                             }
                                                                                                                                             array8[0] = "Up             " + array10[0];
                                                                                                                                             array8[1] = "Down          " + array10[1];
                                                                                                                                             array8[2] = "Left            " + array10[2];
                                                                                                                                             array8[3] = "Right          " + array10[3];
                                                                                                                                             array8[4] = "Jump          " + array10[4];
                                                                                                                                             array8[5] = "Throw         " + array10[5];
                                                                                                                                             array8[6] = "Inventory      " + array10[6];
                                                                                                                                             array8[7] = "Quick Heal    " + array10[7];
                                                                                                                                             array8[8] = "Quick Mana   " + array10[8];
                                                                                                                                             array8[9] = "Quick Buff    " + array10[9];
                                                                                                                                             array8[10] = "Grapple        " + array10[10];
                                                                                                                                             array8[11] = "Auto Select    " + array10[11];
                                                                                                                                             for (int num18 = 0; num18 < 12; num18++)
                                                                                                                                             {
                                                                                                                                                 array7[num18] = true;
                                                                                                                                                 array6[num18] = 0.55f;
                                                                                                                                                 array4[num18] = -80;
                                                                                                                                             }
                                                                                                                                             array6[12] = 0.8f;
                                                                                                                                             array6[13] = 0.8f;
                                                                                                                                             array3[12] = 6;
                                                                                                                                             array8[12] = "Reset to Default";
                                                                                                                                             array3[13] = 16;
                                                                                                                                             array8[13] = "Back";
                                                                                                                                             if (this.selectedMenu == 13)
                                                                                                                                             {
                                                                                                                                                 Main.menuMode = 11;
                                                                                                                                                 Main.PlaySound(11, -1, -1, 1);
                                                                                                                                             }
                                                                                                                                             else
                                                                                                                                             {
                                                                                                                                                 if (this.selectedMenu == 12)
                                                                                                                                                 {
                                                                                                                                                     Main.cUp = "W";
                                                                                                                                                     Main.cDown = "S";
                                                                                                                                                     Main.cLeft = "A";
                                                                                                                                                     Main.cRight = "D";
                                                                                                                                                     Main.cJump = "Space";
                                                                                                                                                     Main.cThrowItem = "T";
                                                                                                                                                     Main.cInv = "Escape";
                                                                                                                                                     Main.cHeal = "H";
                                                                                                                                                     Main.cMana = "M";
                                                                                                                                                     Main.cBuff = "B";
                                                                                                                                                     Main.cHook = "E";
                                                                                                                                                     Main.cTorch = "LeftShift";
                                                                                                                                                     this.setKey = -1;
                                                                                                                                                     Main.PlaySound(11, -1, -1, 1);
                                                                                                                                                 }
                                                                                                                                                 else
                                                                                                                                                 {
                                                                                                                                                     if (this.selectedMenu >= 0)
                                                                                                                                                     {
                                                                                                                                                         this.setKey = this.selectedMenu;
                                                                                                                                                     }
                                                                                                                                                 }
                                                                                                                                             }
                                                                                                                                             if (this.setKey >= 0)
                                                                                                                                             {
                                                                                                                                                 Keys[] pressedKeys = Main.keyState.GetPressedKeys();
                                                                                                                                                 if (pressedKeys.Length > 0)
                                                                                                                                                 {
                                                                                                                                                     string text = string.Concat(pressedKeys[0]);
                                                                                                                                                     if (this.setKey == 0)
                                                                                                                                                     {
                                                                                                                                                         Main.cUp = text;
                                                                                                                                                     }
                                                                                                                                                     if (this.setKey == 1)
                                                                                                                                                     {
                                                                                                                                                         Main.cDown = text;
                                                                                                                                                     }
                                                                                                                                                     if (this.setKey == 2)
                                                                                                                                                     {
                                                                                                                                                         Main.cLeft = text;
                                                                                                                                                     }
                                                                                                                                                     if (this.setKey == 3)
                                                                                                                                                     {
                                                                                                                                                         Main.cRight = text;
                                                                                                                                                     }
                                                                                                                                                     if (this.setKey == 4)
                                                                                                                                                     {
                                                                                                                                                         Main.cJump = text;
                                                                                                                                                     }
                                                                                                                                                     if (this.setKey == 5)
                                                                                                                                                     {
                                                                                                                                                         Main.cThrowItem = text;
                                                                                                                                                     }
                                                                                                                                                     if (this.setKey == 6)
                                                                                                                                                     {
                                                                                                                                                         Main.cInv = text;
                                                                                                                                                     }
                                                                                                                                                     if (this.setKey == 7)
                                                                                                                                                     {
                                                                                                                                                         Main.cHeal = text;
                                                                                                                                                     }
                                                                                                                                                     if (this.setKey == 8)
                                                                                                                                                     {
                                                                                                                                                         Main.cMana = text;
                                                                                                                                                     }
                                                                                                                                                     if (this.setKey == 9)
                                                                                                                                                     {
                                                                                                                                                         Main.cBuff = text;
                                                                                                                                                     }
                                                                                                                                                     if (this.setKey == 10)
                                                                                                                                                     {
                                                                                                                                                         Main.cHook = text;
                                                                                                                                                     }
                                                                                                                                                     if (this.setKey == 11)
                                                                                                                                                     {
                                                                                                                                                         Main.cTorch = text;
                                                                                                                                                     }
                                                                                                                                                     this.setKey = -1;
                                                                                                                                                 }
                                                                                                                                             }
                                                                                                                                         }
                                                                                                                                         else
                                                                                                                                         {
                                                                                                                                             if (Main.menuMode == 12)
                                                                                                                                             {
                                                                                                                                                 Main.menuServer = false;
                                                                                                                                                 array8[0] = "Join";
                                                                                                                                                 array8[1] = "Host & Play";
                                                                                                                                                 array8[2] = "Back";
                                                                                                                                                 if (this.selectedMenu == 0)
                                                                                                                                                 {
                                                                                                                                                     Main.LoadPlayers();
                                                                                                                                                     Main.menuMultiplayer = true;
                                                                                                                                                     Main.PlaySound(10, -1, -1, 1);
                                                                                                                                                     Main.menuMode = 1;
                                                                                                                                                 }
                                                                                                                                                 else
                                                                                                                                                 {
                                                                                                                                                     if (this.selectedMenu == 1)
                                                                                                                                                     {
                                                                                                                                                         Main.LoadPlayers();
                                                                                                                                                         Main.PlaySound(10, -1, -1, 1);
                                                                                                                                                         Main.menuMode = 1;
                                                                                                                                                         Main.menuMultiplayer = true;
                                                                                                                                                         Main.menuServer = true;
                                                                                                                                                     }
                                                                                                                                                 }
                                                                                                                                                 if (this.selectedMenu == 2)
                                                                                                                                                 {
                                                                                                                                                     Main.PlaySound(11, -1, -1, 1);
                                                                                                                                                     Main.menuMode = 0;
                                                                                                                                                 }
                                                                                                                                                 num4 = 3;
                                                                                                                                             }
                                                                                                                                             else
                                                                                                                                             {
                                                                                                                                                 if (Main.menuMode == 13)
                                                                                                                                                 {
                                                                                                                                                     string a2 = Main.getIP;
                                                                                                                                                     Main.getIP = Main.GetInputText(Main.getIP);
                                                                                                                                                     if (a2 != Main.getIP)
                                                                                                                                                     {
                                                                                                                                                         Main.PlaySound(12, -1, -1, 1);
                                                                                                                                                     }
                                                                                                                                                     array8[0] = "Enter Server IP Address:";
                                                                                                                                                     array2[9] = true;
                                                                                                                                                     if (Main.getIP != "")
                                                                                                                                                     {
                                                                                                                                                         if (Main.getIP.Substring(0, 1) == " ")
                                                                                                                                                         {
                                                                                                                                                             Main.getIP = "";
                                                                                                                                                         }
                                                                                                                                                         for (int num19 = 0; num19 < Main.getIP.Length; num19++)
                                                                                                                                                         {
                                                                                                                                                             if (Main.getIP != " ")
                                                                                                                                                             {
                                                                                                                                                                 array2[9] = false;
                                                                                                                                                             }
                                                                                                                                                         }
                                                                                                                                                     }
                                                                                                                                                     this.textBlinkerCount++;
                                                                                                                                                     if (this.textBlinkerCount >= 20)
                                                                                                                                                     {
                                                                                                                                                         if (this.textBlinkerState == 0)
                                                                                                                                                         {
                                                                                                                                                             this.textBlinkerState = 1;
                                                                                                                                                         }
                                                                                                                                                         else
                                                                                                                                                         {
                                                                                                                                                             this.textBlinkerState = 0;
                                                                                                                                                         }
                                                                                                                                                         this.textBlinkerCount = 0;
                                                                                                                                                     }
                                                                                                                                                     array8[1] = Main.getIP;
                                                                                                                                                     if (this.textBlinkerState == 1)
                                                                                                                                                     {
                                                                                                                                                         string[] array9;
                                                                                                                                                         (array9 = array8)[1] = array9[1] + "|";
                                                                                                                                                         array4[1] = 1;
                                                                                                                                                     }
                                                                                                                                                     else
                                                                                                                                                     {
                                                                                                                                                         string[] array9;
                                                                                                                                                         (array9 = array8)[1] = array9[1] + " ";
                                                                                                                                                     }
                                                                                                                                                     array[0] = true;
                                                                                                                                                     array[1] = true;
                                                                                                                                                     array3[9] = 44;
                                                                                                                                                     array3[10] = 64;
                                                                                                                                                     array8[9] = "Accept";
                                                                                                                                                     array8[10] = "Back";
                                                                                                                                                     num4 = 11;
                                                                                                                                                     num = 180;
                                                                                                                                                     num3 = 30;
                                                                                                                                                     array3[1] = 19;
                                                                                                                                                     for (int num20 = 2; num20 < 9; num20++)
                                                                                                                                                     {
                                                                                                                                                         int num21 = num20 - 2;
                                                                                                                                                         if (Main.recentWorld[num21] != null && Main.recentWorld[num21] != "")
                                                                                                                                                         {
                                                                                                                                                             array8[num20] = string.Concat(new object[]
                                                                                                                                                             {
                                                                                                                                                                 Main.recentWorld[num21],
                                                                                                                                                                 " (",
                                                                                                                                                                 Main.recentIP[num21],
                                                                                                                                                                 ":",
                                                                                                                                                                 Main.recentPort[num21],
                                                                                                                                                                 ")"
                                                                                                                                                             });
                                                                                                                                                         }
                                                                                                                                                         else
                                                                                                                                                         {
                                                                                                                                                             array8[num20] = "";
                                                                                                                                                             array[num20] = true;
                                                                                                                                                         }
                                                                                                                                                         array6[num20] = 0.6f;
                                                                                                                                                         array3[num20] = 40;
                                                                                                                                                     }
                                                                                                                                                     if (this.selectedMenu >= 2 && this.selectedMenu < 9)
                                                                                                                                                     {
                                                                                                                                                         Main.autoPass = false;
                                                                                                                                                         int num22 = this.selectedMenu - 2;
                                                                                                                                                         Netplay.serverPort = Main.recentPort[num22];
                                                                                                                                                         Main.getIP = Main.recentIP[num22];
                                                                                                                                                         if (Netplay.SetIP(Main.getIP))
                                                                                                                                                         {
                                                                                                                                                             Main.menuMode = 10;
                                                                                                                                                             Netplay.StartClient();
                                                                                                                                                         }
                                                                                                                                                         else
                                                                                                                                                         {
                                                                                                                                                             if (Netplay.SetIP2(Main.getIP))
                                                                                                                                                             {
                                                                                                                                                                 Main.menuMode = 10;
                                                                                                                                                                 Netplay.StartClient();
                                                                                                                                                             }
                                                                                                                                                         }
                                                                                                                                                     }
                                                                                                                                                     if (this.selectedMenu == 10)
                                                                                                                                                     {
                                                                                                                                                         Main.PlaySound(11, -1, -1, 1);
                                                                                                                                                         Main.menuMode = 1;
                                                                                                                                                     }
                                                                                                                                                     if (this.selectedMenu == 9 || (!array2[2] && Main.inputTextEnter))
                                                                                                                                                     {
                                                                                                                                                         Main.PlaySound(12, -1, -1, 1);
                                                                                                                                                         Main.menuMode = 131;
                                                                                                                                                     }
                                                                                                                                                 }
                                                                                                                                                 else
                                                                                                                                                 {
                                                                                                                                                     if (Main.menuMode == 131)
                                                                                                                                                     {
                                                                                                                                                         int num23 = 7777;
                                                                                                                                                         string a3 = Main.getPort;
                                                                                                                                                         Main.getPort = Main.GetInputText(Main.getPort);
                                                                                                                                                         if (a3 != Main.getPort)
                                                                                                                                                         {
                                                                                                                                                             Main.PlaySound(12, -1, -1, 1);
                                                                                                                                                         }
                                                                                                                                                         array8[0] = "Enter Server Port:";
                                                                                                                                                         array2[2] = true;
                                                                                                                                                         if (Main.getPort != "")
                                                                                                                                                         {
                                                                                                                                                             bool flag5 = false;
                                                                                                                                                             try
                                                                                                                                                             {
                                                                                                                                                                 num23 = Convert.ToInt32(Main.getPort);
                                                                                                                                                                 if (num23 > 0 && num23 <= 65535)
                                                                                                                                                                 {
                                                                                                                                                                     flag5 = true;
                                                                                                                                                                 }
                                                                                                                                                             }
                                                                                                                                                             catch
                                                                                                                                                             {
                                                                                                                                                             }
                                                                                                                                                             if (flag5)
                                                                                                                                                             {
                                                                                                                                                                 array2[2] = false;
                                                                                                                                                             }
                                                                                                                                                         }
                                                                                                                                                         this.textBlinkerCount++;
                                                                                                                                                         if (this.textBlinkerCount >= 20)
                                                                                                                                                         {
                                                                                                                                                             if (this.textBlinkerState == 0)
                                                                                                                                                             {
                                                                                                                                                                 this.textBlinkerState = 1;
                                                                                                                                                             }
                                                                                                                                                             else
                                                                                                                                                             {
                                                                                                                                                                 this.textBlinkerState = 0;
                                                                                                                                                             }
                                                                                                                                                             this.textBlinkerCount = 0;
                                                                                                                                                         }
                                                                                                                                                         array8[1] = Main.getPort;
                                                                                                                                                         if (this.textBlinkerState == 1)
                                                                                                                                                         {
                                                                                                                                                             string[] array9;
                                                                                                                                                             (array9 = array8)[1] = array9[1] + "|";
                                                                                                                                                             array4[1] = 1;
                                                                                                                                                         }
                                                                                                                                                         else
                                                                                                                                                         {
                                                                                                                                                             string[] array9;
                                                                                                                                                             (array9 = array8)[1] = array9[1] + " ";
                                                                                                                                                         }
                                                                                                                                                         array[0] = true;
                                                                                                                                                         array[1] = true;
                                                                                                                                                         array3[1] = -20;
                                                                                                                                                         array3[2] = 20;
                                                                                                                                                         array8[2] = "Accept";
                                                                                                                                                         array8[3] = "Back";
                                                                                                                                                         num4 = 4;
                                                                                                                                                         if (this.selectedMenu == 3)
                                                                                                                                                         {
                                                                                                                                                             Main.PlaySound(11, -1, -1, 1);
                                                                                                                                                             Main.menuMode = 1;
                                                                                                                                                         }
                                                                                                                                                         if (this.selectedMenu == 2 || (!array2[2] && Main.inputTextEnter))
                                                                                                                                                         {
                                                                                                                                                             Netplay.serverPort = num23;
                                                                                                                                                             Main.autoPass = false;
                                                                                                                                                             if (Netplay.SetIP(Main.getIP))
                                                                                                                                                             {
                                                                                                                                                                 Main.menuMode = 10;
                                                                                                                                                                 Netplay.StartClient();
                                                                                                                                                             }
                                                                                                                                                             else
                                                                                                                                                             {
                                                                                                                                                                 if (Netplay.SetIP2(Main.getIP))
                                                                                                                                                                 {
                                                                                                                                                                     Main.menuMode = 10;
                                                                                                                                                                     Netplay.StartClient();
                                                                                                                                                                 }
                                                                                                                                                             }
                                                                                                                                                         }
                                                                                                                                                     }
                                                                                                                                                     else
                                                                                                                                                     {
                                                                                                                                                         if (Main.menuMode == 16)
                                                                                                                                                         {
                                                                                                                                                             num = 200;
                                                                                                                                                             num3 = 60;
                                                                                                                                                             array3[1] = 30;
                                                                                                                                                             array3[2] = 30;
                                                                                                                                                             array3[3] = 30;
                                                                                                                                                             array3[4] = 70;
                                                                                                                                                             array8[0] = "Choose world size:";
                                                                                                                                                             array[0] = true;
                                                                                                                                                             array8[1] = "Small";
                                                                                                                                                             array8[2] = "Medium";
                                                                                                                                                             array8[3] = "Large";
                                                                                                                                                             array8[4] = "Back";
                                                                                                                                                             num4 = 5;
                                                                                                                                                             if (this.selectedMenu == 4)
                                                                                                                                                             {
                                                                                                                                                                 Main.menuMode = 6;
                                                                                                                                                                 Main.PlaySound(11, -1, -1, 1);
                                                                                                                                                             }
                                                                                                                                                             else
                                                                                                                                                             {
                                                                                                                                                                 if (this.selectedMenu > 0)
                                                                                                                                                                 {
                                                                                                                                                                     if (this.selectedMenu == 1)
                                                                                                                                                                     {
                                                                                                                                                                         Main.maxTilesX = 4200;
                                                                                                                                                                         Main.maxTilesY = 1200;
                                                                                                                                                                     }
                                                                                                                                                                     else
                                                                                                                                                                     {
                                                                                                                                                                         if (this.selectedMenu == 2)
                                                                                                                                                                         {
                                                                                                                                                                             Main.maxTilesX = 6400;
                                                                                                                                                                             Main.maxTilesY = 1800;
                                                                                                                                                                         }
                                                                                                                                                                         else
                                                                                                                                                                         {
                                                                                                                                                                             Main.maxTilesX = 8400;
                                                                                                                                                                             Main.maxTilesY = 2400;
                                                                                                                                                                         }
                                                                                                                                                                     }
                                                                                                                                                                     Main.menuMode = 7;
                                                                                                                                                                     Main.PlaySound(10, -1, -1, 1);
                                                                                                                                                                     WorldGen.setWorldSize();
                                                                                                                                                                 }
                                                                                                                                                             }
                                                                                                                                                         }
                                                                                                                                                     }
                                                                                                                                                 }
                                                                                                                                             }
                                                                                                                                         }
                                                                                                                                     }
                                                                                                                                 }
                                                                                                                             }
                                                                                                                         }
                                                                                                                     }
                                                                                                                 }
                                                                                                             }
                                                                                                         }
                                                                                                     }
                                                                                                 }
                                                                                             }
                                                                                         }
                                                                                     }
                                                                                 }
                                                                             }
                                                                         }
                                                                     }
                                                                 }
                                                             }
                                                         }
                                                     }
                                                 }
                                             }
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     IL_3687:
     if (Main.menuMode != num5)
     {
         num4 = 0;
         for (int num24 = 0; num24 < Main.maxMenuItems; num24++)
         {
             this.menuItemScale[num24] = 0.8f;
         }
     }
     int num25 = this.focusMenu;
     this.selectedMenu = -1;
     this.selectedMenu2 = -1;
     this.focusMenu = -1;
     Microsoft.Xna.Framework.Vector2 origin;
     for (int num26 = 0; num26 < num4; num26++)
     {
         if (array8[num26] != null)
         {
             if (flag)
             {
                 string text2 = "";
                 for (int num27 = 0; num27 < 6; num27++)
                 {
                     int num28 = num9;
                     int num29 = 370 + Main.screenWidth / 2 - 400;
                     if (num27 == 0)
                     {
                         text2 = "Red:";
                     }
                     if (num27 == 1)
                     {
                         text2 = "Green:";
                         num28 += 30;
                     }
                     if (num27 == 2)
                     {
                         text2 = "Blue:";
                         num28 += 60;
                     }
                     if (num27 == 3)
                     {
                         text2 = string.Concat(this.selColor.R);
                         num29 += 90;
                     }
                     if (num27 == 4)
                     {
                         text2 = string.Concat(this.selColor.G);
                         num29 += 90;
                         num28 += 30;
                     }
                     if (num27 == 5)
                     {
                         text2 = string.Concat(this.selColor.B);
                         num29 += 90;
                         num28 += 60;
                     }
                     for (int num30 = 0; num30 < 5; num30++)
                     {
                         Microsoft.Xna.Framework.Color color4 = Microsoft.Xna.Framework.Color.Black;
                         if (num30 == 4)
                         {
                             color4 = color;
                             color4.R = (byte)((255 + color4.R) / 2);
                             color4.G = (byte)((255 + color4.R) / 2);
                             color4.B = (byte)((255 + color4.R) / 2);
                         }
                         int num31 = 255;
                         int num32 = (int)color4.R - (255 - num31);
                         if (num32 < 0)
                         {
                             num32 = 0;
                         }
                         color4 = new Microsoft.Xna.Framework.Color((int)((byte)num32), (int)((byte)num32), (int)((byte)num32), (int)((byte)num31));
                         int num33 = 0;
                         int num34 = 0;
                         if (num30 == 0)
                         {
                             num33 = -2;
                         }
                         if (num30 == 1)
                         {
                             num33 = 2;
                         }
                         if (num30 == 2)
                         {
                             num34 = -2;
                         }
                         if (num30 == 3)
                         {
                             num34 = 2;
                         }
                         SpriteBatch arg_38AC_0 = this.spriteBatch;
                         SpriteFont arg_38AC_1 = Main.fontDeathText;
                         string arg_38AC_2 = text2;
                         Microsoft.Xna.Framework.Vector2 arg_38AC_3 = new Microsoft.Xna.Framework.Vector2((float)(num29 + num33), (float)(num28 + num34));
                         Microsoft.Xna.Framework.Color arg_38AC_4 = color4;
                         float arg_38AC_5 = 0f;
                         origin = default(Microsoft.Xna.Framework.Vector2);
                         arg_38AC_0.DrawString(arg_38AC_1, arg_38AC_2, arg_38AC_3, arg_38AC_4, arg_38AC_5, origin, 0.5f, SpriteEffects.None, 0f);
                     }
                 }
                 bool flag6 = false;
                 for (int num35 = 0; num35 < 2; num35++)
                 {
                     for (int num36 = 0; num36 < 3; num36++)
                     {
                         int num37 = num9 + num36 * 30 - 12;
                         int num38 = 360 + Main.screenWidth / 2 - 400;
                         float scale = 0.9f;
                         if (num35 == 0)
                         {
                             num38 -= 70;
                             num37 += 2;
                         }
                         else
                         {
                             num38 -= 40;
                         }
                         text2 = "-";
                         if (num35 == 1)
                         {
                             text2 = "+";
                         }
                         Microsoft.Xna.Framework.Vector2 vector3 = new Microsoft.Xna.Framework.Vector2(24f, 24f);
                         int num39 = 142;
                         if (Main.mouseX > num38 && (float)Main.mouseX < (float)num38 + vector3.X && Main.mouseY > num37 + 13 && (float)Main.mouseY < (float)(num37 + 13) + vector3.Y)
                         {
                             if (this.focusColor != (num35 + 1) * (num36 + 10))
                             {
                                 Main.PlaySound(12, -1, -1, 1);
                             }
                             this.focusColor = (num35 + 1) * (num36 + 10);
                             flag6 = true;
                             num39 = 255;
                             if (Main.mouseLeft)
                             {
                                 if (this.colorDelay <= 1)
                                 {
                                     if (this.colorDelay == 0)
                                     {
                                         this.colorDelay = 40;
                                     }
                                     else
                                     {
                                         this.colorDelay = 3;
                                     }
                                     int num40 = num35;
                                     if (num35 == 0)
                                     {
                                         num40 = -1;
                                         if (this.selColor.R + this.selColor.G + this.selColor.B <= 150)
                                         {
                                             num40 = 0;
                                         }
                                     }
                                     if (num36 == 0 && (int)this.selColor.R + num40 >= 0 && (int)this.selColor.R + num40 <= 255)
                                     {
                                         this.selColor.R = (byte)((int)this.selColor.R + num40);
                                     }
                                     if (num36 == 1 && (int)this.selColor.G + num40 >= 0 && (int)this.selColor.G + num40 <= 255)
                                     {
                                         this.selColor.G = (byte)((int)this.selColor.G + num40);
                                     }
                                     if (num36 == 2 && (int)this.selColor.B + num40 >= 0 && (int)this.selColor.B + num40 <= 255)
                                     {
                                         this.selColor.B = (byte)((int)this.selColor.B + num40);
                                     }
                                 }
                                 this.colorDelay--;
                             }
                             else
                             {
                                 this.colorDelay = 0;
                             }
                         }
                         for (int num41 = 0; num41 < 5; num41++)
                         {
                             Microsoft.Xna.Framework.Color color5 = Microsoft.Xna.Framework.Color.Black;
                             if (num41 == 4)
                             {
                                 color5 = color;
                                 color5.R = (byte)((255 + color5.R) / 2);
                                 color5.G = (byte)((255 + color5.R) / 2);
                                 color5.B = (byte)((255 + color5.R) / 2);
                             }
                             int num42 = (int)color5.R - (255 - num39);
                             if (num42 < 0)
                             {
                                 num42 = 0;
                             }
                             color5 = new Microsoft.Xna.Framework.Color((int)((byte)num42), (int)((byte)num42), (int)((byte)num42), (int)((byte)num39));
                             int num43 = 0;
                             int num44 = 0;
                             if (num41 == 0)
                             {
                                 num43 = -2;
                             }
                             if (num41 == 1)
                             {
                                 num43 = 2;
                             }
                             if (num41 == 2)
                             {
                                 num44 = -2;
                             }
                             if (num41 == 3)
                             {
                                 num44 = 2;
                             }
                             SpriteBatch arg_3C01_0 = this.spriteBatch;
                             SpriteFont arg_3C01_1 = Main.fontDeathText;
                             string arg_3C01_2 = text2;
                             Microsoft.Xna.Framework.Vector2 arg_3C01_3 = new Microsoft.Xna.Framework.Vector2((float)(num38 + num43), (float)(num37 + num44));
                             Microsoft.Xna.Framework.Color arg_3C01_4 = color5;
                             float arg_3C01_5 = 0f;
                             origin = default(Microsoft.Xna.Framework.Vector2);
                             arg_3C01_0.DrawString(arg_3C01_1, arg_3C01_2, arg_3C01_3, arg_3C01_4, arg_3C01_5, origin, scale, SpriteEffects.None, 0f);
                         }
                     }
                 }
                 if (!flag6)
                 {
                     this.focusColor = 0;
                     this.colorDelay = 0;
                 }
             }
             if (flag3)
             {
                 int num45 = 400;
                 string text3 = "";
                 for (int num46 = 0; num46 < 4; num46++)
                 {
                     int num47 = num45;
                     int num48 = 370 + Main.screenWidth / 2 - 400;
                     if (num46 == 0)
                     {
                         text3 = "Parallax: " + this.bgScroll;
                     }
                     for (int num49 = 0; num49 < 5; num49++)
                     {
                         Microsoft.Xna.Framework.Color color6 = Microsoft.Xna.Framework.Color.Black;
                         if (num49 == 4)
                         {
                             color6 = color;
                             color6.R = (byte)((255 + color6.R) / 2);
                             color6.G = (byte)((255 + color6.R) / 2);
                             color6.B = (byte)((255 + color6.R) / 2);
                         }
                         int num50 = 255;
                         int num51 = (int)color6.R - (255 - num50);
                         if (num51 < 0)
                         {
                             num51 = 0;
                         }
                         color6 = new Microsoft.Xna.Framework.Color((int)((byte)num51), (int)((byte)num51), (int)((byte)num51), (int)((byte)num50));
                         int num52 = 0;
                         int num53 = 0;
                         if (num49 == 0)
                         {
                             num52 = -2;
                         }
                         if (num49 == 1)
                         {
                             num52 = 2;
                         }
                         if (num49 == 2)
                         {
                             num53 = -2;
                         }
                         if (num49 == 3)
                         {
                             num53 = 2;
                         }
                         SpriteBatch arg_3D84_0 = this.spriteBatch;
                         SpriteFont arg_3D84_1 = Main.fontDeathText;
                         string arg_3D84_2 = text3;
                         Microsoft.Xna.Framework.Vector2 arg_3D84_3 = new Microsoft.Xna.Framework.Vector2((float)(num48 + num52), (float)(num47 + num53));
                         Microsoft.Xna.Framework.Color arg_3D84_4 = color6;
                         float arg_3D84_5 = 0f;
                         origin = default(Microsoft.Xna.Framework.Vector2);
                         arg_3D84_0.DrawString(arg_3D84_1, arg_3D84_2, arg_3D84_3, arg_3D84_4, arg_3D84_5, origin, 0.5f, SpriteEffects.None, 0f);
                     }
                 }
                 bool flag7 = false;
                 for (int num54 = 0; num54 < 2; num54++)
                 {
                     for (int num55 = 0; num55 < 1; num55++)
                     {
                         int num56 = num45 + num55 * 30 - 12;
                         int num57 = 360 + Main.screenWidth / 2 - 400;
                         float scale2 = 0.9f;
                         if (num54 == 0)
                         {
                             num57 -= 70;
                             num56 += 2;
                         }
                         else
                         {
                             num57 -= 40;
                         }
                         text3 = "-";
                         if (num54 == 1)
                         {
                             text3 = "+";
                         }
                         Microsoft.Xna.Framework.Vector2 vector4 = new Microsoft.Xna.Framework.Vector2(24f, 24f);
                         int num58 = 142;
                         if (Main.mouseX > num57 && (float)Main.mouseX < (float)num57 + vector4.X && Main.mouseY > num56 + 13 && (float)Main.mouseY < (float)(num56 + 13) + vector4.Y)
                         {
                             if (this.focusColor != (num54 + 1) * (num55 + 10))
                             {
                                 Main.PlaySound(12, -1, -1, 1);
                             }
                             this.focusColor = (num54 + 1) * (num55 + 10);
                             flag7 = true;
                             num58 = 255;
                             if (Main.mouseLeft)
                             {
                                 if (this.colorDelay <= 1)
                                 {
                                     if (this.colorDelay == 0)
                                     {
                                         this.colorDelay = 40;
                                     }
                                     else
                                     {
                                         this.colorDelay = 3;
                                     }
                                     int num59 = (int?)num54 ?? -1;
                                     if (num55 == 0)
                                     {
                                         this.bgScroll += num59;
                                         if (this.bgScroll > 100)
                                         {
                                             this.bgScroll = 100;
                                         }
                                         if (this.bgScroll < 0)
                                         {
                                             this.bgScroll = 0;
                                         }
                                     }
                                 }
                                 this.colorDelay--;
                             }
                             else
                             {
                                 this.colorDelay = 0;
                             }
                         }
                         for (int num60 = 0; num60 < 5; num60++)
                         {
                             Microsoft.Xna.Framework.Color color7 = Microsoft.Xna.Framework.Color.Black;
                             if (num60 == 4)
                             {
                                 color7 = color;
                                 color7.R = (byte)((255 + color7.R) / 2);
                                 color7.G = (byte)((255 + color7.R) / 2);
                                 color7.B = (byte)((255 + color7.R) / 2);
                             }
                             int num61 = (int)color7.R - (255 - num58);
                             if (num61 < 0)
                             {
                                 num61 = 0;
                             }
                             color7 = new Microsoft.Xna.Framework.Color((int)((byte)num61), (int)((byte)num61), (int)((byte)num61), (int)((byte)num58));
                             int num62 = 0;
                             int num63 = 0;
                             if (num60 == 0)
                             {
                                 num62 = -2;
                             }
                             if (num60 == 1)
                             {
                                 num62 = 2;
                             }
                             if (num60 == 2)
                             {
                                 num63 = -2;
                             }
                             if (num60 == 3)
                             {
                                 num63 = 2;
                             }
                             SpriteBatch arg_400D_0 = this.spriteBatch;
                             SpriteFont arg_400D_1 = Main.fontDeathText;
                             string arg_400D_2 = text3;
                             Microsoft.Xna.Framework.Vector2 arg_400D_3 = new Microsoft.Xna.Framework.Vector2((float)(num57 + num62), (float)(num56 + num63));
                             Microsoft.Xna.Framework.Color arg_400D_4 = color7;
                             float arg_400D_5 = 0f;
                             origin = default(Microsoft.Xna.Framework.Vector2);
                             arg_400D_0.DrawString(arg_400D_1, arg_400D_2, arg_400D_3, arg_400D_4, arg_400D_5, origin, scale2, SpriteEffects.None, 0f);
                         }
                     }
                 }
                 if (!flag7)
                 {
                     this.focusColor = 0;
                     this.colorDelay = 0;
                 }
             }
             if (flag2)
             {
                 int num64 = 400;
                 string text4 = "";
                 for (int num65 = 0; num65 < 4; num65++)
                 {
                     int num66 = num64;
                     int num67 = 370 + Main.screenWidth / 2 - 400;
                     if (num65 == 0)
                     {
                         text4 = "Sound:";
                     }
                     if (num65 == 1)
                     {
                         text4 = "Music:";
                         num66 += 30;
                     }
                     if (num65 == 2)
                     {
                         text4 = Math.Round((double)(Main.soundVolume * 100f)) + "%";
                         num67 += 90;
                     }
                     if (num65 == 3)
                     {
                         text4 = Math.Round((double)(Main.musicVolume * 100f)) + "%";
                         num67 += 90;
                         num66 += 30;
                     }
                     for (int num68 = 0; num68 < 5; num68++)
                     {
                         Microsoft.Xna.Framework.Color color8 = Microsoft.Xna.Framework.Color.Black;
                         if (num68 == 4)
                         {
                             color8 = color;
                             color8.R = (byte)((255 + color8.R) / 2);
                             color8.G = (byte)((255 + color8.R) / 2);
                             color8.B = (byte)((255 + color8.R) / 2);
                         }
                         int num69 = 255;
                         int num70 = (int)color8.R - (255 - num69);
                         if (num70 < 0)
                         {
                             num70 = 0;
                         }
                         color8 = new Microsoft.Xna.Framework.Color((int)((byte)num70), (int)((byte)num70), (int)((byte)num70), (int)((byte)num69));
                         int num71 = 0;
                         int num72 = 0;
                         if (num68 == 0)
                         {
                             num71 = -2;
                         }
                         if (num68 == 1)
                         {
                             num71 = 2;
                         }
                         if (num68 == 2)
                         {
                             num72 = -2;
                         }
                         if (num68 == 3)
                         {
                             num72 = 2;
                         }
                         SpriteBatch arg_41F6_0 = this.spriteBatch;
                         SpriteFont arg_41F6_1 = Main.fontDeathText;
                         string arg_41F6_2 = text4;
                         Microsoft.Xna.Framework.Vector2 arg_41F6_3 = new Microsoft.Xna.Framework.Vector2((float)(num67 + num71), (float)(num66 + num72));
                         Microsoft.Xna.Framework.Color arg_41F6_4 = color8;
                         float arg_41F6_5 = 0f;
                         origin = default(Microsoft.Xna.Framework.Vector2);
                         arg_41F6_0.DrawString(arg_41F6_1, arg_41F6_2, arg_41F6_3, arg_41F6_4, arg_41F6_5, origin, 0.5f, SpriteEffects.None, 0f);
                     }
                 }
                 bool flag8 = false;
                 for (int num73 = 0; num73 < 2; num73++)
                 {
                     for (int num74 = 0; num74 < 2; num74++)
                     {
                         int num75 = num64 + num74 * 30 - 12;
                         int num76 = 360 + Main.screenWidth / 2 - 400;
                         float scale3 = 0.9f;
                         if (num73 == 0)
                         {
                             num76 -= 70;
                             num75 += 2;
                         }
                         else
                         {
                             num76 -= 40;
                         }
                         text4 = "-";
                         if (num73 == 1)
                         {
                             text4 = "+";
                         }
                         Microsoft.Xna.Framework.Vector2 vector5 = new Microsoft.Xna.Framework.Vector2(24f, 24f);
                         int num77 = 142;
                         if (Main.mouseX > num76 && (float)Main.mouseX < (float)num76 + vector5.X && Main.mouseY > num75 + 13 && (float)Main.mouseY < (float)(num75 + 13) + vector5.Y)
                         {
                             if (this.focusColor != (num73 + 1) * (num74 + 10))
                             {
                                 Main.PlaySound(12, -1, -1, 1);
                             }
                             this.focusColor = (num73 + 1) * (num74 + 10);
                             flag8 = true;
                             num77 = 255;
                             if (Main.mouseLeft)
                             {
                                 if (this.colorDelay <= 1)
                                 {
                                     if (this.colorDelay == 0)
                                     {
                                         this.colorDelay = 40;
                                     }
                                     else
                                     {
                                         this.colorDelay = 3;
                                     }
                                     int num78 = (int?)num73 ?? -1;
                                     if (num74 == 0)
                                     {
                                         Main.soundVolume += (float)num78 * 0.01f;
                                         if (Main.soundVolume > 1f)
                                         {
                                             Main.soundVolume = 1f;
                                         }
                                         if (Main.soundVolume < 0f)
                                         {
                                             Main.soundVolume = 0f;
                                         }
                                     }
                                     if (num74 == 1)
                                     {
                                         Main.musicVolume += (float)num78 * 0.01f;
                                         if (Main.musicVolume > 1f)
                                         {
                                             Main.musicVolume = 1f;
                                         }
                                         if (Main.musicVolume < 0f)
                                         {
                                             Main.musicVolume = 0f;
                                         }
                                     }
                                 }
                                 this.colorDelay--;
                             }
                             else
                             {
                                 this.colorDelay = 0;
                             }
                         }
                         for (int num79 = 0; num79 < 5; num79++)
                         {
                             Microsoft.Xna.Framework.Color color9 = Microsoft.Xna.Framework.Color.Black;
                             if (num79 == 4)
                             {
                                 color9 = color;
                                 color9.R = (byte)((255 + color9.R) / 2);
                                 color9.G = (byte)((255 + color9.R) / 2);
                                 color9.B = (byte)((255 + color9.R) / 2);
                             }
                             int num80 = (int)color9.R - (255 - num77);
                             if (num80 < 0)
                             {
                                 num80 = 0;
                             }
                             color9 = new Microsoft.Xna.Framework.Color((int)((byte)num80), (int)((byte)num80), (int)((byte)num80), (int)((byte)num77));
                             int num81 = 0;
                             int num82 = 0;
                             if (num79 == 0)
                             {
                                 num81 = -2;
                             }
                             if (num79 == 1)
                             {
                                 num81 = 2;
                             }
                             if (num79 == 2)
                             {
                                 num82 = -2;
                             }
                             if (num79 == 3)
                             {
                                 num82 = 2;
                             }
                             SpriteBatch arg_44D9_0 = this.spriteBatch;
                             SpriteFont arg_44D9_1 = Main.fontDeathText;
                             string arg_44D9_2 = text4;
                             Microsoft.Xna.Framework.Vector2 arg_44D9_3 = new Microsoft.Xna.Framework.Vector2((float)(num76 + num81), (float)(num75 + num82));
                             Microsoft.Xna.Framework.Color arg_44D9_4 = color9;
                             float arg_44D9_5 = 0f;
                             origin = default(Microsoft.Xna.Framework.Vector2);
                             arg_44D9_0.DrawString(arg_44D9_1, arg_44D9_2, arg_44D9_3, arg_44D9_4, arg_44D9_5, origin, scale3, SpriteEffects.None, 0f);
                         }
                     }
                 }
                 if (!flag8)
                 {
                     this.focusColor = 0;
                     this.colorDelay = 0;
                 }
             }
             for (int num83 = 0; num83 < 5; num83++)
             {
                 Microsoft.Xna.Framework.Color color10 = Microsoft.Xna.Framework.Color.Black;
                 if (num83 == 4)
                 {
                     color10 = color;
                     if (array5[num26] == 2)
                     {
                         color10 = Main.hcColor;
                     }
                     else
                     {
                         if (array5[num26] == 1)
                         {
                             color10 = Main.mcColor;
                         }
                     }
                     color10.R = (byte)((255 + color10.R) / 2);
                     color10.G = (byte)((255 + color10.G) / 2);
                     color10.B = (byte)((255 + color10.B) / 2);
                 }
                 int num84 = (int)(255f * (this.menuItemScale[num26] * 2f - 1f));
                 if (array[num26])
                 {
                     num84 = 255;
                 }
                 int num85 = (int)color10.R - (255 - num84);
                 if (num85 < 0)
                 {
                     num85 = 0;
                 }
                 int num86 = (int)color10.G - (255 - num84);
                 if (num86 < 0)
                 {
                     num86 = 0;
                 }
                 int num87 = (int)color10.B - (255 - num84);
                 if (num87 < 0)
                 {
                     num87 = 0;
                 }
                 color10 = new Microsoft.Xna.Framework.Color((int)((byte)num85), (int)((byte)num86), (int)((byte)num87), (int)((byte)num84));
                 int num88 = 0;
                 int num89 = 0;
                 if (num83 == 0)
                 {
                     num88 = -2;
                 }
                 if (num83 == 1)
                 {
                     num88 = 2;
                 }
                 if (num83 == 2)
                 {
                     num89 = -2;
                 }
                 if (num83 == 3)
                 {
                     num89 = 2;
                 }
                 Microsoft.Xna.Framework.Vector2 origin2 = Main.fontDeathText.MeasureString(array8[num26]);
                 origin2.X *= 0.5f;
                 origin2.Y *= 0.5f;
                 float num90 = this.menuItemScale[num26];
                 if (Main.menuMode == 15 && num26 == 0)
                 {
                     num90 *= 0.35f;
                 }
                 else
                 {
                     if (Main.netMode == 2)
                     {
                         num90 *= 0.5f;
                     }
                 }
                 num90 *= array6[num26];
                 if (!array7[num26])
                 {
                     this.spriteBatch.DrawString(Main.fontDeathText, array8[num26], new Microsoft.Xna.Framework.Vector2((float)(num2 + num88 + array4[num26]), (float)(num + num3 * num26 + num89) + origin2.Y * array6[num26] + (float)array3[num26]), color10, 0f, origin2, num90, SpriteEffects.None, 0f);
                 }
                 else
                 {
                     this.spriteBatch.DrawString(Main.fontDeathText, array8[num26], new Microsoft.Xna.Framework.Vector2((float)(num2 + num88 + array4[num26]), (float)(num + num3 * num26 + num89) + origin2.Y * array6[num26] + (float)array3[num26]), color10, 0f, new Microsoft.Xna.Framework.Vector2(0f, origin2.Y), num90, SpriteEffects.None, 0f);
                 }
             }
             if (!array7[num26])
             {
                 if ((float)Main.mouseX > (float)num2 - (float)(array8[num26].Length * 10) * array6[num26] + (float)array4[num26] && (float)Main.mouseX < (float)num2 + (float)(array8[num26].Length * 10) * array6[num26] + (float)array4[num26] && Main.mouseY > num + num3 * num26 + array3[num26] && (float)Main.mouseY < (float)(num + num3 * num26 + array3[num26]) + 50f * array6[num26] && Main.hasFocus)
                 {
                     this.focusMenu = num26;
                     if (array[num26] || array2[num26])
                     {
                         this.focusMenu = -1;
                     }
                     else
                     {
                         if (num25 != this.focusMenu)
                         {
                             Main.PlaySound(12, -1, -1, 1);
                         }
                         if (Main.mouseLeftRelease && Main.mouseLeft)
                         {
                             this.selectedMenu = num26;
                         }
                         if (Main.mouseRightRelease && Main.mouseRight)
                         {
                             this.selectedMenu2 = num26;
                         }
                     }
                 }
             }
             else
             {
                 if (Main.mouseX > num2 + array4[num26] && (float)Main.mouseX < (float)num2 + (float)(array8[num26].Length * 20) * array6[num26] + (float)array4[num26] && Main.mouseY > num + num3 * num26 + array3[num26] && (float)Main.mouseY < (float)(num + num3 * num26 + array3[num26]) + 50f * array6[num26] && Main.hasFocus)
                 {
                     this.focusMenu = num26;
                     if (array[num26] || array2[num26])
                     {
                         this.focusMenu = -1;
                     }
                     else
                     {
                         if (num25 != this.focusMenu)
                         {
                             Main.PlaySound(12, -1, -1, 1);
                         }
                         if (Main.mouseLeftRelease && Main.mouseLeft)
                         {
                             this.selectedMenu = num26;
                         }
                         if (Main.mouseRightRelease && Main.mouseRight)
                         {
                             this.selectedMenu2 = num26;
                         }
                     }
                 }
             }
         }
     }
     for (int num91 = 0; num91 < Main.maxMenuItems; num91++)
     {
         if (num91 == this.focusMenu)
         {
             if (this.menuItemScale[num91] < 1f)
             {
                 this.menuItemScale[num91] += 0.02f;
             }
             if (this.menuItemScale[num91] > 1f)
             {
                 this.menuItemScale[num91] = 1f;
             }
         }
         else
         {
             if ((double)this.menuItemScale[num91] > 0.8)
             {
                 this.menuItemScale[num91] -= 0.02f;
             }
         }
     }
     if (num6 >= 0)
     {
         Main.loadPlayer[num6].PlayerFrame();
         Main.loadPlayer[num6].position.X = (float)num7 + Main.screenPosition.X;
         Main.loadPlayer[num6].position.Y = (float)num8 + Main.screenPosition.Y;
         this.DrawPlayer(Main.loadPlayer[num6]);
     }
     for (int num92 = 0; num92 < 5; num92++)
     {
         Microsoft.Xna.Framework.Color color11 = Microsoft.Xna.Framework.Color.Black;
         if (num92 == 4)
         {
             color11 = color;
             color11.R = (byte)((255 + color11.R) / 2);
             color11.G = (byte)((255 + color11.R) / 2);
             color11.B = (byte)((255 + color11.R) / 2);
         }
         color11.A = (byte)((float)color11.A * 0.3f);
         int num93 = 0;
         int num94 = 0;
         if (num92 == 0)
         {
             num93 = -2;
         }
         if (num92 == 1)
         {
             num93 = 2;
         }
         if (num92 == 2)
         {
             num94 = -2;
         }
         if (num92 == 3)
         {
             num94 = 2;
         }
         string text5 = "Copyright © 2011 Re-Logic";
         Microsoft.Xna.Framework.Vector2 origin3 = Main.fontMouseText.MeasureString(text5);
         origin3.X *= 0.5f;
         origin3.Y *= 0.5f;
         this.spriteBatch.DrawString(Main.fontMouseText, text5, new Microsoft.Xna.Framework.Vector2((float)Main.screenWidth - origin3.X + (float)num93 - 10f, (float)Main.screenHeight - origin3.Y + (float)num94 - 2f), color11, 0f, origin3, 1f, SpriteEffects.None, 0f);
     }
     for (int num95 = 0; num95 < 5; num95++)
     {
         Microsoft.Xna.Framework.Color color12 = Microsoft.Xna.Framework.Color.Black;
         if (num95 == 4)
         {
             color12 = color;
             color12.R = (byte)((255 + color12.R) / 2);
             color12.G = (byte)((255 + color12.R) / 2);
             color12.B = (byte)((255 + color12.R) / 2);
         }
         color12.A = (byte)((float)color12.A * 0.3f);
         int num96 = 0;
         int num97 = 0;
         if (num95 == 0)
         {
             num96 = -2;
         }
         if (num95 == 1)
         {
             num96 = 2;
         }
         if (num95 == 2)
         {
             num97 = -2;
         }
         if (num95 == 3)
         {
             num97 = 2;
         }
         Microsoft.Xna.Framework.Vector2 origin4 = Main.fontMouseText.MeasureString(Main.versionNumber);
         origin4.X *= 0.5f;
         origin4.Y *= 0.5f;
         this.spriteBatch.DrawString(Main.fontMouseText, Main.versionNumber, new Microsoft.Xna.Framework.Vector2(origin4.X + (float)num96 + 10f, (float)Main.screenHeight - origin4.Y + (float)num97 - 2f), color12, 0f, origin4, 1f, SpriteEffects.None, 0f);
     }
     SpriteBatch arg_4DBA_0 = this.spriteBatch;
     Texture2D arg_4DBA_1 = Main.cursorTexture;
     Microsoft.Xna.Framework.Vector2 arg_4DBA_2 = new Microsoft.Xna.Framework.Vector2((float)(Main.mouseX + 1), (float)(Main.mouseY + 1));
     Microsoft.Xna.Framework.Rectangle? arg_4DBA_3 = new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.cursorTexture.Width, Main.cursorTexture.Height));
     Microsoft.Xna.Framework.Color arg_4DBA_4 = new Microsoft.Xna.Framework.Color((int)((float)Main.cursorColor.R * 0.2f), (int)((float)Main.cursorColor.G * 0.2f), (int)((float)Main.cursorColor.B * 0.2f), (int)((float)Main.cursorColor.A * 0.5f));
     float arg_4DBA_5 = 0f;
     origin = default(Microsoft.Xna.Framework.Vector2);
     arg_4DBA_0.Draw(arg_4DBA_1, arg_4DBA_2, arg_4DBA_3, arg_4DBA_4, arg_4DBA_5, origin, Main.cursorScale * 1.1f, SpriteEffects.None, 0f);
     SpriteBatch arg_4E1A_0 = this.spriteBatch;
     Texture2D arg_4E1A_1 = Main.cursorTexture;
     Microsoft.Xna.Framework.Vector2 arg_4E1A_2 = new Microsoft.Xna.Framework.Vector2((float)Main.mouseX, (float)Main.mouseY);
     Microsoft.Xna.Framework.Rectangle? arg_4E1A_3 = new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.cursorTexture.Width, Main.cursorTexture.Height));
     Microsoft.Xna.Framework.Color arg_4E1A_4 = Main.cursorColor;
     float arg_4E1A_5 = 0f;
     origin = default(Microsoft.Xna.Framework.Vector2);
     arg_4E1A_0.Draw(arg_4E1A_1, arg_4E1A_2, arg_4E1A_3, arg_4E1A_4, arg_4E1A_5, origin, Main.cursorScale, SpriteEffects.None, 0f);
     if (Main.fadeCounter > 0)
     {
         Microsoft.Xna.Framework.Color white = Microsoft.Xna.Framework.Color.White;
         Main.fadeCounter--;
         float num98 = (float)Main.fadeCounter / 75f * 255f;
         byte b2 = (byte)num98;
         white = new Microsoft.Xna.Framework.Color((int)b2, (int)b2, (int)b2, (int)b2);
         this.spriteBatch.Draw(Main.fadeTexture, new Microsoft.Xna.Framework.Rectangle(0, 0, Main.screenWidth, Main.screenHeight), white);
     }
     this.spriteBatch.End();
     if (Main.mouseLeft)
     {
         Main.mouseLeftRelease = false;
     }
     else
     {
         Main.mouseLeftRelease = true;
     }
     if (Main.mouseRight)
     {
         Main.mouseRightRelease = false;
         return;
     }
     Main.mouseRightRelease = true;
 }