示例#1
0
        /// <summary>
        /// Purges the jailing history
        /// </summary>
        /// <param name="m">The user invoking the history purge</param>
        /// <param name="filter">The purge filter</param>
        public static void PurgeHistory(Mobile m, JailPurge filter)
        {
            List <JailEntry> history = GetHistory();
            List <JailEntry> purged  = new List <JailEntry>();

            foreach (JailEntry jail in history)
            {
                if (filter.PurgeCheck(jail))
                {
                    purged.Add(jail);
                }
            }

            if (purged.Count == 0)
            {
                m.SendMessage("The specified purge found no matches in the history.");
            }
            else
            {
                foreach (JailEntry jail in purged)
                {
                    history.Remove(jail);
                }
            }

            SaveHistory(history);

            // Save the purged file
            if (!Directory.Exists(PurgedFolder))
            {
                Directory.CreateDirectory(PurgedFolder);
            }

            string path = Path.Combine(PurgedFolder, string.Format("{0} Purged by {1}.xml", GetTimeStamp(), m.Name));

            Console.WriteLine("{0} purged {1} jail entries", m.Name, purged.Count);
            m.SendMessage("You have just purged {0} jail entries", purged.Count);

            SaveJailFile(path, purged);
        }
示例#2
0
		/// <summary>
		///     Purges the jailing history
		/// </summary>
		/// <param name="m">The user invoking the history purge</param>
		/// <param name="filter">The purge filter</param>
		public static void PurgeHistory(Mobile m, JailPurge filter)
		{
			if (m == null || filter==null)
			{
				return;
			}

			List<JailEntry> history = GetHistory();
			var purged = history.Where(filter.PurgeCheck).ToList();

			if (purged.Count == 0)
			{
				m.SendMessage("The specified purge found no matches in the history.");
			}
			else
			{
				foreach (JailEntry jail in purged)
				{
					history.Remove(jail);
				}
			}

			SaveHistory(history);

			// Save the purged file
			if (!Directory.Exists(PurgedFolder))
			{
				Directory.CreateDirectory(PurgedFolder);
			}

			string path = Path.Combine(PurgedFolder, string.Format("{0} Purged by {1}.xml", GetTimeStamp(), m.Name));

			Console.WriteLine("{0} purged {1} jail entries", m.Name, purged.Count);
			m.SendMessage("You have just purged {0} jail entries", purged.Count);

			SaveJailFile(path, purged);
		}
示例#3
0
        public override void OnResponse(Server.Network.NetState sender, RelayInfo info)
        {
            // Get information first
            m_Banned  = false;
            m_Deleted = false;
            m_Old     = false;

            foreach (int flag in info.Switches)
            {
                switch (flag)
                {
                case 0:                         // Banned
                    m_Banned = true;
                    break;

                case 1:                         // Deleted
                    m_Deleted = true;
                    break;

                case 2:                         // Old
                    m_Old = true;
                    break;
                }
            }

            TextRelay text = info.GetTextEntry(1);

            if (text != null && !String.IsNullOrEmpty(text.Text))
            {
                int months = Utility.ToInt32(info.GetTextEntry(1).Text);
                if (months > 0 && months <= 12)
                {
                    m_Months = months;
                }
            }

            switch (info.ButtonID)
            {
            case 1:                     // View History
            {
                List <JailEntry> history = JailSystem.GetFullHistory();

                if (history.Count > 0)
                {
                    sender.Mobile.SendGump(new JailListingGump(sender.Mobile, JailSystem.GetFullHistory(), new JailGumpCallback(JailAdminGumpCallback)));
                }
                else
                {
                    sender.Mobile.SendMessage("The history is empty");
                    sender.Mobile.SendGump(new JailAdminGump(sender.Mobile, m_Banned, m_Deleted, m_Old, m_Months));
                }
                break;
            }

            case 2:                     // Search for players
            case 3:                     // Search for accounts
            {
                text = info.GetTextEntry(0);
                if (text != null && !String.IsNullOrEmpty(text.Text))
                {
                    List <Mobile>  mobmatches = new List <Mobile>();
                    List <Account> accmatches = new List <Account>();

                    if (info.ButtonID == 2)
                    {
                        mobmatches = JailSystem.SearchForPlayers(text.Text);
                    }
                    else
                    {
                        accmatches = JailSystem.SearchForAccounts(text.Text);
                    }

                    if (mobmatches.Count > 0 || accmatches.Count > 0)
                    {
                        sender.Mobile.SendGump(new JailSearchGump(mobmatches, accmatches, sender.Mobile, new JailGumpCallback(JailAdminGumpCallback)));
                    }
                    else
                    {
                        sender.Mobile.SendMessage("No matches found");
                        sender.Mobile.SendGump(new JailAdminGump(sender.Mobile, m_Banned, m_Deleted, m_Old, m_Months));
                    }
                }
                else
                {
                    sender.Mobile.SendMessage("Invalid search");
                    sender.Mobile.SendGump(new JailAdminGump(sender.Mobile, m_Banned, m_Deleted, m_Old, m_Months));
                }
                break;
            }

            case 4:                     // Purge
            {
                if (!(m_Deleted || m_Banned || m_Old))
                {
                    sender.Mobile.SendMessage("Invalid purge options. Please correct and try again.");
                    sender.Mobile.SendGump(new JailAdminGump(sender.Mobile, m_Banned, m_Deleted, m_Old, m_Months));
                }
                else
                {
                    JailPurge purge = new JailPurge(m_Banned, m_Deleted, m_Old, m_Months);
                    JailSystem.PurgeHistory(sender.Mobile, purge);
                    sender.Mobile.SendGump(new JailAdminGump(sender.Mobile));
                }
                break;
            }

            case 5:                     // View Jail
            {
                sender.Mobile.SendGump(new JailListingGump(sender.Mobile, JailSystem.Jailings, new JailGumpCallback(JailAdminGumpCallback)));
                break;
            }
            }
        }
