Exemplo n.º 1
0
        private static void Load()
        {
            string filePath = Path.Combine( "Saves/Accounts", "accounts.xml" );

            if ( !File.Exists( filePath ) )
                return;

            XmlDocument doc = new XmlDocument();
            doc.Load( filePath );

            XmlElement root = doc["accounts"];

            foreach ( XmlElement accountXmlElement in root.GetElementsByTagName( "account" ) )
            {
                try
                {
                    Account acct = new Account( accountXmlElement );

                    Accounts.AddAccount( acct );
                }
                catch
                {
                    Console.WriteLine( "Warning: Account instance load failed" );
                }
            }
        }
Exemplo n.º 2
0
		public static void Load()
		{
			m_Accounts = new Dictionary<string, IAccount>( 32, StringComparer.OrdinalIgnoreCase );

			string filePath = Path.Combine( "Saves/Accounts", "accounts.xml" );

			if ( !File.Exists( filePath ) )
				return;

			XmlDocument doc = new XmlDocument();
			doc.Load( filePath );

			XmlElement root = doc["accounts"];

			foreach ( XmlElement account in root.GetElementsByTagName( "account" ) )
			{
				try
				{
					Account acct = new Account( account );
				}
				catch
				{
					Console.WriteLine( "Warning: Account instance load failed" );
				}
			}
		}
        public DonationHuePickerGump(Mobile m, int[] hues, GetHueMethod gethuemethod, SetHueMethod sethuemethod, string caption)
            : base(20, 20)
        {
            if (m == null || m.Account == null || hues == null || hues.Length <= 0 || gethuemethod == null || sethuemethod == null || caption == null)
                return;

            m_Account = (Account)m.Account;
            m_Hues = hues;
            m_GetHueMethod = gethuemethod;
            m_SetHueMethod = sethuemethod;
            m_Caption = caption;

            int cushue = m_GetHueMethod(m_Account);

            AddPage(0);

            AddBackground(0, 0, 200, 120 + m_Hues.Length * 30, 2600);

            AddLabel(50, 30, 2401, m_Caption);

            int c = 0;
            foreach (int hue in m_Hues)
            {
                AddRadio(30, 50 + c * 30, 9727, 9730, (cushue == hue), c);
                AddLabel(65, 55 + c * 30, (hue == 0) ? 2401 : (hue == 1177) ? 52 : hue - 1, (hue == 0) ? "Regular Hue" : (hue == 1177) ? "Blaze Hue" : "*****");
                c++;
            }
            AddButton(30, 60 + c * 30, 4005, 4007, 1, GumpButtonType.Reply, 0);
            AddLabel(65, 60 + c * 30, 2401, "Apply");
        }
Exemplo n.º 4
0
		public static void Initialize()
		{
			if ( Accounts.Count == 0 && !Core.Service )
			{
				Console.WriteLine( "This server has no accounts." );
				Console.Write( "Do you want to create the owner account now? (y/n)" );

				if( Console.ReadKey( true ).Key == ConsoleKey.Y )
				{
					Console.WriteLine();

					Console.Write( "Username: "******"Password: "******"Account created." );
				}
				else
				{
					Console.WriteLine();

					Console.WriteLine( "Account not created." );
				}
			}
		}
Exemplo n.º 5
0
		public static Account CreateAccount( string username, string password, string linkedEmail = null )
		{
			Account account = new Account( username, password, linkedEmail );

			if ( m_Accounts.Count == 0 )
				account.AccessLevel = AccessLevel.Owner;

			return AddAccount( account );
		}
Exemplo n.º 6
0
        public static Account AddAccount( string user, string pass )
        {
            Account a = new Account( user, pass );
            if ( m_Accounts.Count == 0 )
                a.AccessLevel = AccessLevel.Administrator;

            m_Accounts[a.Username] = a;

            return a;
        }
Exemplo n.º 7
0
		protected virtual int GetProgress(ConquestState state, Account account)
		{
            if (state.User == null)
                return 0;

			if (account == null || DateTime.UtcNow - account.Created < AccountAge)
			{
				return 0;
			}
			
			return 1;
		}
