Terraria.Player.OpenBossBag C# (CSharp) Method

OpenBossBag() public method

public OpenBossBag ( int type ) : void
type int
return void
        public void OpenBossBag(int type)
        {
            if (type == 3318)
            {
                if (Main.rand.Next(2) == 0)
                    this.QuickSpawnItem(2430, 1);
                if (Main.rand.Next(7) == 0)
                    this.QuickSpawnItem(2493, 1);
                int num1 = Main.rand.Next(256, 259);
                int num2 = Main.rand.Next(256, 259);
                while (num2 == num1)
                    num2 = Main.rand.Next(256, 259);
                this.QuickSpawnItem(num1, 1);
                this.QuickSpawnItem(num2, 1);
                if (Main.rand.Next(2) == 0)
                    this.QuickSpawnItem(2610, 1);
                else
                    this.QuickSpawnItem(2585, 1);
                this.QuickSpawnItem(998, 1);
                this.QuickSpawnItem(3090, 1);
            }
            else if (type == 3319)
            {
                if (Main.rand.Next(7) == 0)
                    this.QuickSpawnItem(2112, 1);
                if (Main.rand.Next(30) == 0)
                    this.QuickSpawnItem(1299, 1);
                if (WorldGen.crimson)
                {
                    this.QuickSpawnItem(880, Main.rand.Next(20) + 10 + (Main.rand.Next(20) + 10) + (Main.rand.Next(20) + 10));
                    this.QuickSpawnItem(2171, Main.rand.Next(3) + 1);
                }
                else
                {
                    this.QuickSpawnItem(56, Main.rand.Next(20) + 10 + (Main.rand.Next(20) + 10) + (Main.rand.Next(20) + 10));
                    this.QuickSpawnItem(59, Main.rand.Next(3) + 1);
                    this.QuickSpawnItem(47, Main.rand.Next(30) + 20);
                }
                this.QuickSpawnItem(3097, 1);
            }
            else if (type == 3320)
            {
                this.QuickSpawnItem(56, Main.rand.Next(15, 30) + Main.rand.Next(15, 31));
                this.QuickSpawnItem(86, Main.rand.Next(10, 20));
                if (Main.rand.Next(20) == 0)
                    this.QuickSpawnItem(994, 1);
                if (Main.rand.Next(7) == 0)
                    this.QuickSpawnItem(2111, 1);
                this.QuickSpawnItem(3224, 1);
            }
            else if (type == 3321)
            {
                this.QuickSpawnItem(880, Main.rand.Next(20, 46) + Main.rand.Next(20, 46));
                this.QuickSpawnItem(1329, Main.rand.Next(10, 20));
                if (Main.rand.Next(7) == 0)
                    this.QuickSpawnItem(2104, 1);
                if (Main.rand.Next(20) == 0)
                    this.QuickSpawnItem(3060, 1);
                this.QuickSpawnItem(3223, 1);
            }
            else if (type == 3322)
            {
                if (Main.rand.Next(7) == 0)
                    this.QuickSpawnItem(2108, 1);
                int num = Main.rand.Next(3);
                switch (num)
                {
                    case 0:
                        num = 1121;
                        break;
                    case 1:
                        num = 1123;
                        break;
                    case 2:
                        num = 2888;
                        break;
                }
                this.QuickSpawnItem(num, 1);
                this.QuickSpawnItem(3333, 1);
                if (Main.rand.Next(3) == 0)
                    this.QuickSpawnItem(1132, 1);
                if (Main.rand.Next(9) == 0)
                    this.QuickSpawnItem(1170, 1);
                if (Main.rand.Next(9) == 0)
                    this.QuickSpawnItem(2502, 1);
                this.QuickSpawnItem(1129, 1);
                this.QuickSpawnItem(Main.rand.Next(842, 845), 1);
                this.QuickSpawnItem(1130, Main.rand.Next(10, 30));
                this.QuickSpawnItem(2431, Main.rand.Next(17, 30));
            }
            else if (type == 3323)
            {
                this.QuickSpawnItem(3245, 1);
                switch (Main.rand.Next(3))
                {
                    case 0:
                        this.QuickSpawnItem(1281, 1);
                        break;
                    case 1:
                        this.QuickSpawnItem(1273, 1);
                        break;
                    default:
                        this.QuickSpawnItem(1313, 1);
                        break;
                }
            }
            else if (type == 3324)
            {
                if (Main.rand.Next(7) == 0)
                    this.QuickSpawnItem(2105, 1);
                this.QuickSpawnItem(367, 1);
                if (!this.extraAccessory)
                    this.QuickSpawnItem(3335, 1);
                int num = Main.rand.Next(4);
                this.QuickSpawnItem(num != 3 ? 489 + num : 2998, 1);
                switch (Main.rand.Next(3))
                {
                    case 0:
                        this.QuickSpawnItem(514, 1);
                        break;
                    case 1:
                        this.QuickSpawnItem(426, 1);
                        break;
                    case 2:
                        this.QuickSpawnItem(434, 1);
                        break;
                }
            }
            else if (type == 3325)
            {
                this.TryGettingDevArmor();
                if (Main.rand.Next(7) == 0)
                    this.QuickSpawnItem(2113, 1);
                this.QuickSpawnItem(548, Main.rand.Next(25, 41));
                this.QuickSpawnItem(1225, Main.rand.Next(20, 36));
                this.QuickSpawnItem(3355, 1);
            }
            else if (type == 3326)
            {
                this.TryGettingDevArmor();
                if (Main.rand.Next(7) == 0)
                    this.QuickSpawnItem(2106, 1);
                this.QuickSpawnItem(549, Main.rand.Next(25, 41));
                this.QuickSpawnItem(1225, Main.rand.Next(20, 36));
                this.QuickSpawnItem(3354, 1);
            }
            else if (type == 3327)
            {
                this.TryGettingDevArmor();
                if (Main.rand.Next(7) == 0)
                    this.QuickSpawnItem(2107, 1);
                this.QuickSpawnItem(547, Main.rand.Next(25, 41));
                this.QuickSpawnItem(1225, Main.rand.Next(20, 36));
                this.QuickSpawnItem(3356, 1);
            }
            else if (type == 3328)
            {
                this.TryGettingDevArmor();
                if (Main.rand.Next(7) == 0)
                    this.QuickSpawnItem(2109, 1);
                this.QuickSpawnItem(1141, 1);
                this.QuickSpawnItem(3336, 1);
                if (Main.rand.Next(15) == 0)
                    this.QuickSpawnItem(1182, 1);
                if (Main.rand.Next(20) == 0)
                    this.QuickSpawnItem(1305, 1);
                if (Main.rand.Next(2) == 0)
                    this.QuickSpawnItem(1157, 1);
                if (Main.rand.Next(10) == 0)
                    this.QuickSpawnItem(3021, 1);
                switch (Main.rand.Next(6))
                {
                    case 0:
                        this.QuickSpawnItem(758, 1);
                        this.QuickSpawnItem(771, Main.rand.Next(50, 150));
                        break;
                    case 1:
                        this.QuickSpawnItem(1255, 1);
                        break;
                    case 2:
                        this.QuickSpawnItem(788, 1);
                        break;
                    case 3:
                        this.QuickSpawnItem(1178, 1);
                        break;
                    case 4:
                        this.QuickSpawnItem(1259, 1);
                        break;
                    case 5:
                        this.QuickSpawnItem(1155, 1);
                        break;
                }
            }
            else if (type == 3329)
            {
                this.TryGettingDevArmor();
                this.QuickSpawnItem(3337, 1);
                if (Main.rand.Next(7) == 0)
                    this.QuickSpawnItem(2110, 1);
                switch (Main.rand.Next(8))
                {
                    case 0:
                        this.QuickSpawnItem(1258, 1);
                        this.QuickSpawnItem(1261, Main.rand.Next(60, 100));
                        break;
                    case 1:
                        this.QuickSpawnItem(1122, 1);
                        break;
                    case 2:
                        this.QuickSpawnItem(899, 1);
                        break;
                    case 3:
                        this.QuickSpawnItem(1248, 1);
                        break;
                    case 4:
                        this.QuickSpawnItem(1294, 1);
                        break;
                    case 5:
                        this.QuickSpawnItem(1295, 1);
                        break;
                    case 6:
                        this.QuickSpawnItem(1296, 1);
                        break;
                    case 7:
                        this.QuickSpawnItem(1297, 1);
                        break;
                }
                this.QuickSpawnItem(2218, Main.rand.Next(18, 24));
            }
            else if (type == 3330)
            {
                this.TryGettingDevArmor();
                this.QuickSpawnItem(3367, 1);
                if (Main.rand.Next(7) == 0)
                    this.QuickSpawnItem(2588, 1);
                if (Main.rand.Next(10) == 0)
                    this.QuickSpawnItem(2609, 1);
                switch (Main.rand.Next(5))
                {
                    case 0:
                        this.QuickSpawnItem(2611, 1);
                        break;
                    case 1:
                        this.QuickSpawnItem(2624, 1);
                        break;
                    case 2:
                        this.QuickSpawnItem(2622, 1);
                        break;
                    case 3:
                        this.QuickSpawnItem(2621, 1);
                        break;
                    case 4:
                        this.QuickSpawnItem(2623, 1);
                        break;
                }
            }
            else if (type == 3331)
            {
                this.TryGettingDevArmor();
                if (Main.rand.Next(7) == 0)
                    this.QuickSpawnItem(3372, 1);
            }
            else if (type == 3332)
            {
                this.TryGettingDevArmor();
                if (Main.rand.Next(7) == 0)
                    this.QuickSpawnItem(3373, 1);
                if (!this.HasItem(3384))
                    this.QuickSpawnItem(3384, 1);
                this.QuickSpawnItem(3460, Main.rand.Next(90, 111));
                this.QuickSpawnItem(1131, 1);
                this.QuickSpawnItem(3577, 1);
                this.QuickSpawnItem(Utils.SelectRandom<int>(Main.rand, 3063, 3389, 3065, 1553, 3546, 3541, 3570, 3571, 3569), 1);
            }
            int Type = -1;
            if (type == 3318)
                Type = 50;
            if (type == 3319)
                Type = 4;
            if (type == 3320)
                Type = 13;
            if (type == 3321)
                Type = 266;
            if (type == 3322)
                Type = 222;
            if (type == 3323)
                Type = 35;
            if (type == 3324)
                Type = 113;
            if (type == 3325)
                Type = 134;
            if (type == 3326)
                Type = 125;
            if (type == 3327)
                Type = (int)sbyte.MaxValue;
            if (type == 3328)
                Type = 262;
            if (type == 3329)
                Type = 245;
            if (type == 3330)
                Type = 370;
            if (type == 3331)
                Type = 439;
            if (type == 3332)
                Type = 398;
            if (Type <= 0)
                return;
            NPC npc = new NPC();
            npc.SetDefaults(Type, -1f);
            float num3 = npc.value * (float)(1.0 + (double)Main.rand.Next(-20, 21) * 0.00999999977648258);
            if (Main.rand.Next(5) == 0)
                num3 *= (float)(1.0 + (double)Main.rand.Next(5, 11) * 0.00999999977648258);
            if (Main.rand.Next(10) == 0)
                num3 *= (float)(1.0 + (double)Main.rand.Next(10, 21) * 0.00999999977648258);
            if (Main.rand.Next(15) == 0)
                num3 *= (float)(1.0 + (double)Main.rand.Next(15, 31) * 0.00999999977648258);
            if (Main.rand.Next(20) == 0)
                num3 *= (float)(1.0 + (double)Main.rand.Next(20, 41) * 0.00999999977648258);
            while ((int)num3 > 0)
            {
                if ((double)num3 > 1000000.0)
                {
                    int stack = (int)((double)num3 / 1000000.0);
                    num3 -= (float)(1000000 * stack);
                    this.QuickSpawnItem(74, stack);
                }
                else if ((double)num3 > 10000.0)
                {
                    int stack = (int)((double)num3 / 10000.0);
                    num3 -= (float)(10000 * stack);
                    this.QuickSpawnItem(73, stack);
                }
                else if ((double)num3 > 100.0)
                {
                    int stack = (int)((double)num3 / 100.0);
                    num3 -= (float)(100 * stack);
                    this.QuickSpawnItem(72, stack);
                }
                else
                {
                    int stack = (int)num3;
                    if (stack < 1)
                        stack = 1;
                    num3 -= (float)stack;
                    this.QuickSpawnItem(71, stack);
                }
            }
        }
Player