RunUO Community

This is a sample guest message. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

ClientVersion fix

floppydisc

Sorceror
ClientVersion fix

As of the new UO client update, the version string now contains more than just one digit as revision. This means, that the current ClientVersion constructor parses the version string (4.0.10) and just reads this as "4.0.1".
I wrote a fix for this. This is the new constructor for the ClientVersion object (found in ClientVersion.cs)

Code:
		public ClientVersion( string fmt )
 		{
 			m_SourceString = fmt;
 
 			try
 			{
 				fmt = fmt.ToLower();
 
 				string[] version = fmt.Split( new char[] {'.'}, 3 );
 
 				m_Patch = 0;
 				for ( int i = 0; i < version[2].Length; i++ )
 				{
 		    		if ( Char.IsLetter( version[2][i] ) )
 					{
 		    			m_Patch = ( version[2][i] - 'a' ) + 1;
 		    			version[2] = version[2].Remove( i, version[2].Length - i );
 						break;
 					}
 				}
 
 				m_Major = int.Parse( version[0] );
 				m_Minor = int.Parse( version[1] );
 				m_Revision = int.Parse( version[2] );
 
 		    	if ( fmt.IndexOf( "god" ) >= 0 || fmt.IndexOf( "gq" ) >= 0 )
 					m_Type = ClientType.God;
 		    	else if ( fmt.IndexOf( "third dawn" ) >= 0 || fmt.IndexOf( "uo:td" ) >= 0 || fmt.IndexOf( "uotd" ) >= 0 || fmt.IndexOf( "uo3d" ) >= 0 || fmt.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;
 			}
 		}
 

Talrol

Wanderer
This is a core code modification, not part of the regular distribution....I wouldn't recommend making changes such as this unless you know what you're doing and of course have a good compiler.

I'm not sure why you're having problems with characters not being able to move when they die, I have no such problems on my shard at all. Perhaps you could ask in Server Support or Script Support?
 

Tannis

Knight
It's not only habitat, it's everyone on 2 shards I work on, and those people are the only ones with the new patch. They've died in custom map areas, Ilshenar areas, and it's all the same. As soon as you try to move as a ghost it will spawn up your screen that you're frozen and can't do that.
 

Kamron

Knight
Are you sure thats because of this script and not because of the client update itself? I haven't taken a look at the script yet, so don't bash me if I am wrong... just food for thought.
 

Tannis

Knight
I don't think the script would fix it either, now that I know it's a custom map problem. I figured since people were dying in Ilshenar, and that the area was still as OSI has it, it wouldn't matter what kind of map it is, but I guess it only happens on customs.
 

habitat85

Wanderer
Im guessing its having the 0kb .diff files for custom map to remove the chunks of land from OSI but OSI hasnt patched any map files if you look in the patchlog file only thing they changed with 4.0.10a is the gump files, art files, and clioc files. Im stumped why its doing this but its super annoying babysitting people so they can get ressed.
 

Kamron

Knight
This is my version of the Client Fix... I believe my code is faster and more effecient

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 ( 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;
			}
		}
 

Kamron

Knight
I don't believe so... because thats a client thing, not a server thing....

Basically what happens is you take
4.0.9q for example, and it changes it to
Major = 4
Minor = 0
Revision = 9
Patch = q

with the fix, for example, it changes 4.0.10a to
Major = 4
Minor = 0
Revision = 10
Patch = a

as apposed to
Major = 4
Minor = 0
Revision = 1
Patch = (garbage)
 

Kamron

Knight
There was a problem with my code which I forgot to put up.... Please refer to my post above which now as the correct code.
 

jaynigs

Wanderer
XxSP1DERxX said:
There was a problem with my code which I forgot to put up.... Please refer to my post above which now as the correct code.

Would that be relating to the client version showing as 0.0.0? :D
 

cuy782002

Wanderer
ok so how do i attact this.............................

using System;
using Server;

namespace Server.Misc
{
public class ClientVerification
{
public static void Initialize()
{
ClientVersion.Required = null;
//ClientVersion.Required = new ClientVersion( "1.0.8q" );

ClientVersion.AllowGod = false;
ClientVersion.AllowUOTD = true;
ClientVersion.AllowRegular = true;

ClientVersion.KickDelay = TimeSpan.FromSeconds( 1.0 );
}
}
}



with yours...............................................



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 ( 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;
}
}
--------------------------------------------------------------------------------
 
Top