Beispiel #1
0
        protected override void BeginLockpick(Mobile from, ILockpickable item)
        {
            if (from is PlayerMobile &&
                item.Locked &&
                QuestHelper.HasQuest <TheTreasureChaseQuest>((PlayerMobile)from) &&
                item is TreasureMapChest &&
                ((TreasureMapChest)item).TreasureMap is BuriedRichesTreasureMap)
            {
                var chest = (TreasureMapChest)item;

                from.PlaySound(0x241);

                Timer.DelayCall(TimeSpan.FromMilliseconds(200), () =>
                {
                    if (item.Locked && from.InRange(chest.GetWorldLocation(), 1))
                    {
                        from.CheckTargetSkill(SkillName.Lockpicking, item, 0, 100);

                        // Success! Pick the lock!
                        from.PrivateOverheadMessage(MessageType.Regular, 1154, 1158252, from.NetState); // *Your recent study of Treasure Hunting helps you pick the lock...*
                        chest.SendLocalizedMessageTo(from, 502076);                                     // The lock quickly yields to your skill.
                        from.PlaySound(0x4A);
                        item.LockPick(from);
                    }
                });
            }
            else
            {
                base.BeginLockpick(from, item);
            }
        }
Beispiel #2
0
                protected override void OnTick()
                {
                    Item item = (Item)m_Item;

                    if (!m_From.InRange(item.GetWorldLocation(), 1))
                    {
                        if (m_From is PlayerMobile)
                        {
                            ((PlayerMobile)m_From).EndPlayerAction();
                        }
                        return;
                    }

                    if (m_Item.LockLevel == 0 || m_Item.LockLevel == -255)
                    {
                        // LockLevel of 0 means that the door can't be picklocked
                        // LockLevel of -255 means it's magic locked
                        item.SendLocalizedMessageTo(m_From, 502073);                           // This lock cannot be picked by normal means
                        if (m_From is PlayerMobile)
                        {
                            ((PlayerMobile)m_From).EndPlayerAction();
                        }
                        return;
                    }

                    if (m_From.Skills[SkillName.Lockpicking].Value < m_Item.RequiredSkill)
                    {
                        // Do some training to gain skills
                        m_From.CheckSkill(SkillName.Lockpicking, 0, m_Item.LockLevel);

                        // The LockLevel is higher thant the LockPicking of the player
                        item.SendLocalizedMessageTo(m_From, 502072);                           // You don't see how that lock can be manipulated.
                        if (m_From is PlayerMobile)
                        {
                            ((PlayerMobile)m_From).EndPlayerAction();
                        }
                        return;
                    }

                    if (m_From.CheckTargetSkill(SkillName.Lockpicking, m_Item, m_Item.LockLevel, m_Item.MaxLockLevel))
                    {
                        // Success! Pick the lock!
                        item.SendLocalizedMessageTo(m_From, 502076);                           // The lock quickly yields to your skill.
                        m_From.PlaySound(0x4A);
                        m_Item.LockPick(m_From);
                    }
                    else
                    {
                        // The player failed to pick the lock
                        BrokeLockPickTest();
                        item.SendLocalizedMessageTo(m_From, 502075);                           // You are unable to pick the lock.
                    }

                    if (m_From is PlayerMobile)
                    {
                        ((PlayerMobile)m_From).EndPlayerAction();
                    }
                }
                protected override void OnTick()
                {
                    Item item = (Item)m_Item;

                    if (!m_From.InRange(item.GetWorldLocation(), 1))
                    {
                        return;
                    }

                    if (m_Item.LockLevel == 0 || m_Item.LockLevel == -255)
                    {
                        // LockLevel of 0 means that the door can't be picklocked
                        // LockLevel of -255 means it's magic locked
                        item.SendLocalizedMessageTo(m_From, 502073);                           // This lock cannot be picked by normal means
                        return;
                    }

                    if (m_From.Skills[SkillName.Lockpicking].Value < m_Item.RequiredSkill)
                    {
                        /*
                         * // Do some training to gain skills
                         * m_From.CheckSkill( SkillName.Lockpicking, 0, m_Item.LockLevel );*/

                        // The LockLevel is higher thant the LockPicking of the player

                        double diff = m_Item.RequiredSkill - m_From.Skills[SkillName.Lockpicking].Value;
                        if (diff < 20 && m_From.Skills[SkillName.Lockpicking].Value < 40.0)
                        {
                            Skill  m_skill = m_From.Skills[SkillName.Lockpicking];
                            double chnc    = diff / 200;
                            //m_From.SendMessage("chance: {0}", chnc);
                            if (chnc > Utility.RandomDouble())
                            {
                                Server.Misc.SkillCheck.Gain(m_From, m_skill);
                            }
                        }

                        item.SendLocalizedMessageTo(m_From, 502072);                           // You don't see how that lock can be manipulated.
                        return;
                    }

                    if (m_From.CheckTargetSkill(SkillName.Lockpicking, m_Item, m_Item.LockLevel, m_Item.MaxLockLevel))
                    {
                        // Success! Pick the lock!
                        item.SendLocalizedMessageTo(m_From, 502076);                           // The lock quickly yields to your skill.
                        m_From.PlaySound(0x4A);
                        m_Item.LockPick(m_From);
                    }
                    else
                    {
                        // The player failed to pick the lock
                        BrokeLockPickTest();
                        item.SendLocalizedMessageTo(m_From, 502075);                           // You are unable to pick the lock.
                    }
                }
