Go Back   RunUO - Ultima Online Emulation > RunUO > Server Support on Windows

Server Support on Windows Get (and give) support on general questions related to the RunUO server itself.

Reply
 
Thread Tools Display Modes
Old 09-08-2007, 09:20 PM   #1 (permalink)
Newbie
 
Join Date: Sep 2006
Age: 23
Posts: 19
Question ClientVerification.cs

I updated to the newest SVN and had a few minor issues, most of which I could fix myself, but I'm now stuck on 1 error.

Code:
Errors:
 + Misc/ClientVerification.cs:
     CS0246: Line 123: The type or namespace name 'ClientVersionReceivedArgs' could not be found (are you missing a using directive or an assembly reference?)
ClientVerification.cs with line 123 in red:
Code:
using System;
using Server;
using System.Diagnostics;
using System.IO;
using Server.Network;
using Server.Gumps;
using Server.Mobiles;

namespace Server.Misc
{
	public class ClientVerification
	{
		private enum OldClientResponse
		{
			Ignore,
			Warn,
			Annoy,
			LenientKick,
			Kick
		}

		private static bool m_DetectClientRequirement = true;
		private static OldClientResponse m_OldClientResponse = OldClientResponse.LenientKick;

		private static ClientVersion m_Required;
		private static bool m_AllowRegular = true, m_AllowUOTD = true, m_AllowGod = true;

		private static TimeSpan m_AgeLeniency = TimeSpan.FromDays( 10 );
		private static TimeSpan m_GameTimeLeniency = TimeSpan.FromHours( 25 );

		private static TimeSpan m_KickDelay = TimeSpan.FromSeconds( 20.0 );

		public static ClientVersion Required
		{
			get
			{
				return m_Required;
			}
			set
			{
				m_Required = value;
			}
		}

		public static bool AllowRegular
		{
			get
			{
				return m_AllowRegular;
			}
			set
			{
				m_AllowRegular = value;
			}
		}

		public static bool AllowUOTD
		{
			get
			{
				return m_AllowUOTD;
			}
			set
			{
				m_AllowUOTD = value;
			}
		}

		public static bool AllowGod
		{
			get
			{
				return m_AllowGod;
			}
			set
			{
				m_AllowGod = value;
			}
		}

		public static TimeSpan KickDelay
		{
			get
			{
				return m_KickDelay;
			}
			set
			{
				m_KickDelay = value;
			}
		}

		public static void Initialize()
		{
			EventSink.ClientVersionReceived += new ClientVersionReceivedHandler( EventSink_ClientVersionReceived );

			//ClientVersion.Required = null;
			//Required = new ClientVersion( "6.0.0.0" );

			if( m_DetectClientRequirement )
			{
				string path = Core.FindDataFile( "client.exe" );

				if( File.Exists( path ) )
				{
					FileVersionInfo info = FileVersionInfo.GetVersionInfo( path );

					if ( info.FileMajorPart != 0 || info.FileMinorPart != 0 || info.FileBuildPart != 0 || info.FilePrivatePart != 0 )
					{
						Required = new ClientVersion( info.FileMajorPart, info.FileMinorPart, info.FileBuildPart, info.FilePrivatePart );
					}
				}
			}

			if( Required != null )
			{
				Utility.PushColor( ConsoleColor.White );
				Console.WriteLine( "Restricting client version to {0}. Action to be taken: {1}", Required, m_OldClientResponse );
				Utility.PopColor();
			}
		}

        private static void EventSink_ClientVersionReceived(ClientVersionReceivedArgs e)
        {
            string kickMessage = null;
            NetState state = e.State;
            ClientVersion version = e.Version;

            if (Required != null && version < Required && (m_OldClientResponse == OldClientResponse.Kick || (m_OldClientResponse == OldClientResponse.LenientKick && (DateTime.Now - state.Mobile.CreationTime) > m_AgeLeniency && state.Mobile is PlayerMobile && ((PlayerMobile)state.Mobile).GameTime > m_GameTimeLeniency)))
            {
                kickMessage = String.Format("This server requires your client version be at least {0}.", Required);
            }
            else if (!AllowGod || !AllowRegular || !AllowUOTD)
            {
                if (!AllowGod && version.Type == ClientType.God)
                    kickMessage = "This server does not allow god clients to connect.";
                else if (!AllowRegular && version.Type == ClientType.Regular)
                    kickMessage = "This server does not allow regular clients to connect.";
                else if (!AllowUOTD && state.IsUOTDClient)
                    kickMessage = "This server does not allow UO:TD clients to connect.";

                if (!AllowGod && !AllowRegular && !AllowUOTD)
                {
                    kickMessage = "This server does not allow any clients to connect.";
                }
                else if (AllowGod && !AllowRegular && !AllowUOTD && version.Type != ClientType.God)
                {
                    kickMessage = "This server requires you to use the god client.";
                }
                else if (kickMessage != null)
                {
                    if (AllowRegular && AllowUOTD)
                        kickMessage += " You can use regular or UO:TD clients.";
                    else if (AllowRegular)
                        kickMessage += " You can use regular clients.";
                    else if (AllowUOTD)
                        kickMessage += " You can use UO:TD clients.";
                }
            }

            if (kickMessage != null)
            {
                state.Mobile.SendMessage(0x22, kickMessage);
                state.Mobile.SendMessage(0x22, "You will be disconnected in {0} seconds.", KickDelay.TotalSeconds);

                Timer.DelayCall(KickDelay, delegate
                {
                    if (state.Socket != null)
                    {
                        Console.WriteLine("Client: {0}: Disconnecting, bad version", state);
                        state.Dispose();
                    }
                });
            }
            else if (Required != null && version < Required)
            {
                switch (m_OldClientResponse)
                {
                    case OldClientResponse.Warn:
                        {
                            state.Mobile.SendMessage(0x22, "Your client is out of date. Please update your client.", Required);
                            state.Mobile.SendMessage(0x22, "This server reccomends that your client version be at least {0}.", Required);
                            break;
                        }
                    case OldClientResponse.LenientKick:
                    case OldClientResponse.Annoy:
                        {
                            SendAnnoyGump(state.Mobile);
                            break;
                        }
                }
            }
        }

