/// <summary>
 /// Hook method for boss Deaths
 /// </summary>
 /// <param name="Event">NPCBossDeathEvent info</param>
 public virtual void onNPCBossDeath(NPCBossDeathEvent Event)
 {
 }
        /// <summary>
        /// Drops loot from dead NPC
        /// </summary>
        public void NPCLoot()
        {
            if (this.type == NPCType.N01_BLUE_SLIME || this.type == NPCType.N16_MOTHER_SLIME)
            {
                Item.NewItem((int)this.Position.X, (int)this.Position.Y, this.Width, this.Height, 23, Main.rand.Next(1, 3), false);
            }
            else if (this.type == NPCType.N71_DUNGEON_SLIME)
            {
                Item.NewItem((int)this.Position.X, (int)this.Position.Y, this.Width, this.Height, 327, 1, false);
            }
            else if (this.type == NPCType.N02_DEMON_EYE)
            {
                if (Main.rand.Next(3) == 0)
                {
                    Item.NewItem((int)this.Position.X, (int)this.Position.Y, this.Width, this.Height, 38, 1, false);
                }
                else
                {
                    if (Main.rand.Next(100) == 0)
                    {
                        Item.NewItem((int)this.Position.X, (int)this.Position.Y, this.Width, this.Height, 236, 1, false);
                    }
                }
            }
            else if (this.type == NPCType.N58_PIRANHA)
            {
                if (Main.rand.Next(500) == 0)
                {
                    Item.NewItem((int)this.Position.X, (int)this.Position.Y, this.Width, this.Height, 263, 1, false);
                }
                else
                {
                    if (Main.rand.Next(40) == 0)
                    {
                        Item.NewItem((int)this.Position.X, (int)this.Position.Y, this.Width, this.Height, 118, 1, false);
                    }
                }
            }
            else if (this.type == NPCType.N03_ZOMBIE && Main.rand.Next(50) == 0)
            {
                Item.NewItem((int)this.Position.X, (int)this.Position.Y, this.Width, this.Height, 216, 1, false);
            }
            else if (this.type == NPCType.N66_VOODOO_DEMON)
            {
                Item.NewItem((int)this.Position.X, (int)this.Position.Y, this.Width, this.Height, 267, 1, false);
            }
            else if (this.type == NPCType.N62_DEMON && Main.rand.Next(50) == 0)
            {
                Item.NewItem((int)this.Position.X, (int)this.Position.Y, this.Width, this.Height, 272, 1, false);
            }
            else if (this.type == NPCType.N52_DOCTOR_BONES)
            {
                Item.NewItem((int)this.Position.X, (int)this.Position.Y, this.Width, this.Height, 251, 1, false);
            }
            else if (this.type == NPCType.N53_THE_GROOM)
            {
                Item.NewItem((int)this.Position.X, (int)this.Position.Y, this.Width, this.Height, 239, 1, false);
            }
            else if (this.type == NPCType.N54_CLOTHIER)
            {
                Item.NewItem((int)this.Position.X, (int)this.Position.Y, this.Width, this.Height, 260, 1, false);
            }
            else if (this.type == NPCType.N55_GOLDFISH)
            {
                Item.NewItem((int)this.Position.X, (int)this.Position.Y, this.Width, this.Height, 261, 1, false);
            }
            else if (this.type == NPCType.N69_ANTLION && Main.rand.Next(10) == 0)
            {
                Item.NewItem((int)this.Position.X, (int)this.Position.Y, this.Width, this.Height, 323, 1, false);
            }
            else if (this.type == NPCType.N73_GOBLIN_SCOUT)
            {
                Item.NewItem((int)this.Position.X, (int)this.Position.Y, this.Width, this.Height, 362, 1, false);
            }
            else if (this.type == NPCType.N04_EYE_OF_CTHULU)
            {
                int stack = Main.rand.Next(30) + 20;
                Item.NewItem((int)this.Position.X, (int)this.Position.Y, this.Width, this.Height, 47, stack, false);
                stack = Main.rand.Next(20) + 10;
                Item.NewItem((int)this.Position.X, (int)this.Position.Y, this.Width, this.Height, 56, stack, false);
                stack = Main.rand.Next(20) + 10;
                Item.NewItem((int)this.Position.X, (int)this.Position.Y, this.Width, this.Height, 56, stack, false);
                stack = Main.rand.Next(20) + 10;
                Item.NewItem((int)this.Position.X, (int)this.Position.Y, this.Width, this.Height, 56, stack, false);
                stack = Main.rand.Next(3) + 1;
                Item.NewItem((int)this.Position.X, (int)this.Position.Y, this.Width, this.Height, 59, stack, false);
            }
            else if (this.type == NPCType.N06_EATER_OF_SOULS && Main.rand.Next(3) == 0)
            {
                Item.NewItem((int)this.Position.X, (int)this.Position.Y, this.Width, this.Height, 68, 1, false);
            }
            else if (this.type == NPCType.N07_DEVOURER_HEAD || this.type == NPCType.N08_DEVOURER_BODY || this.type == NPCType.N09_DEVOURER_TAIL)
            {
                if (Main.rand.Next(3) == 0)
                {
                    Item.NewItem((int)this.Position.X, (int)this.Position.Y, this.Width, this.Height, 68, Main.rand.Next(1, 3), false);
                }
                Item.NewItem((int)this.Position.X, (int)this.Position.Y, this.Width, this.Height, 69, Main.rand.Next(3, 9), false);
            }
            else if ((this.type == NPCType.N10_GIANT_WORM_HEAD || this.type == NPCType.N11_GIANT_WORM_BODY || this.type == NPCType.N12_GIANT_WORM_TAIL) && Main.rand.Next(500) == 0)
            {
                Item.NewItem((int)this.Position.X, (int)this.Position.Y, this.Width, this.Height, 215, 1, false);
            }
            else if (this.type == NPCType.N47_CORRUPT_BUNNY && Main.rand.Next(75) == 0)
            {
                Item.NewItem((int)this.Position.X, (int)this.Position.Y, this.Width, this.Height, 243, 1, false);
            }
            else if (this.type == NPCType.N13_EATER_OF_WORLDS_HEAD || this.type == NPCType.N14_EATER_OF_WORLDS_BODY || this.type == NPCType.N15_EATER_OF_WORLDS_TAIL)
            {
                int stack2 = Main.rand.Next(1, 3);
                if (Main.rand.Next(2) == 0)
                {
                    Item.NewItem((int)this.Position.X, (int)this.Position.Y, this.Width, this.Height, 86, stack2, false);
                }
                if (Main.rand.Next(2) == 0)
                {
                    stack2 = Main.rand.Next(2, 6);
                    Item.NewItem((int)this.Position.X, (int)this.Position.Y, this.Width, this.Height, 56, stack2, false);
                }
                if (this.boss)
                {
                    stack2 = Main.rand.Next(10, 30);
                    Item.NewItem((int)this.Position.X, (int)this.Position.Y, this.Width, this.Height, 56, stack2, false);
                    stack2 = Main.rand.Next(10, 31);
                    Item.NewItem((int)this.Position.X, (int)this.Position.Y, this.Width, this.Height, 56, stack2, false);
                }
                if (Main.rand.Next(3) == 0 && Main.players[(int)Player.FindClosest(this.Position, this.Width, this.Height)].statLife < Main.players[(int)Player.FindClosest(this.Position, this.Width, this.Height)].statLifeMax)
                {
                    Item.NewItem((int)this.Position.X, (int)this.Position.Y, this.Width, this.Height, 58, 1, false);
                }
            }
            //            if (this.type == NPCType.N39_BONE_SERPENT_HEAD || this.type == NPCType.N40_BONE_SERPENT_BODY || this.type == NPCType.N41_BONE_SERPENT_TAIL)
            //            {
            //                if (Main.rand.Next(100) == 0)
            //                {
            //                    Item.NewItem((int)this.Position.X, (int)this.Position.Y, this.Width, this.Height, 220, 1, false);
            //                }
            //                else
            //                {
            //                    if (Main.rand.Next(100) == 0)
            //                    {
            //                        Item.NewItem((int)this.Position.X, (int)this.Position.Y, this.Width, this.Height, 218, 1, false);
            //                    }
            //                }
            //            }
            else if (this.type == NPCType.N63_BLUE_JELLYFISH || this.type == NPCType.N64_PINK_JELLYFISH)
            {
                Item.NewItem((int)this.Position.X, (int)this.Position.Y, this.Width, this.Height, 282, Main.rand.Next(1, 5), false);
            }
            else if (this.type == NPCType.N21_SKELETON || this.type == NPCType.N44_UNDEAD_MINER)
            {
                if (Main.rand.Next(25) == 0)
                {
                    Item.NewItem((int)this.Position.X, (int)this.Position.Y, this.Width, this.Height, 118, 1, false);
                }
                else
                {
                    if (this.type == NPCType.N44_UNDEAD_MINER)
                    {
                        Item.NewItem((int)this.Position.X, (int)this.Position.Y, this.Width, this.Height, 166, Main.rand.Next(1, 4), false);
                    }
                }
            }
            else if (this.type == NPCType.N45_TIM)
            {
                Item.NewItem((int)this.Position.X, (int)this.Position.Y, this.Width, this.Height, 238, 1, false);
            }
            else if (this.type == NPCType.N50_KING_SLIME)
            {
                Item.NewItem((int)this.Position.X, (int)this.Position.Y, this.Width, this.Height, Main.rand.Next(256, 259), 1, false);
            }
            else if (this.type == NPCType.N23_METEOR_HEAD && Main.rand.Next(50) == 0)
            {
                Item.NewItem((int)this.Position.X, (int)this.Position.Y, this.Width, this.Height, 116, 1, false);
            }
            else if (this.type == NPCType.N24_FIRE_IMP && Main.rand.Next(300) == 0)
            {
                Item.NewItem((int)this.Position.X, (int)this.Position.Y, this.Width, this.Height, 244, 1, false);
            }
            else if (this.type == NPCType.N31_ANGRY_BONES || this.type == NPCType.N32_DARK_CASTER || this.type == NPCType.N34_CURSED_SKULL)
            {
                if (Main.rand.Next(75) == 0)
                {
                    Item.NewItem((int)this.Position.X, (int)this.Position.Y, this.Width, this.Height, 327, 1, false);
                }
                else
                {
                    Item.NewItem((int)this.Position.X, (int)this.Position.Y, this.Width, this.Height, 154, Main.rand.Next(1, 4), false);
                }
            }
            else if (this.type == NPCType.N26_GOBLIN_PEON || this.type == NPCType.N27_GOBLIN_THIEF || this.type == NPCType.N28_GOBLIN_WARRIOR || this.type == NPCType.N29_GOBLIN_SORCERER)
            {
                if (Main.rand.Next(400) == 0)
                {
                    Item.NewItem((int)this.Position.X, (int)this.Position.Y, this.Width, this.Height, 128, 1, false);
                }
                else
                {
                    if (Main.rand.Next(200) == 0)
                    {
                        Item.NewItem((int)this.Position.X, (int)this.Position.Y, this.Width, this.Height, 160, 1, false);
                    }
                    else
                    {
                        if (Main.rand.Next(2) == 0)
                        {
                            int stack3 = Main.rand.Next(1, 6);
                            Item.NewItem((int)this.Position.X, (int)this.Position.Y, this.Width, this.Height, 161, stack3, false);
                        }
                    }
                }
            }
            else if (this.type == NPCType.N42_HORNET && Main.rand.Next(2) == 0)
            {
                Item.NewItem((int)this.Position.X, (int)this.Position.Y, this.Width, this.Height, 209, 1, false);
            }
            else if (this.type == NPCType.N43_MAN_EATER && Main.rand.Next(4) == 0)
            {
                Item.NewItem((int)this.Position.X, (int)this.Position.Y, this.Width, this.Height, 210, 1, false);
            }
            else if (this.type == NPCType.N65_SHARK)
            {
                if (Main.rand.Next(50) == 0)
                {
                    Item.NewItem((int)this.Position.X, (int)this.Position.Y, this.Width, this.Height, 268, 1, false);
                }
                else
                {
                    Item.NewItem((int)this.Position.X, (int)this.Position.Y, this.Width, this.Height, 319, 1, false);
                }
            }
            else if (this.type == NPCType.N48_HARPY && Main.rand.Next(5) == 0)
            {
                Item.NewItem((int)this.Position.X, (int)this.Position.Y, this.Width, this.Height, 320, 1, false);
            }
            if (this.boss)
            {
                //boss kill
                int BossType = 0;
                if (this.type == NPCType.N04_EYE_OF_CTHULU)
                {
                    NPC.downedBoss1 = true;
                    BossType = 1;
                }
                if (this.type == NPCType.N13_EATER_OF_WORLDS_HEAD || this.type == NPCType.N14_EATER_OF_WORLDS_BODY || this.type == NPCType.N15_EATER_OF_WORLDS_TAIL)
                {
                    NPC.downedBoss2 = true;
                    this.Name = "Eater of Worlds";
                    BossType = 2;
                }
                if (this.type == NPCType.N35_SKELETRON_HEAD)
                {
                    NPC.downedBoss3 = true;
                    this.Name = "Skeletron";
                    BossType = 3;
                }
                int stack4 = Main.rand.Next(5, 16);
                Item.NewItem((int)this.Position.X, (int)this.Position.Y, this.Width, this.Height, 28, stack4, false);
                int num = Main.rand.Next(5) + 5;
                for (int i = 0; i < num; i++)
                {
                    Item.NewItem((int)this.Position.X, (int)this.Position.Y, this.Width, this.Height, 58, 1, false);
                }

                NetMessage.SendData(25, -1, -1, this.Name + " has been defeated!", 255, 175f, 75f, 255f);

                NPCBossDeathEvent npcEvent = new NPCBossDeathEvent();
                npcEvent.Boss = BossType;
                Sender sender = new Sender();
                sender.Op = true;
                npcEvent.Sender = sender;
                Program.server.PluginManager.processHook(Hooks.NPC_BOSSDEATH, npcEvent);
            }
            if (Main.rand.Next(6) == 0 && this.lifeMax > 1)
            {
                if (Main.rand.Next(2) == 0 && Main.players[(int)Player.FindClosest(this.Position, this.Width, this.Height)].statMana < Main.players[(int)Player.FindClosest(this.Position, this.Width, this.Height)].statManaMax)
                {
                    Item.NewItem((int)this.Position.X, (int)this.Position.Y, this.Width, this.Height, 184, 1, false);
                }
                else
                {
                    if (Main.rand.Next(2) == 0 && Main.players[(int)Player.FindClosest(this.Position, this.Width, this.Height)].statLife < Main.players[(int)Player.FindClosest(this.Position, this.Width, this.Height)].statLifeMax)
                    {
                        Item.NewItem((int)this.Position.X, (int)this.Position.Y, this.Width, this.Height, 58, 1, false);
                    }
                }
            }
            float num2 = this.value;
            num2 *= 1f + (float)Main.rand.Next(-20, 21) * 0.01f;
            if (Main.rand.Next(5) == 0)
            {
                num2 *= 1f + (float)Main.rand.Next(5, 11) * 0.01f;
            }
            if (Main.rand.Next(10) == 0)
            {
                num2 *= 1f + (float)Main.rand.Next(10, 21) * 0.01f;
            }
            if (Main.rand.Next(15) == 0)
            {
                num2 *= 1f + (float)Main.rand.Next(15, 31) * 0.01f;
            }
            if (Main.rand.Next(20) == 0)
            {
                num2 *= 1f + (float)Main.rand.Next(20, 41) * 0.01f;
            }
            while ((int)num2 > 0)
            {
                if (num2 > 1000000f)
                {
                    int num3 = (int)(num2 / 1000000f);
                    if (num3 > 50 && Main.rand.Next(2) == 0)
                    {
                        num3 /= Main.rand.Next(3) + 1;
                    }
                    if (Main.rand.Next(2) == 0)
                    {
                        num3 /= Main.rand.Next(3) + 1;
                    }
                    num2 -= (float)(1000000 * num3);
                    Item.NewItem((int)this.Position.X, (int)this.Position.Y, this.Width, this.Height, 74, num3, false);
                }
                else
                {
                    if (num2 > 10000f)
                    {
                        int num4 = (int)(num2 / 10000f);
                        if (num4 > 50 && Main.rand.Next(2) == 0)
                        {
                            num4 /= Main.rand.Next(3) + 1;
                        }
                        if (Main.rand.Next(2) == 0)
                        {
                            num4 /= Main.rand.Next(3) + 1;
                        }
                        num2 -= (float)(10000 * num4);
                        Item.NewItem((int)this.Position.X, (int)this.Position.Y, this.Width, this.Height, 73, num4, false);
                    }
                    else
                    {
                        if (num2 > 100f)
                        {
                            int num5 = (int)(num2 / 100f);
                            if (num5 > 50 && Main.rand.Next(2) == 0)
                            {
                                num5 /= Main.rand.Next(3) + 1;
                            }
                            if (Main.rand.Next(2) == 0)
                            {
                                num5 /= Main.rand.Next(3) + 1;
                            }
                            num2 -= (float)(100 * num5);
                            Item.NewItem((int)this.Position.X, (int)this.Position.Y, this.Width, this.Height, 72, num5, false);
                        }
                        else
                        {
                            int num6 = (int)num2;
                            if (num6 > 50 && Main.rand.Next(2) == 0)
                            {
                                num6 /= Main.rand.Next(3) + 1;
                            }
                            if (Main.rand.Next(2) == 0)
                            {
                                num6 /= Main.rand.Next(4) + 1;
                            }
                            if (num6 < 1)
                            {
                                num6 = 1;
                            }
                            num2 -= (float)num6;
                            Item.NewItem((int)this.Position.X, (int)this.Position.Y, this.Width, this.Height, 71, num6, false);
                        }
                    }
                }
            }
        }
        public void NPCLoot()
        {
            if (this.Type == 1 || this.Type == 16)
            {
                Item.NewItem((int)this.Position.X, (int)this.Position.Y, this.Width, this.Height, 23, Main.rand.Next(1, 3), false);
            }
            if (this.Type == 2)
            {
                if (Main.rand.Next(3) == 0)
                {
                    Item.NewItem((int)this.Position.X, (int)this.Position.Y, this.Width, this.Height, 38, 1, false);
                }
                else
                {
                    if (Main.rand.Next(100) == 0)
                    {
                        Item.NewItem((int)this.Position.X, (int)this.Position.Y, this.Width, this.Height, 236, 1, false);
                    }
                }
            }
            if (this.Type == 58)
            {
                if (Main.rand.Next(500) == 0)
                {
                    Item.NewItem((int)this.Position.X, (int)this.Position.Y, this.Width, this.Height, 263, 1, false);
                }
                else
                {
                    if (Main.rand.Next(40) == 0)
                    {
                        Item.NewItem((int)this.Position.X, (int)this.Position.Y, this.Width, this.Height, 118, 1, false);
                    }
                }
            }
            if (this.Type == 3 && Main.rand.Next(50) == 0)
            {
                Item.NewItem((int)this.Position.X, (int)this.Position.Y, this.Width, this.Height, 216, 1, false);
            }
            if (this.Type == 66)
            {
                Item.NewItem((int)this.Position.X, (int)this.Position.Y, this.Width, this.Height, 267, 1, false);
            }
            if (this.Type == 62 && Main.rand.Next(50) == 0)
            {
                Item.NewItem((int)this.Position.X, (int)this.Position.Y, this.Width, this.Height, 272, 1, false);
            }
            if (this.Type == 52)
            {
                Item.NewItem((int)this.Position.X, (int)this.Position.Y, this.Width, this.Height, 251, 1, false);
            }
            if (this.Type == 53)
            {
                Item.NewItem((int)this.Position.X, (int)this.Position.Y, this.Width, this.Height, 239, 1, false);
            }
            if (this.Type == 54)
            {
                Item.NewItem((int)this.Position.X, (int)this.Position.Y, this.Width, this.Height, 260, 1, false);
            }
            if (this.Type == 55)
            {
                Item.NewItem((int)this.Position.X, (int)this.Position.Y, this.Width, this.Height, 261, 1, false);
            }
            if (this.Type == 69 && Main.rand.Next(10) == 0)
            {
                Item.NewItem((int)this.Position.X, (int)this.Position.Y, this.Width, this.Height, 323, 1, false);
            }
            if (this.Type == 4)
            {
                int stack = Main.rand.Next(30) + 20;
                Item.NewItem((int)this.Position.X, (int)this.Position.Y, this.Width, this.Height, 47, stack, false);
                stack = Main.rand.Next(20) + 10;
                Item.NewItem((int)this.Position.X, (int)this.Position.Y, this.Width, this.Height, 56, stack, false);
                stack = Main.rand.Next(20) + 10;
                Item.NewItem((int)this.Position.X, (int)this.Position.Y, this.Width, this.Height, 56, stack, false);
                stack = Main.rand.Next(20) + 10;
                Item.NewItem((int)this.Position.X, (int)this.Position.Y, this.Width, this.Height, 56, stack, false);
                stack = Main.rand.Next(3) + 1;
                Item.NewItem((int)this.Position.X, (int)this.Position.Y, this.Width, this.Height, 59, stack, false);
            }
            if (this.Type == 6 && Main.rand.Next(3) == 0)
            {
                Item.NewItem((int)this.Position.X, (int)this.Position.Y, this.Width, this.Height, 68, 1, false);
            }
            if (this.Type == 7 || this.Type == 8 || this.Type == 9)
            {
                if (Main.rand.Next(3) == 0)
                {
                    Item.NewItem((int)this.Position.X, (int)this.Position.Y, this.Width, this.Height, 68, Main.rand.Next(1, 3), false);
                }
                Item.NewItem((int)this.Position.X, (int)this.Position.Y, this.Width, this.Height, 69, Main.rand.Next(3, 9), false);
            }
            if ((this.Type == 10 || this.Type == 11 || this.Type == 12) && Main.rand.Next(500) == 0)
            {
                Item.NewItem((int)this.Position.X, (int)this.Position.Y, this.Width, this.Height, 215, 1, false);
            }
            if (this.Type == 47 && Main.rand.Next(75) == 0)
            {
                Item.NewItem((int)this.Position.X, (int)this.Position.Y, this.Width, this.Height, 243, 1, false);
            }
            if (this.Type == 39 || this.Type == 40 || this.Type == 41)
            {
                if (Main.rand.Next(100) == 0)
                {
                    Item.NewItem((int)this.Position.X, (int)this.Position.Y, this.Width, this.Height, 220, 1, false);
                }
                else
                {
                    if (Main.rand.Next(100) == 0)
                    {
                        Item.NewItem((int)this.Position.X, (int)this.Position.Y, this.Width, this.Height, 218, 1, false);
                    }
                }
            }
            if (this.Type == 13 || this.Type == 14 || this.Type == 15)
            {
                int stack2 = Main.rand.Next(1, 4);
                Item.NewItem((int)this.Position.X, (int)this.Position.Y, this.Width, this.Height, 86, stack2, false);
                if (Main.rand.Next(2) == 0)
                {
                    stack2 = Main.rand.Next(2, 6);
                    Item.NewItem((int)this.Position.X, (int)this.Position.Y, this.Width, this.Height, 56, stack2, false);
                }
                if (this.boss)
                {
                    stack2 = Main.rand.Next(10, 30);
                    Item.NewItem((int)this.Position.X, (int)this.Position.Y, this.Width, this.Height, 56, stack2, false);
                    stack2 = Main.rand.Next(10, 31);
                    Item.NewItem((int)this.Position.X, (int)this.Position.Y, this.Width, this.Height, 56, stack2, false);
                }
            }
            if (this.Type == 63 || this.Type == 64)
            {
                Item.NewItem((int)this.Position.X, (int)this.Position.Y, this.Width, this.Height, 282, Main.rand.Next(1, 5), false);
            }
            if (this.Type == 21 || this.Type == 44)
            {
                if (Main.rand.Next(25) == 0)
                {
                    Item.NewItem((int)this.Position.X, (int)this.Position.Y, this.Width, this.Height, 118, 1, false);
                }
                else
                {
                    if (this.Type == 44)
                    {
                        Item.NewItem((int)this.Position.X, (int)this.Position.Y, this.Width, this.Height, 166, Main.rand.Next(1, 4), false);
                    }
                }
            }
            if (this.Type == 45)
            {
                Item.NewItem((int)this.Position.X, (int)this.Position.Y, this.Width, this.Height, 238, 1, false);
            }
            if (this.Type == 50)
            {
                Item.NewItem((int)this.Position.X, (int)this.Position.Y, this.Width, this.Height, Main.rand.Next(256, 259), 1, false);
            }
            if (this.Type == 23 && Main.rand.Next(50) == 0)
            {
                Item.NewItem((int)this.Position.X, (int)this.Position.Y, this.Width, this.Height, 116, 1, false);
            }
            if (this.Type == 24)
            {
                if (Main.rand.Next(50) == 0)
                {
                    Item.NewItem((int)this.Position.X, (int)this.Position.Y, this.Width, this.Height, 112, 1, false);
                }
                else
                {
                    if (Main.rand.Next(500) == 0)
                    {
                        Item.NewItem((int)this.Position.X, (int)this.Position.Y, this.Width, this.Height, 244, 1, false);
                    }
                }
            }
            if (this.Type == 31 || this.Type == 32)
            {
                Item.NewItem((int)this.Position.X, (int)this.Position.Y, this.Width, this.Height, 154, 1, false);
            }
            if (this.Type == 26 || this.Type == 27 || this.Type == 28 || this.Type == 29)
            {
                if (Main.rand.Next(400) == 0)
                {
                    Item.NewItem((int)this.Position.X, (int)this.Position.Y, this.Width, this.Height, 128, 1, false);
                }
                else
                {
                    if (Main.rand.Next(200) == 0)
                    {
                        Item.NewItem((int)this.Position.X, (int)this.Position.Y, this.Width, this.Height, 160, 1, false);
                    }
                    else
                    {
                        if (Main.rand.Next(2) == 0)
                        {
                            int stack3 = Main.rand.Next(1, 6);
                            Item.NewItem((int)this.Position.X, (int)this.Position.Y, this.Width, this.Height, 161, stack3, false);
                        }
                    }
                }
            }
            if (this.Type == 42)
            {
                Item.NewItem((int)this.Position.X, (int)this.Position.Y, this.Width, this.Height, 209, 1, false);
            }
            if (this.Type == 43 && Main.rand.Next(5) == 0)
            {
                Item.NewItem((int)this.Position.X, (int)this.Position.Y, this.Width, this.Height, 210, 1, false);
            }
            if (this.Type == 65)
            {
                if (Main.rand.Next(50) == 0)
                {
                    Item.NewItem((int)this.Position.X, (int)this.Position.Y, this.Width, this.Height, 268, 1, false);
                }
                else
                {
                    Item.NewItem((int)this.Position.X, (int)this.Position.Y, this.Width, this.Height, 319, 1, false);
                }
            }
            if (this.Type == 48 && Main.rand.Next(5) == 0)
            {
                Item.NewItem((int)this.Position.X, (int)this.Position.Y, this.Width, this.Height, 320, 1, false);
            }
            if (this.boss)
            {
                //boss kill
                int BossType = 0;
                if (this.Type == 4)
                {
                    NPC.downedBoss1 = true;
                    BossType = 1;
                }
                if (this.Type == 13 || this.Type == 14 || this.Type == 15)
                {
                    NPC.downedBoss2 = true;
                    this.Name = "Eater of Worlds";
                    BossType = 2;
                }
                if (this.Type == 35)
                {
                    NPC.downedBoss3 = true;
                    this.Name = "Skeletron";
                    BossType = 3;
                }
                int stack4 = Main.rand.Next(5, 16);
                Item.NewItem((int)this.Position.X, (int)this.Position.Y, this.Width, this.Height, 28, stack4, false);
                int num = Main.rand.Next(5) + 5;
                for (int i = 0; i < num; i++)
                {
                    Item.NewItem((int)this.Position.X, (int)this.Position.Y, this.Width, this.Height, 58, 1, false);
                }

                NetMessage.SendData(25, -1, -1, this.Name + " has been defeated!", 255, 175f, 75f, 255f);

                NPCBossDeathEvent npcEvent = new NPCBossDeathEvent();
                npcEvent.Boss = BossType;
                Sender sender = new Sender();
                sender.Op = true;
                npcEvent.Sender = sender;
                Program.server.PluginManager.processHook(Hooks.NPC_BOSSDEATH, npcEvent);
            }
            if (Main.rand.Next(7) == 0 && this.lifeMax > 1)
            {
                if (Main.rand.Next(2) == 0 && Main.players[(int)Player.FindClosest(this.Position, this.Width, this.Height)].statMana < Main.players[(int)Player.FindClosest(this.Position, this.Width, this.Height)].statManaMax)
                {
                    Item.NewItem((int)this.Position.X, (int)this.Position.Y, this.Width, this.Height, 184, 1, false);
                }
                else
                {
                    if (Main.rand.Next(2) == 0 && Main.players[(int)Player.FindClosest(this.Position, this.Width, this.Height)].statLife < Main.players[(int)Player.FindClosest(this.Position, this.Width, this.Height)].statLifeMax)
                    {
                        Item.NewItem((int)this.Position.X, (int)this.Position.Y, this.Width, this.Height, 58, 1, false);
                    }
                }
            }
            float num2 = this.value;
            num2 *= 1f + (float)Main.rand.Next(-20, 21) * 0.01f;
            if (Main.rand.Next(5) == 0)
            {
                num2 *= 1f + (float)Main.rand.Next(5, 11) * 0.01f;
            }
            if (Main.rand.Next(10) == 0)
            {
                num2 *= 1f + (float)Main.rand.Next(10, 21) * 0.01f;
            }
            if (Main.rand.Next(15) == 0)
            {
                num2 *= 1f + (float)Main.rand.Next(15, 31) * 0.01f;
            }
            if (Main.rand.Next(20) == 0)
            {
                num2 *= 1f + (float)Main.rand.Next(20, 41) * 0.01f;
            }
            while ((int)num2 > 0)
            {
                if (num2 > 1000000f)
                {
                    int num3 = (int)(num2 / 1000000f);
                    if (num3 > 50 && Main.rand.Next(2) == 0)
                    {
                        num3 /= Main.rand.Next(3) + 1;
                    }
                    if (Main.rand.Next(2) == 0)
                    {
                        num3 /= Main.rand.Next(3) + 1;
                    }
                    num2 -= (float)(1000000 * num3);
                    Item.NewItem((int)this.Position.X, (int)this.Position.Y, this.Width, this.Height, 74, num3, false);
                }
                else
                {
                    if (num2 > 10000f)
                    {
                        int num4 = (int)(num2 / 10000f);
                        if (num4 > 50 && Main.rand.Next(2) == 0)
                        {
                            num4 /= Main.rand.Next(3) + 1;
                        }
                        if (Main.rand.Next(2) == 0)
                        {
                            num4 /= Main.rand.Next(3) + 1;
                        }
                        num2 -= (float)(10000 * num4);
                        Item.NewItem((int)this.Position.X, (int)this.Position.Y, this.Width, this.Height, 73, num4, false);
                    }
                    else
                    {
                        if (num2 > 100f)
                        {
                            int num5 = (int)(num2 / 100f);
                            if (num5 > 50 && Main.rand.Next(2) == 0)
                            {
                                num5 /= Main.rand.Next(3) + 1;
                            }
                            if (Main.rand.Next(2) == 0)
                            {
                                num5 /= Main.rand.Next(3) + 1;
                            }
                            num2 -= (float)(100 * num5);
                            Item.NewItem((int)this.Position.X, (int)this.Position.Y, this.Width, this.Height, 72, num5, false);
                        }
                        else
                        {
                            int num6 = (int)num2;
                            if (num6 > 50 && Main.rand.Next(2) == 0)
                            {
                                num6 /= Main.rand.Next(3) + 1;
                            }
                            if (Main.rand.Next(2) == 0)
                            {
                                num6 /= Main.rand.Next(4) + 1;
                            }
                            if (num6 < 1)
                            {
                                num6 = 1;
                            }
                            num2 -= (float)num6;
                            Item.NewItem((int)this.Position.X, (int)this.Position.Y, this.Width, this.Height, 71, num6, false);
                        }
                    }
                }
            }
        }