Пример #1
0
        /// <summary>
        /// Adds all the original vanilla NPCs.
        /// </summary>
        internal static void FillVanilla()
        {
            for (int i = -65; i < NPCID.Count; i++)
            {
                if (i == 0)
                    continue;

                NPC n = new NPC();
                n.netDefaults(i);

                NpcDef def = new NpcDef(Lang.npcName(n.type, true));

                def.InternalName = n.name;
                def.Type = n.type;
                def.NetID = i;

                CopyNpcToDef(def, n);

                DefFromType.Add(i, def);
                // TODO Fix overlapping names
                //VanillaDefFromName.Add(n.name, def);
            }
        }
Пример #2
0
        public void NPCLoot()
        {
            if (Main.netMode == 1 || this.type >= NPCID.Count)
            {
                return;
            }
            bool flag = NPC.downedMechBoss1 && NPC.downedMechBoss2 && NPC.downedMechBoss3;
            int num = this.type;
            switch (num)
            {
            case 13:
            case 14:
            case 15:
                if (this.boss)
                {
                    AchievementsHelper.NotifyNPCKilled(this);
                }
                break;
            default:
                switch (num)
                {
                case 125:
                case 126:
                {
                    int num2 = (this.type == NPCID.Spazmatism) ? 125 : 126;
                    if (!NPC.AnyNPCs(num2))
                    {
                        AchievementsHelper.NotifyNPCKilled(this);
                        AchievementsHelper.CheckMechaMayhem(this.type);
                        goto IL_C1;
                    }
                    goto IL_C1;
                }
                case 127:
                    break;
                default:
                    if (num != 134)
                    {
                        AchievementsHelper.NotifyNPCKilled(this);
                        goto IL_C1;
                    }
                    break;
                }
                AchievementsHelper.CheckMechaMayhem(this.type);
                AchievementsHelper.NotifyNPCKilled(this);
                break;
            }
            IL_C1:
            int num3 = Item.NPCtoBanner(this.BannerID());
            if (num3 > 0 && !NPCID.Sets.ExcludedFromDeathTally[this.type] && this.AnyInteractions())
            {
                NPC.killCount[num3]++;
                if (Main.netMode == 2)
                {
                    NetMessage.SendData((int)PacketTypes.NpcKillCount, -1, -1, "", num3, 0f, 0f, 0f, 0, 0, 0);
                }
                int num4 = 50;
                if (NPC.killCount[num3] % num4 == 0 && num3 > 0)
                {
                    int l = Item.BannerToNPC(num3);
                    NPC nPC = new NPC();
                    nPC.netDefaults(l);
                    int num5 = this.lastInteraction;
                    if (!Main.player[num5].active || Main.player[num5].dead)
                    {
                        num5 = this.FindClosestPlayer();
                    }
                    string text = string.Concat(new object[]
                    {
                        "The ",
                        NPC.killCount[num3],
                        "th ",
                        Lang.npcName(l, false),
                        " has been defeated!"
                    });
                    if (num5 >= 0 && num5 < 255)
                    {
                        text = string.Concat(new object[]
                        {
                            Main.player[num5].name,
                            " has defeated the ",
                            NPC.killCount[num3],
                            "th ",
                            Lang.npcName(l, false),
                            "!"
                        });
                    }
                    if (Main.netMode == 0)
                    {
                        Main.NewText(text, 250, 250, 0, false);
                    }
                    else if (Main.netMode == 2)
                    {
                        NetMessage.SendData((int)PacketTypes.ChatText, -1, -1, text, 255, 250f, 250f, 0f, 0, 0, 0);
                    }
                    int num6 = 1615 + num3 - 1;
                    if (num3 >= 249)
                    {
                        num6 = 3593 + num3 - 249;
                    }
                    else if (num3 >= 186)
                    {
                        num6 = 3390 + num3 - 186;
                    }
                    else if (num3 >= 88)
                    {
                        num6 = 2897 + num3 - 88;
                    }
                    Vector2 position = this.position;
                    if (num5 >= 0 && num5 < 255)
                    {
                        position = Main.player[num5].position;
                    }
                    DropLoot(position, this.width, this.height, num6, 1, false, 0, false, false);
                }
            }
            if (this.type == NPCID.MeteorHead && Main.hardMode)
            {
                return;
            }
            if ((this.type == NPCID.PigronCorruption || this.type == NPCID.PigronCrimson || this.type == NPCID.PigronHallow) && Main.rand.Next(3) == 0)
            {
                DropLoot(this.position, this.width, this.height, 3532, 1, false, 0, false, false);
            }
            num = this.type;
            if (num <= 122)
            {
                if (num <= 80)
                {
                    if (num != 75 && num != 80)
                    {
                        goto IL_482;
                    }
                }
                else
                {
                    switch (num)
                    {
                    case 84:
                    case 86:
                        break;
                    case 85:
                        goto IL_482;
                    default:
                        switch (num)
                        {
                        case 120:
                        case 122:
                            break;
                        case 121:
                            goto IL_482;
                        default:
                            goto IL_482;
                        }
                        break;
                    }
                }
            }
            else if (num <= 171)
            {
                switch (num)
                {
                case 137:
                case 138:
                    break;
                default:
                    if (num != 171)
                    {
                        goto IL_482;
                    }
                    break;
                }
            }
            else if (num != 244 && num != 475)
            {
                goto IL_482;
            }
            int maxValue = Main.expertMode ? 150 : 200;
            if (Main.rand.Next(maxValue) == 0)
            {
                DropLoot(this.position, this.width, this.height, 3260, 1, false, 0, false, false);
            }
            IL_482:
            if (Main.slimeRain && Main.slimeRainNPC[this.type] && !NPC.AnyNPCs(NPCID.KingSlime))
            {
                int num7 = 150;
                if (NPC.downedSlimeKing)
                {
                    num7 /= 2;
                }
                Main.slimeRainKillCount++;
                if (Main.slimeRainKillCount >= num7)
                {
                    int plr = this.FindClosestPlayer();
                    NPC.SpawnOnPlayer(plr, 50);
                    Main.slimeRainKillCount = -num7 / 2;
                }
            }
            if (!Main.player[(int)Player.FindClosest(this.position, this.width, this.height)].ZoneDungeon)
            {
                bool flag2 = false;
                if (Main.expertMode && Main.rand.Next(5) == 0)
                {
                    flag2 = true;
                }
                else if (Main.rand.Next(5) == 0)
                {
                    flag2 = true;
                }
                if (this.boss)
                {
                    flag2 = false;
                }
                switch (this.type)
                {
                case 13:
                case 14:
                case 15:
                    flag2 = false;
                    break;
                }
                if (Main.hardMode && this.lifeMax > 1 && this.damage > 0 && !this.friendly && (double)this.position.Y > Main.rockLayer * 16.0 && flag2 && this.type != NPCID.Slimer && this.value > 0f)
                {
                    if (Main.player[(int)Player.FindClosest(this.position, this.width, this.height)].ZoneCorrupt || Main.player[(int)Player.FindClosest(this.position, this.width, this.height)].ZoneCrimson)
                    {
                        DropLoot(this.position, this.width, this.height, 521, 1, false, 0, false, false);
                    }
                    if (Main.player[(int)Player.FindClosest(this.position, this.width, this.height)].ZoneHoly)
                    {
                        DropLoot(this.position, this.width, this.height, 520, 1, false, 0, false, false);
                    }
                }
            }
            if (this.type == NPCID.BlueSlime && this.ai[1] > 0f)
            {
                int num8 = (int)this.ai[1];
                if (num8 > 0 && num8 < Main.maxItemTypes)
                {
                    int num9 = 1;
                    if (num8 == 8)
                    {
                        num9 = Main.rand.Next(5, 11);
                    }
                    else if (num8 == 166)
                    {
                        num9 = Main.rand.Next(2, 7);
                    }
                    else if (num8 == 965)
                    {
                        num9 = Main.rand.Next(20, 46);
                    }
                    else if ((num8 >= 11 && num8 <= 14) || (num8 >= 699 && num8 <= 702))
                    {
                        num9 = Main.rand.Next(3, 9);
                        if (Main.rand.Next(2) == 0)
                        {
                            num9 += 5;
                        }
                    }
                    else if (num8 == 71)
                    {
                        num9 = Main.rand.Next(50, 100);
                    }
                    else if (num8 == 72)
                    {
                        num9 = Main.rand.Next(20, 100);
                    }
                    else if (num8 == 73)
                    {
                        num9 = Main.rand.Next(1, 3);
                    }
                    DropLoot(this.position, this.width, this.height, num8, num9, false, 0, false, false);
                }
            }
            if (this.type == NPCID.Guide && this.displayName == "Andrew")
            {
                DropLoot(this.position, this.width, this.height, 867, 1, false, 0, false, false);
            }
            if (this.type == NPCID.Stylist && Main.rand.Next(8) == 0)
            {
                DropLoot(this.position, this.width, this.height, 3352, 1, false, 0, false, false);
            }
            if (this.type == NPCID.TaxCollector && Main.rand.Next(8) == 0)
            {
                DropLoot(this.position, this.width, this.height, 3351, 1, false, 0, false, false);
            }
            if (this.type == NPCID.Painter && Main.rand.Next(10) == 0)
            {
                DropLoot(this.position, this.width, this.height, 3350, 1, false, 0, false, false);
            }
            if (this.type == NPCID.PartyGirl && Main.rand.Next(4) == 0)
            {
                DropLoot(this.position, this.width, this.height, 3548, Main.rand.Next(30, 61), false, 0, false, false);
            }
            if (this.type == NPCID.DyeTrader && Main.rand.Next(8) == 0)
            {
                DropLoot(this.position, this.width, this.height, 3349, 1, false, 0, false, false);
            }
            if (Main.hardMode && this.value > 0f)
            {
                if (!NPC.downedMechBoss1 && Main.rand.Next(2500) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 556, 1, false, 0, false, false);
                }
                else if (!NPC.downedMechBoss2 && Main.rand.Next(2500) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 544, 1, false, 0, false, false);
                }
                else if (!NPC.downedMechBoss3 && Main.rand.Next(2500) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 557, 1, false, 0, false, false);
                }
            }
            if (Main.halloween && this.value > 0f && this.value < 500f && this.damage < 40 && this.defense < 20)
            {
                if (Main.rand.Next(2000) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 1825, 1, false, 0, false, false);
                }
                else if (Main.rand.Next(2000) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 1827, 1, false, 0, false, false);
                }
            }
            if (Main.hardMode && this.value > 0f)
            {
                if (Main.rand.Next(2500) == 0 && Main.player[(int)Player.FindClosest(this.position, this.width, this.height)].ZoneJungle)
                {
                    DropLoot(this.position, this.width, this.height, 1533, 1, false, 0, false, false);
                }
                if (Main.rand.Next(2500) == 0 && Main.player[(int)Player.FindClosest(this.position, this.width, this.height)].ZoneCorrupt)
                {
                    DropLoot(this.position, this.width, this.height, 1534, 1, false, 0, false, false);
                }
                if (Main.rand.Next(2500) == 0 && Main.player[(int)Player.FindClosest(this.position, this.width, this.height)].ZoneCrimson)
                {
                    DropLoot(this.position, this.width, this.height, 1535, 1, false, 0, false, false);
                }
                if (Main.rand.Next(2500) == 0 && Main.player[(int)Player.FindClosest(this.position, this.width, this.height)].ZoneHoly)
                {
                    DropLoot(this.position, this.width, this.height, 1536, 1, false, 0, false, false);
                }
                if (Main.rand.Next(2500) == 0 && Main.player[(int)Player.FindClosest(this.position, this.width, this.height)].ZoneSnow)
                {
                    DropLoot(this.position, this.width, this.height, 1537, 1, false, 0, false, false);
                }
            }
            if (this.type == NPCID.DungeonGuardian)
            {
                DropLoot(this.position, this.width, this.height, 1169, 1, false, 0, false, false);
            }
            if (Main.snowMoon)
            {
                int num10 = NPC.waveCount;
                if (Main.expertMode)
                {
                    num10 += 7;
                }
                int num11 = (int)((double)(30 - num10) / 2.5);
                if (Main.expertMode)
                {
                    num11 -= 2;
                }
                if (num11 < 1)
                {
                    num11 = 1;
                }
                if (this.type == NPCID.Everscream)
                {
                    NPC.downedChristmasTree = true;
                }
                if (this.type == NPCID.IceQueen)
                {
                    NPC.downedChristmasIceQueen = true;
                }
                if (this.type == NPCID.SantaNK1)
                {
                    NPC.downedChristmasSantank = true;
                }
                if ((this.type == NPCID.Everscream || this.type == NPCID.IceQueen || this.type == NPCID.SantaNK1) && Main.rand.Next(num11) == 0 && num10 >= 15)
                {
                    int num12 = 4;
                    if (num10 == 16)
                    {
                        num12 = 4;
                    }
                    if (num10 == 17)
                    {
                        num12 = 3;
                    }
                    if (num10 == 18)
                    {
                        num12 = 3;
                    }
                    if (num10 == 19)
                    {
                        num12 = 2;
                    }
                    if (num10 >= 20)
                    {
                        num12 = 2;
                    }
                    if (Main.expertMode && Main.rand.Next(3) == 0)
                    {
                        num12--;
                    }
                    if (Main.rand.Next(num12) == 0)
                    {
                        if (this.type == NPCID.Everscream)
                        {
                            DropLoot(this.position, this.width, this.height, 1962, 1, false, 0, false, false);
                        }
                        if (this.type == NPCID.IceQueen)
                        {
                            DropLoot(this.position, this.width, this.height, 1960, 1, false, 0, false, false);
                        }
                        if (this.type == NPCID.SantaNK1)
                        {
                            DropLoot(this.position, this.width, this.height, 1961, 1, false, 0, false, false);
                        }
                    }
                }
                if (Main.rand.Next(num11) == 0)
                {
                    if (this.type == NPCID.Everscream)
                    {
                        int num13 = Main.rand.Next(3);
                        if (Main.rand.Next(15) == 0)
                        {
                            DropLoot(this.position, this.width, this.height, 1871, 1, false, -1, false, false);
                        }
                        else
                        {
                            if (num13 == 0)
                            {
                                DropLoot(this.position, this.width, this.height, 1916, 1, false, 0, false, false);
                            }
                            if (num13 == 1)
                            {
                                DropLoot(this.position, this.width, this.height, 1928, 1, false, -1, false, false);
                            }
                            if (num13 == 2)
                            {
                                DropLoot(this.position, this.width, this.height, 1930, 1, false, -1, false, false);
                            }
                        }
                    }
                    if (this.type == NPCID.SantaNK1)
                    {
                        int num14 = Main.rand.Next(2);
                        if (num14 == 0)
                        {
                            DropLoot(this.position, this.width, this.height, 1910, 1, false, -1, false, false);
                        }
                        if (num14 == 1)
                        {
                            DropLoot(this.position, this.width, this.height, 1929, 1, false, -1, false, false);
                        }
                    }
                    if (this.type == NPCID.IceQueen)
                    {
                        if (NPC.waveCount >= 15 && Main.rand.Next(30) == 0)
                        {
                            DropLoot(this.position, this.width, this.height, 1914, 1, false, 0, false, false);
                        }
                        else if (Main.rand.Next(15) == 0)
                        {
                            DropLoot(this.position, this.width, this.height, 1959, 1, false, 0, false, false);
                        }
                        else
                        {
                            int num15 = Main.rand.Next(3);
                            if (num15 == 0)
                            {
                                DropLoot(this.position, this.width, this.height, 1931, 1, false, -1, false, false);
                            }
                            if (num15 == 1)
                            {
                                DropLoot(this.position, this.width, this.height, 1946, 1, false, -1, false, false);
                            }
                            if (num15 == 2)
                            {
                                DropLoot(this.position, this.width, this.height, 1947, 1, false, -1, false, false);
                            }
                        }
                    }
                }
            }
            if (this.type == NPCID.PresentMimic)
            {
                int num16 = Main.rand.Next(5, 11);
                for (int i = 0; i < num16; i++)
                {
                    DropLoot(this.position, this.width, this.height, 58, 1, false, 0, false, false);
                }
                if (Main.xMas)
                {
                    DropLoot(this.position, this.width, this.height, 1869, 1, false, 0, false, false);
                }
            }
            if (this.type >= NPCID.ZombieElf && this.type <= NPCID.ZombieElfGirl && Main.rand.Next(5) == 0)
            {
                DropLoot(this.position, this.width, this.height, 58, 1, false, 0, false, false);
            }
            if (this.type >= NPCID.ZombieElf && this.type <= NPCID.ZombieElfGirl && Main.rand.Next(200) == 0)
            {
                DropLoot(this.position, this.width, this.height, 1943 + Main.rand.Next(3), 1, false, 0, false, false);
            }
            if (this.type == NPCID.GingerbreadMan && Main.rand.Next(3) != 0)
            {
                DropLoot(this.position, this.width, this.height, 58, 1, false, 0, false, false);
            }
            if (Main.pumpkinMoon)
            {
                if (this.type == NPCID.MourningWood)
                {
                    NPC.downedHalloweenTree = true;
                }
                if (this.type == NPCID.Pumpking)
                {
                    NPC.downedHalloweenKing = true;
                }
                int num17 = NPC.waveCount;
                if (Main.expertMode)
                {
                    num17 += 6;
                }
                int num18 = (int)((double)(17 - num17) / 1.25);
                if (Main.expertMode)
                {
                    num18--;
                }
                if (num18 < 1)
                {
                    num18 = 1;
                }
                if (num17 >= 15)
                {
                    if (this.type == NPCID.MourningWood)
                    {
                        DropLoot(this.position, this.width, this.height, 1855, 1, false, 0, false, false);
                    }
                    if (this.type == NPCID.Pumpking)
                    {
                        DropLoot(this.position, this.width, this.height, 1856, 1, false, 0, false, false);
                    }
                }
                if (Main.rand.Next(num18) == 0)
                {
                    if (this.type == NPCID.HeadlessHorseman && Main.rand.Next(20) == 0)
                    {
                        DropLoot(this.position, this.width, this.height, 1857, 1, false, 0, false, false);
                    }
                    if (this.type >= NPCID.Scarecrow1 && this.type <= NPCID.Scarecrow10 && Main.rand.Next(10) == 0)
                    {
                        DropLoot(this.position, this.width, this.height, Main.rand.Next(1788, 1791), 1, false, 0, false, false);
                    }
                    if (this.type == NPCID.MourningWood)
                    {
                        int num19 = Main.rand.Next(5);
                        if (num19 == 0)
                        {
                            DropLoot(this.position, this.width, this.height, 1829, 1, false, 0, false, false);
                        }
                        if (num19 == 1)
                        {
                            DropLoot(this.position, this.width, this.height, 1831, 1, false, 0, false, false);
                        }
                        if (num19 == 2)
                        {
                            DropLoot(this.position, this.width, this.height, 1835, 1, false, -1, false, false);
                        }
                        if (num19 == 2)
                        {
                            DropLoot(this.position, this.width, this.height, 1836, Main.rand.Next(30, 61), false, 0, false, false);
                        }
                        if (num19 == 3)
                        {
                            DropLoot(this.position, this.width, this.height, 1837, 1, false, 0, false, false);
                        }
                        if (num19 == 4)
                        {
                            DropLoot(this.position, this.width, this.height, 1845, 1, false, -1, false, false);
                        }
                    }
                    if (this.type == NPCID.Pumpking)
                    {
                        int num20 = Main.rand.Next(7);
                        if (num20 == 0)
                        {
                            DropLoot(this.position, this.width, this.height, 1782, 1, false, -1, false, false);
                        }
                        if (num20 == 0)
                        {
                            DropLoot(this.position, this.width, this.height, 1783, Main.rand.Next(50, 101), false, 0, false, false);
                        }
                        if (num20 == 1)
                        {
                            DropLoot(this.position, this.width, this.height, 1784, 1, false, -1, false, false);
                        }
                        if (num20 == 1)
                        {
                            DropLoot(this.position, this.width, this.height, 1785, Main.rand.Next(25, 51), false, 0, false, false);
                        }
                        if (num20 == 2)
                        {
                            DropLoot(this.position, this.width, this.height, 1811, 1, false, 0, false, false);
                        }
                        if (num20 == 3)
                        {
                            DropLoot(this.position, this.width, this.height, 1826, 1, false, -1, false, false);
                        }
                        if (num20 == 4)
                        {
                            DropLoot(this.position, this.width, this.height, 1801, 1, false, -1, false, false);
                        }
                        if (num20 == 5)
                        {
                            DropLoot(this.position, this.width, this.height, 1802, 1, false, -1, false, false);
                        }
                        if (num20 == 6)
                        {
                            DropLoot(this.position, this.width, this.height, 1798, 1, false, 0, false, false);
                        }
                    }
                }
            }
            if (this.type == NPCID.MourningWood)
            {
                DropLoot(this.position, this.width, this.height, 1729, Main.rand.Next(30, 51), false, 0, false, false);
            }
            if (this.type == NPCID.Splinterling)
            {
                DropLoot(this.position, this.width, this.height, 1729, Main.rand.Next(1, 5), false, 0, false, false);
            }
            if (this.type >= NPCID.Scarecrow1 && this.type <= NPCID.Scarecrow10 && Main.rand.Next(4) == 0)
            {
                DropLoot(this.position, this.width, this.height, 58, 1, false, 0, false, false);
            }
            if (this.type == NPCID.Splinterling && Main.rand.Next(6) == 0)
            {
                DropLoot(this.position, this.width, this.height, 58, 1, false, 0, false, false);
            }
            if (this.type == NPCID.Hellhound && Main.rand.Next(4) == 0)
            {
                DropLoot(this.position, this.width, this.height, 58, 1, false, 0, false, false);
            }
            if (this.type == NPCID.Poltergeist && Main.rand.Next(4) == 0)
            {
                DropLoot(this.position, this.width, this.height, 58, 1, false, 0, false, false);
            }
            if (this.type == NPCID.HeadlessHorseman)
            {
                DropLoot(this.position, this.width, this.height, 58, 1, false, 0, false, false);
            }
            if (Main.halloween && this.lifeMax > 1 && this.damage > 0 && !this.friendly && this.type != NPCID.Slimer && this.type != NPCID.MeteorHead && this.value > 0f && Main.rand.Next(80) == 0)
            {
                DropLoot(this.position, this.width, this.height, 1774, 1, false, 0, false, false);
            }
            if (Main.xMas && this.lifeMax > 1 && this.damage > 0 && !this.friendly && this.type != NPCID.Slimer && this.value > 0f && Main.rand.Next(13) == 0)
            {
                DropLoot(this.position, this.width, this.height, 1869, 1, false, 0, false, false);
            }
            if (this.lifeMax > 5 && this.value > 0f && !this.friendly && Main.hardMode && this.position.Y / 16f > (float)(Main.maxTilesY - 200) && Main.rand.Next(50) == 0)
            {
                DropLoot(this.position, this.width, this.height, 2701, Main.rand.Next(20, 51), false, 0, false, false);
            }
            if (this.type == NPCID.MourningWood || this.type == NPCID.Pumpking || this.type == NPCID.Everscream || this.type == NPCID.IceQueen || this.type == NPCID.SantaNK1)
            {
                int num21 = Main.rand.Next(6) + 6;
                for (int j = 0; j < num21; j++)
                {
                    DropLoot(this.position, this.width, this.height, 58, 1, false, 0, false, false);
                }
            }
            if (this.type == NPCID.RedDevil && Main.rand.Next(75) == 0)
            {
                DropLoot(this.position, this.width, this.height, 1518, 1, false, 0, false, false);
            }
            if (this.type == NPCID.IceGolem && Main.rand.Next(3) == 0)
            {
                DropLoot(this.position, this.width, this.height, 1519, 1, false, 0, false, false);
            }
            if (this.type >= NPCID.RustyArmoredBonesAxe && this.type <= NPCID.HellArmoredBonesSword && Main.rand.Next(450) == 0)
            {
                DropLoot(this.position, this.width, this.height, 1517, 1, false, 0, false, false);
            }
            if ((this.type == NPCID.VampireBat || this.type == NPCID.Vampire) && Main.rand.Next(40) == 0)
            {
                DropLoot(this.position, this.width, this.height, 1520, 1, false, 0, false, false);
            }
            if (this.type == NPCID.MossHornet && Main.rand.Next(150) == 0)
            {
                DropLoot(this.position, this.width, this.height, 1521, 1, false, 0, false, false);
            }
            if (this.type == NPCID.Harpy && Main.rand.Next(200) == 0)
            {
                DropLoot(this.position, this.width, this.height, 1516, 1, false, 0, false, false);
            }
            if (this.type == NPCID.Moth && Main.rand.Next(2) == 0)
            {
                DropLoot(this.position, this.width, this.height, 1611, 1, false, 0, false, false);
            }
            if (this.type == NPCID.GraniteFlyer || this.type == NPCID.GraniteGolem)
            {
                DropLoot(this.position, this.width, this.height, 3086, Main.rand.Next(5, 11), false, -1, false, false);
            }
            if (!Main.hardMode && Main.rand.Next(100) == 0 && this.target >= 0 && this.lifeMax > 5 && !this.friendly && Main.rand.Next(4) == 0 && this.position.Y / 16f > (float)(Main.maxTilesY - 350) && NPC.downedBoss3)
            {
                DropLoot(this.position, this.width, this.height, 3282, 1, false, -1, false, false);
            }
            if (Main.hardMode && Main.player[this.target].ZoneSnow && Main.rand.Next(80) == 0 && this.target >= 0 && this.lifeMax > 5 && !this.friendly && this.value > 0f)
            {
                DropLoot(this.position, this.width, this.height, 3289, 1, false, -1, false, false);
            }
            else if (Main.hardMode && Main.rand.Next(200) == 0 && this.target >= 0 && this.lifeMax > 5 && !this.friendly && this.value > 0f)
            {
                if (Main.player[this.target].ZoneJungle && NPC.downedMechBossAny)
                {
                    DropLoot(this.position, this.width, this.height, 3286, 1, false, -1, false, false);
                }
                else if (Main.player[this.target].ZoneDungeon && NPC.downedPlantBoss)
                {
                    DropLoot(this.position, this.width, this.height, 3291, 1, false, -1, false, false);
                }
                else if ((double)(this.position.Y / 16f) > (Main.rockLayer + (double)Main.maxTilesY) / 2.0 && !Main.player[this.target].ZoneDungeon && Main.rand.Next(2) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 3290, 1, false, -1, false, false);
                }
            }
            int num22 = 1;
            if (Main.expertMode && Main.rand.Next(2) == 0)
            {
                num22 = 2;
            }
            for (int k = 0; k < num22; k++)
            {
                if (this.type == NPCID.CreatureFromTheDeep && Main.rand.Next(50) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 497, 1, false, -1, false, false);
                }
                if ((this.type == NPCID.Vampire || this.type == NPCID.VampireBat) && Main.rand.Next(35) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 900, 1, false, -1, false, false);
                }
                if (this.type == NPCID.Eyezor && Main.rand.Next(15) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 1311, 1, false, -1, false, false);
                }
                if (NPC.downedMechBoss1 && NPC.downedMechBoss2 && NPC.downedMechBoss3)
                {
                    if (this.type == NPCID.Mothron)
                    {
                        if (Main.rand.Next(20) == 0 && NPC.downedPlantBoss)
                        {
                            DropLoot(this.position, this.width, this.height, 2770, 1, false, -1, false, false);
                            k++;
                        }
                        if (Main.rand.Next(4) == 0)
                        {
                            DropLoot(this.position, this.width, this.height, 1570, 1, false, -1, false, false);
                            k++;
                        }
                        else if (Main.rand.Next(3) == 0 && NPC.downedPlantBoss)
                        {
                            DropLoot(this.position, this.width, this.height, 3292, 1, false, -1, false, false);
                            k++;
                        }
                    }
                    if (this.type == NPCID.Reaper && Main.rand.Next(40) == 0)
                    {
                        DropLoot(this.position, this.width, this.height, 1327, 1, false, -1, false, false);
                    }
                }
                if (NPC.downedPlantBoss)
                {
                    if (this.type == NPCID.Butcher && Main.rand.Next(40) == 0)
                    {
                        DropLoot(this.position, this.width, this.height, 3098, 1, false, -1, false, false);
                    }
                    if (this.type == NPCID.DrManFly && Main.rand.Next(40) == 0)
                    {
                        DropLoot(this.position, this.width, this.height, 3105, 1, false, -1, false, false);
                    }
                    if (this.type == NPCID.Psycho && Main.rand.Next(40) == 0)
                    {
                        DropLoot(this.position, this.width, this.height, 3106, 1, false, -1, false, false);
                    }
                    if (this.type == NPCID.DeadlySphere && Main.rand.Next(40) == 0)
                    {
                        DropLoot(this.position, this.width, this.height, 3249, 1, false, -1, false, false);
                    }
                    if (this.type == NPCID.Nailhead && Main.rand.Next(25) == 0)
                    {
                        DropLoot(this.position, this.width, this.height, 3107, 1, false, -1, false, false);
                        DropLoot(this.position, this.width, this.height, 3108, Main.rand.Next(100, 201), false, -1, false, false);
                    }
                }
            }
            if (Main.bloodMoon && Main.hardMode && Main.rand.Next(1000) == 0 && this.value > 0f)
            {
                DropLoot(this.position, this.width, this.height, 1314, 1, false, -1, false, false);
            }
            if (this.type == NPCID.ArmoredSkeleton && Main.rand.Next(150) == 0)
            {
                DropLoot(this.position, this.width, this.height, 723, 1, false, -1, false, false);
            }
            if (Main.rand.Next(100) == 0 || (Main.expertMode && Main.rand.Next(100) == 0))
            {
                int num23 = -1;
                int num24 = -1;
                num = this.type;
                if (num <= 109)
                {
                    if (num > 42)
                    {
                        switch (num)
                        {
                        case 75:
                            if (Main.rand.Next(2) == 0)
                            {
                                num23 = 889;
                            }
                            else
                            {
                                num23 = 890;
                            }
                            if (Main.rand.Next(100) != 0)
                            {
                                goto IL_2B09;
                            }
                            if (num23 == 889)
                            {
                                num24 = 890;
                                goto IL_2B09;
                            }
                            num24 = 889;
                            goto IL_2B09;
                        case 76:
                        case 85:
                        case 86:
                        case 87:
                        case 88:
                        case 89:
                        case 90:
                        case 91:
                        case 92:
                            goto IL_2B09;
                        case 77:
                            goto IL_2A1F;
                        case 78:
                        case 82:
                            num23 = 889;
                            goto IL_2B09;
                        case 79:
                            if (Main.rand.Next(2) == 0)
                            {
                                num23 = 888;
                            }
                            else
                            {
                                num23 = 890;
                            }
                            if (Main.rand.Next(100) != 0)
                            {
                                goto IL_2B09;
                            }
                            if (num23 == 888)
                            {
                                num24 = 890;
                                goto IL_2B09;
                            }
                            num24 = 888;
                            goto IL_2B09;
                        case 80:
                        case 93:
                            break;
                        case 81:
                            num23 = 888;
                            goto IL_2B09;
                        case 83:
                        case 84:
                            goto IL_2A5B;
                        case 94:
                            goto IL_2A67;
                        default:
                            switch (num)
                            {
                            case 102:
                            case 104:
                                goto IL_2A13;
                            case 103:
                                num23 = 890;
                                goto IL_2B09;
                            default:
                                if (num != 109)
                                {
                                    goto IL_2B09;
                                }
                                break;
                            }
                            break;
                        }
                        num23 = 893;
                        goto IL_2B09;
                    }
                    if (num == 34)
                    {
                        goto IL_2A5B;
                    }
                    if (num != 42)
                    {
                        goto IL_2B09;
                    }
                    goto IL_2A2B;
                }
                else if (num <= 179)
                {
                    if (num == 141 || num == 176)
                    {
                        goto IL_2A2B;
                    }
                    if (num != 179)
                    {
                        goto IL_2B09;
                    }
                    goto IL_2A5B;
                }
                else
                {
                    if (num == 182)
                    {
                        goto IL_2A67;
                    }
                    switch (num)
                    {
                    case 231:
                    case 232:
                    case 233:
                    case 234:
                    case 235:
                        goto IL_2A2B;
                    default:
                        switch (num)
                        {
                        case 269:
                        case 270:
                        case 271:
                        case 272:
                            break;
                        case 273:
                        case 274:
                        case 275:
                        case 276:
                            goto IL_2A1F;
                        default:
                            goto IL_2B09;
                        }
                        break;
                    }
                }
                IL_2A13:
                num23 = 885;
                goto IL_2B09;
                IL_2A1F:
                num23 = 886;
                goto IL_2B09;
                IL_2A2B:
                num23 = 887;
                goto IL_2B09;
                IL_2A5B:
                num23 = 891;
                goto IL_2B09;
                IL_2A67:
                num23 = 892;
                IL_2B09:
                if (num23 != -1)
                {
                    DropLoot(this.position, this.width, this.height, num23, 1, false, -1, false, false);
                }
                if (num24 != -1)
                {
                    DropLoot(this.position, this.width, this.height, num24, 1, false, -1, false, false);
                }
            }
            int num25 = 1;
            if (Main.expertMode && Main.rand.Next(2) == 0)
            {
                num25 = 2;
            }
            for (int m = 0; m < num25; m++)
            {
                if (this.type == NPCID.Paladin)
                {
                    if (Main.rand.Next(15) == 0)
                    {
                        DropLoot(this.position, this.width, this.height, 1513, 1, false, -1, false, false);
                    }
                    else if (Main.rand.Next(10) == 0)
                    {
                        DropLoot(this.position, this.width, this.height, 938, 1, false, -1, false, false);
                    }
                }
                if (this.type == NPCID.BoneLee && Main.rand.Next(6) == 0)
                {
                    if (Main.rand.Next(2) == 0)
                    {
                        DropLoot(this.position, this.width, this.height, 963, 1, false, -1, false, false);
                    }
                    else
                    {
                        DropLoot(this.position, this.width, this.height, 977, 1, false, -1, false, false);
                    }
                }
                if (this.type == NPCID.SkeletonSniper)
                {
                    if (Main.rand.Next(12) == 0)
                    {
                        DropLoot(this.position, this.width, this.height, 1300, 1, false, -1, false, false);
                    }
                    else if (Main.rand.Next(12) == 0)
                    {
                        DropLoot(this.position, this.width, this.height, 1254, 1, false, -1, false, false);
                    }
                }
                if (this.type == NPCID.TacticalSkeleton)
                {
                    if (Main.rand.Next(12) == 0)
                    {
                        DropLoot(this.position, this.width, this.height, 1514, 1, false, -1, false, false);
                    }
                    else if (Main.rand.Next(12) == 0)
                    {
                        DropLoot(this.position, this.width, this.height, 679, 1, false, -1, false, false);
                    }
                }
                if (this.type == NPCID.SkeletonCommando && Main.rand.Next(18) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 759, 1, false, -1, false, false);
                }
                if ((this.type == NPCID.RaggedCaster || this.type == NPCID.RaggedCasterOpenCoat) && Main.rand.Next(20) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 1446, 1, false, -1, false, false);
                }
                if ((this.type == NPCID.Necromancer || this.type == NPCID.NecromancerArmored) && Main.rand.Next(20) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 1444, 1, false, -1, false, false);
                }
                if ((this.type == NPCID.DiabolistRed || this.type == NPCID.DiabolistWhite) && Main.rand.Next(20) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 1445, 1, false, -1, false, false);
                }
                if (this.type >= NPCID.RustyArmoredBonesAxe && this.type <= NPCID.HellArmoredBonesSword)
                {
                    if (Main.rand.Next(400) == 0)
                    {
                        DropLoot(this.position, this.width, this.height, 1183, 1, false, -1, false, false);
                    }
                    else if (Main.rand.Next(300) == 0)
                    {
                        DropLoot(this.position, this.width, this.height, 1266, 1, false, -1, false, false);
                    }
                    else if (Main.rand.Next(200) == 0)
                    {
                        DropLoot(this.position, this.width, this.height, 671, 1, false, -1, false, false);
                    }
                }
            }
            if (this.lifeMax > 100 && this.type != NPCID.DungeonSpirit && this.value > 0f && this.target >= 0 && Main.hardMode && NPC.downedPlantBoss && Main.player[this.target].ZoneDungeon)
            {
                int maxValue2 = 13;
                if (Main.expertMode)
                {
                    maxValue2 = 9;
                }
                if (Main.rand.Next(maxValue2) == 0 && Main.wallDungeon[(int)Main.tile[(int)base.Center.X / 16, (int)base.Center.Y / 16].wall])
                {
                    NPC.NewNPC((int)base.Center.X, (int)base.Center.Y, 288, 0, 0f, 0f, 0f, 0f, 255);
                }
            }
            if (this.type == NPCID.DungeonSpirit)
            {
                DropLoot(this.position, this.width, this.height, 1508, Main.rand.Next(1, 3), false, -1, false, false);
            }
            if (this.type == NPCID.RedDevil && Main.rand.Next(30) == 0)
            {
                DropLoot(this.position, this.width, this.height, 683, 1, false, -1, false, false);
            }
            if ((this.type == NPCID.LostGirl || this.type == NPCID.Nymph) && (Main.expertMode || Main.rand.Next(2) == 0))
            {
                DropLoot(this.position, this.width, this.height, 3102, 1, false, -1, false, false);
            }
            if (this.type == NPCID.Golem)
            {
                if (Main.expertMode)
                {
                    this.DropBossBags();
                }
                else
                {
                    if (Main.rand.Next(7) == 0)
                    {
                        DropLoot(this.position, this.width, this.height, 2110, 1, false, -1, false, false);
                    }
                    int num26 = Main.rand.Next(8);
                    if (num26 == 0)
                    {
                        DropLoot(this.position, this.width, this.height, 1258, 1, false, -1, false, false);
                        DropLoot(this.position, this.width, this.height, 1261, Main.rand.Next(60, 100), false, 0, false, false);
                    }
                    else if (num26 == 1)
                    {
                        DropLoot(this.position, this.width, this.height, 1122, 1, false, -1, false, false);
                    }
                    else if (num26 == 2)
                    {
                        DropLoot(this.position, this.width, this.height, 899, 1, false, -1, false, false);
                    }
                    else if (num26 == 3)
                    {
                        DropLoot(this.position, this.width, this.height, 1248, 1, false, -1, false, false);
                    }
                    else if (num26 == 4)
                    {
                        DropLoot(this.position, this.width, this.height, 1294, 1, false, -1, false, false);
                    }
                    else if (num26 == 5)
                    {
                        DropLoot(this.position, this.width, this.height, 1295, 1, false, -1, false, false);
                    }
                    else if (num26 == 6)
                    {
                        DropLoot(this.position, this.width, this.height, 1296, 1, false, -1, false, false);
                    }
                    else if (num26 == 7)
                    {
                        DropLoot(this.position, this.width, this.height, 1297, 1, false, -1, false, false);
                    }
                    DropLoot(this.position, this.width, this.height, 2218, Main.rand.Next(4, 9), false, -1, false, false);
                }
                NPC.downedGolemBoss = true;
            }
            if (this.type == NPCID.GoblinSummoner && (Main.expertMode || Main.rand.Next(2) == 0))
            {
                if (Main.rand.Next(3) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 3052, 1, false, -1, false, false);
                }
                else if (Main.rand.Next(2) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 3053, 1, false, -1, false, false);
                }
                else
                {
                    DropLoot(this.position, this.width, this.height, 3054, 1, false, -1, false, false);
                }
            }
            if (this.type == NPCID.IchorSticker)
            {
                DropLoot(this.position, this.width, this.height, 1332, Main.rand.Next(2, 6), false, 0, false, false);
            }
            if (this.type == NPCID.DukeFishron)
            {
                NPC.downedFishron = true;
                if (Main.expertMode)
                {
                    this.DropBossBags();
                }
                else
                {
                    if (Main.rand.Next(7) == 0)
                    {
                        DropLoot(this.position, this.width, this.height, 2588, 1, false, -1, false, false);
                    }
                    if (Main.rand.Next(15) == 0)
                    {
                        DropLoot(this.position, this.width, this.height, 2609, 1, false, -1, false, false);
                    }
                    int num27 = Main.rand.Next(5);
                    if (num27 == 0)
                    {
                        DropLoot(this.position, this.width, this.height, 2611, 1, false, -1, false, false);
                    }
                    else if (num27 == 1)
                    {
                        DropLoot(this.position, this.width, this.height, 2624, 1, false, -1, false, false);
                    }
                    else if (num27 == 2)
                    {
                        DropLoot(this.position, this.width, this.height, 2622, 1, false, -1, false, false);
                    }
                    else if (num27 == 3)
                    {
                        DropLoot(this.position, this.width, this.height, 2621, 1, false, -1, false, false);
                    }
                    else if (num27 == 4)
                    {
                        DropLoot(this.position, this.width, this.height, 2623, 1, false, -1, false, false);
                    }
                }
            }
            if (this.type == NPCID.Clown && !NPC.downedClown)
            {
                NPC.downedClown = true;
                if (Main.netMode == 2)
                {
                    NetMessage.SendData((int)PacketTypes.WorldInfo, -1, -1, "", 0, 0f, 0f, 0f, 0, 0, 0);
                }
            }
            if (this.type == NPCID.GiantTortoise && Main.rand.Next(17) == 0)
            {
                DropLoot(this.position, this.width, this.height, 1328, 1, false, -1, false, false);
            }
            if (this.type == NPCID.ChaosElemental && Main.rand.Next(500) == 0)
            {
                DropLoot(this.position, this.width, this.height, 1326, 1, false, -1, false, false);
            }
            if (this.type == NPCID.CaveBat && Main.rand.Next(250) == 0)
            {
                DropLoot(this.position, this.width, this.height, 1325, 1, false, -1, false, false);
            }
            if (this.type == NPCID.SnowFlinx && Main.rand.Next(150) == 0)
            {
                DropLoot(this.position, this.width, this.height, 951, 1, false, -1, false, false);
            }
            if (this.type == NPCID.UndeadMiner && Main.rand.Next(50) == 0)
            {
                DropLoot(this.position, this.width, this.height, 1320, 1, false, -1, false, false);
            }
            if (this.type == NPCID.UndeadMiner && Main.rand.Next(20) == 0)
            {
                DropLoot(this.position, this.width, this.height, 88, 1, false, -1, false, false);
            }
            if (this.type == NPCID.SkeletonArcher && Main.rand.Next(80) == 0)
            {
                DropLoot(this.position, this.width, this.height, 1321, 1, false, -1, false, false);
            }
            if (this.type == NPCID.Hellbat && Main.rand.Next(150) == 0)
            {
                DropLoot(this.position, this.width, this.height, 1322, 1, false, -1, false, false);
            }
            if (this.type == NPCID.Lavabat && Main.rand.Next(50) == 0)
            {
                DropLoot(this.position, this.width, this.height, 1322, 1, false, -1, false, false);
            }
            if (this.type == NPCID.FireImp && Main.rand.Next(50) == 0)
            {
                DropLoot(this.position, this.width, this.height, 1323, 1, false, -1, false, false);
            }
            if (this.type == NPCID.Clown && Main.rand.Next(30) == 0)
            {
                DropLoot(this.position, this.width, this.height, 1324, Main.rand.Next(1, 5), false, -1, false, false);
            }
            if (this.type == NPCID.BlackRecluse || this.type == NPCID.BlackRecluseWall)
            {
                if (Main.rand.Next(40) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 1308, 1, false, -1, false, false);
                }
                if (Main.expertMode)
                {
                    if (Main.rand.Next(3) == 0)
                    {
                        DropLoot(this.position, this.width, this.height, 2607, Main.rand.Next(2, 4), false, 0, false, false);
                    }
                    else if (Main.rand.Next(2) == 0)
                    {
                        DropLoot(this.position, this.width, this.height, 2607, Main.rand.Next(1, 4), false, 0, false, false);
                    }
                    else
                    {
                        DropLoot(this.position, this.width, this.height, 2607, 1, false, 0, false, false);
                    }
                }
                else if (Main.rand.Next(4) != 0)
                {
                    if (Main.rand.Next(3) == 0)
                    {
                        DropLoot(this.position, this.width, this.height, 2607, Main.rand.Next(1, 4), false, 0, false, false);
                    }
                    else if (Main.rand.Next(2) == 0)
                    {
                        DropLoot(this.position, this.width, this.height, 2607, Main.rand.Next(1, 3), false, 0, false, false);
                    }
                    else
                    {
                        DropLoot(this.position, this.width, this.height, 2607, 1, false, 0, false, false);
                    }
                }
            }
            if (Main.hardMode && (this.type == NPCID.ArmoredViking || this.type == NPCID.IcyMerman || this.type == NPCID.IceElemental || this.type == NPCID.IceTortoise) && Main.rand.Next(180) == 0)
            {
                DropLoot(this.position, this.width, this.height, 1306, 1, false, -1, false, false);
            }
            if (this.type == NPCID.RainbowSlime)
            {
                DropLoot(this.position, this.width, this.height, 23, Main.rand.Next(1, 6), false, 0, false, false);
                if (Main.rand.Next(2) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 23, Main.rand.Next(1, 6), false, 0, false, false);
                }
                if (Main.rand.Next(2) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 23, Main.rand.Next(1, 6), false, 0, false, false);
                }
                if (Main.rand.Next(2) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 23, Main.rand.Next(1, 6), false, 0, false, false);
                }
                DropLoot(this.position, this.width, this.height, 662, Main.rand.Next(30, 60), false, 0, false, false);
            }
            if (this.type == NPCID.AngryNimbus && Main.rand.Next(15) == 0)
            {
                DropLoot(this.position, this.width, this.height, 1244, 1, false, -1, false, false);
            }
            if (this.type == NPCID.RuneWizard)
            {
                DropLoot(this.position, this.width, this.height, 754, 1, false, -1, false, false);
                DropLoot(this.position, this.width, this.height, 755, 1, false, -1, false, false);
            }
            if (this.type == NPCID.SkeletonArcher && Main.rand.Next(200) == 0)
            {
                DropLoot(this.position, this.width, this.height, 682, 1, false, -1, false, false);
            }
            if (this.type == NPCID.IceTortoise && Main.rand.Next(100) == 0)
            {
                DropLoot(this.position, this.width, this.height, 1253, 1, false, -1, false, false);
            }
            if ((this.type == NPCID.IceElemental || this.type == NPCID.IcyMerman) && Main.rand.Next(50) == 0)
            {
                DropLoot(this.position, this.width, this.height, 726, 1, false, -1, false, false);
            }
            if (this.type == NPCID.IceGolem)
            {
                DropLoot(this.position, this.width, this.height, 2161, 1, false, -1, false, false);
            }
            if (this.type == NPCID.Medusa && Main.rand.Next(50) == 0)
            {
                DropLoot(this.position, this.width, this.height, 3269, 1, false, -1, false, false);
            }
            if (this.type == NPCID.Lihzahrd || this.type == NPCID.LihzahrdCrawler || this.type == NPCID.FlyingSnake)
            {
                if (Main.rand.Next(1000) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 1172, 1, false, -1, false, false);
                }
                if (Main.rand.Next(50) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 1293, 1, false, -1, false, false);
                }
                if (Main.rand.Next(7) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 2766, Main.rand.Next(1, 3), false, -1, false, false);
                }
            }
            if (this.type == NPCID.Mummy || this.type == NPCID.DarkMummy || this.type == NPCID.LightMummy)
            {
                if (Main.rand.Next(75) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 870, 1, false, -1, false, false);
                }
                if (Main.rand.Next(75) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 871, 1, false, -1, false, false);
                }
                if (Main.rand.Next(75) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 872, 1, false, -1, false, false);
                }
            }
            if (this.type == NPCID.BigMimicCorruption)
            {
                int num28 = Main.rand.Next(5);
                if (num28 == 0)
                {
                    DropLoot(this.position, this.width, this.height, 3008, 1, false, -1, false, false);
                }
                else if (num28 == 1)
                {
                    DropLoot(this.position, this.width, this.height, 3014, 1, false, -1, false, false);
                }
                else if (num28 == 2)
                {
                    DropLoot(this.position, this.width, this.height, 3012, 1, false, -1, false, false);
                }
                else if (num28 == 3)
                {
                    DropLoot(this.position, this.width, this.height, 3015, 1, false, -1, false, false);
                }
                else if (num28 == 4)
                {
                    DropLoot(this.position, this.width, this.height, 3023, 1, false, -1, false, false);
                }
            }
            else if (this.type == NPCID.BigMimicCrimson)
            {
                int num29 = Main.rand.Next(5);
                if (num29 == 0)
                {
                    DropLoot(this.position, this.width, this.height, 3006, 1, false, -1, false, false);
                }
                else if (num29 == 1)
                {
                    DropLoot(this.position, this.width, this.height, 3007, 1, false, -1, false, false);
                }
                else if (num29 == 2)
                {
                    DropLoot(this.position, this.width, this.height, 3013, 1, false, -1, false, false);
                }
                else if (num29 == 3)
                {
                    DropLoot(this.position, this.width, this.height, 3016, 1, false, -1, false, false);
                }
                else if (num29 == 4)
                {
                    DropLoot(this.position, this.width, this.height, 3020, 1, false, -1, false, false);
                }
            }
            else if (this.type == NPCID.BigMimicHallow)
            {
                int num30 = Main.rand.Next(4);
                if (num30 == 0)
                {
                    DropLoot(this.position, this.width, this.height, 3029, 1, false, -1, false, false);
                }
                else if (num30 == 1)
                {
                    DropLoot(this.position, this.width, this.height, 3030, 1, false, -1, false, false);
                }
                else if (num30 == 2)
                {
                    DropLoot(this.position, this.width, this.height, 3051, 1, false, -1, false, false);
                }
                else if (num30 == 3)
                {
                    DropLoot(this.position, this.width, this.height, 3022, 1, false, -1, false, false);
                }
            }
            else
            {
                int arg_47D3_0 = this.type;
            }
            if (this.type == NPCID.BigMimicCorruption || this.type == NPCID.BigMimicCrimson || this.type == NPCID.BigMimicHallow || this.type == NPCID.BigMimicJungle)
            {
                DropLoot(this.position, this.width, this.height, 499, Main.rand.Next(5, 11), false, -1, false, false);
                DropLoot(this.position, this.width, this.height, 500, Main.rand.Next(5, 16), false, -1, false, false);
            }
            if (this.type == NPCID.Mimic && this.value > 0f)
            {
                if (this.ai[3] == 4f)
                {
                    if (Main.rand.Next(20) == 0)
                    {
                        DropLoot(this.position, this.width, this.height, 1312, 1, false, -1, false, false);
                    }
                    else
                    {
                        int num31 = Main.rand.Next(3);
                        if (num31 == 0)
                        {
                            DropLoot(this.position, this.width, this.height, 676, 1, false, -1, false, false);
                        }
                        else if (num31 == 1)
                        {
                            DropLoot(this.position, this.width, this.height, 725, 1, false, -1, false, false);
                        }
                        else if (num31 == 2)
                        {
                            DropLoot(this.position, this.width, this.height, 1264, 1, false, -1, false, false);
                        }
                    }
                }
                else
                {
                    int num32 = Main.rand.Next(6);
                    if (num32 == 0)
                    {
                        DropLoot(this.position, this.width, this.height, 437, 1, false, -1, false, false);
                    }
                    else if (num32 == 1)
                    {
                        DropLoot(this.position, this.width, this.height, 517, 1, false, -1, false, false);
                    }
                    else if (num32 == 2)
                    {
                        DropLoot(this.position, this.width, this.height, 535, 1, false, -1, false, false);
                    }
                    else if (num32 == 3)
                    {
                        DropLoot(this.position, this.width, this.height, 536, 1, false, -1, false, false);
                    }
                    else if (num32 == 4)
                    {
                        DropLoot(this.position, this.width, this.height, 532, 1, false, -1, false, false);
                    }
                    else
                    {
                        DropLoot(this.position, this.width, this.height, 554, 1, false, -1, false, false);
                    }
                }
            }
            if (this.type == NPCID.WyvernHead)
            {
                if (Main.expertMode)
                {
                    DropLoot(this.position, this.width, this.height, 575, Main.rand.Next(5, 11) * 2, false, 0, false, false);
                }
                else
                {
                    DropLoot(this.position, this.width, this.height, 575, Main.rand.Next(5, 11), false, 0, false, false);
                }
            }
            if (this.type >= NPCID.PirateDeckhand && this.type <= NPCID.PirateCrossbower)
            {
                if (Main.rand.Next(8000) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 905, 1, false, -1, false, false);
                }
                if (Main.rand.Next(4000) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 855, 1, false, -1, false, false);
                }
                if (Main.rand.Next(2000) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 854, 1, false, -1, false, false);
                }
                if (Main.rand.Next(2000) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 2584, 1, false, -1, false, false);
                }
                if (Main.rand.Next(1000) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 3033, 1, false, -1, false, false);
                }
                if (Main.rand.Next(200) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 672, 1, false, -1, false, false);
                }
                if (Main.rand.Next(500) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 1277, 1, false, 0, false, false);
                }
                if (Main.rand.Next(500) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 1278, 1, false, 0, false, false);
                }
                if (Main.rand.Next(500) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 1279, 1, false, 0, false, false);
                }
                if (Main.rand.Next(500) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 1280, 1, false, 0, false, false);
                }
                if (Main.rand.Next(300) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 1704, 1, false, 0, false, false);
                }
                if (Main.rand.Next(300) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 1705, 1, false, 0, false, false);
                }
                if (Main.rand.Next(300) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 1710, 1, false, 0, false, false);
                }
                if (Main.rand.Next(300) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 1716, 1, false, 0, false, false);
                }
                if (Main.rand.Next(300) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 1720, 1, false, 0, false, false);
                }
                if (Main.rand.Next(300) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 2379, 1, false, 0, false, false);
                }
                if (Main.rand.Next(300) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 2389, 1, false, 0, false, false);
                }
                if (Main.rand.Next(300) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 2405, 1, false, 0, false, false);
                }
                if (Main.rand.Next(300) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 2843, 1, false, 0, false, false);
                }
                if (Main.rand.Next(300) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 2663, 1, false, 0, false, false);
                }
                if (Main.rand.Next(300) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 2238, 1, false, 0, false, false);
                }
                if (Main.rand.Next(300) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 2133, 1, false, 0, false, false);
                }
                if (Main.rand.Next(300) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 2137, 1, false, 0, false, false);
                }
                if (Main.rand.Next(300) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 2143, 1, false, 0, false, false);
                }
                if (Main.rand.Next(300) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 2147, 1, false, 0, false, false);
                }
                if (Main.rand.Next(300) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 2151, 1, false, 0, false, false);
                }
                if (Main.rand.Next(300) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 2155, 1, false, 0, false, false);
                }
                if (Main.rand.Next(500) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 3263, 1, false, 0, false, false);
                }
                if (Main.rand.Next(500) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 3264, 1, false, 0, false, false);
                }
                if (Main.rand.Next(500) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 3265, 1, false, 0, false, false);
                }
            }
            else if (this.type == NPCID.PirateCaptain)
            {
                if (Main.rand.Next(2000) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 905, 1, false, -1, false, false);
                }
                if (Main.rand.Next(1000) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 855, 1, false, -1, false, false);
                }
                if (Main.rand.Next(500) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 854, 1, false, -1, false, false);
                }
                if (Main.rand.Next(500) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 2584, 1, false, -1, false, false);
                }
                if (Main.rand.Next(250) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 3033, 1, false, -1, false, false);
                }
                if (Main.rand.Next(50) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 672, 1, false, -1, false, false);
                }
            }
            else if (this.type == NPCID.PirateShip)
            {
                if (Main.rand.Next(400) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 905, 1, false, -1, false, false);
                }
                else if (Main.rand.Next(200) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 855, 1, false, -1, false, false);
                }
                else if (Main.rand.Next(100) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 854, 1, false, -1, false, false);
                }
                else if (Main.rand.Next(100) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 2584, 1, false, -1, false, false);
                }
                else if (Main.rand.Next(50) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 3033, 1, false, -1, false, false);
                }
                else if (Main.rand.Next(10) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 672, 1, false, -1, false, false);
                }
            }
            if ((this.type == NPCID.ZombieEskimo || this.type == NPCID.ArmedZombieEskimo) && Main.rand.Next(50) == 0)
            {
                int num33 = Main.rand.Next(3);
                DropLoot(this.position, this.width, this.height, 803 + num33, 1, false, 0, false, false);
            }
            if (this.type == NPCID.CochinealBeetle)
            {
                DropLoot(this.position, this.width, this.height, 1115, 1, false, -1, false, false);
            }
            if (this.type == NPCID.CyanBeetle)
            {
                DropLoot(this.position, this.width, this.height, 1116, 1, false, -1, false, false);
            }
            if (this.type == NPCID.LacBeetle)
            {
                DropLoot(this.position, this.width, this.height, 1117, 1, false, -1, false, false);
            }
            if (this.type == NPCID.SeaSnail)
            {
                DropLoot(this.position, this.width, this.height, 1118, 1, false, -1, false, false);
            }
            if (this.type == NPCID.Squid)
            {
                DropLoot(this.position, this.width, this.height, 1119, 1, false, -1, false, false);
            }
            if (this.type == NPCID.UndeadViking && Main.rand.Next(50) == 0)
            {
                DropLoot(this.position, this.width, this.height, 879, 1, false, -1, false, false);
            }
            if (this.type == NPCID.SnowmanGangsta || this.type == NPCID.MisterStabby || this.type == NPCID.SnowBalla)
            {
                DropLoot(this.position, this.width, this.height, 593, Main.rand.Next(5, 11), false, 0, false, false);
            }
            if (this.type == NPCID.DarkMummy)
            {
                if (Main.rand.Next(10) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 527, 1, false, 0, false, false);
                }
            }
            else if (this.type == NPCID.LightMummy && Main.rand.Next(10) == 0)
            {
                DropLoot(this.position, this.width, this.height, 528, 1, false, 0, false, false);
            }
            if (this.type == NPCID.DesertGhoulCorruption)
            {
                if (Main.rand.Next(3) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 522, Main.rand.Next(1, 4), false, 0, false, false);
                }
                if (Main.rand.Next(15) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 527, 1, false, 0, false, false);
                }
            }
            if (this.type == NPCID.DesertGhoulCrimson)
            {
                if (Main.rand.Next(3) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 1332, Main.rand.Next(1, 4), false, 0, false, false);
                }
                if (Main.rand.Next(15) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 527, 1, false, 0, false, false);
                }
            }
            if (this.type == NPCID.DesertGhoulHallow && Main.rand.Next(15) == 0)
            {
                DropLoot(this.position, this.width, this.height, 528, 1, false, 0, false, false);
            }
            if (this.type == NPCID.DesertBeast && Main.rand.Next(3) == 0)
            {
                DropLoot(this.position, this.width, this.height, 3380, 1, false, 0, false, false);
            }
            if (this.type == NPCID.DesertLamiaLight)
            {
                if (Main.rand.Next(25) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 2802, 1, false, 0, false, false);
                }
            }
            else if (this.type == NPCID.DesertLamiaDark && Main.rand.Next(25) == 0)
            {
                DropLoot(this.position, this.width, this.height, 2801, 1, false, 0, false, false);
            }
            if ((this.type == NPCID.CaveBat || this.type == NPCID.JungleBat || this.type == NPCID.IceBat || this.type == NPCID.GiantBat) && Main.rand.Next(100) == 0)
            {
                DropLoot(this.position, this.width, this.height, 18, 1, false, -1, false, false);
            }
            if ((this.type == NPCID.MotherSlime || this.type == NPCID.SnowFlinx || this.type == NPCID.UndeadViking || this.type == NPCID.ArmoredViking) && Main.rand.Next(50) == 0)
            {
                DropLoot(this.position, this.width, this.height, 393, 1, false, -1, false, false);
            }
            if (this.type == NPCID.Piranha && Main.rand.Next(75) == 0)
            {
                DropLoot(this.position, this.width, this.height, 393, 1, false, -1, false, false);
            }
            if (this.type >= NPCID.Crawdad && this.type <= NPCID.Salamander9)
            {
                if (Main.rand.Next(80) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 18, 1, false, -1, false, false);
                }
                else if (Main.rand.Next(80) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 393, 1, false, -1, false, false);
                }
                else if (Main.rand.Next(25) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 3285, 1, false, -1, false, false);
                }
            }
            if (this.type == NPCID.Skeleton || this.type == NPCID.HeadacheSkeleton || this.type == NPCID.MisassembledSkeleton || this.type == NPCID.PantlessSkeleton || this.type == NPCID.SkeletonTopHat || this.type == NPCID.SkeletonAstonaut || this.type == NPCID.SkeletonAlien || (this.type >= NPCID.BoneThrowingSkeleton && this.type <= NPCID.BoneThrowingSkeleton4))
            {
                if (Main.rand.Next(100) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 954, 1, false, -1, false, false);
                }
                else if (Main.rand.Next(200) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 955, 1, false, -1, false, false);
                }
                else if (Main.rand.Next(200) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 1166, 1, false, -1, false, false);
                }
                else if (Main.rand.Next(500) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 1274, 1, false, -1, false, false);
                }
            }
            else if (this.type == NPCID.EaterofSouls)
            {
                if (Main.rand.Next(175) == 0)
                {
                    int num34 = Main.rand.Next(3);
                    if (num34 == 0)
                    {
                        DropLoot(this.position, this.width, this.height, 956, 1, false, -1, false, false);
                    }
                    else if (num34 == 1)
                    {
                        DropLoot(this.position, this.width, this.height, 957, 1, false, -1, false, false);
                    }
                    else
                    {
                        DropLoot(this.position, this.width, this.height, 958, 1, false, -1, false, false);
                    }
                }
            }
            else if (this.type == NPCID.Hornet || this.type == NPCID.ManEater || (this.type >= NPCID.HornetFatty && this.type <= NPCID.HornetStingy))
            {
                if (Main.rand.Next(100) == 0)
                {
                    int num35 = Main.rand.Next(3);
                    if (num35 == 0)
                    {
                        DropLoot(this.position, this.width, this.height, 960, 1, false, -1, false, false);
                    }
                    else if (num35 == 1)
                    {
                        DropLoot(this.position, this.width, this.height, 961, 1, false, -1, false, false);
                    }
                    else
                    {
                        DropLoot(this.position, this.width, this.height, 962, 1, false, -1, false, false);
                    }
                }
            }
            else if (this.type == NPCID.AngryBones || this.type == NPCID.DarkCaster || this.type == NPCID.AngryBonesBig || this.type == NPCID.AngryBonesBigMuscle || this.type == NPCID.AngryBonesBigHelmet)
            {
                if (Main.rand.Next(450) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 959, 1, false, -1, false, false);
                }
                if (Main.rand.Next(300) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 1307, 1, false, -1, false, false);
                }
            }
            if ((this.type == NPCID.Herpling || this.type == NPCID.CrimsonAxe || this.type == NPCID.FloatyGross || this.type == NPCID.Crimslime) && Main.rand.Next(200) == 0)
            {
                DropLoot(this.position, this.width, this.height, 996, 1, false, 0, false, false);
            }
            if (this.type == NPCID.Clinger || this.type == NPCID.SeekerHead)
            {
                DropLoot(this.position, this.width, this.height, 522, Main.rand.Next(2, 6), false, 0, false, false);
            }
            if (this.type == NPCID.Unicorn)
            {
                DropLoot(this.position, this.width, this.height, 526, 1, false, 0, false, false);
                if (Main.rand.Next(100) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 856, 1, false, 0, false, false);
                }
            }
            if (this.type == NPCID.PincushionZombie || this.type == NPCID.ArmedZombiePincussion)
            {
                DropLoot(this.position, this.width, this.height, 40, Main.rand.Next(1, 10), false, 0, false, false);
            }
            if (this.type == NPCID.UmbrellaSlime)
            {
                if (Main.rand.Next(45) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 1243, 1, false, 0, false, false);
                }
                else
                {
                    DropLoot(this.position, this.width, this.height, 23, Main.rand.Next(2, 7), false, 0, false, false);
                }
            }
            if (this.type == NPCID.SandSlime)
            {
                int num36 = Main.rand.Next(1, 3);
                if (Main.expertMode)
                {
                    if (this.netID == -7)
                    {
                        num36++;
                    }
                    if (this.netID == -8 || this.netID == -9)
                    {
                        num36 += Main.rand.Next(2);
                    }
                }
                DropLoot(this.position, this.width, this.height, 23, num36, false, 0, false, false);
                int num37 = 8000;
                if (Main.expertMode)
                {
                    num37 = (int)((double)num37 * 0.7);
                }
                if (Main.rand.Next(num37) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 1309, 1, false, -1, false, false);
                }
            }
            if (this.type >= NPCID.SlimeRibbonWhite && this.type <= NPCID.SlimeRibbonRed && Main.rand.Next(20) == 0)
            {
                DropLoot(this.position, this.width, this.height, 1906, 1, false, 0, false, false);
            }
            if (this.netID == -4)
            {
                DropLoot(this.position, this.width, this.height, 3111, Main.rand.Next(25, 51), false, 0, false, false);
                int num38 = 100;
                if (Main.expertMode)
                {
                    num38 = (int)((double)num38 * 0.7);
                }
                if (Main.rand.Next(num38) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 1309, 1, false, -1, false, false);
                }
            }
            else if (this.type == NPCID.BlueSlime || this.type == NPCID.MotherSlime || this.type == NPCID.IlluminantSlime || this.type == NPCID.ToxicSludge || this.type == NPCID.IceSlime || this.type == NPCID.SpikedIceSlime || this.type == NPCID.SlimedZombie || this.type == NPCID.SpikedJungleSlime || this.type == NPCID.SlimeMasked || (this.type >= NPCID.SlimeRibbonWhite && this.type <= NPCID.SlimeRibbonRed) || this.type == NPCID.SlimeSpiked)
            {
                int num39 = Main.rand.Next(1, 3);
                if (Main.expertMode)
                {
                    if (this.netID == -7)
                    {
                        num39++;
                    }
                    if (this.netID == -8 || this.netID == -9)
                    {
                        num39 += Main.rand.Next(2);
                    }
                }

                Vector2 position = this.position;
                int width = this.width;
                int height = this.height;
                int ID = 23;
                bool broadcast = false;
                int prefix = 0;
                bool nodelay = false;
                bool reverseLookup = false;
                if (!ServerApi.Hooks.InvokeNpcLootDrop(ref position, ref width, ref height, ref ID, ref num39, ref broadcast, ref prefix, type, whoAmI, ref nodelay, ref reverseLookup))
                {
                    int num40 = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 23, num39, false, 0, false, false);
                    if (this.netID <= 1 && this.netID != -1 && this.netID != -2 && this.netID != -5 && this.netID != -6)
                    {
                        Main.item[num40].color = this.color;
                        NetMessage.SendData((int)PacketTypes.TweakItem, -1, -1, "", num40, 1f, 0f, 0f, 0, 0, 0);
                    }
                }
                int num41 = 10000;
                if (Main.expertMode)
                {
                    num41 = (int)((double)num41 * 0.7);
                }
                if (Main.rand.Next(num41) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 1309, 1, false, -1, false, false);
                }
            }
            if (this.type == NPCID.Pixie)
            {
                DropLoot(this.position, this.width, this.height, 501, Main.rand.Next(1, 4), false, 0, false, false);
            }
            if (this.type == NPCID.CorruptSlime || this.type == NPCID.Crimslime)
            {
                DropLoot(this.position, this.width, this.height, 23, Main.rand.Next(2, 5), false, 0, false, false);
            }
            if (this.type == NPCID.Gastropod)
            {
                DropLoot(this.position, this.width, this.height, 23, Main.rand.Next(5, 11), false, 0, false, false);
            }
            if (this.type == NPCID.DungeonSlime)
            {
                DropLoot(this.position, this.width, this.height, 327, 1, false, 0, false, false);
            }
            if (this.type == NPCID.DemonEye || this.type == NPCID.DemonEyeOwl || this.type == NPCID.DemonEyeSpaceship || this.type == NPCID.CataractEye || this.type == NPCID.SleepyEye || this.type == NPCID.DialatedEye || this.type == NPCID.GreenEye || this.type == NPCID.PurpleEye || this.type == NPCID.WanderingEye)
            {
                if (Main.rand.Next(3) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 38, 1, false, 0, false, false);
                }
                else if (Main.rand.Next(100) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 236, 1, false, 0, false, false);
                }
            }
            if (this.type == NPCID.Werewolf && Main.rand.Next(60) == 0)
            {
                DropLoot(this.position, this.width, this.height, 485, 1, false, -1, false, false);
            }
            if (this.type == NPCID.Piranha)
            {
                if (Main.rand.Next(250) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 263, 1, false, 0, false, false);
                }
                else if (Main.rand.Next(30) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 118, 1, false, 0, false, false);
                }
            }
            if (this.type == NPCID.AnglerFish && Main.rand.Next(250) == 0)
            {
                DropLoot(this.position, this.width, this.height, 263, 1, false, 0, false, false);
            }
            if (this.type == NPCID.Zombie || this.type == NPCID.ZombieXmas || this.type == NPCID.ZombieSweater || this.type == NPCID.BaldZombie || this.type == NPCID.ZombieEskimo || this.type == NPCID.PincushionZombie || this.type == NPCID.SlimedZombie || this.type == NPCID.SwampZombie || this.type == NPCID.TwiggyZombie || this.type == NPCID.FemaleZombie || this.type == NPCID.ZombieRaincoat || this.type == NPCID.ZombieDoctor || this.type == NPCID.ZombieSuperman || this.type == NPCID.ZombiePixie || (this.type >= NPCID.ArmedZombie && this.type <= NPCID.ArmedZombieCenx))
            {
                if (Main.rand.Next(50) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 216, 1, false, -1, false, false);
                }
                if (Main.rand.Next(250) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 1304, 1, false, -1, false, false);
                }
            }
            if ((this.type == NPCID.BloodZombie || this.type == NPCID.Drippler) && (Main.expertMode || Main.rand.Next(2) == 0))
            {
                if (Main.rand.Next(75) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 3212, 1, false, -1, false, false);
                }
                if (Main.rand.Next(100) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 3213, 1, false, -1, false, false);
                }
            }
            if (this.type == NPCID.ZombieRaincoat && Main.rand.Next(20) == 0)
            {
                if (Main.rand.Next(2) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 1135, 1, false, -1, false, false);
                }
                else
                {
                    DropLoot(this.position, this.width, this.height, 1136, 1, false, -1, false, false);
                }
            }
            if (this.type == NPCID.VoodooDemon)
            {
                DropLoot(this.position, this.width, this.height, 267, 1, false, 0, false, false);
            }
            if ((this.type == NPCID.Demon || this.type == NPCID.VoodooDemon) && Main.rand.Next(35) == 0)
            {
                DropLoot(this.position, this.width, this.height, 272, 1, false, -1, false, false);
            }
            if (this.value > 0f && Main.hardMode && (double)(this.position.Y / 16f) < Main.worldSurface + 10.0 && (base.Center.X / 16f < 380f || base.Center.X / 16f > (float)(Main.maxTilesX - 380)) && Main.rand.Next(100) == 0)
            {
                DropLoot(this.position, this.width, this.height, 1315, 1, false, 0, false, false);
            }
            if (this.type == NPCID.DoctorBones)
            {
                DropLoot(this.position, this.width, this.height, 251, 1, false, 0, false, false);
            }
            if (this.type == NPCID.TheGroom)
            {
                DropLoot(this.position, this.width, this.height, 239, 1, false, 0, false, false);
            }
            if (this.type == NPCID.TheBride)
            {
                DropLoot(this.position, this.width, this.height, 3478, 1, false, 0, false, false);
                DropLoot(this.position, this.width, this.height, 3479, 1, false, 0, false, false);
            }
            if (this.type == NPCID.Clothier)
            {
                DropLoot(this.position, this.width, this.height, 260, 1, false, 0, false, false);
            }
            if (this.type == NPCID.TravellingMerchant)
            {
                DropLoot(this.position, this.width, this.height, 2222, 1, false, 0, false, false);
            }
            if ((this.type == NPCID.Antlion || this.type == NPCID.FlyingAntlion || this.type == NPCID.WalkingAntlion) && Main.rand.Next(3) == 0)
            {
                DropLoot(this.position, this.width, this.height, 323, Main.rand.Next(1, 3), false, 0, false, false);
            }
            if (this.type == NPCID.GoblinScout)
            {
                DropLoot(this.position, this.width, this.height, 362, Main.rand.Next(1, 3), false, 0, false, false);
            }
            if ((this.type == NPCID.GraniteFlyer || this.type == NPCID.GraniteGolem) && Main.rand.Next(30) == 0)
            {
                DropLoot(this.position, this.width, this.height, 3109, 1, false, 0, false, false);
            }
            if ((this.type == NPCID.EaterofSouls || this.type == NPCID.Corruptor) && Main.rand.Next(3) == 0)
            {
                DropLoot(this.position, this.width, this.height, 68, 1, false, 0, false, false);
            }
            if ((this.type == NPCID.FaceMonster || this.type == NPCID.Crimera || this.type == NPCID.BloodCrawler || this.type == NPCID.FloatyGross || this.type == NPCID.BloodCrawlerWall) && Main.rand.Next(3) == 0)
            {
                DropLoot(this.position, this.width, this.height, 1330, 1, false, 0, false, false);
            }
            if (this.type == NPCID.DevourerHead || this.type == NPCID.DevourerBody || this.type == NPCID.DevourerTail)
            {
                if (Main.rand.Next(3) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 68, Main.rand.Next(1, 3), false, 0, false, false);
                }
                DropLoot(this.position, this.width, this.height, 69, Main.rand.Next(3, 9), false, 0, false, false);
            }
            if ((this.type == NPCID.GiantWormHead || this.type == NPCID.GiantWormBody || this.type == NPCID.GiantWormTail || this.type == NPCID.DiggerHead || this.type == NPCID.DiggerBody || this.type == NPCID.DiggerTail) && (Main.rand.Next(50) == 0 || (Main.expertMode && Main.rand.Next(50) == 0)))
            {
                DropLoot(this.position, this.width, this.height, 215, 1, false, 0, false, false);
            }
            if (this.type == NPCID.CorruptBunny && Main.rand.Next(75) == 0)
            {
                DropLoot(this.position, this.width, this.height, 243, 1, false, 0, false, false);
            }
            if (this.type == NPCID.EyeofCthulhu)
            {
                if (Main.expertMode)
                {
                    this.DropBossBags();
                }
                else
                {
                    if (Main.rand.Next(7) == 0)
                    {
                        DropLoot(this.position, this.width, this.height, 2112, 1, false, -1, false, false);
                    }
                    if (Main.rand.Next(40) == 0 || (Main.expertMode && Main.rand.Next(20) == 0))
                    {
                        DropLoot(this.position, this.width, this.height, 1299, 1, false, 0, false, false);
                    }
                    if (Main.expertMode)
                    {
                        DropLoot(this.position, this.width, this.height, 3097, 1, false, -1, false, false);
                    }
                    int num42 = 1;
                    if (Main.expertMode)
                    {
                        num42 = 2;
                    }
                    for (int n = 0; n < num42; n++)
                    {
                        if (WorldGen.crimson)
                        {
                            int stack = Main.rand.Next(20) + 10;
                            DropLoot(this.position, this.width, this.height, 880, stack, false, 0, false, false);
                            stack = Main.rand.Next(20) + 10;
                            DropLoot(this.position, this.width, this.height, 880, stack, false, 0, false, false);
                            stack = Main.rand.Next(20) + 10;
                            DropLoot(this.position, this.width, this.height, 880, stack, false, 0, false, false);
                            stack = Main.rand.Next(3) + 1;
                            DropLoot(this.position, this.width, this.height, 2171, stack, false, 0, false, false);
                        }
                        else
                        {
                            int stack2 = Main.rand.Next(30) + 20;
                            DropLoot(this.position, this.width, this.height, 47, stack2, false, 0, false, false);
                            stack2 = Main.rand.Next(20) + 10;
                            DropLoot(this.position, this.width, this.height, 56, stack2, false, 0, false, false);
                            stack2 = Main.rand.Next(20) + 10;
                            DropLoot(this.position, this.width, this.height, 56, stack2, false, 0, false, false);
                            stack2 = Main.rand.Next(20) + 10;
                            DropLoot(this.position, this.width, this.height, 56, stack2, false, 0, false, false);
                            stack2 = Main.rand.Next(3) + 1;
                            DropLoot(this.position, this.width, this.height, 59, stack2, false, 0, false, false);
                        }
                    }
                }
            }
            if (this.type == NPCID.BrainofCthulhu)
            {
                if (Main.expertMode)
                {
                    this.DropBossBags();
                }
                else
                {
                    int stack3 = Main.rand.Next(20, 46);
                    DropLoot(this.position, this.width, this.height, 880, stack3, false, 0, false, false);
                    stack3 = Main.rand.Next(20, 46);
                    DropLoot(this.position, this.width, this.height, 880, stack3, false, 0, false, false);
                    if (Main.expertMode)
                    {
                        stack3 = Main.rand.Next(30, 51);
                        DropLoot(this.position, this.width, this.height, 880, stack3, false, 0, false, false);
                        stack3 = Main.rand.Next(30, 51);
                        DropLoot(this.position, this.width, this.height, 880, stack3, false, 0, false, false);
                    }
                    if (Main.rand.Next(7) == 0)
                    {
                        DropLoot(this.position, this.width, this.height, 2104, 1, false, -1, false, false);
                    }
                    if (Main.rand.Next(20) == 0)
                    {
                        DropLoot(this.position, this.width, this.height, 3060, 1, false, 0, false, false);
                    }
                    if (Main.expertMode)
                    {
                        DropLoot(this.position, this.width, this.height, 3223, 1, false, 0, false, false);
                    }
                }
            }
            if (this.type == NPCID.Creeper && NPC.AnyNPCs(NPCID.BrainofCthulhu))
            {
                int num43 = Main.rand.Next(2, 6);
                if (Main.rand.Next(3) != 0)
                {
                    if (Main.expertMode)
                    {
                        num43 += Main.rand.Next(2, 6);
                    }
                    DropLoot(this.position, this.width, this.height, 1329, num43, false, 0, false, false);
                }
                if (Main.rand.Next(3) != 0)
                {
                    num43 = Main.rand.Next(5, 13);
                    if (Main.expertMode)
                    {
                        num43 += Main.rand.Next(6, 14);
                    }
                    DropLoot(this.position, this.width, this.height, 880, num43, false, 0, false, false);
                }
                if (Main.rand.Next(2) == 0 && Main.player[(int)Player.FindClosest(this.position, this.width, this.height)].statLife < Main.player[(int)Player.FindClosest(this.position, this.width, this.height)].statLifeMax2)
                {
                    DropLoot(this.position, this.width, this.height, 58, 1, false, 0, false, false);
                }
            }
            if (this.type == NPCID.EaterofWorldsHead || this.type == NPCID.EaterofWorldsBody || this.type == NPCID.EaterofWorldsTail)
            {
                int num44 = Main.rand.Next(1, 3);
                if (Main.rand.Next(2) == 0)
                {
                    if (Main.expertMode)
                    {
                        num44++;
                    }
                    DropLoot(this.position, this.width, this.height, 86, num44, false, 0, false, false);
                }
                if (Main.rand.Next(2) == 0)
                {
                    num44 = Main.rand.Next(2, 6);
                    DropLoot(this.position, this.width, this.height, 56, num44, false, 0, false, false);
                }
                if (this.boss)
                {
                    if (Main.expertMode)
                    {
                        this.DropBossBags();
                    }
                    else
                    {
                        num44 = Main.rand.Next(10, 30);
                        DropLoot(this.position, this.width, this.height, 56, num44, false, 0, false, false);
                        num44 = Main.rand.Next(10, 31);
                        DropLoot(this.position, this.width, this.height, 56, num44, false, 0, false, false);
                        if (Main.expertMode)
                        {
                            num44 = Main.rand.Next(10, 30);
                            DropLoot(this.position, this.width, this.height, 56, num44, false, 0, false, false);
                            num44 = Main.rand.Next(10, 31);
                            DropLoot(this.position, this.width, this.height, 56, num44, false, 0, false, false);
                        }
                        if (Main.expertMode)
                        {
                            DropLoot(this.position, this.width, this.height, 3224, 1, false, 0, false, false);
                        }
                        if (Main.rand.Next(20) == 0)
                        {
                            DropLoot(this.position, this.width, this.height, 994, 1, false, 0, false, false);
                        }
                        if (Main.rand.Next(7) == 0)
                        {
                            DropLoot(this.position, this.width, this.height, 2111, 1, false, -1, false, false);
                        }
                    }
                }
                if (Main.rand.Next(4) == 0 && Main.player[(int)Player.FindClosest(this.position, this.width, this.height)].statLife < Main.player[(int)Player.FindClosest(this.position, this.width, this.height)].statLifeMax2)
                {
                    DropLoot(this.position, this.width, this.height, 58, 1, false, 0, false, false);
                }
            }
            if (this.type == NPCID.QueenBee)
            {
                if (Main.expertMode)
                {
                    this.DropBossBags();
                }
                else
                {
                    if (Main.rand.Next(7) == 0)
                    {
                        DropLoot(this.position, this.width, this.height, 2108, 1, false, -1, false, false);
                    }
                    int num45 = Main.rand.Next(3);
                    if (num45 == 0)
                    {
                        num45 = 1121;
                    }
                    else if (num45 == 1)
                    {
                        num45 = 1123;
                    }
                    else if (num45 == 2)
                    {
                        num45 = 2888;
                    }
                    DropLoot(this.position, this.width, this.height, num45, 1, false, -1, false, false);
                    if (Main.expertMode)
                    {
                        int num46 = Main.rand.Next(3);
                        if (num46 == 0)
                        {
                            num46 = 1121;
                        }
                        else if (num46 == 1)
                        {
                            num46 = 1123;
                        }
                        else if (num46 == 2)
                        {
                            num46 = 2888;
                        }
                        while (num46 == num45)
                        {
                            num46 = Main.rand.Next(3);
                            if (num46 == 0)
                            {
                                num46 = 1121;
                            }
                            else if (num46 == 1)
                            {
                                num46 = 1123;
                            }
                            else if (num46 == 2)
                            {
                                num46 = 2888;
                            }
                        }
                        DropLoot(this.position, this.width, this.height, num46, 1, false, -1, false, false);
                        DropLoot(this.position, this.width, this.height, 1132, 1, false, -1, false, false);
                    }
                    else if (Main.rand.Next(3) == 0)
                    {
                        DropLoot(this.position, this.width, this.height, 1132, 1, false, -1, false, false);
                    }
                    if ((Main.expertMode && Main.rand.Next(15) == 0) || Main.rand.Next(15) == 0)
                    {
                        DropLoot(this.position, this.width, this.height, 1170, 1, false, 0, false, false);
                    }
                    if ((Main.expertMode && Main.rand.Next(20) == 0) || Main.rand.Next(20) == 0)
                    {
                        DropLoot(this.position, this.width, this.height, 2502, 1, false, 0, false, false);
                    }
                    if (Main.expertMode)
                    {
                        DropLoot(this.position, this.width, this.height, 1129, 1, false, 0, false, false);
                        DropLoot(this.position, this.width, this.height, Main.rand.Next(842, 845), 1, false, 0, false, false);
                    }
                    else if (Main.rand.Next(3) == 0)
                    {
                        DropLoot(this.position, this.width, this.height, 1129, 1, false, 0, false, false);
                    }
                    else if (Main.rand.Next(2) == 0)
                    {
                        DropLoot(this.position, this.width, this.height, Main.rand.Next(842, 845), 1, false, 0, false, false);
                    }
                    if (Main.rand.Next(4) != 0 || Main.expertMode)
                    {
                        DropLoot(this.position, this.width, this.height, 1130, Main.rand.Next(10, 30), false, 0, false, false);
                        if (Main.expertMode)
                        {
                            DropLoot(this.position, this.width, this.height, 1130, Main.rand.Next(10, 30), false, 0, false, false);
                        }
                    }
                    if (Main.expertMode)
                    {
                        DropLoot(this.position, this.width, this.height, 2431, Main.rand.Next(44, 67), false, 0, false, false);
                    }
                    else
                    {
                        DropLoot(this.position, this.width, this.height, 2431, Main.rand.Next(16, 27), false, 0, false, false);
                    }
                }
                NPC.downedQueenBee = true;
                if (Main.netMode == 2)
                {
                    NetMessage.SendData((int)PacketTypes.WorldInfo, -1, -1, "", 0, 0f, 0f, 0f, 0, 0, 0);
                }
            }
            if (this.type == NPCID.SkeletronHead)
            {
                if (Main.expertMode)
                {
                    this.DropBossBags();
                }
                else if (Main.rand.Next(7) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 1281, 1, false, -1, false, false);
                }
                else if (Main.rand.Next(7) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 1273, 1, false, -1, false, false);
                }
                else if (Main.rand.Next(7) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 1313, 1, false, -1, false, false);
                }
            }
            if (this.type == NPCID.WallofFlesh)
            {
                if (Main.expertMode)
                {
                    this.DropBossBags();
                }
                else
                {
                    if (Main.rand.Next(7) == 0)
                    {
                        DropLoot(this.position, this.width, this.height, 2105, 1, false, -1, false, false);
                    }
                    DropLoot(this.position, this.width, this.height, 367, 1, false, -1, false, false);
                    if (Main.expertMode)
                    {
                        int num47 = Main.rand.Next(4);
                        if (num47 == 3)
                        {
                            num47 = 2998;
                        }
                        else
                        {
                            num47 = 489 + num47;
                        }
                        DropLoot(this.position, this.width, this.height, num47, 1, false, -1, false, false);
                        int num48 = Main.rand.Next(3);
                        if (num48 == 0)
                        {
                            DropLoot(this.position, this.width, this.height, 514, 1, false, -1, false, false);
                        }
                        else if (num48 == 1)
                        {
                            DropLoot(this.position, this.width, this.height, 426, 1, false, -1, false, false);
                        }
                        else if (num48 == 2)
                        {
                            DropLoot(this.position, this.width, this.height, 434, 1, false, -1, false, false);
                        }
                    }
                    else if (Main.rand.Next(2) == 0)
                    {
                        int num49 = Main.rand.Next(4);
                        if (num49 == 3)
                        {
                            num49 = 2998;
                        }
                        else
                        {
                            num49 = 489 + num49;
                        }
                        DropLoot(this.position, this.width, this.height, num49, 1, false, -1, false, false);
                    }
                    else
                    {
                        int num50 = Main.rand.Next(3);
                        if (num50 == 0)
                        {
                            DropLoot(this.position, this.width, this.height, 514, 1, false, -1, false, false);
                        }
                        else if (num50 == 1)
                        {
                            DropLoot(this.position, this.width, this.height, 426, 1, false, -1, false, false);
                        }
                        else if (num50 == 2)
                        {
                            DropLoot(this.position, this.width, this.height, 434, 1, false, -1, false, false);
                        }
                    }
                }
                if (Main.netMode != 1)
                {
                    int num51 = (int)(this.position.X + (float)(this.width / 2)) / 16;
                    int num52 = (int)(this.position.Y + (float)(this.height / 2)) / 16;
                    int num53 = this.width / 2 / 16 + 1;
                    for (int num54 = num51 - num53; num54 <= num51 + num53; num54++)
                    {
                        for (int num55 = num52 - num53; num55 <= num52 + num53; num55++)
                        {
                            if ((num54 == num51 - num53 || num54 == num51 + num53 || num55 == num52 - num53 || num55 == num52 + num53) && !Main.tile[num54, num55].active())
                            {
                                Main.tile[num54, num55].type = (ushort)(WorldGen.crimson ? 347 : 140);
                                Main.tile[num54, num55].active(true);
                            }
                            Main.tile[num54, num55].lava(false);
                            Main.tile[num54, num55].liquid = 0;
                            if (Main.netMode == 2)
                            {
                                NetMessage.SendTileSquare(-1, num54, num55, 1);
                            }
                            else
                            {
                                WorldGen.SquareTileFrame(num54, num55, true);
                            }
                        }
                    }
                }
            }
            if (this.type == NPCID.CultistBoss)
            {
                NPC.downedAncientCultist = true;
                if (Main.rand.Next(7) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 3372, 1, false, -1, false, false);
                }
                DropLoot(this.position, this.width, this.height, 3549, 1, false, -1, false, false);
                WorldGen.TriggerLunarApocalypse();
            }
            if (this.type == NPCID.MoonLordCore)
            {
                NPC.downedMoonlord = true;
                NPC.LunarApocalypseIsUp = false;
                if (Main.expertMode)
                {
                    this.DropBossBags();
                }
                else
                {
                    if (Main.rand.Next(7) == 0)
                    {
                        DropLoot(this.position, this.width, this.height, 3373, 1, false, -1, false, false);
                    }
                    DropLoot(this.position, this.width, this.height, 3384, 1, false, -1, false, false);
                    DropLoot(this.position, this.width, this.height, 3460, Main.rand.Next(70, 91), false, -1, false, false);
                    int num56 = Utils.SelectRandom<int>(Main.rand, new int[]
                    {
                        3063,
                        3389,
                        3065,
                        1553,
                        3546,
                        3541,
                        3570,
                        3571,
                        3569
                    });
                    DropLoot(this.position, this.width, this.height, num56, 1, false, -1, false, false);
                }
            }
            num = this.type;
            if (num <= 493)
            {
                switch (num)
                {
                case 402:
                case 405:
                case 407:
                case 409:
                case 411:
                    if ((this.type != NPCID.StardustCellSmall || Main.rand.Next(3) == 0) && NPC.ShieldStrengthTowerStardust > 0)
                    {
                        Projectile.NewProjectile(base.Center.X, base.Center.Y, 0f, 0f, 629, 0, 0f, Main.myPlayer, (float)NPC.FindFirstNPC(493), 0f);
                        goto IL_90BA;
                    }
                    goto IL_90BA;
                case 403:
                case 404:
                case 406:
                case 408:
                case 410:
                case 428:
                    goto IL_90BA;
                case 412:
                case 413:
                case 414:
                case 415:
                case 416:
                case 417:
                case 418:
                case 419:
                    break;
                case 420:
                case 421:
                case 423:
                case 424:
                    if (NPC.ShieldStrengthTowerNebula > 0)
                    {
                        Projectile.NewProjectile(base.Center.X, base.Center.Y, 0f, 0f, 629, 0, 0f, Main.myPlayer, (float)NPC.FindFirstNPC(507), 0f);
                        goto IL_90BA;
                    }
                    goto IL_90BA;
                case 422:
                {
                    int num57 = Main.rand.Next(25, 41) / 2;
                    if (Main.expertMode)
                    {
                        num57 = (int)((float)num57 * 1.5f);
                    }
                    for (int num58 = 0; num58 < num57; num58++)
                    {
                        DropLoot(new Vector2((int)this.position.X + Main.rand.Next(this.width), (int)this.position.Y + Main.rand.Next(this.height)), 2, 2, 3456, Main.rand.Next(1, 4), false, 0, false, false);
                    }
                    NPC.downedTowerVortex = true;
                    NPC.TowerActiveVortex = false;
                    WorldGen.UpdateLunarApocalypse();
                    WorldGen.MessageLunarApocalypse();
                    goto IL_90BA;
                }
                case 425:
                case 426:
                case 427:
                case 429:
                    if (NPC.ShieldStrengthTowerVortex > 0)
                    {
                        Projectile.NewProjectile(base.Center.X, base.Center.Y, 0f, 0f, 629, 0, 0f, Main.myPlayer, (float)NPC.FindFirstNPC(422), 0f);
                        goto IL_90BA;
                    }
                    goto IL_90BA;
                default:
                {
                    if (num != 493)
                    {
                        goto IL_90BA;
                    }
                    int num59 = Main.rand.Next(25, 41) / 2;
                    if (Main.expertMode)
                    {
                        num59 = (int)((float)num59 * 1.5f);
                    }
                    for (int num60 = 0; num60 < num59; num60++)
                    {
                        DropLoot(new Vector2((int)this.position.X + Main.rand.Next(this.width), (int)this.position.Y + Main.rand.Next(this.height)), 2, 2, 3459, Main.rand.Next(1, 4), false, 0, false, false);
                    }
                    NPC.downedTowerStardust = true;
                    NPC.TowerActiveStardust = false;
                    WorldGen.UpdateLunarApocalypse();
                    WorldGen.MessageLunarApocalypse();
                    goto IL_90BA;
                }
                }
            }
            else
            {
                if (num == 507)
                {
                    int num61 = Main.rand.Next(25, 41) / 2;
                    if (Main.expertMode)
                    {
                        num61 = (int)((float)num61 * 1.5f);
                    }
                    for (int num62 = 0; num62 < num61; num62++)
                    {
                        DropLoot(new Vector2((int)this.position.X + Main.rand.Next(this.width), (int)this.position.Y + Main.rand.Next(this.height)), 2, 2, 3457, Main.rand.Next(1, 4), false, 0, false, false);
                    }
                    NPC.downedTowerNebula = true;
                    NPC.TowerActiveNebula = false;
                    WorldGen.UpdateLunarApocalypse();
                    WorldGen.MessageLunarApocalypse();
                    goto IL_90BA;
                }
                switch (num)
                {
                case 517:
                {
                    int num63 = Main.rand.Next(25, 41) / 2;
                    if (Main.expertMode)
                    {
                        num63 = (int)((float)num63 * 1.5f);
                    }
                    for (int num64 = 0; num64 < num63; num64++)
                    {
                        DropLoot(new Vector2((int)this.position.X + Main.rand.Next(this.width), (int)this.position.Y + Main.rand.Next(this.height)), 2, 2, 3458, Main.rand.Next(1, 4), false, 0, false, false);
                    }
                    NPC.downedTowerSolar = true;
                    NPC.TowerActiveSolar = false;
                    WorldGen.UpdateLunarApocalypse();
                    WorldGen.MessageLunarApocalypse();
                    goto IL_90BA;
                }
                case 518:
                    break;
                default:
                    goto IL_90BA;
                }
            }
            if (NPC.ShieldStrengthTowerSolar > 0)
            {
                Projectile.NewProjectile(base.Center.X, base.Center.Y, 0f, 0f, 629, 0, 0f, Main.myPlayer, (float)NPC.FindFirstNPC(517), 0f);
            }
            IL_90BA:
            num = this.type;
            switch (num)
            {
            case 381:
            case 382:
            case 383:
            case 385:
            case 386:
            case 389:
            case 390:
                break;
            case 384:
            case 387:
            case 388:
                goto IL_914D;
            default:
                if (num != 520)
                {
                    goto IL_914D;
                }
                break;
            }
            if (Main.rand.Next(8) == 0)
            {
                DropLoot(this.position, this.width, this.height, 2860, Main.rand.Next(8, 21), false, 0, false, false);
            }
            IL_914D:
            num = this.type;
            if (num == 383 || num == 386 || num == 389)
            {
                if (Main.rand.Next(200) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 2806, 1, false, 0, false, false);
                }
                if (Main.rand.Next(200) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 2807, 1, false, 0, false, false);
                }
                if (Main.rand.Next(200) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 2808, 1, false, 0, false, false);
                }
            }
            num = this.type;
            switch (num)
            {
            case 381:
            case 382:
            case 385:
                break;
            case 383:
            case 384:
                goto IL_9346;
            default:
                if (num != 390)
                {
                    goto IL_9346;
                }
                break;
            }
            if (Main.rand.Next(200) == 0)
            {
                DropLoot(this.position, this.width, this.height, 2803, 1, false, 0, false, false);
            }
            if (Main.rand.Next(200) == 0)
            {
                DropLoot(this.position, this.width, this.height, 2804, 1, false, 0, false, false);
            }
            if (Main.rand.Next(200) == 0)
            {
                DropLoot(this.position, this.width, this.height, 2805, 1, false, 0, false, false);
            }
            IL_9346:
            if (this.type == NPCID.MartianSaucerCore)
            {
                DropLoot(this.position, this.width, this.height, Utils.SelectRandom<int>(Main.rand, new int[]
                {
                    2797,
                    2749,
                    2795,
                    2798,
                    2796,
                    2882,
                    2880,
                    2769,
                    2800
                }), 1, false, 0, false, false);
            }
            if (this.type == NPCID.ScutlixRider && Main.rand.Next(100) == 0)
            {
                DropLoot(this.position, this.width, this.height, 2771, 1, false, 0, false, false);
            }
            if ((this.type == NPCID.TheHungryII || this.type == NPCID.LeechHead || this.type == NPCID.LeechBody || this.type == NPCID.LeechTail) && (!Main.expertMode || Main.rand.Next(5) == 0))
            {
                DropLoot(this.position, this.width, this.height, 58, 1, false, 0, false, false);
            }
            if (this.type == NPCID.Probe && Main.rand.Next(2) == 0)
            {
                DropLoot(this.position, this.width, this.height, 58, 1, false, 0, false, false);
            }
            if (this.type == NPCID.BlueJellyfish || this.type == NPCID.PinkJellyfish || this.type == NPCID.GreenJellyfish)
            {
                if (Main.rand.Next(100) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 1303, 1, false, -1, false, false);
                }
                DropLoot(this.position, this.width, this.height, 282, Main.rand.Next(1, 5), false, 0, false, false);
            }
            if (this.type == NPCID.GreekSkeleton && Main.rand.Next(2) == 0)
            {
                DropLoot(this.position, this.width, this.height, 3094, Main.rand.Next(40, 81), false, 0, false, false);
            }
            if (this.type == NPCID.GreekSkeleton && Main.rand.Next(20) == 0)
            {
                DropLoot(this.position, this.width, this.height, 3187 + Main.rand.Next(3), 1, false, 0, false, false);
            }
            if (this.type == NPCID.Skeleton || this.type == NPCID.UndeadMiner || this.type == NPCID.UndeadViking || this.type == NPCID.HeadacheSkeleton || this.type == NPCID.MisassembledSkeleton || this.type == NPCID.GreekSkeleton || this.type == NPCID.PantlessSkeleton || this.type == NPCID.SkeletonTopHat || this.type == NPCID.SkeletonAstonaut || this.type == NPCID.SkeletonAlien || (this.type >= NPCID.BoneThrowingSkeleton && this.type <= NPCID.BoneThrowingSkeleton4))
            {
                if (Main.rand.Next(25) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 118, 1, false, 0, false, false);
                }
                else if (this.type == NPCID.UndeadMiner)
                {
                    if (Main.rand.Next(20) == 0)
                    {
                        DropLoot(this.position, this.width, this.height, Main.rand.Next(410, 412), 1, false, 0, false, false);
                    }
                    else
                    {
                        DropLoot(this.position, this.width, this.height, 166, Main.rand.Next(1, 4), false, 0, false, false);
                    }
                }
            }
            if (this.type == NPCID.Tim)
            {
                DropLoot(this.position, this.width, this.height, 238, 1, false, 0, false, false);
            }
            if (this.type == NPCID.KingSlime)
            {
                if (Main.slimeRain)
                {
                    Main.StopSlimeRain(true);
                    AchievementsHelper.NotifyProgressionEvent(16);
                }
                if (Main.expertMode)
                {
                    this.DropBossBags();
                }
                else
                {
                    if (Main.rand.Next(4) == 0)
                    {
                        DropLoot(this.position, this.width, this.height, 2430, 1, false, 0, false, false);
                    }
                    if (Main.rand.Next(7) == 0)
                    {
                        DropLoot(this.position, this.width, this.height, 2493, 1, false, -1, false, false);
                    }
                    DropLoot(this.position, this.width, this.height, Main.rand.Next(256, 259), 1, false, 0, false, false);
                    Main.rand.Next(2);
                    if (Main.rand.Next(3) == 0)
                    {
                        DropLoot(this.position, this.width, this.height, 2585, 1, false, 0, false, false);
                    }
                    else
                    {
                        DropLoot(this.position, this.width, this.height, 2610, 1, false, 0, false, false);
                    }
                    DropLoot(this.position, this.width, this.height, 998, 1, false, 0, false, false);
                }
                NPC.downedSlimeKing = true;
                if (Main.netMode == 2)
                {
                    NetMessage.SendData((int)PacketTypes.WorldInfo, -1, -1, "", 0, 0f, 0f, 0f, 0, 0, 0);
                }
            }
            if (this.type == NPCID.MeteorHead && Main.rand.Next(50) == 0)
            {
                DropLoot(this.position, this.width, this.height, 116, 1, false, 0, false, false);
            }
            if (this.type == NPCID.FireImp && Main.rand.Next(250) == 0)
            {
                DropLoot(this.position, this.width, this.height, 244, 1, false, 0, false, false);
            }
            if (this.type == NPCID.AngryBones || this.type == NPCID.DarkCaster || this.type == NPCID.CursedSkull)
            {
                if (Main.rand.Next(250) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 932, 1, false, 0, false, false);
                }
                else if (Main.rand.Next(100) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 3095, 1, false, 0, false, false);
                }
                else if (Main.rand.Next(65) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 327, 1, false, 0, false, false);
                }
                else if (!Main.expertMode)
                {
                    DropLoot(this.position, this.width, this.height, 154, Main.rand.Next(1, 4), false, 0, false, false);
                }
                if (Main.expertMode)
                {
                    DropLoot(this.position, this.width, this.height, 154, Main.rand.Next(2, 7), false, 0, false, false);
                }
            }
            if (this.type == NPCID.GoblinPeon || this.type == NPCID.GoblinThief || this.type == NPCID.GoblinWarrior || this.type == NPCID.GoblinSorcerer || this.type == NPCID.GoblinArcher)
            {
                if (Main.rand.Next(200) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 160, 1, false, 0, false, false);
                }
                else if (Main.rand.Next(2) == 0)
                {
                    int stack4 = Main.rand.Next(1, 6);
                    DropLoot(this.position, this.width, this.height, 161, stack4, false, 0, false, false);
                }
            }
            if (this.type == NPCID.AngryTrapper && Main.rand.Next(100) == 0)
            {
                DropLoot(this.position, this.width, this.height, 1265, 1, false, -1, false, false);
            }
            if ((this.type == NPCID.Hornet || (this.type >= NPCID.HornetFatty && this.type <= NPCID.HornetStingy)) && (Main.expertMode || Main.rand.Next(3) != 0))
            {
                DropLoot(this.position, this.width, this.height, 209, 1, false, 0, false, false);
            }
            if (this.type == NPCID.SpikedJungleSlime && (Main.expertMode || Main.rand.Next(2) == 0))
            {
                DropLoot(this.position, this.width, this.height, 209, 1, false, 0, false, false);
            }
            if (this.type == NPCID.ManEater && (Main.expertMode || Main.rand.Next(2) == 0))
            {
                DropLoot(this.position, this.width, this.height, 210, 1, false, 0, false, false);
            }
            if (this.type == NPCID.Shark)
            {
                if (Main.rand.Next(50) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 268, 1, false, 0, false, false);
                }
                else
                {
                    DropLoot(this.position, this.width, this.height, 319, 1, false, 0, false, false);
                }
            }
            if (this.type == NPCID.Harpy && Main.rand.Next(2) == 0)
            {
                DropLoot(this.position, this.width, this.height, 320, 1, false, 0, false, false);
            }
            if (this.type == NPCID.Retinazer || this.type == NPCID.Spazmatism)
            {
                int num65 = 125;
                if (this.type == NPCID.Retinazer)
                {
                    num65 = 126;
                }
                if (!NPC.AnyNPCs(num65))
                {
                    if (Main.expertMode)
                    {
                        this.DropBossBags();
                    }
                    else
                    {
                        if (Main.rand.Next(7) == 0)
                        {
                            DropLoot(this.position, this.width, this.height, 2106, 1, false, -1, false, false);
                        }
                        DropLoot(this.position, this.width, this.height, 549, Main.rand.Next(25, 41), false, 0, false, false);
                        DropLoot(this.position, this.width, this.height, 1225, Main.rand.Next(15, 31), false, 0, false, false);
                    }
                }
                else
                {
                    this.value = 0f;
                    this.boss = false;
                }
            }
            else if (Main.expertMode)
            {
                if (this.type == NPCID.SkeletronPrime || this.type == NPCID.TheDestroyer)
                {
                    this.DropBossBags();
                }
            }
            else if (this.type == NPCID.SkeletronPrime)
            {
                if (Main.rand.Next(7) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 2107, 1, false, -1, false, false);
                }
                DropLoot(this.position, this.width, this.height, 547, Main.rand.Next(25, 41), false, 0, false, false);
                DropLoot(this.position, this.width, this.height, 1225, Main.rand.Next(15, 31), false, 0, false, false);
            }
            else if (this.type == NPCID.TheDestroyer)
            {
                if (Main.rand.Next(7) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 2113, 1, false, -1, false, false);
                }
                DropLoot(this.position, this.width, this.height, 548, Main.rand.Next(25, 41), false, 0, false, false);
                DropLoot(this.position, this.width, this.height, 1225, Main.rand.Next(15, 31), false, 0, false, false);
            }
            if (this.type == NPCID.Plantera)
            {
                if (Main.expertMode)
                {
                    this.DropBossBags();
                }
                else
                {
                    if (Main.rand.Next(7) == 0)
                    {
                        DropLoot(this.position, this.width, this.height, 2109, 1, false, -1, false, false);
                    }
                    if (Main.expertMode)
                    {
                        DropLoot(this.position, this.width, this.height, 1141, Main.rand.Next(2, 4), false, -1, false, false);
                    }
                    else
                    {
                        DropLoot(this.position, this.width, this.height, 1141, 1, false, -1, false, false);
                    }
                    if (Main.rand.Next(20) == 0)
                    {
                        DropLoot(this.position, this.width, this.height, 1182, 1, false, -1, false, false);
                    }
                    if (Main.rand.Next(50) == 0 || (Main.expertMode && Main.rand.Next(50) == 0))
                    {
                        DropLoot(this.position, this.width, this.height, 1305, 1, false, -1, false, false);
                    }
                    if (Main.rand.Next(4) == 0 || Main.expertMode)
                    {
                        DropLoot(this.position, this.width, this.height, 1157, 1, false, -1, false, false);
                    }
                    if (Main.rand.Next(10) == 0)
                    {
                        DropLoot(this.position, this.width, this.height, 3021, 1, false, -1, false, false);
                    }
                    int num66 = 1;
                    if (Main.expertMode)
                    {
                        num66 = 2;
                    }
                    int num67 = 0;
                    for (int num68 = 0; num68 < num66; num68++)
                    {
                        int num69 = Main.rand.Next(7);
                        if (!NPC.downedPlantBoss)
                        {
                            num69 = 0;
                        }
                        if (num68 == 0)
                        {
                            num67 = num69;
                        }
                        else
                        {
                            while (num67 == num69)
                            {
                                num69 = Main.rand.Next(7);
                            }
                        }
                        if (num69 == 0)
                        {
                            DropLoot(this.position, this.width, this.height, 758, 1, false, -1, false, false);
                            DropLoot(this.position, this.width, this.height, 771, Main.rand.Next(50, 150), false, 0, false, false);
                        }
                        else if (num69 == 1)
                        {
                            DropLoot(this.position, this.width, this.height, 1255, 1, false, -1, false, false);
                        }
                        else if (num69 == 2)
                        {
                            DropLoot(this.position, this.width, this.height, 788, 1, false, -1, false, false);
                        }
                        else if (num69 == 3)
                        {
                            DropLoot(this.position, this.width, this.height, 1178, 1, false, -1, false, false);
                        }
                        else if (num69 == 4)
                        {
                            DropLoot(this.position, this.width, this.height, 1259, 1, false, -1, false, false);
                        }
                        else if (num69 == 5)
                        {
                            DropLoot(this.position, this.width, this.height, 1155, 1, false, -1, false, false);
                        }
                        else if (num69 == 6)
                        {
                            DropLoot(this.position, this.width, this.height, 3018, 1, false, -1, false, false);
                        }
                    }
                }
                bool flag3 = NPC.downedPlantBoss;
                NPC.downedPlantBoss = true;
                if (!flag3)
                {
                    if (Main.netMode == 0)
                    {
                        Main.NewText(Lang.misc[33], 50, 255, 130, false);
                    }
                    else if (Main.netMode == 2)
                    {
                        NetMessage.SendData((int)PacketTypes.ChatText, -1, -1, Lang.misc[33], 255, 50f, 255f, 130f, 0, 0, 0);
                    }
                }
            }
            if ((this.boss || this.type == NPCID.Retinazer || this.type == NPCID.Spazmatism || this.type == NPCID.PirateShip) && Main.rand.Next(10) == 0)
            {
                if (this.type == NPCID.EyeofCthulhu)
                {
                    DropLoot(this.position, this.width, this.height, 1360, 1, false, 0, false, false);
                }
                if (this.type == NPCID.EaterofWorldsHead || this.type == NPCID.EaterofWorldsBody || this.type == NPCID.EaterofWorldsTail)
                {
                    DropLoot(this.position, this.width, this.height, 1361, 1, false, 0, false, false);
                }
                if (this.type == NPCID.BrainofCthulhu)
                {
                    DropLoot(this.position, this.width, this.height, 1362, 1, false, 0, false, false);
                }
                if (this.type == NPCID.SkeletronHead)
                {
                    DropLoot(this.position, this.width, this.height, 1363, 1, false, 0, false, false);
                }
                if (this.type == NPCID.QueenBee)
                {
                    DropLoot(this.position, this.width, this.height, 1364, 1, false, 0, false, false);
                }
                if (this.type == NPCID.WallofFlesh)
                {
                    DropLoot(this.position, this.width, this.height, 1365, 1, false, 0, false, false);
                }
                if (this.type == NPCID.TheDestroyer)
                {
                    DropLoot(this.position, this.width, this.height, 1366, 1, false, 0, false, false);
                }
                if (this.type == NPCID.SkeletronPrime)
                {
                    DropLoot(this.position, this.width, this.height, 1367, 1, false, 0, false, false);
                }
                if (this.type == NPCID.Retinazer)
                {
                    DropLoot(this.position, this.width, this.height, 1368, 1, false, 0, false, false);
                }
                if (this.type == NPCID.Spazmatism)
                {
                    DropLoot(this.position, this.width, this.height, 1369, 1, false, 0, false, false);
                }
                if (this.type == NPCID.Plantera)
                {
                    DropLoot(this.position, this.width, this.height, 1370, 1, false, 0, false, false);
                }
                if (this.type == NPCID.Golem)
                {
                    DropLoot(this.position, this.width, this.height, 1371, 1, false, 0, false, false);
                }
                if (this.type == NPCID.KingSlime)
                {
                    DropLoot(this.position, this.width, this.height, 2489, 1, false, 0, false, false);
                }
                if (this.type == NPCID.DukeFishron)
                {
                    DropLoot(this.position, this.width, this.height, 2589, 1, false, 0, false, false);
                }
                if (this.type == NPCID.CultistBoss)
                {
                    DropLoot(this.position, this.width, this.height, 3357, 1, false, 0, false, false);
                }
                if (this.type == NPCID.PirateShip)
                {
                    DropLoot(this.position, this.width, this.height, 3359, 1, false, 0, false, false);
                }
                if (this.type == NPCID.MartianSaucerCore)
                {
                    DropLoot(this.position, this.width, this.height, 3358, 1, false, 0, false, false);
                }
                if (this.type == NPCID.MoonLordCore)
                {
                    DropLoot(this.position, this.width, this.height, 3595, 1, false, 0, false, false);
                }
            }
            if (this.boss)
            {
                if (this.type == NPCID.EyeofCthulhu)
                {
                    NPC.downedBoss1 = true;
                }
                else if (this.type == NPCID.EaterofWorldsHead || this.type == NPCID.EaterofWorldsBody || this.type == NPCID.EaterofWorldsTail)
                {
                    NPC.downedBoss2 = true;
                    this.name = "Eater of Worlds";
                }
                else if (this.type == NPCID.BrainofCthulhu)
                {
                    NPC.downedBoss2 = true;
                    this.name = "Brain of Cthulu";
                }
                else if (this.type == NPCID.SkeletronHead)
                {
                    NPC.downedBoss3 = true;
                    this.name = "Skeletron";
                }
                else
                {
                    this.name = this.displayName;
                }
                if (this.type == NPCID.SkeletronPrime)
                {
                    NPC.downedMechBoss3 = true;
                    NPC.downedMechBossAny = true;
                }
                if (this.type == NPCID.TheDestroyer)
                {
                    NPC.downedMechBoss1 = true;
                    NPC.downedMechBossAny = true;
                }
                string name = this.name;
                if (this.displayName != "")
                {
                    name = this.displayName;
                }
                int stack5 = Main.rand.Next(5, 16);
                int num70 = 28;
                if (this.type == NPCID.WallofFlesh)
                {
                    num70 = 188;
                }
                else if (this.type == NPCID.QueenBee)
                {
                    num70 = 1134;
                }
                else if (this.type > 113 && this.type < 222)
                {
                    num70 = 499;
                }
                else if (this.type == NPCID.Golem || this.type == NPCID.Plantera)
                {
                    num70 = 499;
                }
                else if (this.type == NPCID.DukeFishron)
                {
                    num70 = 499;
                }
                else if (this.type == NPCID.MartianSaucerCore)
                {
                    num70 = 499;
                }
                else if (this.type == NPCID.CultistBoss)
                {
                    num70 = 499;
                }
                else if (this.type == NPCID.MoonLordCore)
                {
                    num70 = 499;
                }
                DropLoot(this.position, this.width, this.height, num70, stack5, false, 0, false, false);
                int num71 = Main.rand.Next(5) + 5;
                for (int num72 = 0; num72 < num71; num72++)
                {
                    DropLoot(this.position, this.width, this.height, 58, 1, false, 0, false, false);
                }
                if (this.type == NPCID.Retinazer || this.type == NPCID.Spazmatism)
                {
                    NPC.downedMechBoss2 = true;
                    NPC.downedMechBossAny = true;
                    if (Main.netMode == 0)
                    {
                        Main.NewText("The Twins " + Lang.misc[50], 175, 75, 255, false);
                    }
                    else if (Main.netMode == 2)
                    {
                        NetMessage.SendData((int)PacketTypes.ChatText, -1, -1, "The Twins " + Lang.misc[50], 255, 175f, 75f, 255f, 0, 0, 0);
                    }
                }
                else if (this.type == NPCID.MoonLordCore)
                {
                    if (Main.netMode == 0)
                    {
                        Main.NewText("Moon Lord " + Lang.misc[17], 175, 75, 255, false);
                    }
                    else if (Main.netMode == 2)
                    {
                        NetMessage.SendData((int)PacketTypes.ChatText, -1, -1, "Moon Lord " + Lang.misc[17], 255, 175f, 75f, 255f, 0, 0, 0);
                    }
                }
                else if (Main.netMode == 0)
                {
                    Main.NewText(name + " " + Lang.misc[17], 175, 75, 255, false);
                }
                else if (Main.netMode == 2)
                {
                    NetMessage.SendData((int)PacketTypes.ChatText, -1, -1, name + " " + Lang.misc[17], 255, 175f, 75f, 255f, 0, 0, 0);
                }
                if (this.type == NPCID.WallofFlesh && Main.netMode != 1)
                {
                    bool hardMode = Main.hardMode;
                    WorldGen.StartHardmode();
                    if (NPC.downedMechBoss1 && NPC.downedMechBoss2 && NPC.downedMechBoss3 && !hardMode)
                    {
                        if (Main.netMode == 0)
                        {
                            Main.NewText(Lang.misc[32], 50, 255, 130, false);
                        }
                        else if (Main.netMode == 2)
                        {
                            NetMessage.SendData((int)PacketTypes.ChatText, -1, -1, Lang.misc[32], 255, 50f, 255f, 130f, 0, 0, 0);
                        }
                    }
                }
                if (Main.netMode == 2)
                {
                    NetMessage.SendData((int)PacketTypes.WorldInfo, -1, -1, "", 0, 0f, 0f, 0f, 0, 0, 0);
                }
            }
            if (!flag && NPC.downedMechBoss1 && NPC.downedMechBoss2 && NPC.downedMechBoss3 && Main.hardMode)
            {
                if (Main.netMode == 0)
                {
                    Main.NewText(Lang.misc[32], 50, 255, 130, false);
                }
                else if (Main.netMode == 2)
                {
                    NetMessage.SendData((int)PacketTypes.ChatText, -1, -1, Lang.misc[32], 255, 50f, 255f, 130f, 0, 0, 0);
                }
            }
            if (this.type != NPCID.MotherSlime && this.type != NPCID.CorruptSlime && this.type != NPCID.Slimer && Main.rand.Next(6) == 0 && this.lifeMax > 1 && this.damage > 0)
            {
                int num73 = (int)Player.FindClosest(this.position, this.width, this.height);
                if (Main.rand.Next(2) == 0 && Main.player[num73].statMana < Main.player[num73].statManaMax2)
                {
                    DropLoot(this.position, this.width, this.height, 184, 1, false, 0, false, false);
                }
                else if (Main.rand.Next(2) == 0 && Main.player[num73].statLife < Main.player[num73].statLifeMax2)
                {
                    DropLoot(this.position, this.width, this.height, 58, 1, false, 0, false, false);
                }
            }
            if (this.type != NPCID.MotherSlime && this.type != NPCID.CorruptSlime && this.type != NPCID.Slimer && Main.rand.Next(2) == 0 && this.lifeMax > 1 && this.damage > 0)
            {
                int num74 = (int)Player.FindClosest(this.position, this.width, this.height);
                if (Main.player[num74].statMana < Main.player[num74].statManaMax2)
                {
                    DropLoot(this.position, this.width, this.height, 184, 1, false, 0, false, false);
                }
            }
            float num75 = this.value;
            if (this.midas)
            {
                num75 *= 1f + (float)Main.rand.Next(10, 50) * 0.01f;
            }
            num75 *= 1f + (float)Main.rand.Next(-20, 21) * 0.01f;
            if (Main.rand.Next(5) == 0)
            {
                num75 *= 1f + (float)Main.rand.Next(5, 11) * 0.01f;
            }
            if (Main.rand.Next(10) == 0)
            {
                num75 *= 1f + (float)Main.rand.Next(10, 21) * 0.01f;
            }
            if (Main.rand.Next(15) == 0)
            {
                num75 *= 1f + (float)Main.rand.Next(15, 31) * 0.01f;
            }
            if (Main.rand.Next(20) == 0)
            {
                num75 *= 1f + (float)Main.rand.Next(20, 41) * 0.01f;
            }
            num75 += this.extraValue;
            while ((int)num75 > 0)
            {
                if (num75 > 1000000f)
                {
                    int num76 = (int)(num75 / 1000000f);
                    if (num76 > 50 && Main.rand.Next(5) == 0)
                    {
                        num76 /= Main.rand.Next(3) + 1;
                    }
                    if (Main.rand.Next(5) == 0)
                    {
                        num76 /= Main.rand.Next(3) + 1;
                    }
                    num75 -= (float)(1000000 * num76);
                    DropLoot(this.position, this.width, this.height, 74, num76, false, 0, false, false);
                }
                else if (num75 > 10000f)
                {
                    int num77 = (int)(num75 / 10000f);
                    if (num77 > 50 && Main.rand.Next(5) == 0)
                    {
                        num77 /= Main.rand.Next(3) + 1;
                    }
                    if (Main.rand.Next(5) == 0)
                    {
                        num77 /= Main.rand.Next(3) + 1;
                    }
                    num75 -= (float)(10000 * num77);
                    DropLoot(this.position, this.width, this.height, 73, num77, false, 0, false, false);
                }
                else if (num75 > 100f)
                {
                    int num78 = (int)(num75 / 100f);
                    if (num78 > 50 && Main.rand.Next(5) == 0)
                    {
                        num78 /= Main.rand.Next(3) + 1;
                    }
                    if (Main.rand.Next(5) == 0)
                    {
                        num78 /= Main.rand.Next(3) + 1;
                    }
                    num75 -= (float)(100 * num78);
                    DropLoot(this.position, this.width, this.height, 72, num78, false, 0, false, false);
                }
                else
                {
                    int num79 = (int)num75;
                    if (num79 > 50 && Main.rand.Next(5) == 0)
                    {
                        num79 /= Main.rand.Next(3) + 1;
                    }
                    if (Main.rand.Next(5) == 0)
                    {
                        num79 /= Main.rand.Next(4) + 1;
                    }
                    if (num79 < 1)
                    {
                        num79 = 1;
                    }
                    num75 -= (float)num79;
                    DropLoot(this.position, this.width, this.height, 71, num79, false, 0, false, false);
                }
            }
        }