		private static void SendAnnoyGump( Mobile m )
		{
			if( m.NetState != null && m.NetState.Version < Required )
			{
				Gump g = new WarningGump( 1060637, 30720, String.Format( "Your client is out of date. Please update your client.<br>This server recommends that your client version be at least {0}.<br> <br>You are currently using version {1}.<br> <br>To patch, run UOPatch.exe inside your Ultima Online folder.", Required, m.NetState.Version ), 0xFFC000, 480, 360,
					delegate( Mobile mob, bool selection, object o )
					{
						m.SendMessage( "You will be reminded of this again." );

						if ( m_OldClientResponse == OldClientResponse.LenientKick )
							m.SendMessage( "Old clients will be kicked after {0} days of character age and {1} hours of play time", m_AgeLeniency, m_GameTimeLeniency );

						Timer.DelayCall( TimeSpan.FromMinutes( Utility.Random( 5, 15 ) ), delegate { SendAnnoyGump( m ); } );
					}, null, false );

				g.Dragable = false;
                g.Closable = false;
                g.Resizable = false;

				m.SendGump( g );
			}
		}
	}
}
The only thread I found that listed the 'ClientVersionReceivedArgs' said that the 'ei' needed to be flipped around which I tried with no luck.
Ideas?
twizfire is offline   Reply With Quote
Old 09-08-2007, 09:49 PM   #2 (permalink)
Forum Administrator
 
Join Date: Jan 2003
Location: Northern Virginia
Posts: 1,548
Default

Your core has to be updated as well.
Mark is offline   Reply With Quote
Old 09-09-2007, 10:55 AM   #3 (permalink)
Newbie
 
Join Date: Sep 2006
Age: 23
Posts: 19
Thumbs up

Well duh...I knew that. I was just testing you...
Thanks.
twizfire is offline   Reply With Quote
Old 09-11-2007, 09:51 PM   #4 (permalink)
Forum Novice
 
Join Date: Jan 2006
Posts: 317
Default Do you mean just switch this script out?

I checked out and recompiled server added the newly compiled server core to my shard and got same error. Do I just switch out client verification.cs with the new one? (from SVN 238)? In Scripts/Misc in my old scripts?

Last edited by mitty; 09-11-2007 at 10:07 PM.
mitty is offline   Reply With Quote
Old 09-13-2007, 01:19 AM   #5 (permalink)
Newbie
 
Join Date: Jun 2006
Posts: 45
Default

I met same problem. Any ideas? Thanks.
wchen18 is offline   Reply With Quote
Old 09-14-2007, 03:28 PM   #6 (permalink)
Forum Novice
 
neuton's Avatar
 
Join Date: Oct 2006
Location: Westchester County, NY
Posts: 113
Send a message via ICQ to neuton Send a message via MSN to neuton Send a message via Yahoo to neuton
Default

Mark: when you say the core needs to be updated...upto where does it need to be to work with this clientverification? I just updated to 6.0.0.0 and still get the error? Thank you for any help you can provide
neuton is offline   Reply With Quote
Old 09-14-2007, 03:41 PM   #7 (permalink)
Forum Novice
 
Join Date: Aug 2005
Location: Italy (Piemonte)
Age: 20
Posts: 210
Send a message via ICQ to Smjert Send a message via MSN to Smjert
Default

Quote:
Originally Posted by neuton View Post
Mark: when you say the core needs to be updated...upto where does it need to be to work with this clientverification? I just updated to 6.0.0.0 and still get the error? Thank you for any help you can provide
That is not the core... is a different thing.. it's the client (the game) XD
You have to update the suorces of the RunUo Server.
Smjert is offline   Reply With Quote
Old 09-14-2007, 03:45 PM   #8 (permalink)
Forum Novice
 
neuton's Avatar
 
Join Date: Oct 2006
Location: Westchester County, NY
Posts: 113
Send a message via ICQ to neuton Send a message via MSN to neuton Send a message via Yahoo to neuton
Default

lol ahh sorry for the mistake, but I got the latest svn last night? should I revert to an older svn or is there a change I need to do?
neuton is offline   Reply With Quote
Old 09-14-2007, 08:53 PM   #9 (permalink)
Newbie
 
Join Date: Sep 2006
Age: 23
Posts: 19
Smile

go HERE to learn how to update your core. I don't think I could explain it any better than this does.
twizfire is offline   Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off



Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0 RC5