Exemplo n.º 8
0
		private static Mobile CreateMobile( Account a )
		{
			if ( a.Count >= a.Limit )
				return null;

			for ( int i = 0; i < a.Length; ++i )
			{
				if ( a[i] == null )
					return (a[i] = new PlayerMobile());
			}

			return null;
		}
		public static void GetAccountInfo(Account a, out AccessLevel accessLevel, out bool online)
		{
			accessLevel = a.AccessLevel;
			online = false;

			for (int j = 0; j < 5; ++j)
			{
				Mobile check = a[j];

				if (check == null)
					continue;

				if (check.AccessLevel > accessLevel)
					accessLevel = check.AccessLevel;

				if (check.NetState != null)
					online = true;
			}
		}
			public void Deserialize( GenericReader reader )
			{
				int version = reader.ReadInt();

				switch ( version )
				{
					case 0:
					{
						m_Account = Accounts.GetAccount( reader.ReadString() );
						m_HorseHue = reader.ReadInt();
						m_SandalHue = reader.ReadInt();
						m_BandanaHue = reader.ReadInt();
						m_RobeHue = reader.ReadInt();
						for ( int i = 0; i < 9; i++ )
							reader.ReadInt();
						break;
					}
				}
			}
		public DonationSettingsGump( Mobile m ) : base( 20, 20 )
		{
			if ( !(m is PlayerMobile ) || m == null || m.Account == null )
				return;

			m_Account = (Account)m.Account;

			AddPage( 0 );



			AddBackground( 0, 0, 300, 250, 2600 );

			AddLabel( 60, 30, 2401, "Donation Settings" );

			int errors = 0;

			TryButton( 30, 50, m, 90, 1, ref errors );
			AddLabel( 65, 50, 2401, "Set Horse Hue" );
			TryButton( 30, 70, m, 30, 2, ref errors );
			AddLabel( 65, 70, 2401, "Set Sandal Hue" );
			TryButton( 30, 90, m, 30, 3, ref errors );
			AddLabel( 65, 90, 2401, "Set Bandana Hue" );
			TryButton( 30, 110, m, 180, 4, ref errors );
			AddLabel( 65, 110, 2401, "Set Robe Hue" );

			TimeSpan timeleft = ((PlayerMobile)m).DonationTimeLeft;

			if ( timeleft == TimeSpan.MaxValue )
				AddLabel( 30, 140, 2401, "You have a permanent membership" );
			else
			{
				if ( timeleft > TimeSpan.FromSeconds( 0.0 ) )
					AddLabel( 30, 140, 2401, String.Format( "Your membership expires in {0} days", (int)timeleft.TotalDays ) );
				if ( errors > 0 )
					AddLabel( 30, 160, 37, "* required membership length" );
				AddLabel( 30, 180, 2401, "Type [donate to donate" );
			}
		}
Exemplo n.º 12
0
        private static Account CreateAccount(NetState state, string un, string pw)
        {
            if (un.Length == 0 || pw.Length == 0)
                return null;

            bool isSafe = !(un.StartsWith(" ") || un.EndsWith(" ") || un.EndsWith("."));

            for (int i = 0; isSafe && i < un.Length; ++i)
                isSafe = (un[i] >= 0x20 && un[i] < 0x7F && !IsForbiddenChar(un[i]));

            for (int i = 0; isSafe && i < pw.Length; ++i)
                isSafe = (pw[i] >= 0x20 && pw[i] < 0x7F);

            if (!isSafe)
                return null;

            if (!CanCreate(state.Address))
            {
                Utility.PushColor(ConsoleColor.DarkYellow);
                Console.WriteLine("Login: {0}: Account '{1}' not created, ip already has {2} account{3}.", state, un, MaxAccountsPerIP, MaxAccountsPerIP == 1 ? "" : "s");
                Utility.PopColor();
                return null;
            }

            Utility.PushColor(ConsoleColor.Green);
            Console.WriteLine("Login: {0}: Creating new account '{1}'", state, un);
            Utility.PopColor();

            Account a = new Account(un, pw);

            return a;
        }
Exemplo n.º 13
0
		/// <summary>
		///     Verifies if an account can be jailed
		/// </summary>
		/// <param name="acc">The account to verify</param>
		/// <returns>True if the account can be jailed</returns>
		public static bool CanBeJailed(Account acc)
		{
			if (acc==null || acc.AccessLevel > AccessLevel.Player)
			{
				return false;
			}

			return m_Jailings.All(jail => !jail.FullJail || jail.Account != acc);
		}
Exemplo n.º 14
0
		/// <summary>
		///     Initializes a jailing action by sending the JailReasonGump
		/// </summary>
		/// <param name="from">The GM performing the jailing</param>
		/// <param name="offender">The account being jailed</param>
		/// <returns>True if the jailing can proceed</returns>
		public static bool InitJail(Mobile from, Account offender)
		{
			if (CanBeJailed(offender))
			{
				from.SendGump(new JailReasonGump(offender));
				return true;
			}
			
			JailEntry jail = GetCurrentJail(offender);

			if (jail == null)
			{
				from.SendMessage("You can't jail that account because it's either already jailed or a staff account.");
			}
			else
			{
				from.SendMessage("That account has already been jailed. Please review the existing jail record.");
				from.SendGump(new JailViewGump(from, jail, null));
			}

			return false;
		}
