public bool OnPlacement(Mobile from, Point3D p)
		{
			if (!from.CheckAlive() || from.Backpack == null || from.Backpack.FindItemByType(typeof(HousePlacementTool)) == null)
			{
				return false;
			}

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

			switch (res)
			{
				case HousePlacementResult.Valid:
					{
						if (from.AccessLevel < AccessLevel.GameMaster && BaseHouse.HasAccountHouse(from))
						{
							from.SendLocalizedMessage(501271); // You already own a house, you may not place another!
						}
						else
						{
							from.SendLocalizedMessage(1011576); // This is a valid location.

							var prev = new PreviewHouse(MultiID);

							MultiComponentList mcl = prev.Components;

							var banLoc = new Point3D(center.X + mcl.Min.X, center.Y + mcl.Max.Y + 1, center.Z);

							foreach (MultiTileEntry entry in mcl.List)
							{
								int itemID = entry.m_ItemID;

								if (itemID < 0xBA3 || itemID > 0xC0E)
								{
									continue;
								}

								banLoc = new Point3D(center.X + entry.m_OffsetX, center.Y + entry.m_OffsetY, center.Z);
								break;
							}

							foreach (object o in toMove)
							{
								if (o is Mobile)
								{
									((Mobile)o).Location = banLoc;
								}
								else if (o is Item)
								{
									((Item)o).Location = banLoc;
								}
							}

							prev.MoveToWorld(center, from.Map);

							/* You are about to place a new house.
						 * Placing this house will condemn any and all of your other houses that you may have.
						 * All of your houses on all shards will be affected.
						 *
						 * In addition, you will not be able to place another house or have one transferred to you for one (1) real-life week.
						 *
						 * Once you accept these terms, these effects cannot be reversed.
						 * Re-deeding or transferring your new house will not uncondemn your other house(s) nor will the one week timer be removed.
						 *
						 * If you are absolutely certain you wish to proceed, click the button next to OKAY below.
						 * If you do not wish to trade for this house, click CANCEL.
						 */
							//from.SendGump( new WarningGump( 1060635, 30720, 1049583, 32512, 420, 280, new WarningGumpCallback( PlacementWarning_Callback ), prev ) );

							from.SendGump(
								new WarningGump(
									1060635, 30720, @"!!! VERY IMPORTANT UOFOREVER WARNING !!!
IF you accept this house placement, be aware that while demolishing a CLASSIC house returns the house deed to you, the deed is WORTH MUCH LESS than the buying price to NPC real estate brokers! (i.e. you will NOT get back NEARLY what you paid for it from NPCs!). Demolishing a CUSTOM house gives you a check for MUCH LESS than the buying price!

You MAY be able to sell classic house deeds to other players, but be aware that the NPC buy-back is SIGNIFICANTLY reduced!", 16777215, 420, 280, PlacementWarning_Callback, prev));

							return true;
						}

						break;
					}
				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:
					{
						// The house could not be created here.  
						// Either something is blocking the house, or the house would not be on valid terrain.
						from.SendLocalizedMessage(1043287);
						break;
					}
				case HousePlacementResult.BadRegion:
					{
						from.SendLocalizedMessage(501265); // Housing cannot be created in this area.
						break;
					}
				case HousePlacementResult.BadRegionTemp:
					{
						//Lord British has decreed a 'no build' period, thus you cannot build this house at this time.
						from.SendLocalizedMessage(501270);
						break;
					}
				case HousePlacementResult.BadRegionRaffle:
					{
						from.SendLocalizedMessage(1150493); // You must have a deed for this plot of land in order to build here.
						break;
					}
				case HousePlacementResult.InvalidCastleKeep:
					{
						from.SendLocalizedMessage(1061122); // Castles and keeps cannot be created here.
						break;
					}
			}

			return false;
		}
        public bool OnPlacement( Mobile from, Point3D p )
        {
            if ( !from.CheckAlive() || from.Backpack == null || from.Backpack.FindItemByType( typeof( HousePlacementTool ) ) == null  )
                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:
                {
                    if ( from.AccessLevel < AccessLevel.GameMaster && BaseHouse.HasAccountHouse( from ) )
                    {
                        from.SendLocalizedMessage( 501271 ); // You already own a house, you may not place another!
                    }
                    else
                    {
                        from.SendLocalizedMessage( 1011576 ); // This is a valid location.

                        PreviewHouse prev = new PreviewHouse( m_MultiID );

                        MultiComponentList mcl = prev.Components;

                        Point3D banLoc = new Point3D( center.X + mcl.Min.X, center.Y + mcl.Max.Y + 1, center.Z );

                        for ( int i = 0; i < mcl.List.Length; ++i )
                        {
                            MultiTileEntry entry = mcl.List[i];

                            int itemID = entry.m_ItemID & 0x3FFF;

                            if ( itemID >= 0xBA3 && itemID <= 0xC0E )
                            {
                                banLoc = new Point3D( center.X + entry.m_OffsetX, center.Y + entry.m_OffsetY, center.Z );
                                break;
                            }
                        }

                        for ( int i = 0; i < toMove.Count; ++i )
                        {
                            object o = toMove[i];

                            if ( o is Mobile )
                                ((Mobile)o).Location = banLoc;
                            else if ( o is Item )
                                ((Item)o).Location = banLoc;
                        }

                        prev.MoveToWorld( center, from.Map );

                        /* You are about to place a new house.
                         * Placing this house will condemn any and all of your other houses that you may have.
                         * All of your houses on all shards will be affected.
                         *
                         * In addition, you will not be able to place another house or have one transferred to you for one (1) real-life week.
                         *
                         * Once you accept these terms, these effects cannot be reversed.
                         * Re-deeding or transferring your new house will not uncondemn your other house(s) nor will the one week timer be removed.
                         *
                         * If you are absolutely certain you wish to proceed, click the button next to OKAY below.
                         * If you do not wish to trade for this house, click CANCEL.
                         */
                        from.SendGump( new WarningGump( 1060635, 30720, 1049583, 32512, 420, 280, new WarningGumpCallback( PlacementWarning_Callback ), prev ) );

                        return true;
                    }

                    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;
                }
                case HousePlacementResult.InvalidCastleKeep:
                {
                    from.SendLocalizedMessage( 1061122 ); // Castles and keeps cannot be created here.
                    break;
                }
            }

            return false;
        }
Esempio n. 3
0
		public bool OnPlacement( Mobile from, Point3D p )
		{
			if ( !from.CheckAlive() )
				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:
				{
					if ( from.AccessLevel < AccessLevel.Player && BaseHouse.HasAccountHouse( from ) )
					{
						from.SendLocalizedMessage( 501271 ); // You already own a house, you may not place another!
					}
					else
					{
						from.SendLocalizedMessage( 1011576 ); // This is a valid location.

						PreviewHouse prev = new PreviewHouse( m_MultiID );

						MultiComponentList mcl = prev.Components;

						Point3D banLoc = new Point3D( center.X + mcl.Min.X, center.Y + mcl.Max.Y + 1, center.Z );

						for ( int i = 0; i < mcl.List.Length; ++i )
						{
							MultiTileEntry entry = mcl.List[i];

							int itemID = entry.m_ItemID & 0x3FFF;

							if ( itemID >= 0xBA3 && itemID <= 0xC0E )
							{
								banLoc = new Point3D( center.X + entry.m_OffsetX, center.Y + entry.m_OffsetY, center.Z );
								break;
							}
						}

						for ( int i = 0; i < toMove.Count; ++i )
						{
							object o = toMove[i];

							if ( o is Mobile )
								((Mobile)o).Location = banLoc;
							else if ( o is Item )
								((Item)o).Location = banLoc;
						}

						prev.MoveToWorld( center, from.Map );

						/* You are about to place a new house.
						 * Placing this house will condemn any and all of your other houses that you may have.
						 * All of your houses on all shards will be affected.
						 * 
						 * In addition, you will not be able to place another house or have one transferred to you for one (1) real-life week.
						 * 
						 * Once you accept these terms, these effects cannot be reversed.
						 * Re-deeding or transferring your new house will not uncondemn your other house(s) nor will the one week timer be removed.
						 * 
						 * If you are absolutely certain you wish to proceed, click the button next to OKAY below.
						 * If you do not wish to trade for this house, click CANCEL.
						 */
						from.SendMessage( "This House Seems To fit Here" );

						return true;
					}

					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.BadRegionTownship:
				{
					from.SendMessage("You are not authorized to build in this township.");
					break;
				}
			}

			return false;
		}