Пример #1
0
        public void SurveyNotice_Callback(Mobile from, object state)
        {
            SurveyPreviewHouse prev = state as SurveyPreviewHouse;

            if (state != null)
            {
                prev.Delete();
            }
        }
Пример #2
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);
        }