private void PlacementWarning_Callback(Mobile from, bool okay, object state) { PreviewHouse prevHouse = (PreviewHouse)state; if (Deleted || !okay || !from.CheckAlive() || from.Backpack == null || from.Backpack.FindItemByType(typeof(HouseDeed)) == null) { 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; HousePlacementResult res = HousePlacement.Check(from, m_MultiID, center, out toMove); BaseHouse house = GetHouse(from); house.MoveToWorld(center, from.Map); Delete(); 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; } } }
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.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; } } return(false); }
public void PlacementWarning_Callback(Mobile from, bool okay, object state) { if (!from.CheckAlive()) { 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; 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 (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; } } }
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(); //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 ArrayList toMove); switch (res) { case HousePlacementResult.Valid: { if (from.AccessLevel < AccessLevel.GameMaster && BaseHouse.HasReachedHouseLimit(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; } } }
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: { 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; 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); } 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; } case HousePlacementResult.NoQueenLoyalty: { from.SendLocalizedMessage(1113707, "10000"); // You must have at lease ~1_MIN~ loyalty to the Gargoyle Queen to place a house in Ter Mur. break; } } return(false); }
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.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 & TileData.MaxItemValue; 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; } } return false; }