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)); 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)); } 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)); 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)); } 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)); 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)); 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 { from.CloseGump(typeof(HouseDemolishGump)); from.SendGump(new HouseDemolishGump(from, m_House)); } } 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.FindPlayerVendor() != null) { from.SendLocalizedMessage(501887); // You have vendors working out of this building. It cannot be declared private until there are no vendors in place. break; } if (m_House.Public && m_House.FindTownshipNPC() != null) { from.SendMessage("You have a township npc in this building. It cannot be declared private."); break; } /*if ( !m_House.Public && m_House.LockBoxCount > 0 ) * { * from.SendMessage( "You have LockBoxes in this building. It cannot be made public until they are removed." ); * break; * }*/ m_House.Public = !m_House.Public; if (!m_House.Public) { m_House.RemoveKeys(from); 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.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. } } }