示例#4
0
		public override void OnResponse(Server.Network.NetState sender, RelayInfo info)
		{
			// Get information first
			m_Banned = false;
			m_Deleted = false;
			m_Old = false;

			foreach( int flag in info.Switches )
			{
				switch ( flag )
				{
					case 0: // Banned
						m_Banned = true;
						break;
					case 1: // Deleted
						m_Deleted = true;
						break;
					case 2: // Old
						m_Old = true;
						break;
				}
			}

			TextRelay text = info.GetTextEntry( 1 );
			if ( text != null && !String.IsNullOrEmpty( text.Text ) )
			{
				int months = Utility.ToInt32( info.GetTextEntry( 1 ).Text );
				if ( months > 0 && months <= 12 )
					m_Months = months;
			}

			switch ( info.ButtonID )
			{
				case 1: // View History
				{
					List<JailEntry> history = JailSystem.GetFullHistory();

					if ( history.Count > 0 )
					{
						sender.Mobile.SendGump( new JailListingGump( sender.Mobile, JailSystem.GetFullHistory(), new JailGumpCallback( JailAdminGumpCallback ) ) );
					}
					else
					{
						sender.Mobile.SendMessage( "The history is empty" );
						sender.Mobile.SendGump( new JailAdminGump( sender.Mobile, m_Banned, m_Deleted, m_Old, m_Months ) );
					}
					break;
				}
				case 2: // Search for players
				case 3: // Search for accounts
				{
					text = info.GetTextEntry( 0 );
					if ( text != null && !String.IsNullOrEmpty( text.Text ) )
					{
						List<PlayerMobile> mobmatches = new List<PlayerMobile>();
						List<Account> accmatches = new List<Account>();

						if ( info.ButtonID == 2 )
							mobmatches = JailSystem.SearchForPlayers( text.Text );
						else
							accmatches = JailSystem.SearchForAccounts( text.Text );

						if ( mobmatches.Count > 0 || accmatches.Count > 0 )
							sender.Mobile.SendGump( new JailSearchGump( mobmatches, accmatches, sender.Mobile, new JailGumpCallback( JailAdminGumpCallback ) ) );
						else
						{
							sender.Mobile.SendMessage( "No matches found" );
							sender.Mobile.SendGump( new JailAdminGump( sender.Mobile, m_Banned, m_Deleted, m_Old, m_Months ) );
						}
					}
					else
					{
						sender.Mobile.SendMessage( "Invalid search" );
						sender.Mobile.SendGump( new JailAdminGump( sender.Mobile, m_Banned, m_Deleted, m_Old, m_Months ) );
					}
					break;
				}
				case 4: // Purge
				{
					if ( ! ( m_Deleted || m_Banned || m_Old ) )
					{
						sender.Mobile.SendMessage( "Invalid purge options. Please correct and try again." );
						sender.Mobile.SendGump( new JailAdminGump( sender.Mobile, m_Banned, m_Deleted, m_Old, m_Months ) );
					}
					else
					{
						JailPurge purge = new JailPurge( m_Banned, m_Deleted, m_Old, m_Months );
						JailSystem.PurgeHistory( sender.Mobile, purge );
						sender.Mobile.SendGump( new JailAdminGump( sender.Mobile ) );
					}
					break;
				}
				case 5: // View Jail
				{
					sender.Mobile.SendGump( new JailListingGump( sender.Mobile, JailSystem.Jailings, new JailGumpCallback( JailAdminGumpCallback ) ) );
					break;
				}
			}
		}
        public override void OnResponse(Server.Network.NetState sender, RelayInfo info)
        {
            // Get information first
            m_Banned = false;
            m_Deleted = false;
            m_Old = false;

            foreach( int flag in info.Switches )
            {
                switch ( flag )
                {
                    case 0: // Banned
                        m_Banned = true;
                        break;
                    case 1: // Deleted
                        m_Deleted = true;
                        break;
                    case 2: // Old
                        m_Old = true;
                        break;
                }
            }

            uint months = 0;
            try
            {
                months = uint.Parse( info.TextEntries[ 1 ].Text );
            }
            catch{}
            finally
            {
                if ( months > 0 )
                {
                    m_Months = (int) months;
                }
            }

            string lookup = null;

            if ( info.TextEntries[ 0 ].Text != null )
            {
                lookup = info.TextEntries[ 0 ].Text;
            }

            switch ( info.ButtonID )
            {
                case 1: // View History

                    ArrayList history = JailSystem.GetFullHistory();

                    if ( history.Count > 0 )
                    {
                        sender.Mobile.SendGump( new JailListingGump( sender.Mobile, JailSystem.GetFullHistory(), new JailGumpCallback( JailAdminGumpCallback ) ) );
                    }
                    else
                    {
                        sender.Mobile.SendMessage( "The history is empty" );
                        sender.Mobile.SendGump( new JailAdminGump( sender.Mobile, m_Banned, m_Deleted, m_Old, m_Months ) );
                    }
                    break;

                case 2: // Search for players
                case 3: // Search for accounts

                    if ( lookup != null && lookup.Length > 0 )
                    {
                        ArrayList matches = null;

                        if ( info.ButtonID == 2 )
                        {
                            matches = JailSystem.SearchForPlayers( lookup );
                        }
                        else
                        {
                            matches = JailSystem.SearchForAccounts( lookup );
                        }

                        if ( matches != null && matches.Count > 0 )
                        {
                            sender.Mobile.SendGump( new JailSearchGump( matches, sender.Mobile, new JailGumpCallback( JailAdminGumpCallback ) ) );
                        }
                        else
                        {
                            sender.Mobile.SendMessage( "No matches found" );
                            sender.Mobile.SendGump( new JailAdminGump( sender.Mobile, m_Banned, m_Deleted, m_Old, m_Months ) );
                        }
                    }
                    else
                    {
                        sender.Mobile.SendMessage( "Invalid search" );
                        sender.Mobile.SendGump( new JailAdminGump( sender.Mobile, m_Banned, m_Deleted, m_Old, m_Months ) );
                    }
                    break;

                case 4: // Purge

                    if ( ! ( m_Deleted || m_Banned || m_Old ) )
                    {
                        sender.Mobile.SendMessage( "Invalid purge options. Please correct and try again." );
                        sender.Mobile.SendGump( new JailAdminGump( sender.Mobile, m_Banned, m_Deleted, m_Old, m_Months ) );
                    }
                    else
                    {
                        JailPurge purge = new JailPurge( m_Banned, m_Deleted, m_Old, m_Months );
                        JailSystem.PurgeHistory( sender.Mobile, purge );
                        sender.Mobile.SendGump( new JailAdminGump( sender.Mobile ) );
                    }
                    break;

                case 5: // View Jail

                    sender.Mobile.SendGump( new JailListingGump( sender.Mobile, JailSystem.Jailings, new JailGumpCallback( JailAdminGumpCallback ) ) );
                    break;
            }
        }
        /// <summary>
        /// Purges the jailing history
        /// </summary>
        /// <param name="m">The user invoking the history purge</param>
        /// <param name="filter">The purge filter</param>
        public static void PurgeHistory( Mobile m, JailPurge filter )
        {
            ArrayList history = GetHistory();
            ArrayList purged = new ArrayList();

            foreach( JailEntry jail in history )
            {
                if ( filter.PurgeCheck( jail ) )
                {
                    purged.Add( jail );
                }
            }

            if ( purged.Count == 0 )
            {
                m.SendMessage( "The specified purge found no matches in the history." );
                return;
            }

            foreach( JailEntry jail in purged )
            {
                history.Remove( jail );
            }

            SaveHistory( history );

            // Save the purged file
            if ( ! Directory.Exists( PurgedFolder ) )
                Directory.CreateDirectory( PurgedFolder );

            string path = Path.Combine( PurgedFolder, string.Format( "{0} Purged by {1}.xml", GetTimeStamp(), m.Name ) );

            Console.WriteLine( "{0} purged {1} jail entries", m.Name, purged.Count );
            m.SendMessage( "You have just purged {0} jail entries", purged.Count );

            SaveJailFile( path, purged );
        }