Server.Gumps.AdminGump.OnResponse C# (CSharp) Méthode

OnResponse() public méthode

public OnResponse ( Server sender, RelayInfo info ) : void
sender Server
info RelayInfo
Résultat void
		public override void OnResponse( Server.Network.NetState sender, RelayInfo info )
		{
			int val = info.ButtonID - 1;

			if ( val < 0 )
				return;

			Mobile from = m_From;

			if ( from.AccessLevel < AccessLevel.Administrator )
				return;

			if ( m_PageType == AdminGumpPage.Accounts )
			{
				ArrayList list = m_List;
				ArrayList rads = m_State as ArrayList;

				if ( list != null && rads != null )
				{
					for ( int i = 0, v = m_ListPage*12; i < 12 && v < list.Count; ++i, ++v )
					{
						object obj = list[v];

						if ( info.IsSwitched( v ) )
						{
							if ( !rads.Contains( obj ) )
								rads.Add( obj );
						}
						else if ( rads.Contains( obj ) )
						{
							rads.Remove( obj );
						}
					}
				}
			}

			int type = val % 11;
			int index = val / 11;

			switch ( type )
			{
				case 0:
				{
					AdminGumpPage page;

					switch ( index )
					{
						case 0: page = AdminGumpPage.Information_General; break;
						case 1: page = AdminGumpPage.Administer; break;
						case 2: page = AdminGumpPage.Clients; break;
						case 3: page = AdminGumpPage.Accounts; break;
						case 4: page = AdminGumpPage.Firewall; break;
						case 5: page = AdminGumpPage.Information_Perf; break;
						default: return;
					}

					from.SendGump( new AdminGump( from, page, 0, null, null, null ) );
					break;
				}
				case 1:
				{
					switch ( index )
					{
						case 0:
						{
							if ( m_List != null && m_ListPage > 0 )
								from.SendGump( new AdminGump( from, m_PageType, m_ListPage - 1, m_List, null, m_State ) );

							break;
						}
						case 1:
						{
							if ( m_List != null /*&& (m_ListPage + 1) * 12 < m_List.Count*/ )
								from.SendGump( new AdminGump( from, m_PageType, m_ListPage + 1, m_List, null, m_State ) );

							break;
						}
					}

					break;
				}
				case 3:
				{
					string notice = null;
					AdminGumpPage page = AdminGumpPage.Administer;

					if ( index >= 500 )
						page = AdminGumpPage.Administer_Access_Lockdown;
					else if ( index >= 400 )
						page = AdminGumpPage.Administer_Commands;
					else if ( index >= 300 )
						page = AdminGumpPage.Administer_Access;
					else if ( index >= 200 )
						page = AdminGumpPage.Administer_Server;
					else if ( index >= 100 )
						page = AdminGumpPage.Administer_WorldBuilding;

					switch ( index )
					{
						case  0: page = AdminGumpPage.Administer_WorldBuilding; break;
						case  1: page = AdminGumpPage.Administer_Server; break;
						case  2: page = AdminGumpPage.Administer_Access; break;
						case  3: page = AdminGumpPage.Administer_Commands; break;

						case 100: InvokeCommand( "DocGen" ); notice = "Documentation has been generated."; break;
						case 101: InvokeCommand( "TelGen" ); notice = "Teleporters have been generated."; break;
						case 102: InvokeCommand( "MoonGen" ); notice = "Moongates have been generated."; break;
						case 103: InvokeCommand( "UOAMVendors" ); notice = "Vendor spawners have been generated."; break;
						case 104: InvokeCommand( "DoorGen" ); notice = "Doors have been generated."; break;
						case 105: InvokeCommand( "SignGen" ); notice = "Signs have been generated."; break;
						case 106: InvokeCommand( "Decorate" ); notice = "Decoration has been generated."; break;
						case 107: InvokeCommand( "RebuildCategorization" ); notice = "Categorization menu has been regenerated. The server should be restarted."; break;

						case 110: InvokeCommand( "Freeze" ); notice = "Target bounding points."; break;
						case 120: InvokeCommand( "Unfreeze" ); notice = "Target bounding points."; break;

						case 200: InvokeCommand( "Save" ); notice = "The world has been saved."; break;
						case 201: Shutdown( false,  true ); break;
						case 202: Shutdown( false, false ); break;
						case 203: Shutdown(  true,  true ); break;
						case 204: Shutdown(  true, false ); break;
						case 210:
						case 211:
						{
							TextRelay relay = info.GetTextEntry( 0 );
							string text = ( relay == null ? null : relay.Text.Trim() );

							if ( text == null || text.Length == 0 )
							{
								notice = "You must enter text to broadcast it.";
							}
							else
							{
								notice = "Your message has been broadcasted.";
								InvokeCommand( String.Format( "{0} {1}", index == 210 ? "BC" : "SM", text ) );
							}

							break;
						}

						case 300: InvokeCommand( "Kick" ); notice = "Target the player to kick."; break;
						case 301: InvokeCommand( "Ban" ); notice = "Target the player to ban."; break;
						case 302: InvokeCommand( "Firewall" ); notice = "Target the player to firewall."; break;

						case 303: page = AdminGumpPage.Administer_Access_Lockdown; break;

						case 310: InvokeCommand( "Set AccessLevel Player" ); notice = "Target the player to change their access level. (Player)"; break;
						case 311: InvokeCommand( "Set AccessLevel Counselor" ); notice = "Target the player to change their access level. (Counselor)"; break;
						case 312: InvokeCommand( "Set AccessLevel GameMaster" ); notice = "Target the player to change their access level. (Game Master)"; break;
						case 313: InvokeCommand( "Set AccessLevel Seer" ); notice = "Target the player to change their access level. (Seer)"; break;

						case 314:
						{
							if ( from.AccessLevel > AccessLevel.Administrator )
							{
								InvokeCommand( "Set AccessLevel Administrator" );
								notice = "Target the player to change their access level. (Administrator)";
							}

							break;
						}

						case 315:
						{
							if ( from.AccessLevel > AccessLevel.Developer )
							{
								InvokeCommand( "Set AccessLevel Developer" );
								notice = "Target the player to change their access level. (Developer)";
							}

							break;
						}

						case 316:
						{
							if ( from.AccessLevel >= AccessLevel.Owner )
							{
								InvokeCommand( "Set AccessLevel Owner" );
								notice = "Target the player to change their access level. (Owner)";
							}

							break;
						}

						case 400: notice = "Enter search terms to add objects."; break;
						case 401: InvokeCommand( "Remove" ); notice = "Target the item or mobile to remove."; break;
						case 402: InvokeCommand( "Dupe" ); notice = "Target the item to dupe."; break;
						case 403: InvokeCommand( "DupeInBag" ); notice = "Target the item to dupe. The item will be duped at it's current location."; break;
						case 404: InvokeCommand( "Props" ); notice = "Target the item or mobile to inspect."; break;
						case 405: InvokeCommand( "Skills" ); notice = "Target a mobile to view their skills."; break;
						case 406: InvokeCommand( "Set Blessed False" ); notice = "Target the mobile to make mortal."; break;
						case 407: InvokeCommand( "Set Blessed True" ); notice = "Target the mobile to make immortal."; break;
						case 408: InvokeCommand( "Set Squelched True" ); notice = "Target the mobile to squelch."; break;
						case 409: InvokeCommand( "Set Squelched False" ); notice = "Target the mobile to unsquelch."; break;
						case 410: InvokeCommand( "Set Frozen True" ); notice = "Target the mobile to freeze."; break;
						case 411: InvokeCommand( "Set Frozen False" ); notice = "Target the mobile to unfreeze."; break;
						case 412: InvokeCommand( "Set Hidden True" ); notice = "Target the mobile to hide."; break;
						case 413: InvokeCommand( "Set Hidden False" ); notice = "Target the mobile to unhide."; break;
						case 414: InvokeCommand( "Kill" ); notice = "Target the mobile to kill."; break;
						case 415: InvokeCommand( "Resurrect" ); notice = "Target the mobile to resurrect."; break;
						case 416: InvokeCommand( "Move" ); notice = "Target the item or mobile to move."; break;
						case 417: InvokeCommand( "Wipe" ); notice = "Target bounding points."; break;
						case 418: InvokeCommand( "Tele" ); notice = "Choose your destination."; break;
						case 419: InvokeCommand( "Multi Tele" ); notice = "Choose your destination."; break;

						case 500:
						case 501:
						case 502:
						case 503:
						case 504:
						{
							Misc.AccountHandler.LockdownLevel = (AccessLevel)(index - 500);

							if ( Misc.AccountHandler.LockdownLevel > AccessLevel.Player )
								notice = "The lockdown level has been changed.";
							else
								notice = "The server is now accessible to everyone.";

							break;
						}

						case 510:
						{
							AccessLevel level = Misc.AccountHandler.LockdownLevel;

							if ( level > AccessLevel.Player )
							{
								List<NetState> clients = NetState.Instances;
								int count = 0;

								for ( int i = 0; i < clients.Count; ++i )
								{
									NetState ns = clients[i];
									IAccount a = ns.Account;

									if ( a == null )
										continue;

									bool hasAccess = false;

									if ( a.AccessLevel >= level )
									{
										hasAccess = true;
									}
									else
									{
										for ( int j = 0; !hasAccess && j < a.Length; ++j )
										{
											Mobile m = a[j];

											if ( m != null && m.AccessLevel >= level )
												hasAccess = true;
										}
									}

									if ( !hasAccess )
									{
										ns.Dispose();
										++count;
									}
								}

								if ( count == 0 )
									notice = "Nobody without access was found to disconnect.";
								else
									notice = String.Format( "Number of players disconnected: {0}", count );
							}
							else
							{
								notice = "The server is not currently locked down.";
							}

							break;
						}
					}

					from.SendGump( new AdminGump( from, page, 0, null, notice, null ) );

					switch ( index )
					{
						case 400: InvokeCommand( "Add" ); break;
						case 111: InvokeCommand( "FreezeWorld" ); break;
						case 112: InvokeCommand( "FreezeMap" ); break;
						case 121: InvokeCommand( "UnfreezeWorld" ); break;
						case 122: InvokeCommand( "UnfreezeMap" ); break;
					}

					break;
				}
				case 4:
				{
					switch ( index )
					{
						case 0:
						case 1:
						{
							bool forName = ( index == 0 );

							ArrayList results = new ArrayList();

							TextRelay matchEntry = info.GetTextEntry( 0 );
							string match = ( matchEntry == null ? null : matchEntry.Text.Trim().ToLower() );
							string notice = null;

							if ( match == null || match.Length == 0 )
							{
								notice = String.Format( "You must enter {0} to search.", forName ? "a name" : "an ip address" );
							}
							else
							{
								List<NetState> instances = NetState.Instances;

								for ( int i = 0; i < instances.Count; ++i )
								{
									NetState ns = instances[i];

									bool isMatch;

									if ( forName )
									{
										Mobile m = ns.Mobile;
										IAccount a = ns.Account;

										isMatch = ( m != null && m.Name.ToLower().IndexOf( match ) >= 0 )
											|| ( a != null && a.Username.ToLower().IndexOf( match ) >= 0 );
									}
									else
									{
										isMatch = ( ns.ToString().IndexOf( match ) >= 0 );
									}

									if ( isMatch )
										results.Add( ns );
								}

								results.Sort( NetStateComparer.Instance );
							}

							if ( results.Count == 1 )
							{
								NetState ns = (NetState)results[0];
								object state = ns.Mobile;

								if ( state == null )
									state = ns.Account;

								if ( state is Mobile )
									from.SendGump( new AdminGump( from, AdminGumpPage.ClientInfo, 0, null, "One match found.", state ) );
								else if ( state is Account )
									from.SendGump( new AdminGump( from, AdminGumpPage.AccountDetails_Information, 0, null, "One match found.", state ) );
								else
									from.SendGump( new AdminGump( from, AdminGumpPage.Clients, 0, results, "One match found.", null ) );
							}
							else
							{
								from.SendGump( new AdminGump( from, AdminGumpPage.Clients, 0, results, notice == null ? (results.Count == 0 ? "Nothing matched your search terms." : null) : notice, null ) );
							}

							break;
						}
						default:
						{
							index -= 2;

							if ( m_List != null && index >= 0 && index < m_List.Count )
							{
								NetState ns = m_List[index] as NetState;

								if ( ns == null )
									break;

								Mobile m = ns.Mobile;
								Account a = ns.Account as Account;

								if ( m != null )
									from.SendGump( new AdminGump( from, AdminGumpPage.ClientInfo, 0, null, null, m ) );
								else if ( a != null )
									from.SendGump( new AdminGump( from, AdminGumpPage.AccountDetails_Information, 0, null, null, a ) );
							}

							break;
						}
					}

					break;
				}
				case 5:
				{
					switch ( index )
					{
						case 0: from.SendGump( new AdminGump( from, AdminGumpPage.AccountDetails_Information, 0, null, null, m_State ) ); break;
						case 1: from.SendGump( new AdminGump( from, AdminGumpPage.AccountDetails_Characters, 0, null, null, m_State ) ); break;
						case 2: from.SendGump( new AdminGump( from, AdminGumpPage.AccountDetails_Comments, 0, null, null, m_State ) ); break;
						case 3: from.SendGump( new AdminGump( from, AdminGumpPage.AccountDetails_Tags, 0, null, null, m_State ) ); break;
						case 13: from.SendGump( new AdminGump( from, AdminGumpPage.AccountDetails_Access, 0, null, null, m_State ) ); break;
						case 14: from.SendGump( new AdminGump( from, AdminGumpPage.AccountDetails_Access_ClientIPs, 0, null, null, m_State ) ); break;
						case 15: from.SendGump( new AdminGump( from, AdminGumpPage.AccountDetails_Access_Restrictions, 0, null, null, m_State ) ); break;
						case 4: from.Prompt = new AddCommentPrompt( m_State as Account ); from.SendMessage( "Enter the new account comment." ); break;
						case 5: from.Prompt = new AddTagNamePrompt( m_State as Account ); from.SendMessage( "Enter the new tag name." ); break;
						case 6:
						{
							TextRelay unEntry = info.GetTextEntry( 0 );
							TextRelay pwEntry = info.GetTextEntry( 1 );

							string un = ( unEntry == null ? null : unEntry.Text.Trim() );
							string pw = ( pwEntry == null ? null : pwEntry.Text.Trim() );

							Account dispAccount = null;
							string notice;

							if ( un == null || un.Length == 0 )
							{
								notice = "You must enter a username to add an account.";
							}
							else if ( pw == null || pw.Length == 0 )
							{
								notice = "You must enter a password to add an account.";
							}
							else
							{
								IAccount account = Accounts.GetAccount( un );

								if ( account != null )
								{
									notice = "There is already an account with that username.";
								}
								else
								{
									dispAccount = new Account( un, pw );
									notice = String.Format( "{0} : Account added.", un );
									CommandLogging.WriteLine( from, "{0} {1} adding new account: {2}", from.AccessLevel, CommandLogging.Format( from ), un );
								}
							}

							from.SendGump( new AdminGump( from, dispAccount != null ? AdminGumpPage.AccountDetails_Information : m_PageType, m_ListPage, m_List, notice, dispAccount != null ? dispAccount : m_State ) );
							break;
						}
						case 7:
						{
							ArrayList results;

							TextRelay matchEntry = info.GetTextEntry( 0 );
							string match = ( matchEntry == null ? null : matchEntry.Text.Trim().ToLower() );
							string notice = null;

							if ( match == null || match.Length == 0 )
							{
								results = new ArrayList( (ICollection)Accounts.GetAccounts() );
								results.Sort( AccountComparer.Instance );
								//notice = "You must enter a username to search.";
							}
							else
							{
								results = new ArrayList();
								foreach ( Account check in Accounts.GetAccounts() )
								{
									if ( check.Username.ToLower().IndexOf( match ) >= 0 )
										results.Add( check );
								}

								results.Sort( AccountComparer.Instance );
							}

							if ( results.Count == 1 )
								from.SendGump( new AdminGump( from, AdminGumpPage.AccountDetails_Information, 0, null, "One match found.", results[0] ) );
							else
								from.SendGump( new AdminGump( from, AdminGumpPage.Accounts, 0, results, notice == null ? (results.Count == 0 ? "Nothing matched your search terms." : null) : notice, new ArrayList() ) );

							break;
						}
						case 8: from.SendGump( new AdminGump( from, AdminGumpPage.AccountDetails_ChangePassword, 0, null, null, m_State ) ); break;
						case 9: from.SendGump( new AdminGump( from, AdminGumpPage.AccountDetails_ChangeAccess, 0, null, null, m_State ) ); break;
						case 10: case 11:
						{
							Account a = m_State as Account;

							if ( a == null )
								break;

							a.SetUnspecifiedBan( from );
							a.Banned = ( index == 10 );
							CommandLogging.WriteLine( from, "{0} {1} {3} account {2}", from.AccessLevel, CommandLogging.Format( from ), a.Username, a.Banned ? "banning" : "unbanning" );
							from.SendGump( new AdminGump( from, m_PageType, m_ListPage, m_List, String.Format( "The account has been {0}.", a.Banned ? "banned" : "unbanned" ), m_State ) );

							if ( index == 10 )
								from.SendGump( new BanDurationGump( a ) );

							break;
						}
						case 12:
						{
							Account a = m_State as Account;

							if ( a == null )
								break;

							TextRelay passwordEntry = info.GetTextEntry( 0 );
							TextRelay confirmEntry = info.GetTextEntry( 1 );

							string password = ( passwordEntry == null ? null : passwordEntry.Text.Trim() );
							string confirm = ( confirmEntry == null ? null : confirmEntry.Text.Trim() );

							string notice;
							AdminGumpPage page = AdminGumpPage.AccountDetails_ChangePassword;

							if ( password == null || password.Length == 0 )
							{
								notice = "You must enter the password.";
							}
							else if ( confirm != password )
							{
								notice = "You must confirm the password. That field must precisely match the password field.";
							}
							else
							{
								notice = "The password has been changed.";
								a.SetPassword( password );
								page = AdminGumpPage.AccountDetails_Information;
								CommandLogging.WriteLine( from, "{0} {1} changing password of account {2}", from.AccessLevel, CommandLogging.Format( from ), a.Username );
							}

							from.SendGump( new AdminGump( from, page, 0, null, notice, m_State ) );

							break;
						}
						case 16: // view shared
						{
							Account a = m_State as Account;

							if ( a == null )
								break;

							ArrayList list = GetSharedAccounts( a.LoginIPs );

							if ( list.Count > 1 || (list.Count == 1 && !list.Contains( a )) )
							{
								from.SendGump( new AdminGump( from, AdminGumpPage.Accounts, 0, list, null, new ArrayList() ) );
							}
							else if ( a.LoginIPs.Length > 0 )
							{
								from.SendGump( new AdminGump( from, AdminGumpPage.AccountDetails_Access_ClientIPs, 0, null, "There are no other accounts which share an address with this one.", m_State ) );
							}
							else
							{
								from.SendGump( new AdminGump( from, AdminGumpPage.AccountDetails_Access_ClientIPs, 0, null, "This account has not yet been accessed.", m_State ) );
							}

							break;
						}
						case 17: // ban shared
						{
							Account a = m_State as Account;

							if ( a == null )
								break;

							ArrayList list = GetSharedAccounts( a.LoginIPs );

							if ( list.Count > 0 )
							{
								StringBuilder sb = new StringBuilder();

								sb.AppendFormat( "You are about to ban {0} account{1}. Do you wish to continue?", list.Count, list.Count != 1 ? "s" : "" );

								for ( int i = 0; i < list.Count; ++i )
									sb.AppendFormat( "<br>- {0}", ((Account)list[i]).Username );

								from.SendGump( new WarningGump( 1060635, 30720, sb.ToString(), 0xFFC000, 420, 400, new WarningGumpCallback( BanShared_Callback ), a ) );
							}
							else if ( a.LoginIPs.Length > 0 )
							{
								from.SendGump( new AdminGump( from, AdminGumpPage.AccountDetails_Access_ClientIPs, 0, null, "There are no accounts which share an address with this one.", m_State ) );
							}
							else
							{
								from.SendGump( new AdminGump( from, AdminGumpPage.AccountDetails_Access_ClientIPs, 0, null, "This account has not yet been accessed.", m_State ) );
							}

							break;
						}
						case 18: // firewall all
						{
							Account a = m_State as Account;

							if ( a == null )
								break;

							if ( a.LoginIPs.Length > 0 )
							{
								from.SendGump( new WarningGump( 1060635, 30720, String.Format( "You are about to firewall {0} address{1}. Do you wish to continue?", a.LoginIPs.Length, a.LoginIPs.Length != 1 ? "s" : "" ), 0xFFC000, 420, 400, new WarningGumpCallback( FirewallShared_Callback ), a ) );
							}
							else
							{
								from.SendGump( new AdminGump( from, AdminGumpPage.AccountDetails_Access_ClientIPs, 0, null, "This account has not yet been accessed.", m_State ) );
							}

							break;
						}
						case 19: // add
						{
							Account a = m_State as Account;

							if ( a == null )
								break;

							TextRelay entry = info.GetTextEntry( 0 );
							string ip = ( entry == null ? null : entry.Text.Trim() );

							string notice;

							if ( ip == null || ip.Length == 0 )
							{
								notice = "You must enter an address to add.";
							}
							else
							{
								string[] list = a.IPRestrictions;

								bool contains = false;
								for ( int i = 0; !contains && i < list.Length; ++i )
									contains = ( list[i] == ip );

								if ( contains )
								{
									notice = "That address is already contained in the list.";
								}
								else
								{
									string[] newList = new string[list.Length + 1];

									for ( int i = 0; i < list.Length; ++i )
										newList[i] = list[i];

									newList[list.Length] = ip;

									a.IPRestrictions = newList;

									notice = String.Format( "{0} : Added to restriction list.", ip );
								}
							}

							from.SendGump( new AdminGump( from, AdminGumpPage.AccountDetails_Access_Restrictions, 0, null, notice, m_State ) );

							break;
						}
						case 20: // Change access level
						case 21:
						case 22:
						case 23:
						case 24:
						{
							Account a = m_State as Account;

							if ( a == null )
								break;

							AccessLevel newLevel;

							switch ( index )
							{
								default:
								case 20: newLevel = AccessLevel.Player; break;
								case 21: newLevel = AccessLevel.Counselor; break;
								case 22: newLevel = AccessLevel.GameMaster; break;
								case 23: newLevel = AccessLevel.Seer; break;
								case 24: newLevel = AccessLevel.Administrator; break;
								case 33: newLevel = AccessLevel.Developer; break;
								case 34: newLevel = AccessLevel.Owner; break;
							}

							if ( newLevel < from.AccessLevel || from.AccessLevel == AccessLevel.Owner )
							{
								a.AccessLevel = newLevel;

								CommandLogging.WriteLine( from, "{0} {1} changing access level of account {2} to {3}", from.AccessLevel, CommandLogging.Format( from ), a.Username, a.AccessLevel );
								from.SendGump( new AdminGump( from, AdminGumpPage.AccountDetails_Information, 0, null, "The access level has been changed.", m_State ) );
							}

							break;
						}
						case 25:
						{
							Account a = m_State as Account;

							if ( a == null )
								break;

							from.SendGump( new WarningGump( 1060635, 30720, String.Format( "<center>Account of {0}</center><br>You are about to <em><basefont color=red>permanently delete</basefont></em> the account. Likewise, all characters on the account will be deleted, including equiped, inventory, and banked items. Any houses tied to the account will be demolished.<br><br>Do you wish to continue?", a.Username ), 0xFFC000, 420, 280, new WarningGumpCallback( AccountDelete_Callback ), m_State ) );
							break;
						}
						case 26: // View all shared accounts
						{
							from.SendGump( new AdminGump( from, AdminGumpPage.Accounts_Shared, 0, null, null, null ) );
							break;
						}
						case 27: // Ban marked
						{
							ArrayList list = m_List;
							ArrayList rads = m_State as ArrayList;

							if ( list == null || rads == null )
								break;

							if ( rads.Count > 0 )
								from.SendGump( new WarningGump( 1060635, 30720, String.Format( "You are about to ban {0} marked account{1}. Be cautioned, the only way to reverse this is by hand--manually unbanning each account.<br><br>Do you wish to continue?", rads.Count, rads.Count == 1 ? "" : "s" ), 0xFFC000, 420, 280, new WarningGumpCallback( Marked_Callback ), new object[]{ true, list, rads, m_ListPage } ) );
							else
								from.SendGump( new NoticeGump( 1060637, 30720, "You have not yet marked any accounts. Place a check mark next to the accounts you wish to ban and then try again.", 0xFFC000, 420, 280, new NoticeGumpCallback( ResendGump_Callback ), new object[]{ list, rads, m_ListPage } ) );

							break;
						}
						case 28: // Delete marked
						{
							ArrayList list = m_List;
							ArrayList rads = m_State as ArrayList;

							if ( list == null || rads == null )
								break;

							if ( rads.Count > 0 )
								from.SendGump( new WarningGump( 1060635, 30720, String.Format( "You are about to <em><basefont color=red>permanently delete</basefont></em> {0} marked account{1}. Likewise, all characters on the account{1} will be deleted, including equiped, inventory, and banked items. Any houses tied to the account{1} will be demolished.<br><br>Do you wish to continue?", rads.Count, rads.Count == 1 ? "" : "s" ), 0xFFC000, 420, 280, new WarningGumpCallback( Marked_Callback ), new object[]{ false, list, rads, m_ListPage } ) );
							else
								from.SendGump( new NoticeGump( 1060637, 30720, "You have not yet marked any accounts. Place a check mark next to the accounts you wish to ban and then try again.", 0xFFC000, 420, 280, new NoticeGumpCallback( ResendGump_Callback ), new object[]{ list, rads, m_ListPage } ) );

							break;
						}
						case 29: // Mark all
						{
							ArrayList list = m_List;
							ArrayList rads = m_State as ArrayList;

							if ( list == null || rads == null )
								break;

							from.SendGump( new AdminGump( from, AdminGumpPage.Accounts, m_ListPage, m_List, null, new ArrayList( list ) ) );

							break;
						}
						case 30: // View all empty accounts
						{
							ArrayList results = new ArrayList();

							foreach ( Account acct in Accounts.GetAccounts() )
							{
								bool empty = true;

								for ( int i = 0; empty && i < acct.Length; ++i )
									empty = ( acct[i] == null );

								if ( empty )
									results.Add( acct );
							}

							if ( results.Count == 1 )
								from.SendGump( new AdminGump( from, AdminGumpPage.AccountDetails_Information, 0, null, "One match found.", results[0] ) );
							else
								from.SendGump( new AdminGump( from, AdminGumpPage.Accounts, 0, results, (results.Count == 0 ? "Nothing matched your search terms." : null), new ArrayList() ) );

							break;
						}
						case 31: // View all inactive accounts
						{
							ArrayList results = new ArrayList();

							foreach ( Account acct in Accounts.GetAccounts() )
							{
								if ( acct.Inactive )
									results.Add( acct );
							}

							if ( results.Count == 1 )
								from.SendGump( new AdminGump( from, AdminGumpPage.AccountDetails_Information, 0, null, "One match found.", results[0] ) );
							else
								from.SendGump( new AdminGump( from, AdminGumpPage.Accounts, 0, results, (results.Count == 0 ? "Nothing matched your search terms." : null), new ArrayList() ) );

							break;
						}
						case 32: // View all banned accounts
						{
							ArrayList results = new ArrayList();

							foreach ( Account acct in Accounts.GetAccounts() )
							{
								if ( acct.Banned )
									results.Add( acct );
							}

							if ( results.Count == 1 )
								from.SendGump( new AdminGump( from, AdminGumpPage.AccountDetails_Information, 0, null, "One match found.", results[0] ) );
							else
								from.SendGump( new AdminGump( from, AdminGumpPage.Accounts, 0, results, (results.Count == 0 ? "Nothing matched your search terms." : null), new ArrayList() ) );

							break;
						}
						case 33: // Change access level (extended)
						case 34:
						{
							goto case 20;
						}
						case 35: // Unmark house owners
						{
							ArrayList list = m_List;
							ArrayList rads = m_State as ArrayList;

							if ( list == null || rads == null )
								break;

							ArrayList newRads = new ArrayList();

							foreach ( Account acct in rads )
							{
								bool hasHouse = false;

								for ( int i = 0; i < acct.Length && !hasHouse; ++i )
									if ( acct[i] != null && BaseHouse.HasHouse( acct[i] ) )
										hasHouse = true;

								if ( !hasHouse )
									newRads.Add( acct );
							}

							from.SendGump( new AdminGump( from, AdminGumpPage.Accounts, m_ListPage, m_List, null, newRads ) );

							break;
						}
						case 36: // Clear login addresses
						{
							Account a = m_State as Account;

							if ( a == null )
								break;

							IPAddress[] ips = a.LoginIPs;

							if ( ips.Length == 0 )
								from.SendGump( new AdminGump( from, AdminGumpPage.AccountDetails_Access_ClientIPs, 0, null, "This account has not yet been accessed.", m_State ) );
							else
								from.SendGump( new WarningGump( 1060635, 30720, String.Format( "You are about to clear the address list for account {0} containing {1} {2}. Do you wish to continue?", a, ips.Length, ( ips.Length == 1 ) ? "entry" : "entries" ), 0xFFC000, 420, 280, new WarningGumpCallback( RemoveLoginIPs_Callback ), a ) );

							break;
						}
						default:
						{
							index -= 50;

							Account a = m_State as Account;

							if ( a != null && index >= 0 && index < a.Length )
							{
								Mobile m = a[index];

								if ( m != null )
									from.SendGump( new AdminGump( from, AdminGumpPage.ClientInfo, 0, null, null, m ) );
							}
							else
							{
								index -= 6;

								if ( m_List != null && index >= 0 && index < m_List.Count )
								{
									if ( m_List[index] is Account )
										from.SendGump( new AdminGump( from, AdminGumpPage.AccountDetails_Information, 0, null, null, m_List[index] ) );
									else if ( m_List[index] is DictionaryEntry )
										from.SendGump( new AdminGump( from, AdminGumpPage.Accounts, 0, (ArrayList)(((DictionaryEntry)m_List[index]).Value), null, new ArrayList() ) );
								}
							}

							break;
						}
					}

					break;
				}
				case 6:
				{
					switch ( index )
					{
						case 0:
						{
							TextRelay matchEntry = info.GetTextEntry( 0 );
							string match = ( matchEntry == null ? null : matchEntry.Text.Trim() );

							string notice = null;
							ArrayList results = new ArrayList();

							if ( match == null || match.Length == 0 )
							{
								notice = "You must enter a username to search.";
							}
							else
							{
								for ( int i = 0; i < Firewall.List.Count; ++i )
								{
									string check = Firewall.List[i].ToString();

									if ( check.IndexOf( match ) >= 0 )
										results.Add( Firewall.List[i] );
								}
							}

							if ( results.Count == 1 )
								from.SendGump( new AdminGump( from, AdminGumpPage.FirewallInfo, 0, null, "One match found.", results[0] ) );
							else if ( results.Count > 1 )
								from.SendGump( new AdminGump( from, AdminGumpPage.Firewall, 0, results, String.Format( "Search results for : {0}", match ), m_State ) );
							else
								from.SendGump( new AdminGump( from, m_PageType, m_ListPage, m_List, notice == null ? "Nothing matched your search terms."  : notice, m_State ) );

							break;
						}
						case 1:
						{
							TextRelay relay = info.GetTextEntry( 0 );
							string text = ( relay == null ? null : relay.Text.Trim() );

							if ( text == null || text.Length == 0 )
							{
								from.SendGump( new AdminGump( from, m_PageType, m_ListPage, m_List, "You must enter an address or pattern to add.", m_State ) );
							}
							else if ( !Utility.IsValidIP( text ) )
							{
								from.SendGump( new AdminGump( from, m_PageType, m_ListPage, m_List, "That is not a valid address or pattern.", m_State ) );
							}
							else
							{
								object toAdd = Firewall.ToFirewallEntry( text );

								CommandLogging.WriteLine( from, "{0} {1} firewalling {2}", from.AccessLevel, CommandLogging.Format( from ), toAdd );

								Firewall.Add( toAdd );
								from.SendGump( new AdminGump( from, AdminGumpPage.FirewallInfo, 0, null, String.Format( "{0} : Added to firewall.", toAdd ), toAdd ) );
							}

							break;
						}
						case 2:
						{
							InvokeCommand( "Firewall" );
							from.SendGump( new AdminGump( from, m_PageType, m_ListPage, m_List, "Target the player to firewall.", m_State ) );
							break;
						}
						case 3:
						{
							if ( m_State is Firewall.IFirewallEntry )
							{
								CommandLogging.WriteLine( from, "{0} {1} removing {2} from firewall list", from.AccessLevel, CommandLogging.Format( from ), m_State );

								Firewall.Remove( m_State );
								from.SendGump( new AdminGump( from, AdminGumpPage.Firewall, 0, null, String.Format( "{0} : Removed from firewall.", m_State ), null ) );
							}

							break;
						}
						default:
						{
							index -= 4;

							if ( m_List != null && index >= 0 && index < m_List.Count )
								from.SendGump( new AdminGump( from, AdminGumpPage.FirewallInfo, 0, null, null, m_List[index] ) );

							break;
						}
					}

					break;
				}
				case 7:
				{
					Mobile m = m_State as Mobile;

					if ( m == null )
						break;

					string notice = null;
					bool sendGump = true;

					switch ( index )
					{
						case 0:
						{
							Map map = m.Map;
							Point3D loc = m.Location;

							if ( map == null || map == Map.Internal )
							{
								map = m.LogoutMap;
								loc = m.LogoutLocation;
							}

							if ( map != null && map != Map.Internal )
							{
								from.MoveToWorld( loc, map );
								notice = "You have been teleported to their location.";
							}

							break;
						}
						case 1:
						{
							m.MoveToWorld( from.Location, from.Map );
							notice = "They have been teleported to your location.";
							break;
						}
						case 2:
						{
							NetState ns = m.NetState;

							if ( ns != null )
							{
								CommandLogging.WriteLine( from, "{0} {1} {2} {3}", from.AccessLevel, CommandLogging.Format( from ), "kicking", CommandLogging.Format( m ) );
								ns.Dispose();
								notice = "They have been kicked.";
							}
							else
							{
								notice = "They are already disconnected.";
							}

							break;
						}
						case 3:
						{
							Account a = m.Account as Account;

							if ( a != null )
							{
								CommandLogging.WriteLine( from, "{0} {1} {2} {3}", from.AccessLevel, CommandLogging.Format( from ), "banning", CommandLogging.Format( m ) );
								a.Banned = true;

								NetState ns = m.NetState;

								if ( ns != null )
									ns.Dispose();

								notice = "They have been banned.";
							}

							break;
						}
						case 6:
						{
							Properties.SetValue( from, m, "Blessed", "False" );
							notice = "They are now mortal.";
							break;
						}
						case 7:
						{
							Properties.SetValue( from, m, "Blessed", "True" );
							notice = "They are now immortal.";
							break;
						}
						case 8:
						{
							Properties.SetValue( from, m, "Squelched", "True" );
							notice = "They are now squelched.";
							break;
						}
						case 9:
						{
							Properties.SetValue( from, m, "Squelched", "False" );
							notice = "They are now unsquelched.";
							break;
						}
						case 10:
						{
							Properties.SetValue( from, m, "Hidden", "True" );
							notice = "They are now hidden.";
							break;
						}
						case 11:
						{
							Properties.SetValue( from, m, "Hidden", "False" );
							notice = "They are now unhidden.";
							break;
						}
						case 12:
						{
							CommandLogging.WriteLine( from, "{0} {1} killing {2}", from.AccessLevel, CommandLogging.Format( from ), CommandLogging.Format( m ) );
							m.Kill();
							notice = "They have been killed.";
							break;
						}
						case 13:
						{
							CommandLogging.WriteLine( from, "{0} {1} resurrecting {2}", from.AccessLevel, CommandLogging.Format( from ), CommandLogging.Format( m ) );
							m.Resurrect();
							notice = "They have been resurrected.";
							break;
						}
						case 14:
						{
							from.SendGump( new AdminGump( from, AdminGumpPage.AccountDetails_Information, 0, null, null, m.Account ) );
							sendGump = false;
							break;
						}
					}

					if ( sendGump )
						from.SendGump( new AdminGump( from, AdminGumpPage.ClientInfo, 0, null, notice, m_State ) );

					switch ( index )
					{
						case 3:
						{
							Account a = m.Account as Account;

							if ( a != null )
								from.SendGump( new BanDurationGump( a ) );

							break;
						}
						case 4:
						{
							from.SendGump( new PropertiesGump( from, m ) );
							break;
						}
						case 5:
						{
							from.SendGump( new SkillsGump( from, m ) );
							break;
						}
					}

					break;
				}
				case 8:
				{
					if ( m_List != null && index >= 0 && index < m_List.Count )
					{
						Account a = m_State as Account;

						if ( a == null )
							break;

						if ( m_PageType == AdminGumpPage.AccountDetails_Access_ClientIPs )
						{
							from.SendGump( new WarningGump( 1060635, 30720, String.Format( "You are about to firewall {0}. All connection attempts from a matching IP will be refused. Are you sure?", m_List[index] ), 0xFFC000, 420, 280, new WarningGumpCallback( Firewall_Callback ), new object[]{ a, m_List[index] } ) );
						}
						else if ( m_PageType == AdminGumpPage.AccountDetails_Access_Restrictions )
						{
							ArrayList list = new ArrayList( a.IPRestrictions );

							list.Remove( m_List[index] );

							a.IPRestrictions = (string[])list.ToArray( typeof( string ) );

							from.SendGump( new AdminGump( from, AdminGumpPage.AccountDetails_Access_Restrictions, 0, null, String.Format( "{0} : Removed from list.", m_List[index] ), a ) );
						}
					}

					break;
				}
				case 9:
				{
					if ( m_List != null && index >= 0 && index < m_List.Count )
					{
						if ( m_PageType == AdminGumpPage.AccountDetails_Access_ClientIPs )
						{
							object obj = m_List[index];

							if ( !(obj is IPAddress) )
								break;

							Account a = m_State as Account;

							if ( a == null )
								break;

							ArrayList list = GetSharedAccounts( (IPAddress)obj );

							if ( list.Count > 1 || (list.Count == 1 && !list.Contains( a )) )
								from.SendGump( new AdminGump( from, AdminGumpPage.Accounts, 0, list, null, new ArrayList() ) );
							else
								from.SendGump( new AdminGump( from, AdminGumpPage.AccountDetails_Access_ClientIPs, 0, null, "There are no other accounts which share that address.", m_State ) );
						}
					}

					break;
				}
				case 10:
				{
					if ( m_List != null && index >= 0 && index < m_List.Count )
					{
						if ( m_PageType == AdminGumpPage.AccountDetails_Access_ClientIPs )
						{
							IPAddress ip = m_List[index] as IPAddress;

							if ( ip == null )
								break;

							Account a = m_State as Account;

							if ( a == null )
								break;

							from.SendGump( new WarningGump( 1060635, 30720, String.Format( "You are about to remove address {0} from account {1}. Do you wish to continue?", ip, a ), 0xFFC000, 420, 280, new WarningGumpCallback( RemoveLoginIP_Callback ), new object[] { a, ip } ) );
						}
					}

					break;
				}
			}
		}