Beispiel #4
0
                protected override void OnTick()
                {
                    Item item = (Item)m_Item;

                    Rogue rge = Perk.GetByType <Rogue>((Player)m_From);

                    if (!m_From.InRange(item.GetWorldLocation(), 1))
                    {
                        return;
                    }

                    if (m_Item.LockLevel == -255)
                    {
                        // LockLevel of -255 means it's magic locked
                        item.SendLocalizedMessageTo(m_From, 502073);                           // This lock cannot be picked by normal means
                        return;
                    }

                    if (m_From.Skills[SkillName.Lockpicking].Value < m_Item.RequiredSkill)
                    {
                        // Do some training to gain skills
                        m_From.CheckSkill(SkillName.Lockpicking, 0, m_Item.LockLevel);

                        // The LockLevel is higher thant the LockPicking of the player
                        item.SendLocalizedMessageTo(m_From, 502072);                           // You don't see how that lock can be manipulated.
                        return;
                    }

                    if (m_From.CheckTargetSkill(SkillName.Lockpicking, m_Item, m_Item.LockLevel, m_Item.MaxLockLevel))
                    {
                        // Success! Pick the lock!
                        item.SendLocalizedMessageTo(m_From, 502076);                           // The lock quickly yields to your skill.
                        m_Item.LockPick(m_From);

                        if (rge == null || !rge.SafeCracker())
                        {
                            m_From.PlaySound(0x4A);
                        }
                    }
                    else
                    {
                        // The player failed to pick the lock
                        if (rge == null || !rge.SafeCracker())
                        {
                            BrokeLockPickTest();
                        }

                        item.SendLocalizedMessageTo(m_From, 502075);                           // You are unable to pick the lock.
                    }
                }
Beispiel #5
0
                protected override void OnTick()
                {
                    Item item = (Item)m_Item;

                    if (!m_From.InRange(item.GetWorldLocation(), 1))
                    {
                        return;
                    }

                    item.SendLocalizedMessageTo(m_From, 502076);
                    m_From.PlaySound(0x4A);
                    m_Item.LockPick(m_From);

                    m_From.SendMessage("The key opens the Treasure chest but is now rendered useless");
                    m_Skey.Delete();
                }
