Beispiel #1
0
        public static void Fill(LockableContainer cont, int level)
        {
            cont.Movable = false;
            cont.Locked  = true;
            int numberItems;

            if (level == 0)
            {
                cont.LockLevel = 0; // Can't be unlocked

                cont.DropItem(new Gold(Utility.RandomMinMax(50, 100)));

                if (Utility.RandomDouble() < 0.75)
                {
                    cont.DropItem(new TreasureMap(0, Map.Trammel));
                }
            }
            else
            {
                cont.TrapType  = TrapType.ExplosionTrap;
                cont.TrapPower = level * 25;
                cont.TrapLevel = level;

                cont.RequiredSkill = level switch
                {
                    1 => 36,
                    2 => 76,
                    3 => 84,
                    4 => 92,
                    5 => 100,
                    6 => 100,
                    _ => cont.RequiredSkill
                };

                cont.LockLevel    = cont.RequiredSkill - 10;
                cont.MaxLockLevel = cont.RequiredSkill + 40;

                // Publish 67 gold change
                // if (Core.SA)
                // cont.DropItem( new Gold( level * 5000 ) );
                // else
                cont.DropItem(new Gold(level * 1000));

                for (var i = 0; i < level * 5; ++i)
                {
                    cont.DropItem(Loot.RandomScroll(0, 63, SpellbookType.Regular));
                }

                if (Core.SE)
                {
                    numberItems = level switch
                    {
                        1 => 5,
                        2 => 10,
                        3 => 15,
                        4 => 38,
                        5 => 50,
                        6 => 60,
                        _ => 0
                    };
                }
                else
                {
                    numberItems = level * 6;
                }

                for (var i = 0; i < numberItems; ++i)
                {
                    Item item;

                    if (Core.AOS)
                    {
                        item = Loot.RandomArmorOrShieldOrWeaponOrJewelry();
                    }
                    else
                    {
                        item = Loot.RandomArmorOrShieldOrWeapon();
                    }

                    if (item is BaseWeapon weapon)
                    {
                        if (Core.AOS)
                        {
                            GetRandomAOSStats(out var attributeCount, out var min, out var max);
                            BaseRunicTool.ApplyAttributesTo(weapon, attributeCount, min, max);
                        }
                        else
                        {
                            weapon.DamageLevel     = (WeaponDamageLevel)Utility.Random(6);
                            weapon.AccuracyLevel   = (WeaponAccuracyLevel)Utility.Random(6);
                            weapon.DurabilityLevel = (WeaponDurabilityLevel)Utility.Random(6);
                        }

                        cont.DropItem(weapon);
                    }
                    else if (item is BaseArmor armor)
                    {
                        if (Core.AOS)
                        {
                            GetRandomAOSStats(out var attributeCount, out var min, out var max);
                            BaseRunicTool.ApplyAttributesTo(armor, attributeCount, min, max);
                        }
                        else
                        {
                            armor.ProtectionLevel = (ArmorProtectionLevel)Utility.Random(6);
                            armor.Durability      = (ArmorDurabilityLevel)Utility.Random(6);
                        }

                        cont.DropItem(armor);
                    }
                    else if (item is BaseHat hat)
                    {
                        if (Core.AOS)
                        {
                            GetRandomAOSStats(out var attributeCount, out var min, out var max);
                            BaseRunicTool.ApplyAttributesTo(hat, attributeCount, min, max);
                        }

                        cont.DropItem(hat);
                    }
                    else if (item is BaseJewel jewel)
                    {
                        GetRandomAOSStats(out var attributeCount, out var min, out var max);
                        BaseRunicTool.ApplyAttributesTo(jewel, attributeCount, min, max);

                        cont.DropItem(jewel);
                    }
                }
            }

            int reagents;

            if (level == 0)
            {
                reagents = 12;
            }
            else
            {
                reagents = level * 3;
            }

            for (var i = 0; i < reagents; i++)
            {
                var item = Loot.RandomPossibleReagent();
                item.Amount = Utility.RandomMinMax(40, 60);
                cont.DropItem(item);
            }

            int gems;

            if (level == 0)
            {
                gems = 2;
            }
            else
            {
                gems = level * 3;
            }

            for (var i = 0; i < gems; i++)
            {
                var item = Loot.RandomGem();
                cont.DropItem(item);
            }

            if (level == 6 && Core.AOS)
            {
                cont.DropItem(Artifacts.RandomElement().CreateInstance <Item>());
            }
        }