コード例 #1
0
        public TreasureMapChest(Mobile owner, int level, bool temporary) : base(0xE40)
        {
            level = level + 4;
            if (level > 10)
            {
                level = 10;
            }

            m_Owner      = owner;
            m_Level      = level;
            m_DeleteTime = DateTime.UtcNow + TimeSpan.FromHours(3.0);

            m_Temporary = temporary;
            m_Guardians = new List <Mobile>();

            m_Timer = new DeleteTimer(this, m_DeleteTime);
            m_Timer.Start();

            Movable = false;
            Locked  = true;

            if (level > 0)
            {
                ContainerFunctions.FillTheContainer(level, this, owner);
            }
            if (level > 3)
            {
                ContainerFunctions.FillTheContainer(level, this, owner);
            }
            if (level > 7)
            {
                ContainerFunctions.FillTheContainer(level, this, owner);
            }
            if (GetPlayerInfo.LuckyPlayer(owner.Luck))
            {
                ContainerFunctions.FillTheContainer(level, this, owner);
            }

            ContainerFunctions.LockTheContainer(level, this, 1);

            int xTraCash = Utility.RandomMinMax((level * 700), (level * 1000));

            ContainerFunctions.AddGoldToContainer(xTraCash, this, 0);

            string sChest = "grand treasure chest";

            switch (level)
            {
            case 0: sChest = "meager treasure chest";               break;

            case 1: sChest = "simple treasure chest";               break;

            case 2: sChest = "good treasure chest";                 break;

            case 3: sChest = "great treasure chest";                break;

            case 4: sChest = "excellent treasure chest";    break;

            case 5: sChest = "superb treasure chest";               break;
            }

            Name = ContainerFunctions.GetOwner("Treasure Chest");
            Name = "the " + sChest + " of " + Name;

            // = SCROLL OF TRANCENDENCE
            if (level >= 4 && Utility.RandomDouble() > 0.9)
            {
                DropItem(ScrollofTranscendence.CreateRandom(level, level * 5));
            }

            // = ARTIFACTS
            int artychance = GetPlayerInfo.LuckyPlayerArtifacts(owner.Luck);

            if (Utility.RandomMinMax(0, 100) < ((level * 17) + artychance))
            {
                Item arty = ArtifactBuilder.CreateArtifact("random");
                DropItem(arty);
            }

            // = SCROLL OF ALACRITY or POWERSCROLL
            if (level > 1)
            {
                if (Utility.RandomDouble() < (0.02 + (level / 200)))
                {
                    SkillName WhatS = (SkillName)Utility.Random(SkillInfo.Table.Length);
                    DropItem(PowerScroll.CreateRandomNoCraft(5, 5));
                }
                else if (Utility.RandomDouble() < 0.075)
                {
                    SkillName WhatS = (SkillName)Utility.Random(SkillInfo.Table.Length);
                    DropItem(new ScrollofAlacrity(WhatS));
                }
            }

            int  giveRelics = level;
            Item relic      = Loot.RandomRelic();

            while (giveRelics > 0)
            {
                relic = Loot.RandomRelic();
                ContainerFunctions.RelicValueIncrease(level, relic);
                DropItem(relic);
                giveRelics = giveRelics - 1;
            }
        }
