Exemple #1
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (m_Key.Deleted || !m_Key.IsChildOf(from.Backpack))
                {
                    //from.SendLocalizedMessage( 501661 ); // That key is unreachable.
                    from.SendAsciiMessage("That key is unreachable");
                    return;
                }

                //int number;

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

                    from.Prompt = new RenamePrompt(m_Key);
                }
                else if (targeted is ILockable)
                {
                    if (m_Key.UseOn(from, (ILockable)targeted))
                    {
                    }
                    else
                    {
                        //number = 501668; // This key doesn't seem to unlock that.
                        from.SendAsciiMessage("This key doesn't seem to unlock that.");
                    }
                }
                else if (targeted is HouseSign)
                {
                    HouseSign sign = (HouseSign)targeted;

                    if (m_Key.KeyValue == sign.keyValue)
                    {
                        from.SendAsciiMessage("What dost thou wish the sign to say?");
                        from.Prompt = new HouseRenamePrompt(sign.Owner);
                        //number = -1;
                    }
                    else
                    {
                        //number = 501666; // You can't unlock that!
                        from.SendAsciiMessage("This key doesn't seem to work on that.");
                    }
                }
                else
                {
                    //number = 501666; // You can't unlock that!
                    from.SendAsciiMessage("You can't unlock that!");
                }

                /*if ( number != -1 )
                 * {
                 *      from.SendLocalizedMessage( number );
                 * }*/
            }
Exemple #2
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (m_Key.Deleted || !m_Key.IsChildOf(from.Backpack))
                {
                    from.SendLocalizedMessage(501661); // That key is unreachable.
                    return;
                }

                int number;

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

                    from.Prompt = new RenamePrompt(m_Key);
                }
                else if (targeted is ILockable)
                {
                    if (targeted is Plank && ((Plank)targeted).IsOpen)
                    {
                        ((Item)targeted).SendLocalizedMessageTo(from, 501671); // You cannot currently lock that.
                        return;
                    }

                    if (m_Key.UseOn(from, (ILockable)targeted))
                    {
                        number = -1;
                    }
                    else
                    {
                        number = 501668; // This key doesn't seem to unlock that.
                    }
                }
                else
                {
                    number = 501666; // You can't unlock that!
                }

                if (number != -1)
                {
                    from.SendLocalizedMessage(number);
                }
            }
Exemple #3
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                // if it's NOT movable, allow use (access check for friends, etc. has already been performed by this point)
                if (m_Key.Movable)
                {
                    if (m_Key.Deleted || !m_Key.IsChildOf(from.Backpack))
                    {
                        from.SendLocalizedMessage(501661); // That key is unreachable.
                        return;
                    }
                }

                int number;

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

                    from.Prompt = new RenamePrompt(m_Key);
                }
                else if (targeted is ILockable)
                {
                    if (m_Key.UseOn(from, (ILockable)targeted))
                    {
                        number = -1;
                    }
                    else
                    {
                        number = 501668;                         // This key doesn't seem to unlock that.
                    }
                }
                else
                {
                    number = 501666;                     // You can't unlock that!
                }

                if (number != -1)
                {
                    from.SendLocalizedMessage(number);
                }
            }
Exemple #4
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (m_Key.Deleted || !m_Key.IsChildOf(from.Backpack))
                {
                    from.SendLocalizedMessage(501661); // That key is unreachable.
                    return;
                }
                if (targeted == m_Key)
                {
                    from.SendLocalizedMessage(501665); // Enter a description for this key.
                    from.Prompt = new RenamePrompt(m_Key);
                }
                else if (!from.InRange(targeted, 3) || !from.InLOS(targeted))
                {
                    from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1019045); // I can't reach that.
                }
                else if (targeted is Item)
                {
                    Item   target     = (Item)targeted;
                    Region itemRegion = Region.Find(target.Location, target.Map);

                    if (itemRegion is Regions.HouseRegion)
                    {
                        BaseHouse house = ((Regions.HouseRegion)itemRegion).House;

                        if (house == null || !from.Alive || house.Deleted)
                        {
                            return;
                        }
                        if (house.HouseKeyVal == m_Key.KeyValue)
                        {
                            if (target.RootParent != null)
                            {
                                from.SendAsciiMessage("You can not lock that down");
                                return;
                            }
                            if (target is BaseDoor)
                            {
                                if (m_Key.UseOn(from, (ILockable)targeted))
                                {
                                    return;
                                }

                                from.SendAsciiMessage("The key does not fit that lock");
                                return;
                            }
                            if (!target.Movable && !house.IsLockedDown(target))
                            {
                                from.SendAsciiMessage("You can't unlock that!");
                                return;
                            }
                            if (m_Key.OnHouseItemTarget(from, target, ((Regions.HouseRegion)itemRegion).House))
                            {
                                return;
                            }
                        }
                    }
                    if (target is ILockable)
                    {
                        if (m_Key.UseOn(from, (ILockable)target))
                        {
                            return;
                        }

                        from.SendAsciiMessage("The key does not fit that lock");
                        return;
                    }
                    if (itemRegion is Regions.HouseRegion)
                    {
                        from.SendAsciiMessage(((Regions.HouseRegion)itemRegion).House != null ? "You must use the house key to lock down or unlock items." : "That does not have a lock.");
                        return;
                    }
                }
                else
                {
                    from.SendAsciiMessage("You can't use a key on that!");
                }

                /*
                 * if (targeted is ILockable && m_Key.UseOn(from, (ILockable)targeted))
                 *      number = -1;
                 *  else
                 *  {
                 *      Item target = (Item)targeted;
                 *      BaseHouse house = BaseHouse.FindHouseAt(from);
                 *
                 *      if (target.RootParent == null)
                 *      {
                 *          if (house != null )
                 *          {
                 *              m_Key.OnHouseItemTarget(from, target, house);
                 *              return;
                 *          }
                 *      }
                 *
                 *      from.SendAsciiMessage("That does not have a lock.");
                 *      number = -1;
                 *  }
                 * }
                 * else
                 * {
                 *  number = 501666; // You can't unlock that!
                 * }
                 * if (number != -1)
                 *  from.SendLocalizedMessage(number);*/
            }