Пример #3
0
 public static List<object> NPCIdSearch(string search)
 {
     try
     {
         var found = new List<object>();
         for (int i = -65; i < Main.maxNPCTypes; i++)
         {
             NPC npc = new NPC();
             npc.netDefaults(i);
             if (npc.name.ToLower().Contains(search.ToLower()))
                 found.Add(npc);
         }
         return found;
     }
     catch { return new List<object>(); }
 }
Пример #4
0
		protected override void Initialize()
		{
			Chest.Initialize();
			Wiring.Initialize();
			Framing.Initialize();
			Lighting.Initialize(false);
			Map.Initialize();
			TimeLogger.Initialize();
			WorldGen.randomBackgrounds();
			WorldGen.setCaveBacks();
			WorldGen.randMoon();
			Main.bgAlpha[0] = 1f;
			Main.bgAlpha2[0] = 1f;
			this.invBottom = 258;
			for (int i = 0; i < 423; i++)
			{
				Main.projFrames[i] = 1;
			}
			Main.projFrames[384] = 6;
			Main.projFrames[385] = 3;
			Main.projFrames[386] = 6;
			Main.projFrames[390] = 11;
			Main.projFrames[391] = 11;
			Main.projFrames[392] = 11;
			Main.projFrames[393] = 15;
			Main.projFrames[394] = 15;
			Main.projFrames[395] = 15;
			Main.projFrames[398] = 10;
			Main.projFrames[407] = 6;
			Main.projFrames[408] = 2;
			Main.projFrames[409] = 3;
			Main.projFrames[387] = 3;
			Main.projFrames[388] = 3;
			Main.projFrames[334] = 11;
			Main.projFrames[324] = 10;
			Main.projFrames[351] = 2;
			Main.projFrames[349] = 5;
			Main.projFrames[353] = 14;
			Main.projFrames[346] = 2;
			Main.projFrames[347] = 2;
			Main.projFrames[335] = 4;
			Main.projFrames[344] = 3;
			Main.projFrames[337] = 5;
			Main.projFrames[317] = 8;
			Main.projFrames[321] = 3;
			Main.projFrames[308] = 10;
			Main.projFrames[316] = 4;
			Main.projFrames[275] = 2;
			Main.projFrames[276] = 2;
			Main.projFrames[254] = 5;
			Main.projFrames[307] = 2;
			Main.projFrames[72] = 4;
			Main.projFrames[86] = 4;
			Main.projFrames[87] = 4;
			Main.projFrames[102] = 2;
			Main.projFrames[111] = 8;
			Main.projFrames[112] = 3;
			Main.projFrames[127] = 16;
			Main.projFrames[175] = 2;
			Main.projFrames[181] = 4;
			Main.projFrames[189] = 4;
			Main.projFrames[191] = 18;
			Main.projFrames[192] = 18;
			Main.projFrames[193] = 18;
			Main.projFrames[194] = 18;
			Main.projFrames[190] = 4;
			Main.projFrames[198] = 4;
			Main.projFrames[199] = 8;
			Main.projFrames[200] = 10;
			Main.projFrames[206] = 5;
			Main.projFrames[208] = 5;
			Main.projFrames[209] = 12;
			Main.projFrames[210] = 12;
			Main.projFrames[211] = 10;
			Main.projFrames[221] = 3;
			Main.projFrames[237] = 4;
			Main.projFrames[238] = 6;
			Main.projFrames[221] = 3;
			Main.projFrames[228] = 5;
			Main.projFrames[229] = 4;
			Main.projFrames[236] = 13;
			Main.projFrames[243] = 4;
			Main.projFrames[244] = 6;
			Main.projFrames[249] = 5;
			Main.projFrames[252] = 4;
			Main.projFrames[266] = 6;
			Main.projFrames[268] = 8;
			Main.projFrames[269] = 7;
			Main.projFrames[270] = 3;
			Main.projFrames[313] = 12;
			Main.projFrames[314] = 13;
			Main.projFrames[319] = 11;
			Main.projFrames[373] = 3;
			Main.projFrames[375] = 8;
			Main.projFrames[377] = 9;
			Main.projFrames[379] = 4;
			Main.projFrames[380] = 4;
			Main.projPet[319] = true;
			Main.projPet[334] = true;
			Main.projPet[324] = true;
			Main.projPet[266] = true;
			Main.projPet[313] = true;
			Main.projPet[314] = true;
			Main.projPet[317] = true;
			Main.projPet[175] = true;
			Main.projPet[111] = true;
			Main.projPet[112] = true;
			Main.projPet[127] = true;
			Main.projPet[191] = true;
			Main.projPet[192] = true;
			Main.projPet[193] = true;
			Main.projPet[194] = true;
			Main.projPet[197] = true;
			Main.projPet[198] = true;
			Main.projPet[199] = true;
			Main.projPet[200] = true;
			Main.projPet[208] = true;
			Main.projPet[209] = true;
			Main.projPet[210] = true;
			Main.projPet[211] = true;
			Main.projPet[236] = true;
			Main.projPet[268] = true;
			Main.projPet[269] = true;
			Main.projPet[353] = true;
			Main.projPet[373] = true;
			Main.projPet[375] = true;
			Main.projPet[377] = true;
			Main.projPet[380] = true;
			Main.projPet[387] = true;
			Main.projPet[388] = true;
			Main.projPet[390] = true;
			Main.projPet[391] = true;
			Main.projPet[392] = true;
			Main.projPet[393] = true;
			Main.projPet[394] = true;
			Main.projPet[395] = true;
			Main.projPet[398] = true;
			Main.projPet[407] = true;
			Main.tileLighted[237] = true;
			Main.debuff[20] = true;
			Main.debuff[21] = true;
			Main.debuff[22] = true;
			Main.debuff[23] = true;
			Main.debuff[24] = true;
			Main.debuff[25] = true;
			Main.debuff[28] = true;
			Main.debuff[30] = true;
			Main.debuff[31] = true;
			Main.debuff[32] = true;
			Main.debuff[33] = true;
			Main.debuff[34] = true;
			Main.debuff[35] = true;
			Main.debuff[36] = true;
			Main.debuff[37] = true;
			Main.debuff[38] = true;
			Main.debuff[39] = true;
			Main.debuff[44] = true;
			Main.debuff[46] = true;
			Main.debuff[47] = true;
			Main.debuff[67] = true;
			Main.debuff[68] = true;
			Main.debuff[69] = true;
			Main.debuff[70] = true;
			Main.debuff[80] = true;
			Main.debuff[86] = true;
			Main.debuff[87] = true;
			Main.debuff[88] = true;
			Main.debuff[89] = true;
			Main.debuff[94] = true;
			Main.debuff[103] = true;
			Main.debuff[119] = true;
			Main.debuff[120] = true;
			Main.debuff[137] = true;
			Main.pvpBuff[20] = true;
			Main.pvpBuff[24] = true;
			Main.pvpBuff[31] = true;
			Main.pvpBuff[39] = true;
			Main.pvpBuff[44] = true;
			Main.pvpBuff[20] = true;
			Main.pvpBuff[69] = true;
			Main.pvpBuff[103] = true;
			Main.pvpBuff[119] = true;
			Main.pvpBuff[120] = true;
			Main.pvpBuff[137] = true;
			Main.meleeBuff[71] = true;
			Main.meleeBuff[73] = true;
			Main.meleeBuff[74] = true;
			Main.meleeBuff[75] = true;
			Main.meleeBuff[76] = true;
			Main.meleeBuff[77] = true;
			Main.meleeBuff[78] = true;
			Main.meleeBuff[79] = true;
			Main.buffNoSave[20] = true;
			Main.buffNoSave[22] = true;
			Main.buffNoSave[23] = true;
			Main.buffNoSave[24] = true;
			Main.buffNoSave[28] = true;
			Main.buffNoSave[30] = true;
			Main.buffNoSave[31] = true;
			Main.buffNoSave[34] = true;
			Main.buffNoSave[35] = true;
			Main.buffNoSave[37] = true;
			Main.buffNoSave[38] = true;
			Main.buffNoSave[39] = true;
			Main.buffNoSave[43] = true;
			Main.buffNoSave[44] = true;
			Main.buffNoSave[46] = true;
			Main.buffNoSave[47] = true;
			Main.buffNoSave[48] = true;
			Main.buffNoSave[58] = true;
			Main.buffNoSave[59] = true;
			Main.buffNoSave[60] = true;
			Main.buffNoSave[62] = true;
			Main.buffNoSave[63] = true;
			Main.buffNoSave[64] = true;
			Main.buffNoSave[67] = true;
			Main.buffNoSave[68] = true;
			Main.buffNoSave[69] = true;
			Main.buffNoSave[70] = true;
			Main.buffNoSave[72] = true;
			Main.buffNoSave[80] = true;
			Main.buffNoSave[87] = true;
			Main.buffNoSave[88] = true;
			Main.buffNoSave[89] = true;
			Main.buffNoSave[94] = true;
			Main.buffNoSave[95] = true;
			Main.buffNoSave[96] = true;
			Main.buffNoSave[97] = true;
			Main.buffNoSave[98] = true;
			Main.buffNoSave[99] = true;
			Main.buffNoSave[100] = true;
			Main.buffNoSave[103] = true;
			Main.buffNoSave[118] = true;
			Main.buffNoSave[138] = true;
			Main.buffNoSave[119] = true;
			Main.buffNoSave[120] = true;
			Main.buffNoSave[90] = true;
			Main.buffNoSave[125] = true;
			Main.buffNoSave[126] = true;
			Main.buffNoSave[128] = true;
			Main.buffNoSave[129] = true;
			Main.buffNoSave[130] = true;
			Main.buffNoSave[131] = true;
			Main.buffNoSave[132] = true;
			Main.buffNoSave[133] = true;
			Main.buffNoSave[134] = true;
			Main.buffNoSave[135] = true;
			Main.buffNoSave[137] = true;
			Main.buffNoTimeDisplay[19] = true;
			Main.buffNoTimeDisplay[27] = true;
			Main.buffNoTimeDisplay[28] = true;
			Main.buffNoTimeDisplay[34] = true;
			Main.buffNoTimeDisplay[37] = true;
			Main.buffNoTimeDisplay[38] = true;
			Main.buffNoTimeDisplay[40] = true;
			Main.buffNoTimeDisplay[41] = true;
			Main.buffNoTimeDisplay[42] = true;
			Main.buffNoTimeDisplay[43] = true;
			Main.buffNoTimeDisplay[45] = true;
			Main.buffNoTimeDisplay[49] = true;
			Main.buffNoTimeDisplay[60] = true;
			Main.buffNoTimeDisplay[62] = true;
			Main.buffNoTimeDisplay[64] = true;
			Main.buffNoTimeDisplay[68] = true;
			Main.buffNoTimeDisplay[81] = true;
			Main.buffNoTimeDisplay[82] = true;
			Main.buffNoTimeDisplay[83] = true;
			Main.buffNoTimeDisplay[90] = true;
			Main.buffNoTimeDisplay[95] = true;
			Main.buffNoTimeDisplay[96] = true;
			Main.buffNoTimeDisplay[97] = true;
			Main.buffNoTimeDisplay[98] = true;
			Main.buffNoTimeDisplay[99] = true;
			Main.buffNoTimeDisplay[100] = true;
			Main.buffNoTimeDisplay[101] = true;
			Main.buffNoTimeDisplay[102] = true;
			Main.buffNoTimeDisplay[118] = true;
			Main.buffNoTimeDisplay[125] = true;
			Main.buffNoTimeDisplay[126] = true;
			Main.buffNoTimeDisplay[128] = true;
			Main.buffNoTimeDisplay[129] = true;
			Main.buffNoTimeDisplay[130] = true;
			Main.buffNoTimeDisplay[131] = true;
			Main.buffNoTimeDisplay[132] = true;
			Main.buffNoTimeDisplay[133] = true;
			Main.buffNoTimeDisplay[134] = true;
			Main.buffNoTimeDisplay[135] = true;
			Main.buffNoTimeDisplay[136] = true;
			Main.buffNoTimeDisplay[138] = true;
			Main.buffNoTimeDisplay[139] = true;
			Main.vanityPet[40] = true;
			Main.vanityPet[41] = true;
			Main.vanityPet[42] = true;
			Main.vanityPet[45] = true;
			Main.vanityPet[50] = true;
			Main.vanityPet[51] = true;
			Main.vanityPet[52] = true;
			Main.vanityPet[53] = true;
			Main.vanityPet[54] = true;
			Main.vanityPet[55] = true;
			Main.vanityPet[56] = true;
			Main.vanityPet[61] = true;
			Main.vanityPet[65] = true;
			Main.vanityPet[66] = true;
			Main.vanityPet[81] = true;
			Main.vanityPet[82] = true;
			Main.vanityPet[84] = true;
			Main.vanityPet[85] = true;
			Main.vanityPet[91] = true;
			Main.vanityPet[92] = true;
			Main.vanityPet[127] = true;
			Main.vanityPet[136] = true;
			Main.lightPet[19] = true;
			Main.lightPet[27] = true;
			Main.lightPet[101] = true;
			Main.lightPet[102] = true;
			Main.lightPet[57] = true;
			Main.tileFlame[4] = true;
			Main.tileFlame[33] = true;
			Main.tileFlame[34] = true;
			Main.tileFlame[35] = true;
			Main.tileFlame[42] = true;
			Main.tileFlame[49] = true;
			Main.tileFlame[93] = true;
			Main.tileFlame[98] = true;
			Main.tileFlame[100] = true;
			Main.tileFlame[173] = true;
			Main.tileFlame[174] = true;
			Main.tileRope[213] = true;
			Main.tileRope[214] = true;
			Main.tilePile[330] = true;
			Main.tilePile[331] = true;
			Main.tilePile[332] = true;
			Main.tilePile[333] = true;
			for (int j = 0; j < 378; j++)
			{
				Main.npcCatchable[j] = false;
			}
			Main.npcCatchable[46] = true;
			Main.npcCatchable[55] = true;
			Main.npcCatchable[74] = true;
			Main.npcCatchable[148] = true;
			Main.npcCatchable[149] = true;
			Main.npcCatchable[297] = true;
			Main.npcCatchable[298] = true;
			Main.npcCatchable[299] = true;
			Main.npcCatchable[300] = true;
			Main.npcCatchable[355] = true;
			Main.npcCatchable[356] = true;
			Main.npcCatchable[357] = true;
			Main.npcCatchable[358] = true;
			Main.npcCatchable[359] = true;
			Main.npcCatchable[360] = true;
			Main.npcCatchable[361] = true;
			Main.npcCatchable[362] = true;
			Main.npcCatchable[363] = true;
			Main.npcCatchable[364] = true;
			Main.npcCatchable[365] = true;
			Main.npcCatchable[366] = true;
			Main.npcCatchable[367] = true;
			Main.npcCatchable[374] = true;
			Main.npcCatchable[377] = true;
			Main.tileSolid[232] = true;
			Main.tileSolid[311] = true;
			Main.tileSolid[312] = true;
			Main.tileSolid[313] = true;
			Main.tileMergeDirt[311] = true;
			Main.tileSolid[315] = true;
			Main.tileMergeDirt[315] = true;
			Main.tileSolid[321] = true;
			Main.tileSolid[322] = true;
			Main.tileBlockLight[321] = true;
			Main.tileBlockLight[322] = true;
			Main.tileMergeDirt[321] = true;
			Main.tileMergeDirt[322] = true;
			Main.tileBrick[321] = true;
			Main.tileBrick[322] = true;
			Main.tileShine[239] = 1100;
			Main.tileSolid[239] = true;
			Main.tileSolidTop[239] = true;
			Main.tileFrameImportant[334] = true;
			Main.tileFrameImportant[300] = true;
			Main.tileFrameImportant[301] = true;
			Main.tileFrameImportant[302] = true;
			Main.tileFrameImportant[303] = true;
			Main.tileFrameImportant[304] = true;
			Main.tileFrameImportant[305] = true;
			Main.tileFrameImportant[306] = true;
			Main.tileFrameImportant[307] = true;
			Main.tileFrameImportant[308] = true;
			Main.tileFrameImportant[324] = true;
			Main.tileObsidianKill[324] = true;
			Main.tileLavaDeath[324] = true;
			Main.tileFrameImportant[283] = true;
			Main.tileFrameImportant[288] = true;
			Main.tileFrameImportant[289] = true;
			Main.tileFrameImportant[290] = true;
			Main.tileFrameImportant[291] = true;
			Main.tileFrameImportant[292] = true;
			Main.tileFrameImportant[293] = true;
			Main.tileFrameImportant[294] = true;
			Main.tileFrameImportant[295] = true;
			Main.tileFrameImportant[296] = true;
			Main.tileFrameImportant[297] = true;
			Main.tileFrameImportant[316] = true;
			Main.tileFrameImportant[317] = true;
			Main.tileFrameImportant[318] = true;
			Main.tileLargeFrames[284] = 1;
			Main.tileLargeFrames[325] = 1;
			Main.tileSolid[325] = true;
			Main.tileBlockLight[325] = true;
			Main.wallLargeFrames[146] = 1;
			Main.wallLargeFrames[147] = 1;
			Main.wallLargeFrames[167] = 1;
			Main.tileSolid[326] = true;
			Main.tileBlockLight[326] = true;
			Main.tileSolid[327] = true;
			Main.tileBlockLight[327] = true;
			Main.tileLighted[327] = true;
			Main.tileSolid[328] = true;
			Main.tileBrick[328] = true;
			Main.tileSolid[329] = true;
			Main.tileBrick[329] = true;
			Main.tileBlockLight[329] = true;
			Main.tileLighted[336] = true;
			Main.tileSolid[284] = true;
			Main.tileBlockLight[284] = true;
			Main.tileFrameImportant[36] = true;
			Main.tileFrameImportant[275] = true;
			Main.tileFrameImportant[276] = true;
			Main.tileFrameImportant[277] = true;
			Main.tileFrameImportant[278] = true;
			Main.tileFrameImportant[279] = true;
			Main.tileFrameImportant[280] = true;
			Main.tileFrameImportant[281] = true;
			Main.tileFrameImportant[282] = true;
			Main.tileFrameImportant[285] = true;
			Main.tileFrameImportant[286] = true;
			Main.tileFrameImportant[309] = true;
			Main.tileFrameImportant[310] = true;
			Main.tileFrameImportant[339] = true;
			Main.tileLighted[286] = true;
			Main.tileFrameImportant[298] = true;
			Main.tileFrameImportant[299] = true;
			Main.tileSolid[170] = true;
			Main.tileFrameImportant[171] = true;
			Main.tileLighted[171] = true;
			Main.tileFrameImportant[247] = true;
			Main.tileFrameImportant[245] = true;
			Main.tileFrameImportant[246] = true;
			Main.tileFrameImportant[239] = true;
			Main.tileFrameImportant[240] = true;
			Main.tileFrameImportant[241] = true;
			Main.tileFrameImportant[242] = true;
			Main.tileFrameImportant[243] = true;
			Main.tileFrameImportant[244] = true;
			Main.tileFrameImportant[254] = true;
			Main.tileSolid[221] = true;
			Main.tileBlockLight[221] = true;
			Main.tileMergeDirt[221] = true;
			Main.tileLighted[96] = true;
			Main.tileMergeDirt[250] = true;
			Main.tileSolid[272] = true;
			Main.tileBlockLight[272] = true;
			Main.tileSolid[229] = true;
			Main.tileBlockLight[229] = true;
			Main.tileMergeDirt[229] = true;
			Main.tileSolid[230] = true;
			Main.tileBlockLight[230] = true;
			Main.tileMergeDirt[230] = true;
			Main.tileSolid[222] = true;
			Main.tileBlockLight[222] = true;
			Main.tileMergeDirt[222] = true;
			Main.tileSolid[223] = true;
			Main.tileBlockLight[223] = true;
			Main.tileMergeDirt[223] = true;
			Main.tileSolid[224] = true;
			Main.tileBlockLight[224] = true;
			Main.tileFrameImportant[237] = true;
			Main.tileFrameImportant[238] = true;
			Main.tileSolid[225] = true;
			Main.tileBlockLight[225] = true;
			Main.tileBrick[225] = true;
			Main.tileSolid[226] = true;
			Main.tileBlockLight[226] = true;
			Main.tileBrick[226] = true;
			Main.tileSolid[235] = true;
			Main.tileBlockLight[235] = true;
			Main.tileFrameImportant[235] = true;
			Main.tileLighted[238] = true;
			Main.tileFrameImportant[236] = true;
			Main.tileCut[236] = true;
			Main.tileSolid[191] = true;
			Main.tileBrick[191] = true;
			Main.tileBlockLight[191] = true;
			Main.tileSolid[211] = true;
			Main.tileBlockLight[211] = true;
			Main.tileSolid[208] = true;
			Main.tileBrick[208] = true;
			Main.tileBlockLight[208] = true;
			Main.tileSolid[192] = true;
			Main.tileBrick[192] = true;
			Main.tileBlockLight[192] = true;
			Main.tileSolid[193] = true;
			Main.tileBrick[193] = true;
			Main.tileBlockLight[193] = true;
			Main.tileMergeDirt[193] = true;
			Main.tileSolid[194] = true;
			Main.tileBrick[194] = true;
			Main.tileBlockLight[194] = true;
			Main.tileSolid[195] = true;
			Main.tileBrick[195] = true;
			Main.tileMergeDirt[195] = true;
			Main.tileBlockLight[195] = true;
			Main.tileBlockLight[200] = true;
			Main.tileSolid[200] = true;
			Main.tileBrick[200] = true;
			Main.tileBlockLight[203] = true;
			Main.tileSolid[203] = true;
			Main.tileMergeDirt[203] = true;
			Main.tileBlockLight[204] = true;
			Main.tileSolid[204] = true;
			Main.tileMergeDirt[204] = true;
			Main.tileBlockLight[165] = true;
			Main.tileShine2[147] = true;
			Main.tileShine2[161] = true;
			Main.tileShine2[163] = true;
			Main.tileShine2[164] = true;
			Main.tileSolid[189] = true;
			Main.tileBlockLight[51] = true;
			Main.tileLighted[204] = true;
			Main.tileShine[204] = 1150;
			Main.tileShine2[204] = true;
			Main.tileSolid[190] = true;
			Main.tileBlockLight[190] = true;
			Main.tileBrick[190] = true;
			Main.tileSolid[198] = true;
			Main.tileMergeDirt[198] = true;
			Main.tileBrick[198] = true;
			Main.tileBlockLight[198] = true;
			Main.tileSolid[206] = true;
			Main.tileBlockLight[206] = true;
			Main.tileMergeDirt[206] = true;
			Main.tileBrick[206] = true;
			Main.tileBlockLight[234] = true;
			Main.tileSolid[248] = true;
			Main.tileSolid[249] = true;
			Main.tileSolid[250] = true;
			Main.tileBrick[248] = true;
			Main.tileBrick[249] = true;
			Main.tileBrick[250] = true;
			Main.tileSolid[251] = true;
			Main.tileSolid[252] = true;
			Main.tileBrick[252] = true;
			Main.tileSolid[253] = true;
			Main.tileBrick[253] = true;
			Main.tileMergeDirt[251] = true;
			Main.tileMergeDirt[252] = true;
			Main.tileMergeDirt[253] = true;
			Main.tileBlockLight[251] = true;
			Main.tileBlockLight[252] = true;
			Main.tileBlockLight[253] = true;
			Main.tileBlockLight[248] = true;
			Main.tileBlockLight[249] = true;
			Main.tileBlockLight[250] = true;
			Main.tileLargeFrames[273] = 1;
			Main.tileSolid[273] = true;
			Main.tileBlockLight[273] = true;
			Main.tileLargeFrames[274] = 1;
			Main.tileSolid[274] = true;
			Main.tileBlockLight[274] = true;
			for (int k = 255; k <= 268; k++)
			{
				Main.tileSolid[k] = true;
				if (k > 261)
				{
					Main.tileLighted[k] = true;
					Main.tileShine2[k] = true;
				}
			}
			Main.tileFrameImportant[269] = true;
			Main.tileFrameImportant[334] = true;
			Main.wallHouse[168] = true;
			Main.wallHouse[169] = true;
			Main.wallHouse[142] = true;
			Main.wallHouse[143] = true;
			Main.wallHouse[144] = true;
			Main.wallHouse[149] = true;
			Main.wallHouse[151] = true;
			Main.wallHouse[150] = true;
			Main.wallHouse[152] = true;
			for (int l = 153; l < 167; l++)
			{
				Main.wallHouse[l] = true;
			}
			Main.wallHouse[146] = true;
			Main.wallHouse[147] = true;
			Main.wallHouse[149] = true;
			Main.wallHouse[167] = true;
			Main.wallHouse[168] = true;
			Main.wallHouse[133] = true;
			Main.wallHouse[134] = true;
			Main.wallHouse[135] = true;
			Main.wallHouse[136] = true;
			Main.wallHouse[137] = true;
			Main.wallHouse[75] = true;
			Main.wallHouse[76] = true;
			Main.wallHouse[78] = true;
			Main.wallHouse[82] = true;
			Main.wallHouse[77] = true;
			Main.wallHouse[1] = true;
			Main.wallHouse[4] = true;
			Main.wallHouse[5] = true;
			Main.wallHouse[6] = true;
			Main.wallHouse[10] = true;
			Main.wallHouse[11] = true;
			Main.wallHouse[12] = true;
			Main.wallHouse[16] = true;
			Main.wallHouse[17] = true;
			Main.wallHouse[18] = true;
			Main.wallHouse[19] = true;
			Main.wallHouse[20] = true;
			Main.wallHouse[21] = true;
			Main.wallHouse[22] = true;
			Main.wallHouse[23] = true;
			Main.wallHouse[24] = true;
			Main.wallHouse[25] = true;
			Main.wallHouse[26] = true;
			Main.wallHouse[27] = true;
			Main.wallHouse[29] = true;
			Main.wallHouse[30] = true;
			Main.wallHouse[31] = true;
			Main.wallHouse[32] = true;
			Main.wallHouse[33] = true;
			Main.wallHouse[34] = true;
			Main.wallHouse[35] = true;
			Main.wallHouse[36] = true;
			Main.wallHouse[37] = true;
			Main.wallHouse[38] = true;
			Main.wallHouse[39] = true;
			Main.wallHouse[41] = true;
			Main.wallHouse[42] = true;
			Main.wallHouse[43] = true;
			Main.wallHouse[44] = true;
			Main.wallHouse[45] = true;
			Main.wallHouse[46] = true;
			Main.wallHouse[47] = true;
			Main.wallHouse[66] = true;
			Main.wallHouse[67] = true;
			Main.wallHouse[68] = true;
			Main.wallHouse[72] = true;
			Main.wallHouse[73] = true;
			Main.wallHouse[107] = true;
			Main.wallHouse[106] = true;
			Main.wallHouse[109] = true;
			Main.wallHouse[110] = true;
			Main.wallHouse[111] = true;
			Main.wallHouse[112] = true;
			Main.wallHouse[113] = true;
			Main.wallHouse[114] = true;
			Main.wallHouse[115] = true;
			Main.wallHouse[116] = true;
			Main.wallHouse[117] = true;
			Main.wallHouse[118] = true;
			Main.wallHouse[119] = true;
			Main.wallHouse[120] = true;
			Main.wallHouse[121] = true;
			Main.wallHouse[122] = true;
			Main.wallHouse[123] = true;
			Main.wallHouse[124] = true;
			Main.wallHouse[125] = true;
			Main.wallHouse[108] = true;
			Main.wallHouse[101] = true;
			Main.wallHouse[102] = true;
			Main.wallHouse[103] = true;
			Main.wallHouse[104] = true;
			Main.wallHouse[105] = true;
			Main.wallHouse[84] = true;
			Main.wallHouse[74] = true;
			Main.wallHouse[85] = true;
			Main.wallHouse[88] = true;
			Main.wallHouse[89] = true;
			Main.wallHouse[90] = true;
			Main.wallHouse[91] = true;
			Main.wallHouse[92] = true;
			Main.wallHouse[93] = true;
			Main.wallHouse[126] = true;
			Main.wallHouse[127] = true;
			Main.wallHouse[128] = true;
			Main.wallHouse[129] = true;
			Main.wallHouse[130] = true;
			Main.wallHouse[131] = true;
			Main.wallHouse[132] = true;
			Main.wallHouse[138] = true;
			Main.wallHouse[139] = true;
			Main.wallHouse[140] = true;
			Main.wallHouse[141] = true;
			Main.wallLight[0] = true;
			Main.wallLight[21] = true;
			Main.wallLight[106] = true;
			Main.wallLight[107] = true;
			Main.wallLight[138] = true;
			Main.wallLight[140] = true;
			Main.wallLight[141] = true;
			Main.wallLight[139] = true;
			Main.wallLight[145] = true;
			Main.wallLight[150] = true;
			Main.wallLight[152] = true;
			Main.wallLight[168] = true;
			for (int m = 0; m < 172; m++)
			{
				Main.wallDungeon[m] = false;
			}
			Main.wallDungeon[7] = true;
			Main.wallDungeon[8] = true;
			Main.wallDungeon[9] = true;
			Main.wallDungeon[94] = true;
			Main.wallDungeon[95] = true;
			Main.wallDungeon[96] = true;
			Main.wallDungeon[97] = true;
			Main.wallDungeon[98] = true;
			Main.wallDungeon[99] = true;
			for (int n = 0; n < 10; n++)
			{
				Main.recentWorld[n] = "";
				Main.recentIP[n] = "";
				Main.recentPort[n] = 0;
			}
			if (Main.rand == null)
			{
				Main.rand = new Random((int)DateTime.Now.Ticks);
			}
			if (WorldGen.genRand == null)
			{
				WorldGen.genRand = new Random((int)DateTime.Now.Ticks);
			}
			this.SetTitle();
			Main.lo = Main.rand.Next(6);
			Main.critterCage = true;
			for (int num = 0; num < 3600; num++)
			{
				Main.CritterCages();
			}
			Main.critterCage = false;
			Main.tileBrick[1] = true;
			Main.tileBrick[54] = true;
			Main.tileBrick[118] = true;
			Main.tileBrick[119] = true;
			Main.tileBrick[120] = true;
			Main.tileBrick[121] = true;
			Main.tileBrick[122] = true;
			Main.tileBrick[140] = true;
			Main.tileBrick[148] = true;
			Main.tileBrick[150] = true;
			Main.tileBrick[151] = true;
			Main.tileBrick[152] = true;
			Main.tileBrick[30] = true;
			Main.tileBrick[38] = true;
			Main.tileBrick[39] = true;
			Main.tileBrick[41] = true;
			Main.tileBrick[43] = true;
			Main.tileBrick[44] = true;
			Main.tileBrick[45] = true;
			Main.tileBrick[46] = true;
			Main.tileBrick[47] = true;
			Main.tileBrick[75] = true;
			Main.tileBrick[76] = true;
			Main.tileBrick[160] = true;
			Main.tileBrick[2] = true;
			Main.tileBrick[199] = true;
			Main.tileBrick[23] = true;
			Main.tileBrick[60] = true;
			Main.tileBrick[70] = true;
			Main.tileBrick[109] = true;
			Main.tileBrick[53] = true;
			Main.tileBrick[116] = true;
			Main.tileBrick[234] = true;
			Main.tileBrick[112] = true;
			Main.tileBrick[147] = true;
			Main.tileBrick[153] = true;
			Main.tileBrick[154] = true;
			Main.tileBrick[155] = true;
			Main.tileBrick[156] = true;
			Main.tileBrick[157] = true;
			Main.tileBrick[158] = true;
			Main.tileBrick[159] = true;
			Main.tileMergeDirt[202] = true;
			Main.tileBrick[202] = true;
			Main.tileSolid[202] = true;
			Main.tileBlockLight[202] = true;
			Main.tileBrick[161] = true;
			Main.tileBlockLight[161] = true;
			Main.tileBlockLight[163] = true;
			Main.tileBlockLight[164] = true;
			Main.tileSolid[188] = true;
			Main.tileBlockLight[188] = true;
			Main.tileBrick[188] = true;
			Main.tileMergeDirt[188] = true;
			Main.tileBrick[179] = true;
			Main.tileSolid[179] = true;
			Main.tileBlockLight[179] = true;
			Main.tileMoss[179] = true;
			Main.tileBrick[180] = true;
			Main.tileSolid[180] = true;
			Main.tileBlockLight[180] = true;
			Main.tileMoss[180] = true;
			Main.tileBrick[181] = true;
			Main.tileSolid[181] = true;
			Main.tileBlockLight[181] = true;
			Main.tileMoss[181] = true;
			Main.tileBrick[182] = true;
			Main.tileSolid[182] = true;
			Main.tileBlockLight[182] = true;
			Main.tileMoss[182] = true;
			Main.tileBrick[183] = true;
			Main.tileSolid[183] = true;
			Main.tileBlockLight[183] = true;
			Main.tileMoss[183] = true;
			Main.tileMergeDirt[177] = true;
			Main.tileMergeDirt[190] = true;
			Main.tileSolid[196] = true;
			Main.tileSolid[197] = true;
			Main.tileMergeDirt[197] = true;
			Main.tileBlockLight[197] = true;
			Main.tileNoSunLight[197] = true;
			Main.tileBrick[175] = true;
			Main.tileSolid[175] = true;
			Main.tileBlockLight[175] = true;
			Main.tileBrick[176] = true;
			Main.tileSolid[176] = true;
			Main.tileBlockLight[176] = true;
			Main.tileBrick[177] = true;
			Main.tileSolid[177] = true;
			Main.tileBlockLight[177] = true;
			Main.tileBrick[225] = true;
			Main.tileBrick[229] = true;
			Main.tileShine[221] = 925;
			Main.tileShine[222] = 875;
			Main.tileShine[223] = 825;
			Main.tileShine2[221] = true;
			Main.tileShine2[222] = true;
			Main.tileShine2[223] = true;
			Main.tileMergeDirt[175] = true;
			Main.tileMergeDirt[176] = true;
			Main.tileMergeDirt[177] = true;
			Main.tileMergeDirt[208] = true;
			Main.tileBrick[162] = true;
			Main.tileSolid[162] = true;
			Main.tileBrick[163] = true;
			Main.tileSolid[163] = true;
			Main.tileBrick[164] = true;
			Main.tileSolid[164] = true;
			Main.tileShine2[6] = true;
			Main.tileShine2[7] = true;
			Main.tileShine2[8] = true;
			Main.tileShine2[9] = true;
			Main.tileShine2[166] = true;
			Main.tileShine2[167] = true;
			Main.tileShine2[168] = true;
			Main.tileShine2[169] = true;
			Main.tileShine2[12] = true;
			Main.tileShine2[21] = true;
			Main.tileShine2[22] = true;
			Main.tileShine2[25] = true;
			Main.tileShine2[45] = true;
			Main.tileShine2[46] = true;
			Main.tileShine2[47] = true;
			Main.tileShine2[63] = true;
			Main.tileShine2[64] = true;
			Main.tileShine2[65] = true;
			Main.tileShine2[66] = true;
			Main.tileShine2[67] = true;
			Main.tileShine2[68] = true;
			Main.tileShine2[107] = true;
			Main.tileShine2[108] = true;
			Main.tileShine2[111] = true;
			Main.tileShine2[121] = true;
			Main.tileShine2[122] = true;
			Main.tileShine2[117] = true;
			Main.tileShine2[211] = true;
			Main.tileShine[129] = 300;
			Main.tileNoFail[129] = true;
			Main.tileNoFail[192] = true;
			Main.tileHammer[26] = true;
			Main.tileHammer[31] = true;
			Main.tileAxe[5] = true;
			Main.tileAxe[72] = true;
			Main.tileAxe[80] = true;
			Main.tileAxe[323] = true;
			Main.tileBrick[59] = true;
			Main.tileBrick[234] = true;
			Main.tileSolid[234] = true;
			Main.tileMergeDirt[234] = true;
			Main.tileSand[53] = true;
			Main.tileSand[112] = true;
			Main.tileSand[116] = true;
			Main.tileSand[234] = true;
			Main.tileFrameImportant[233] = true;
			Main.tileLighted[215] = true;
			Main.tileFrameImportant[227] = true;
			Main.tileFrameImportant[228] = true;
			Main.tileFrameImportant[231] = true;
			Main.tileCut[231] = true;
			Main.tileFrameImportant[216] = true;
			Main.tileFrameImportant[217] = true;
			Main.tileFrameImportant[218] = true;
			Main.tileFrameImportant[219] = true;
			Main.tileFrameImportant[220] = true;
			Main.tileFrameImportant[338] = true;
			Main.tileFrameImportant[165] = true;
			Main.tileFrameImportant[209] = true;
			Main.tileFrameImportant[215] = true;
			Main.tileFrameImportant[210] = true;
			Main.tileFrameImportant[212] = true;
			Main.tileFrameImportant[207] = true;
			Main.tileFrameImportant[178] = true;
			Main.tileFrameImportant[184] = true;
			Main.tileFrameImportant[185] = true;
			Main.tileFrameImportant[186] = true;
			Main.tileFrameImportant[187] = true;
			Main.tileFrameImportant[173] = true;
			Main.tileFrameImportant[174] = true;
			Main.tileLighted[173] = true;
			Main.tileLighted[174] = true;
			Main.tileFrameImportant[139] = true;
			Main.tileLighted[160] = true;
			Main.tileLighted[149] = true;
			Main.tileFrameImportant[149] = true;
			Main.tileFrameImportant[142] = true;
			Main.tileFrameImportant[143] = true;
			Main.tileFrameImportant[144] = true;
			Main.tileStone[131] = true;
			Main.tileFrameImportant[136] = true;
			Main.tileFrameImportant[137] = true;
			Main.tileFrameImportant[138] = true;
			Main.tileBlockLight[137] = true;
			Main.tileSolid[137] = true;
			Main.tileBlockLight[160] = true;
			Main.tileSolid[160] = true;
			Main.tileMergeDirt[160] = true;
			Main.tileBlockLight[161] = true;
			Main.tileSolid[161] = true;
			Main.tileBlockLight[145] = true;
			Main.tileSolid[145] = true;
			Main.tileMergeDirt[145] = true;
			Main.tileBlockLight[146] = true;
			Main.tileSolid[146] = true;
			Main.tileMergeDirt[146] = true;
			Main.tileBlockLight[147] = true;
			Main.tileSolid[147] = true;
			Main.tileBlockLight[148] = true;
			Main.tileSolid[148] = true;
			Main.tileMergeDirt[148] = true;
			Main.tileBlockLight[138] = true;
			Main.tileSolid[138] = true;
			Main.tileBlockLight[140] = true;
			Main.tileSolid[140] = true;
			Main.tileBlockLight[151] = true;
			Main.tileSolid[151] = true;
			Main.tileMergeDirt[151] = true;
			Main.tileBlockLight[152] = true;
			Main.tileSolid[152] = true;
			Main.tileMergeDirt[152] = true;
			Main.tileBlockLight[153] = true;
			Main.tileSolid[153] = true;
			Main.tileMergeDirt[153] = true;
			Main.tileBlockLight[154] = true;
			Main.tileSolid[154] = true;
			Main.tileMergeDirt[154] = true;
			Main.tileBlockLight[155] = true;
			Main.tileSolid[155] = true;
			Main.tileMergeDirt[155] = true;
			Main.tileBlockLight[156] = true;
			Main.tileSolid[156] = true;
			Main.tileMergeDirt[156] = true;
			Main.tileMergeDirt[150] = true;
			Main.tileBlockLight[157] = true;
			Main.tileSolid[157] = true;
			Main.tileMergeDirt[157] = true;
			Main.tileBlockLight[158] = true;
			Main.tileSolid[158] = true;
			Main.tileMergeDirt[158] = true;
			Main.tileBlockLight[159] = true;
			Main.tileSolid[159] = true;
			Main.tileMergeDirt[159] = true;
			Main.tileFrameImportant[320] = true;
			Main.tileShine[22] = 1150;
			Main.tileShine[6] = 1150;
			Main.tileShine[7] = 1100;
			Main.tileShine[8] = 1000;
			Main.tileShine[9] = 1050;
			Main.tileShine[166] = 1125;
			Main.tileShine[167] = 1075;
			Main.tileShine[168] = 1025;
			Main.tileShine[169] = 975;
			Main.tileShine[178] = 500;
			Main.tileShine2[178] = true;
			Main.tileShine[12] = 300;
			Main.tileShine[21] = 1200;
			Main.tileShine[63] = 900;
			Main.tileShine[64] = 900;
			Main.tileShine[65] = 900;
			Main.tileShine[66] = 900;
			Main.tileShine[67] = 900;
			Main.tileShine[68] = 900;
			Main.tileShine[45] = 1900;
			Main.tileShine[46] = 2000;
			Main.tileShine[47] = 2100;
			Main.tileShine[122] = 1800;
			Main.tileShine[121] = 1850;
			Main.tileShine[125] = 600;
			Main.tileShine[109] = 9000;
			Main.tileShine[110] = 9000;
			Main.tileShine[116] = 9000;
			Main.tileShine[117] = 9000;
			Main.tileShine[118] = 8000;
			Main.tileShine[107] = 950;
			Main.tileShine[108] = 900;
			Main.tileShine[111] = 850;
			Main.tileShine[211] = 800;
			Main.tileLighted[4] = true;
			Main.tileLighted[17] = true;
			Main.tileLighted[133] = true;
			Main.tileLighted[31] = true;
			Main.tileLighted[33] = true;
			Main.tileLighted[34] = true;
			Main.tileLighted[35] = true;
			Main.tileLighted[37] = true;
			Main.tileLighted[42] = true;
			Main.tileLighted[49] = true;
			Main.tileLighted[58] = true;
			Main.tileLighted[61] = true;
			Main.tileLighted[70] = true;
			Main.tileLighted[71] = true;
			Main.tileLighted[72] = true;
			Main.tileLighted[76] = true;
			Main.tileLighted[77] = true;
			Main.tileLighted[19] = true;
			Main.tileLighted[22] = true;
			Main.tileLighted[26] = true;
			Main.tileLighted[83] = true;
			Main.tileLighted[84] = true;
			Main.tileLighted[92] = true;
			Main.tileLighted[93] = true;
			Main.tileLighted[95] = true;
			Main.tileLighted[98] = true;
			Main.tileLighted[100] = true;
			Main.tileLighted[109] = true;
			Main.tileLighted[125] = true;
			Main.tileLighted[126] = true;
			Main.tileLighted[129] = true;
			Main.tileLighted[140] = true;
			Main.tileLighted[270] = true;
			Main.tileLighted[271] = true;
			Main.tileMergeDirt[1] = true;
			Main.tileMergeDirt[6] = true;
			Main.tileMergeDirt[7] = true;
			Main.tileMergeDirt[8] = true;
			Main.tileMergeDirt[9] = true;
			Main.tileMergeDirt[166] = true;
			Main.tileMergeDirt[167] = true;
			Main.tileMergeDirt[168] = true;
			Main.tileMergeDirt[169] = true;
			Main.tileMergeDirt[22] = true;
			Main.tileMergeDirt[25] = true;
			Main.tileMergeDirt[30] = true;
			Main.tileMergeDirt[37] = true;
			Main.tileMergeDirt[38] = true;
			Main.tileMergeDirt[40] = true;
			Main.tileMergeDirt[53] = true;
			Main.tileMergeDirt[56] = true;
			Main.tileMergeDirt[107] = true;
			Main.tileMergeDirt[108] = true;
			Main.tileMergeDirt[111] = true;
			Main.tileMergeDirt[112] = true;
			Main.tileMergeDirt[116] = true;
			Main.tileMergeDirt[117] = true;
			Main.tileMergeDirt[123] = true;
			Main.tileMergeDirt[140] = true;
			Main.tileMergeDirt[39] = true;
			Main.tileMergeDirt[122] = true;
			Main.tileMergeDirt[121] = true;
			Main.tileMergeDirt[120] = true;
			Main.tileMergeDirt[119] = true;
			Main.tileMergeDirt[118] = true;
			Main.tileMergeDirt[47] = true;
			Main.tileMergeDirt[46] = true;
			Main.tileMergeDirt[45] = true;
			Main.tileMergeDirt[44] = true;
			Main.tileMergeDirt[43] = true;
			Main.tileMergeDirt[41] = true;
			Main.tileFrameImportant[201] = true;
			Main.tileFrameImportant[3] = true;
			Main.tileFrameImportant[4] = true;
			Main.tileFrameImportant[5] = true;
			Main.tileFrameImportant[10] = true;
			Main.tileFrameImportant[11] = true;
			Main.tileFrameImportant[12] = true;
			Main.tileFrameImportant[13] = true;
			Main.tileFrameImportant[14] = true;
			Main.tileFrameImportant[15] = true;
			Main.tileFrameImportant[16] = true;
			Main.tileFrameImportant[17] = true;
			Main.tileFrameImportant[18] = true;
			Main.tileFrameImportant[19] = true;
			Main.tileFrameImportant[20] = true;
			Main.tileFrameImportant[21] = true;
			Main.tileFrameImportant[24] = true;
			Main.tileFrameImportant[26] = true;
			Main.tileFrameImportant[27] = true;
			Main.tileFrameImportant[28] = true;
			Main.tileFrameImportant[29] = true;
			Main.tileFrameImportant[31] = true;
			Main.tileFrameImportant[33] = true;
			Main.tileFrameImportant[34] = true;
			Main.tileFrameImportant[35] = true;
			Main.tileFrameImportant[42] = true;
			Main.tileFrameImportant[50] = true;
			Main.tileFrameImportant[55] = true;
			Main.tileFrameImportant[61] = true;
			Main.tileFrameImportant[71] = true;
			Main.tileFrameImportant[72] = true;
			Main.tileFrameImportant[73] = true;
			Main.tileFrameImportant[74] = true;
			Main.tileFrameImportant[77] = true;
			Main.tileFrameImportant[78] = true;
			Main.tileFrameImportant[79] = true;
			Main.tileFrameImportant[81] = true;
			Main.tileFrameImportant[82] = true;
			Main.tileFrameImportant[83] = true;
			Main.tileFrameImportant[84] = true;
			Main.tileFrameImportant[85] = true;
			Main.tileFrameImportant[86] = true;
			Main.tileFrameImportant[87] = true;
			Main.tileFrameImportant[88] = true;
			Main.tileFrameImportant[89] = true;
			Main.tileFrameImportant[90] = true;
			Main.tileFrameImportant[91] = true;
			Main.tileFrameImportant[92] = true;
			Main.tileFrameImportant[93] = true;
			Main.tileFrameImportant[94] = true;
			Main.tileFrameImportant[95] = true;
			Main.tileFrameImportant[96] = true;
			Main.tileFrameImportant[97] = true;
			Main.tileFrameImportant[98] = true;
			Main.tileFrameImportant[99] = true;
			Main.tileFrameImportant[101] = true;
			Main.tileFrameImportant[102] = true;
			Main.tileFrameImportant[103] = true;
			Main.tileFrameImportant[104] = true;
			Main.tileFrameImportant[105] = true;
			Main.tileFrameImportant[100] = true;
			Main.tileFrameImportant[106] = true;
			Main.tileFrameImportant[110] = true;
			Main.tileFrameImportant[113] = true;
			Main.tileFrameImportant[114] = true;
			Main.tileFrameImportant[125] = true;
			Main.tileFrameImportant[287] = true;
			Main.tileFrameImportant[126] = true;
			Main.tileFrameImportant[128] = true;
			Main.tileFrameImportant[129] = true;
			Main.tileFrameImportant[132] = true;
			Main.tileFrameImportant[133] = true;
			Main.tileFrameImportant[134] = true;
			Main.tileFrameImportant[135] = true;
			Main.tileFrameImportant[319] = true;
			Main.tileFrameImportant[323] = true;
			Main.tileFrameImportant[335] = true;
			Main.tileFrameImportant[337] = true;
			Main.tileFrameImportant[141] = true;
			Main.tileFrameImportant[270] = true;
			Main.tileFrameImportant[271] = true;
			Main.tileFrameImportant[314] = true;
			Main.tileCut[201] = true;
			Main.tileCut[3] = true;
			Main.tileCut[24] = true;
			Main.tileCut[28] = true;
			Main.tileCut[32] = true;
			Main.tileCut[51] = true;
			Main.tileCut[52] = true;
			Main.tileCut[61] = true;
			Main.tileCut[62] = true;
			Main.tileCut[69] = true;
			Main.tileCut[71] = true;
			Main.tileCut[73] = true;
			Main.tileCut[74] = true;
			Main.tileCut[82] = true;
			Main.tileCut[83] = true;
			Main.tileCut[84] = true;
			Main.tileCut[110] = true;
			Main.tileCut[113] = true;
			Main.tileCut[115] = true;
			Main.tileCut[184] = true;
			Main.tileCut[205] = true;
			Main.tileAlch[82] = true;
			Main.tileAlch[83] = true;
			Main.tileAlch[84] = true;
			Main.tileSolid[127] = true;
			Main.tileSolid[130] = true;
			Main.tileBlockLight[130] = true;
			Main.tileBlockLight[131] = true;
			Main.tileNoAttach[232] = true;
			Main.tileSolid[107] = true;
			Main.tileBlockLight[107] = true;
			Main.tileSolid[108] = true;
			Main.tileBlockLight[108] = true;
			Main.tileSolid[111] = true;
			Main.tileBlockLight[111] = true;
			Main.tileSolid[109] = true;
			Main.tileBlockLight[109] = true;
			Main.tileSolid[110] = false;
			Main.tileNoAttach[110] = true;
			Main.tileNoFail[110] = true;
			Main.tileSolid[112] = true;
			Main.tileBlockLight[112] = true;
			Main.tileSolid[116] = true;
			Main.tileBlockLight[116] = true;
			Main.tileSolid[117] = true;
			Main.tileBlockLight[117] = true;
			Main.tileSolid[123] = true;
			Main.tileBlockLight[123] = true;
			Main.tileNoFail[165] = true;
			Main.tileNoFail[184] = true;
			Main.tileNoFail[185] = true;
			Main.tileNoFail[186] = true;
			Main.tileNoFail[187] = true;
			Main.tileSolid[118] = true;
			Main.tileBlockLight[118] = true;
			Main.tileSolid[119] = true;
			Main.tileBlockLight[119] = true;
			Main.tileSolid[120] = true;
			Main.tileBlockLight[120] = true;
			Main.tileSolid[121] = true;
			Main.tileBlockLight[121] = true;
			Main.tileSolid[122] = true;
			Main.tileBlockLight[122] = true;
			Main.tileSolid[150] = true;
			Main.tileBlockLight[150] = true;
			Main.tileBlockLight[115] = true;
			Main.tileSolid[199] = true;
			Main.tileBlockLight[199] = true;
			Main.tileSolid[0] = true;
			Main.tileBlockLight[0] = true;
			Main.tileSolid[1] = true;
			Main.tileBlockLight[1] = true;
			Main.tileSolid[2] = true;
			Main.tileBlockLight[2] = true;
			Main.tileSolid[3] = false;
			Main.tileNoAttach[3] = true;
			Main.tileNoFail[3] = true;
			Main.tileNoFail[201] = true;
			Main.tileSolid[4] = false;
			Main.tileNoAttach[4] = true;
			Main.tileNoFail[4] = true;
			Main.tileNoFail[24] = true;
			Main.tileSolid[5] = false;
			Main.tileSolid[6] = true;
			Main.tileBlockLight[6] = true;
			Main.tileSolid[7] = true;
			Main.tileBlockLight[7] = true;
			Main.tileSolid[8] = true;
			Main.tileBlockLight[8] = true;
			Main.tileSolid[9] = true;
			Main.tileBlockLight[9] = true;
			Main.tileSolid[166] = true;
			Main.tileBlockLight[166] = true;
			Main.tileSolid[167] = true;
			Main.tileBlockLight[167] = true;
			Main.tileSolid[168] = true;
			Main.tileBlockLight[168] = true;
			Main.tileSolid[169] = true;
			Main.tileBlockLight[169] = true;
			Main.tileBlockLight[10] = true;
			Main.tileSolid[10] = true;
			Main.tileNoAttach[10] = true;
			Main.tileBlockLight[10] = true;
			Main.tileSolid[11] = false;
			Main.tileSolidTop[19] = true;
			Main.tileSolid[19] = true;
			Main.tileSolid[22] = true;
			Main.tileSolid[23] = true;
			Main.tileSolid[25] = true;
			Main.tileSolid[30] = true;
			Main.tileNoFail[32] = true;
			Main.tileBlockLight[32] = true;
			Main.tileSolid[37] = true;
			Main.tileBlockLight[37] = true;
			Main.tileSolid[38] = true;
			Main.tileBlockLight[38] = true;
			Main.tileSolid[39] = true;
			Main.tileBlockLight[39] = true;
			Main.tileSolid[40] = true;
			Main.tileBlockLight[40] = true;
			Main.tileSolid[41] = true;
			Main.tileBlockLight[41] = true;
			Main.tileSolid[43] = true;
			Main.tileBlockLight[43] = true;
			Main.tileSolid[44] = true;
			Main.tileBlockLight[44] = true;
			Main.tileSolid[45] = true;
			Main.tileBlockLight[45] = true;
			Main.tileSolid[46] = true;
			Main.tileBlockLight[46] = true;
			Main.tileSolid[47] = true;
			Main.tileBlockLight[47] = true;
			Main.tileSolid[48] = true;
			Main.tileBlockLight[48] = true;
			Main.tileSolid[53] = true;
			Main.tileBlockLight[53] = true;
			Main.tileSolid[54] = true;
			Main.tileBlockLight[52] = true;
			Main.tileBlockLight[205] = true;
			Main.tileSolid[56] = true;
			Main.tileBlockLight[56] = true;
			Main.tileSolid[57] = true;
			Main.tileBlockLight[57] = true;
			Main.tileSolid[58] = true;
			Main.tileBlockLight[58] = true;
			Main.tileSolid[59] = true;
			Main.tileBlockLight[59] = true;
			Main.tileSolid[60] = true;
			Main.tileBlockLight[60] = true;
			Main.tileSolid[63] = true;
			Main.tileBlockLight[63] = true;
			Main.tileStone[63] = true;
			Main.tileStone[130] = true;
			Main.tileSolid[64] = true;
			Main.tileBlockLight[64] = true;
			Main.tileStone[64] = true;
			Main.tileSolid[65] = true;
			Main.tileBlockLight[65] = true;
			Main.tileStone[65] = true;
			Main.tileSolid[66] = true;
			Main.tileBlockLight[66] = true;
			Main.tileStone[66] = true;
			Main.tileSolid[67] = true;
			Main.tileBlockLight[67] = true;
			Main.tileStone[67] = true;
			Main.tileSolid[68] = true;
			Main.tileBlockLight[68] = true;
			Main.tileStone[68] = true;
			Main.tileSolid[75] = true;
			Main.tileBlockLight[75] = true;
			Main.tileSolid[76] = true;
			Main.tileBlockLight[76] = true;
			Main.tileSolid[70] = true;
			Main.tileBlockLight[70] = true;
			Main.tileNoFail[50] = true;
			Main.tileNoAttach[50] = true;
			Main.tileDungeon[41] = true;
			Main.tileDungeon[43] = true;
			Main.tileDungeon[44] = true;
			Main.tileBlockLight[30] = true;
			Main.tileBlockLight[25] = true;
			Main.tileBlockLight[23] = true;
			Main.tileBlockLight[22] = true;
			Main.tileBlockLight[62] = true;
			Main.tileSolidTop[18] = true;
			Main.tileSolidTop[14] = true;
			Main.tileSolidTop[16] = true;
			Main.tileSolidTop[134] = true;
			Main.tileSolidTop[114] = true;
			Main.tileNoAttach[20] = true;
			Main.tileNoAttach[19] = true;
			Main.tileNoAttach[13] = true;
			Main.tileNoAttach[14] = true;
			Main.tileNoAttach[15] = true;
			Main.tileNoAttach[16] = true;
			Main.tileNoAttach[134] = true;
			Main.tileNoAttach[17] = true;
			Main.tileNoAttach[18] = true;
			Main.tileNoAttach[19] = true;
			Main.tileNoAttach[21] = true;
			Main.tileNoAttach[27] = true;
			Main.tileNoAttach[114] = true;
			Main.tileTable[14] = true;
			Main.tileTable[18] = true;
			Main.tileTable[19] = true;
			Main.tileTable[114] = true;
			Main.tileNoAttach[86] = true;
			Main.tileNoAttach[87] = true;
			Main.tileNoAttach[88] = true;
			Main.tileNoAttach[89] = true;
			Main.tileNoAttach[90] = true;
			Main.tileTable[101] = true;
			Main.tileNoAttach[101] = true;
			Main.tileNoAttach[102] = true;
			Main.tileNoAttach[94] = true;
			Main.tileNoAttach[95] = true;
			Main.tileNoAttach[96] = true;
			Main.tileNoAttach[97] = true;
			Main.tileNoAttach[98] = true;
			Main.tileNoAttach[99] = true;
			Main.tileTable[87] = true;
			Main.tileTable[88] = true;
			Main.tileSolidTop[87] = true;
			Main.tileSolidTop[88] = true;
			Main.tileSolidTop[101] = true;
			Main.tileNoAttach[91] = true;
			Main.tileNoAttach[92] = true;
			Main.tileNoAttach[93] = true;
			Main.tileLighted[190] = true;
			Main.tileBlockLight[192] = true;
			Main.tileBrick[192] = false;
			Main.tileWaterDeath[215] = true;
			Main.tileWaterDeath[4] = true;
			Main.tileWaterDeath[51] = true;
			Main.tileWaterDeath[93] = true;
			Main.tileWaterDeath[98] = true;
			Main.tileLavaDeath[3] = true;
			Main.tileLavaDeath[5] = true;
			Main.tileLavaDeath[10] = true;
			Main.tileLavaDeath[11] = true;
			Main.tileLavaDeath[12] = true;
			Main.tileLavaDeath[13] = true;
			Main.tileLavaDeath[14] = true;
			Main.tileLavaDeath[15] = true;
			Main.tileLavaDeath[16] = true;
			Main.tileLavaDeath[17] = true;
			Main.tileLavaDeath[18] = true;
			Main.tileLavaDeath[19] = true;
			Main.tileLavaDeath[20] = true;
			Main.tileLavaDeath[24] = true;
			Main.tileLavaDeath[27] = true;
			Main.tileLavaDeath[28] = true;
			Main.tileLavaDeath[29] = true;
			Main.tileLavaDeath[32] = true;
			Main.tileLavaDeath[33] = true;
			Main.tileLavaDeath[34] = true;
			Main.tileLavaDeath[35] = true;
			Main.tileLavaDeath[36] = true;
			Main.tileLavaDeath[42] = true;
			Main.tileLavaDeath[49] = true;
			Main.tileLavaDeath[50] = true;
			Main.tileLavaDeath[51] = true;
			Main.tileLavaDeath[52] = true;
			Main.tileLavaDeath[55] = true;
			Main.tileLavaDeath[61] = true;
			Main.tileLavaDeath[62] = true;
			Main.tileLavaDeath[69] = true;
			Main.tileLavaDeath[71] = true;
			Main.tileLavaDeath[72] = true;
			Main.tileLavaDeath[73] = true;
			Main.tileLavaDeath[74] = true;
			Main.tileLavaDeath[79] = true;
			Main.tileLavaDeath[80] = true;
			Main.tileLavaDeath[81] = true;
			Main.tileLavaDeath[86] = true;
			Main.tileLavaDeath[87] = true;
			Main.tileLavaDeath[88] = true;
			Main.tileLavaDeath[89] = true;
			Main.tileLavaDeath[90] = true;
			Main.tileLavaDeath[91] = true;
			Main.tileLavaDeath[92] = true;
			Main.tileLavaDeath[93] = true;
			Main.tileLavaDeath[94] = true;
			Main.tileLavaDeath[95] = true;
			Main.tileLavaDeath[96] = true;
			Main.tileLavaDeath[97] = true;
			Main.tileLavaDeath[98] = true;
			Main.tileLavaDeath[100] = true;
			Main.tileLavaDeath[101] = true;
			Main.tileLavaDeath[102] = true;
			Main.tileLavaDeath[103] = true;
			Main.tileLavaDeath[104] = true;
			Main.tileLavaDeath[106] = true;
			Main.tileLavaDeath[110] = true;
			Main.tileLavaDeath[113] = true;
			Main.tileLavaDeath[115] = true;
			Main.tileLavaDeath[125] = true;
			Main.tileLavaDeath[126] = true;
			Main.tileLavaDeath[128] = true;
			Main.tileLavaDeath[149] = true;
			Main.tileLavaDeath[173] = true;
			Main.tileLavaDeath[174] = true;
			Main.tileLavaDeath[184] = true;
			Main.tileLavaDeath[201] = true;
			Main.tileLavaDeath[205] = true;
			Main.tileLavaDeath[201] = true;
			Main.tileLavaDeath[209] = true;
			Main.tileLavaDeath[210] = true;
			Main.tileLavaDeath[212] = true;
			Main.tileLavaDeath[213] = true;
			Main.tileLavaDeath[214] = true;
			Main.tileLavaDeath[215] = true;
			Main.tileLavaDeath[216] = true;
			Main.tileLavaDeath[217] = true;
			Main.tileLavaDeath[218] = true;
			Main.tileLavaDeath[219] = true;
			Main.tileLavaDeath[220] = true;
			Main.tileLavaDeath[227] = true;
			Main.tileLavaDeath[228] = true;
			Main.tileLavaDeath[233] = true;
			Main.tileLavaDeath[236] = true;
			Main.tileLavaDeath[238] = true;
			Main.tileLavaDeath[240] = true;
			Main.tileLavaDeath[241] = true;
			Main.tileLavaDeath[242] = true;
			Main.tileLavaDeath[243] = true;
			Main.tileLavaDeath[244] = true;
			Main.tileLavaDeath[245] = true;
			Main.tileLavaDeath[246] = true;
			Main.tileLavaDeath[247] = true;
			Main.tileLavaDeath[254] = true;
			Main.tileLavaDeath[269] = true;
			Main.tileLavaDeath[270] = true;
			Main.tileLavaDeath[271] = true;
			Main.tileLavaDeath[275] = true;
			Main.tileLavaDeath[276] = true;
			Main.tileLavaDeath[277] = true;
			Main.tileLavaDeath[278] = true;
			Main.tileLavaDeath[279] = true;
			Main.tileLavaDeath[280] = true;
			Main.tileLavaDeath[281] = true;
			Main.tileLavaDeath[282] = true;
			Main.tileLavaDeath[283] = true;
			Main.tileLavaDeath[285] = true;
			Main.tileLavaDeath[286] = true;
			Main.tileLavaDeath[287] = true;
			Main.tileLavaDeath[288] = true;
			Main.tileLavaDeath[289] = true;
			Main.tileLavaDeath[290] = true;
			Main.tileLavaDeath[291] = true;
			Main.tileLavaDeath[292] = true;
			Main.tileLavaDeath[293] = true;
			Main.tileLavaDeath[294] = true;
			Main.tileLavaDeath[295] = true;
			Main.tileLavaDeath[296] = true;
			Main.tileLavaDeath[297] = true;
			Main.tileLavaDeath[298] = true;
			Main.tileLavaDeath[299] = true;
			Main.tileLavaDeath[300] = true;
			Main.tileLavaDeath[301] = true;
			Main.tileLavaDeath[302] = true;
			Main.tileLavaDeath[303] = true;
			Main.tileLavaDeath[304] = true;
			Main.tileLavaDeath[305] = true;
			Main.tileLavaDeath[306] = true;
			Main.tileLavaDeath[307] = true;
			Main.tileLavaDeath[308] = true;
			Main.tileLavaDeath[309] = true;
			Main.tileLavaDeath[310] = true;
			Main.tileLavaDeath[316] = true;
			Main.tileLavaDeath[317] = true;
			Main.tileLavaDeath[318] = true;
			Main.tileLavaDeath[319] = true;
			Main.tileLavaDeath[323] = true;
			Main.tileLavaDeath[335] = true;
			Main.tileLavaDeath[338] = true;
			Main.tileLavaDeath[339] = true;
			Main.tileLighted[316] = true;
			Main.tileLighted[317] = true;
			Main.tileLighted[318] = true;
			for (int num2 = 0; num2 < 340; num2++)
			{
				if (Main.tileLavaDeath[num2])
				{
					Main.tileObsidianKill[num2] = true;
				}
			}
			Main.tileObsidianKill[77] = true;
			Main.tileObsidianKill[78] = true;
			Main.tileObsidianKill[82] = true;
			Main.tileObsidianKill[83] = true;
			Main.tileObsidianKill[84] = true;
			Main.tileObsidianKill[85] = true;
			Main.tileObsidianKill[105] = true;
			Main.tileObsidianKill[129] = true;
			Main.tileObsidianKill[132] = true;
			Main.tileObsidianKill[133] = true;
			Main.tileObsidianKill[134] = true;
			Main.tileObsidianKill[135] = true;
			Main.tileObsidianKill[136] = true;
			Main.tileObsidianKill[139] = true;
			Main.tileObsidianKill[165] = true;
			Main.tileObsidianKill[178] = true;
			Main.tileObsidianKill[185] = true;
			Main.tileObsidianKill[186] = true;
			Main.tileObsidianKill[187] = true;
			Main.tileObsidianKill[231] = true;
			Main.tileObsidianKill[337] = true;
			for (int num3 = 0; num3 < 172; num3++)
			{
				if (num3 == 20)
				{
					Main.wallBlend[num3] = 14;
				}
				else
				{
					if (num3 == 19)
					{
						Main.wallBlend[num3] = 9;
					}
					else
					{
						if (num3 == 18)
						{
							Main.wallBlend[num3] = 8;
						}
						else
						{
							if (num3 == 17)
							{
								Main.wallBlend[num3] = 7;
							}
							else
							{
								if (num3 == 16 || num3 == 59)
								{
									Main.wallBlend[num3] = 2;
								}
								else
								{
									if (num3 == 1 || (num3 >= 48 && num3 <= 53))
									{
										Main.wallBlend[num3] = 1;
									}
									else
									{
										Main.wallBlend[num3] = num3;
									}
								}
							}
						}
					}
				}
			}
			Main.wallBlend[65] = 63;
			Main.wallBlend[66] = 63;
			Main.wallBlend[68] = 63;
			Main.wallBlend[67] = 64;
			Main.wallBlend[80] = 74;
			Main.wallBlend[81] = 77;
			Main.wallBlend[94] = 7;
			Main.wallBlend[95] = 7;
			Main.wallBlend[100] = 7;
			Main.wallBlend[101] = 7;
			Main.wallBlend[96] = 8;
			Main.wallBlend[97] = 8;
			Main.wallBlend[102] = 8;
			Main.wallBlend[103] = 8;
			Main.wallBlend[98] = 9;
			Main.wallBlend[99] = 9;
			Main.wallBlend[104] = 9;
			Main.wallBlend[105] = 9;
			Main.tileNoFail[24] = true;
			Main.tileNoFail[3] = true;
			Main.tileNoFail[52] = true;
			Main.tileNoFail[62] = true;
			Main.tileNoFail[32] = true;
			Main.tileNoFail[61] = true;
			Main.tileNoFail[69] = true;
			Main.tileNoFail[73] = true;
			Main.tileNoFail[74] = true;
			Main.tileNoFail[82] = true;
			Main.tileNoFail[83] = true;
			Main.tileNoFail[84] = true;
			Main.tileNoFail[110] = true;
			Main.tileNoFail[113] = true;
			Main.tileNoFail[115] = true;
			Main.tileNoFail[165] = true;
			Main.tileNoFail[184] = true;
			Main.tileNoFail[201] = true;
			Main.tileNoFail[205] = true;
			Main.tileNoFail[227] = true;
			Main.tileNoFail[233] = true;
			for (int num4 = 0; num4 < 340; num4++)
			{
				if (Main.tileSolid[num4])
				{
					Main.tileNoSunLight[num4] = true;
				}
				Main.tileFrame[num4] = 0;
				Main.tileFrameCounter[num4] = 0;
			}
			Main.tileNoSunLight[54] = false;
			Main.tileNoSunLight[328] = false;
			Main.tileNoSunLight[19] = false;
			Main.tileNoSunLight[11] = true;
			Main.tileNoSunLight[189] = false;
			Main.tileNoSunLight[196] = false;
			for (int num5 = 0; num5 < Main.maxMenuItems; num5++)
			{
				this.menuItemScale[num5] = 0.8f;
			}
			for (int num6 = 0; num6 < 6001; num6++)
			{
				Main.dust[num6] = new Dust();
			}
			for (int num7 = 0; num7 < 401; num7++)
			{
				Main.item[num7] = new Item();
			}
			for (int num8 = 0; num8 < 201; num8++)
			{
				Main.npc[num8] = new NPC();
				Main.npc[num8].whoAmI = num8;
			}
			for (int num9 = 0; num9 < 256; num9++)
			{
				Main.player[num9] = new Player();
			}
			for (int num10 = 0; num10 < 1001; num10++)
			{
				Main.projectile[num10] = new Projectile();
			}
			for (int num11 = 0; num11 < 501; num11++)
			{
				Main.gore[num11] = new Gore();
			}
			for (int num12 = 0; num12 < Main.maxRain + 1; num12++)
			{
				Main.rain[num12] = new Rain();
			}
			for (int num13 = 0; num13 < 200; num13++)
			{
				Main.cloud[num13] = new Cloud();
			}
			for (int num14 = 0; num14 < 100; num14++)
			{
				Main.combatText[num14] = new CombatText();
			}
			for (int num15 = 0; num15 < 20; num15++)
			{
				Main.itemText[num15] = new ItemText();
			}
			for (int num16 = 0; num16 < 2749; num16++)
			{
				Item item = new Item();
				item.SetDefaults(num16, false);
				Main.itemName[num16] = item.name;
				if (item.headSlot > 0)
				{
					Item.headType[item.headSlot] = item.type;
				}
				if (item.bodySlot > 0)
				{
					Item.bodyType[item.bodySlot] = item.type;
				}
				if (item.legSlot > 0)
				{
					Item.legType[item.legSlot] = item.type;
				}
			}
			NPC nPC = new NPC();
			for (int num17 = -65; num17 < 378; num17++)
			{
				if (num17 != 0)
				{
					nPC.netDefaults(num17);
					if (nPC.lifeMax > 32767)
					{
						Main.npcLifeBytes[num17] = 4;
					}
					else
					{
						if (nPC.lifeMax > 127)
						{
							Main.npcLifeBytes[num17] = 2;
						}
						else
						{
							Main.npcLifeBytes[num17] = 1;
						}
					}
				}
			}
			for (int num18 = 0; num18 < Recipe.maxRecipes; num18++)
			{
				Main.recipe[num18] = new Recipe();
				Main.availableRecipeY[num18] = (float)(65 * num18);
			}
			Recipe.SetupRecipes();
			for (int num19 = 0; num19 < Main.numChatLines; num19++)
			{
				Main.chatLine[num19] = new ChatLine();
			}
			for (int num20 = 0; num20 < Liquid.resLiquid; num20++)
			{
				Main.liquid[num20] = new Liquid();
			}
			for (int num21 = 0; num21 < 10000; num21++)
			{
				Main.liquidBuffer[num21] = new LiquidBuffer();
			}
			this.waterfallManager = new WaterfallManager();
			Lighting.LightingThreads = Environment.ProcessorCount - 1;
			this.shop[0] = new Chest(false);
			Chest.SetupTravelShop();
			for (int num22 = 1; num22 < Main.numShops; num22++)
			{
				this.shop[num22] = new Chest(false);
				this.shop[num22].SetupShop(num22);
			}
			Main.teamColor[0] = Color.White;
			Main.teamColor[1] = new Color(230, 40, 20);
			Main.teamColor[2] = new Color(20, 200, 30);
			Main.teamColor[3] = new Color(75, 90, 255);
			Main.teamColor[4] = new Color(200, 180, 0);
			if (Main.menuMode == 1)
			{
				Main.LoadPlayers();
			}
			for (int num23 = 1; num23 < 423; num23++)
			{
				Projectile projectile = new Projectile();
				projectile.SetDefaults(num23);
				if (projectile.hostile)
				{
					Main.projHostile[num23] = true;
				}
			}
			Netplay.Init();
			if (Main.skipMenu)
			{
				WorldGen.clearWorld();
				Main.gameMenu = false;
				Main.LoadPlayers();
				Main.player[Main.myPlayer] = (Player)Main.loadPlayer[0].Clone();
				Main.PlayerPath = Main.loadPlayerPath[0];
				Main.LoadWorlds();
				WorldGen.generateWorld(-1);
				WorldGen.EveryTileFrame();
				Main.player[Main.myPlayer].Spawn();
			}
			else
			{
				IntPtr systemMenu = Main.GetSystemMenu(base.Window.Handle, false);
				int menuItemCount = Main.GetMenuItemCount(systemMenu);
				Main.RemoveMenu(systemMenu, menuItemCount - 1, 1024);
			}
			if (Main.dedServ)
			{
				return;
			}
			Main.clientUUID = Guid.NewGuid().ToString();
			keyBoardInput.newKeyEvent += delegate(char keyStroke)
			{
				if (Main.keyCount < 10)
				{
					Main.keyInt[Main.keyCount] = (int)keyStroke;
					Main.keyString[Main.keyCount] = string.Concat(keyStroke);
					Main.keyCount++;
				}
			};
			base.Initialize();
			base.Window.AllowUserResizing = true;
			this.OpenSettings();
			if (Main.screenWidth > GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Width)
			{
				Main.screenWidth = GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Width;
			}
			if (Main.screenHeight > GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Height)
			{
				Main.screenHeight = GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Height;
			}
			Main.graphics.ApplyChanges();
			this.CheckBunny();
			if (Lang.lang > 1)
			{
				Lang.setLang(true);
			}
			Lang.setLang(false);
			if (Lang.lang == 0)
			{
				Main.menuMode = 1212;
			}
			this.SetTitle();
			this.OpenRecent();
			Star.SpawnStars();
			WorldGen.RandomWeather();
			foreach (DisplayMode current in GraphicsAdapter.DefaultAdapter.SupportedDisplayModes)
			{
				if (current.Width >= Main.minScreenW && current.Height >= Main.minScreenH && current.Width <= Main.maxScreenW && current.Height <= Main.maxScreenH)
				{
					bool flag = true;
					for (int num24 = 0; num24 < Main.numDisplayModes; num24++)
					{
						if (current.Width == Main.displayWidth[num24] && current.Height == Main.displayHeight[num24])
						{
							flag = false;
							break;
						}
					}
					if (flag)
					{
						Main.displayHeight[Main.numDisplayModes] = current.Height;
						Main.displayWidth[Main.numDisplayModes] = current.Width;
						Main.numDisplayModes++;
					}
				}
			}
			if (Main.autoJoin)
			{
				Main.LoadPlayers();
				Main.menuMode = 1;
				Main.menuMultiplayer = true;
			}
			Main.fpsTimer.Start();
			Main.updateTimer.Start();
		}
