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!

Network.Flags

jaynigs

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

					[B]state.Flags = flags;[/B]



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
 

Seanchen.net

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

They don't use packets, to do what you want to do.

They handle it via their account system.
 

jaynigs

Wanderer
Seanchen.net said:
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.
 

Seanchen.net

Wanderer
jaynigs said:
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.

I would assume you can tell which client they are using, before they login into the character, by the client type. To be honest you might have to modify the order RunUO asks or requests the information you want.

Why don't you just do the exact same the other method uses?

The method has the same PacketReader..

You can do that one of two ways.

read in the other two values like so

pvSrc.ReadInt32(); // 0xEDEDEDED

Code:
			pvSrc.ReadInt32(); // 0xEDEDEDED

			string name = pvSrc.ReadString( 30 );
		pvSrc.Seek( 2, SeekOrigin.Current );
			int flags = pvSrc.ReadInt32();

It looks like the "flag" is the 4th position/value, so adjust the following


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

and take that into consideration
 

jaynigs

Wanderer
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
 

Seanchen.net

Wanderer
jaynigs said:
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

Doesn't matter the information is still there.

Code:
		int flags = pvSrc.ReadInt32();

To be honest I don't understand the problem. The information you want is in both packets, please note my response was based on what you told me, was before I read the code ( I make replies based on the data that is said, before I read code ).
 

jaynigs

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

Seanchen.net

Wanderer
jaynigs said:
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. :(

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.
 

jaynigs

Wanderer
Seanchen.net said:
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 ) );
 
Top