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!

fix for ClientVersion errors

ArteGordon

Wanderer
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.
 

Attachments

  • clientversionfix.cs
    4.5 KB · Views: 561

Solbehlas

Wanderer
Thank you all so much for finding an immediate fix to this situation from OSI. You all are so talented to be on the ball so quickly. I still got a lot to learn still and I would have been lost trying to figure what to do. I learn so much from expeirenced scripters. I am glad the the community can thrive and be as one.

Thanks again!

Solbehlas,

Simplyuso
 

haazen

Sorceror
I feel extremely stupid now. I have searched and found nothing like this to change in the Core files. This is the closest thing I have found in the core ClientVersion.cs

m_Revision = int.Parse( fmt[4].ToString() );

if ( fmt.Length >= 6 && Char.IsWhiteSpace( fmt[5] ) )
m_Patch = 0;
else
m_Patch = (fmt[5] - 'a') + 1;

What am I doing wrong? I know it's me. I have never not found exactly what Arte Grodon tells us to do.
 

ArteGordon

Wanderer
it looks like you already have a modified ClientVersion. The core patch that I posted isnt going to be much help for you since it is based on an unmodded core.

You could still use the drop-in script that replaces the default clientversion packet handler, but then whatever mods you have made to your current ClientVersion constructor will end up being ignored.
 

haazen

Sorceror
Thanks Arte Gordon. The drop in script works great.


fyi I just downloaded the core zip file again and my script is the same as the download.
 

ArteGordon

Wanderer
ah, I just checked and you are correct. The code I posted also reflects an earlier mod to deal with the problem with 2 digit revisions that came up a while back in 4.0.10a

I will modify the posted core mod to reflect that. Sorry.
 

Sender

Wanderer
ArteGordon said:
ah, I just checked and you are correct. The code I posted also reflects an earlier mod to deal with the problem with 2 digit revisions that came up a while back in 4.0.10a

I will modify the posted core mod to reflect that. Sorry.
Yes. Problem with numbers (not only for revision) exist.
Version string must be parsed dynamically.
Please see my solution for this problem.
Can be parsed below types of versions:
5 (Major=5; Minor=0; Revision=0; Patch = 0)
5a (Major=5; Minor=0; Revision=0; Patch = 1)
5.2a (Major=5; Minor=2; Revision=0; Patch = 1)
5.0.1j (Major=5; Minor=0; Revision=1; Patch = 10)
5.0.2 (Major=5; Minor=0; Revision=2; Patch = 0)
10.1.2 (Major=10; Minor=1; Revision=2; Patch = 0)
1234567.1234567.1234567z (Major=1234567; Minor=1234567; Revision=1234567; Patch = 26)

I used Finite State Machine methodology. Usually this technique used in systems programming (compilers, interpreters, regular expressions and others).
 
hi there, i have tryout looking for ClientVersion.cs and ive used agent ransack, and nothing in my runuo folder. the closes ive got is ClientVerification

any help where this is. thanks.
 

ArteGordon

Wanderer
WonderlandADnc said:
ok that sounds ok. but what if i want to have it back as it was.!
I dont know exactly what you mean but if you remove the script that I attached then it will be back to the way it was unless you changed something else.
 
Top