Пример #5
0
 public static void InitLifeBytes()
 {
     NPC nPC = new NPC();
     for (int i = -65; i < 540; i++)
     {
         if (i != 0)
         {
             nPC.netDefaults(i);
             if (nPC.lifeMax > 32767)
             {
                 Main.npcLifeBytes[i] = 4;
             }
             else if (nPC.lifeMax <= 127)
             {
                 Main.npcLifeBytes[i] = 1;
             }
             else
             {
                 Main.npcLifeBytes[i] = 2;
             }
         }
     }
     nPC = null;
 }
Пример #6
0
 public static List<NPC> GetNPCByName(string name)
 {
     var found = new List<NPC>();
     for (int i = 1; i < Main.maxNPCTypes; i++)
     {
         NPC npc = new NPC();
         npc.netDefaults(i);
         if (npc.name.ToLower().Contains(name.ToLower()))
             found.Add(npc);
     }
     return found;
 }
Пример #7
0
		public static async void Find(CommandArgs e)
		{
			var regex = new Regex(@"^\w+ -(?<switch>\w+) (?<search>.+?) ?(?<page>\d*)$");
			Match match = regex.Match(e.Message);
			if (!match.Success)
			{
				e.Player.SendErrorMessage("Invalid syntax! Proper syntax: {0}find <-switch> <name...> [page]",
					TShock.Config.CommandSpecifier);
				e.Player.SendSuccessMessage("Valid {0}find switches:", TShock.Config.CommandSpecifier);
				e.Player.SendInfoMessage("-command: Finds a command.");
				e.Player.SendInfoMessage("-item: Finds an item.");
				e.Player.SendInfoMessage("-npc: Finds an NPC.");
				e.Player.SendInfoMessage("-tile: Finds a tile.");
				e.Player.SendInfoMessage("-wall: Finds a wall.");
				return;
			}

			int page = 1;
			if (!String.IsNullOrWhiteSpace(match.Groups["page"].Value) &&
				(!int.TryParse(match.Groups["page"].Value, out page) || page <= 0))
			{
				e.Player.SendErrorMessage("Invalid page '{0}'!", match.Groups["page"].Value);
				return;
			}

			switch (match.Groups["switch"].Value.ToLowerInvariant())
			{
				#region Command

				case "command":
					{
						var commands = new List<string>();

						await Task.Run(() =>
						{
							foreach (
								Command command in
									TShockAPI.Commands.ChatCommands.FindAll(c => c.Names.Any(s => s.ContainsInsensitive(match.Groups[2].Value))))
							{
								commands.Add(String.Format("{0} (Permission: {1})", command.Name, command.Permissions.FirstOrDefault()));
							}
						});

						PaginationTools.SendPage(e.Player, page, commands,
							new PaginationTools.Settings
							{
								HeaderFormat = "Found Commands ({0}/{1}):",
								FooterFormat = String.Format("Type /find -command {0} {{0}} for more", match.Groups[2].Value),
								NothingToDisplayString = "No commands were found."
							});
						return;
					}

				#endregion

				#region Item

				case "item":
					var items = new List<string>();

					await Task.Run(() =>
					{
						for (int i = -48; i < 0; i++)
						{
							var item = new Item();
							item.netDefaults(i);
							if (item.name.ContainsInsensitive(match.Groups[2].Value))
							{
								items.Add(String.Format("{0} (ID: {1})", item.name, i));
							}
						}
						for (int i = 0; i < Main.itemName.Length; i++)
						{
							if (Main.itemName[i].ContainsInsensitive(match.Groups[2].Value))
							{
								items.Add(String.Format("{0} (ID: {1})", Main.itemName[i], i));
							}
						}
					});

					PaginationTools.SendPage(e.Player, page, items,
						new PaginationTools.Settings
						{
							HeaderFormat = "Found Items ({0}/{1}):",
							FooterFormat = String.Format("Type /find -item {0} {{0}} for more", match.Groups[2].Value),
							NothingToDisplayString = "No items were found."
						});
					return;

				#endregion

				#region NPC

				case "npc":
					var npcs = new List<string>();

					await Task.Run(() =>
					{
						for (int i = -65; i < 0; i++)
						{
							var npc = new NPC();
							npc.netDefaults(i);
							if (npc.name.ContainsInsensitive(match.Groups[2].Value))
							{
								npcs.Add(String.Format("{0} (ID: {1})", npc.name, i));
							}
						}
						for (int i = 0; i < Main.npcName.Count(); i++)
						{
							if (Main.npcName[i].ContainsInsensitive(match.Groups[2].Value))
							{
								npcs.Add(String.Format("{0} (ID: {1})", Main.npcName[i], i));
							}
						}
					});

					PaginationTools.SendPage(e.Player, page, npcs,
						new PaginationTools.Settings
						{
							HeaderFormat = "Found NPCs ({0}/{1}):",
							FooterFormat = String.Format("Type /find -npc {0} {{0}} for more", match.Groups[2].Value),
							NothingToDisplayString = "No NPCs were found.",
						});
					return;

				#endregion

				#region Tile

				case "tile":
					var tiles = new List<string>();

					await Task.Run(() =>
					{
						foreach (FieldInfo fi in typeof(TileID).GetFields())
						{
							var sb = new StringBuilder();
							for (int i = 0; i < fi.Name.Length; i++)
							{
								if (Char.IsUpper(fi.Name[i]) && i > 0)
								{
									sb.Append(" ").Append(fi.Name[i]);
								}
								else
								{
									sb.Append(fi.Name[i]);
								}
							}

							string name = sb.ToString();
							if (name.ContainsInsensitive(match.Groups[2].Value))
							{
								tiles.Add(String.Format("{0} (ID: {1})", name, fi.GetValue(null)));
							}
						}
					});

					PaginationTools.SendPage(e.Player, page, tiles,
						new PaginationTools.Settings
						{
							HeaderFormat = "Found Tiles ({0}/{1}):",
							FooterFormat = String.Format("Type /find -tile {0} {{0}} for more", match.Groups[2].Value),
							NothingToDisplayString = "No tiles were found.",
						});
					return;

				#endregion

				#region Wall

				case "wall":
					var walls = new List<string>();

					await Task.Run(() =>
					{
						foreach (FieldInfo fi in typeof(WallID).GetFields())
						{
							var sb = new StringBuilder();
							for (int i = 0; i < fi.Name.Length; i++)
							{
								if (Char.IsUpper(fi.Name[i]) && i > 0)
								{
									sb.Append(" ").Append(fi.Name[i]);
								}
								else
								{
									sb.Append(fi.Name[i]);
								}
							}

							string name = sb.ToString();
							if (name.ContainsInsensitive(match.Groups[2].Value))
							{
								walls.Add(String.Format("{0} (ID: {1})", name, fi.GetValue(null)));
							}
						}
					});

					PaginationTools.SendPage(e.Player, page, walls,
						new PaginationTools.Settings
						{
							HeaderFormat = "Found Walls ({0}/{1}):",
							FooterFormat = String.Format("Type /find -wall {0} {{0}} for more", match.Groups[2].Value),
							NothingToDisplayString = "No walls were found.",
						});
					return;

				#endregion

				default:
					e.Player.SendSuccessMessage("Valid {0}find switches:", TShock.Config.CommandSpecifier);
					e.Player.SendInfoMessage("-command: Finds a command.");
					e.Player.SendInfoMessage("-item: Finds an item.");
					e.Player.SendInfoMessage("-npc: Finds an NPC.");
					e.Player.SendInfoMessage("-tile: Finds a tile.");
					e.Player.SendInfoMessage("-wall: Finds a wall.");
					return;
			}
		}