Beispiel #6
0
                protected override void OnTick()
                {
                    if (!m_From.InRange(((Item)m_Item).GetWorldLocation(), 1))
                    {
                        return;
                    }

                    if (DateTime.Now >= m_Time)
                    {
                        Item item = (Item)m_Item;

                        if (m_Item.LockLevel == 0 || m_Item.LockLevel == -255)
                        {
                            // LockLevel of 0 means that the door can't be picklocked
                            // LockLevel of -255 means it's magic locked
                            item.SendLocalizedMessageTo(m_From, 502073); // This lock cannot be picked by normal means
                        }
                        else if (m_From.Skills[SkillName.Crochetage].Value < m_Item.RequiredSkill)
                        {
                            m_From.CheckSkill(SkillName.Crochetage, 0, m_Item.LockLevel);

                            // The LockLevel is higher thant the LockPicking of the player
                            item.SendLocalizedMessageTo(m_From, 502072); // You don't see how that lock can be manipulated.
                        }
                        else if (m_From.CheckTargetSkill(SkillName.Crochetage, m_Item, m_Item.LockLevel, m_Item.MaxLockLevel))
                        {
                            // Success! Pick the lock!
                            item.SendLocalizedMessageTo(m_From, 502076); // The lock quickly yields to your skill.
                            m_From.PlaySound(0x4A);
                            m_Item.LockPick(m_From);
                        }
                        else
                        {
                            // The player failed to pick the lock
                            BrokeLockPickTest();
                            item.SendLocalizedMessageTo(m_From, 502075); // You are unable to pick the lock.
                        }
                        Stop();

                        m_From.NextSkillTime = Core.TickCount + 10000; // 10 seconds.
                    }
                    else
                    {
                        m_From.PlaySound(0x241);
                    }
                }
Beispiel #7
0
                protected override void OnTick()
                {
                    Item item = m_Item as Item;

                    if (item != null && !item.Deleted)
                    {
                        if (m_Item.Locked)
                        {
                            if (m_From.InRange(item.GetWorldLocation(), 1))
                            {
                                if (m_Item.LockLevel == 0 || m_Item.LockLevel == -255)
                                {
                                    // LockLevel of 0 means that the door can't be picklocked
                                    // LockLevel of -255 means it's magic locked
                                    item.SendLocalizedMessageTo(m_From, 502073);                                       // This lock cannot be picked by normal means
                                }
                                else if (m_From.Skills[SkillName.Lockpicking].Value < m_Item.RequiredSkill)
                                {
                                    /*
                                     * // Do some training to gain skills
                                     * m_From.CheckSkill( SkillName.Lockpicking, 0, m_Item.LockLevel );*/

                                    // The LockLevel is higher than the LockPicking of the player
                                    item.SendLocalizedMessageTo(m_From, 502072);                                       // You don't see how that lock can be manipulated.
                                }
                                else if (m_From.CheckTargetSkill(SkillName.Lockpicking, m_Item, m_Item.LockLevel, m_Item.MaxLockLevel))
                                {
                                    // Success! Pick the lock!
                                    item.SendLocalizedMessageTo(m_From, 502076);                                       // The lock quickly yields to your skill.
                                    m_From.PlaySound(0x4A);
                                    m_Item.LockPick(m_From);
                                }
                                else
                                {
                                    // The player failed to pick the lock
                                    BrokeLockPickTest();
                                    item.SendLocalizedMessageTo(m_From, 502075);                                       // You are unable to pick the lock.
                                }
                            }
                        }
                        else
                        {
                            m_From.SendLocalizedMessage(502069);                               // This does not appear to be locked
                        }
                    }
                }
Beispiel #8
0
                protected override void OnTick()
                {
                    if (!(m_Item is Item))
                    {
                        return;
                    }
                    Item item = (Item)m_Item;

                    if (!m_From.InRange(item.GetWorldLocation(), 1))
                    {
                        return;
                    }

                    if (m_Item.LockLevel == 0 || m_Item.LockLevel == -255)
                    {
                        // LockLevel of 0 means that the door can't be picklocked
                        // LockLevel of -255 means it's magic locked
                        item.SendLocalizedMessageTo(m_From, 502073);                           // This lock cannot be picked by normal means
                        return;
                    }

                    if (m_From.Skills[SkillName.Lockpicking].Value < m_Item.RequiredSkill)
                    {
                        item.SendLocalizedMessageTo(m_From, 502072);                           // You don't see how that lock can be manipulated.
                        return;
                    }

                    if (m_From.CheckTargetSkill(SkillName.Lockpicking, m_Item, m_Item.LockLevel - 1, m_Item.MaxLockLevel))
                    {
                        item.SendLocalizedMessageTo(m_From, 502076);                           // The lock quickly yields to your skill.
                        m_From.PlaySound(0x4A);
                        m_Item.LockPick(m_From);
                        m_From.RevealingAction();
                    }
                    else
                    {
                        if (Utility.Random(3) == 0)
                        {
                            item.SendLocalizedMessageTo(m_From, 502074);                              // You broke the lockpick.
                            m_From.PlaySound(0x3A4);
                            m_Lockpick.Consume();
                        }
                        item.SendLocalizedMessageTo(m_From, 502075);                           // You are unable to pick the lock.
                    }
                }
