Exemplo n.º 1
0
        public bool OnPlacement(Mobile from, HouseSurveyTool tool, Point3D p)
        {
            if (!from.CheckAlive() || from.Backpack == null || tool == null || tool.UsesRemaining == 0 || !tool.IsChildOf(from.Backpack))
            {
                return(false);
            }

            if (SurveyPreviewHouse.PreviewHouseList.Contains(from))
            {
                from.SendMessage("You are already previewing a potential house location.");
                return(false);
            }

            ArrayList            toMove;
            Point3D              center = new Point3D(p.X - m_Offset.X, p.Y - m_Offset.Y, p.Z - m_Offset.Z);
            HousePlacementResult res    = HousePlacement.Check(from, m_MultiID, center, out toMove);

            switch (res)
            {
            case HousePlacementResult.Valid:
            {
                from.SendMessage("This is valid terrain to place a house.");                           // This is a valid location.

                SurveyPreviewHouse prev = new SurveyPreviewHouse(m_MultiID, from);

                MultiComponentList mcl = prev.Components;

                prev.MoveToWorld(center, from.Map);

                string message = "You have found valid terrain to place a house.  This preview will stay visible for 20 seconds.<BR><BR>Press OKAY to stop previewing this house.";

                from.SendGump(new NoticeGump(1060635, 30720, message, 0xFFC000, 420, 280, new NoticeGumpCallback(SurveyNotice_Callback), prev));

                return(true);
            }

            case HousePlacementResult.BadItem:
            case HousePlacementResult.BadLand:
            case HousePlacementResult.BadStatic:
            case HousePlacementResult.BadRegionHidden:
            case HousePlacementResult.NoSurface:
            {
                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.
                break;
            }

            case HousePlacementResult.BadRegion:
            {
                from.SendLocalizedMessage(501265);                           // Housing cannot be created in this area.
                break;
            }

            case HousePlacementResult.BadRegionTemp:
            {
                from.SendLocalizedMessage(501270);                           //Lord British has decreed a 'no build' period, thus you cannot build this house at this time.
                break;
            }
            }

            return(false);
        }
Exemplo n.º 2
0
        protected override void OnTarget(Mobile from, object o)
        {
            if (!from.CheckAlive() || from.Backpack == null || m_Tool == null || m_Tool.UsesRemaining == 0 || !m_Tool.IsChildOf(from.Backpack))
            {
                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, m_Tool, p);
                }
                else if (reg.IsPartOf(typeof(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.
                }
                if (m_Tool.UsesRemaining > 0)
                {
                    m_Tool.UsesRemaining--;
                    from.SendMessage("Your house survey tool lost part of its charge.");
                }
            }
        }
Exemplo n.º 3
0
        public override void OnResponse(Server.Network.NetState sender, RelayInfo info)
        {
            if (!m_From.CheckAlive() || m_From.Backpack == null || m_Tool == null || m_Tool.UsesRemaining == 0 || !m_Tool.IsChildOf(m_From.Backpack))
            {
                return;
            }

            switch (info.ButtonID)
            {
            case 1:                     // Classic Houses
            {
                m_From.SendGump(new HouseSurveyListGump(m_From, m_Tool, HouseSurveyEntry.ClassicHouses));
                break;
            }

            case 2:                     // 2-Story Customizable Houses
            {
                m_From.SendGump(new HouseSurveyListGump(m_From, m_Tool, HouseSurveyEntry.TwoStoryFoundations));
                break;
            }

            case 3:                     // 3-Story Customizable Houses
            {
                m_From.SendGump(new HouseSurveyListGump(m_From, m_Tool, HouseSurveyEntry.ThreeStoryFoundations));
                break;
            }
            }
        }
Exemplo n.º 4
0
        public override void OnResponse(Server.Network.NetState sender, RelayInfo info)
        {
            if (!m_From.CheckAlive() || m_From.Backpack == null || m_Tool == null || m_Tool.UsesRemaining == 0 || !m_Tool.IsChildOf(m_From.Backpack))
            {
                return;
            }

            int index = info.ButtonID - 1;

            if (index >= 0 && index < m_Entries.Length)
            {
                m_From.Target = new NewHouseSurveyTarget(m_Tool, m_Entries, m_Entries[index]);
            }
            else
            {
                m_From.SendGump(new HouseSurveyCategoryGump(m_From, m_Tool));
            }
        }
Exemplo n.º 5
0
		public bool OnPlacement( Mobile from, HouseSurveyTool tool, Point3D p )
		{
			if ( !from.CheckAlive() || from.Backpack == null || tool == null || tool.UsesRemaining == 0 || !tool.IsChildOf( from.Backpack )  )
				return false;

			if ( SurveyPreviewHouse.PreviewHouseList.Contains( from ) )
			{
				from.SendMessage( "You are already previewing a potential house location." );
				return false;
			}

			ArrayList toMove;
			Point3D center = new Point3D( p.X - m_Offset.X, p.Y - m_Offset.Y, p.Z - m_Offset.Z );
			HousePlacementResult res = HousePlacement.Check( from, m_MultiID, center, out toMove, false );

			switch ( res )
			{
				case HousePlacementResult.Valid:
				{
					from.SendMessage( "This is valid terrain to place a house." ); // This is a valid location.

					SurveyPreviewHouse prev = new SurveyPreviewHouse( m_MultiID, from );

					MultiComponentList mcl = prev.Components;

					prev.MoveToWorld( center, from.Map );

					string message = "You have found valid terrain to place a house.  This preview will stay visible for 20 seconds.<BR><BR>Press OKAY to stop previewing this house.";

					from.SendGump( new NoticeGump( 1060635, 30720, message, 0xFFC000, 420, 280, new NoticeGumpCallback( SurveyNotice_Callback ), prev ) );

					return true;
				}
                case HousePlacementResult.MobileBlocking:
                {
                    from.SendMessage("There is somebody in the way, and you can't place on top of them!");
                    break;
                }
                case HousePlacementResult.ItemBlocking:
                {
                    from.SendMessage("There is an item in the way, and you can't place on top of them!");
                    break;
                }
				case HousePlacementResult.BadItem:
				case HousePlacementResult.BadLand:
				case HousePlacementResult.BadStatic:
				case HousePlacementResult.BadRegionHidden:
				case HousePlacementResult.NoSurface:
				{
					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.
					break;
				}
				case HousePlacementResult.BadRegion:
				{
					from.SendLocalizedMessage( 501265 ); // Housing cannot be created in this area.
					break;
				}
				case HousePlacementResult.BadRegionTemp:
				{
					from.SendLocalizedMessage( 501270 ); //Lord British has decreed a 'no build' period, thus you cannot build this house at this time.
					break;
				}
			}

			return false;
		}