View Single Post
Old 04-27-2006, 01:12 PM   #1 (permalink)
ArteGordon
Master of the Internet
 
Join Date: Aug 2003
Posts: 5,688
Default fix for ClientVersion errors

The following is a fix for ClientVersion that incorrectly parses some client version strings, such as the recent '5.0.2' version.

just replace the ClientVersion constructor around line 240 in ClientVersion.cs with the following

Code:
		public ClientVersion( string fmt )
		{
			m_SourceString = fmt;

			try
			{
				//Format: Major.Minor.Revision[Patch] [Type]
				//Exmple: 4.0.10a UO3D
				fmt = fmt.ToLower();

				string[] fmts = fmt.Split( new char[] {'.'}, 3 );
				string patch = fmts[2];

				int letter_index;
				for( letter_index = 0; letter_index < patch.Length; letter_index++ )
					if ( !Char.IsNumber( patch[letter_index] ) )
						break;

				m_Major = int.Parse( fmts[0] );
				m_Minor = int.Parse( fmts[1] );
				m_Revision = int.Parse(patch.Substring(0, letter_index));

				if (letter_index < patch.Length && Char.IsLetter(patch[letter_index]))
					m_Patch = (patch[letter_index] - 'a') + 1;
				else
					m_Patch = 0;

				if ( patch.IndexOf( "god" ) >= 0 || patch.IndexOf( "gq" ) >= 0 )
					m_Type = ClientType.God;
				else if ( patch.IndexOf( "third dawn" ) >= 0 || patch.IndexOf( "uo:td" ) >= 0 || patch.IndexOf( "uotd" ) >= 0 || patch.IndexOf( "uo3d" ) >= 0 || patch.IndexOf( "uo:3d" ) >= 0 )
					m_Type = ClientType.UOTD;
				else
					m_Type = ClientType.Regular;
			}
			catch
			{
				m_Major = 0;
				m_Minor = 0;
				m_Revision = 0;
				m_Patch = 0;
				m_Type = ClientType.Regular;
			}
		}
The above is a core modification and requires access to the RunUO-1.0.0 source files and the ability to recompile the server.

I have also attached a fix that can be used instead of making this core mod. Just drop the script into your custom script area. This is NOT a core modification and does not require access to the RunUO sources.

If you made the core mod, then you dont need the script. If you used the script then you dont need the core mod. If you did both, that's not a problem either.
Attached Files
File Type: cs clientversionfix.cs (4.5 KB, 555 views)
__________________
The first line of the first rule in the forum rules and guidelines "Be respectful of others. "

For questions, information, and support for XmlSpawner and its addons, visit the
XmlSpawner Support Forum

Last edited by ArteGordon; 05-01-2006 at 06:33 AM.
ArteGordon is offline   Reply With Quote