Beispiel #9
0
                protected override void OnTick()
                {
                    m_Table.Remove(m_From);

                    Item item = (Item)m_Item;

                    if (!m_From.InRange(item.GetWorldLocation(), 1))
                    {
                        return;
                    }

                    int message = -1;

                    if (m_Item.LockLevel == 0 || m_Item.LockLevel == -255)
                    {
                        // LockLevel of 0 means that the target can't be picklocked
                        // LockLevel of -255 means it's magic locked

                        message = 502073;                         // This lock cannot be picked by normal means
                    }
                    else if (!m_Item.IsLockedAndTrappedByPlayer() && m_From.Skills[SkillName.Lockpicking].Value < m_Item.RequiredSkill)
                    {
                        message = 502072;                         // You don't see how that lock can be manipulated.
                    }
                    else if (m_Item.CheckAccess(m_From))
                    {
                        if (m_Lockpick.CheckSuccess(m_From, m_Item))
                        {
                            message = m_Item.LockPick(m_From);
                            m_Lockpick.OnSuccess(m_From, m_Item);
                        }
                        else
                        {
                            message = m_Item.FailLockPick(m_From);
                            m_Lockpick.OnFailure(m_From, m_Item);
                        }
                    }

                    if (message != -1)
                    {
                        item.SendLocalizedMessageTo(m_From, message);
                    }
                }