Exemplo n.º 15
0
		/// <summary>
		///     Gets the current jail record for a given account
		/// </summary>
		/// <param name="acc">The account being examined</param>
		/// <returns>A JailEntry if one is matching, null otherwise</returns>
		private static JailEntry GetCurrentJail(Account acc)
		{
			if (acc == null)
			{
				return null;
			}

			return m_Jailings.FirstOrDefault(jail => jail.Account == acc && jail.FullJail);
		}
Exemplo n.º 16
0
        public static bool HasHalfLevel(Account acct)
        {
            TimeSpan totalTime = (DateTime.UtcNow - acct.Created);

            Double level = (totalTime.TotalDays / RewardInterval.TotalDays);

            return level >= 0.5;
        }
Exemplo n.º 17
0
		public static void LogIPAccess(IPAddress ipAddress, Account acct, Mobile mob)
		{
			string directory = "Logs/Login";

			if (!Directory.Exists(directory))
			{
				Directory.CreateDirectory(directory);
			}

			try
			{
				using (var op = new StreamWriter(Path.Combine(directory, String.Format("{0}.log", acct.Username.ToLower())), true))
				{
					op.WriteLine("{0} - {1} - {2} - created character: {3}", DateTime.UtcNow, acct.Username, ipAddress, mob);
				}
			}
			catch
			{
				Console.WriteLine(
					"Failed to write to file: {0}", Path.Combine("Logs/Login", String.Format("{0}.log", acct.Username.ToLower())));
			}
		}
Exemplo n.º 18
0
        private static bool ImportAccount(Dictionary<string, string> accountData)
        {
            try
            {
                // On vérifie s'il y a déjà un compte qui existe avec ce login, si oui on ne fait rien
                IAccount account = Accounts.GetAccount(accountData["LOGIN"]);
                if (account != null) return false;

                // On vérifie que le joueur n'ait pas de plevel pour ne pas importer les comptes GM et autres
                string plevel = null;
                accountData.TryGetValue("PLEVEL", out plevel);
                if (plevel != null) return false;

                // On crée un nouveau compte et on l'ajoute à la liste des comtes
                IAccount newAccount = new Account(accountData["LOGIN"], accountData["PASSWORD"]);
                Accounts.Add(newAccount);
            }
            catch //(KeyNotFoundException knfe)
            {
                // S'il manque des informations comme le login ou le password on n'importe pas le compte
                return false;
            }
            return true;
        }
Exemplo n.º 19
0
        public static int GetRewardLevel(Account acct)
        {
            TimeSpan totalTime = (DateTime.UtcNow - acct.Created);

            int level = (int)(totalTime.TotalDays / RewardInterval.TotalDays);

            if (level < 0)
                level = 0;

            return level;
        }
		public DonationStatusGump( PlayerMobile m )
			: base( 20, 20 )
		{
			if ( m == null || m.Account == null )
				return;

			m_Mobile = m;
			m_Account = (Account)m.Account;

			DateTime DonationStart;
			TimeSpan DonationDuration;

			try
			{
				DonationStart = DateTime.Parse( m_Account.GetTag( "DonationStart" ) );
				DonationDuration = TimeSpan.Parse( m_Account.GetTag( "DonationDuration" ) );
			}
			catch
			{
				DonationStart = DateTime.MinValue;
				DonationDuration = TimeSpan.FromMinutes( 0.0 );
			}

			this.Closable=true;
			this.Disposable=true;
			this.Dragable=true;
			this.Resizable=false;
			this.AddPage(0);
			this.AddBackground(0, 0, 300, 185, 5150);
			this.AddLabel(27, 26, 0, String.Format( "Donation status for account {0}", m.Account.ToString() ) );
			this.AddLabel(27, 49, 0, "Current subscription valid until");
			if ( DateTime.Now - DonationStart > DonationDuration )
				this.AddLabel(27, 69, 0, String.Format( "No current subscription" ) );
			else if ( DonationDuration == TimeSpan.MaxValue )
				this.AddLabel(27, 69, 0, String.Format( "Permanent subscription" ) );
			else
				this.AddLabel(27, 69, 0, (DonationStart + DonationDuration).ToString() );
			this.AddLabel(57, 94, 0, "New subscription");

			this.AddRadio(26, 95, 210, 211, true, 0 );
			this.AddTextEntry( 57, 110, 50, 20, 0, 0, "");
			this.AddLabel(111, 115, 0, "Days" );
			this.AddRadio(27, 131, 210, 211, false, 1 );
			this.AddLabel(57, 134, 0, "Permanent subscription" );
			this.AddButton(233, 110, 4023, 4024, 1, GumpButtonType.Reply, 0 );
		}
