Exemplo n.º 1
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (m_Item.Deleted)
                {
                    return;
                }

                if (targeted is BreakableContainer)
                {
                    BreakableContainer breakableContainer = targeted as BreakableContainer;

                    if (breakableContainer.LockpickDamageScalar > 0)
                    {
                        breakableContainer.Interact(from, BreakableContainer.InteractionType.Lockpick);
                    }
                    else
                    {
                        breakableContainer.Interact(from, BreakableContainer.InteractionType.None);
                    }

                    return;
                }

                if (targeted is BreakableStatic)
                {
                    BreakableStatic breakableStatic = targeted as BreakableStatic;

                    if (breakableStatic.LockpickDamageScalar > 0)
                    {
                        breakableStatic.Interact(from, BreakableStatic.InteractionType.Lockpick);
                    }
                    else
                    {
                        breakableStatic.Interact(from, BreakableStatic.InteractionType.None);
                    }

                    return;
                }

                if (targeted is Hold)
                {
                    Hold hold = targeted as Hold;
                    hold.LockpickHold(from, m_Item);

                    return;
                }

                if (targeted is ILockpickable)
                {
                    Item item = (Item)targeted;
                    from.Direction = from.GetDirectionTo(item);

                    from.BeginAction(typeof(Lockpick));

                    Timer.DelayCall(TimeSpan.FromSeconds(SkillCooldown.LockpickingCooldown), delegate
                    {
                        if (from != null)
                        {
                            from.EndAction(typeof(Lockpick));
                        }
                    });

                    if (((ILockpickable)targeted).Locked)
                    {
                        from.PlaySound(0x241);
                        new InternalTimer(from, (ILockpickable)targeted, m_Item).Start();
                    }

                    else
                    {
                        // The door is not locked
                        from.SendLocalizedMessage(502069); // This does not appear to be locked
                    }
                }

                else
                {
                    from.SendLocalizedMessage(501666); // You can't unlock that!
                }
            }
Exemplo n.º 2
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (m_Item.Deleted)
                {
                    return;
                }

                if (targeted is BreakableContainer)
                {
                    BreakableContainer breakableContainer = targeted as BreakableContainer;

                    if (breakableContainer.LockpickDamageScalar > 0)
                    {
                        breakableContainer.Interact(from, BreakableContainer.InteractionType.Lockpick);
                    }
                    else
                    {
                        breakableContainer.Interact(from, BreakableContainer.InteractionType.None);
                    }

                    return;
                }

                if (targeted is BreakableStatic)
                {
                    BreakableStatic breakableStatic = targeted as BreakableStatic;

                    if (breakableStatic.LockpickDamageScalar > 0)
                    {
                        breakableStatic.Interact(from, BreakableStatic.InteractionType.Lockpick);
                    }
                    else
                    {
                        breakableStatic.Interact(from, BreakableStatic.InteractionType.None);
                    }

                    return;
                }

                if (targeted is Hold)
                {
                    Hold hold = targeted as Hold;
                    hold.LockpickHold(from, m_Item);

                    return;
                }

                if (targeted is ILockpickable)
                {
                    if (targeted is BaseTreasureChest)
                    {
                        PlayerMobile player = from as PlayerMobile;

                        if (player != null)
                        {
                            CaptchaPersistance.CheckAndCreateCaptchaAccountEntry(player);

                            if (!player.m_CaptchaAccountData.Attempt(player, CaptchaSourceType.DungeonChest))
                            {
                                return;
                            }
                        }
                    }

                    Item item = (Item)targeted;
                    from.Direction = from.GetDirectionTo(item);

                    from.BeginAction(typeof(Lockpick));

                    Timer.DelayCall(TimeSpan.FromSeconds(SkillCooldown.LockpickingCooldown), delegate
                    {
                        if (from != null)
                        {
                            from.EndAction(typeof(Lockpick));
                        }
                    });

                    if (((ILockpickable)targeted).Locked)
                    {
                        from.PlaySound(0x241);
                        new InternalTimer(from, (ILockpickable)targeted, m_Item).Start();
                    }

                    else
                    {
                        // The door is not locked
                        from.SendLocalizedMessage(502069); // This does not appear to be locked
                    }
                }

                else
                {
                    from.SendLocalizedMessage(501666); // You can't unlock that!
                }
            }