public void PlacementWarning_Callback( Mobile from, bool okay, object state )
{
if ( !from.CheckAlive() || from.Backpack == null || from.Backpack.FindItemByType( typeof( HousePlacementTool ) ) == null )
return;
PreviewHouse prevHouse = (PreviewHouse)state;
if ( !okay )
{
prevHouse.Delete();
return;
}
if ( prevHouse.Deleted )
{
/* Too much time has passed and the test house you created has been deleted.
* Please try again!
*/
from.SendGump( new NoticeGump( 1060637, 30720, 1060647, 32512, 320, 180, null, null ) );
return;
}
Point3D center = prevHouse.Location;
Map map = prevHouse.Map;
prevHouse.Delete();
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
{
BaseHouse house = ConstructHouse( from );
if ( house == null )
return;
house.Price = m_Cost;
if ( from.AccessLevel >= AccessLevel.GameMaster )
{
from.SendMessage( "{0} gold would have been withdrawn from your bank if you were not a GM.", m_Cost.ToString() );
}
else
{
if ( Banker.Withdraw( from, m_Cost ) )
{
from.SendLocalizedMessage( 1060398, m_Cost.ToString() ); // ~1_AMOUNT~ gold has been withdrawn from your bank box.
}
else
{
house.RemoveKeys( from );
house.Delete();
from.SendLocalizedMessage( 1060646 ); // You do not have the funds available in your bank box to purchase this house. Try placing a smaller house, or adding gold or checks to your bank box.
return;
}
}
house.MoveToWorld( center, from.Map );
for ( int i = 0; i < toMove.Count; ++i )
{
object o = toMove[ i ];
if ( o is Mobile )
( (Mobile) o ).Location = house.BanLocation;
else if ( o is Item )
( (Item) o ).Location = house.BanLocation;
}
}
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.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;
}
}
}