Exemplo n.º 21
0
		/// <summary>
		///     Searches the jail history for references of an account
		/// </summary>
		/// <param name="account">The account to search for</param>
		/// <returns>An ArrayList of JailEntry objects</returns>
		public static List<JailEntry> SearchHistory(Account account)
		{
			List<JailEntry> history = GetHistory();

			history.AddRange(m_ExpiredJailings);
			history.AddRange(m_Jailings);

			return history.Where(jail => jail.Account != null && jail.Account == account).ToList();
		}
Exemplo n.º 22
0
		//This function stolen from Misc/CrashGuard.cs
		private static void SendEmail( Account account, string password )
		{
			WebAccountLogger.Log( string.Format("Attempting to send email to {0}/{1} at {2}...", account.Username, password, account.EmailAddress) );

			if( EmailServer == null || FromEmailAddress == null )
			{
				WebAccountLogger.Log("Not sending email because EmailServer or FromEmailAddress is not set.");
				return;
			}

			try
			{
				string path = WebAccount.RequestDirectory + "\\message.txt";
				if( File.Exists(path) )
				{
					using ( StreamReader sr = new StreamReader(path) )
					{
						EmailMessageFormat = sr.ReadToEnd();
						sr.Close();
					}
				}
				else
				{
					WebAccountLogger.Log("Error: " + path + " doesn't exist - sending default message.");
				}
			}
			catch
			{
				WebAccountLogger.Log("Failed to read message.txt for account email - using default message.");
			}

			try
			{
				MailMessage message = new MailMessage();

				message.Subject = "New Angel Island account request."; WebAccountLogger.Log( message.Subject );
				message.From = FromEmailAddress; // WebAccountLogger.Log( message.From );
				message.To = account.EmailAddress; // WebAccountLogger.Log( message.To );
				message.Body = string.Format(EmailMessageFormat, password); // WebAccountLogger.Log( message.Body );
				SmtpMail.SmtpServer = EmailServer; // WebAccountLogger.Log( SmtpMail.SmtpServer );
				SmtpMail.Send( message );

				WebAccountLogger.Log( "done" );
			}
			catch
			{
				WebAccountLogger.Log( "failed" );
			}
		}
Exemplo n.º 23
0
		/// <summary>
		///     Gets the online mobile for a given account.
		///     This method will not return any staff mobiles.
		/// </summary>
		/// <param name="account">The account object</param>
		/// <returns>A mobile if one is online, null otherwise</returns>
		public static Mobile GetOnlineMobile(Account account)
		{
			if (account == null)
			{
				return null;
			}

			for (int i = 0; i < account.Length; i++)
			{
				Mobile m = account[i];

				if (m != null && m.NetState != null && m.AccessLevel == AccessLevel.Player)
				{
					return m;
				}
			}

			return null;
		}
Exemplo n.º 24
0
 public BanDurationGump(Account a)
     : this(MakeList(a))
 {
 }
Exemplo n.º 25
0
		/// <summary>
		///     Finalizes a jailing action by adding a jail record and moving the mobile into a jail cell
		/// </summary>
		/// <param name="m">The player being jailed</param>
		/// <param name="account">The account of the player being jailed</param>
		/// <param name="from">The GM performing the jailing</param>
		/// <param name="reason">The reason for the jailing</param>
		/// <param name="autorelease">States if the player should be auto released after the sentence is over</param>
		/// <param name="duration">The length of the sentence</param>
		/// <param name="fulljail">States if the full account should be jailed</param>
		/// <param name="comment">An additional comment about the jailing</param>
		public static void CommitJailing(
			Mobile m,
			Account account,
			Mobile from,
			string reason,
			bool autorelease,
			TimeSpan duration,
			bool fulljail,
			string comment)
		{
			var jail = new JailEntry(m, account, from, duration, reason, comment, autorelease, fulljail);

			// Verify if the new entry is valid
			JailEntry existing = null;

			if (! IsValid(jail))
			{
				existing = jail.Mobile != null ? GetCurrentJail(jail.Mobile) : GetCurrentJail(jail.Account);
			}

			if (existing != null)
			{
				// This jailing wont' be committed, if there's a pending player, release them
				CancelJail(m, from);

				from.SendMessage(
					0x40,
					"Your new jail report is in conflict with an existing entry. Please review and eventually update the existing jailing.");
				from.SendGump(new JailViewGump(from, existing, null));
				return;
			}

			// The jailing is valid so go on and add it

			m_Jailings.Add(jail);
			FinalizeJail(m);

			// Send jailing review gump to the offender
			if (m != null && m.NetState != null)
			{
				m.SendGump(new PlayerJailGump(jail, from));
			}
			else if (jail.FullJail) // Handle full account jailing/player relogging
			{
				Mobile mob = GetOnlineMobile(jail.Account);

				if (mob != null)
				{
					FinalizeJail(mob);
					mob.SendGump(new PlayerJailGump(jail, from));
				}
			}
		}