Beispiel #10
0
                protected override void OnTick()
                {
                    Item item = (Item)m_Item;

                    int m_LockLvl    = m_Item.LockLevel - 5;
                    int m_MaxLockLvl = m_Item.MaxLockLevel - 5;

                    if (m_LockLvl <= 0)
                    {
                        m_LockLvl = 1;
                    }
                    if (m_MaxLockLvl <= 0)
                    {
                        m_MaxLockLvl = 1;
                    }

                    if (!m_From.InRange(item.GetWorldLocation(), 1))
                    {
                        return;
                    }

                    if (m_Item.LockLevel == 0 || m_Item.LockLevel == -255)
                    {
                        // LockLevel of 0 means that the door can't be picklocked
                        // LockLevel of -255 means it's magic locked
                        item.SendLocalizedMessageTo(m_From, 502073); // This lock cannot be picked by normal means
                        return;
                    }

                    if ((m_From.Skills[SkillName.Lockpicking].Value + 5.0) < m_Item.RequiredSkill)
                    {
                        // The LockLevel is higher thant the LockPicking of the player
                        item.SendLocalizedMessageTo(m_From, 502072); // You don't see how that lock can be manipulated.
                        return;
                    }

                    if (m_From.CheckTargetSkill(SkillName.Lockpicking, m_Item, m_LockLvl, m_MaxLockLvl))
                    {
                        // Success! Pick the lock!
                        item.SendLocalizedMessageTo(m_From, 502076); // The lock quickly yields to your skill.
                        m_From.PlaySound(0x4A);
                        m_Item.LockPick(m_From);
                        --m_Skey.UsesRemaining;
                    }
                    else
                    {
                        // The player failed to pick the lock
                        item.SendLocalizedMessageTo(m_From, 502075); // You are unable to pick the lock.
                        --m_Skey.UsesRemaining;
                        if (m_Skey.UsesRemaining <= 0)
                        {
                            m_From.SendMessage("You have used up your skeleton key");
                            m_Skey.Delete();
                        }

                        // ==== Random Item Disintergration upon Failure ====
                        if ((Core.SA) && m_Item is TreasureMapChest)
                        {
                            int i_Num = 0; Item i_Destroy = null;

                            BaseContainer m_chest = m_Item as BaseContainer;
                            Item          Dust    = new DustPile();

                            for (int i = 10; i > 0; i--)
                            {
                                i_Num = Utility.Random(m_chest.Items.Count);
                                // Make sure DustPiles aren't called for destruction
                                if ((m_chest.Items.Count > 0) && m_chest.Items[i_Num] is DustPile)
                                {
                                    for (int ci = (m_chest.Items.Count - 1); ci >= 0; ci--)
                                    {
                                        i_Num = ci;
                                        if (i_Num < 0)
                                        {
                                            i_Num = 0;
                                        }

                                        if (m_chest.Items[i_Num] is DustPile)
                                        {
                                            i_Destroy = null;
                                        }
                                        else
                                        {
                                            i_Destroy = m_chest.Items[i_Num];
                                            i_Num     = i_Num; i = 0;
                                        }
                                        // Nothing left but Dust
                                        if (ci < 0 && i > 0)
                                        {
                                            i_Destroy = null; i = 0;
                                        }
                                    }
                                }
                                // Item targetted =+= prepare for object DOOM! >;D
                                else
                                {
                                    i_Destroy = m_chest.Items[i_Num]; i = 0;
                                }
                            }
                            // Delete chosen Item and drop a Dust Pile
                            if (i_Destroy is Gold)
                            {
                                if (i_Destroy.Amount > 1000)
                                {
                                    i_Destroy.Amount -= 1000;
                                }
                                else
                                {
                                    i_Destroy.Delete();
                                }

                                Dust.Hue = 1177; m_chest.DropItem(Dust);
                            }
                            else if (i_Destroy != null)
                            {
                                i_Destroy.Delete(); m_chest.DropItem(Dust);
                            }
                            Effects.PlaySound(m_chest.Location, m_chest.Map, 0x1DE);
                            m_chest.PublicOverheadMessage(MessageType.Regular, 2004, false, "The sound of gas escaping is heard from the chest.");
                        }
                    }
                }
