public override void OnResponse(NetState state, RelayInfo info) { Mobile from = state.Mobile; switch (info.ButtonID) { case 0: // Closed { return; } case 1: // Previous { if (m_Page > 0) { from.SendGump(new WhoGump(from, m_Mobiles, m_Page - 1)); } break; } case 2: // Next { if ((m_Page + 1) * EntryCount < m_Mobiles.Count) { from.SendGump(new WhoGump(from, m_Mobiles, m_Page + 1)); } break; } default: { int index = (m_Page * EntryCount) + (info.ButtonID - 3); if (index >= 0 && index < m_Mobiles.Count) { Mobile m = m_Mobiles[index]; if (m.Deleted) { from.SendMessage("That player has deleted their character."); from.SendGump(new WhoGump(from, m_Mobiles, m_Page)); } else if (m.NetState == null) { from.SendMessage("That player is no longer online."); from.SendGump(new WhoGump(from, m_Mobiles, m_Page)); } else if (m == from || !m.Hidden || from.AccessLevel >= m.AccessLevel || (m is PlayerMobile && ((PlayerMobile)m).VisibilityList.Contains(from))) { from.SendGump(new ClientGump(from, m.NetState)); } else { from.SendMessage("You cannot see them."); from.SendGump(new WhoGump(from, m_Mobiles, m_Page)); } } break; } } }
public override void OnResponse(NetState sender, RelayInfo info) { TimeSpan toSet; bool shouldSet, shouldSend; TextRelay h = info.GetTextEntry(0); TextRelay m = info.GetTextEntry(1); TextRelay s = info.GetTextEntry(2); switch (info.ButtonID) { case 1: // Zero { toSet = TimeSpan.Zero; shouldSet = true; shouldSend = true; break; } case 2: // From H:M:S { bool successfulParse = false; if (h != null && m != null && s != null) { successfulParse = TimeSpan.TryParse(h.Text + ":" + m.Text + ":" + s.Text, out toSet); } else { toSet = TimeSpan.Zero; } shouldSet = shouldSend = successfulParse; break; } case 3: // From H { if (h != null) { try { toSet = TimeSpan.FromHours(Utility.ToDouble(h.Text)); shouldSet = true; shouldSend = true; break; } catch { } } toSet = TimeSpan.Zero; shouldSet = false; shouldSend = false; break; } case 4: // From M { if (m != null) { try { toSet = TimeSpan.FromMinutes(Utility.ToDouble(m.Text)); shouldSet = true; shouldSend = true; break; } catch { } } toSet = TimeSpan.Zero; shouldSet = false; shouldSend = false; break; } case 5: // From S { if (s != null) { try { toSet = TimeSpan.FromSeconds(Utility.ToDouble(s.Text)); shouldSet = true; shouldSend = true; break; } catch { } } toSet = TimeSpan.Zero; shouldSet = false; shouldSend = false; break; } default: { toSet = TimeSpan.Zero; shouldSet = false; shouldSend = true; break; } } if (shouldSet) { try { CommandLogging.LogChangeProperty(m_Mobile, m_Object, m_Property.Name, toSet.ToString()); m_Property.SetValue(m_Object, toSet, null); PropertiesGump.OnValueChanged(m_Object, m_Property, m_Stack); } catch { m_Mobile.SendMessage("An exception was caught. The property may not have changed."); } } if (shouldSend) { m_Mobile.SendGump(new PropertiesGump(m_Mobile, m_Object, m_Stack, m_List, m_Page)); } }
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; 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) { var 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()); // ~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 sender, RelayInfo info) { if (m_House.Deleted) { return; } Mobile from = sender.Mobile; bool isCombatRestricted = m_House.IsCombatRestricted(from); bool isOwner = m_House.IsOwner(from); bool isCoOwner = isOwner || m_House.IsCoOwner(from); bool isFriend = isCoOwner || m_House.IsFriend(from); if (isCombatRestricted) { isFriend = isCoOwner = isOwner = false; } 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 (!Guilds.Guild.NewGuildSystem && 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.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; } } }