Exemplo n.º 26
0
        private static void ProcessMatch(Mobile from, bool highOnly, PlayerMobile pm1, PlayerMobile pm2)
        {
            try
            {               // sanity
                if (from == null || pm1 == null || pm2 == null)
                {
                    return;                     // wtf
                }
                NetState ns1 = pm1.NetState;
                NetState ns2 = pm2.NetState;

                if (ns1 == null || ns2 == null)
                {
                    return;                     // logged out / disconnected
                }
                if (ns1.Address == null || ns1.Mobile == null || ns2.Address == null || ns2.Mobile == null)
                {
                    return;                     // still logging in?
                }
                if (ns1.Account == null || ns2.Account == null)
                {
                    return;                     // error state .. ignore this account
                }
                if (ns1.Account as Server.Accounting.Account == null || ns2.Account as Server.Accounting.Account == null)
                {
                    return;                     // error state .. ignore this account
                }
                Server.Accounting.Account pm1Account = (Server.Accounting.Account)ns1.Account;
                int    pm1HWInfo = pm1Account.HardwareHash;                     // most recent hardware info
                string pm1Name   = string.Format("{0}/{1}", pm1Account.Username, ns1.Mobile.Name);

                Server.Accounting.Account pm2Account = (Server.Accounting.Account)ns2.Account;
                int    pm2HWInfo = pm2Account.HardwareHash;                     // most recent hardware info
                string pm2Name   = string.Format("{0}/{1}", pm2Account.Username, ns2.Mobile.Name);

                alert alarm = alert.LOW;
                if (pm1HWInfo == 0 && pm2HWInfo == 0 && ns1.Version == ns2.Version)
                {
                    // unknown hardware, same client version
                    if (LineOfSight(pm1, pm2))
                    {
                        alarm = alert.MEDIUM;
                    }
                }
                else if (pm1HWInfo == 0 || pm2HWInfo == 0 && ns1.Version == ns2.Version)
                {
                    // unknown hardware, same client version
                    if (LineOfSight(pm1, pm2))
                    {
                        alarm = alert.MEDIUM;
                    }
                }
                // we don't care about 'bad hardware' here as long as it matches!

                /*else if ((pm1HWInfo != null && pm2HWInfo != null) && (pm1HWInfo.CpuClockSpeed == 0 || pm1HWInfo.OSMajor == 0 || pm2HWInfo.CpuClockSpeed == 0 || pm2HWInfo.OSMajor == 0))
                 * {
                 *      // unknown hardware
                 *      if (LineOfSight(pm1, pm2))
                 *              alarm = alert.MEDIUM;
                 * }*/
                else if ((pm1HWInfo != 0 && pm2HWInfo != 0) && pm1HWInfo == pm2HWInfo /*Server.Commands.MultiClientCommand.IsSameHWInfo(pm1HWInfo, pm2HWInfo)*/)
                {
                    // same hardware
                    alarm = alert.MEDIUM;
                    if (LineOfSight(pm1, pm2) && ns1.Version == ns2.Version)
                    {
                        alarm = alert.HIGH;
                    }
                }
                else
                {
                    // different hardware
                    if (LineOfSight(pm1, pm2) && ns1.Version == ns2.Version)
                    {
                        alarm = alert.MEDIUM;
                    }
                }

                // caller wants to filter to HIGH alarms only
                if (highOnly == true && alarm != alert.HIGH)
                {
                    return;
                }

                from.SendMessage(String.Format("{0}, {1}, Alarm({2})", pm1Name, pm2Name, alarm.ToString()));
            }
            catch (Exception ex)
            {
                LogHelper.LogException(ex);
            }
        }
