Go Back   RunUO - Ultima Online Emulation > RunUO > Core Modifications > Network Modifications

Network Modifications This forum is for modifications to the networking code of RunUO

Reply
 
Thread Tools Display Modes
Old 03-04-2006, 08:20 AM   #1 (permalink)
Forum Expert
 
jaynigs's Avatar
 
Join Date: Mar 2003
Location: England
Age: 35
Posts: 986
Default Network.Flags

Ive been trying for the last 2 hours to change the supported features within the core dependant on the client expansion.. The problem i face is that the Network.Flags are not set until the player logs in with a character, so i cannot seem to test if the player uses Mondains Legacy etc at server login...


i have Highlighted in bold where the Netstate flags are set.


PacketHandlers.cs
Code:
	public static void PlayCharacter( NetState state, PacketReader pvSrc )
		{
			pvSrc.ReadInt32(); // 0xEDEDEDED

			string name = pvSrc.ReadString( 30 );

			pvSrc.Seek( 2, SeekOrigin.Current );
			int flags = pvSrc.ReadInt32();
			pvSrc.Seek( 24, SeekOrigin.Current );

			int charSlot = pvSrc.ReadInt32();
			int clientIP = pvSrc.ReadInt32();

			IAccount a = state.Account;

			if ( a == null || charSlot < 0 || charSlot >= a.Length )
			{
				state.Dispose();
			}
			else
			{
				Mobile m = a[charSlot];

				// Check if anyone is using this account
				for ( int i = 0; i < a.Length; ++i )
				{
					Mobile check = a[i];

					if ( check != null && check.Map != Map.Internal && check != m )
					{
						Console.WriteLine( "Login: {0}: Account in use", state );
						state.Send( new PopupMessage( PMMessage.CharInWorld ) );
						return;
					}
				}

				if ( m == null )
				{
					state.Dispose();
				}
				else
				{
					if ( m.NetState != null )
						m.NetState.Dispose();

					NetState.ProcessDisposedQueue();

					state.BlockAllPackets = true;

					state.Flags = flags;


and this is where i need them..


PacketHandlers.cs
Code:
		public static void GameLogin( NetState state, PacketReader pvSrc )
		{
			if ( state.SentFirstPacket )
			{
				state.Dispose();
				return;
			}

			state.SentFirstPacket = true;

			int authID = pvSrc.ReadInt32();

			if ( !IsValidAuthID( authID ) )
			{
				Console.WriteLine( "Login: {0}: Invalid client detected, disconnecting", state );
				state.Dispose();
				return;
			}
			else if ( state.m_AuthID != 0 && authID != state.m_AuthID )
			{
				Console.WriteLine( "Login: {0}: Invalid client detected, disconnecting", state );
				state.Dispose();
				return;
			}
			else if ( state.m_AuthID == 0 && authID != state.m_Seed )
			{
				Console.WriteLine( "Login: {0}: Invalid client detected, disconnecting", state );
				state.Dispose();
				return;
			}

			string username = pvSrc.ReadString( 30 );
			string password = pvSrc.ReadString( 30 );


			int flags = pvSrc.ReadInt32();


			GameLoginEventArgs e = new GameLoginEventArgs( state, username, password );

			EventSink.InvokeGameLogin( e );

			if ( e.Accepted )
			{
				state.CityInfo = e.CityInfo;
				state.CompressionEnabled = true;


				if ( Core.AOS )
					state.Send( SupportedFeatures.Instantiate( state.Account, flags ) );

				state.Send( new CharacterList( state.Account, state.CityInfo ) );
			}
			else
			{
				state.Dispose();
			}
		}

Since Ea/Osi use this ability, there must be some packet info i could use to set the Netstate.Flags earlier. Or, another way to detect the expansion type from ClientVersion info?

Thanks for reading

jay
jaynigs is offline   Reply With Quote
Old 03-04-2006, 08:38 AM   #2 (permalink)
Forum Expert
 
jaynigs's Avatar
 
Join Date: Mar 2003
Location: England
Age: 35
Posts: 986
Default

Quote:
Originally Posted by Seanchen.net
They don't use packets, to do what you want to do.

They handle it via their account system.
Thanks for reply.

Yes and no, the accounts are tagged with what version you are permitted to use, but if you dont update your client, you cannot create an elf for example.
jaynigs is offline   Reply With Quote
Old 03-04-2006, 12:38 PM   #3 (permalink)
Forum Expert
 
jaynigs's Avatar
 
Join Date: Mar 2003
Location: England
Age: 35
Posts: 986
Default

Thanks again for the reply.

It seems the packet being read by these 2 methods are different packets..

Packet 0x5D is PlayCharacter
Packet 0x91 is GameLogin
jaynigs is offline   Reply With Quote
Old 03-04-2006, 03:12 PM   #4 (permalink)
Forum Expert
 
jaynigs's Avatar
 
Join Date: Mar 2003
Location: England
Age: 35
Posts: 986
Default

After some experiments, they arent the same packet info, gamelogin packet contains only authID and user name and pass strings, i could find no such info in this packet pertaining to client expansion type, or any other client info at all for that matter.
jaynigs is offline   Reply With Quote
Old 03-04-2006, 11:03 PM   #5 (permalink)
Forum Expert
 
mordero's Avatar
 
Join Date: Nov 2003
Location: Illinois, USA
Age: 22
Posts: 2,911
Default

Quote:
Originally Posted by jaynigs
After some experiments, they arent the same packet info, gamelogin packet contains only authID and user name and pass strings, i could find no such info in this packet pertaining to client expansion type, or any other client info at all for that matter.
This might help determine whats in the packets...

http://kec.cz/tartaros/steamengine/u...tml?style=gold
mordero is offline   Reply With Quote
Old 03-05-2006, 07:14 AM   #6 (permalink)
Forum Expert
 
jaynigs's Avatar
 
Join Date: Mar 2003
Location: England
Age: 35
Posts: 986
Default

Quote:
Originally Posted by Seanchen.net
I disagree...

if ( Core.AOS )
state.Send( SupportedFeatures.Instantiate( state.Account, flags ) );


I still believe the flags which is based on the client, is the same information.

Ah, i may be to blame there, my apologies, i added the overload flags to that line myself as i was experimenting with something.

Base runuo is just,,

Code:
if ( Core.AOS )
					state.Send( SupportedFeatures.Instantiate( state.Account ) );
jaynigs 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