Пример #8
0
        public void NPCLoot()
        {
            if (Main.netMode == 1 || this.type >= 540)
            {
                return;
            }
            bool flag = NPC.downedMechBoss1 && NPC.downedMechBoss2 && NPC.downedMechBoss3;
            int num = this.type;
            switch (num)
            {
            case 13:
            case 14:
            case 15:
                if (this.boss)
                {
                    AchievementsHelper.NotifyNPCKilled(this);
                }
                break;
            default:
                switch (num)
                {
                case 125:
                case 126:
                {
                    int num2 = (this.type == 126) ? 125 : 126;
                    if (!NPC.AnyNPCs(num2))
                    {
                        AchievementsHelper.NotifyNPCKilled(this);
                        AchievementsHelper.CheckMechaMayhem(this.type);
                        goto IL_C1;
                    }
                    goto IL_C1;
                }
                case 127:
                    break;
                default:
                    if (num != 134)
                    {
                        AchievementsHelper.NotifyNPCKilled(this);
                        goto IL_C1;
                    }
                    break;
                }
                AchievementsHelper.CheckMechaMayhem(this.type);
                AchievementsHelper.NotifyNPCKilled(this);
                break;
            }
            IL_C1:
            int num3 = Item.NPCtoBanner(this.BannerID());
            if (num3 > 0 && !NPCID.Sets.ExcludedFromDeathTally[this.type] && this.AnyInteractions())
            {
                NPC.killCount[num3]++;
                if (Main.netMode == 2)
                {
                    NetMessage.SendData(83, -1, -1, "", num3, 0f, 0f, 0f, 0, 0, 0);
                }
                int num4 = 50;
                if (NPC.killCount[num3] % num4 == 0 && num3 > 0)
                {
                    int l = Item.BannerToNPC(num3);
                    NPC nPC = new NPC();
                    nPC.netDefaults(l);
                    int num5 = this.lastInteraction;
                    if (!Main.player[num5].active || Main.player[num5].dead)
                    {
                        num5 = this.FindClosestPlayer();
                    }
                    string text = string.Concat(new object[]
                    {
                        "The ",
                        NPC.killCount[num3],
                        "th ",
                        Lang.npcName(l, false),
                        " has been defeated!"
                    });
                    if (num5 >= 0 && num5 < 255)
                    {
                        text = string.Concat(new object[]
                        {
                            Main.player[num5].name,
                            " has defeated the ",
                            NPC.killCount[num3],
                            "th ",
                            Lang.npcName(l, false),
                            "!"
                        });
                    }
                    if (Main.netMode == 0)
                    {
                        Main.NewText(text, 250, 250, 0, false);
                    }
                    else if (Main.netMode == 2)
                    {
                        NetMessage.SendData(25, -1, -1, text, 255, 250f, 250f, 0f, 0, 0, 0);
                    }
                    int num6 = 1615 + num3 - 1;
                    if (num3 >= 249)
                    {
                        num6 = 3593 + num3 - 249;
                    }
                    else if (num3 >= 186)
                    {
                        num6 = 3390 + num3 - 186;
                    }
                    else if (num3 >= 88)
                    {
                        num6 = 2897 + num3 - 88;
                    }
                    Vector2 position = this.position;
                    if (num5 >= 0 && num5 < 255)
                    {
                        position = Main.player[num5].position;
                    }
                    DropLoot(position, this.width, this.height, num6, 1, false, 0, false, false);
                }
            }
            if (this.type == 23 && Main.hardMode)
            {
                return;
            }
            if ((this.type == 170 || this.type == 180 || this.type == 171) && Main.rand.Next(3) == 0)
            {
                DropLoot(this.position, this.width, this.height, 3532, 1, false, 0, false, false);
            }
            num = this.type;
            if (num <= 122)
            {
                if (num <= 80)
                {
                    if (num != 75 && num != 80)
                    {
                        goto IL_482;
                    }
                }
                else
                {
                    switch (num)
                    {
                    case 84:
                    case 86:
                        break;
                    case 85:
                        goto IL_482;
                    default:
                        switch (num)
                        {
                        case 120:
                        case 122:
                            break;
                        case 121:
                            goto IL_482;
                        default:
                            goto IL_482;
                        }
                        break;
                    }
                }
            }
            else if (num <= 171)
            {
                switch (num)
                {
                case 137:
                case 138:
                    break;
                default:
                    if (num != 171)
                    {
                        goto IL_482;
                    }
                    break;
                }
            }
            else if (num != 244 && num != 475)
            {
                goto IL_482;
            }
            int maxValue = Main.expertMode ? 150 : 200;
            if (Main.rand.Next(maxValue) == 0)
            {
                DropLoot(this.position, this.width, this.height, 3260, 1, false, 0, false, false);
            }
            IL_482:
            if (Main.slimeRain && Main.slimeRainNPC[this.type] && !NPC.AnyNPCs(50))
            {
                int num7 = 150;
                if (NPC.downedSlimeKing)
                {
                    num7 /= 2;
                }
                Main.slimeRainKillCount++;
                if (Main.slimeRainKillCount >= num7)
                {
                    int plr = this.FindClosestPlayer();
                    NPC.SpawnOnPlayer(plr, 50);
                    Main.slimeRainKillCount = -num7 / 2;
                }
            }
            if (!Main.player[(int)Player.FindClosest(this.position, this.width, this.height)].ZoneDungeon)
            {
                bool flag2 = false;
                if (Main.expertMode && Main.rand.Next(5) == 0)
                {
                    flag2 = true;
                }
                else if (Main.rand.Next(5) == 0)
                {
                    flag2 = true;
                }
                if (this.boss)
                {
                    flag2 = false;
                }
                switch (this.type)
                {
                case 13:
                case 14:
                case 15:
                    flag2 = false;
                    break;
                }
                if (Main.hardMode && this.lifeMax > 1 && this.damage > 0 && !this.friendly && (double)this.position.Y > Main.rockLayer * 16.0 && flag2 && this.type != 121 && this.value > 0f)
                {
                    if (Main.player[(int)Player.FindClosest(this.position, this.width, this.height)].ZoneCorrupt || Main.player[(int)Player.FindClosest(this.position, this.width, this.height)].ZoneCrimson)
                    {
                        DropLoot(this.position, this.width, this.height, 521, 1, false, 0, false, false);
                    }
                    if (Main.player[(int)Player.FindClosest(this.position, this.width, this.height)].ZoneHoly)
                    {
                        DropLoot(this.position, this.width, this.height, 520, 1, false, 0, false, false);
                    }
                }
            }
            if (this.type == 1 && this.ai[1] > 0f)
            {
                int num8 = (int)this.ai[1];
                if (num8 > 0 && num8 < Main.maxItemTypes)
                {
                    int num9 = 1;
                    if (num8 == 8)
                    {
                        num9 = Main.rand.Next(5, 11);
                    }
                    else if (num8 == 166)
                    {
                        num9 = Main.rand.Next(2, 7);
                    }
                    else if (num8 == 965)
                    {
                        num9 = Main.rand.Next(20, 46);
                    }
                    else if ((num8 >= 11 && num8 <= 14) || (num8 >= 699 && num8 <= 702))
                    {
                        num9 = Main.rand.Next(3, 9);
                        if (Main.rand.Next(2) == 0)
                        {
                            num9 += 5;
                        }
                    }
                    else if (num8 == 71)
                    {
                        num9 = Main.rand.Next(50, 100);
                    }
                    else if (num8 == 72)
                    {
                        num9 = Main.rand.Next(20, 100);
                    }
                    else if (num8 == 73)
                    {
                        num9 = Main.rand.Next(1, 3);
                    }
                    DropLoot(this.position, this.width, this.height, num8, num9, false, 0, false, false);
                }
            }
            if (this.type == 22 && this.displayName == "Andrew")
            {
                DropLoot(this.position, this.width, this.height, 867, 1, false, 0, false, false);
            }
            if (this.type == 353 && Main.rand.Next(8) == 0)
            {
                DropLoot(this.position, this.width, this.height, 3352, 1, false, 0, false, false);
            }
            if (this.type == 441 && Main.rand.Next(8) == 0)
            {
                DropLoot(this.position, this.width, this.height, 3351, 1, false, 0, false, false);
            }
            if (this.type == 227 && Main.rand.Next(10) == 0)
            {
                DropLoot(this.position, this.width, this.height, 3350, 1, false, 0, false, false);
            }
            if (this.type == 208 && Main.rand.Next(4) == 0)
            {
                DropLoot(this.position, this.width, this.height, 3548, Main.rand.Next(30, 61), false, 0, false, false);
            }
            if (this.type == 207 && Main.rand.Next(8) == 0)
            {
                DropLoot(this.position, this.width, this.height, 3349, 1, false, 0, false, false);
            }
            if (Main.hardMode && this.value > 0f)
            {
                if (!NPC.downedMechBoss1 && Main.rand.Next(2500) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 556, 1, false, 0, false, false);
                }
                else if (!NPC.downedMechBoss2 && Main.rand.Next(2500) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 544, 1, false, 0, false, false);
                }
                else if (!NPC.downedMechBoss3 && Main.rand.Next(2500) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 557, 1, false, 0, false, false);
                }
            }
            if (Main.halloween && this.value > 0f && this.value < 500f && this.damage < 40 && this.defense < 20)
            {
                if (Main.rand.Next(2000) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 1825, 1, false, 0, false, false);
                }
                else if (Main.rand.Next(2000) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 1827, 1, false, 0, false, false);
                }
            }
            if (Main.hardMode && this.value > 0f)
            {
                if (Main.rand.Next(2500) == 0 && Main.player[(int)Player.FindClosest(this.position, this.width, this.height)].ZoneJungle)
                {
                    DropLoot(this.position, this.width, this.height, 1533, 1, false, 0, false, false);
                }
                if (Main.rand.Next(2500) == 0 && Main.player[(int)Player.FindClosest(this.position, this.width, this.height)].ZoneCorrupt)
                {
                    DropLoot(this.position, this.width, this.height, 1534, 1, false, 0, false, false);
                }
                if (Main.rand.Next(2500) == 0 && Main.player[(int)Player.FindClosest(this.position, this.width, this.height)].ZoneCrimson)
                {
                    DropLoot(this.position, this.width, this.height, 1535, 1, false, 0, false, false);
                }
                if (Main.rand.Next(2500) == 0 && Main.player[(int)Player.FindClosest(this.position, this.width, this.height)].ZoneHoly)
                {
                    DropLoot(this.position, this.width, this.height, 1536, 1, false, 0, false, false);
                }
                if (Main.rand.Next(2500) == 0 && Main.player[(int)Player.FindClosest(this.position, this.width, this.height)].ZoneSnow)
                {
                    DropLoot(this.position, this.width, this.height, 1537, 1, false, 0, false, false);
                }
            }
            if (this.type == 68)
            {
                DropLoot(this.position, this.width, this.height, 1169, 1, false, 0, false, false);
            }
            if (Main.snowMoon)
            {
                int num10 = NPC.waveCount;
                if (Main.expertMode)
                {
                    num10 += 7;
                }
                int num11 = (int)((double)(30 - num10) / 2.5);
                if (Main.expertMode)
                {
                    num11 -= 2;
                }
                if (num11 < 1)
                {
                    num11 = 1;
                }
                if (this.type == 344)
                {
                    NPC.downedChristmasTree = true;
                }
                if (this.type == 345)
                {
                    NPC.downedChristmasIceQueen = true;
                }
                if (this.type == 346)
                {
                    NPC.downedChristmasSantank = true;
                }
                if ((this.type == 344 || this.type == 345 || this.type == 346) && Main.rand.Next(num11) == 0 && num10 >= 15)
                {
                    int num12 = 4;
                    if (num10 == 16)
                    {
                        num12 = 4;
                    }
                    if (num10 == 17)
                    {
                        num12 = 3;
                    }
                    if (num10 == 18)
                    {
                        num12 = 3;
                    }
                    if (num10 == 19)
                    {
                        num12 = 2;
                    }
                    if (num10 >= 20)
                    {
                        num12 = 2;
                    }
                    if (Main.expertMode && Main.rand.Next(3) == 0)
                    {
                        num12--;
                    }
                    if (Main.rand.Next(num12) == 0)
                    {
                        if (this.type == 344)
                        {
                            DropLoot(this.position, this.width, this.height, 1962, 1, false, 0, false, false);
                        }
                        if (this.type == 345)
                        {
                            DropLoot(this.position, this.width, this.height, 1960, 1, false, 0, false, false);
                        }
                        if (this.type == 346)
                        {
                            DropLoot(this.position, this.width, this.height, 1961, 1, false, 0, false, false);
                        }
                    }
                }
                if (Main.rand.Next(num11) == 0)
                {
                    if (this.type == 344)
                    {
                        int num13 = Main.rand.Next(3);
                        if (Main.rand.Next(15) == 0)
                        {
                            DropLoot(this.position, this.width, this.height, 1871, 1, false, -1, false, false);
                        }
                        else
                        {
                            if (num13 == 0)
                            {
                                DropLoot(this.position, this.width, this.height, 1916, 1, false, 0, false, false);
                            }
                            if (num13 == 1)
                            {
                                DropLoot(this.position, this.width, this.height, 1928, 1, false, -1, false, false);
                            }
                            if (num13 == 2)
                            {
                                DropLoot(this.position, this.width, this.height, 1930, 1, false, -1, false, false);
                            }
                        }
                    }
                    if (this.type == 346)
                    {
                        int num14 = Main.rand.Next(2);
                        if (num14 == 0)
                        {
                            DropLoot(this.position, this.width, this.height, 1910, 1, false, -1, false, false);
                        }
                        if (num14 == 1)
                        {
                            DropLoot(this.position, this.width, this.height, 1929, 1, false, -1, false, false);
                        }
                    }
                    if (this.type == 345)
                    {
                        if (NPC.waveCount >= 15 && Main.rand.Next(30) == 0)
                        {
                            DropLoot(this.position, this.width, this.height, 1914, 1, false, 0, false, false);
                        }
                        else if (Main.rand.Next(15) == 0)
                        {
                            DropLoot(this.position, this.width, this.height, 1959, 1, false, 0, false, false);
                        }
                        else
                        {
                            int num15 = Main.rand.Next(3);
                            if (num15 == 0)
                            {
                                DropLoot(this.position, this.width, this.height, 1931, 1, false, -1, false, false);
                            }
                            if (num15 == 1)
                            {
                                DropLoot(this.position, this.width, this.height, 1946, 1, false, -1, false, false);
                            }
                            if (num15 == 2)
                            {
                                DropLoot(this.position, this.width, this.height, 1947, 1, false, -1, false, false);
                            }
                        }
                    }
                }
            }
            if (this.type == 341)
            {
                int num16 = Main.rand.Next(5, 11);
                for (int i = 0; i < num16; i++)
                {
                    DropLoot(this.position, this.width, this.height, 58, 1, false, 0, false, false);
                }
                if (Main.xMas)
                {
                    DropLoot(this.position, this.width, this.height, 1869, 1, false, 0, false, false);
                }
            }
            if (this.type >= 338 && this.type <= 340 && Main.rand.Next(5) == 0)
            {
                DropLoot(this.position, this.width, this.height, 58, 1, false, 0, false, false);
            }
            if (this.type >= 338 && this.type <= 340 && Main.rand.Next(200) == 0)
            {
                DropLoot(this.position, this.width, this.height, 1943 + Main.rand.Next(3), 1, false, 0, false, false);
            }
            if (this.type == 342 && Main.rand.Next(3) != 0)
            {
                DropLoot(this.position, this.width, this.height, 58, 1, false, 0, false, false);
            }
            if (Main.pumpkinMoon)
            {
                if (this.type == 325)
                {
                    NPC.downedHalloweenTree = true;
                }
                if (this.type == 327)
                {
                    NPC.downedHalloweenKing = true;
                }
                int num17 = NPC.waveCount;
                if (Main.expertMode)
                {
                    num17 += 6;
                }
                int num18 = (int)((double)(17 - num17) / 1.25);
                if (Main.expertMode)
                {
                    num18--;
                }
                if (num18 < 1)
                {
                    num18 = 1;
                }
                if (num17 >= 15)
                {
                    if (this.type == 325)
                    {
                        DropLoot(this.position, this.width, this.height, 1855, 1, false, 0, false, false);
                    }
                    if (this.type == 327)
                    {
                        DropLoot(this.position, this.width, this.height, 1856, 1, false, 0, false, false);
                    }
                }
                if (Main.rand.Next(num18) == 0)
                {
                    if (this.type == 315 && Main.rand.Next(20) == 0)
                    {
                        DropLoot(this.position, this.width, this.height, 1857, 1, false, 0, false, false);
                    }
                    if (this.type >= 305 && this.type <= 314 && Main.rand.Next(10) == 0)
                    {
                        DropLoot(this.position, this.width, this.height, Main.rand.Next(1788, 1791), 1, false, 0, false, false);
                    }
                    if (this.type == 325)
                    {
                        int num19 = Main.rand.Next(5);
                        if (num19 == 0)
                        {
                            DropLoot(this.position, this.width, this.height, 1829, 1, false, 0, false, false);
                        }
                        if (num19 == 1)
                        {
                            DropLoot(this.position, this.width, this.height, 1831, 1, false, 0, false, false);
                        }
                        if (num19 == 2)
                        {
                            DropLoot(this.position, this.width, this.height, 1835, 1, false, -1, false, false);
                        }
                        if (num19 == 2)
                        {
                            DropLoot(this.position, this.width, this.height, 1836, Main.rand.Next(30, 61), false, 0, false, false);
                        }
                        if (num19 == 3)
                        {
                            DropLoot(this.position, this.width, this.height, 1837, 1, false, 0, false, false);
                        }
                        if (num19 == 4)
                        {
                            DropLoot(this.position, this.width, this.height, 1845, 1, false, -1, false, false);
                        }
                    }
                    if (this.type == 327)
                    {
                        int num20 = Main.rand.Next(7);
                        if (num20 == 0)
                        {
                            DropLoot(this.position, this.width, this.height, 1782, 1, false, -1, false, false);
                        }
                        if (num20 == 0)
                        {
                            DropLoot(this.position, this.width, this.height, 1783, Main.rand.Next(50, 101), false, 0, false, false);
                        }
                        if (num20 == 1)
                        {
                            DropLoot(this.position, this.width, this.height, 1784, 1, false, -1, false, false);
                        }
                        if (num20 == 1)
                        {
                            DropLoot(this.position, this.width, this.height, 1785, Main.rand.Next(25, 51), false, 0, false, false);
                        }
                        if (num20 == 2)
                        {
                            DropLoot(this.position, this.width, this.height, 1811, 1, false, 0, false, false);
                        }
                        if (num20 == 3)
                        {
                            DropLoot(this.position, this.width, this.height, 1826, 1, false, -1, false, false);
                        }
                        if (num20 == 4)
                        {
                            DropLoot(this.position, this.width, this.height, 1801, 1, false, -1, false, false);
                        }
                        if (num20 == 5)
                        {
                            DropLoot(this.position, this.width, this.height, 1802, 1, false, -1, false, false);
                        }
                        if (num20 == 6)
                        {
                            DropLoot(this.position, this.width, this.height, 1798, 1, false, 0, false, false);
                        }
                    }
                }
            }
            if (this.type == 325)
            {
                DropLoot(this.position, this.width, this.height, 1729, Main.rand.Next(30, 51), false, 0, false, false);
            }
            if (this.type == 326)
            {
                DropLoot(this.position, this.width, this.height, 1729, Main.rand.Next(1, 5), false, 0, false, false);
            }
            if (this.type >= 305 && this.type <= 314 && Main.rand.Next(4) == 0)
            {
                DropLoot(this.position, this.width, this.height, 58, 1, false, 0, false, false);
            }
            if (this.type == 326 && Main.rand.Next(6) == 0)
            {
                DropLoot(this.position, this.width, this.height, 58, 1, false, 0, false, false);
            }
            if (this.type == 329 && Main.rand.Next(4) == 0)
            {
                DropLoot(this.position, this.width, this.height, 58, 1, false, 0, false, false);
            }
            if (this.type == 330 && Main.rand.Next(4) == 0)
            {
                DropLoot(this.position, this.width, this.height, 58, 1, false, 0, false, false);
            }
            if (this.type == 315)
            {
                DropLoot(this.position, this.width, this.height, 58, 1, false, 0, false, false);
            }
            if (Main.halloween && this.lifeMax > 1 && this.damage > 0 && !this.friendly && this.type != 121 && this.type != 23 && this.value > 0f && Main.rand.Next(80) == 0)
            {
                DropLoot(this.position, this.width, this.height, 1774, 1, false, 0, false, false);
            }
            if (Main.xMas && this.lifeMax > 1 && this.damage > 0 && !this.friendly && this.type != 121 && this.value > 0f && Main.rand.Next(13) == 0)
            {
                DropLoot(this.position, this.width, this.height, 1869, 1, false, 0, false, false);
            }
            if (this.lifeMax > 5 && this.value > 0f && !this.friendly && Main.hardMode && this.position.Y / 16f > (float)(Main.maxTilesY - 200) && Main.rand.Next(50) == 0)
            {
                DropLoot(this.position, this.width, this.height, 2701, Main.rand.Next(20, 51), false, 0, false, false);
            }
            if (this.type == 325 || this.type == 327 || this.type == 344 || this.type == 345 || this.type == 346)
            {
                int num21 = Main.rand.Next(6) + 6;
                for (int j = 0; j < num21; j++)
                {
                    DropLoot(this.position, this.width, this.height, 58, 1, false, 0, false, false);
                }
            }
            if (this.type == 156 && Main.rand.Next(75) == 0)
            {
                DropLoot(this.position, this.width, this.height, 1518, 1, false, 0, false, false);
            }
            if (this.type == 243 && Main.rand.Next(3) == 0)
            {
                DropLoot(this.position, this.width, this.height, 1519, 1, false, 0, false, false);
            }
            if (this.type >= 269 && this.type <= 280 && Main.rand.Next(450) == 0)
            {
                DropLoot(this.position, this.width, this.height, 1517, 1, false, 0, false, false);
            }
            if ((this.type == 158 || this.type == 159) && Main.rand.Next(40) == 0)
            {
                DropLoot(this.position, this.width, this.height, 1520, 1, false, 0, false, false);
            }
            if (this.type == 176 && Main.rand.Next(150) == 0)
            {
                DropLoot(this.position, this.width, this.height, 1521, 1, false, 0, false, false);
            }
            if (this.type == 48 && Main.rand.Next(200) == 0)
            {
                DropLoot(this.position, this.width, this.height, 1516, 1, false, 0, false, false);
            }
            if (this.type == 205 && Main.rand.Next(2) == 0)
            {
                DropLoot(this.position, this.width, this.height, 1611, 1, false, 0, false, false);
            }
            if (this.type == 483 || this.type == 482)
            {
                DropLoot(this.position, this.width, this.height, 3086, Main.rand.Next(5, 11), false, -1, false, false);
            }
            if (!Main.hardMode && Main.rand.Next(100) == 0 && this.target >= 0 && this.lifeMax > 5 && !this.friendly && Main.rand.Next(4) == 0 && this.position.Y / 16f > (float)(Main.maxTilesY - 350) && NPC.downedBoss3)
            {
                DropLoot(this.position, this.width, this.height, 3282, 1, false, -1, false, false);
            }
            if (Main.hardMode && Main.player[this.target].ZoneSnow && Main.rand.Next(80) == 0 && this.target >= 0 && this.lifeMax > 5 && !this.friendly && this.value > 0f)
            {
                DropLoot(this.position, this.width, this.height, 3289, 1, false, -1, false, false);
            }
            else if (Main.hardMode && Main.rand.Next(200) == 0 && this.target >= 0 && this.lifeMax > 5 && !this.friendly && this.value > 0f)
            {
                if (Main.player[this.target].ZoneJungle && NPC.downedMechBossAny)
                {
                    DropLoot(this.position, this.width, this.height, 3286, 1, false, -1, false, false);
                }
                else if (Main.player[this.target].ZoneDungeon && NPC.downedPlantBoss)
                {
                    DropLoot(this.position, this.width, this.height, 3291, 1, false, -1, false, false);
                }
                else if ((double)(this.position.Y / 16f) > (Main.rockLayer + (double)Main.maxTilesY) / 2.0 && !Main.player[this.target].ZoneDungeon && Main.rand.Next(2) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 3290, 1, false, -1, false, false);
                }
            }
            int num22 = 1;
            if (Main.expertMode && Main.rand.Next(2) == 0)
            {
                num22 = 2;
            }
            for (int k = 0; k < num22; k++)
            {
                if (this.type == 461 && Main.rand.Next(50) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 497, 1, false, -1, false, false);
                }
                if ((this.type == 159 || this.type == 158) && Main.rand.Next(35) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 900, 1, false, -1, false, false);
                }
                if (this.type == 251 && Main.rand.Next(15) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 1311, 1, false, -1, false, false);
                }
                if (NPC.downedMechBoss1 && NPC.downedMechBoss2 && NPC.downedMechBoss3)
                {
                    if (this.type == 477)
                    {
                        if (Main.rand.Next(20) == 0 && NPC.downedPlantBoss)
                        {
                            DropLoot(this.position, this.width, this.height, 2770, 1, false, -1, false, false);
                            k++;
                        }
                        if (Main.rand.Next(4) == 0)
                        {
                            DropLoot(this.position, this.width, this.height, 1570, 1, false, -1, false, false);
                            k++;
                        }
                        else if (Main.rand.Next(3) == 0 && NPC.downedPlantBoss)
                        {
                            DropLoot(this.position, this.width, this.height, 3292, 1, false, -1, false, false);
                            k++;
                        }
                    }
                    if (this.type == 253 && Main.rand.Next(40) == 0)
                    {
                        DropLoot(this.position, this.width, this.height, 1327, 1, false, -1, false, false);
                    }
                }
                if (NPC.downedPlantBoss)
                {
                    if (this.type == 460 && Main.rand.Next(40) == 0)
                    {
                        DropLoot(this.position, this.width, this.height, 3098, 1, false, -1, false, false);
                    }
                    if (this.type == 468 && Main.rand.Next(40) == 0)
                    {
                        DropLoot(this.position, this.width, this.height, 3105, 1, false, -1, false, false);
                    }
                    if (this.type == 466 && Main.rand.Next(40) == 0)
                    {
                        DropLoot(this.position, this.width, this.height, 3106, 1, false, -1, false, false);
                    }
                    if (this.type == 467 && Main.rand.Next(40) == 0)
                    {
                        DropLoot(this.position, this.width, this.height, 3249, 1, false, -1, false, false);
                    }
                    if (this.type == 463 && Main.rand.Next(25) == 0)
                    {
                        DropLoot(this.position, this.width, this.height, 3107, 1, false, -1, false, false);
                        DropLoot(this.position, this.width, this.height, 3108, Main.rand.Next(100, 201), false, -1, false, false);
                    }
                }
            }
            if (Main.bloodMoon && Main.hardMode && Main.rand.Next(1000) == 0 && this.value > 0f)
            {
                DropLoot(this.position, this.width, this.height, 1314, 1, false, -1, false, false);
            }
            if (this.type == 77 && Main.rand.Next(150) == 0)
            {
                DropLoot(this.position, this.width, this.height, 723, 1, false, -1, false, false);
            }
            if (Main.rand.Next(100) == 0 || (Main.expertMode && Main.rand.Next(100) == 0))
            {
                int num23 = -1;
                int num24 = -1;
                num = this.type;
                if (num <= 109)
                {
                    if (num > 42)
                    {
                        switch (num)
                        {
                        case 75:
                            if (Main.rand.Next(2) == 0)
                            {
                                num23 = 889;
                            }
                            else
                            {
                                num23 = 890;
                            }
                            if (Main.rand.Next(100) != 0)
                            {
                                goto IL_2B09;
                            }
                            if (num23 == 889)
                            {
                                num24 = 890;
                                goto IL_2B09;
                            }
                            num24 = 889;
                            goto IL_2B09;
                        case 76:
                        case 85:
                        case 86:
                        case 87:
                        case 88:
                        case 89:
                        case 90:
                        case 91:
                        case 92:
                            goto IL_2B09;
                        case 77:
                            goto IL_2A1F;
                        case 78:
                        case 82:
                            num23 = 889;
                            goto IL_2B09;
                        case 79:
                            if (Main.rand.Next(2) == 0)
                            {
                                num23 = 888;
                            }
                            else
                            {
                                num23 = 890;
                            }
                            if (Main.rand.Next(100) != 0)
                            {
                                goto IL_2B09;
                            }
                            if (num23 == 888)
                            {
                                num24 = 890;
                                goto IL_2B09;
                            }
                            num24 = 888;
                            goto IL_2B09;
                        case 80:
                        case 93:
                            break;
                        case 81:
                            num23 = 888;
                            goto IL_2B09;
                        case 83:
                        case 84:
                            goto IL_2A5B;
                        case 94:
                            goto IL_2A67;
                        default:
                            switch (num)
                            {
                            case 102:
                            case 104:
                                goto IL_2A13;
                            case 103:
                                num23 = 890;
                                goto IL_2B09;
                            default:
                                if (num != 109)
                                {
                                    goto IL_2B09;
                                }
                                break;
                            }
                            break;
                        }
                        num23 = 893;
                        goto IL_2B09;
                    }
                    if (num == 34)
                    {
                        goto IL_2A5B;
                    }
                    if (num != 42)
                    {
                        goto IL_2B09;
                    }
                    goto IL_2A2B;
                }
                else if (num <= 179)
                {
                    if (num == 141 || num == 176)
                    {
                        goto IL_2A2B;
                    }
                    if (num != 179)
                    {
                        goto IL_2B09;
                    }
                    goto IL_2A5B;
                }
                else
                {
                    if (num == 182)
                    {
                        goto IL_2A67;
                    }
                    switch (num)
                    {
                    case 231:
                    case 232:
                    case 233:
                    case 234:
                    case 235:
                        goto IL_2A2B;
                    default:
                        switch (num)
                        {
                        case 269:
                        case 270:
                        case 271:
                        case 272:
                            break;
                        case 273:
                        case 274:
                        case 275:
                        case 276:
                            goto IL_2A1F;
                        default:
                            goto IL_2B09;
                        }
                        break;
                    }
                }
                IL_2A13:
                num23 = 885;
                goto IL_2B09;
                IL_2A1F:
                num23 = 886;
                goto IL_2B09;
                IL_2A2B:
                num23 = 887;
                goto IL_2B09;
                IL_2A5B:
                num23 = 891;
                goto IL_2B09;
                IL_2A67:
                num23 = 892;
                IL_2B09:
                if (num23 != -1)
                {
                    DropLoot(this.position, this.width, this.height, num23, 1, false, -1, false, false);
                }
                if (num24 != -1)
                {
                    DropLoot(this.position, this.width, this.height, num24, 1, false, -1, false, false);
                }
            }
            int num25 = 1;
            if (Main.expertMode && Main.rand.Next(2) == 0)
            {
                num25 = 2;
            }
            for (int m = 0; m < num25; m++)
            {
                if (this.type == 290)
                {
                    if (Main.rand.Next(15) == 0)
                    {
                        DropLoot(this.position, this.width, this.height, 1513, 1, false, -1, false, false);
                    }
                    else if (Main.rand.Next(10) == 0)
                    {
                        DropLoot(this.position, this.width, this.height, 938, 1, false, -1, false, false);
                    }
                }
                if (this.type == 287 && Main.rand.Next(6) == 0)
                {
                    if (Main.rand.Next(2) == 0)
                    {
                        DropLoot(this.position, this.width, this.height, 963, 1, false, -1, false, false);
                    }
                    else
                    {
                        DropLoot(this.position, this.width, this.height, 977, 1, false, -1, false, false);
                    }
                }
                if (this.type == 291)
                {
                    if (Main.rand.Next(12) == 0)
                    {
                        DropLoot(this.position, this.width, this.height, 1300, 1, false, -1, false, false);
                    }
                    else if (Main.rand.Next(12) == 0)
                    {
                        DropLoot(this.position, this.width, this.height, 1254, 1, false, -1, false, false);
                    }
                }
                if (this.type == 292)
                {
                    if (Main.rand.Next(12) == 0)
                    {
                        DropLoot(this.position, this.width, this.height, 1514, 1, false, -1, false, false);
                    }
                    else if (Main.rand.Next(12) == 0)
                    {
                        DropLoot(this.position, this.width, this.height, 679, 1, false, -1, false, false);
                    }
                }
                if (this.type == 293 && Main.rand.Next(18) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 759, 1, false, -1, false, false);
                }
                if ((this.type == 281 || this.type == 282) && Main.rand.Next(20) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 1446, 1, false, -1, false, false);
                }
                if ((this.type == 283 || this.type == 284) && Main.rand.Next(20) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 1444, 1, false, -1, false, false);
                }
                if ((this.type == 285 || this.type == 286) && Main.rand.Next(20) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 1445, 1, false, -1, false, false);
                }
                if (this.type >= 269 && this.type <= 280)
                {
                    if (Main.rand.Next(400) == 0)
                    {
                        DropLoot(this.position, this.width, this.height, 1183, 1, false, -1, false, false);
                    }
                    else if (Main.rand.Next(300) == 0)
                    {
                        DropLoot(this.position, this.width, this.height, 1266, 1, false, -1, false, false);
                    }
                    else if (Main.rand.Next(200) == 0)
                    {
                        DropLoot(this.position, this.width, this.height, 671, 1, false, -1, false, false);
                    }
                }
            }
            if (this.lifeMax > 100 && this.type != 288 && this.value > 0f && this.target >= 0 && Main.hardMode && NPC.downedPlantBoss && Main.player[this.target].ZoneDungeon)
            {
                int maxValue2 = 13;
                if (Main.expertMode)
                {
                    maxValue2 = 9;
                }
                if (Main.rand.Next(maxValue2) == 0 && Main.wallDungeon[(int)Main.tile[(int)base.Center.X / 16, (int)base.Center.Y / 16].wall])
                {
                    NPC.NewNPC((int)base.Center.X, (int)base.Center.Y, 288, 0, 0f, 0f, 0f, 0f, 255);
                }
            }
            if (this.type == 288)
            {
                DropLoot(this.position, this.width, this.height, 1508, Main.rand.Next(1, 3), false, -1, false, false);
            }
            if (this.type == 156 && Main.rand.Next(30) == 0)
            {
                DropLoot(this.position, this.width, this.height, 683, 1, false, -1, false, false);
            }
            if ((this.type == 195 || this.type == 196) && (Main.expertMode || Main.rand.Next(2) == 0))
            {
                DropLoot(this.position, this.width, this.height, 3102, 1, false, -1, false, false);
            }
            if (this.type == 245)
            {
                if (Main.expertMode)
                {
                    this.DropBossBags();
                }
                else
                {
                    if (Main.rand.Next(7) == 0)
                    {
                        DropLoot(this.position, this.width, this.height, 2110, 1, false, -1, false, false);
                    }
                    int num26 = Main.rand.Next(8);
                    if (num26 == 0)
                    {
                        DropLoot(this.position, this.width, this.height, 1258, 1, false, -1, false, false);
                        DropLoot(this.position, this.width, this.height, 1261, Main.rand.Next(60, 100), false, 0, false, false);
                    }
                    else if (num26 == 1)
                    {
                        DropLoot(this.position, this.width, this.height, 1122, 1, false, -1, false, false);
                    }
                    else if (num26 == 2)
                    {
                        DropLoot(this.position, this.width, this.height, 899, 1, false, -1, false, false);
                    }
                    else if (num26 == 3)
                    {
                        DropLoot(this.position, this.width, this.height, 1248, 1, false, -1, false, false);
                    }
                    else if (num26 == 4)
                    {
                        DropLoot(this.position, this.width, this.height, 1294, 1, false, -1, false, false);
                    }
                    else if (num26 == 5)
                    {
                        DropLoot(this.position, this.width, this.height, 1295, 1, false, -1, false, false);
                    }
                    else if (num26 == 6)
                    {
                        DropLoot(this.position, this.width, this.height, 1296, 1, false, -1, false, false);
                    }
                    else if (num26 == 7)
                    {
                        DropLoot(this.position, this.width, this.height, 1297, 1, false, -1, false, false);
                    }
                    DropLoot(this.position, this.width, this.height, 2218, Main.rand.Next(4, 9), false, -1, false, false);
                }
                NPC.downedGolemBoss = true;
            }
            if (this.type == 471 && (Main.expertMode || Main.rand.Next(2) == 0))
            {
                if (Main.rand.Next(3) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 3052, 1, false, -1, false, false);
                }
                else if (Main.rand.Next(2) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 3053, 1, false, -1, false, false);
                }
                else
                {
                    DropLoot(this.position, this.width, this.height, 3054, 1, false, -1, false, false);
                }
            }
            if (this.type == 268)
            {
                DropLoot(this.position, this.width, this.height, 1332, Main.rand.Next(2, 6), false, 0, false, false);
            }
            if (this.type == 370)
            {
                NPC.downedFishron = true;
                if (Main.expertMode)
                {
                    this.DropBossBags();
                }
                else
                {
                    if (Main.rand.Next(7) == 0)
                    {
                        DropLoot(this.position, this.width, this.height, 2588, 1, false, -1, false, false);
                    }
                    if (Main.rand.Next(15) == 0)
                    {
                        DropLoot(this.position, this.width, this.height, 2609, 1, false, -1, false, false);
                    }
                    int num27 = Main.rand.Next(5);
                    if (num27 == 0)
                    {
                        DropLoot(this.position, this.width, this.height, 2611, 1, false, -1, false, false);
                    }
                    else if (num27 == 1)
                    {
                        DropLoot(this.position, this.width, this.height, 2624, 1, false, -1, false, false);
                    }
                    else if (num27 == 2)
                    {
                        DropLoot(this.position, this.width, this.height, 2622, 1, false, -1, false, false);
                    }
                    else if (num27 == 3)
                    {
                        DropLoot(this.position, this.width, this.height, 2621, 1, false, -1, false, false);
                    }
                    else if (num27 == 4)
                    {
                        DropLoot(this.position, this.width, this.height, 2623, 1, false, -1, false, false);
                    }
                }
            }
            if (this.type == 109 && !NPC.downedClown)
            {
                NPC.downedClown = true;
                if (Main.netMode == 2)
                {
                    NetMessage.SendData(7, -1, -1, "", 0, 0f, 0f, 0f, 0, 0, 0);
                }
            }
            if (this.type == 153 && Main.rand.Next(17) == 0)
            {
                DropLoot(this.position, this.width, this.height, 1328, 1, false, -1, false, false);
            }
            if (this.type == 120 && Main.rand.Next(500) == 0)
            {
                DropLoot(this.position, this.width, this.height, 1326, 1, false, -1, false, false);
            }
            if (this.type == 49 && Main.rand.Next(250) == 0)
            {
                DropLoot(this.position, this.width, this.height, 1325, 1, false, -1, false, false);
            }
            if (this.type == 185 && Main.rand.Next(150) == 0)
            {
                DropLoot(this.position, this.width, this.height, 951, 1, false, -1, false, false);
            }
            if (this.type == 44 && Main.rand.Next(50) == 0)
            {
                DropLoot(this.position, this.width, this.height, 1320, 1, false, -1, false, false);
            }
            if (this.type == 44 && Main.rand.Next(20) == 0)
            {
                DropLoot(this.position, this.width, this.height, 88, 1, false, -1, false, false);
            }
            if (this.type == 110 && Main.rand.Next(80) == 0)
            {
                DropLoot(this.position, this.width, this.height, 1321, 1, false, -1, false, false);
            }
            if (this.type == 60 && Main.rand.Next(150) == 0)
            {
                DropLoot(this.position, this.width, this.height, 1322, 1, false, -1, false, false);
            }
            if (this.type == 151 && Main.rand.Next(50) == 0)
            {
                DropLoot(this.position, this.width, this.height, 1322, 1, false, -1, false, false);
            }
            if (this.type == 24 && Main.rand.Next(50) == 0)
            {
                DropLoot(this.position, this.width, this.height, 1323, 1, false, -1, false, false);
            }
            if (this.type == 109 && Main.rand.Next(30) == 0)
            {
                DropLoot(this.position, this.width, this.height, 1324, Main.rand.Next(1, 5), false, -1, false, false);
            }
            if (this.type == 163 || this.type == 238)
            {
                if (Main.rand.Next(40) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 1308, 1, false, -1, false, false);
                }
                if (Main.expertMode)
                {
                    if (Main.rand.Next(3) == 0)
                    {
                        DropLoot(this.position, this.width, this.height, 2607, Main.rand.Next(2, 4), false, 0, false, false);
                    }
                    else if (Main.rand.Next(2) == 0)
                    {
                        DropLoot(this.position, this.width, this.height, 2607, Main.rand.Next(1, 4), false, 0, false, false);
                    }
                    else
                    {
                        DropLoot(this.position, this.width, this.height, 2607, 1, false, 0, false, false);
                    }
                }
                else if (Main.rand.Next(4) != 0)
                {
                    if (Main.rand.Next(3) == 0)
                    {
                        DropLoot(this.position, this.width, this.height, 2607, Main.rand.Next(1, 4), false, 0, false, false);
                    }
                    else if (Main.rand.Next(2) == 0)
                    {
                        DropLoot(this.position, this.width, this.height, 2607, Main.rand.Next(1, 3), false, 0, false, false);
                    }
                    else
                    {
                        DropLoot(this.position, this.width, this.height, 2607, 1, false, 0, false, false);
                    }
                }
            }
            if (Main.hardMode && (this.type == 197 || this.type == 206 || this.type == 169 || this.type == 154) && Main.rand.Next(180) == 0)
            {
                DropLoot(this.position, this.width, this.height, 1306, 1, false, -1, false, false);
            }
            if (this.type == 244)
            {
                DropLoot(this.position, this.width, this.height, 23, Main.rand.Next(1, 6), false, 0, false, false);
                if (Main.rand.Next(2) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 23, Main.rand.Next(1, 6), false, 0, false, false);
                }
                if (Main.rand.Next(2) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 23, Main.rand.Next(1, 6), false, 0, false, false);
                }
                if (Main.rand.Next(2) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 23, Main.rand.Next(1, 6), false, 0, false, false);
                }
                DropLoot(this.position, this.width, this.height, 662, Main.rand.Next(30, 60), false, 0, false, false);
            }
            if (this.type == 250 && Main.rand.Next(15) == 0)
            {
                DropLoot(this.position, this.width, this.height, 1244, 1, false, -1, false, false);
            }
            if (this.type == 172)
            {
                DropLoot(this.position, this.width, this.height, 754, 1, false, -1, false, false);
                DropLoot(this.position, this.width, this.height, 755, 1, false, -1, false, false);
            }
            if (this.type == 110 && Main.rand.Next(200) == 0)
            {
                DropLoot(this.position, this.width, this.height, 682, 1, false, -1, false, false);
            }
            if (this.type == 154 && Main.rand.Next(100) == 0)
            {
                DropLoot(this.position, this.width, this.height, 1253, 1, false, -1, false, false);
            }
            if ((this.type == 169 || this.type == 206) && Main.rand.Next(50) == 0)
            {
                DropLoot(this.position, this.width, this.height, 726, 1, false, -1, false, false);
            }
            if (this.type == 243)
            {
                DropLoot(this.position, this.width, this.height, 2161, 1, false, -1, false, false);
            }
            if (this.type == 480 && Main.rand.Next(50) == 0)
            {
                DropLoot(this.position, this.width, this.height, 3269, 1, false, -1, false, false);
            }
            if (this.type == 198 || this.type == 199 || this.type == 226)
            {
                if (Main.rand.Next(1000) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 1172, 1, false, -1, false, false);
                }
                if (Main.rand.Next(50) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 1293, 1, false, -1, false, false);
                }
                if (Main.rand.Next(7) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 2766, Main.rand.Next(1, 3), false, -1, false, false);
                }
            }
            if (this.type == 78 || this.type == 79 || this.type == 80)
            {
                if (Main.rand.Next(75) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 870, 1, false, -1, false, false);
                }
                if (Main.rand.Next(75) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 871, 1, false, -1, false, false);
                }
                if (Main.rand.Next(75) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 872, 1, false, -1, false, false);
                }
            }
            if (this.type == 473)
            {
                int num28 = Main.rand.Next(5);
                if (num28 == 0)
                {
                    DropLoot(this.position, this.width, this.height, 3008, 1, false, -1, false, false);
                }
                else if (num28 == 1)
                {
                    DropLoot(this.position, this.width, this.height, 3014, 1, false, -1, false, false);
                }
                else if (num28 == 2)
                {
                    DropLoot(this.position, this.width, this.height, 3012, 1, false, -1, false, false);
                }
                else if (num28 == 3)
                {
                    DropLoot(this.position, this.width, this.height, 3015, 1, false, -1, false, false);
                }
                else if (num28 == 4)
                {
                    DropLoot(this.position, this.width, this.height, 3023, 1, false, -1, false, false);
                }
            }
            else if (this.type == 474)
            {
                int num29 = Main.rand.Next(5);
                if (num29 == 0)
                {
                    DropLoot(this.position, this.width, this.height, 3006, 1, false, -1, false, false);
                }
                else if (num29 == 1)
                {
                    DropLoot(this.position, this.width, this.height, 3007, 1, false, -1, false, false);
                }
                else if (num29 == 2)
                {
                    DropLoot(this.position, this.width, this.height, 3013, 1, false, -1, false, false);
                }
                else if (num29 == 3)
                {
                    DropLoot(this.position, this.width, this.height, 3016, 1, false, -1, false, false);
                }
                else if (num29 == 4)
                {
                    DropLoot(this.position, this.width, this.height, 3020, 1, false, -1, false, false);
                }
            }
            else if (this.type == 475)
            {
                int num30 = Main.rand.Next(4);
                if (num30 == 0)
                {
                    DropLoot(this.position, this.width, this.height, 3029, 1, false, -1, false, false);
                }
                else if (num30 == 1)
                {
                    DropLoot(this.position, this.width, this.height, 3030, 1, false, -1, false, false);
                }
                else if (num30 == 2)
                {
                    DropLoot(this.position, this.width, this.height, 3051, 1, false, -1, false, false);
                }
                else if (num30 == 3)
                {
                    DropLoot(this.position, this.width, this.height, 3022, 1, false, -1, false, false);
                }
            }
            else
            {
                int arg_47D3_0 = this.type;
            }
            if (this.type == 473 || this.type == 474 || this.type == 475 || this.type == 476)
            {
                DropLoot(this.position, this.width, this.height, 499, Main.rand.Next(5, 11), false, -1, false, false);
                DropLoot(this.position, this.width, this.height, 500, Main.rand.Next(5, 16), false, -1, false, false);
            }
            if (this.type == 85 && this.value > 0f)
            {
                if (this.ai[3] == 4f)
                {
                    if (Main.rand.Next(20) == 0)
                    {
                        DropLoot(this.position, this.width, this.height, 1312, 1, false, -1, false, false);
                    }
                    else
                    {
                        int num31 = Main.rand.Next(3);
                        if (num31 == 0)
                        {
                            DropLoot(this.position, this.width, this.height, 676, 1, false, -1, false, false);
                        }
                        else if (num31 == 1)
                        {
                            DropLoot(this.position, this.width, this.height, 725, 1, false, -1, false, false);
                        }
                        else if (num31 == 2)
                        {
                            DropLoot(this.position, this.width, this.height, 1264, 1, false, -1, false, false);
                        }
                    }
                }
                else
                {
                    int num32 = Main.rand.Next(6);
                    if (num32 == 0)
                    {
                        DropLoot(this.position, this.width, this.height, 437, 1, false, -1, false, false);
                    }
                    else if (num32 == 1)
                    {
                        DropLoot(this.position, this.width, this.height, 517, 1, false, -1, false, false);
                    }
                    else if (num32 == 2)
                    {
                        DropLoot(this.position, this.width, this.height, 535, 1, false, -1, false, false);
                    }
                    else if (num32 == 3)
                    {
                        DropLoot(this.position, this.width, this.height, 536, 1, false, -1, false, false);
                    }
                    else if (num32 == 4)
                    {
                        DropLoot(this.position, this.width, this.height, 532, 1, false, -1, false, false);
                    }
                    else
                    {
                        DropLoot(this.position, this.width, this.height, 554, 1, false, -1, false, false);
                    }
                }
            }
            if (this.type == 87)
            {
                if (Main.expertMode)
                {
                    DropLoot(this.position, this.width, this.height, 575, Main.rand.Next(5, 11) * 2, false, 0, false, false);
                }
                else
                {
                    DropLoot(this.position, this.width, this.height, 575, Main.rand.Next(5, 11), false, 0, false, false);
                }
            }
            if (this.type >= 212 && this.type <= 215)
            {
                if (Main.rand.Next(8000) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 905, 1, false, -1, false, false);
                }
                if (Main.rand.Next(4000) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 855, 1, false, -1, false, false);
                }
                if (Main.rand.Next(2000) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 854, 1, false, -1, false, false);
                }
                if (Main.rand.Next(2000) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 2584, 1, false, -1, false, false);
                }
                if (Main.rand.Next(1000) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 3033, 1, false, -1, false, false);
                }
                if (Main.rand.Next(200) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 672, 1, false, -1, false, false);
                }
                if (Main.rand.Next(500) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 1277, 1, false, 0, false, false);
                }
                if (Main.rand.Next(500) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 1278, 1, false, 0, false, false);
                }
                if (Main.rand.Next(500) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 1279, 1, false, 0, false, false);
                }
                if (Main.rand.Next(500) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 1280, 1, false, 0, false, false);
                }
                if (Main.rand.Next(300) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 1704, 1, false, 0, false, false);
                }
                if (Main.rand.Next(300) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 1705, 1, false, 0, false, false);
                }
                if (Main.rand.Next(300) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 1710, 1, false, 0, false, false);
                }
                if (Main.rand.Next(300) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 1716, 1, false, 0, false, false);
                }
                if (Main.rand.Next(300) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 1720, 1, false, 0, false, false);
                }
                if (Main.rand.Next(300) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 2379, 1, false, 0, false, false);
                }
                if (Main.rand.Next(300) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 2389, 1, false, 0, false, false);
                }
                if (Main.rand.Next(300) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 2405, 1, false, 0, false, false);
                }
                if (Main.rand.Next(300) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 2843, 1, false, 0, false, false);
                }
                if (Main.rand.Next(300) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 2663, 1, false, 0, false, false);
                }
                if (Main.rand.Next(300) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 2238, 1, false, 0, false, false);
                }
                if (Main.rand.Next(300) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 2133, 1, false, 0, false, false);
                }
                if (Main.rand.Next(300) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 2137, 1, false, 0, false, false);
                }
                if (Main.rand.Next(300) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 2143, 1, false, 0, false, false);
                }
                if (Main.rand.Next(300) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 2147, 1, false, 0, false, false);
                }
                if (Main.rand.Next(300) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 2151, 1, false, 0, false, false);
                }
                if (Main.rand.Next(300) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 2155, 1, false, 0, false, false);
                }
                if (Main.rand.Next(500) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 3263, 1, false, 0, false, false);
                }
                if (Main.rand.Next(500) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 3264, 1, false, 0, false, false);
                }
                if (Main.rand.Next(500) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 3265, 1, false, 0, false, false);
                }
            }
            else if (this.type == 216)
            {
                if (Main.rand.Next(2000) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 905, 1, false, -1, false, false);
                }
                if (Main.rand.Next(1000) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 855, 1, false, -1, false, false);
                }
                if (Main.rand.Next(500) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 854, 1, false, -1, false, false);
                }
                if (Main.rand.Next(500) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 2584, 1, false, -1, false, false);
                }
                if (Main.rand.Next(250) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 3033, 1, false, -1, false, false);
                }
                if (Main.rand.Next(50) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 672, 1, false, -1, false, false);
                }
            }
            else if (this.type == 491)
            {
                if (Main.rand.Next(400) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 905, 1, false, -1, false, false);
                }
                else if (Main.rand.Next(200) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 855, 1, false, -1, false, false);
                }
                else if (Main.rand.Next(100) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 854, 1, false, -1, false, false);
                }
                else if (Main.rand.Next(100) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 2584, 1, false, -1, false, false);
                }
                else if (Main.rand.Next(50) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 3033, 1, false, -1, false, false);
                }
                else if (Main.rand.Next(10) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 672, 1, false, -1, false, false);
                }
            }
            if ((this.type == 161 || this.type == 431) && Main.rand.Next(50) == 0)
            {
                int num33 = Main.rand.Next(3);
                DropLoot(this.position, this.width, this.height, 803 + num33, 1, false, 0, false, false);
            }
            if (this.type == 217)
            {
                DropLoot(this.position, this.width, this.height, 1115, 1, false, -1, false, false);
            }
            if (this.type == 218)
            {
                DropLoot(this.position, this.width, this.height, 1116, 1, false, -1, false, false);
            }
            if (this.type == 219)
            {
                DropLoot(this.position, this.width, this.height, 1117, 1, false, -1, false, false);
            }
            if (this.type == 220)
            {
                DropLoot(this.position, this.width, this.height, 1118, 1, false, -1, false, false);
            }
            if (this.type == 221)
            {
                DropLoot(this.position, this.width, this.height, 1119, 1, false, -1, false, false);
            }
            if (this.type == 167 && Main.rand.Next(50) == 0)
            {
                DropLoot(this.position, this.width, this.height, 879, 1, false, -1, false, false);
            }
            if (this.type == 143 || this.type == 144 || this.type == 145)
            {
                DropLoot(this.position, this.width, this.height, 593, Main.rand.Next(5, 11), false, 0, false, false);
            }
            if (this.type == 79)
            {
                if (Main.rand.Next(10) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 527, 1, false, 0, false, false);
                }
            }
            else if (this.type == 80 && Main.rand.Next(10) == 0)
            {
                DropLoot(this.position, this.width, this.height, 528, 1, false, 0, false, false);
            }
            if (this.type == 525)
            {
                if (Main.rand.Next(3) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 522, Main.rand.Next(1, 4), false, 0, false, false);
                }
                if (Main.rand.Next(15) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 527, 1, false, 0, false, false);
                }
            }
            if (this.type == 526)
            {
                if (Main.rand.Next(3) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 1332, Main.rand.Next(1, 4), false, 0, false, false);
                }
                if (Main.rand.Next(15) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 527, 1, false, 0, false, false);
                }
            }
            if (this.type == 527 && Main.rand.Next(15) == 0)
            {
                DropLoot(this.position, this.width, this.height, 528, 1, false, 0, false, false);
            }
            if (this.type == 532 && Main.rand.Next(3) == 0)
            {
                DropLoot(this.position, this.width, this.height, 3380, 1, false, 0, false, false);
            }
            if (this.type == 528)
            {
                if (Main.rand.Next(25) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 2802, 1, false, 0, false, false);
                }
            }
            else if (this.type == 529 && Main.rand.Next(25) == 0)
            {
                DropLoot(this.position, this.width, this.height, 2801, 1, false, 0, false, false);
            }
            if ((this.type == 49 || this.type == 51 || this.type == 150 || this.type == 93) && Main.rand.Next(100) == 0)
            {
                DropLoot(this.position, this.width, this.height, 18, 1, false, -1, false, false);
            }
            if ((this.type == 16 || this.type == 185 || this.type == 167 || this.type == 197) && Main.rand.Next(50) == 0)
            {
                DropLoot(this.position, this.width, this.height, 393, 1, false, -1, false, false);
            }
            if (this.type == 58 && Main.rand.Next(75) == 0)
            {
                DropLoot(this.position, this.width, this.height, 393, 1, false, -1, false, false);
            }
            if (this.type >= 494 && this.type <= 506)
            {
                if (Main.rand.Next(80) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 18, 1, false, -1, false, false);
                }
                else if (Main.rand.Next(80) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 393, 1, false, -1, false, false);
                }
                else if (Main.rand.Next(25) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 3285, 1, false, -1, false, false);
                }
            }
            if (this.type == 21 || this.type == 201 || this.type == 202 || this.type == 203 || this.type == 322 || this.type == 323 || this.type == 324 || (this.type >= 449 && this.type <= 452))
            {
                if (Main.rand.Next(100) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 954, 1, false, -1, false, false);
                }
                else if (Main.rand.Next(200) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 955, 1, false, -1, false, false);
                }
                else if (Main.rand.Next(200) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 1166, 1, false, -1, false, false);
                }
                else if (Main.rand.Next(500) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 1274, 1, false, -1, false, false);
                }
            }
            else if (this.type == 6)
            {
                if (Main.rand.Next(175) == 0)
                {
                    int num34 = Main.rand.Next(3);
                    if (num34 == 0)
                    {
                        DropLoot(this.position, this.width, this.height, 956, 1, false, -1, false, false);
                    }
                    else if (num34 == 1)
                    {
                        DropLoot(this.position, this.width, this.height, 957, 1, false, -1, false, false);
                    }
                    else
                    {
                        DropLoot(this.position, this.width, this.height, 958, 1, false, -1, false, false);
                    }
                }
            }
            else if (this.type == 42 || this.type == 43 || (this.type >= 231 && this.type <= 235))
            {
                if (Main.rand.Next(100) == 0)
                {
                    int num35 = Main.rand.Next(3);
                    if (num35 == 0)
                    {
                        DropLoot(this.position, this.width, this.height, 960, 1, false, -1, false, false);
                    }
                    else if (num35 == 1)
                    {
                        DropLoot(this.position, this.width, this.height, 961, 1, false, -1, false, false);
                    }
                    else
                    {
                        DropLoot(this.position, this.width, this.height, 962, 1, false, -1, false, false);
                    }
                }
            }
            else if (this.type == 31 || this.type == 32 || this.type == 294 || this.type == 295 || this.type == 296)
            {
                if (Main.rand.Next(450) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 959, 1, false, -1, false, false);
                }
                if (Main.rand.Next(300) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 1307, 1, false, -1, false, false);
                }
            }
            if ((this.type == 174 || this.type == 179 || this.type == 182 || this.type == 183) && Main.rand.Next(200) == 0)
            {
                DropLoot(this.position, this.width, this.height, 996, 1, false, 0, false, false);
            }
            if (this.type == 101 || this.type == 98)
            {
                DropLoot(this.position, this.width, this.height, 522, Main.rand.Next(2, 6), false, 0, false, false);
            }
            if (this.type == 86)
            {
                DropLoot(this.position, this.width, this.height, 526, 1, false, 0, false, false);
                if (Main.rand.Next(100) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 856, 1, false, 0, false, false);
                }
            }
            if (this.type == 186 || this.type == 432)
            {
                DropLoot(this.position, this.width, this.height, 40, Main.rand.Next(1, 10), false, 0, false, false);
            }
            if (this.type == 225)
            {
                if (Main.rand.Next(45) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 1243, 1, false, 0, false, false);
                }
                else
                {
                    DropLoot(this.position, this.width, this.height, 23, Main.rand.Next(2, 7), false, 0, false, false);
                }
            }
            if (this.type == 537)
            {
                int num36 = Main.rand.Next(1, 3);
                if (Main.expertMode)
                {
                    if (this.netID == -7)
                    {
                        num36++;
                    }
                    if (this.netID == -8 || this.netID == -9)
                    {
                        num36 += Main.rand.Next(2);
                    }
                }
                DropLoot(this.position, this.width, this.height, 23, num36, false, 0, false, false);
                int num37 = 8000;
                if (Main.expertMode)
                {
                    num37 = (int)((double)num37 * 0.7);
                }
                if (Main.rand.Next(num37) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 1309, 1, false, -1, false, false);
                }
            }
            if (this.type >= 333 && this.type <= 336 && Main.rand.Next(20) == 0)
            {
                DropLoot(this.position, this.width, this.height, 1906, 1, false, 0, false, false);
            }
            if (this.netID == -4)
            {
                DropLoot(this.position, this.width, this.height, 3111, Main.rand.Next(25, 51), false, 0, false, false);
                int num38 = 100;
                if (Main.expertMode)
                {
                    num38 = (int)((double)num38 * 0.7);
                }
                if (Main.rand.Next(num38) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 1309, 1, false, -1, false, false);
                }
            }
            else if (this.type == 1 || this.type == 16 || this.type == 138 || this.type == 141 || this.type == 147 || this.type == 184 || this.type == 187 || this.type == 204 || this.type == 302 || (this.type >= 333 && this.type <= 336) || this.type == 535)
            {
                int num39 = Main.rand.Next(1, 3);
                if (Main.expertMode)
                {
                    if (this.netID == -7)
                    {
                        num39++;
                    }
                    if (this.netID == -8 || this.netID == -9)
                    {
                        num39 += Main.rand.Next(2);
                    }
                }

                Vector2 position = this.position;
                int width = this.width;
                int height = this.height;
                int ID = 23;
                bool broadcast = false;
                int prefix = 0;
                bool nodelay = false;
                bool reverseLookup = false;
                if (!ServerApi.Hooks.InvokeNpcLootDrop(ref position, ref width, ref height, ref ID, ref num39, ref broadcast, ref prefix, type, whoAmI, ref nodelay, ref reverseLookup))
                {
                    int num40 = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 23, num39, false, 0, false, false);
                    if (this.netID <= 1 && this.netID != -1 && this.netID != -2 && this.netID != -5 && this.netID != -6)
                    {
                        Main.item[num40].color = this.color;
                        NetMessage.SendData(88, -1, -1, "", num40, 1f, 0f, 0f, 0, 0, 0);
                    }
                }
                int num41 = 10000;
                if (Main.expertMode)
                {
                    num41 = (int)((double)num41 * 0.7);
                }
                if (Main.rand.Next(num41) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 1309, 1, false, -1, false, false);
                }
            }
            if (this.type == 75)
            {
                DropLoot(this.position, this.width, this.height, 501, Main.rand.Next(1, 4), false, 0, false, false);
            }
            if (this.type == 81 || this.type == 183)
            {
                DropLoot(this.position, this.width, this.height, 23, Main.rand.Next(2, 5), false, 0, false, false);
            }
            if (this.type == 122)
            {
                DropLoot(this.position, this.width, this.height, 23, Main.rand.Next(5, 11), false, 0, false, false);
            }
            if (this.type == 71)
            {
                DropLoot(this.position, this.width, this.height, 327, 1, false, 0, false, false);
            }
            if (this.type == 2 || this.type == 317 || this.type == 318 || this.type == 190 || this.type == 191 || this.type == 192 || this.type == 193 || this.type == 194 || this.type == 133)
            {
                if (Main.rand.Next(3) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 38, 1, false, 0, false, false);
                }
                else if (Main.rand.Next(100) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 236, 1, false, 0, false, false);
                }
            }
            if (this.type == 104 && Main.rand.Next(60) == 0)
            {
                DropLoot(this.position, this.width, this.height, 485, 1, false, -1, false, false);
            }
            if (this.type == 58)
            {
                if (Main.rand.Next(250) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 263, 1, false, 0, false, false);
                }
                else if (Main.rand.Next(30) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 118, 1, false, 0, false, false);
                }
            }
            if (this.type == 102 && Main.rand.Next(250) == 0)
            {
                DropLoot(this.position, this.width, this.height, 263, 1, false, 0, false, false);
            }
            if (this.type == 3 || this.type == 331 || this.type == 332 || this.type == 132 || this.type == 161 || this.type == 186 || this.type == 187 || this.type == 188 || this.type == 189 || this.type == 200 || this.type == 223 || this.type == 319 || this.type == 320 || this.type == 321 || (this.type >= 430 && this.type <= 436))
            {
                if (Main.rand.Next(50) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 216, 1, false, -1, false, false);
                }
                if (Main.rand.Next(250) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 1304, 1, false, -1, false, false);
                }
            }
            if ((this.type == 489 || this.type == 490) && (Main.expertMode || Main.rand.Next(2) == 0))
            {
                if (Main.rand.Next(75) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 3212, 1, false, -1, false, false);
                }
                if (Main.rand.Next(100) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 3213, 1, false, -1, false, false);
                }
            }
            if (this.type == 223 && Main.rand.Next(20) == 0)
            {
                if (Main.rand.Next(2) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 1135, 1, false, -1, false, false);
                }
                else
                {
                    DropLoot(this.position, this.width, this.height, 1136, 1, false, -1, false, false);
                }
            }
            if (this.type == 66)
            {
                DropLoot(this.position, this.width, this.height, 267, 1, false, 0, false, false);
            }
            if ((this.type == 62 || this.type == 66) && Main.rand.Next(35) == 0)
            {
                DropLoot(this.position, this.width, this.height, 272, 1, false, -1, false, false);
            }
            if (this.value > 0f && Main.hardMode && (double)(this.position.Y / 16f) < Main.worldSurface + 10.0 && (base.Center.X / 16f < 380f || base.Center.X / 16f > (float)(Main.maxTilesX - 380)) && Main.rand.Next(100) == 0)
            {
                DropLoot(this.position, this.width, this.height, 1315, 1, false, 0, false, false);
            }
            if (this.type == 52)
            {
                DropLoot(this.position, this.width, this.height, 251, 1, false, 0, false, false);
            }
            if (this.type == 53)
            {
                DropLoot(this.position, this.width, this.height, 239, 1, false, 0, false, false);
            }
            if (this.type == 536)
            {
                DropLoot(this.position, this.width, this.height, 3478, 1, false, 0, false, false);
                DropLoot(this.position, this.width, this.height, 3479, 1, false, 0, false, false);
            }
            if (this.type == 54)
            {
                DropLoot(this.position, this.width, this.height, 260, 1, false, 0, false, false);
            }
            if (this.type == 368)
            {
                DropLoot(this.position, this.width, this.height, 2222, 1, false, 0, false, false);
            }
            if ((this.type == 69 || this.type == 509 || this.type == 508) && Main.rand.Next(3) == 0)
            {
                DropLoot(this.position, this.width, this.height, 323, Main.rand.Next(1, 3), false, 0, false, false);
            }
            if (this.type == 73)
            {
                DropLoot(this.position, this.width, this.height, 362, Main.rand.Next(1, 3), false, 0, false, false);
            }
            if ((this.type == 483 || this.type == 482) && Main.rand.Next(30) == 0)
            {
                DropLoot(this.position, this.width, this.height, 3109, 1, false, 0, false, false);
            }
            if ((this.type == 6 || this.type == 94) && Main.rand.Next(3) == 0)
            {
                DropLoot(this.position, this.width, this.height, 68, 1, false, 0, false, false);
            }
            if ((this.type == 181 || this.type == 173 || this.type == 239 || this.type == 182 || this.type == 240) && Main.rand.Next(3) == 0)
            {
                DropLoot(this.position, this.width, this.height, 1330, 1, false, 0, false, false);
            }
            if (this.type == 7 || this.type == 8 || this.type == 9)
            {
                if (Main.rand.Next(3) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 68, Main.rand.Next(1, 3), false, 0, false, false);
                }
                DropLoot(this.position, this.width, this.height, 69, Main.rand.Next(3, 9), false, 0, false, false);
            }
            if ((this.type == 10 || this.type == 11 || this.type == 12 || this.type == 95 || this.type == 96 || this.type == 97) && (Main.rand.Next(50) == 0 || (Main.expertMode && Main.rand.Next(50) == 0)))
            {
                DropLoot(this.position, this.width, this.height, 215, 1, false, 0, false, false);
            }
            if (this.type == 47 && Main.rand.Next(75) == 0)
            {
                DropLoot(this.position, this.width, this.height, 243, 1, false, 0, false, false);
            }
            if (this.type == 4)
            {
                if (Main.expertMode)
                {
                    this.DropBossBags();
                }
                else
                {
                    if (Main.rand.Next(7) == 0)
                    {
                        DropLoot(this.position, this.width, this.height, 2112, 1, false, -1, false, false);
                    }
                    if (Main.rand.Next(40) == 0 || (Main.expertMode && Main.rand.Next(20) == 0))
                    {
                        DropLoot(this.position, this.width, this.height, 1299, 1, false, 0, false, false);
                    }
                    if (Main.expertMode)
                    {
                        DropLoot(this.position, this.width, this.height, 3097, 1, false, -1, false, false);
                    }
                    int num42 = 1;
                    if (Main.expertMode)
                    {
                        num42 = 2;
                    }
                    for (int n = 0; n < num42; n++)
                    {
                        if (WorldGen.crimson)
                        {
                            int stack = Main.rand.Next(20) + 10;
                            DropLoot(this.position, this.width, this.height, 880, stack, false, 0, false, false);
                            stack = Main.rand.Next(20) + 10;
                            DropLoot(this.position, this.width, this.height, 880, stack, false, 0, false, false);
                            stack = Main.rand.Next(20) + 10;
                            DropLoot(this.position, this.width, this.height, 880, stack, false, 0, false, false);
                            stack = Main.rand.Next(3) + 1;
                            DropLoot(this.position, this.width, this.height, 2171, stack, false, 0, false, false);
                        }
                        else
                        {
                            int stack2 = Main.rand.Next(30) + 20;
                            DropLoot(this.position, this.width, this.height, 47, stack2, false, 0, false, false);
                            stack2 = Main.rand.Next(20) + 10;
                            DropLoot(this.position, this.width, this.height, 56, stack2, false, 0, false, false);
                            stack2 = Main.rand.Next(20) + 10;
                            DropLoot(this.position, this.width, this.height, 56, stack2, false, 0, false, false);
                            stack2 = Main.rand.Next(20) + 10;
                            DropLoot(this.position, this.width, this.height, 56, stack2, false, 0, false, false);
                            stack2 = Main.rand.Next(3) + 1;
                            DropLoot(this.position, this.width, this.height, 59, stack2, false, 0, false, false);
                        }
                    }
                }
            }
            if (this.type == 266)
            {
                if (Main.expertMode)
                {
                    this.DropBossBags();
                }
                else
                {
                    int stack3 = Main.rand.Next(20, 46);
                    DropLoot(this.position, this.width, this.height, 880, stack3, false, 0, false, false);
                    stack3 = Main.rand.Next(20, 46);
                    DropLoot(this.position, this.width, this.height, 880, stack3, false, 0, false, false);
                    if (Main.expertMode)
                    {
                        stack3 = Main.rand.Next(30, 51);
                        DropLoot(this.position, this.width, this.height, 880, stack3, false, 0, false, false);
                        stack3 = Main.rand.Next(30, 51);
                        DropLoot(this.position, this.width, this.height, 880, stack3, false, 0, false, false);
                    }
                    if (Main.rand.Next(7) == 0)
                    {
                        DropLoot(this.position, this.width, this.height, 2104, 1, false, -1, false, false);
                    }
                    if (Main.rand.Next(20) == 0)
                    {
                        DropLoot(this.position, this.width, this.height, 3060, 1, false, 0, false, false);
                    }
                    if (Main.expertMode)
                    {
                        DropLoot(this.position, this.width, this.height, 3223, 1, false, 0, false, false);
                    }
                }
            }
            if (this.type == 267 && NPC.AnyNPCs(266))
            {
                int num43 = Main.rand.Next(2, 6);
                if (Main.rand.Next(3) != 0)
                {
                    if (Main.expertMode)
                    {
                        num43 += Main.rand.Next(2, 6);
                    }
                    DropLoot(this.position, this.width, this.height, 1329, num43, false, 0, false, false);
                }
                if (Main.rand.Next(3) != 0)
                {
                    num43 = Main.rand.Next(5, 13);
                    if (Main.expertMode)
                    {
                        num43 += Main.rand.Next(6, 14);
                    }
                    DropLoot(this.position, this.width, this.height, 880, num43, false, 0, false, false);
                }
                if (Main.rand.Next(2) == 0 && Main.player[(int)Player.FindClosest(this.position, this.width, this.height)].statLife < Main.player[(int)Player.FindClosest(this.position, this.width, this.height)].statLifeMax2)
                {
                    DropLoot(this.position, this.width, this.height, 58, 1, false, 0, false, false);
                }
            }
            if (this.type == 13 || this.type == 14 || this.type == 15)
            {
                int num44 = Main.rand.Next(1, 3);
                if (Main.rand.Next(2) == 0)
                {
                    if (Main.expertMode)
                    {
                        num44++;
                    }
                    DropLoot(this.position, this.width, this.height, 86, num44, false, 0, false, false);
                }
                if (Main.rand.Next(2) == 0)
                {
                    num44 = Main.rand.Next(2, 6);
                    DropLoot(this.position, this.width, this.height, 56, num44, false, 0, false, false);
                }
                if (this.boss)
                {
                    if (Main.expertMode)
                    {
                        this.DropBossBags();
                    }
                    else
                    {
                        num44 = Main.rand.Next(10, 30);
                        DropLoot(this.position, this.width, this.height, 56, num44, false, 0, false, false);
                        num44 = Main.rand.Next(10, 31);
                        DropLoot(this.position, this.width, this.height, 56, num44, false, 0, false, false);
                        if (Main.expertMode)
                        {
                            num44 = Main.rand.Next(10, 30);
                            DropLoot(this.position, this.width, this.height, 56, num44, false, 0, false, false);
                            num44 = Main.rand.Next(10, 31);
                            DropLoot(this.position, this.width, this.height, 56, num44, false, 0, false, false);
                        }
                        if (Main.expertMode)
                        {
                            DropLoot(this.position, this.width, this.height, 3224, 1, false, 0, false, false);
                        }
                        if (Main.rand.Next(20) == 0)
                        {
                            DropLoot(this.position, this.width, this.height, 994, 1, false, 0, false, false);
                        }
                        if (Main.rand.Next(7) == 0)
                        {
                            DropLoot(this.position, this.width, this.height, 2111, 1, false, -1, false, false);
                        }
                    }
                }
                if (Main.rand.Next(4) == 0 && Main.player[(int)Player.FindClosest(this.position, this.width, this.height)].statLife < Main.player[(int)Player.FindClosest(this.position, this.width, this.height)].statLifeMax2)
                {
                    DropLoot(this.position, this.width, this.height, 58, 1, false, 0, false, false);
                }
            }
            if (this.type == 222)
            {
                if (Main.expertMode)
                {
                    this.DropBossBags();
                }
                else
                {
                    if (Main.rand.Next(7) == 0)
                    {
                        DropLoot(this.position, this.width, this.height, 2108, 1, false, -1, false, false);
                    }
                    int num45 = Main.rand.Next(3);
                    if (num45 == 0)
                    {
                        num45 = 1121;
                    }
                    else if (num45 == 1)
                    {
                        num45 = 1123;
                    }
                    else if (num45 == 2)
                    {
                        num45 = 2888;
                    }
                    DropLoot(this.position, this.width, this.height, num45, 1, false, -1, false, false);
                    if (Main.expertMode)
                    {
                        int num46 = Main.rand.Next(3);
                        if (num46 == 0)
                        {
                            num46 = 1121;
                        }
                        else if (num46 == 1)
                        {
                            num46 = 1123;
                        }
                        else if (num46 == 2)
                        {
                            num46 = 2888;
                        }
                        while (num46 == num45)
                        {
                            num46 = Main.rand.Next(3);
                            if (num46 == 0)
                            {
                                num46 = 1121;
                            }
                            else if (num46 == 1)
                            {
                                num46 = 1123;
                            }
                            else if (num46 == 2)
                            {
                                num46 = 2888;
                            }
                        }
                        DropLoot(this.position, this.width, this.height, num46, 1, false, -1, false, false);
                        DropLoot(this.position, this.width, this.height, 1132, 1, false, -1, false, false);
                    }
                    else if (Main.rand.Next(3) == 0)
                    {
                        DropLoot(this.position, this.width, this.height, 1132, 1, false, -1, false, false);
                    }
                    if ((Main.expertMode && Main.rand.Next(15) == 0) || Main.rand.Next(15) == 0)
                    {
                        DropLoot(this.position, this.width, this.height, 1170, 1, false, 0, false, false);
                    }
                    if ((Main.expertMode && Main.rand.Next(20) == 0) || Main.rand.Next(20) == 0)
                    {
                        DropLoot(this.position, this.width, this.height, 2502, 1, false, 0, false, false);
                    }
                    if (Main.expertMode)
                    {
                        DropLoot(this.position, this.width, this.height, 1129, 1, false, 0, false, false);
                        DropLoot(this.position, this.width, this.height, Main.rand.Next(842, 845), 1, false, 0, false, false);
                    }
                    else if (Main.rand.Next(3) == 0)
                    {
                        DropLoot(this.position, this.width, this.height, 1129, 1, false, 0, false, false);
                    }
                    else if (Main.rand.Next(2) == 0)
                    {
                        DropLoot(this.position, this.width, this.height, Main.rand.Next(842, 845), 1, false, 0, false, false);
                    }
                    if (Main.rand.Next(4) != 0 || Main.expertMode)
                    {
                        DropLoot(this.position, this.width, this.height, 1130, Main.rand.Next(10, 30), false, 0, false, false);
                        if (Main.expertMode)
                        {
                            DropLoot(this.position, this.width, this.height, 1130, Main.rand.Next(10, 30), false, 0, false, false);
                        }
                    }
                    if (Main.expertMode)
                    {
                        DropLoot(this.position, this.width, this.height, 2431, Main.rand.Next(44, 67), false, 0, false, false);
                    }
                    else
                    {
                        DropLoot(this.position, this.width, this.height, 2431, Main.rand.Next(16, 27), false, 0, false, false);
                    }
                }
                NPC.downedQueenBee = true;
                if (Main.netMode == 2)
                {
                    NetMessage.SendData(7, -1, -1, "", 0, 0f, 0f, 0f, 0, 0, 0);
                }
            }
            if (this.type == 35)
            {
                if (Main.expertMode)
                {
                    this.DropBossBags();
                }
                else if (Main.rand.Next(7) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 1281, 1, false, -1, false, false);
                }
                else if (Main.rand.Next(7) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 1273, 1, false, -1, false, false);
                }
                else if (Main.rand.Next(7) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 1313, 1, false, -1, false, false);
                }
            }
            if (this.type == 113)
            {
                if (Main.expertMode)
                {
                    this.DropBossBags();
                }
                else
                {
                    if (Main.rand.Next(7) == 0)
                    {
                        DropLoot(this.position, this.width, this.height, 2105, 1, false, -1, false, false);
                    }
                    DropLoot(this.position, this.width, this.height, 367, 1, false, -1, false, false);
                    if (Main.expertMode)
                    {
                        int num47 = Main.rand.Next(4);
                        if (num47 == 3)
                        {
                            num47 = 2998;
                        }
                        else
                        {
                            num47 = 489 + num47;
                        }
                        DropLoot(this.position, this.width, this.height, num47, 1, false, -1, false, false);
                        int num48 = Main.rand.Next(3);
                        if (num48 == 0)
                        {
                            DropLoot(this.position, this.width, this.height, 514, 1, false, -1, false, false);
                        }
                        else if (num48 == 1)
                        {
                            DropLoot(this.position, this.width, this.height, 426, 1, false, -1, false, false);
                        }
                        else if (num48 == 2)
                        {
                            DropLoot(this.position, this.width, this.height, 434, 1, false, -1, false, false);
                        }
                    }
                    else if (Main.rand.Next(2) == 0)
                    {
                        int num49 = Main.rand.Next(4);
                        if (num49 == 3)
                        {
                            num49 = 2998;
                        }
                        else
                        {
                            num49 = 489 + num49;
                        }
                        DropLoot(this.position, this.width, this.height, num49, 1, false, -1, false, false);
                    }
                    else
                    {
                        int num50 = Main.rand.Next(3);
                        if (num50 == 0)
                        {
                            DropLoot(this.position, this.width, this.height, 514, 1, false, -1, false, false);
                        }
                        else if (num50 == 1)
                        {
                            DropLoot(this.position, this.width, this.height, 426, 1, false, -1, false, false);
                        }
                        else if (num50 == 2)
                        {
                            DropLoot(this.position, this.width, this.height, 434, 1, false, -1, false, false);
                        }
                    }
                }
                if (Main.netMode != 1)
                {
                    int num51 = (int)(this.position.X + (float)(this.width / 2)) / 16;
                    int num52 = (int)(this.position.Y + (float)(this.height / 2)) / 16;
                    int num53 = this.width / 2 / 16 + 1;
                    for (int num54 = num51 - num53; num54 <= num51 + num53; num54++)
                    {
                        for (int num55 = num52 - num53; num55 <= num52 + num53; num55++)
                        {
                            if ((num54 == num51 - num53 || num54 == num51 + num53 || num55 == num52 - num53 || num55 == num52 + num53) && !Main.tile[num54, num55].active())
                            {
                                Main.tile[num54, num55].type = (ushort)(WorldGen.crimson ? 347 : 140);
                                Main.tile[num54, num55].active(true);
                            }
                            Main.tile[num54, num55].lava(false);
                            Main.tile[num54, num55].liquid = 0;
                            if (Main.netMode == 2)
                            {
                                NetMessage.SendTileSquare(-1, num54, num55, 1);
                            }
                            else
                            {
                                WorldGen.SquareTileFrame(num54, num55, true);
                            }
                        }
                    }
                }
            }
            if (this.type == 439)
            {
                NPC.downedAncientCultist = true;
                if (Main.rand.Next(7) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 3372, 1, false, -1, false, false);
                }
                DropLoot(this.position, this.width, this.height, 3549, 1, false, -1, false, false);
                WorldGen.TriggerLunarApocalypse();
            }
            if (this.type == 398)
            {
                NPC.downedMoonlord = true;
                NPC.LunarApocalypseIsUp = false;
                if (Main.expertMode)
                {
                    this.DropBossBags();
                }
                else
                {
                    if (Main.rand.Next(7) == 0)
                    {
                        DropLoot(this.position, this.width, this.height, 3373, 1, false, -1, false, false);
                    }
                    DropLoot(this.position, this.width, this.height, 3384, 1, false, -1, false, false);
                    DropLoot(this.position, this.width, this.height, 3460, Main.rand.Next(70, 91), false, -1, false, false);
                    int num56 = Utils.SelectRandom<int>(Main.rand, new int[]
                    {
                        3063,
                        3389,
                        3065,
                        1553,
                        3546,
                        3541,
                        3570,
                        3571,
                        3569
                    });
                    DropLoot(this.position, this.width, this.height, num56, 1, false, -1, false, false);
                }
            }
            num = this.type;
            if (num <= 493)
            {
                switch (num)
                {
                case 402:
                case 405:
                case 407:
                case 409:
                case 411:
                    if ((this.type != 406 || Main.rand.Next(3) == 0) && NPC.ShieldStrengthTowerStardust > 0)
                    {
                        Projectile.NewProjectile(base.Center.X, base.Center.Y, 0f, 0f, 629, 0, 0f, Main.myPlayer, (float)NPC.FindFirstNPC(493), 0f);
                        goto IL_90BA;
                    }
                    goto IL_90BA;
                case 403:
                case 404:
                case 406:
                case 408:
                case 410:
                case 428:
                    goto IL_90BA;
                case 412:
                case 413:
                case 414:
                case 415:
                case 416:
                case 417:
                case 418:
                case 419:
                    break;
                case 420:
                case 421:
                case 423:
                case 424:
                    if (NPC.ShieldStrengthTowerNebula > 0)
                    {
                        Projectile.NewProjectile(base.Center.X, base.Center.Y, 0f, 0f, 629, 0, 0f, Main.myPlayer, (float)NPC.FindFirstNPC(507), 0f);
                        goto IL_90BA;
                    }
                    goto IL_90BA;
                case 422:
                {
                    int num57 = Main.rand.Next(25, 41) / 2;
                    if (Main.expertMode)
                    {
                        num57 = (int)((float)num57 * 1.5f);
                    }
                    for (int num58 = 0; num58 < num57; num58++)
                    {
                        DropLoot(new Vector2((int)this.position.X + Main.rand.Next(this.width), (int)this.position.Y + Main.rand.Next(this.height)), 2, 2, 3456, Main.rand.Next(1, 4), false, 0, false, false);
                    }
                    NPC.downedTowerVortex = true;
                    NPC.TowerActiveVortex = false;
                    WorldGen.UpdateLunarApocalypse();
                    WorldGen.MessageLunarApocalypse();
                    goto IL_90BA;
                }
                case 425:
                case 426:
                case 427:
                case 429:
                    if (NPC.ShieldStrengthTowerVortex > 0)
                    {
                        Projectile.NewProjectile(base.Center.X, base.Center.Y, 0f, 0f, 629, 0, 0f, Main.myPlayer, (float)NPC.FindFirstNPC(422), 0f);
                        goto IL_90BA;
                    }
                    goto IL_90BA;
                default:
                {
                    if (num != 493)
                    {
                        goto IL_90BA;
                    }
                    int num59 = Main.rand.Next(25, 41) / 2;
                    if (Main.expertMode)
                    {
                        num59 = (int)((float)num59 * 1.5f);
                    }
                    for (int num60 = 0; num60 < num59; num60++)
                    {
                        DropLoot(new Vector2((int)this.position.X + Main.rand.Next(this.width), (int)this.position.Y + Main.rand.Next(this.height)), 2, 2, 3459, Main.rand.Next(1, 4), false, 0, false, false);
                    }
                    NPC.downedTowerStardust = true;
                    NPC.TowerActiveStardust = false;
                    WorldGen.UpdateLunarApocalypse();
                    WorldGen.MessageLunarApocalypse();
                    goto IL_90BA;
                }
                }
            }
            else
            {
                if (num == 507)
                {
                    int num61 = Main.rand.Next(25, 41) / 2;
                    if (Main.expertMode)
                    {
                        num61 = (int)((float)num61 * 1.5f);
                    }
                    for (int num62 = 0; num62 < num61; num62++)
                    {
                        DropLoot(new Vector2((int)this.position.X + Main.rand.Next(this.width), (int)this.position.Y + Main.rand.Next(this.height)), 2, 2, 3457, Main.rand.Next(1, 4), false, 0, false, false);
                    }
                    NPC.downedTowerNebula = true;
                    NPC.TowerActiveNebula = false;
                    WorldGen.UpdateLunarApocalypse();
                    WorldGen.MessageLunarApocalypse();
                    goto IL_90BA;
                }
                switch (num)
                {
                case 517:
                {
                    int num63 = Main.rand.Next(25, 41) / 2;
                    if (Main.expertMode)
                    {
                        num63 = (int)((float)num63 * 1.5f);
                    }
                    for (int num64 = 0; num64 < num63; num64++)
                    {
                        DropLoot(new Vector2((int)this.position.X + Main.rand.Next(this.width), (int)this.position.Y + Main.rand.Next(this.height)), 2, 2, 3458, Main.rand.Next(1, 4), false, 0, false, false);
                    }
                    NPC.downedTowerSolar = true;
                    NPC.TowerActiveSolar = false;
                    WorldGen.UpdateLunarApocalypse();
                    WorldGen.MessageLunarApocalypse();
                    goto IL_90BA;
                }
                case 518:
                    break;
                default:
                    goto IL_90BA;
                }
            }
            if (NPC.ShieldStrengthTowerSolar > 0)
            {
                Projectile.NewProjectile(base.Center.X, base.Center.Y, 0f, 0f, 629, 0, 0f, Main.myPlayer, (float)NPC.FindFirstNPC(517), 0f);
            }
            IL_90BA:
            num = this.type;
            switch (num)
            {
            case 381:
            case 382:
            case 383:
            case 385:
            case 386:
            case 389:
            case 390:
                break;
            case 384:
            case 387:
            case 388:
                goto IL_914D;
            default:
                if (num != 520)
                {
                    goto IL_914D;
                }
                break;
            }
            if (Main.rand.Next(8) == 0)
            {
                DropLoot(this.position, this.width, this.height, 2860, Main.rand.Next(8, 21), false, 0, false, false);
            }
            IL_914D:
            num = this.type;
            if (num == 383 || num == 386 || num == 389)
            {
                if (Main.rand.Next(200) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 2806, 1, false, 0, false, false);
                }
                if (Main.rand.Next(200) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 2807, 1, false, 0, false, false);
                }
                if (Main.rand.Next(200) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 2808, 1, false, 0, false, false);
                }
            }
            num = this.type;
            switch (num)
            {
            case 381:
            case 382:
            case 385:
                break;
            case 383:
            case 384:
                goto IL_9346;
            default:
                if (num != 390)
                {
                    goto IL_9346;
                }
                break;
            }
            if (Main.rand.Next(200) == 0)
            {
                DropLoot(this.position, this.width, this.height, 2803, 1, false, 0, false, false);
            }
            if (Main.rand.Next(200) == 0)
            {
                DropLoot(this.position, this.width, this.height, 2804, 1, false, 0, false, false);
            }
            if (Main.rand.Next(200) == 0)
            {
                DropLoot(this.position, this.width, this.height, 2805, 1, false, 0, false, false);
            }
            IL_9346:
            if (this.type == 395)
            {
                DropLoot(this.position, this.width, this.height, Utils.SelectRandom<int>(Main.rand, new int[]
                {
                    2797,
                    2749,
                    2795,
                    2798,
                    2796,
                    2882,
                    2880,
                    2769,
                    2800
                }), 1, false, 0, false, false);
            }
            if (this.type == 390 && Main.rand.Next(100) == 0)
            {
                DropLoot(this.position, this.width, this.height, 2771, 1, false, 0, false, false);
            }
            if ((this.type == 116 || this.type == 117 || this.type == 118 || this.type == 119) && (!Main.expertMode || Main.rand.Next(5) == 0))
            {
                DropLoot(this.position, this.width, this.height, 58, 1, false, 0, false, false);
            }
            if (this.type == 139 && Main.rand.Next(2) == 0)
            {
                DropLoot(this.position, this.width, this.height, 58, 1, false, 0, false, false);
            }
            if (this.type == 63 || this.type == 64 || this.type == 103)
            {
                if (Main.rand.Next(100) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 1303, 1, false, -1, false, false);
                }
                DropLoot(this.position, this.width, this.height, 282, Main.rand.Next(1, 5), false, 0, false, false);
            }
            if (this.type == 481 && Main.rand.Next(2) == 0)
            {
                DropLoot(this.position, this.width, this.height, 3094, Main.rand.Next(40, 81), false, 0, false, false);
            }
            if (this.type == 481 && Main.rand.Next(20) == 0)
            {
                DropLoot(this.position, this.width, this.height, 3187 + Main.rand.Next(3), 1, false, 0, false, false);
            }
            if (this.type == 21 || this.type == 44 || this.type == 167 || this.type == 201 || this.type == 202 || this.type == 481 || this.type == 203 || this.type == 322 || this.type == 323 || this.type == 324 || (this.type >= 449 && this.type <= 452))
            {
                if (Main.rand.Next(25) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 118, 1, false, 0, false, false);
                }
                else if (this.type == 44)
                {
                    if (Main.rand.Next(20) == 0)
                    {
                        DropLoot(this.position, this.width, this.height, Main.rand.Next(410, 412), 1, false, 0, false, false);
                    }
                    else
                    {
                        DropLoot(this.position, this.width, this.height, 166, Main.rand.Next(1, 4), false, 0, false, false);
                    }
                }
            }
            if (this.type == 45)
            {
                DropLoot(this.position, this.width, this.height, 238, 1, false, 0, false, false);
            }
            if (this.type == 50)
            {
                if (Main.slimeRain)
                {
                    Main.StopSlimeRain(true);
                    AchievementsHelper.NotifyProgressionEvent(16);
                }
                if (Main.expertMode)
                {
                    this.DropBossBags();
                }
                else
                {
                    if (Main.rand.Next(4) == 0)
                    {
                        DropLoot(this.position, this.width, this.height, 2430, 1, false, 0, false, false);
                    }
                    if (Main.rand.Next(7) == 0)
                    {
                        DropLoot(this.position, this.width, this.height, 2493, 1, false, -1, false, false);
                    }
                    DropLoot(this.position, this.width, this.height, Main.rand.Next(256, 259), 1, false, 0, false, false);
                    Main.rand.Next(2);
                    if (Main.rand.Next(3) == 0)
                    {
                        DropLoot(this.position, this.width, this.height, 2585, 1, false, 0, false, false);
                    }
                    else
                    {
                        DropLoot(this.position, this.width, this.height, 2610, 1, false, 0, false, false);
                    }
                    DropLoot(this.position, this.width, this.height, 998, 1, false, 0, false, false);
                }
                NPC.downedSlimeKing = true;
                if (Main.netMode == 2)
                {
                    NetMessage.SendData(7, -1, -1, "", 0, 0f, 0f, 0f, 0, 0, 0);
                }
            }
            if (this.type == 23 && Main.rand.Next(50) == 0)
            {
                DropLoot(this.position, this.width, this.height, 116, 1, false, 0, false, false);
            }
            if (this.type == 24 && Main.rand.Next(250) == 0)
            {
                DropLoot(this.position, this.width, this.height, 244, 1, false, 0, false, false);
            }
            if (this.type == 31 || this.type == 32 || this.type == 34)
            {
                if (Main.rand.Next(250) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 932, 1, false, 0, false, false);
                }
                else if (Main.rand.Next(100) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 3095, 1, false, 0, false, false);
                }
                else if (Main.rand.Next(65) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 327, 1, false, 0, false, false);
                }
                else if (!Main.expertMode)
                {
                    DropLoot(this.position, this.width, this.height, 154, Main.rand.Next(1, 4), false, 0, false, false);
                }
                if (Main.expertMode)
                {
                    DropLoot(this.position, this.width, this.height, 154, Main.rand.Next(2, 7), false, 0, false, false);
                }
            }
            if (this.type == 26 || this.type == 27 || this.type == 28 || this.type == 29 || this.type == 111)
            {
                if (Main.rand.Next(200) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 160, 1, false, 0, false, false);
                }
                else if (Main.rand.Next(2) == 0)
                {
                    int stack4 = Main.rand.Next(1, 6);
                    DropLoot(this.position, this.width, this.height, 161, stack4, false, 0, false, false);
                }
            }
            if (this.type == 175 && Main.rand.Next(100) == 0)
            {
                DropLoot(this.position, this.width, this.height, 1265, 1, false, -1, false, false);
            }
            if ((this.type == 42 || (this.type >= 231 && this.type <= 235)) && (Main.expertMode || Main.rand.Next(3) != 0))
            {
                DropLoot(this.position, this.width, this.height, 209, 1, false, 0, false, false);
            }
            if (this.type == 204 && (Main.expertMode || Main.rand.Next(2) == 0))
            {
                DropLoot(this.position, this.width, this.height, 209, 1, false, 0, false, false);
            }
            if (this.type == 43 && (Main.expertMode || Main.rand.Next(2) == 0))
            {
                DropLoot(this.position, this.width, this.height, 210, 1, false, 0, false, false);
            }
            if (this.type == 65)
            {
                if (Main.rand.Next(50) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 268, 1, false, 0, false, false);
                }
                else
                {
                    DropLoot(this.position, this.width, this.height, 319, 1, false, 0, false, false);
                }
            }
            if (this.type == 48 && Main.rand.Next(2) == 0)
            {
                DropLoot(this.position, this.width, this.height, 320, 1, false, 0, false, false);
            }
            if (this.type == 125 || this.type == 126)
            {
                int num65 = 125;
                if (this.type == 125)
                {
                    num65 = 126;
                }
                if (!NPC.AnyNPCs(num65))
                {
                    if (Main.expertMode)
                    {
                        this.DropBossBags();
                    }
                    else
                    {
                        if (Main.rand.Next(7) == 0)
                        {
                            DropLoot(this.position, this.width, this.height, 2106, 1, false, -1, false, false);
                        }
                        DropLoot(this.position, this.width, this.height, 549, Main.rand.Next(25, 41), false, 0, false, false);
                        DropLoot(this.position, this.width, this.height, 1225, Main.rand.Next(15, 31), false, 0, false, false);
                    }
                }
                else
                {
                    this.value = 0f;
                    this.boss = false;
                }
            }
            else if (Main.expertMode)
            {
                if (this.type == 127 || this.type == 134)
                {
                    this.DropBossBags();
                }
            }
            else if (this.type == 127)
            {
                if (Main.rand.Next(7) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 2107, 1, false, -1, false, false);
                }
                DropLoot(this.position, this.width, this.height, 547, Main.rand.Next(25, 41), false, 0, false, false);
                DropLoot(this.position, this.width, this.height, 1225, Main.rand.Next(15, 31), false, 0, false, false);
            }
            else if (this.type == 134)
            {
                if (Main.rand.Next(7) == 0)
                {
                    DropLoot(this.position, this.width, this.height, 2113, 1, false, -1, false, false);
                }
                DropLoot(this.position, this.width, this.height, 548, Main.rand.Next(25, 41), false, 0, false, false);
                DropLoot(this.position, this.width, this.height, 1225, Main.rand.Next(15, 31), false, 0, false, false);
            }
            if (this.type == 262)
            {
                if (Main.expertMode)
                {
                    this.DropBossBags();
                }
                else
                {
                    if (Main.rand.Next(7) == 0)
                    {
                        DropLoot(this.position, this.width, this.height, 2109, 1, false, -1, false, false);
                    }
                    if (Main.expertMode)
                    {
                        DropLoot(this.position, this.width, this.height, 1141, Main.rand.Next(2, 4), false, -1, false, false);
                    }
                    else
                    {
                        DropLoot(this.position, this.width, this.height, 1141, 1, false, -1, false, false);
                    }
                    if (Main.rand.Next(20) == 0)
                    {
                        DropLoot(this.position, this.width, this.height, 1182, 1, false, -1, false, false);
                    }
                    if (Main.rand.Next(50) == 0 || (Main.expertMode && Main.rand.Next(50) == 0))
                    {
                        DropLoot(this.position, this.width, this.height, 1305, 1, false, -1, false, false);
                    }
                    if (Main.rand.Next(4) == 0 || Main.expertMode)
                    {
                        DropLoot(this.position, this.width, this.height, 1157, 1, false, -1, false, false);
                    }
                    if (Main.rand.Next(10) == 0)
                    {
                        DropLoot(this.position, this.width, this.height, 3021, 1, false, -1, false, false);
                    }
                    int num66 = 1;
                    if (Main.expertMode)
                    {
                        num66 = 2;
                    }
                    int num67 = 0;
                    for (int num68 = 0; num68 < num66; num68++)
                    {
                        int num69 = Main.rand.Next(7);
                        if (!NPC.downedPlantBoss)
                        {
                            num69 = 0;
                        }
                        if (num68 == 0)
                        {
                            num67 = num69;
                        }
                        else
                        {
                            while (num67 == num69)
                            {
                                num69 = Main.rand.Next(7);
                            }
                        }
                        if (num69 == 0)
                        {
                            DropLoot(this.position, this.width, this.height, 758, 1, false, -1, false, false);
                            DropLoot(this.position, this.width, this.height, 771, Main.rand.Next(50, 150), false, 0, false, false);
                        }
                        else if (num69 == 1)
                        {
                            DropLoot(this.position, this.width, this.height, 1255, 1, false, -1, false, false);
                        }
                        else if (num69 == 2)
                        {
                            DropLoot(this.position, this.width, this.height, 788, 1, false, -1, false, false);
                        }
                        else if (num69 == 3)
                        {
                            DropLoot(this.position, this.width, this.height, 1178, 1, false, -1, false, false);
                        }
                        else if (num69 == 4)
                        {
                            DropLoot(this.position, this.width, this.height, 1259, 1, false, -1, false, false);
                        }
                        else if (num69 == 5)
                        {
                            DropLoot(this.position, this.width, this.height, 1155, 1, false, -1, false, false);
                        }
                        else if (num69 == 6)
                        {
                            DropLoot(this.position, this.width, this.height, 3018, 1, false, -1, false, false);
                        }
                    }
                }
                bool flag3 = NPC.downedPlantBoss;
                NPC.downedPlantBoss = true;
                if (!flag3)
                {
                    if (Main.netMode == 0)
                    {
                        Main.NewText(Lang.misc[33], 50, 255, 130, false);
                    }
                    else if (Main.netMode == 2)
                    {
                        NetMessage.SendData(25, -1, -1, Lang.misc[33], 255, 50f, 255f, 130f, 0, 0, 0);
                    }
                }
            }
            if ((this.boss || this.type == 125 || this.type == 126 || this.type == 491) && Main.rand.Next(10) == 0)
            {
                if (this.type == 4)
                {
                    DropLoot(this.position, this.width, this.height, 1360, 1, false, 0, false, false);
                }
                if (this.type == 13 || this.type == 14 || this.type == 15)
                {
                    DropLoot(this.position, this.width, this.height, 1361, 1, false, 0, false, false);
                }
                if (this.type == 266)
                {
                    DropLoot(this.position, this.width, this.height, 1362, 1, false, 0, false, false);
                }
                if (this.type == 35)
                {
                    DropLoot(this.position, this.width, this.height, 1363, 1, false, 0, false, false);
                }
                if (this.type == 222)
                {
                    DropLoot(this.position, this.width, this.height, 1364, 1, false, 0, false, false);
                }
                if (this.type == 113)
                {
                    DropLoot(this.position, this.width, this.height, 1365, 1, false, 0, false, false);
                }
                if (this.type == 134)
                {
                    DropLoot(this.position, this.width, this.height, 1366, 1, false, 0, false, false);
                }
                if (this.type == 127)
                {
                    DropLoot(this.position, this.width, this.height, 1367, 1, false, 0, false, false);
                }
                if (this.type == 125)
                {
                    DropLoot(this.position, this.width, this.height, 1368, 1, false, 0, false, false);
                }
                if (this.type == 126)
                {
                    DropLoot(this.position, this.width, this.height, 1369, 1, false, 0, false, false);
                }
                if (this.type == 262)
                {
                    DropLoot(this.position, this.width, this.height, 1370, 1, false, 0, false, false);
                }
                if (this.type == 245)
                {
                    DropLoot(this.position, this.width, this.height, 1371, 1, false, 0, false, false);
                }
                if (this.type == 50)
                {
                    DropLoot(this.position, this.width, this.height, 2489, 1, false, 0, false, false);
                }
                if (this.type == 370)
                {
                    DropLoot(this.position, this.width, this.height, 2589, 1, false, 0, false, false);
                }
                if (this.type == 439)
                {
                    DropLoot(this.position, this.width, this.height, 3357, 1, false, 0, false, false);
                }
                if (this.type == 491)
                {
                    DropLoot(this.position, this.width, this.height, 3359, 1, false, 0, false, false);
                }
                if (this.type == 395)
                {
                    DropLoot(this.position, this.width, this.height, 3358, 1, false, 0, false, false);
                }
                if (this.type == 398)
                {
                    DropLoot(this.position, this.width, this.height, 3595, 1, false, 0, false, false);
                }
            }
            if (this.boss)
            {
                if (this.type == 4)
                {
                    NPC.downedBoss1 = true;
                }
                else if (this.type == 13 || this.type == 14 || this.type == 15)
                {
                    NPC.downedBoss2 = true;
                    this.name = "Eater of Worlds";
                }
                else if (this.type == 266)
                {
                    NPC.downedBoss2 = true;
                    this.name = "Brain of Cthulu";
                }
                else if (this.type == 35)
                {
                    NPC.downedBoss3 = true;
                    this.name = "Skeletron";
                }
                else
                {
                    this.name = this.displayName;
                }
                if (this.type == 127)
                {
                    NPC.downedMechBoss3 = true;
                    NPC.downedMechBossAny = true;
                }
                if (this.type == 134)
                {
                    NPC.downedMechBoss1 = true;
                    NPC.downedMechBossAny = true;
                }
                string name = this.name;
                if (this.displayName != "")
                {
                    name = this.displayName;
                }
                int stack5 = Main.rand.Next(5, 16);
                int num70 = 28;
                if (this.type == 113)
                {
                    num70 = 188;
                }
                else if (this.type == 222)
                {
                    num70 = 1134;
                }
                else if (this.type > 113 && this.type < 222)
                {
                    num70 = 499;
                }
                else if (this.type == 245 || this.type == 262)
                {
                    num70 = 499;
                }
                else if (this.type == 370)
                {
                    num70 = 499;
                }
                else if (this.type == 395)
                {
                    num70 = 499;
                }
                else if (this.type == 439)
                {
                    num70 = 499;
                }
                else if (this.type == 398)
                {
                    num70 = 499;
                }
                DropLoot(this.position, this.width, this.height, num70, stack5, false, 0, false, false);
                int num71 = Main.rand.Next(5) + 5;
                for (int num72 = 0; num72 < num71; num72++)
                {
                    DropLoot(this.position, this.width, this.height, 58, 1, false, 0, false, false);
                }
                if (this.type == 125 || this.type == 126)
                {
                    NPC.downedMechBoss2 = true;
                    NPC.downedMechBossAny = true;
                    if (Main.netMode == 0)
                    {
                        Main.NewText("The Twins " + Lang.misc[50], 175, 75, 255, false);
                    }
                    else if (Main.netMode == 2)
                    {
                        NetMessage.SendData(25, -1, -1, "The Twins " + Lang.misc[50], 255, 175f, 75f, 255f, 0, 0, 0);
                    }
                }
                else if (this.type == 398)
                {
                    if (Main.netMode == 0)
                    {
                        Main.NewText("Moon Lord " + Lang.misc[17], 175, 75, 255, false);
                    }
                    else if (Main.netMode == 2)
                    {
                        NetMessage.SendData(25, -1, -1, "Moon Lord " + Lang.misc[17], 255, 175f, 75f, 255f, 0, 0, 0);
                    }
                }
                else if (Main.netMode == 0)
                {
                    Main.NewText(name + " " + Lang.misc[17], 175, 75, 255, false);
                }
                else if (Main.netMode == 2)
                {
                    NetMessage.SendData(25, -1, -1, name + " " + Lang.misc[17], 255, 175f, 75f, 255f, 0, 0, 0);
                }
                if (this.type == 113 && Main.netMode != 1)
                {
                    bool hardMode = Main.hardMode;
                    WorldGen.StartHardmode();
                    if (NPC.downedMechBoss1 && NPC.downedMechBoss2 && NPC.downedMechBoss3 && !hardMode)
                    {
                        if (Main.netMode == 0)
                        {
                            Main.NewText(Lang.misc[32], 50, 255, 130, false);
                        }
                        else if (Main.netMode == 2)
                        {
                            NetMessage.SendData(25, -1, -1, Lang.misc[32], 255, 50f, 255f, 130f, 0, 0, 0);
                        }
                    }
                }
                if (Main.netMode == 2)
                {
                    NetMessage.SendData(7, -1, -1, "", 0, 0f, 0f, 0f, 0, 0, 0);
                }
            }
            if (!flag && NPC.downedMechBoss1 && NPC.downedMechBoss2 && NPC.downedMechBoss3 && Main.hardMode)
            {
                if (Main.netMode == 0)
                {
                    Main.NewText(Lang.misc[32], 50, 255, 130, false);
                }
                else if (Main.netMode == 2)
                {
                    NetMessage.SendData(25, -1, -1, Lang.misc[32], 255, 50f, 255f, 130f, 0, 0, 0);
                }
            }
            if (this.type != 16 && this.type != 81 && this.type != 121 && Main.rand.Next(6) == 0 && this.lifeMax > 1 && this.damage > 0)
            {
                int num73 = (int)Player.FindClosest(this.position, this.width, this.height);
                if (Main.rand.Next(2) == 0 && Main.player[num73].statMana < Main.player[num73].statManaMax2)
                {
                    DropLoot(this.position, this.width, this.height, 184, 1, false, 0, false, false);
                }
                else if (Main.rand.Next(2) == 0 && Main.player[num73].statLife < Main.player[num73].statLifeMax2)
                {
                    DropLoot(this.position, this.width, this.height, 58, 1, false, 0, false, false);
                }
            }
            if (this.type != 16 && this.type != 81 && this.type != 121 && Main.rand.Next(2) == 0 && this.lifeMax > 1 && this.damage > 0)
            {
                int num74 = (int)Player.FindClosest(this.position, this.width, this.height);
                if (Main.player[num74].statMana < Main.player[num74].statManaMax2)
                {
                    DropLoot(this.position, this.width, this.height, 184, 1, false, 0, false, false);
                }
            }
            float num75 = this.value;
            if (this.midas)
            {
                num75 *= 1f + (float)Main.rand.Next(10, 50) * 0.01f;
            }
            num75 *= 1f + (float)Main.rand.Next(-20, 21) * 0.01f;
            if (Main.rand.Next(5) == 0)
            {
                num75 *= 1f + (float)Main.rand.Next(5, 11) * 0.01f;
            }
            if (Main.rand.Next(10) == 0)
            {
                num75 *= 1f + (float)Main.rand.Next(10, 21) * 0.01f;
            }
            if (Main.rand.Next(15) == 0)
            {
                num75 *= 1f + (float)Main.rand.Next(15, 31) * 0.01f;
            }
            if (Main.rand.Next(20) == 0)
            {
                num75 *= 1f + (float)Main.rand.Next(20, 41) * 0.01f;
            }
            num75 += this.extraValue;
            while ((int)num75 > 0)
            {
                if (num75 > 1000000f)
                {
                    int num76 = (int)(num75 / 1000000f);
                    if (num76 > 50 && Main.rand.Next(5) == 0)
                    {
                        num76 /= Main.rand.Next(3) + 1;
                    }
                    if (Main.rand.Next(5) == 0)
                    {
                        num76 /= Main.rand.Next(3) + 1;
                    }
                    num75 -= (float)(1000000 * num76);
                    DropLoot(this.position, this.width, this.height, 74, num76, false, 0, false, false);
                }
                else if (num75 > 10000f)
                {
                    int num77 = (int)(num75 / 10000f);
                    if (num77 > 50 && Main.rand.Next(5) == 0)
                    {
                        num77 /= Main.rand.Next(3) + 1;
                    }
                    if (Main.rand.Next(5) == 0)
                    {
                        num77 /= Main.rand.Next(3) + 1;
                    }
                    num75 -= (float)(10000 * num77);
                    DropLoot(this.position, this.width, this.height, 73, num77, false, 0, false, false);
                }
                else if (num75 > 100f)
                {
                    int num78 = (int)(num75 / 100f);
                    if (num78 > 50 && Main.rand.Next(5) == 0)
                    {
                        num78 /= Main.rand.Next(3) + 1;
                    }
                    if (Main.rand.Next(5) == 0)
                    {
                        num78 /= Main.rand.Next(3) + 1;
                    }
                    num75 -= (float)(100 * num78);
                    DropLoot(this.position, this.width, this.height, 72, num78, false, 0, false, false);
                }
                else
                {
                    int num79 = (int)num75;
                    if (num79 > 50 && Main.rand.Next(5) == 0)
                    {
                        num79 /= Main.rand.Next(3) + 1;
                    }
                    if (Main.rand.Next(5) == 0)
                    {
                        num79 /= Main.rand.Next(4) + 1;
                    }
                    if (num79 < 1)
                    {
                        num79 = 1;
                    }
                    num75 -= (float)num79;
                    DropLoot(this.position, this.width, this.height, 71, num79, false, 0, false, false);
                }
            }
        }
Пример #9
0
 /// <summary>
 /// Gets a NPC by name
 /// </summary>
 /// <param name="name">Name</param>
 /// <returns>List of matching NPCs</returns>
 public static List<NPC> GetNPCByName(string name)
 {
     var found = new List<NPC>();
     NPC npc = new NPC();
     string nameLower = name.ToLower();
     for (int i = -17; i < Main.maxNPCTypes; i++)
     {
         npc.netDefaults(i);
         if (npc.name.ToLower() == nameLower)
             return new List<NPC> { npc };
         if (npc.name.ToLower().StartsWith(nameLower))
             found.Add((NPC)npc.Clone());
     }
     return found;
 }
Пример #10
0
 /// <summary>
 /// Gets an NPC by ID
 /// </summary>
 /// <param name="id">ID</param>
 /// <returns>NPC</returns>
 public static NPC GetNPCById(int id)
 {
     NPC npc = new NPC();
     npc.netDefaults(id);
     return npc;
 }