Exemplo n.º 1
0
        public override void OnDoubleClick(Mobile from)
        {
            ArrayList list = StrongBox.Table[from] as ArrayList;

            if (list != null && list.Count > 1)
            {
                from.SendAsciiMessage("You already own a strong box, you cannot place another!");
                return;
            }

            BaseHouse h = BaseHouse.FindHouseAt(from);

            if (h != null && h.IsOwner(from) && !(h is Tent) && h.IsInside(from))
            {
                IPooledEnumerable eable = h.GetItemsInRange(18);
                foreach (Item i in eable)
                {
                    if (h.IsInside(i))
                    {
                        if (i is BaseDoor && (i.X == from.X || i.Y == from.Y) && from.GetDistanceToSqrt(i) < 2 && i.Z - 5 < from.Z && i.Z + 5 > from.Z)
                        {
                            from.SendAsciiMessage("You cannot place this in front of a door.");
                            eable.Free();
                            return;
                        }
                        else if (i is StrongBox)
                        {
                            from.SendAsciiMessage("There is already a strong box in this house.");
                            eable.Free();
                            return;
                        }
                    }
                }
                eable.Free();

                StrongBox s = new StrongBox(from, h);
                s.MoveToWorld(from.Location, from.Map);
                this.Delete();
            }
            else
            {
                from.SendAsciiMessage("You must be in a house you own in order to place a strong box.");
            }
        }
Exemplo n.º 2
0
		public void AddStrongBox( Mobile from )
		{
			if ( !IsCoOwner( from ) || !IsActive )
				return;

			if ( from == Owner )
			{
				from.SendLocalizedMessage( 502109 ); // Owners don't get a strong box
				return;
			}

			if ( IsAosRules ? !CheckAosLockdowns( 1 ) : ((LockDownCount + 1) > m_MaxLockDowns) )
			{
				from.SendLocalizedMessage( 1005379 );//That would exceed the maximum lock down limit for this house
				return;
			}

			foreach ( SecureInfo info in m_Secures )
			{
				Container c = info.Item;

				if ( !c.Deleted && c is StrongBox && ((StrongBox)c).Owner == from )
				{
					from.SendLocalizedMessage( 502112 );//You already have a strong box
					return;
				}
			}

			for ( int i = 0; m_Doors != null && i < m_Doors.Count; ++i )
			{
				BaseDoor door = m_Doors[i] as BaseDoor;
				Point3D p = door.Location;

				if ( door.Open )
					p = new Point3D( p.X - door.Offset.X, p.Y - door.Offset.Y, p.Z - door.Offset.Z );

				if ( (from.Z + 16) >= p.Z && (p.Z + 16) >= from.Z )
				{
					if ( from.InRange( p, 1 ) )
					{
						from.SendLocalizedMessage( 502113 ); // You cannot place a strongbox near a door or near steps.
						return;
					}
				}
			}

			StrongBox sb = new StrongBox( from, this );
			sb.Movable = false;
			sb.IsLockedDown = false;
			sb.IsSecure = true;
			m_Secures.Add( new SecureInfo( sb, SecureLevel.CoOwners ) );
			sb.MoveToWorld( from.Location, from.Map );
		}
Exemplo n.º 3
0
        public override void OnDoubleClick( Mobile from )
        {
            ArrayList list = StrongBox.Table[from] as ArrayList;
            if ( list != null && list.Count > 1 )
            {
                from.SendAsciiMessage( "You already own a strong box, you cannot place another!" );
                return;
            }

            BaseHouse h = BaseHouse.FindHouseAt( from );
            if ( h != null && h.IsOwner( from ) && !(h is Tent) && h.IsInside( from ) )
            {
                IPooledEnumerable eable = h.GetItemsInRange( 18 );
                foreach ( Item i in eable )
                {
                    if ( h.IsInside( i ) )
                    {
                        if ( i is BaseDoor && ( i.X == from.X || i.Y == from.Y ) && from.GetDistanceToSqrt( i ) < 2 && i.Z-5 < from.Z && i.Z+5 > from.Z )
                        {
                            from.SendAsciiMessage( "You cannot place this in front of a door." );
                            eable.Free();
                            return;
                        }
                        else if ( i is StrongBox )
                        {
                            from.SendAsciiMessage( "There is already a strong box in this house." );
                            eable.Free();
                            return;
                        }
                    }
                }
                eable.Free();

                StrongBox s = new StrongBox( from, h );
                s.MoveToWorld( from.Location, from.Map );
                this.Delete();
            }
            else
            {
                from.SendAsciiMessage( "You must be in a house you own in order to place a strong box." );
            }
        }
Exemplo n.º 4
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                int number = -1;

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

                    from.Prompt = new RenamePrompt(m_Key);
                }
                else if (targeted is StrongBox)
                {
                    StrongBox sb = (StrongBox)targeted;

                    if (sb.Owner == null || sb.Owner.Deleted)
                    {
                        from.SendAsciiMessage("You can not recover that strong box.");
                        return;
                    }

                    if (sb.Owner == from || sb.Owner.Account == from.Account)
                    {
                        while (sb.Items.Count > 0)
                        {
                            ((Item)sb.Items[0]).MoveToWorld(sb.Location, sb.Map);
                        }
                        sb.Delete();
                        from.AddToBackpack(new StrongBoxDeed());
                    }
                    else
                    {
                        from.SendAsciiMessage("You do not own that strong box.");
                    }
                }
                else if (targeted is ILockable)
                {
                    ILockable o = (ILockable)targeted;

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

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

                                if (o.Locked)
                                {
                                    item.SendLocalizedMessageTo(from, 1048000);
                                }
                                else
                                {
                                    item.SendLocalizedMessageTo(from, 1048001);
                                }
                            }
                        }
                    }
                    else
                    {
                        number = 501668;                         // This key doesn't seem to unlock that.
                    }
                }
                else if (targeted is HouseSign)
                {
                    HouseSign sign = (HouseSign)targeted;
                    if (sign.Owner != null && sign.Owner.KeyValue == m_Key.KeyValue)
                    {
                        from.Prompt = new Prompts.HouseRenamePrompt(sign.Owner);
                        number      = 1060767;                    // Enter the new name of your house.
                    }
                }
                else
                {
                    number = 501666;                     // You can't unlock that!
                }

                if (number != -1)
                {
                    from.SendLocalizedMessage(number);
                }
            }