public override void OnResponse(NetState state, RelayInfo info) { if (info.ButtonID == 1 && !m_House.Deleted) { if (m_House.IsOwner(m_Mobile)) { if (m_House.MovingCrate != null || m_House.InternalizedVendors.Count > 0) { return; } else if (!Guilds.Guild.NewGuildSystem && m_House.FindGuildstone() != null) { m_Mobile.SendLocalizedMessage(501389); // You cannot redeed a house with a guildstone inside. return; } /*else if ( m_House.PlayerVendors.Count > 0 ) * { * m_Mobile.SendLocalizedMessage( 503236 ); // You need to collect your vendor's belongings before moving. * return; * }*/ else if (m_House.HasRentedVendors && m_House.VendorInventories.Count > 0) { m_Mobile.SendLocalizedMessage(1062679); // You cannot do that that while you still have contract vendors or unclaimed contract vendor inventory in your house. return; } else if (m_House.HasRentedVendors) { m_Mobile.SendLocalizedMessage(1062680); // You cannot do that that while you still have contract vendors in your house. return; } else if (m_House.VendorInventories.Count > 0) { m_Mobile.SendLocalizedMessage(1062681); // You cannot do that that while you still have unclaimed contract vendor inventory in your house. return; } if (m_Mobile.AccessLevel >= AccessLevel.Batisseur) { m_Mobile.SendMessage("You do not get a refund for your house as you are not a player"); m_House.RemoveKeys(m_Mobile); m_House.Delete(); } else { Item toGive = null; if (m_House.IsAosRules) { if (m_House.Price > 0) { toGive = new BankCheck(m_House.Price); } else { toGive = m_House.GetDeed(); } } else { toGive = m_House.GetDeed(); if (toGive == null && m_House.Price > 0) { toGive = new BankCheck(m_House.Price); } } if (toGive != null) { BankBox box = m_Mobile.BankBox; if (box.TryDropItem(m_Mobile, toGive, false)) { if (toGive is BankCheck) { m_Mobile.SendLocalizedMessage(1060397, ((BankCheck)toGive).Worth.ToString()); // ~1_AMOUNT~ gold has been deposited into your bank box. } m_House.RemoveKeys(m_Mobile); m_House.Delete(); } else { toGive.Delete(); m_Mobile.SendLocalizedMessage(500390); // Your bank box is full. } } else { m_Mobile.SendMessage("Unable to refund house."); } } } else { m_Mobile.SendLocalizedMessage(501320); // Only the house owner may do this. } } }
public override void OnResponse(NetState state, RelayInfo info) { if (info.ButtonID == 1 && !m_House.Deleted) { if (m_House.IsOwner(m_Mobile)) { if (m_House.MovingCrate != null || m_House.InternalizedVendors.Count > 0) { return; } else if (!Guilds.Guild.NewGuildSystem && m_House.FindGuildstone() != null) { m_Mobile.SendLocalizedMessage(501389); // You cannot redeed a house with a guildstone inside. return; } /*else if ( m_House.PlayerVendors.Count > 0 ) * { * m_Mobile.SendLocalizedMessage( 503236 ); // You need to collect your vendor's belongings before moving. * return; * }*/ else if (m_House.HasRentedVendors && m_House.VendorInventories.Count > 0) { m_Mobile.SendLocalizedMessage(1062679); // You cannot do that that while you still have contract vendors or unclaimed contract vendor inventory in your house. return; } else if (m_House.HasRentedVendors) { m_Mobile.SendLocalizedMessage(1062680); // You cannot do that that while you still have contract vendors in your house. return; } else if (m_House.VendorInventories.Count > 0) { m_Mobile.SendLocalizedMessage(1062681); // You cannot do that that while you still have unclaimed contract vendor inventory in your house. return; } Item toGive = null; if (m_House.IsAosRules) { if (m_House.Price > 0) { toGive = new BankCheck(m_House.Price); } else { toGive = m_House.GetDeed(); } } else { toGive = m_House.GetDeed(); if (toGive == null && m_House.Price > 0) { toGive = new BankCheck(m_House.Price); } } if (toGive != null) { Container bp = m_Mobile.Backpack; if (bp == null || !bp.TryDropItem(m_Mobile, toGive, true)) { toGive.MoveToWorld(m_Mobile.Location, m_Mobile.Map); } m_House.RemoveKeys(m_Mobile); m_House.Delete(); } else { m_Mobile.SendMessage("Unable to refund house."); } } else { m_Mobile.SendLocalizedMessage(501320); // Only the house owner may do this. } } }
public override void OnResponse(NetState sender, RelayInfo info) { if (m_House.Deleted) { return; } Mobile from = sender.Mobile; bool isOwner = m_House.IsOwner(from); bool isCoOwner = isOwner || m_House.IsCoOwner(from); bool isFriend = isCoOwner || m_House.IsFriend(from); if (!isFriend || !from.Alive) { return; } Item sign = m_House.Sign; if (sign == null || from.Map != sign.Map || !from.InRange(sign.GetWorldLocation(), 18)) { return; } switch (info.ButtonID) { case 1: // Rename sign { from.Prompt = new RenamePrompt(m_House); from.SendLocalizedMessage(501302); // What dost thou wish the sign to say? break; } case 2: // List of co-owners { from.CloseGump(typeof(HouseGump)); from.CloseGump(typeof(HouseListGump)); from.CloseGump(typeof(HouseRemoveGump)); from.SendGump(new HouseListGump(1011275, m_House.CoOwners, m_House, false)); break; } case 3: // Add co-owner { if (isOwner) { from.SendLocalizedMessage(501328); // Target the person you wish to name a co-owner of your household. from.Target = new CoOwnerTarget(true, m_House); } else { from.SendLocalizedMessage(501327); // Only the house owner may add Co-owners. } break; } case 4: // Remove co-owner { if (isOwner) { from.CloseGump(typeof(HouseGump)); from.CloseGump(typeof(HouseListGump)); from.CloseGump(typeof(HouseRemoveGump)); from.SendGump(new HouseRemoveGump(1011274, m_House.CoOwners, m_House, false)); } else { from.SendLocalizedMessage(501329); // Only the house owner may remove co-owners. } break; } case 5: // Clear co-owners { if (isOwner) { if (m_House.CoOwners != null) { m_House.CoOwners.Clear(); } from.SendLocalizedMessage(501333); // All co-owners have been removed from this house. } else { from.SendLocalizedMessage(501330); // Only the house owner may remove co-owners. } break; } case 6: // List friends { from.CloseGump(typeof(HouseGump)); from.CloseGump(typeof(HouseListGump)); from.CloseGump(typeof(HouseRemoveGump)); from.SendGump(new HouseListGump(1011273, m_House.Friends, m_House, false)); break; } case 7: // Add friend { if (isCoOwner) { from.SendLocalizedMessage(501317); // Target the person you wish to name a friend of your household. from.Target = new HouseFriendTarget(true, m_House); } else { from.SendLocalizedMessage(501316); // Only the house owner may add friends. } break; } case 8: // Remove friend { if (isCoOwner) { from.CloseGump(typeof(HouseGump)); from.CloseGump(typeof(HouseListGump)); from.CloseGump(typeof(HouseRemoveGump)); from.SendGump(new HouseRemoveGump(1011272, m_House.Friends, m_House, false)); } else { from.SendLocalizedMessage(501318); // Only the house owner may remove friends. } break; } case 9: // Clear friends { if (isCoOwner) { if (m_House.Friends != null) { m_House.Friends.Clear(); } from.SendLocalizedMessage(501332); // All friends have been removed from this house. } else { from.SendLocalizedMessage(501319); // Only the house owner may remove friends. } break; } case 10: // Ban { from.SendLocalizedMessage(501325); // Target the individual to ban from this house. from.Target = new HouseBanTarget(true, m_House); break; } case 11: // Eject { from.SendLocalizedMessage(501326); // Target the individual to eject from this house. from.Target = new HouseKickTarget(m_House); break; } case 12: // List bans { from.CloseGump(typeof(HouseGump)); from.CloseGump(typeof(HouseListGump)); from.CloseGump(typeof(HouseRemoveGump)); from.SendGump(new HouseListGump(1011271, m_House.Bans, m_House, true)); break; } case 13: // Remove ban { from.CloseGump(typeof(HouseGump)); from.CloseGump(typeof(HouseListGump)); from.CloseGump(typeof(HouseRemoveGump)); from.SendGump(new HouseRemoveGump(1011269, m_House.Bans, m_House, true)); break; } case 14: // Transfer ownership { if (isOwner) { from.SendLocalizedMessage(501309); // Target the person to whom you wish to give this house. from.Target = new HouseOwnerTarget(m_House); } else { from.SendLocalizedMessage(501310); // Only the house owner may do this. } break; } case 15: // Demolish house { if (isOwner) { if (m_House.FindGuildstone() != null) { from.SendLocalizedMessage(501389); // You cannot redeed a house with a guildstone inside. } else { Item toGive = m_House.GetDeed(); Container backpack = from.Backpack; if (backpack.TryDropItem(from, toGive, false)) { from.SendLocalizedMessage(501391); // You place the deed in your backpack. m_House.RemoveKeys(from); m_House.Delete(); } else { from.SendLocalizedMessage(501294); // Redeeding the house has failed. from.SendLocalizedMessage(501390); // You do not have room in your backpack for a house deed. toGive.Delete(); } } } else { from.SendLocalizedMessage(501320); // Only the house owner may do this. } break; } case 16: // Change locks { if (m_House.Public) { from.SendLocalizedMessage(501669); // Public houses are always unlocked. } else { if (isOwner) { m_House.RemoveKeys(from); m_House.ChangeLocks(from); from.SendLocalizedMessage(501306); // The locks on your front door have been changed, and new master keys have been placed in your bank and your backpack. } else { from.SendLocalizedMessage(501303); // Only the house owner may change the house locks. } } break; } case 17: // Declare public/private { if (isOwner) { if (m_House.Public && m_House.PlayerVendors.Count > 0) { from.SendLocalizedMessage(501887); // You have vendors working out of this building. It cannot be declared private until there are no vendors in place. break; } m_House.Public = !m_House.Public; if (!m_House.Public) { m_House.ChangeLocks(from); from.SendLocalizedMessage(501888); // This house is now private. from.SendLocalizedMessage(501306); // The locks on your front door have been changed, and new master keys have been placed in your bank and your backpack. } else { m_House.RemoveKeys(from); m_House.RemoveLocks(); from.SendLocalizedMessage(501886); //This house is now public. Friends of the house my now have vendors working out of this building. } } else { from.SendLocalizedMessage(501307); // Only the house owner may do this. } break; } case 18: // Change type { if (isOwner) { if (m_House.Public && info.Switches.Length > 0) { int index = info.Switches[0] - 1; if (index >= 0 && index < 53) { m_House.ChangeSignType(2980 + index * 2); } } } else { from.SendLocalizedMessage(501307); // Only the house owner may do this. } break; } } }
public override void OnResponse(NetState state, RelayInfo info) { if (info.ButtonID == 1 && !m_House.Deleted) { if (m_House.IsOwner(m_Mobile)) { if (m_House.MovingCrate != null || m_House.InternalizedVendors.Count > 0) { return; } else if (!Guilds.Guild.NewGuildSystem && m_House.FindGuildstone() != null) { m_Mobile.SendLocalizedMessage(501389); // You cannot redeed a house with a guildstone inside. return; } /*else if ( m_House.PlayerVendors.Count > 0 ) * { * m_Mobile.SendLocalizedMessage( 503236 ); // You need to collect your vendor's belongings before moving. * return; * }*/ else if (m_House.HasRentedVendors && m_House.VendorInventories.Count > 0) { m_Mobile.SendLocalizedMessage(1062679); // You cannot do that that while you still have contract vendors or unclaimed contract vendor inventory in your house. return; } else if (m_House.HasRentedVendors) { m_Mobile.SendLocalizedMessage(1062680); // You cannot do that that while you still have contract vendors in your house. return; } else if (m_House.VendorInventories.Count > 0) { m_Mobile.SendLocalizedMessage(1062681); // You cannot do that that while you still have unclaimed contract vendor inventory in your house. return; } if (m_Mobile.AccessLevel >= AccessLevel.GameMaster) { m_Mobile.SendMessage("You do not get a refund for your house as you are not a player"); m_House.RemoveKeys(m_Mobile); m_House.Delete(); } else { Item toGive = null; BankCheck check = null; BankBox box = m_Mobile.BankBox; if (m_House.IsAosRules) { if (m_House.Price > 0) { check = new BankCheck(m_House.Price); } toGive = m_House.GetDeed(); } else { toGive = m_House.GetDeed(); if (toGive == null && m_House.Price > 0) { check = new BankCheck(m_House.Price); } } if (check != null) { if (box.TryDropItem(m_Mobile, check, false)) { m_Mobile.SendLocalizedMessage(1060397, check.Worth.ToString()); // ~1_AMOUNT~ gold has been deposited into your bank box. } else { check.Delete(); if (toGive != null) { toGive.Delete(); } m_Mobile.SendLocalizedMessage(500390); // Your bank box is full. return; } } if (toGive != null) { if (box.TryDropItem(m_Mobile, toGive, false)) { /* if ( pm.HasDonated ) * { * m_House.KillVendors( true ); * HouseDecayingCrate crate = m_House.MoveAllDecayingToCrate(); * if ( crate.Items.Count == 0 ) * crate.Delete(); * else * m_Mobile.BankBox.DropItem( crate ); * } */ m_Mobile.CloseGump(typeof(ConfirmCommitGump)); m_House.RemoveKeys(m_Mobile); m_House.Delete(); } else { if (check != null) { check.Delete(); } toGive.Delete(); m_Mobile.SendLocalizedMessage(500390); // Your bank box is full. return; } } else if (TestCenter.Enabled) { m_Mobile.SendMessage("This house cannot be refunded during beta. Please contact a Gamemaster for replacement options."); } else { m_Mobile.SendMessage("Your house cannot be refunded."); } } } else { m_Mobile.SendLocalizedMessage(501320); // Only the house owner may do this. } } }
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: { from.SendLocalizedMessage(1011576); // This is a valid location. BaseHouse house = ConstructHouse(from); if (house == null) { return(false); } 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(false); } 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; } } 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; } } return(false); }
public override void OnResponse(NetState state, RelayInfo info) { if (info.ButtonID == 1 && !m_House.Deleted) { if (m_House.IsOwner(m_Mobile)) { if (m_House.MovingCrate != null || m_House.InternalizedVendors.Count > 0) { return; } if (m_House.HasRentedVendors && m_House.VendorInventories.Count > 0) { m_Mobile.SendLocalizedMessage(1062679); // You cannot do that that while you still have contract vendors or unclaimed contract vendor inventory in your house. return; } if (m_House.HasRentedVendors) { m_Mobile.SendLocalizedMessage(1062680); // You cannot do that that while you still have contract vendors in your house. return; } if (m_House.VendorInventories.Count > 0) { m_Mobile.SendLocalizedMessage(1062681); // You cannot do that that while you still have unclaimed contract vendor inventory in your house. return; } else if (m_House.HasActiveAuction) { m_Mobile.SendLocalizedMessage(1156453); // You cannot currently take this action because you have auction safes locked down in your home. You must remove them first. return; } if (m_Mobile.AccessLevel >= AccessLevel.GameMaster) { m_Mobile.SendMessage("You do not get a refund for your house as you are not a player"); m_House.RemoveKeys(m_Mobile); m_House.Delete(); } else { Item toGive; if (m_House.IsAosRules) { if (m_House.Price > 0) { toGive = new BankCheck(m_House.Price); } else { toGive = m_House.GetDeed(); } } else { toGive = m_House.GetDeed(); if (toGive == null && m_House.Price > 0) { toGive = new BankCheck(m_House.Price); } } if (AccountGold.Enabled && toGive is BankCheck) { int worth = ((BankCheck)toGive).Worth; if (m_Mobile.Account != null && m_Mobile.Account.DepositGold(worth)) { toGive.Delete(); m_Mobile.SendLocalizedMessage(1060397, worth.ToString("#,0")); // ~1_AMOUNT~ gold has been deposited into your bank box. m_House.RemoveKeys(m_Mobile); m_House.Delete(); return; } } if (toGive != null) { BankBox box = m_Mobile.BankBox; if (box.TryDropItem(m_Mobile, toGive, false)) { if (toGive is BankCheck) { m_Mobile.SendLocalizedMessage(1060397, ((BankCheck)toGive).Worth.ToString("#,0")); // ~1_AMOUNT~ gold has been deposited into your bank box. } m_House.RemoveKeys(m_Mobile); m_House.Delete(); } else { toGive.Delete(); m_Mobile.SendLocalizedMessage(500390); // Your bank box is full. } } else { m_Mobile.SendMessage("Unable to refund house."); } } } else { m_Mobile.SendLocalizedMessage(501320); // Only the house owner may do this. } } }
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; 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 (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 override void OnResponse(NetState state, RelayInfo info) { if (info.ButtonID == 1 && !m_House.Deleted) { if (m_House.IsOwner(m_Mobile)) { if (m_House.MovingCrate != null || m_House.InternalizedVendors.Count > 0) { return; } if (m_House.HasRentedVendors && m_House.VendorInventories.Count > 0) { m_Mobile.SendLocalizedMessage(1062679); // You cannot do that that while you still have contract vendors or unclaimed contract vendor inventory in your house. return; } if (m_House.HasRentedVendors) { m_Mobile.SendLocalizedMessage(1062680); // You cannot do that that while you still have contract vendors in your house. return; } if (m_House.VendorInventories.Count > 0) { m_Mobile.SendLocalizedMessage(1062681); // You cannot do that that while you still have unclaimed contract vendor inventory in your house. return; } if (m_House.HasActiveAuction) { m_Mobile.SendLocalizedMessage(1156453); // You cannot currently take this action because you have auction safes locked down in your home. You must remove them first. return; } if (m_Mobile.AccessLevel >= AccessLevel.GameMaster) { m_Mobile.SendMessage("You do not get a refund for your house as you are not a player"); m_House.Delete(); } else { Banker.Deposit(m_Mobile, m_House.Price, true); var region = new TempNoHousingRegion(m_House, m_Mobile); Timer.DelayCall(m_House.RestrictedPlacingTime, region.Unregister); m_House.Delete(); return; } } else { m_Mobile.SendLocalizedMessage(501320); // Only the house owner may do this. } } }
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, this.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 = this.ConstructHouse(from); if (house == null) { return; } house.Price = this.m_Cost; if (from.AccessLevel >= AccessLevel.GameMaster) { from.SendMessage("{0} gold would have been withdrawn from your bank if you were not a GM.", this.m_Cost.ToString()); } else { if (Banker.Withdraw(from, this.m_Cost)) { from.SendLocalizedMessage(1060398, this.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; } 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; } } }
public override void OnResponse(NetState state, RelayInfo info) { if (info.ButtonID == 1 && !m_House.Deleted) { if (m_House.IsOwner(m_Mobile)) { if (m_House.MovingCrate != null || m_House.InternalizedVendors.Count > 0) { m_Mobile.SendLocalizedMessage(1080455); // You can not resize your house at this time. Please remove all items fom the moving crate and try again. return; } if (m_House.HasRentedVendors && m_House.VendorInventories.Count > 0) { m_Mobile.SendLocalizedMessage(1062679); // You cannot do that that while you still have contract vendors or unclaimed contract vendor inventory in your house. return; } if (m_House.HasRentedVendors) { m_Mobile.SendLocalizedMessage(1062680); // You cannot do that that while you still have contract vendors in your house. return; } if (m_House.VendorInventories.Count > 0) { m_Mobile.SendLocalizedMessage(1062681); // You cannot do that that while you still have unclaimed contract vendor inventory in your house. return; } if (m_Mobile.AccessLevel >= AccessLevel.GameMaster) { m_Mobile.SendMessage("You do not get a refund for your house as you are not a player"); var region = new TempNoHousingRegion(m_House, m_Mobile); Timer.DelayCall(m_House.RestrictedPlacingTime, region.Unregister); m_House.Delete(); } else { Banker.Deposit(m_Mobile, m_House.Price, true); var region = new TempNoHousingRegion(m_House, m_Mobile); Timer.DelayCall(m_House.RestrictedPlacingTime, region.Unregister); m_House.Delete(); return; } } else { m_Mobile.SendLocalizedMessage(501320); // Only the house owner may do } } else if (info.ButtonID == 0) { m_Mobile.CloseGump(typeof(ConfirmHouseResize)); m_Mobile.SendGump(new HouseGump(HouseGumpPage.Customize, m_Mobile, m_House)); } }
public override void OnResponse(NetState state, RelayInfo info) { if (info.ButtonID == 1 && !m_House.Deleted) { if (m_House.IsOwner(m_Mobile)) { if (m_House.MovingCrate != null || m_House.InternalizedVendors.Count > 0) { m_Mobile.SendLocalizedMessage(1080455); // You can not resize your house at this time. Please remove all items fom the moving crate and try again. return; } else if (m_House.HasRentedVendors && m_House.VendorInventories.Count > 0) { m_Mobile.SendLocalizedMessage(1062679); // You cannot do that that while you still have contract vendors or unclaimed contract vendor inventory in your house. return; } else if (m_House.HasRentedVendors) { m_Mobile.SendLocalizedMessage(1062680); // You cannot do that that while you still have contract vendors in your house. return; } else if (m_House.VendorInventories.Count > 0) { m_Mobile.SendLocalizedMessage(1062681); // You cannot do that that while you still have unclaimed contract vendor inventory in your house. return; } if (m_Mobile.AccessLevel >= AccessLevel.GameMaster) { m_Mobile.SendMessage("You do not get a refund for your house as you are not a player"); m_House.RemoveKeys(m_Mobile); new TempNoHousingRegion(m_House, m_Mobile); m_House.Delete(); } else { Item toGive = null; if (m_House.IsAosRules) { if (m_House.Price > 0) { Banker.Deposit(m_Mobile, m_House.Price, true); m_House.RemoveKeys(m_Mobile); new TempNoHousingRegion(m_House, m_Mobile); m_House.Delete(); return; } else { toGive = m_House.GetDeed(); } } else { toGive = m_House.GetDeed(); if (toGive == null && m_House.Price > 0) { toGive = new BankCheck(m_House.Price); } } if (toGive != null) { BankBox box = m_Mobile.BankBox; if (box.TryDropItem(m_Mobile, toGive, false)) { if (toGive is BankCheck) { m_Mobile.SendLocalizedMessage(1060397, ((BankCheck)toGive).Worth.ToString()); // ~1_AMOUNT~ gold has been deposited into your bank box. } m_House.RemoveKeys(m_Mobile); new TempNoHousingRegion(m_House, m_Mobile); m_House.Delete(); } else { toGive.Delete(); m_Mobile.SendLocalizedMessage(500390); // Your bank box is full. } } else { m_Mobile.SendMessage("Unable to refund house."); } } } else { m_Mobile.SendLocalizedMessage(501320); // Only the house owner may do } } else if (info.ButtonID == 0) { m_Mobile.CloseGump(typeof(ConfirmHouseResize)); m_Mobile.SendGump(new HouseGumpAOS(HouseGumpPageAOS.Customize, m_Mobile, m_House)); } }
public static void DeleteChar_WarningGumpCallback(Mobile from, bool okay, object state) { Mobile mob = (Mobile)state; NetState ns = mob.NetState; List <BaseHouse> houselist = BaseHouse.GetHouses(mob); List <Mobile> mobs = new List <Mobile>(); int mobCount, houseCount; int itemCount = 0; if (!okay) { return; } CommandLogging.WriteLine(from, "{0} {1} deleting character {2}.", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(mob)); foreach (Mobile m in World.Mobiles.Values) { if (m is BaseCreature) { BaseCreature bc = (BaseCreature)m; if ((bc.Controlled && bc.ControlMaster == mob) || (bc.Summoned && bc.SummonMaster == mob)) { mobs.Add(bc); } } else if (m is PlayerVendor) { PlayerVendor pv = (PlayerVendor)m; if (pv.Owner == mob) { mobs.Add(pv); } } } mobCount = mobs.Count; for (int i = 0; i < mobs.Count; ++i) { mobs[i].Delete(); } mobs.Clear(); houseCount = houselist.Count; for (int j = 0; j < houselist.Count; ++j) { BaseHouse house = (BaseHouse)houselist[j]; List <Item> itemlist = house.GetItems(); for (int k = 0; k < itemlist.Count; ++k) { Item item = (Item)itemlist[k]; if (item.IsLockedDown) { itemCount++; item.Delete(); } else if (item.IsSecure && item is BaseContainer) { BaseContainer con = (BaseContainer)itemlist[k]; itemCount += con.GetTotal(TotalType.Items) + 1; // +1 is the container itself con.Delete(); } } itemlist.Clear(); house.Delete(); } houselist.Clear(); from.SendMessage("{0} pet{3} and playervendor{3} and {1} house{4} with {2} item{5} inside deleted.", mobCount, houseCount, itemCount, mobCount != 1 ? "s" : "", houseCount != 1 ? "s" : "", itemCount != 1 ? "s" : ""); mob.Say("I've been deleted!"); if (ns != null) { ns.Dispose(); } mob.Delete(); from.SendMessage("Character has been disposed of thoughtfully."); }
public override void OnResponse(NetState state, RelayInfo info) { // Just in case they packed it away with the gump up if (m_House.Deleted) { return; } if (info.ButtonID == 0) { // Placement cancelled // Re-pack the tent and place back in pack Item toGive; if (m_House is Tent) { toGive = (TentBag)((Tent)m_House).GetDeed(); } else if (m_House is SiegeTent) { toGive = (SiegeTentBag)((SiegeTent)m_House).GetDeed(); } else { Console.WriteLine("Invalid type detected"); return; } // Find the roof IEnumerator ta_enum = m_House.Addons.GetEnumerator(); while (ta_enum.MoveNext()) { if (ta_enum.Current is TentRoof) { break; } } // Hue the tent bag to the roof hue toGive.Hue = ((TentRoof)ta_enum.Current).Hue; //toGive.MoveToWorld( m_House.Location, m_Mobile.Map ); state.Mobile.AddToBackpack(toGive); m_House.Delete(); } else { // Approved placement // wea: 2/Sep/2006 Set the placed bool to indicate that this is now a useable tent if (m_House is SiegeTent) { ((SiegeTent)m_House).Tentpack.Placed = true; } else if (m_House is Tent) { ((Tent)m_House).Tentpack.Placed = true; } } }
public override void OnResponse(NetState state, RelayInfo info) { if (m_House.Deleted) { return; } Mobile from = state.Mobile; if (m_List != null && info.ButtonID == 1) // Remove now { if (m_House.IsOwner(from)) { if (m_House.InternalizedVendors.Count > 0) { return; } else if (!Guilds.Guild.NewGuildSystem && m_House.FindGuildstone() != null) { from.SendLocalizedMessage(501389); // You cannot redeed a house with a guildstone inside. return; } else if (m_House.PlayerVendors.Count > 0) { from.SendLocalizedMessage(503236); // You need to collect your vendor's belongings before moving. return; } else if (m_House.VendorInventories.Count > 0) { from.SendLocalizedMessage(1062681); // You cannot do that that while you still have unclaimed contract vendor inventory in your house. return; } Item toGive = m_House.GetDeed(); if (toGive != null) { Container backpack = from.Backpack; if (backpack == null) { from.SendLocalizedMessage(501393); // You do not seem to have a backpack. } else if (backpack.TryDropItem(from, toGive, false)) { from.SendLocalizedMessage(501391); // You place the deed in your backpack. m_House.RemoveKeys(from); m_House.Delete(); } else { from.SendLocalizedMessage(501390); // You do not have room in your backpack for a house deed. } } else { from.SendLocalizedMessage(501294); // Redeeding the house has failed. } } else { from.SendLocalizedMessage(501320); // Only the house owner may do this. } } int[] switches = info.Switches; if (switches.Length > 0) { for (int i = 0; i < switches.Length; ++i) { int index = switches[i]; if (index >= 0 && index < m_Copy.Count) { m_List.Remove(m_Copy[index]); } } if (m_List.Count > 0) { from.CloseGump(typeof(HouseGump)); from.CloseGump(typeof(HouseListGump)); from.CloseGump(typeof(HouseRemoveGump)); from.SendGump(new HouseRemoveGump(m_Number, m_List, m_House, m_AccountOf)); return; } } from.SendGump(new HouseGump(from, m_House)); }
public override void OnResponse(NetState state, RelayInfo info) { if (info.ButtonID == 1 && !m_House.Deleted) { if (m_House.IsOwner(m_Mobile)) { if (m_House.FindGuildstone() != null) { m_Mobile.SendLocalizedMessage(501389); // You cannot redeed a house with a guildstone inside. return; } //Pix: 7/13/2008 - Removing the requirement of a townshipstone to be in a house. // else if (m_House.FindTownshipStone() != null) // { // m_Mobile.SendMessage("You can't demolish a house which holds a Township stone."); // return; // } //It was decided that we should just auto-dismiss the township NPC if the house is demolished //else if (m_House.FindTownshipNPC() != null) //{ // m_Mobile.SendMessage("You need to dismiss your Township NPC before moving."); // return; //} else if (m_House.FindPlayerVendor() != null) { m_Mobile.SendLocalizedMessage(503236); // You need to collect your vendor's belongings before moving. return; } else if (m_House.FindPlayer() != null) { m_Mobile.SendMessage("It is not safe to demolish this house with someone still inside."); // You need to collect your vendor's belongings before moving. //Tell staff that an exploit is in progress //Server.Scripts.Commands.CommandHandlers.BroadcastMessage( AccessLevel.Counselor, //0x482, //String.Format( "Exploit in progress at {0}. Stay hidden, Jail involved players, get acct name, ban.", m_House.Location.ToString() ) ); return; } Item toGive = null; Item Refund = null; // for various home upgrades if (m_House.IsAosRules) { if (m_House.Price > 0) { toGive = new BankCheck(m_House.Price); } else { toGive = m_House.GetDeed(); } } else { toGive = m_House.GetDeed(); if (toGive == null && m_House.Price > 0) { toGive = new BankCheck(m_House.Price); } if (m_House.UpgradeCosts > 0) { Refund = new BankCheck((int)m_House.UpgradeCosts); } } if (toGive != null) { BankBox box = m_Mobile.BankBox; // Adam: TryDropItem() fails if trhe bank is full, and this isn't the time to be // failing .. just overload their bank. if (box != null /*&& box.TryDropItem( m_Mobile, toGive, false )*/) { box.AddItem(toGive); if (toGive is BankCheck) { m_Mobile.SendLocalizedMessage(1060397, ((BankCheck)toGive).Worth.ToString()); // ~1_AMOUNT~ gold has been deposited into your bank box. } if (Refund != null) { box.AddItem(Refund); if (Refund is BankCheck) { m_Mobile.SendLocalizedMessage(1060397, ((BankCheck)Refund).Worth.ToString()); // ~1_AMOUNT~ gold has been deposited into your bank box. } } m_House.RemoveKeys(m_Mobile); m_House.Delete(); } else { toGive.Delete(); m_Mobile.SendLocalizedMessage(500390); // Your bank box is full. } } else { m_Mobile.SendMessage("Unable to refund house."); } } else { m_Mobile.SendLocalizedMessage(501320); // Only the house owner may do this. } } }
protected override void OnTarget(Mobile from, object targ) { int converted = 0; int deleted = 0; if (targ is HouseSign) { HouseSign sign = (HouseSign)targ; if (sign.Structure != null) { if (sign.Structure is BaseHouse) { // don't let staff convert original custom houses to static .. force them to make a copy first if (sign.Structure is HouseFoundation == true && sign.Structure is StaticHouse == false) { from.SendMessage(0x22, "Please make a COPY of this house before converting it to static."); from.SendMessage(0x22, "[housegen"); } else { //ok, we got what we want :) BaseHouse house = sign.Structure as BaseHouse; //get a copy of the location Point3D location = new Point3D(house.Location.X, house.Location.Y, house.Location.Z); // make a copy of the doors - see comments below // ArrayList Doors = new ArrayList(house.Doors); //Now we need to iterate through the components and place their static equivalent while skipping doors and other fixtures for (int i = 0; i < house.Components.List.Length; i++) { string sz = location.X + house.Components.List[i].GetType().ToString(); if (!IsFixture(house.Components.List[i].m_ItemID)) { Point3D itemloc = new Point3D( location.X + house.Components.List[i].m_OffsetX, location.Y + house.Components.List[i].m_OffsetY, location.Z + house.Components.List[i].m_OffsetZ ); Static item = new Static((int)(house.Components.List[i].m_ItemID & 0x3FFF)); item.MoveToWorld(itemloc, from.Map); converted++; } else { deleted++; } } // not adding the doors back because we want players to have to purchase them /*foreach (BaseDoor bd in Doors) * { * if (bd == null) * continue; * * BaseDoor replacement = GetFixtureItem(bd.ItemID) as BaseDoor; * if (replacement != null && replacement.Deleted == false) * { * Point3D itemloc = new Point3D( * location.X + bd.Offset.X, * location.Y + bd.Offset.Y, * location.Z + bd.Offset.Z * ); * * replacement.MoveToWorld(itemloc, from.Map); * } * }*/ //delete the house house.Delete(); } } } else { from.SendMessage(0x22, "That house sign does not point to a house"); } } else if (targ is AddonComponent) { //ok, we got what we want :) AddonComponent addon = targ as AddonComponent; // use the players location as the addon's location is whacky Point3D location = new Point3D(from.Location.X, from.Location.Y, from.Location.Z); from.SendMessage("Using your location for the static location."); //Now we need to iterate through the components and place their static equivalent while skipping doors and other fixtures foreach (Item item in addon.Addon.Components) { if (item == null || item is AddonComponent == false) { continue; } AddonComponent ac = item as AddonComponent; if (!IsFixture((short)ac.ItemID)) { Point3D itemloc = new Point3D( location.X + ac.Offset.X, location.Y + ac.Offset.Y, location.Z + ac.Offset.Z ); Static sitem = new Static((int)(ac.ItemID & 0x3FFF)); sitem.MoveToWorld(itemloc, from.Map); converted++; } else { deleted++; } } //delete the addon addon.Delete(); } else { from.SendMessage(0x22, "That is neither a house sign nor an addon"); } from.SendMessage("Conversion complete with {0} tiles converted and {1} deleted.", converted, deleted); }