コード例 #2
0
        public static void Fill(LockableContainer cont, int level)
        {
            bool isFelucca = (cont.Map == Map.Felucca);
            bool inTokuno  = (cont.Map == Map.Tokuno);
            bool SoS       = false;

            if (cont.IsShipwreckedItem == true)
            {
                SoS = true;
            }

            cont.Movable = false;
            cont.Locked  = true;
            int numberItems;

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

                cont.DropItem(new Gold(Utility.RandomMinMax(500, 1000)));

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

                // = Chest Lock Levels (~40% to open at cont.RequiredSkill / 100% at cont.MaxLockLevel)
                switch (level)
                {
                case 1: cont.RequiredSkill = 5; cont.LockLevel = -25; cont.MaxLockLevel = 55; break;

                case 2: cont.RequiredSkill = 45; cont.LockLevel = 25; cont.MaxLockLevel = 75; break;

                case 3: cont.RequiredSkill = 65; cont.LockLevel = 45; cont.MaxLockLevel = 95; break;

                case 4: cont.RequiredSkill = 75; cont.LockLevel = 55; cont.MaxLockLevel = 105; break;

                case 5: cont.RequiredSkill = 75; cont.LockLevel = 55; cont.MaxLockLevel = 105; break;

                case 6: cont.RequiredSkill = 80; cont.LockLevel = 60; cont.MaxLockLevel = 110; break;

                case 7: cont.RequiredSkill = 80; cont.LockLevel = 60; cont.MaxLockLevel = 110; break;
                }

                // = GOLD PIECES
                cont.DropItem(new Gold(level * 5000));

                // = TREASURE MAP or MiB
                if (!SoS)
                {
                    if (Utility.RandomDouble() < 0.2)
                    {
                        cont.DropItem(new TreasureMap(level, MapItem.GetRandomFacet()));
                    }
                    else if ((level < 7) && (Utility.RandomDouble() < 0.025))
                    {
                        cont.DropItem(new TreasureMap(level + 1, MapItem.GetRandomFacet()));
                    }
                    else if (Utility.RandomDouble() > 0.8)
                    {
                        if (Utility.RandomDouble() > 0.5)
                        {
                            cont.DropItem(new MessageInABottle(Map.Felucca));
                        }
                        else
                        {
                            cont.DropItem(new MessageInABottle(Map.Trammel));
                        }
                    }
                }
                else if (!SoS)
                {
                    int soslvl = Utility.Random(level) + 1;

                    if (Utility.RandomDouble() < 0.2)
                    {
                        cont.DropItem(new TreasureMap(soslvl, MapItem.GetRandomFacet()));
                    }
                }

                // = LEVEL 8 ARCANE SCROLLS
                for (int i = 0; i < level; ++i)
                {
                    cont.DropItem(Loot.RandomScroll(57, 64, SpellbookType.Regular));
                }

                // = MAGIC ITEMS
                Item item;

                numberItems = 24 + (level * 8);
                for (int i = 0; i < numberItems; ++i)
                {
                    if (Core.AOS)
                    {
                        item = Loot.RandomArmorOrShieldOrWeaponOrJewelry(inTokuno);
                    }
                    else
                    {
                        item = Loot.RandomArmorOrShieldOrWeapon(inTokuno);
                    }

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

                        if (Core.AOS)
                        {
                            int attributeCount;
                            int min, max;

                            GetRandomAOSStats(level, out attributeCount, out min, out 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(item);
                    }
                    else if (item is BaseArmor)
                    {
                        BaseArmor armor = (BaseArmor)item;

                        if (Core.AOS)
                        {
                            int attributeCount;
                            int min, max;

                            GetRandomAOSStats(level, out attributeCount, out min, out max);

                            BaseRunicTool.ApplyAttributesTo(armor, attributeCount, min, max);
                        }
                        else
                        {
                            armor.ProtectionLevel = (ArmorProtectionLevel)Utility.Random(6);
                            armor.Durability      = (ArmorDurabilityLevel)Utility.Random(6);
                        }

                        cont.DropItem(item);
                    }
                    else if (item is BaseHat)
                    {
                        BaseHat hat = (BaseHat)item;

                        if (Core.AOS)
                        {
                            int attributeCount;
                            int min, max;

                            GetRandomAOSStats(level, out attributeCount, out min, out max);

                            BaseRunicTool.ApplyAttributesTo(hat, attributeCount, min, max);
                        }

                        cont.DropItem(item);
                    }
                    else if (item is BaseJewel)
                    {
                        int attributeCount;
                        int min, max;

                        GetRandomAOSStats(level, out attributeCount, out min, out max);

                        BaseRunicTool.ApplyAttributesTo((BaseJewel)item, attributeCount, min, max);

                        cont.DropItem(item);
                    }
                }
            }

            // = REAGENTS
            int reagents;

            if (level == 0)
            {
                reagents = 10;
            }
            else
            {
                reagents = 3 + level;
            }

            for (int i = 0; i < reagents; i++)
            {
                Item itr = Loot.RandomPossibleReagent();
                itr.Amount = Utility.RandomMinMax(40, 60);
                cont.DropItem(itr);
            }
            // = STACK OF GEMS
            int gems;

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

            Item itg  = new Citrine();
            int  rndG = Utility.Random(9) + 1;

            if (rndG == 1)
            {
                itg = new Amber(gems);
            }
            if (rndG == 2)
            {
                itg = new Amethyst(gems);
            }
            if (rndG == 3)
            {
                itg = new Citrine(gems);
            }
            if (rndG == 4)
            {
                itg = new Diamond(gems);
            }
            if (rndG == 5)
            {
                itg = new Emerald(gems);
            }
            if (rndG == 6)
            {
                itg = new Ruby(gems);
            }
            if (rndG == 7)
            {
                itg = new Sapphire(gems);
            }
            if (rndG == 8)
            {
                itg = new StarSapphire(gems);
            }
            if (rndG == 9)
            {
                itg = new Tourmaline(gems);
            }
            cont.DropItem(itg);

            // = SCROLL OF ALACRITY or POWERSCROLL
            if (level > 1)
            {
                if (Utility.RandomDouble() < (0.02 + (level / 200)))
                {
                    SkillName WhatS = (SkillName)Utility.Random(SkillInfo.Table.Length);
                    cont.DropItem(PowerScroll.CreateRandomNoCraft(5, 5));
                }
                else if (Utility.RandomDouble() < 0.075)
                {
                    SkillName WhatS = (SkillName)Utility.Random(SkillInfo.Table.Length);
                    cont.DropItem(new ScrollofAlacrity(WhatS));
                }
            }

            // = SCROLL OF TRANCENDENCE
            if (level >= 4 && isFelucca && Utility.RandomDouble() > 0.9)
            {
                cont.DropItem(ScrollofTranscendence.CreateRandom(level, level * 5));
            }

            // = CREEPING VINES
            if (!SoS && Utility.RandomDouble() < 0.075)
            {
                cont.DropItem(new CreepingVines());
            }

            // = ILSHENAR LESSER ARTIFACT
            if (level >= 6 && Core.AOS)
            {
                cont.DropItem((Item)Activator.CreateInstance(m_Artifacts[Utility.Random(m_Artifacts.Length)]));
            }

            // = SKELETON KEY
            if (level < 7)
            {
                if (!SoS && Utility.RandomDouble() > (0.92 - (level / 100)))
                {
                    cont.DropItem(new SFSkeletonKey());
                }
            }
            // = [LVL 7] = MASTER SKELETON KEY
            if (level == 7)
            {
                if (Utility.RandomDouble() < 0.10)
                {
                    cont.DropItem(new SFMasterSkeletonKey());
                }
            }
        }