OnPlacement() public method

public OnPlacement ( Mobile from, Point3D p ) : bool
from Mobile
p Point3D
return bool
        protected override void OnTarget(Mobile from, object o)
        {
            if (!from.CheckAlive())
            {
                return;
            }

            IPoint3D ip = o as IPoint3D;

            if (ip != null)
            {
                if (ip is Item)
                {
                    ip = ((Item)ip).GetWorldTop();
                }

                Point3D p = new Point3D(ip);

                Region reg = Region.Find(new Point3D(p), from.Map);

                if (from.AccessLevel >= AccessLevel.GameMaster || reg.AllowHousing(from, p))
                {
                    m_Placed = m_Entry.OnPlacement(from, p);
                }
                else if (reg is TreasureRegion)
                {
                    from.SendLocalizedMessage(1043287);                       // The house could not be created here.  Either something is blocking the house, or the house would not be on valid terrain.
                }
                else
                {
                    from.SendLocalizedMessage(501265);                       // Housing can not be created in this area.
                }
            }
        }
Ejemplo n.º 2
0
		protected override void OnTarget( Mobile from, object o )
		{
			if ( !from.CheckAlive() || from.Backpack == null || from.Backpack.FindItemByType( typeof( HousePlacementTool ) ) == null  )
				return;

			IPoint3D ip = o as IPoint3D;

			if ( ip != null )
			{
				if ( ip is Item )
					ip = ((Item)ip).GetWorldTop();

				Point3D p = new Point3D( ip );

				Region reg = Region.Find( new Point3D( p ), from.Map );

				if ( from.AccessLevel >= AccessLevel.GameMaster || reg.AllowHousing( from, p ) )
					m_Placed = m_Entry.OnPlacement( from, p );

				else if ( reg.IsPartOf( typeof( TempNoHousingRegion ) ) )
					from.SendLocalizedMessage( 501270 ); // Lord British has decreed a 'no build' period, thus you cannot build this house at this time.
				
                else if ( reg.IsPartOf( typeof( TreasureRegion ) ) || reg.IsPartOf( typeof( HouseRegion ) ) )
					from.SendLocalizedMessage( 1043287 ); // The house could not be created here.  Either something is blocking the house, or the house would not be on valid terrain.
				
                else if ( reg.IsPartOf( typeof( HouseRaffleRegion ) ) )
					from.SendLocalizedMessage( 1150493 ); // You must have a deed for this plot of land in order to build here.
				
                else
					from.SendLocalizedMessage( 501265 ); // Housing can not be created in this area.
			}
		}