Exemplo n.º 27
0
		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;
				}
			}
		}
Exemplo n.º 28
0
        private static bool IsYoung(Mobile m)
        {
            Server.Accounting.Account acct = m.Account as Account;

            return(acct != null && (DateTime.Now - acct.Created) < TimeSpan.FromHours(24.0));
        }
Exemplo n.º 29
0
        public static void ClientMon_OnCommand(CommandEventArgs e)
        {
            try
            {
                if (e.Arguments.Length == 0)
                {
                    e.Mobile.SendMessage("Usage: ClientMon -ui|-ma|-mc|-hi|-ho");
                    e.Mobile.SendMessage("Where: -ui ... Unique IP addresses");
                    e.Mobile.SendMessage("Where: -ma ... total multi accounts");
                    e.Mobile.SendMessage("Where: -mc ... total multi clients");
                    e.Mobile.SendMessage("Where: -hi ... clients that have hardware info");
                    e.Mobile.SendMessage("Where: -ho ... HIGH only. use with -mc");
                    return;
                }

                if (e.ArgString.Contains("-hi"))
                {
                    int clients          = 0;
                    int hardwareInfo     = 0;
                    int badHardwareInfo  = 0;
                    int nullHardwareInfo = 0;
                    foreach (DictionaryEntry de in ClientMon.list)
                    {
                        ArrayList al = de.Value as ArrayList;

                        if (al == null)
                        {
                            continue;
                        }

                        foreach (Account acct in al)
                        {
                            if (acct == null)
                            {
                                continue;                                       // bogus
                            }
                            PlayerMobile pm = GetActiveCharacter(acct);
                            if (pm == null)
                            {
                                continue;                                       // no longer logged in?
                            }
                            NetState ns = pm.NetState;
                            if (ns == null || ns.Address == null || ns.Mobile == null)
                            {
                                continue;                                       // still logging in?
                            }
                            Server.Accounting.Account pmAccount = (Server.Accounting.Account)ns.Account;
                            HardwareInfo pmHWInfo = pmAccount.HardwareInfo;

                            clients++;

                            if (pmHWInfo == null)
                            {
                                nullHardwareInfo++;
                            }
                            else
                            {
                                if (pmHWInfo.CpuClockSpeed == 0 || pmHWInfo.OSMajor == 0)
                                {
                                    badHardwareInfo++;
                                }
                                else
                                {
                                    hardwareInfo++;
                                }
                            }
                        }
                    }

                    e.Mobile.SendMessage(String.Format("{0} total clients, {1} with hardware info", clients, hardwareInfo));
                    e.Mobile.SendMessage(String.Format("{0} with null hardware info, {1} with bad hardware info", nullHardwareInfo, badHardwareInfo));
                }

                if (e.ArgString.Contains("-mc"))
                {
                    bool highOnly = false;
                    if (e.ArgString.Contains("-ho"))
                    {
                        highOnly = true;
                    }

                    foreach (DictionaryEntry de in ClientMon.list)
                    {
                        ArrayList al = de.Value as ArrayList;

                        if (al == null)                                 // bogus
                        {
                            continue;
                        }

                        if (al.Count < 2)                               // no more than 1 account for this IP
                        {
                            continue;
                        }

                        PlayerMobile pm1  = null;
                        PlayerMobile pm2  = null;
                        ArrayList    seen = new ArrayList();
                        foreach (Account acct1 in al)
                        {
                            if (acct1 == null)
                            {
                                continue;                                       // bogus
                            }
                            if (!TestCenter.Enabled && acct1.GetAccessLevel() > AccessLevel.Player)
                            {
                                continue;                                       // ignore staff
                            }
                            pm1 = GetActiveCharacter(acct1);
                            if (pm1 == null)
                            {
                                continue;                                       // logged out maybe?
                            }
                            seen.Add(acct1);

                            foreach (Account acct2 in al)
                            {
                                if (acct2 == null)
                                {
                                    continue;                                           // bogus
                                }
                                if (seen.Contains(acct2))
                                {
                                    continue;                                           // already processed
                                }
                                if (!TestCenter.Enabled && acct2.GetAccessLevel() > AccessLevel.Player)
                                {
                                    continue;                                           // ignore staff
                                }
                                pm2 = GetActiveCharacter(acct2);
                                if (pm2 == null)
                                {
                                    continue;                                           // logged out maybe?
                                }
                                // okay check the hardware and report
                                ProcessMatch(e.Mobile, highOnly, pm1, pm2);
                            }
                        }
                    }
                }

                if (e.ArgString.Contains("-ma"))
                {
                    int clients     = 0;
                    int ipaddresses = 0;
                    foreach (DictionaryEntry de in ClientMon.list)
                    {
                        ArrayList al = de.Value as ArrayList;

                        if (al == null)
                        {
                            continue;
                        }

                        if (al.Count > 1)
                        {
                            clients += al.Count;
                            ipaddresses++;
                        }
                    }

                    if (clients == 0)
                    {
                        e.Mobile.SendMessage("There are no shared IP addresses");
                    }
                    else
                    {
                        e.Mobile.SendMessage(String.Format("There {2} {0} client{3} sharing {1} IP address{4}",
                                                           clients, ipaddresses,
                                                           clients == 1 ? "is" : "are",
                                                           clients == 1 ? "" : "s",
                                                           ipaddresses == 1 ? "" : "es"
                                                           ));
                    }
                }

                if (e.ArgString.Contains("-ui"))
                {
                    e.Mobile.SendMessage(String.Format("There {1} {0} unique IP address{2}",
                                                       ClientMon.list.Count,
                                                       ClientMon.list.Count == 1 ? "is" : "are",
                                                       ClientMon.list.Count == 1 ? "" : "es"
                                                       ));
                }
            }
            catch (Exception ex)
            {
                LogHelper.LogException(ex);
            }

            e.Mobile.SendMessage("done.");
        }
