Exemplo n.º 1
0
                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.SendAsciiMessageTo(m_From, "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.SendAsciiMessageTo(m_From, "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.SendAsciiMessageTo(m_From, "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.SendAsciiMessageTo(m_From, "You are unable to pick the lock.");                           //
                    }
                }
Exemplo n.º 2
0
                protected void BrokeLockPickTest()
                {
                    // When failed, a 25% chance to break the lockpick
                    if (Utility.Random(4) == 0)
                    {
                        Item item = (Item)m_Item;

                        //
                        item.SendAsciiMessageTo(m_From, "You broke the lockpick.");

                        m_From.PlaySound(0x3A4);
                        m_Lockpick.Consume();
                    }
                }
Exemplo n.º 3
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (targeted == m_keyring)
                {
                    for (int i = 0; i < m_keyring.m_Keys.Count; i++)
                    {
                        KeyringEntry entry = m_keyring.m_Keys[i] as KeyringEntry;
                        Key          key   = new Key();
                        key.KeyValue    = entry.KeyValue;
                        key.Link        = entry.Link;
                        key.MaxRange    = entry.MaxRange;
                        key.ItemID      = entry.ItemID;
                        key.LootType    = entry.LootType;
                        key.Description = entry.Description;
                        from.AddToBackpack(key);
                        m_keyring.ItemID = 0x1011;
                        m_keyring.Weight = 1;
                    }
                    m_keyring.m_Keys.Clear();
                }
                else if (targeted is ILockable)
                {
                    ILockable o = (ILockable)targeted;

                    for (int i = 0; i < m_keyring.m_Keys.Count; i++)
                    {
                        KeyringEntry entry = m_keyring.m_Keys[i] as KeyringEntry;

                        if (o.KeyValue == entry.KeyValue)
                        {
                            if (o is BaseDoor && !((BaseDoor)o).UseLocks())
                            {
                                from.SendAsciiMessage("This key doesn't seem to unlock that.");
                            }
                            else
                            {
                                o.Locked = !o.Locked;
                                Didit    = true;

                                if (o is LockableContainer)
                                {
                                    LockableContainer cont = (LockableContainer)o;

                                    if (cont.LockLevel == -255)
                                    {
                                        cont.LockLevel = cont.RequiredSkill - 10;
                                    }
                                }

                                if (targeted is Item)
                                {
                                    Item item = (Item)targeted;

                                    if (o.Locked)
                                    {
                                        item.SendAsciiMessageTo(from, "You lock it.");
                                    }
                                    else
                                    {
                                        item.SendAsciiMessageTo(from, "You unlock it.");
                                    }
                                }
                            }
                        }
                    }

                    if (!Didit)
                    {
                        from.SendAsciiMessage("No key seems to unlock that.");
                    }
                }
                else
                {
                    from.SendAsciiMessage("You can't unlock that!");
                }
            }
Exemplo n.º 4
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                string number;

                if (targeted == m_Key)
                {
                    number = "Enter a description for this key.";

                    from.Prompt = new RenamePrompt(m_Key);
                }
                else if (targeted is ILockable)
                {
                    number = "";

                    ILockable o = (ILockable)targeted;

                    if (o.KeyValue == m_Key.KeyValue)
                    {
                        if (o is BaseDoor && !((BaseDoor)o).UseLocks())
                        {
                            number = "This key doesn't seem to unlock that.";
                        }
                        else
                        {
                            o.Locked = !o.Locked;

                            if (o is LockableContainer)
                            {
                                LockableContainer cont = (LockableContainer)o;

                                if (cont.LockLevel == -255)
                                {
                                    cont.LockLevel = cont.RequiredSkill - 10;
                                }
                            }

                            if (targeted is Item)
                            {
                                Item item = (Item)targeted;

                                if (o.Locked)
                                {
                                    item.SendAsciiMessageTo(from, "You lock it.");
                                }
                                else
                                {
                                    item.SendAsciiMessageTo(from, "You unlock it.");
                                }
                            }
                        }
                    }
                    else
                    {
                        number = "This key doesn't seem to unlock that.";
                    }
                }
                else
                {
                    number = "You can't unlock that!";
                }

                if (number != "")
                {
                    from.SendAsciiMessage(number);
                }
            }