Beispiel #11
0
                protected override void OnTick()
                {
                    Item item = (Item)m_Item;

                    if (m_From.Skills[SkillName.Lockpicking].Base < 1)
                    {
                        int cycle = 10;

                        while (cycle > 0)
                        {
                            cycle--;
                            m_From.CheckTargetSkill(SkillName.Lockpicking, m_Item, 0, 10);
                        }
                    }

                    if (!m_From.InRange(item.GetWorldLocation(), 1))
                    {
                        return;
                    }

                    if (m_Item.LockLevel == 0 || m_Item.LockLevel == -255)
                    {
                        // LockLevel of 0 means that the door can't be picklocked
                        // LockLevel of -255 means it's magic locked
                        if (m_Lockpick.ItemID == 0x3A75)
                        {
                            m_From.PrivateOverheadMessage(0, 1150, false, "This lock cannot be hacked by normal means.", m_From.NetState);
                        }
                        else
                        {
                            m_From.PrivateOverheadMessage(0, 1150, false, "This lock cannot be picked by normal means.", m_From.NetState);
                        }

                        return;
                    }

                    if ((m_From.Skills[SkillName.Lockpicking].Value + 2) < m_Item.RequiredSkill)
                    {
                        /*
                         * // Do some training to gain skills
                         * m_From.CheckSkill( SkillName.Lockpicking, 0, m_Item.LockLevel );*/

                        // The LockLevel is higher thant the LockPicking of the player
                        if (m_Lockpick.ItemID == 0x3A75)
                        {
                            m_From.PrivateOverheadMessage(0, 1150, false, "You don't see how that lock can be hacked.", m_From.NetState);
                        }
                        else
                        {
                            m_From.PrivateOverheadMessage(0, 1150, false, "You don't see how that lock can be manipulated.", m_From.NetState);
                        }
                        return;
                    }

                    if (m_From.CheckTargetSkill(SkillName.Lockpicking, m_Item, m_Item.LockLevel, m_Item.MaxLockLevel))
                    {
                        // Success! Pick the lock!
                        if (m_Lockpick.ItemID == 0x3A75)
                        {
                            m_From.PlaySound(0x54B); m_From.PrivateOverheadMessage(0, 1150, false, "Your skill at hacking worked.", m_From.NetState);
                        }
                        else
                        {
                            m_From.PlaySound(0x4A); m_From.PrivateOverheadMessage(0, 1150, false, "The lock quickly yields to your skill.", m_From.NetState);
                        }

                        m_Item.LockPick(m_From);
                    }
                    else
                    {
                        // The player failed to pick the lock
                        BrokeLockPickTest();

                        if (m_Lockpick.ItemID == 0x3A75)
                        {
                            m_From.PrivateOverheadMessage(0, 1150, false, "You are unable to hack the lock.", m_From.NetState);
                        }
                        else
                        {
                            m_From.PrivateOverheadMessage(0, 1150, false, "You are unable to pick the lock.", m_From.NetState);
                        }

                        // ==== Random Item Disintergration upon Failure ====
                        if (m_Item is TreasureMapChest)
                        {
                            int i_Num = 0; Item i_Destroy = null;

                            BaseContainer m_chest = m_Item as BaseContainer;
                            Item          Dust    = new DustPile();

                            for (int i = 10; i > 0; i--)
                            {
                                i_Num = Utility.Random(m_chest.Items.Count);
                                // Make sure DustPiles aren't called for destruction
                                if ((m_chest.Items.Count > 0) && m_chest.Items[i_Num] is DustPile)
                                {
                                    for (int ci = (m_chest.Items.Count - 1); ci >= 0; ci--)
                                    {
                                        i_Num = ci;
                                        if (i_Num < 0)
                                        {
                                            i_Num = 0;
                                        }

                                        if (m_chest.Items[i_Num] is DustPile)
                                        {
                                            i_Destroy = null;
                                        }
                                        else
                                        {
                                            i_Destroy = m_chest.Items[i_Num];
                                            i         = 0;
                                        }
                                        // Nothing left but Dust
                                        if (ci < 0 && i > 0)
                                        {
                                            i_Destroy = null; i = 0;
                                        }
                                    }
                                }
                                // Item targeted =+= prepare for object DOOM! >;D
                                else
                                {
                                    i_Destroy = m_chest.Items[i_Num]; i = 0;
                                }
                            }
                            // Delete chosen Item and drop a Dust Pile
                            if (i_Destroy is Gold)
                            {
                                if (i_Destroy.Amount > 1000)
                                {
                                    i_Destroy.Amount -= 1000;
                                }
                                else
                                {
                                    i_Destroy.Delete();
                                }

                                Dust.Hue = 1177; m_chest.DropItem(Dust);
                            }
                            else if (i_Destroy != null)
                            {
                                i_Destroy.Delete(); m_chest.DropItem(Dust);
                            }
                            Effects.PlaySound(m_chest.Location, m_chest.Map, 0x1DE);
                            m_chest.PublicOverheadMessage(MessageType.Regular, 2004, false, "The sound of gas escaping is heard from the chest.");
                        }
                    }
                }
