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; } 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 tent with someone still inside."); // You need to collect your vendor's belongings before moving. //Tell staff that an exploit is in progress //Server.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; 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); m_House.Delete(); } else { m_Mobile.SendMessage("Only the tent 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.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. } } }