Exemple #1
0
        private void Fill()
        {
            if (m_Filled)
            {
                return;
            }

            m_Filled = true;

            TrapType  = TrapType.ExplosionTrap;
            TrapPower = m_Level * 25;
            TrapLevel = m_Level;
            Locked    = true;

            switch (m_Level)
            {
            case 1:
                RequiredSkill = 36;
                break;

            case 2:
                RequiredSkill = 76;
                break;

            case 3:
                RequiredSkill = 84;
                break;

            case 4:
                RequiredSkill = 92;
                break;

            case 5:
                RequiredSkill = 100;
                break;
            }

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

            DropItem(new Gold(m_Level * 200));

            for (int i = 0; i < m_Level; ++i)
            {
                DropItem(Loot.RandomScroll(0, 63, SpellbookType.Regular));
                DropItem(new Platinum(PseudoSeerStone.ParagonChestPlatinumPerLevel));
            }

            for (int i = 0; i < m_Level * 2; ++i)
            {
                Item item = Loot.RandomArmorOrShieldOrWeapon();

                if (item is BaseWeapon)
                {
                    var weapon = (BaseWeapon)item;

                    int damageLevel = PseudoSeerStone.GetDamageLevel(m_Level);

                    if (PseudoSeerStone.HighestDamageLevelSpawn < damageLevel)
                    {
                        /*if (damageLevel == 5 && PseudoSeerStone.ReplaceVanqWithSkillScrolls)
                         * {
                         *      DropItem(PuzzleChest.CreateRandomSkillScroll());
                         * }*/

                        int platAmount = PseudoSeerStone.PlatinumPerMissedDamageLevel *
                                         (damageLevel - PseudoSeerStone.Instance._HighestDamageLevelSpawn);

                        if (platAmount > 0)
                        {
                            DropItem(new Platinum(platAmount));
                        }

                        damageLevel = PseudoSeerStone.Instance._HighestDamageLevelSpawn;
                    }

                    weapon.DamageLevel     = (WeaponDamageLevel)damageLevel;
                    weapon.DurabilityLevel = (WeaponDurabilityLevel)PseudoSeerStone.GetDurabilityLevel(m_Level);
                    weapon.AccuracyLevel   = (WeaponAccuracyLevel)PseudoSeerStone.GetAccuracyLevel(m_Level);

                    if (0.02 * m_Level >= Utility.RandomDouble())
                    {
                        weapon.Slayer = (SlayerName)Utility.Random(28);
                    }

                    DropItem(item);
                }
                else if (item is BaseArmor)
                {
                    var armor = (BaseArmor)item;

                    armor.ProtectionLevel = (ArmorProtectionLevel)Utility.Random(6);
                    armor.Durability      = (ArmorDurabilityLevel)Utility.Random(6);

                    DropItem(item);
                }
                else if (item is BaseHat)
                {
                    DropItem(item);
                }
                else if (item is BaseJewel)
                {
                    DropItem(item);
                }
            }

            if (Utility.RandomDouble() <= 0.05)
            {
                var scroll = new SkillScroll();
                scroll.Randomize();
                DropItem(scroll);
            }

            for (int i = 0; i < m_Level; i++)
            {
                Item item = Loot.RandomPossibleReagent(Expansion);
                item.Amount = Utility.RandomMinMax(40, 60);

                DropItem(item);
            }

            for (int i = 0; i < m_Level; i++)
            {
                Item item = Loot.RandomGem();
                DropItem(item);
            }

            DropItem(new TreasureMap(m_Level + 1, Map.Felucca));
        }
        public static void Fill(LockableContainer cont, int level, Expansion e)
        {
            cont.Movable = false;
            cont.Locked  = true;
            int numberItems;

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

                cont.DropItem(new Gold(Utility.RandomMinMax(25, 50))); // reduced from 50 100

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

                switch (level)
                {
                case 1:
                    cont.RequiredSkill = 36;
                    break;

                case 2:
                    cont.RequiredSkill = 76;
                    break;

                case 3:
                    cont.RequiredSkill = 84;
                    break;

                case 4:
                    cont.RequiredSkill = 92;
                    break;

                case 5:
                    cont.RequiredSkill = 95;
                    break;

                case 6:
                    cont.RequiredSkill = 95;
                    break;
                }

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

                cont.DropItem(new Gold(level * 1000, level * 2000));

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

                if (e >= Expansion.SE)
                {
                    switch (level)
                    {
                    case 1:
                        numberItems = 2;
                        break;

                    case 2:
                        numberItems = 4;
                        break;

                    case 3:
                        numberItems = 7;
                        break;

                    case 4:
                        numberItems = 10;
                        break;

                    case 5:
                        numberItems = 20;
                        break;

                    case 6:
                        numberItems = 30;
                        break;

                    default:
                        numberItems = 0;
                        break;
                    }
                }
                else
                {
                    numberItems = level * 6;
                }

                for (int i = 0; i < numberItems; ++i)
                {
                    Item item = Loot.RandomArmorOrShieldOrWeapon();

                    if (item is BaseWeapon)
                    {
                        var weapon = (BaseWeapon)item;

                        int damageLevel = PseudoSeerStone.GetDamageLevel(level);

                        if (PseudoSeerStone.HighestDamageLevelSpawn < damageLevel)
                        {
                            if (damageLevel == 5 && PseudoSeerStone.ReplaceVanqWithSkillScrolls)
                            {
                                cont.DropItem(PuzzleChest.CreateRandomSkillScroll());
                            }

                            int platAmount = PseudoSeerStone.PlatinumPerMissedDamageLevel *
                                             (damageLevel - PseudoSeerStone.Instance._HighestDamageLevelSpawn);

                            if (platAmount > 0)
                            {
                                cont.DropItem(new Platinum(platAmount));
                            }

                            damageLevel = PseudoSeerStone.Instance._HighestDamageLevelSpawn;
                        }

                        weapon.DamageLevel     = (WeaponDamageLevel)damageLevel;
                        weapon.DurabilityLevel = (WeaponDurabilityLevel)PseudoSeerStone.GetDurabilityLevel(level);
                        weapon.AccuracyLevel   = (WeaponAccuracyLevel)PseudoSeerStone.GetAccuracyLevel(level);

                        if (0.02 * level >= Utility.RandomDouble())
                        {
                            weapon.Slayer = (SlayerName)Utility.Random(28);
                        }

                        cont.DropItem(item);
                    }
                    else if (item is BaseArmor)
                    {
                        var armor = (BaseArmor)item;

                        armor.ProtectionLevel = (ArmorProtectionLevel)Utility.Random(6);
                        armor.Durability      = (ArmorDurabilityLevel)Utility.Random(6);

                        cont.DropItem(item);
                    }
                    else if (item is BaseHat || item is BaseJewel)
                    {
                        cont.DropItem(item);
                    }
                }
            }

            int reagents;

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

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

            int gems;

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

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

            if (level == 6 && cont.EraAOS)
            {
                cont.DropItem((Item)Activator.CreateInstance(m_Artifacts[Utility.Random(m_Artifacts.Length)]));
            }
        }
        public TreasureChestLevel4() : base(0xE41)
        {
            this.SetChestAppearance();
            Movable      = false;
            LiftOverride = true;

            TrapType  = TrapType.ExplosionTrap;
            TrapPower = m_Level * Utility.Random(10, 25);
            Locked    = true;

            RequiredSkill = 92;
            Breakable     = false;
            LockLevel     = this.RequiredSkill - Utility.Random(1, 10);
            //MaxLockLevel = this.RequiredSkill;
            MaxLockLevel = 100;

            // According to OSI, loot in level 4 chest is:
            //  Gold 500 - 900
            //  Reagents
            //  Scrolls
            //  Blank scrolls
            //  Potions
            //  Gems
            //  Magic Wand
            //  Magic weapon
            //  Magic armour
            //  Magic clothing (not implemented)
            //  Magic jewelry (not implemented)
            //  Crystal ball (not implemented)

            // Gold
            DropItem(new Gold(Utility.Random(200, 400)));

            // Reagents
            for (int i = Utility.Random(1, m_Level); i > 1; i--)
            {
                Item ReagentLoot = Loot.RandomReagent();
                ReagentLoot.Amount = 12;
                DropItem(ReagentLoot);
            }

            // Scrolls
            for (int i = Utility.Random(1, m_Level); i > 1; i--)
            {
                Item ScrollLoot = Loot.RandomScroll(0, 47, SpellbookType.Regular);
                ScrollLoot.Amount = Utility.Random(1, 3);;
                DropItem(ScrollLoot);
            }

            // Drop blank scrolls
            DropItem(new BlankScroll(Utility.Random(1, m_Level)));

            // Potions
            for (int i = Utility.Random(1, m_Level); i > 1; i--)
            {
                Item PotionLoot = Loot.RandomPotion();
                DropItem(PotionLoot);
            }

            // Gems
            for (int i = Utility.Random(1, m_Level); i > 1; i--)
            {
                Item GemLoot = Loot.RandomGem();
                GemLoot.Amount = Utility.Random(1, 4);;
                DropItem(GemLoot);
            }


            // Equipment
            for (int i = Utility.Random(1, m_Level); i > 1; i--)
            {
                Item item = Loot.RandomArmorOrShieldOrWeapon();

                if (item is BaseWeapon)
                {
                    BaseWeapon weapon      = (BaseWeapon)item;
                    int        damageLevel = PseudoSeerStone.GetDamageLevel(m_Level);
                    if (PseudoSeerStone.HighestDamageLevelSpawn < damageLevel)
                    {
                        if (damageLevel == 5 && PseudoSeerStone.ReplaceVanqWithSkillScrolls)
                        {
                            DropItem(PuzzleChest.CreateRandomSkillScroll());
                        }
                        int platAmount = PseudoSeerStone.PlatinumPerMissedDamageLevel * (damageLevel - PseudoSeerStone.Instance._HighestDamageLevelSpawn);
                        if (platAmount > 0)
                        {
                            DropItem(new Platinum(platAmount));
                        }
                        damageLevel = PseudoSeerStone.Instance._HighestDamageLevelSpawn;
                    }
                    weapon.DamageLevel     = (WeaponDamageLevel)damageLevel;
                    weapon.DurabilityLevel = (WeaponDurabilityLevel)PseudoSeerStone.GetDurabilityLevel(m_Level);
                    weapon.AccuracyLevel   = (WeaponAccuracyLevel)PseudoSeerStone.GetAccuracyLevel(m_Level);
                    weapon.Quality         = WeaponQuality.Regular;
                }
                else if (item is BaseArmor)
                {
                    BaseArmor armor = (BaseArmor)item;
                    armor.ProtectionLevel = (ArmorProtectionLevel)Utility.Random(m_Level);
                    armor.Durability      = (ArmorDurabilityLevel)Utility.Random(m_Level);
                    armor.Quality         = ArmorQuality.Regular;
                }

                DropItem(item);
            }

            // Clothing
            for (int i = Utility.Random(1, 2); i > 1; i--)
            {
                DropItem(Loot.RandomClothing());
            }

            // Jewelry
            for (int i = Utility.Random(1, 2); i > 1; i--)
            {
                DropItem(Loot.RandomJewelry());
            }

            // Crystal ball (not implemented)
        }