Beispiel #12
0
        protected virtual void EndLockpick(object state)
        {
            object[]      objs         = (object[])state;
            ILockpickable lockpickable = objs[0] as ILockpickable;
            Mobile        from         = objs[1] as Mobile;

            Item item = (Item)lockpickable;

            if (!from.InRange(item.GetWorldLocation(), 1))
            {
                return;
            }

            if (lockpickable.LockLevel == 0 || lockpickable.LockLevel == -255)
            {
                // LockLevel of 0 means that the door can't be picklocked
                // LockLevel of -255 means it's magic locked
                item.SendLocalizedMessageTo(from, 502073); // This lock cannot be picked by normal means
                return;
            }

            if (from.Skills[SkillName.Lockpicking].Value < lockpickable.RequiredSkill - SkillBonus)
            {
                /*
                 * // Do some training to gain skills
                 * from.CheckSkill( SkillName.Lockpicking, 0, lockpickable.LockLevel );*/
                // The LockLevel is higher thant the LockPicking of the player
                item.SendLocalizedMessageTo(from, 502072); // You don't see how that lock can be manipulated.
                return;
            }

            int maxlevel = lockpickable.MaxLockLevel;
            int minLevel = lockpickable.LockLevel;

            if (lockpickable is Skeletonkey)
            {
                minLevel -= SkillBonus;
                maxlevel -= SkillBonus; //regulars subtract the bonus from the max level
            }

            if (this is MasterSkeletonKey || from.CheckTargetSkill(SkillName.Lockpicking, lockpickable, minLevel, maxlevel))
            {
                // Success! Pick the lock!
                OnUse();

                item.SendLocalizedMessageTo(from, 502076); // The lock quickly yields to your skill.
                from.PlaySound(0x4A);
                lockpickable.LockPick(from);
            }
            else
            {
                // The player failed to pick the lock
                BrokeLockPickTest(from);
                item.SendLocalizedMessageTo(from, 502075); // You are unable to pick the lock.

                if (item is TreasureMapChest && ((Container)item).Items.Count > 0 && 0.25 > Utility.RandomDouble())
                {
                    Container cont = (Container)item;

                    Item toBreak = cont.Items[Utility.Random(cont.Items.Count)];

                    if (!(toBreak is Container))
                    {
                        toBreak.Delete();
                        Effects.PlaySound(item.Location, item.Map, 0x1DE);
                        from.SendMessage(0x20, "The sound of gas escaping is heard from the chest.");
                    }
                }
            }
        }