Exemplo n.º 30
0
			public AddCommentPrompt( Account acct )
			{
				m_Account = acct;
			}
Exemplo n.º 31
0
        public static void CPI_Worker(out string s1, out string s2)
        {
            s1 = s2 = "no data";
            try
            {
                //////////////////////////////////////////////
                // Calculate the percentage of players carrying > force magic weapons

                double players       = 0;
                double players_magic = 0;
                foreach (Mobile m in World.Mobiles.Values)
                {
                    if (m is PlayerMobile == false)
                    {
                        continue;
                    }
                    Container backpack = m.Backpack;
                    if (backpack != null)
                    {                       // get players account
                        Server.Accounting.Account ax = m.Account as Server.Accounting.Account;
                        if (ax == null)
                        {
                            continue;
                        }

                        // have they logged in within the last 90 days?
                        TimeSpan delta = DateTime.Now - ax.LastLogin;
                        if (delta.TotalDays > 90)
                        {
                            continue;
                        }

                        // filter for dexxers - get highest weapon skill
                        double sk1   = Math.Max(m.Skills[SkillName.Archery].Base, m.Skills[SkillName.Fencing].Base);
                        double sk2   = Math.Max(m.Skills[SkillName.Macing].Base, m.Skills[SkillName.Swords].Base);
                        double skill = Math.Max(sk1, sk2);
                        if (skill < 100)
                        {
                            continue;
                        }

                        // record all players that have a weapon on them
                        players++;
                        ArrayList stuff     = backpack.FindAllItems();
                        Item      oneHanded = m.FindItemOnLayer(Layer.OneHanded);
                        Item      twoHanded = m.FindItemOnLayer(Layer.TwoHanded);
                        if (oneHanded is BaseWeapon && (oneHanded as BaseWeapon).DamageLevel > WeaponDamageLevel.Force)
                        {
                            stuff.Add(oneHanded);
                        }
                        if (twoHanded is BaseWeapon && (twoHanded as BaseWeapon).DamageLevel > WeaponDamageLevel.Force)
                        {
                            stuff.Add(twoHanded);
                        }

                        // record all the players that have a high end magic weapon on them
                        foreach (Item ix in stuff)
                        {
                            if (ix is BaseWeapon && (ix as BaseWeapon).DamageLevel > WeaponDamageLevel.Force)
                            {                                   // we only count one high end weapon per player
                                players_magic++;
                                break;
                            }
                        }
                    }
                }

                if (players > 0)
                {
                    s1 = String.Format("Of {0} GM dexxers, {1}% are equipping Power or higher.", (int)players, (int)((players_magic / players) * 100));
                }

                //////////////////////////////////////////////
                // Calculate the average cost of > force weapons

                int total_magic = 0;
                int total_value = 0;
                foreach (Mobile m in World.Mobiles.Values)
                {
                    if (m is PlayerVendor)
                    {
                        PlayerVendor pv  = m as PlayerVendor;
                        Hashtable    tab = pv.SellItems;
                        foreach (DictionaryEntry de in tab)
                        {
                            if (de.Value is VendorItem)
                            {
                                if (de.Key is Item)
                                {
                                    Item ix = (de.Key as Item);
                                    if (ix is BaseWeapon && (ix as BaseWeapon).DamageLevel > WeaponDamageLevel.Force)
                                    {
                                        total_magic++;
                                        total_value += (de.Value as VendorItem).Price;
                                    }
                                }
                            }
                        }
                    }
                }

                if (total_magic > 0)
                {
                    s2 = String.Format("Of {0} high end magic weapons, {1} is the average vendor cost.", total_magic, total_value / total_magic);
                }
            }
            catch (Exception err)
            {
                s1 = "Exception: " + err.Message;
            }
        }
