public void Process(int start, int length, int num, int whoAmI, byte[] readBuffer, byte bufferData)
        {
            int signIndex = (int)BitConverter.ToInt16(readBuffer, num);
            num += 2;
            int x = BitConverter.ToInt32(readBuffer, num);
            num += 4;
            int y = BitConverter.ToInt32(readBuffer, num);
            num += 4;

            String SignText = Encoding.ASCII.GetString(readBuffer, num, length - num + start);

            Sign sign = new Sign();
            sign.x = x;
            sign.y = y;

            PlayerEditSignEvent signEvent = new PlayerEditSignEvent();
            signEvent.Sender = Main.players[whoAmI];
            signEvent.Sign = sign;
            signEvent.Text = SignText;
            Program.server.PluginManager.processHook(Hooks.PLAYER_EDITSIGN, signEvent);
            if (signEvent.Cancelled)
            {
                return;
            }

            Main.sign[signIndex] = sign;
            Sign.TextSign(signIndex, SignText);
        }
Exemple #2
0
 public override void onPlayerEditSign(PlayerEditSignEvent Event)
 {
     Event.Cancelled = CancelEvent(Event.Sender.Name);
     base.onPlayerEditSign(Event);
 }
        public void AI()
        {
            if (this.aiStyle == 1)
            {
                if (this.type == 41)
                {
                    Vector2 arg_5D_0 = new Vector2(this.Position.X, this.Position.Y);
                    int arg_5D_1 = this.width;
                    int arg_5D_2 = this.height;
                    int arg_5D_3 = 31;
                    float arg_5D_4 = 0f;
                    float arg_5D_5 = 0f;
                    int arg_5D_6 = 100;
                    Color newColor = default(Color);
                    int num = Dust.NewDust(arg_5D_0, arg_5D_1, arg_5D_2, arg_5D_3, arg_5D_4, arg_5D_5, arg_5D_6, newColor, 1.6f);
                    Main.dust[num].noGravity = true;
                    Vector2 arg_B3_0 = new Vector2(this.Position.X, this.Position.Y);
                    int arg_B3_1 = this.width;
                    int arg_B3_2 = this.height;
                    int arg_B3_3 = 6;
                    float arg_B3_4 = 0f;
                    float arg_B3_5 = 0f;
                    int arg_B3_6 = 100;
                    newColor = default(Color);
                    num = Dust.NewDust(arg_B3_0, arg_B3_1, arg_B3_2, arg_B3_3, arg_B3_4, arg_B3_5, arg_B3_6, newColor, 2f);
                    Main.dust[num].noGravity = true;
                }
                if (this.type == 20 || this.type == 14 || this.type == 36)
                {
                    if (this.alpha > 0)
                    {
                        this.alpha -= 15;
                    }
                    if (this.alpha < 0)
                    {
                        this.alpha = 0;
                    }
                }
                if (this.type != 5 && this.type != 14 && this.type != 20 && this.type != 36 && this.type != 38)
                {
                    this.ai[0] += 1f;
                }
                if (this.ai[0] >= 15f)
                {
                    this.ai[0] = 15f;
                    this.Velocity.Y = this.Velocity.Y + 0.1f;
                }
                this.rotation = (float)Math.Atan2((double)this.Velocity.Y, (double)this.Velocity.X) + 1.57f;
                if (this.Velocity.Y > 16f)
                {
                    this.Velocity.Y = 16f;
                    return;
                }
            }
            else
            {
                if (this.aiStyle == 2)
                {
                    this.rotation += (Math.Abs(this.Velocity.X) + Math.Abs(this.Velocity.Y)) * 0.03f * (float)this.direction;
                    this.ai[0] += 1f;
                    if (this.ai[0] >= 20f)
                    {
                        this.Velocity.Y = this.Velocity.Y + 0.4f;
                        this.Velocity.X = this.Velocity.X * 0.97f;
                    }
                    else
                    {
                        if (this.type == 48 || this.type == 54)
                        {
                            this.rotation = (float)Math.Atan2((double)this.Velocity.Y, (double)this.Velocity.X) + 1.57f;
                        }
                    }
                    if (this.Velocity.Y > 16f)
                    {
                        this.Velocity.Y = 16f;
                    }
                    if (this.type == 54 && Main.rand.Next(20) == 0)
                    {
                        Vector2 arg_35A_0 = new Vector2(this.Position.X, this.Position.Y);
                        int arg_35A_1 = this.width;
                        int arg_35A_2 = this.height;
                        int arg_35A_3 = 40;
                        float arg_35A_4 = this.Velocity.X * 0.1f;
                        float arg_35A_5 = this.Velocity.Y * 0.1f;
                        int arg_35A_6 = 0;
                        Color newColor = default(Color);
                        Dust.NewDust(arg_35A_0, arg_35A_1, arg_35A_2, arg_35A_3, arg_35A_4, arg_35A_5, arg_35A_6, newColor, 0.75f);
                        return;
                    }
                }
                else
                {
                    if (this.aiStyle == 3)
                    {
                        if (this.soundDelay == 0)
                        {
                            this.soundDelay = 8;
                        }
                        if (this.type == 19)
                        {
                            for (int i = 0; i < 2; i++)
                            {
                                Vector2 arg_40A_0 = new Vector2(this.Position.X, this.Position.Y);
                                int arg_40A_1 = this.width;
                                int arg_40A_2 = this.height;
                                int arg_40A_3 = 6;
                                float arg_40A_4 = this.Velocity.X * 0.2f;
                                float arg_40A_5 = this.Velocity.Y * 0.2f;
                                int arg_40A_6 = 100;
                                Color newColor = default(Color);
                                int num2 = Dust.NewDust(arg_40A_0, arg_40A_1, arg_40A_2, arg_40A_3, arg_40A_4, arg_40A_5, arg_40A_6, newColor, 2f);
                                Main.dust[num2].noGravity = true;
                                Dust expr_429_cp_0 = Main.dust[num2];
                                expr_429_cp_0.Velocity.X = expr_429_cp_0.Velocity.X * 0.3f;
                                Dust expr_446_cp_0 = Main.dust[num2];
                                expr_446_cp_0.Velocity.Y = expr_446_cp_0.Velocity.Y * 0.3f;
                            }
                        }
                        else
                        {
                            if (this.type == 33)
                            {
                                if (Main.rand.Next(1) == 0)
                                {
                                    Vector2 arg_4C7_0 = this.Position;
                                    int arg_4C7_1 = this.width;
                                    int arg_4C7_2 = this.height;
                                    int arg_4C7_3 = 40;
                                    float arg_4C7_4 = this.Velocity.X * 0.25f;
                                    float arg_4C7_5 = this.Velocity.Y * 0.25f;
                                    int arg_4C7_6 = 0;
                                    Color newColor = default(Color);
                                    int num3 = Dust.NewDust(arg_4C7_0, arg_4C7_1, arg_4C7_2, arg_4C7_3, arg_4C7_4, arg_4C7_5, arg_4C7_6, newColor, 1.4f);
                                    Main.dust[num3].noGravity = true;
                                }
                            }
                            else
                            {
                                if (this.type == 6 && Main.rand.Next(5) == 0)
                                {
                                    Vector2 arg_53C_0 = this.Position;
                                    int arg_53C_1 = this.width;
                                    int arg_53C_2 = this.height;
                                    int arg_53C_3 = 15;
                                    float arg_53C_4 = this.Velocity.X * 0.5f;
                                    float arg_53C_5 = this.Velocity.Y * 0.5f;
                                    int arg_53C_6 = 150;
                                    Color newColor = default(Color);
                                    Dust.NewDust(arg_53C_0, arg_53C_1, arg_53C_2, arg_53C_3, arg_53C_4, arg_53C_5, arg_53C_6, newColor, 0.9f);
                                }
                            }
                        }
                        if (this.ai[0] == 0f)
                        {
                            this.ai[1] += 1f;
                            if (this.ai[1] >= 30f)
                            {
                                this.ai[0] = 1f;
                                this.ai[1] = 0f;
                                this.netUpdate = true;
                            }
                        }
                        else
                        {
                            this.tileCollide = false;
                            float num4 = 9f;
                            float num5 = 0.4f;
                            if (this.type == 19)
                            {
                                num4 = 13f;
                                num5 = 0.6f;
                            }
                            else
                            {
                                if (this.type == 33)
                                {
                                    num4 = 15f;
                                    num5 = 0.8f;
                                }
                            }
                            Vector2 vector = new Vector2(this.Position.X + (float)this.width * 0.5f, this.Position.Y + (float)this.height * 0.5f);
                            float num6 = Main.players[this.Owner].Position.X + (float)(Main.players[this.Owner].width / 2) - vector.X;
                            float num7 = Main.players[this.Owner].Position.Y + (float)(Main.players[this.Owner].height / 2) - vector.Y;
                            float num8 = (float)Math.Sqrt((double)(num6 * num6 + num7 * num7));
                            num8 = num4 / num8;
                            num6 *= num8;
                            num7 *= num8;
                            if (this.Velocity.X < num6)
                            {
                                this.Velocity.X = this.Velocity.X + num5;
                                if (this.Velocity.X < 0f && num6 > 0f)
                                {
                                    this.Velocity.X = this.Velocity.X + num5;
                                }
                            }
                            else
                            {
                                if (this.Velocity.X > num6)
                                {
                                    this.Velocity.X = this.Velocity.X - num5;
                                    if (this.Velocity.X > 0f && num6 < 0f)
                                    {
                                        this.Velocity.X = this.Velocity.X - num5;
                                    }
                                }
                            }
                            if (this.Velocity.Y < num7)
                            {
                                this.Velocity.Y = this.Velocity.Y + num5;
                                if (this.Velocity.Y < 0f && num7 > 0f)
                                {
                                    this.Velocity.Y = this.Velocity.Y + num5;
                                }
                            }
                            else
                            {
                                if (this.Velocity.Y > num7)
                                {
                                    this.Velocity.Y = this.Velocity.Y - num5;
                                    if (this.Velocity.Y > 0f && num7 < 0f)
                                    {
                                        this.Velocity.Y = this.Velocity.Y - num5;
                                    }
                                }
                            }
                            if (Main.myPlayer == this.Owner)
                            {
                                Rectangle rectangle = new Rectangle((int)this.Position.X, (int)this.Position.Y, this.width, this.height);
                                Rectangle value = new Rectangle((int)Main.players[this.Owner].Position.X, (int)Main.players[this.Owner].Position.Y, Main.players[this.Owner].width, Main.players[this.Owner].height);
                                if (rectangle.Intersects(value))
                                {
                                    this.Kill();
                                }
                            }
                        }
                        this.rotation += 0.4f * (float)this.direction;
                        return;
                    }
                    if (this.aiStyle == 4)
                    {
                        this.rotation = (float)Math.Atan2((double)this.Velocity.Y, (double)this.Velocity.X) + 1.57f;
                        if (this.ai[0] == 0f)
                        {
                            this.alpha -= 50;
                            if (this.alpha <= 0)
                            {
                                this.alpha = 0;
                                this.ai[0] = 1f;
                                if (this.ai[1] == 0f)
                                {
                                    this.ai[1] += 1f;
                                    this.Position += this.Velocity * 1f;
                                }
                                if (this.type == 7 && Main.myPlayer == this.Owner)
                                {
                                    int num9 = this.type;
                                    if (this.ai[1] >= 6f)
                                    {
                                        num9++;
                                    }
                                    int num10 = Projectile.NewProjectile(this.Position.X + this.Velocity.X + (float)(this.width / 2), this.Position.Y + this.Velocity.Y + (float)(this.height / 2), this.Velocity.X, this.Velocity.Y, num9, this.damage, this.knockBack, this.Owner);
                                    Main.projectile[num10].damage = this.damage;
                                    Main.projectile[num10].ai[1] = this.ai[1] + 1f;
                                    NetMessage.SendData(27, -1, -1, "", num10);
                                    return;
                                }
                            }
                        }
                        else
                        {
                            if (this.alpha < 170 && this.alpha + 5 >= 170)
                            {
                                Color newColor;
                                for (int j = 0; j < 3; j++)
                                {
                                    Vector2 arg_AF5_0 = this.Position;
                                    int arg_AF5_1 = this.width;
                                    int arg_AF5_2 = this.height;
                                    int arg_AF5_3 = 18;
                                    float arg_AF5_4 = this.Velocity.X * 0.025f;
                                    float arg_AF5_5 = this.Velocity.Y * 0.025f;
                                    int arg_AF5_6 = 170;
                                    newColor = default(Color);
                                    Dust.NewDust(arg_AF5_0, arg_AF5_1, arg_AF5_2, arg_AF5_3, arg_AF5_4, arg_AF5_5, arg_AF5_6, newColor, 1.2f);
                                }
                                Vector2 arg_B38_0 = this.Position;
                                int arg_B38_1 = this.width;
                                int arg_B38_2 = this.height;
                                int arg_B38_3 = 14;
                                float arg_B38_4 = 0f;
                                float arg_B38_5 = 0f;
                                int arg_B38_6 = 170;
                                newColor = default(Color);
                                Dust.NewDust(arg_B38_0, arg_B38_1, arg_B38_2, arg_B38_3, arg_B38_4, arg_B38_5, arg_B38_6, newColor, 1.1f);
                            }
                            this.alpha += 5;
                            if (this.alpha >= 255)
                            {
                                this.Kill();
                                return;
                            }
                        }
                    }
                    else
                    {
                        if (this.aiStyle == 5)
                        {
                            if (this.soundDelay == 0)
                            {
                                this.soundDelay = 20 + Main.rand.Next(40);
                            }
                            if (this.ai[0] == 0f)
                            {
                                this.ai[0] = 1f;
                            }
                            this.alpha += (int)(25f * this.ai[0]);
                            if (this.alpha > 200)
                            {
                                this.alpha = 200;
                                this.ai[0] = -1f;
                            }
                            if (this.alpha < 0)
                            {
                                this.alpha = 0;
                                this.ai[0] = 1f;
                            }
                            this.rotation += (Math.Abs(this.Velocity.X) + Math.Abs(this.Velocity.Y)) * 0.01f * (float)this.direction;
                            if (Main.rand.Next(10) == 0)
                            {
                                Vector2 arg_CBA_0 = this.Position;
                                int arg_CBA_1 = this.width;
                                int arg_CBA_2 = this.height;
                                int arg_CBA_3 = 15;
                                float arg_CBA_4 = this.Velocity.X * 0.5f;
                                float arg_CBA_5 = this.Velocity.Y * 0.5f;
                                int arg_CBA_6 = 150;
                                Color newColor = default(Color);
                                Dust.NewDust(arg_CBA_0, arg_CBA_1, arg_CBA_2, arg_CBA_3, arg_CBA_4, arg_CBA_5, arg_CBA_6, newColor, 1.2f);
                            }
                            if (Main.rand.Next(20) == 0)
                            {
                                Gore.NewGore(this.Position, new Vector2(this.Velocity.X * 0.2f, this.Velocity.Y * 0.2f), Main.rand.Next(16, 18));
                                return;
                            }
                        }
                        else
                        {
                            if (this.aiStyle == 6)
                            {
                                this.Velocity *= 0.95f;
                                this.ai[0] += 1f;
                                if (this.ai[0] == 180f)
                                {
                                    this.Kill();
                                }
                                if (this.ai[1] == 0f)
                                {
                                    this.ai[1] = 1f;
                                    for (int k = 0; k < 30; k++)
                                    {
                                        Vector2 arg_DCA_0 = this.Position;
                                        int arg_DCA_1 = this.width;
                                        int arg_DCA_2 = this.height;
                                        int arg_DCA_3 = 10 + this.type;
                                        float arg_DCA_4 = this.Velocity.X;
                                        float arg_DCA_5 = this.Velocity.Y;
                                        int arg_DCA_6 = 50;
                                        Color newColor = default(Color);
                                        Dust.NewDust(arg_DCA_0, arg_DCA_1, arg_DCA_2, arg_DCA_3, arg_DCA_4, arg_DCA_5, arg_DCA_6, newColor, 1f);
                                    }
                                }
                                if (this.type == 10)
                                {
                                    int num11 = (int)(this.Position.X / 16f) - 1;
                                    int num12 = (int)((this.Position.X + (float)this.width) / 16f) + 2;
                                    int num13 = (int)(this.Position.Y / 16f) - 1;
                                    int num14 = (int)((this.Position.Y + (float)this.height) / 16f) + 2;
                                    if (num11 < 0)
                                    {
                                        num11 = 0;
                                    }
                                    if (num12 > Main.maxTilesX)
                                    {
                                        num12 = Main.maxTilesX;
                                    }
                                    if (num13 < 0)
                                    {
                                        num13 = 0;
                                    }
                                    if (num14 > Main.maxTilesY)
                                    {
                                        num14 = Main.maxTilesY;
                                    }
                                    for (int l = num11; l < num12; l++)
                                    {
                                        for (int m = num13; m < num14; m++)
                                        {
                                            Vector2 vector2;
                                            vector2.X = (float)(l * 16);
                                            vector2.Y = (float)(m * 16);
                                            if (this.Position.X + (float)this.width > vector2.X && this.Position.X < vector2.X + 16f && this.Position.Y + (float)this.height > vector2.Y && this.Position.Y < vector2.Y + 16f && Main.myPlayer == this.Owner && Main.tile[l, m].Active)
                                            {
                                                if (Main.tile[l, m].type == 23)
                                                {
                                                    Main.tile[l, m].type = 2;
                                                    WorldGen.SquareTileFrame(l, m, true);
                                                    if (Main.netMode == 1)
                                                    {
                                                        NetMessage.SendTileSquare(-1, l - 1, m - 1, 3);
                                                    }
                                                }
                                                if (Main.tile[l, m].type == 25)
                                                {
                                                    Main.tile[l, m].type = 1;
                                                    WorldGen.SquareTileFrame(l, m, true);
                                                    if (Main.netMode == 1)
                                                    {
                                                        NetMessage.SendTileSquare(-1, l - 1, m - 1, 3);
                                                    }
                                                }
                                            }
                                        }
                                    }
                                    return;
                                }
                            }
                            else
                            {
                                if (this.aiStyle == 7)
                                {
                                    if (Main.players[this.Owner].dead)
                                    {
                                        this.Kill();
                                        return;
                                    }
                                    Vector2 vector3 = new Vector2(this.Position.X + (float)this.width * 0.5f, this.Position.Y + (float)this.height * 0.5f);
                                    float num15 = Main.players[this.Owner].Position.X + (float)(Main.players[this.Owner].width / 2) - vector3.X;
                                    float num16 = Main.players[this.Owner].Position.Y + (float)(Main.players[this.Owner].height / 2) - vector3.Y;
                                    float num17 = (float)Math.Sqrt((double)(num15 * num15 + num16 * num16));
                                    this.rotation = (float)Math.Atan2((double)num16, (double)num15) - 1.57f;
                                    if (this.ai[0] == 0f)
                                    {
                                        if ((num17 > 300f && this.type == 13) || (num17 > 400f && this.type == 32))
                                        {
                                            this.ai[0] = 1f;
                                        }
                                        int num18 = (int)(this.Position.X / 16f) - 1;
                                        int num19 = (int)((this.Position.X + (float)this.width) / 16f) + 2;
                                        int num20 = (int)(this.Position.Y / 16f) - 1;
                                        int num21 = (int)((this.Position.Y + (float)this.height) / 16f) + 2;
                                        if (num18 < 0)
                                        {
                                            num18 = 0;
                                        }
                                        if (num19 > Main.maxTilesX)
                                        {
                                            num19 = Main.maxTilesX;
                                        }
                                        if (num20 < 0)
                                        {
                                            num20 = 0;
                                        }
                                        if (num21 > Main.maxTilesY)
                                        {
                                            num21 = Main.maxTilesY;
                                        }
                                        for (int n = num18; n < num19; n++)
                                        {
                                            int num22 = num20;
                                            while (num22 < num21)
                                            {
                                                if (Main.tile[n, num22] == null)
                                                {
                                                    Main.tile[n, num22] = new Tile();
                                                }
                                                Vector2 vector4;
                                                vector4.X = (float)(n * 16);
                                                vector4.Y = (float)(num22 * 16);
                                                if (this.Position.X + (float)this.width > vector4.X && this.Position.X < vector4.X + 16f && this.Position.Y + (float)this.height > vector4.Y && this.Position.Y < vector4.Y + 16f && Main.tile[n, num22].Active && Main.tileSolid[(int)Main.tile[n, num22].type])
                                                {
                                                    if (Main.players[this.Owner].grapCount < 10)
                                                    {
                                                        Main.players[this.Owner].grappling[Main.players[this.Owner].grapCount] = this.whoAmI;
                                                        Main.players[this.Owner].grapCount++;
                                                    }
                                                    if (Main.myPlayer == this.Owner)
                                                    {
                                                        int num23 = 0;
                                                        int num24 = -1;
                                                        int num25 = 100000;
                                                        for (int num26 = 0; num26 < 1000; num26++)
                                                        {
                                                            if (Main.projectile[num26].Active && Main.projectile[num26].Owner == this.Owner && Main.projectile[num26].aiStyle == 7)
                                                            {
                                                                if (Main.projectile[num26].timeLeft < num25)
                                                                {
                                                                    num24 = num26;
                                                                    num25 = Main.projectile[num26].timeLeft;
                                                                }
                                                                num23++;
                                                            }
                                                        }
                                                        if (num23 > 3)
                                                        {
                                                            Main.projectile[num24].Kill();
                                                        }
                                                    }
                                                    WorldGen.KillTile(n, num22, true, true, false);
                                                    this.Velocity.X = 0f;
                                                    this.Velocity.Y = 0f;
                                                    this.ai[0] = 2f;
                                                    this.Position.X = (float)(n * 16 + 8 - this.width / 2);
                                                    this.Position.Y = (float)(num22 * 16 + 8 - this.height / 2);
                                                    this.damage = 0;
                                                    this.netUpdate = true;
                                                    if (Main.myPlayer == this.Owner)
                                                    {
                                                        NetMessage.SendData(13, -1, -1, "", this.Owner);
                                                        break;
                                                    }
                                                    break;
                                                }
                                                else
                                                {
                                                    num22++;
                                                }
                                            }
                                            if (this.ai[0] == 2f)
                                            {
                                                return;
                                            }
                                        }
                                        return;
                                    }
                                    if (this.ai[0] == 1f)
                                    {
                                        float num27 = 11f;
                                        if (this.type == 32)
                                        {
                                            num27 = 15f;
                                        }
                                        if (num17 < 24f)
                                        {
                                            this.Kill();
                                        }
                                        num17 = num27 / num17;
                                        num15 *= num17;
                                        num16 *= num17;
                                        this.Velocity.X = num15;
                                        this.Velocity.Y = num16;
                                        return;
                                    }
                                    if (this.ai[0] == 2f)
                                    {
                                        int num28 = (int)(this.Position.X / 16f) - 1;
                                        int num29 = (int)((this.Position.X + (float)this.width) / 16f) + 2;
                                        int num30 = (int)(this.Position.Y / 16f) - 1;
                                        int num31 = (int)((this.Position.Y + (float)this.height) / 16f) + 2;
                                        if (num28 < 0)
                                        {
                                            num28 = 0;
                                        }
                                        if (num29 > Main.maxTilesX)
                                        {
                                            num29 = Main.maxTilesX;
                                        }
                                        if (num30 < 0)
                                        {
                                            num30 = 0;
                                        }
                                        if (num31 > Main.maxTilesY)
                                        {
                                            num31 = Main.maxTilesY;
                                        }
                                        bool flag = true;
                                        for (int num32 = num28; num32 < num29; num32++)
                                        {
                                            for (int num33 = num30; num33 < num31; num33++)
                                            {
                                                if (Main.tile[num32, num33] == null)
                                                {
                                                    Main.tile[num32, num33] = new Tile();
                                                }
                                                Vector2 vector5;
                                                vector5.X = (float)(num32 * 16);
                                                vector5.Y = (float)(num33 * 16);
                                                if (this.Position.X + (float)(this.width / 2) > vector5.X && this.Position.X + (float)(this.width / 2) < vector5.X + 16f && this.Position.Y + (float)(this.height / 2) > vector5.Y && this.Position.Y + (float)(this.height / 2) < vector5.Y + 16f && Main.tile[num32, num33].Active && Main.tileSolid[(int)Main.tile[num32, num33].type])
                                                {
                                                    flag = false;
                                                }
                                            }
                                        }
                                        if (flag)
                                        {
                                            this.ai[0] = 1f;
                                            return;
                                        }
                                        if (Main.players[this.Owner].grapCount < 10)
                                        {
                                            Main.players[this.Owner].grappling[Main.players[this.Owner].grapCount] = this.whoAmI;
                                            Main.players[this.Owner].grapCount++;
                                            return;
                                        }
                                    }
                                }
                                else
                                {
                                    if (this.aiStyle == 8)
                                    {
                                        if (this.type == 27)
                                        {
                                            Vector2 arg_17E5_0 = new Vector2(this.Position.X + this.Velocity.X, this.Position.Y + this.Velocity.Y);
                                            int arg_17E5_1 = this.width;
                                            int arg_17E5_2 = this.height;
                                            int arg_17E5_3 = 29;
                                            float arg_17E5_4 = this.Velocity.X;
                                            float arg_17E5_5 = this.Velocity.Y;
                                            int arg_17E5_6 = 100;
                                            Color newColor = default(Color);
                                            int num34 = Dust.NewDust(arg_17E5_0, arg_17E5_1, arg_17E5_2, arg_17E5_3, arg_17E5_4, arg_17E5_5, arg_17E5_6, newColor, 3f);
                                            Main.dust[num34].noGravity = true;
                                            Vector2 arg_184A_0 = new Vector2(this.Position.X, this.Position.Y);
                                            int arg_184A_1 = this.width;
                                            int arg_184A_2 = this.height;
                                            int arg_184A_3 = 29;
                                            float arg_184A_4 = this.Velocity.X;
                                            float arg_184A_5 = this.Velocity.Y;
                                            int arg_184A_6 = 100;
                                            newColor = default(Color);
                                            num34 = Dust.NewDust(arg_184A_0, arg_184A_1, arg_184A_2, arg_184A_3, arg_184A_4, arg_184A_5, arg_184A_6, newColor, 1.5f);
                                        }
                                        else
                                        {
                                            for (int num35 = 0; num35 < 2; num35++)
                                            {
                                                Vector2 arg_18B9_0 = new Vector2(this.Position.X, this.Position.Y);
                                                int arg_18B9_1 = this.width;
                                                int arg_18B9_2 = this.height;
                                                int arg_18B9_3 = 6;
                                                float arg_18B9_4 = this.Velocity.X * 0.2f;
                                                float arg_18B9_5 = this.Velocity.Y * 0.2f;
                                                int arg_18B9_6 = 100;
                                                Color newColor = default(Color);
                                                int num36 = Dust.NewDust(arg_18B9_0, arg_18B9_1, arg_18B9_2, arg_18B9_3, arg_18B9_4, arg_18B9_5, arg_18B9_6, newColor, 2f);
                                                Main.dust[num36].noGravity = true;
                                                Dust expr_18DB_cp_0 = Main.dust[num36];
                                                expr_18DB_cp_0.Velocity.X = expr_18DB_cp_0.Velocity.X * 0.3f;
                                                Dust expr_18F9_cp_0 = Main.dust[num36];
                                                expr_18F9_cp_0.Velocity.Y = expr_18F9_cp_0.Velocity.Y * 0.3f;
                                            }
                                        }
                                        if (this.type != 27)
                                        {
                                            this.ai[1] += 1f;
                                        }
                                        if (this.ai[1] >= 20f)
                                        {
                                            this.Velocity.Y = this.Velocity.Y + 0.2f;
                                        }
                                        this.rotation += 0.3f * (float)this.direction;
                                        if (this.Velocity.Y > 16f)
                                        {
                                            this.Velocity.Y = 16f;
                                            return;
                                        }
                                    }
                                    else
                                    {
                                        if (this.aiStyle == 9)
                                        {
                                            if (this.type == 34)
                                            {
                                                Vector2 arg_1A1A_0 = new Vector2(this.Position.X, this.Position.Y);
                                                int arg_1A1A_1 = this.width;
                                                int arg_1A1A_2 = this.height;
                                                int arg_1A1A_3 = 6;
                                                float arg_1A1A_4 = this.Velocity.X * 0.2f;
                                                float arg_1A1A_5 = this.Velocity.Y * 0.2f;
                                                int arg_1A1A_6 = 100;
                                                Color newColor = default(Color);
                                                int num37 = Dust.NewDust(arg_1A1A_0, arg_1A1A_1, arg_1A1A_2, arg_1A1A_3, arg_1A1A_4, arg_1A1A_5, arg_1A1A_6, newColor, 3.5f);
                                                Main.dust[num37].noGravity = true;
                                                Dust expr_1A37 = Main.dust[num37];
                                                expr_1A37.Velocity *= 1.4f;
                                                Vector2 arg_1AA7_0 = new Vector2(this.Position.X, this.Position.Y);
                                                int arg_1AA7_1 = this.width;
                                                int arg_1AA7_2 = this.height;
                                                int arg_1AA7_3 = 6;
                                                float arg_1AA7_4 = this.Velocity.X * 0.2f;
                                                float arg_1AA7_5 = this.Velocity.Y * 0.2f;
                                                int arg_1AA7_6 = 100;
                                                newColor = default(Color);
                                                num37 = Dust.NewDust(arg_1AA7_0, arg_1AA7_1, arg_1AA7_2, arg_1AA7_3, arg_1AA7_4, arg_1AA7_5, arg_1AA7_6, newColor, 1.5f);
                                            }
                                            else
                                            {
                                                if (this.soundDelay == 0 && Math.Abs(this.Velocity.X) + Math.Abs(this.Velocity.Y) > 2f)
                                                {
                                                    this.soundDelay = 10;
                                                }
                                                Vector2 arg_1B4F_0 = new Vector2(this.Position.X, this.Position.Y);
                                                int arg_1B4F_1 = this.width;
                                                int arg_1B4F_2 = this.height;
                                                int arg_1B4F_3 = 15;
                                                float arg_1B4F_4 = 0f;
                                                float arg_1B4F_5 = 0f;
                                                int arg_1B4F_6 = 100;
                                                Color newColor = default(Color);
                                                int num38 = Dust.NewDust(arg_1B4F_0, arg_1B4F_1, arg_1B4F_2, arg_1B4F_3, arg_1B4F_4, arg_1B4F_5, arg_1B4F_6, newColor, 2f);
                                                Dust expr_1B5E = Main.dust[num38];
                                                expr_1B5E.Velocity *= 0.3f;
                                                Main.dust[num38].Position.X = this.Position.X + (float)(this.width / 2) + 4f + (float)Main.rand.Next(-4, 5);
                                                Main.dust[num38].Position.Y = this.Position.Y + (float)(this.height / 2) + (float)Main.rand.Next(-4, 5);
                                                Main.dust[num38].noGravity = true;
                                            }
                                            if (Main.myPlayer == this.Owner && this.ai[0] == 0f)
                                            {
                                                if (!Main.players[this.Owner].channel)
                                                {
                                                    this.Kill();
                                                }
                                            }
                                            if (this.type == 34)
                                            {
                                                this.rotation += 0.3f * (float)this.direction;
                                            }
                                            else
                                            {
                                                if (this.Velocity.X != 0f || this.Velocity.Y != 0f)
                                                {
                                                    this.rotation = (float)Math.Atan2((double)this.Velocity.Y, (double)this.Velocity.X) - 2.355f;
                                                }
                                            }
                                            if (this.Velocity.Y > 16f)
                                            {
                                                this.Velocity.Y = 16f;
                                                return;
                                            }
                                        }
                                        else
                                        {
                                            if (this.aiStyle == 10)
                                            {
                                                if (this.type == 31 && this.ai[0] != 2f)
                                                {
                                                    if (Main.rand.Next(2) == 0)
                                                    {
                                                        Vector2 arg_1E9B_0 = new Vector2(this.Position.X, this.Position.Y);
                                                        int arg_1E9B_1 = this.width;
                                                        int arg_1E9B_2 = this.height;
                                                        int arg_1E9B_3 = 32;
                                                        float arg_1E9B_4 = 0f;
                                                        float arg_1E9B_5 = this.Velocity.Y / 2f;
                                                        int arg_1E9B_6 = 0;
                                                        Color newColor = default(Color);
                                                        int num43 = Dust.NewDust(arg_1E9B_0, arg_1E9B_1, arg_1E9B_2, arg_1E9B_3, arg_1E9B_4, arg_1E9B_5, arg_1E9B_6, newColor, 1f);
                                                        Dust expr_1EAF_cp_0 = Main.dust[num43];
                                                        expr_1EAF_cp_0.Velocity.X = expr_1EAF_cp_0.Velocity.X * 0.4f;
                                                    }
                                                }
                                                else
                                                {
                                                    if (this.type == 39)
                                                    {
                                                        if (Main.rand.Next(2) == 0)
                                                        {
                                                            Vector2 arg_1F31_0 = new Vector2(this.Position.X, this.Position.Y);
                                                            int arg_1F31_1 = this.width;
                                                            int arg_1F31_2 = this.height;
                                                            int arg_1F31_3 = 38;
                                                            float arg_1F31_4 = 0f;
                                                            float arg_1F31_5 = this.Velocity.Y / 2f;
                                                            int arg_1F31_6 = 0;
                                                            Color newColor = default(Color);
                                                            int num44 = Dust.NewDust(arg_1F31_0, arg_1F31_1, arg_1F31_2, arg_1F31_3, arg_1F31_4, arg_1F31_5, arg_1F31_6, newColor, 1f);
                                                            Dust expr_1F45_cp_0 = Main.dust[num44];
                                                            expr_1F45_cp_0.Velocity.X = expr_1F45_cp_0.Velocity.X * 0.4f;
                                                        }
                                                    }
                                                    else
                                                    {
                                                        if (this.type == 40)
                                                        {
                                                            if (Main.rand.Next(2) == 0)
                                                            {
                                                                Vector2 arg_1FC7_0 = new Vector2(this.Position.X, this.Position.Y);
                                                                int arg_1FC7_1 = this.width;
                                                                int arg_1FC7_2 = this.height;
                                                                int arg_1FC7_3 = 36;
                                                                float arg_1FC7_4 = 0f;
                                                                float arg_1FC7_5 = this.Velocity.Y / 2f;
                                                                int arg_1FC7_6 = 0;
                                                                Color newColor = default(Color);
                                                                int num45 = Dust.NewDust(arg_1FC7_0, arg_1FC7_1, arg_1FC7_2, arg_1FC7_3, arg_1FC7_4, arg_1FC7_5, arg_1FC7_6, newColor, 1f);
                                                                Dust expr_1FD6 = Main.dust[num45];
                                                                expr_1FD6.Velocity *= 0.4f;
                                                            }
                                                        }
                                                        else
                                                        {
                                                            if (this.type == 42 || this.type == 31)
                                                            {
                                                                if (Main.rand.Next(2) == 0)
                                                                {
                                                                    Vector2 arg_2057_0 = new Vector2(this.Position.X, this.Position.Y);
                                                                    int arg_2057_1 = this.width;
                                                                    int arg_2057_2 = this.height;
                                                                    int arg_2057_3 = 32;
                                                                    float arg_2057_4 = 0f;
                                                                    float arg_2057_5 = 0f;
                                                                    int arg_2057_6 = 0;
                                                                    Color newColor = default(Color);
                                                                    int num46 = Dust.NewDust(arg_2057_0, arg_2057_1, arg_2057_2, arg_2057_3, arg_2057_4, arg_2057_5, arg_2057_6, newColor, 1f);
                                                                    Dust expr_206B_cp_0 = Main.dust[num46];
                                                                    expr_206B_cp_0.Velocity.X = expr_206B_cp_0.Velocity.X * 0.4f;
                                                                }
                                                            }
                                                            else
                                                            {
                                                                if (Main.rand.Next(20) == 0)
                                                                {
                                                                    Vector2 arg_20CE_0 = new Vector2(this.Position.X, this.Position.Y);
                                                                    int arg_20CE_1 = this.width;
                                                                    int arg_20CE_2 = this.height;
                                                                    int arg_20CE_3 = 0;
                                                                    float arg_20CE_4 = 0f;
                                                                    float arg_20CE_5 = 0f;
                                                                    int arg_20CE_6 = 0;
                                                                    Color newColor = default(Color);
                                                                    Dust.NewDust(arg_20CE_0, arg_20CE_1, arg_20CE_2, arg_20CE_3, arg_20CE_4, arg_20CE_5, arg_20CE_6, newColor, 1f);
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                                if (Main.myPlayer == this.Owner && this.ai[0] == 0f)
                                                {
                                                    if (!Main.players[this.Owner].channel)
                                                    {
                                                        this.ai[0] = 1f;
                                                        this.netUpdate = true;
                                                    }
                                                }
                                                if (this.ai[0] == 1f)
                                                {
                                                    if (this.type == 42)
                                                    {
                                                        this.ai[1] += 1f;
                                                        if (this.ai[1] >= 15f)
                                                        {
                                                            this.ai[1] = 15f;
                                                            this.Velocity.Y = this.Velocity.Y + 0.2f;
                                                        }
                                                    }
                                                    else
                                                    {
                                                        this.Velocity.Y = this.Velocity.Y + 0.41f;
                                                    }
                                                }
                                                else
                                                {
                                                    if (this.ai[0] == 2f)
                                                    {
                                                        this.Velocity.Y = this.Velocity.Y + 0.2f;
                                                        if ((double)this.Velocity.X < -0.04)
                                                        {
                                                            this.Velocity.X = this.Velocity.X + 0.04f;
                                                        }
                                                        else
                                                        {
                                                            if ((double)this.Velocity.X > 0.04)
                                                            {
                                                                this.Velocity.X = this.Velocity.X - 0.04f;
                                                            }
                                                            else
                                                            {
                                                                this.Velocity.X = 0f;
                                                            }
                                                        }
                                                    }
                                                }
                                                this.rotation += 0.1f;
                                                if (this.Velocity.Y > 10f)
                                                {
                                                    this.Velocity.Y = 10f;
                                                    return;
                                                }
                                            }
                                            else
                                            {
                                                if (this.aiStyle == 11)
                                                {
                                                    this.rotation += 0.02f;
                                                    if (Main.myPlayer == this.Owner)
                                                    {
                                                        if (Main.players[this.Owner].dead)
                                                        {
                                                            this.Kill();
                                                            return;
                                                        }
                                                        float num51 = 4f;
                                                        Vector2 vector8 = new Vector2(this.Position.X + (float)this.width * 0.5f, this.Position.Y + (float)this.height * 0.5f);
                                                        float num52 = Main.players[this.Owner].Position.X + (float)(Main.players[this.Owner].width / 2) - vector8.X;
                                                        float num53 = Main.players[this.Owner].Position.Y + (float)(Main.players[this.Owner].height / 2) - vector8.Y;
                                                        float num54 = (float)Math.Sqrt((double)(num52 * num52 + num53 * num53));
                                                        num54 = (float)Math.Sqrt((double)(num52 * num52 + num53 * num53));
                                                        if (num54 > (float)Main.screenWidth)
                                                        {
                                                            this.Position.X = Main.players[this.Owner].Position.X + (float)(Main.players[this.Owner].width / 2) - (float)(this.width / 2);
                                                            this.Position.Y = Main.players[this.Owner].Position.Y + (float)(Main.players[this.Owner].height / 2) - (float)(this.height / 2);
                                                            return;
                                                        }
                                                        if (num54 > 64f)
                                                        {
                                                            num54 = num51 / num54;
                                                            num52 *= num54;
                                                            num53 *= num54;
                                                            if (num52 != this.Velocity.X || num53 != this.Velocity.Y)
                                                            {
                                                                this.netUpdate = true;
                                                            }
                                                            this.Velocity.X = num52;
                                                            this.Velocity.Y = num53;
                                                            return;
                                                        }
                                                        if (this.Velocity.X != 0f || this.Velocity.Y != 0f)
                                                        {
                                                            this.netUpdate = true;
                                                        }
                                                        this.Velocity.X = 0f;
                                                        this.Velocity.Y = 0f;
                                                        return;
                                                    }
                                                }
                                                else
                                                {
                                                    if (this.aiStyle == 12)
                                                    {
                                                        this.scale -= 0.05f;
                                                        if (this.scale <= 0f)
                                                        {
                                                            this.Kill();
                                                        }
                                                        if (this.ai[0] > 4f)
                                                        {
                                                            this.alpha = 150;
                                                            this.light = 0.8f;
                                                            Vector2 arg_26C3_0 = new Vector2(this.Position.X, this.Position.Y);
                                                            int arg_26C3_1 = this.width;
                                                            int arg_26C3_2 = this.height;
                                                            int arg_26C3_3 = 29;
                                                            float arg_26C3_4 = this.Velocity.X;
                                                            float arg_26C3_5 = this.Velocity.Y;
                                                            int arg_26C3_6 = 100;
                                                            Color newColor = default(Color);
                                                            int num55 = Dust.NewDust(arg_26C3_0, arg_26C3_1, arg_26C3_2, arg_26C3_3, arg_26C3_4, arg_26C3_5, arg_26C3_6, newColor, 2.5f);
                                                            Main.dust[num55].noGravity = true;
                                                            Vector2 arg_2728_0 = new Vector2(this.Position.X, this.Position.Y);
                                                            int arg_2728_1 = this.width;
                                                            int arg_2728_2 = this.height;
                                                            int arg_2728_3 = 29;
                                                            float arg_2728_4 = this.Velocity.X;
                                                            float arg_2728_5 = this.Velocity.Y;
                                                            int arg_2728_6 = 100;
                                                            newColor = default(Color);
                                                            Dust.NewDust(arg_2728_0, arg_2728_1, arg_2728_2, arg_2728_3, arg_2728_4, arg_2728_5, arg_2728_6, newColor, 1.5f);
                                                        }
                                                        else
                                                        {
                                                            this.ai[0] += 1f;
                                                        }
                                                        this.rotation += 0.3f * (float)this.direction;
                                                        return;
                                                    }
                                                    if (this.aiStyle == 13)
                                                    {
                                                        if (Main.players[this.Owner].dead)
                                                        {
                                                            this.Kill();
                                                            return;
                                                        }
                                                        Main.players[this.Owner].itemAnimation = 5;
                                                        Main.players[this.Owner].itemTime = 5;
                                                        if (this.Position.X + (float)(this.width / 2) > Main.players[this.Owner].Position.X + (float)(Main.players[this.Owner].width / 2))
                                                        {
                                                            Main.players[this.Owner].direction = 1;
                                                        }
                                                        else
                                                        {
                                                            Main.players[this.Owner].direction = -1;
                                                        }
                                                        Vector2 vector9 = new Vector2(this.Position.X + (float)this.width * 0.5f, this.Position.Y + (float)this.height * 0.5f);
                                                        float num56 = Main.players[this.Owner].Position.X + (float)(Main.players[this.Owner].width / 2) - vector9.X;
                                                        float num57 = Main.players[this.Owner].Position.Y + (float)(Main.players[this.Owner].height / 2) - vector9.Y;
                                                        float num58 = (float)Math.Sqrt((double)(num56 * num56 + num57 * num57));
                                                        if (this.ai[0] == 0f)
                                                        {
                                                            if (num58 > 600f)
                                                            {
                                                                this.ai[0] = 1f;
                                                            }
                                                            this.rotation = (float)Math.Atan2((double)this.Velocity.Y, (double)this.Velocity.X) + 1.57f;
                                                            this.ai[1] += 1f;
                                                            if (this.ai[1] > 2f)
                                                            {
                                                                this.alpha = 0;
                                                            }
                                                            if (this.ai[1] >= 10f)
                                                            {
                                                                this.ai[1] = 15f;
                                                                this.Velocity.Y = this.Velocity.Y + 0.3f;
                                                                return;
                                                            }
                                                        }
                                                        else
                                                        {
                                                            if (this.ai[0] == 1f)
                                                            {
                                                                this.tileCollide = false;
                                                                this.rotation = (float)Math.Atan2((double)num57, (double)num56) - 1.57f;
                                                                float num59 = 11f;
                                                                if (num58 < 50f)
                                                                {
                                                                    this.Kill();
                                                                }
                                                                num58 = num59 / num58;
                                                                num56 *= num58;
                                                                num57 *= num58;
                                                                this.Velocity.X = num56;
                                                                this.Velocity.Y = num57;
                                                                return;
                                                            }
                                                        }
                                                    }
                                                    else
                                                    {
                                                        if (this.aiStyle == 14)
                                                        {
                                                            if (this.type == 0x35)
                                                            {
                                                                try
                                                                {
                                                                    Vector2 vector10 = Collision.TileCollision(this.Position, this.Velocity, this.width, this.height, false, false);
                                                                    bool flag1 = this.Velocity != vector10;
                                                                    int num66 = ((int)(this.Position.X / 16f)) - 1;
                                                                    int num67 = ((int)((this.Position.X + this.width) / 16f)) + 2;
                                                                    int num68 = ((int)(this.Position.Y / 16f)) - 1;
                                                                    int num69 = ((int)((this.Position.Y + this.height) / 16f)) + 2;
                                                                    if (num66 < 0)
                                                                    {
                                                                        num66 = 0;
                                                                    }
                                                                    if (num67 > Main.maxTilesX)
                                                                    {
                                                                        num67 = Main.maxTilesX;
                                                                    }
                                                                    if (num68 < 0)
                                                                    {
                                                                        num68 = 0;
                                                                    }
                                                                    if (num69 > Main.maxTilesY)
                                                                    {
                                                                        num69 = Main.maxTilesY;
                                                                    }
                                                                    for (int num70 = num66; num70 < num67; num70++)
                                                                    {
                                                                        for (int num71 = num68; num71 < num69; num71++)
                                                                        {
                                                                            if (((Main.tile[num70, num71] != null) && Main.tile[num70, num71].Active) && (Main.tileSolid[Main.tile[num70, num71].type] || (Main.tileSolidTop[Main.tile[num70, num71].type] && (Main.tile[num70, num71].frameY == 0))))
                                                                            {
                                                                                Vector2 vector11;
                                                                                vector11.X = num70 * 0x10;
                                                                                vector11.Y = num71 * 0x10;
                                                                                if ((((this.Position.X + this.width) > vector11.X) && (this.Position.X < (vector11.X + 16f))) && (((this.Position.Y + this.height) > vector11.Y) && (this.Position.Y < (vector11.Y + 16f))))
                                                                                {
                                                                                    this.Velocity.X = 0f;
                                                                                    this.Velocity.Y = -0.2f;
                                                                                }
                                                                            }
                                                                        }
                                                                    }
                                                                }
                                                                catch
                                                                {
                                                                }
                                                            }

                                                            this.ai[0] += 1f;
                                                            if (this.ai[0] > 5f)
                                                            {
                                                                this.ai[0] = 5f;
                                                                if (this.Velocity.Y == 0f && this.Velocity.X != 0f)
                                                                {
                                                                    this.Velocity.X = this.Velocity.X * 0.97f;
                                                                    if ((double)this.Velocity.X > -0.01 && (double)this.Velocity.X < 0.01)
                                                                    {
                                                                        this.Velocity.X = 0f;
                                                                        this.netUpdate = true;
                                                                    }
                                                                }
                                                                this.Velocity.Y = this.Velocity.Y + 0.2f;
                                                            }
                                                            this.rotation += this.Velocity.X * 0.1f;
                                                            return;
                                                        }
                                                        if (this.aiStyle == 15)
                                                        {
                                                            if (this.type == 25)
                                                            {
                                                                if (Main.rand.Next(15) == 0)
                                                                {
                                                                    Vector2 arg_2D89_0 = this.Position;
                                                                    int arg_2D89_1 = this.width;
                                                                    int arg_2D89_2 = this.height;
                                                                    int arg_2D89_3 = 14;
                                                                    float arg_2D89_4 = 0f;
                                                                    float arg_2D89_5 = 0f;
                                                                    int arg_2D89_6 = 150;
                                                                    Color newColor = default(Color);
                                                                    Dust.NewDust(arg_2D89_0, arg_2D89_1, arg_2D89_2, arg_2D89_3, arg_2D89_4, arg_2D89_5, arg_2D89_6, newColor, 1.3f);
                                                                }
                                                            }
                                                            else
                                                            {
                                                                if (this.type == 26)
                                                                {
                                                                    Vector2 arg_2DE8_0 = this.Position;
                                                                    int arg_2DE8_1 = this.width;
                                                                    int arg_2DE8_2 = this.height;
                                                                    int arg_2DE8_3 = 29;
                                                                    float arg_2DE8_4 = this.Velocity.X * 0.4f;
                                                                    float arg_2DE8_5 = this.Velocity.Y * 0.4f;
                                                                    int arg_2DE8_6 = 100;
                                                                    Color newColor = default(Color);
                                                                    int num66 = Dust.NewDust(arg_2DE8_0, arg_2DE8_1, arg_2DE8_2, arg_2DE8_3, arg_2DE8_4, arg_2DE8_5, arg_2DE8_6, newColor, 2.5f);
                                                                    Main.dust[num66].noGravity = true;
                                                                    Dust expr_2E0A_cp_0 = Main.dust[num66];
                                                                    expr_2E0A_cp_0.Velocity.X = expr_2E0A_cp_0.Velocity.X / 2f;
                                                                    Dust expr_2E28_cp_0 = Main.dust[num66];
                                                                    expr_2E28_cp_0.Velocity.Y = expr_2E28_cp_0.Velocity.Y / 2f;
                                                                }
                                                                else
                                                                {
                                                                    if (this.type == 35)
                                                                    {
                                                                        Vector2 arg_2E91_0 = this.Position;
                                                                        int arg_2E91_1 = this.width;
                                                                        int arg_2E91_2 = this.height;
                                                                        int arg_2E91_3 = 6;
                                                                        float arg_2E91_4 = this.Velocity.X * 0.4f;
                                                                        float arg_2E91_5 = this.Velocity.Y * 0.4f;
                                                                        int arg_2E91_6 = 100;
                                                                        Color newColor = default(Color);
                                                                        int num67 = Dust.NewDust(arg_2E91_0, arg_2E91_1, arg_2E91_2, arg_2E91_3, arg_2E91_4, arg_2E91_5, arg_2E91_6, newColor, 3f);
                                                                        Main.dust[num67].noGravity = true;
                                                                        Dust expr_2EB3_cp_0 = Main.dust[num67];
                                                                        expr_2EB3_cp_0.Velocity.X = expr_2EB3_cp_0.Velocity.X * 2f;
                                                                        Dust expr_2ED1_cp_0 = Main.dust[num67];
                                                                        expr_2ED1_cp_0.Velocity.Y = expr_2ED1_cp_0.Velocity.Y * 2f;
                                                                    }
                                                                }
                                                            }
                                                            if (Main.players[this.Owner].dead)
                                                            {
                                                                this.Kill();
                                                                return;
                                                            }
                                                            Main.players[this.Owner].itemAnimation = 5;
                                                            Main.players[this.Owner].itemTime = 5;
                                                            if (this.Position.X + (float)(this.width / 2) > Main.players[this.Owner].Position.X + (float)(Main.players[this.Owner].width / 2))
                                                            {
                                                                Main.players[this.Owner].direction = 1;
                                                            }
                                                            else
                                                            {
                                                                Main.players[this.Owner].direction = -1;
                                                            }
                                                            Vector2 vector11 = new Vector2(this.Position.X + (float)this.width * 0.5f, this.Position.Y + (float)this.height * 0.5f);
                                                            float num68 = Main.players[this.Owner].Position.X + (float)(Main.players[this.Owner].width / 2) - vector11.X;
                                                            float num69 = Main.players[this.Owner].Position.Y + (float)(Main.players[this.Owner].height / 2) - vector11.Y;
                                                            float num70 = (float)Math.Sqrt((double)(num68 * num68 + num69 * num69));
                                                            if (this.ai[0] == 0f)
                                                            {
                                                                this.tileCollide = true;
                                                                if (num70 > 300f)
                                                                {
                                                                    this.ai[0] = 1f;
                                                                }
                                                                else
                                                                {
                                                                    this.ai[1] += 1f;
                                                                    if (this.ai[1] > 2f)
                                                                    {
                                                                        this.alpha = 0;
                                                                    }
                                                                    if (this.ai[1] >= 5f)
                                                                    {
                                                                        this.ai[1] = 15f;
                                                                        this.Velocity.Y = this.Velocity.Y + 0.5f;
                                                                        this.Velocity.X = this.Velocity.X * 0.95f;
                                                                    }
                                                                }
                                                            }
                                                            else
                                                            {
                                                                if (this.ai[0] == 1f)
                                                                {
                                                                    this.tileCollide = false;
                                                                    float num71 = 11f;
                                                                    if (num70 < 20f)
                                                                    {
                                                                        this.Kill();
                                                                    }
                                                                    num70 = num71 / num70;
                                                                    num68 *= num70;
                                                                    num69 *= num70;
                                                                    this.Velocity.X = num68;
                                                                    this.Velocity.Y = num69;
                                                                }
                                                            }
                                                            this.rotation += this.Velocity.X * 0.03f;
                                                            return;
                                                        }
                                                        else
                                                        {
                                                            if (this.aiStyle == 16)
                                                            {
                                                                if (this.type == 37)
                                                                {
                                                                    try
                                                                    {
                                                                        int num72 = (int)(this.Position.X / 16f) - 1;
                                                                        int num73 = (int)((this.Position.X + (float)this.width) / 16f) + 2;
                                                                        int num74 = (int)(this.Position.Y / 16f) - 1;
                                                                        int num75 = (int)((this.Position.Y + (float)this.height) / 16f) + 2;
                                                                        if (num72 < 0)
                                                                        {
                                                                            num72 = 0;
                                                                        }
                                                                        if (num73 > Main.maxTilesX)
                                                                        {
                                                                            num73 = Main.maxTilesX;
                                                                        }
                                                                        if (num74 < 0)
                                                                        {
                                                                            num74 = 0;
                                                                        }
                                                                        if (num75 > Main.maxTilesY)
                                                                        {
                                                                            num75 = Main.maxTilesY;
                                                                        }
                                                                        for (int num76 = num72; num76 < num73; num76++)
                                                                        {
                                                                            for (int num77 = num74; num77 < num75; num77++)
                                                                            {
                                                                                if (Main.tile[num76, num77] != null && Main.tile[num76, num77].Active && (Main.tileSolid[(int)Main.tile[num76, num77].type] || (Main.tileSolidTop[(int)Main.tile[num76, num77].type] && Main.tile[num76, num77].frameY == 0)))
                                                                                {
                                                                                    Vector2 vector12;
                                                                                    vector12.X = (float)(num76 * 16);
                                                                                    vector12.Y = (float)(num77 * 16);
                                                                                    if (this.Position.X + (float)this.width - 4f > vector12.X && this.Position.X + 4f < vector12.X + 16f && this.Position.Y + (float)this.height - 4f > vector12.Y && this.Position.Y + 4f < vector12.Y + 16f)
                                                                                    {
                                                                                        this.Velocity.X = 0f;
                                                                                        this.Velocity.Y = -0.2f;
                                                                                    }
                                                                                }
                                                                            }
                                                                        }
                                                                    }
                                                                    catch
                                                                    {
                                                                    }
                                                                }
                                                                if (this.Owner == Main.myPlayer && this.timeLeft <= 3)
                                                                {
                                                                    this.ai[1] = 0f;
                                                                    this.alpha = 255;
                                                                    if (this.type == 28 || this.type == 37)
                                                                    {
                                                                        this.Position.X = this.Position.X + (float)(this.width / 2);
                                                                        this.Position.Y = this.Position.Y + (float)(this.height / 2);
                                                                        this.width = 128;
                                                                        this.height = 128;
                                                                        this.Position.X = this.Position.X - (float)(this.width / 2);
                                                                        this.Position.Y = this.Position.Y - (float)(this.height / 2);
                                                                        this.damage = 100;
                                                                        this.knockBack = 8f;
                                                                    }
                                                                    else
                                                                    {
                                                                        if (this.type == 29)
                                                                        {
                                                                            this.Position.X = this.Position.X + (float)(this.width / 2);
                                                                            this.Position.Y = this.Position.Y + (float)(this.height / 2);
                                                                            this.width = 250;
                                                                            this.height = 250;
                                                                            this.Position.X = this.Position.X - (float)(this.width / 2);
                                                                            this.Position.Y = this.Position.Y - (float)(this.height / 2);
                                                                            this.damage = 250;
                                                                            this.knockBack = 10f;
                                                                        }
                                                                        else
                                                                        {
                                                                            if (this.type == 30)
                                                                            {
                                                                                this.Position.X = this.Position.X + (float)(this.width / 2);
                                                                                this.Position.Y = this.Position.Y + (float)(this.height / 2);
                                                                                this.width = 128;
                                                                                this.height = 128;
                                                                                this.Position.X = this.Position.X - (float)(this.width / 2);
                                                                                this.Position.Y = this.Position.Y - (float)(this.height / 2);
                                                                                this.knockBack = 8f;
                                                                            }
                                                                        }
                                                                    }
                                                                }
                                                                else
                                                                {
                                                                    if (this.type != 30 && Main.rand.Next(4) == 0)
                                                                    {
                                                                        if (this.type != 30)
                                                                        {
                                                                            this.damage = 0;
                                                                        }
                                                                        Vector2 arg_3629_0 = new Vector2(this.Position.X, this.Position.Y);
                                                                        int arg_3629_1 = this.width;
                                                                        int arg_3629_2 = this.height;
                                                                        int arg_3629_3 = 6;
                                                                        float arg_3629_4 = 0f;
                                                                        float arg_3629_5 = 0f;
                                                                        int arg_3629_6 = 100;
                                                                        Color newColor = default(Color);
                                                                        Dust.NewDust(arg_3629_0, arg_3629_1, arg_3629_2, arg_3629_3, arg_3629_4, arg_3629_5, arg_3629_6, newColor, 1f);
                                                                    }
                                                                }
                                                                this.ai[0] += 1f;
                                                                if ((this.type == 30 && this.ai[0] > 10f) || (this.type != 30 && this.ai[0] > 5f))
                                                                {
                                                                    this.ai[0] = 10f;
                                                                    if (this.Velocity.Y == 0f && this.Velocity.X != 0f)
                                                                    {
                                                                        this.Velocity.X = this.Velocity.X * 0.97f;
                                                                        if (this.type == 29)
                                                                        {
                                                                            this.Velocity.X = this.Velocity.X * 0.99f;
                                                                        }
                                                                        if ((double)this.Velocity.X > -0.01 && (double)this.Velocity.X < 0.01)
                                                                        {
                                                                            this.Velocity.X = 0f;
                                                                            this.netUpdate = true;
                                                                        }
                                                                    }
                                                                    this.Velocity.Y = this.Velocity.Y + 0.2f;
                                                                }
                                                                this.rotation += this.Velocity.X * 0.1f;
                                                                return;
                                                            }
                                                            if (this.aiStyle == 17)
                                                            {
                                                                if (this.Velocity.Y == 0f)
                                                                {
                                                                    this.Velocity.X = this.Velocity.X * 0.98f;
                                                                }
                                                                this.rotation += this.Velocity.X * 0.1f;
                                                                this.Velocity.Y = this.Velocity.Y + 0.2f;
                                                                if (this.Owner == Main.myPlayer)
                                                                {
                                                                    int num78 = (int)((this.Position.X + (float)this.width) / 16f);
                                                                    int num79 = (int)((this.Position.Y + (float)this.height) / 16f);
                                                                    if (Main.tile[num78, num79] != null && !Main.tile[num78, num79].Active)
                                                                    {
                                                                        WorldGen.PlaceTile(num78, num79, 85, false, false, -1, 0);
                                                                        if (Main.tile[num78, num79].Active)
                                                                        {
                                                                            if (Main.netMode != 0)
                                                                            {
                                                                                NetMessage.SendData(17, -1, -1, "", 1, (float)num78, (float)num79, 85f);
                                                                            }
                                                                            int num80 = Sign.ReadSign(num78, num79);
                                                                            if (num80 >= 0)
                                                                            {
                                                                                //Need to check if this works :3
                                                                                PlayerEditSignEvent playerEvent = new PlayerEditSignEvent();
                                                                                playerEvent.Sender = Main.players[Main.myPlayer];
                                                                                playerEvent.setSign(Main.sign[num80]);
                                                                                playerEvent.setText(this.miscText);
                                                                                playerEvent.setIsPlayer(false);
                                                                                Program.server.getPluginManager().processHook(Hooks.PLAYER_EDITSIGN, playerEvent);
                                                                                if (playerEvent.Cancelled)
                                                                                {
                                                                                    return;
                                                                                }

                                                                                Sign.TextSign(num80, this.miscText);
                                                                            }
                                                                            this.Kill();
                                                                            return;
                                                                        }
                                                                    }
                                                                }
                                                            }
                                                            else
                                                            {
                                                                if (this.aiStyle == 18)
                                                                {
                                                                    if (this.ai[1] == 0f && this.type == 44)
                                                                    {
                                                                        this.ai[1] = 1f;
                                                                    }
                                                                    this.rotation += (float)this.direction * 0.8f;
                                                                    this.ai[0] += 1f;
                                                                    if (this.ai[0] >= 30f)
                                                                    {
                                                                        if (this.ai[0] < 100f)
                                                                        {
                                                                            this.Velocity *= 1.06f;
                                                                        }
                                                                        else
                                                                        {
                                                                            this.ai[0] = 200f;
                                                                        }
                                                                    }
                                                                    for (int num81 = 0; num81 < 2; num81++)
                                                                    {
                                                                        Vector2 arg_39CC_0 = new Vector2(this.Position.X, this.Position.Y);
                                                                        int arg_39CC_1 = this.width;
                                                                        int arg_39CC_2 = this.height;
                                                                        int arg_39CC_3 = 27;
                                                                        float arg_39CC_4 = 0f;
                                                                        float arg_39CC_5 = 0f;
                                                                        int arg_39CC_6 = 100;
                                                                        Color newColor = default(Color);
                                                                        int num82 = Dust.NewDust(arg_39CC_0, arg_39CC_1, arg_39CC_2, arg_39CC_3, arg_39CC_4, arg_39CC_5, arg_39CC_6, newColor, 1f);
                                                                        Main.dust[num82].noGravity = true;
                                                                    }
                                                                    return;
                                                                }
                                                                if (this.aiStyle == 19)
                                                                {
                                                                    this.direction = Main.players[this.Owner].direction;
                                                                    Main.players[this.Owner].heldProj = this.whoAmI;
                                                                    this.Position.X = Main.players[this.Owner].Position.X + (float)(Main.players[this.Owner].width / 2) - (float)(this.width / 2);
                                                                    this.Position.Y = Main.players[this.Owner].Position.Y + (float)(Main.players[this.Owner].height / 2) - (float)(this.height / 2);
                                                                    if (this.type == 46)
                                                                    {
                                                                        if (this.ai[0] == 0f)
                                                                        {
                                                                            this.ai[0] = 3f;
                                                                            this.netUpdate = true;
                                                                        }
                                                                        if (Main.players[this.Owner].itemAnimation < Main.players[this.Owner].inventory[Main.players[this.Owner].selectedItemIndex].UseAnimation / 3)
                                                                        {
                                                                            this.ai[0] -= 1.6f;
                                                                        }
                                                                        else
                                                                        {
                                                                            this.ai[0] += 1.4f;
                                                                        }
                                                                    }
                                                                    else
                                                                    {
                                                                        if (this.type == 47)
                                                                        {
                                                                            if (this.ai[0] == 0f)
                                                                            {
                                                                                this.ai[0] = 4f;
                                                                                this.netUpdate = true;
                                                                            }
                                                                            if (Main.players[this.Owner].itemAnimation < Main.players[this.Owner].inventory[Main.players[this.Owner].selectedItemIndex].UseAnimation / 3)
                                                                            {
                                                                                this.ai[0] -= 1.2f;
                                                                            }
                                                                            else
                                                                            {
                                                                                this.ai[0] += 0.9f;
                                                                            }
                                                                        }
                                                                        else
                                                                        {
                                                                            if (this.type == 49)
                                                                            {
                                                                                if (this.ai[0] == 0f)
                                                                                {
                                                                                    this.ai[0] = 4f;
                                                                                    this.netUpdate = true;
                                                                                }
                                                                                if (Main.players[this.Owner].itemAnimation < Main.players[this.Owner].inventory[Main.players[this.Owner].selectedItemIndex].UseAnimation / 3)
                                                                                {
                                                                                    this.ai[0] -= 1.1f;
                                                                                }
                                                                                else
                                                                                {
                                                                                    this.ai[0] += 0.85f;
                                                                                }
                                                                            }
                                                                        }
                                                                    }
                                                                    this.Position += this.Velocity * this.ai[0];
                                                                    if (Main.players[this.Owner].itemAnimation == 0)
                                                                    {
                                                                        this.Kill();
                                                                    }
                                                                    this.rotation = (float)Math.Atan2((double)this.Velocity.Y, (double)this.Velocity.X) + 2.355f;
                                                                    if (this.type == 46)
                                                                    {
                                                                        Color newColor;
                                                                        if (Main.rand.Next(5) == 0)
                                                                        {
                                                                            Vector2 arg_3D66_0 = this.Position;
                                                                            int arg_3D66_1 = this.width;
                                                                            int arg_3D66_2 = this.height;
                                                                            int arg_3D66_3 = 14;
                                                                            float arg_3D66_4 = 0f;
                                                                            float arg_3D66_5 = 0f;
                                                                            int arg_3D66_6 = 150;
                                                                            newColor = default(Color);
                                                                            Dust.NewDust(arg_3D66_0, arg_3D66_1, arg_3D66_2, arg_3D66_3, arg_3D66_4, arg_3D66_5, arg_3D66_6, newColor, 1.4f);
                                                                        }
                                                                        Vector2 arg_3DBD_0 = this.Position;
                                                                        int arg_3DBD_1 = this.width;
                                                                        int arg_3DBD_2 = this.height;
                                                                        int arg_3DBD_3 = 27;
                                                                        float arg_3DBD_4 = this.Velocity.X * 0.2f + (float)(this.direction * 3);
                                                                        float arg_3DBD_5 = this.Velocity.Y * 0.2f;
                                                                        int arg_3DBD_6 = 100;
                                                                        newColor = default(Color);
                                                                        int num83 = Dust.NewDust(arg_3DBD_0, arg_3DBD_1, arg_3DBD_2, arg_3DBD_3, arg_3DBD_4, arg_3DBD_5, arg_3DBD_6, newColor, 1.2f);
                                                                        Main.dust[num83].noGravity = true;
                                                                        Dust expr_3DDF_cp_0 = Main.dust[num83];
                                                                        expr_3DDF_cp_0.Velocity.X = expr_3DDF_cp_0.Velocity.X / 2f;
                                                                        Dust expr_3DFD_cp_0 = Main.dust[num83];
                                                                        expr_3DFD_cp_0.Velocity.Y = expr_3DFD_cp_0.Velocity.Y / 2f;
                                                                        Vector2 arg_3E55_0 = this.Position - this.Velocity * 2f;
                                                                        int arg_3E55_1 = this.width;
                                                                        int arg_3E55_2 = this.height;
                                                                        int arg_3E55_3 = 27;
                                                                        float arg_3E55_4 = 0f;
                                                                        float arg_3E55_5 = 0f;
                                                                        int arg_3E55_6 = 150;
                                                                        newColor = default(Color);
                                                                        num83 = Dust.NewDust(arg_3E55_0, arg_3E55_1, arg_3E55_2, arg_3E55_3, arg_3E55_4, arg_3E55_5, arg_3E55_6, newColor, 1.4f);
                                                                        Dust expr_3E69_cp_0 = Main.dust[num83];
                                                                        expr_3E69_cp_0.Velocity.X = expr_3E69_cp_0.Velocity.X / 5f;
                                                                        Dust expr_3E87_cp_0 = Main.dust[num83];
                                                                        expr_3E87_cp_0.Velocity.Y = expr_3E87_cp_0.Velocity.Y / 5f;
                                                                    }
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
        public override void onPlayerEditSign(PlayerEditSignEvent Event)
        {
            //base.onPlayerEditSign(Event);

            Player player = Event.Player;

            player.sendMessage("Sign! "+Event.Text);
            //Event.Sign.text = "This is a test";
            Program.tConsole.WriteLine("Sign has been edited");

            //Event.Cancelled = true;
        }
 /// <summary>
 /// Hook method for all player-initiated sign edits
 /// </summary>
 /// <param name="Event">PlayerEditSignEvent info</param>
 public virtual void onPlayerEditSign(PlayerEditSignEvent Event)
 {
 }
 public override void onPlayerEditSign(PlayerEditSignEvent Event)
 {
     if (isEnabled == false || configSignEdit == false)
     {
         return;
     }
     else
     {
         Player Player = (Player)Event.Sender;
         if (Math.Sqrt(Math.Pow((Player.Location.X / 16 - Event.Sign.x), 2) + Math.Pow((Player.Location.Y / 16 - Event.Sign.y), 2)) > configRange)
         {
             Event.Cancelled = true;
             Player.sendMessage("You are too far away to edit that sign.",255,255,0,0);
             Program.tConsole.WriteLine("[" + base.Name + "] Cancelled Sign Edit of Player: " + Player.Name);
         }
     }
 }
Exemple #7
0
 public override void onPlayerEditSign(PlayerEditSignEvent Event)
 {
     Player player = Server.GetPlayerByName(Event.Sender.Name);
     if (IsInsideAnotherHouse(player.Name, (int)Event.Sign.x, (int)Event.Sign.y, CHECK_SIGN_LOCK) &&
         !player.Op)
     {
         Event.Cancelled = true;
         player.sendMessage("You cannot edit this sign, it's locked and inside someone else's house", chatColor);
     }
     base.onPlayerEditSign(Event);
 }