Exemple #4
0
        protected void GenerateT()
        {
            if (0.001 >= Utility.RandomDouble())
            {
                PowerScroll ps = CreateRandomPowerScroll();
                DropItem(ps);
            }
            if (0.1 >= Utility.RandomDouble())
            {
                Item skillscroll = CreateRandomSkillScroll();
                DropItem(skillscroll);
            }

            DropItem(new Gold(2000, 4000));

            List <Item> gems = new List <Item>();

            for (int i = 0; i < 9; i++)
            {
                Item gem     = Loot.RandomGem();
                Type gemType = gem.GetType();

                foreach (Item listGem in gems)
                {
                    if (listGem.GetType() == gemType)
                    {
                        listGem.Amount++;
                        gem.Delete();
                        break;
                    }
                }

                if (!gem.Deleted)
                {
                    gems.Add(gem);
                }
            }

            foreach (Item gem in gems)
            {
                DropItem(gem);
            }

            if (0.2 > Utility.RandomDouble())
            {
                DropItem(new BagOfReagents(50));
            }

            for (int i = 0; i < 5; i++)
            {
                Item item;
                item = Loot.RandomArmorOrShieldOrWeapon();
                int level = 5;
                if (item is BaseWeapon)
                {
                    BaseWeapon weapon = (BaseWeapon)item;

                    int damageLevel = PseudoSeerStone.GetDamageLevel(level);
                    if (PseudoSeerStone.HighestDamageLevelSpawn < damageLevel)
                    {
                        if (damageLevel == 5 && PseudoSeerStone.ReplaceVanqWithSkillScrolls)
                        {
                            DropItem(PuzzleChest.CreateRandomSkillScroll());
                        }
                        int platAmount = PseudoSeerStone.PlatinumPerMissedDamageLevel * (damageLevel - PseudoSeerStone.Instance._HighestDamageLevelSpawn);
                        if (platAmount > 0)
                        {
                            DropItem(new Platinum(platAmount));
                        }
                        damageLevel = PseudoSeerStone.Instance._HighestDamageLevelSpawn;
                    }
                    weapon.DamageLevel     = (WeaponDamageLevel)damageLevel;
                    weapon.DurabilityLevel = (WeaponDurabilityLevel)PseudoSeerStone.GetDurabilityLevel(level);
                    weapon.AccuracyLevel   = (WeaponAccuracyLevel)PseudoSeerStone.GetAccuracyLevel(level);
                    if (0.02 * level >= Utility.RandomDouble())
                    {
                        weapon.Slayer = (SlayerName)Utility.Random(28);
                    }
                    DropItem(item);
                }
                else if (item is BaseArmor)
                {
                    BaseArmor armor = (BaseArmor)item;

                    armor.ProtectionLevel = (ArmorProtectionLevel)Utility.Random(6);
                    armor.Durability      = (ArmorDurabilityLevel)Utility.Random(6);

                    DropItem(item);
                }
            }
        }