Exemplo n.º 32
0
			public AddTagNamePrompt( Account acct )
			{
				m_Account = acct;
			}
Exemplo n.º 33
0
        private static void UpdateAccount(NetState state, PacketReader pvSrc)
        { 
            if (state.Account.AccessLevel < AccessLevel.Administrator)
            {
                state.Send(new MessageBoxMessage("You do not have permission to edit accounts.", "Account Access Exception"));
                return;
            }

            string username = pvSrc.ReadString();
            string pass = pvSrc.ReadString();

            Account a = Accounts.GetAccount(username) as Account;

            if (a != null && !CanAccessAccount(state.Account, a))
            {
                state.Send(new MessageBoxMessage("You cannot edit an account with an access level greater than or equal to your own.", "Account Access Exception"));
            }
            else
            {
                bool CreatedAccount = false;
                bool UpdatedPass = false;
                bool oldbanned = a == null ? false : a.Banned;
                AccessLevel oldAcessLevel = a == null ? 0 : a.AccessLevel;

                if (a == null)
                {
                    a = new Account(username, pass);
                    CreatedAccount = true;
                }
                else if (pass != "(hidden)")
                {
                    a.SetPassword(pass);
                    UpdatedPass = true;
                }

                if (a != state.Account)
                {
                    AccessLevel newAccessLevel = (AccessLevel)pvSrc.ReadByte();
                    if (a.AccessLevel != newAccessLevel)
                    {
                        if (newAccessLevel >= state.Account.AccessLevel)
                            state.Send(new MessageBoxMessage("Warning: You may not set an access level greater than or equal to your own.", "Account Access Level update denied."));
                        else
                            a.AccessLevel = newAccessLevel;
                    }
                    bool newBanned = pvSrc.ReadBoolean();
                    if (newBanned != a.Banned)
                    {
                        oldbanned = a.Banned;
                        a.Banned = newBanned;
                        a.Comments.Add(new AccountComment(state.Account.Username, newBanned ? "Banned via Remote Admin" : "Unbanned via Remote Admin"));
                    }
                }
                else
                {
                    pvSrc.ReadInt16();//skip both
                    state.Send(new MessageBoxMessage("Warning: When editing your own account, Account Status and Access Level cannot be changed.", "Editing Own Account"));
                }

                ArrayList list = new ArrayList();
                ushort length = pvSrc.ReadUInt16();
                bool invalid = false;
                for (int i = 0; i < length; i++)
                {
                    string add = pvSrc.ReadString();
                    if (Utility.IsValidIP(add))
                        list.Add(add);
                    else
                        invalid = true;
                }

                if (list.Count > 0)
                    a.IPRestrictions = (string[])list.ToArray(typeof(string));
                else
                    a.IPRestrictions = new string[0];

                if (invalid)
                    state.Send(new MessageBoxMessage("Warning: one or more of the IP Restrictions you specified was not valid.", "Invalid IP Restriction"));

                if (CreatedAccount)
                    RemoteAdminLogging.WriteLine(state, "Created account {0} with Access Level {1}", a.Username, a.AccessLevel);
                else
                {
                    string changes = string.Empty;
                    if (UpdatedPass)
                        changes += " Password Changed.";
                    if (oldAcessLevel != a.AccessLevel)
                        changes = string.Format("{0} Access level changed from {1} to {2}.", changes, oldAcessLevel, a.AccessLevel);
                    if (oldbanned != a.Banned)
                        changes += a.Banned ? " Banned." : " Unbanned.";
                    RemoteAdminLogging.WriteLine(state, "Updated account {0}:{1}", a.Username, changes);
                }

                state.Send(new MessageBoxMessage("Account updated successfully.", "Account Updated"));
            }
        }
Exemplo n.º 34
0
			public AddTagValuePrompt( Account acct, string name )
			{
				m_Account = acct;
				m_Name = name;
			}