Beispiel #13
0
                protected override void OnTick()
                {
                    Item item = (Item)m_Item;

                    if (!m_From.InRange(item.GetWorldLocation(), 1))
                    {
                        return;
                    }

                    bool canPsy = m_From.Competences[CompType.Psychologie].roll(10);

                    foreach (NubiaMobile m in m_From.GetMobilesInRange(6))
                    {
                        if (m is NubiaPlayer && m != m_From)
                        {
                            if (m.Competences[CompType.PerceptionAuditive].intRoll(false) >= m_From.Competences[CompType.Discretion].intRoll())
                            {
                                if (canPsy)
                                {
                                    m_From.SendMessage("{0} semble vous avoir repérez, vous manquez de discretion !", m.Name);
                                }
                                m_From.PrivateOverheadMessage(Server.Network.MessageType.Emote, 0, false, "*crochète une serrure*", m.NetState);
                            }
                        }
                    }

                    if (m_From.Competences[CompType.Crochetage].getPureMaitrise() < m_Item.MiniMaitrise ||
                        m_From.Competences[CompType.Crochetage].getPureMaitrise() + 20 < (int)m_Item.Serrure)
                    {
                        /*
                         * // Do some training to gain skills
                         * m_From.CheckSkill( SkillName.Lockpicking, 0, m_Item.LockLevel );*/

                        // The LockLevel is higher thant the LockPicking of the player
                        m_From.SendMessage("Réussite impossible");
                        item.SendLocalizedMessageTo(m_From, 502072); // You don't see how that lock can be manipulated.
                        return;
                    }

                    int malus = 0;

                    if (m_Lockpick == null)
                    {
                        malus = -4;
                        m_From.SendMessage("Vous n'avez pas d'outils, malus de circonstance de " + malus.ToString());
                    }

                    if (m_From.Competences[CompType.Crochetage].roll((int)m_Item.Serrure + malus))
                    {
                        // Success! Pick the lock!
                        item.SendLocalizedMessageTo(m_From, 502076); // The lock quickly yields to your skill.
                        m_From.PlaySound(0x4A);
                        m_Item.LockPick(m_From);
                    }
                    else
                    {
                        // The player failed to pick the lock
                        item.SendLocalizedMessageTo(m_From, 502075); // You are unable to pick the lock.
                    }

                    //Consomation du lockPick
                    if (m_Lockpick != null && !m_From.Competences[CompType.Crochetage].roll((int)m_Item.Serrure))
                    {
                        BrokeLockPickTest();
                    }
                }
                protected override void OnTick()
                {
                    Item item = (Item)m_Item;

                    if (!m_From.InRange(item.GetWorldLocation(), 1))
                    {
                        return;
                    }

                    if (m_Item.LockLevel == 0 || m_Item.LockLevel == -255)
                    {
                        // LockLevel of 0 means that the door can't be picklocked
                        // LockLevel of -255 means it's magic locked
                        item.SendLocalizedMessageTo(m_From, 502073);                           // This lock cannot be picked by normal means
                        return;
                    }

                    if (m_From.Skills[SkillName.Lockpicking].Value < m_Item.RequiredSkill)
                    {
                        /*
                         * // Do some training to gain skills
                         * m_From.CheckSkill( SkillName.Lockpicking, 0, m_Item.LockLevel );*/

                        // The LockLevel is higher thant the LockPicking of the player
                        m_From.SendMessage("Trying to manipulate the contraption resulted in a broken lockpick.");
                        m_Lockpick.Consume();
                        return;
                    }

                    if (m_From.CheckTargetSkill(SkillName.Lockpicking, m_Item, m_Item.LockLevel, m_Item.MaxLockLevel))
                    {
                        // Success! Pick the lock!
                        m_From.SendMessage("Woot! You succeed at picking the lock.");
                        m_From.PlaySound(0x4A);
                        m_Item.LockPick(m_From);
                    }
                    else
                    {
                        // The player failed to pick the lock
                        BrokeLockPickTest();
                        item.SendLocalizedMessageTo(m_From, 502075);                           // You are unable to pick the lock.

                        // ==== Random Item Disintergration upon Failure ====
                        if ((Core.SA) && m_Item is TreasureMapChest)
                        {
                            int i_Num = 0; Item i_Destroy = null;

                            BaseContainer m_chest = m_Item as BaseContainer;
                            Item          Dust    = new DustPile();

                            for (int i = 10; i > 0; i--)
                            {
                                i_Num = Utility.Random(m_chest.Items.Count);
                                // Make sure DustPiles aren't called for destruction
                                if ((m_chest.Items.Count > 0) && m_chest.Items[i_Num] is DustPile)
                                {
                                    for (int ci = (m_chest.Items.Count - 1); ci >= 0; ci--)
                                    {
                                        i_Num = ci;
                                        if (i_Num < 0)
                                        {
                                            i_Num = 0;
                                        }

                                        if (m_chest.Items[i_Num] is DustPile)
                                        {
                                            i_Destroy = null;
                                        }
                                        else
                                        {
                                            i_Destroy = m_chest.Items[i_Num];
                                            i_Num     = i_Num; i = 0;
                                        }
                                        // Nothing left but Dust
                                        if (ci < 0 && i > 0)
                                        {
                                            i_Destroy = null; i = 0;
                                        }
                                    }
                                }
                                // Item targetted =+= prepare for object DOOM! >;D
                                else
                                {
                                    i_Destroy = m_chest.Items[i_Num]; i = 0;
                                }
                            }
                            // Delete chosen Item and drop a Dust Pile
                            if (i_Destroy is Gold)
                            {
                                if (i_Destroy.Amount > 1000)
                                {
                                    i_Destroy.Amount -= 1000;
                                }
                                else
                                {
                                    i_Destroy.Delete();
                                }

                                Dust.Hue = 1177; m_chest.DropItem(Dust);
                            }
                            else if (i_Destroy != null)
                            {
                                i_Destroy.Delete(); m_chest.DropItem(Dust);
                            }
                            Effects.PlaySound(m_chest.Location, m_chest.Map, 0x1DE);
                            m_chest.PublicOverheadMessage(MessageType.Regular, 2004, false, "The sound of gas escaping is heard from the chest.");
                        }
                    }
                }