当前位置: 首页>>代码示例>>C#>>正文


C# PacketReader.ReadUInt32方法代码示例

本文整理汇总了C#中Server.Network.PacketReader.ReadUInt32方法的典型用法代码示例。如果您正苦于以下问题:C# PacketReader.ReadUInt32方法的具体用法?C# PacketReader.ReadUInt32怎么用?C# PacketReader.ReadUInt32使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Server.Network.PacketReader的用法示例。


在下文中一共展示了PacketReader.ReadUInt32方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CreateCharacterNew

        public void CreateCharacterNew( GameClient state, PacketReader pvSrc )
        {
            /*int unk1 = */
            pvSrc.ReadInt32();
            /*int unk2 = */
            pvSrc.ReadInt32();
            /*int unk3 = */
            pvSrc.ReadByte();
            string name = pvSrc.ReadString( 30 );

            pvSrc.Seek( 2, SeekOrigin.Current );
            int flags = pvSrc.ReadInt32();
            pvSrc.Seek( 8, SeekOrigin.Current );
            int prof = pvSrc.ReadByte();
            pvSrc.Seek( 15, SeekOrigin.Current );

            int genderRace = pvSrc.ReadByte();

            int str = pvSrc.ReadByte();
            int dex = pvSrc.ReadByte();
            int intl = pvSrc.ReadByte();
            int is1 = pvSrc.ReadByte();
            int vs1 = pvSrc.ReadByte();
            int is2 = pvSrc.ReadByte();
            int vs2 = pvSrc.ReadByte();
            int is3 = pvSrc.ReadByte();
            int vs3 = pvSrc.ReadByte();
            int is4 = pvSrc.ReadByte();
            int vs4 = pvSrc.ReadByte();
            int hue = pvSrc.ReadUInt16();
            int hairVal = pvSrc.ReadInt16();
            int hairHue = pvSrc.ReadInt16();
            int hairValf = pvSrc.ReadInt16();
            int hairHuef = pvSrc.ReadInt16();
            pvSrc.ReadByte();
            int cityIndex = pvSrc.ReadByte();
            /*int charSlot = */
            pvSrc.ReadInt32();
            uint clientIP = pvSrc.ReadUInt32();
            int shirtHue = pvSrc.ReadInt16();
            int pantsHue = pvSrc.ReadInt16();

            /*
            0x00, 0x01
            0x02, 0x03 -> Human Male, Human Female
            0x04, 0x05 -> Elf Male, Elf Female
            0x05, 0x06 -> Gargoyle Male, Gargoyle Female
            */

            bool female = ( ( genderRace % 2 ) != 0 );

            Race race = null;

            byte raceId = (byte) ( genderRace < 4 ? 0 : ( ( genderRace / 2 ) - 1 ) );
            race = Race.Races[raceId];

            if ( race == null )
                race = Race.DefaultRace;

            clientIP = (uint) IPAddress.NetworkToHostOrder( (int) clientIP );

            state.ClientAddress = new IPAddress( (long) clientIP );

            CityInfo[] info = state.CityInfo;
            IAccount a = state.Account;

            if ( Utility.IsUsingMulticlient( state, Environment.Config.Login.MaxLoginsPerPC ) )
            {
                Console.WriteLine( "Login: {0}: Multiclient detected, disconnecting...", state );
                state.Send( new PopupMessage( PMMessage.LoginSyncError ) );
                state.Dispose();
                return;
            }

            if ( info == null || a == null || cityIndex < 0 || cityIndex >= info.Length )
            {
                state.Dispose();
            }
            else
            {
                // 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 )
                    {
                        Console.WriteLine( "Login: {0}: Account in use", state );
                        state.Send( new PopupMessage( PMMessage.CharInWorld ) );
                        return;
                    }
                }

                state.Flags = flags;

                CreateCharRequestEventArgs args = new CreateCharRequestEventArgs(
                    state, a,
                    name, female, hue,
                    str, dex, intl,
                    info[cityIndex],
//.........这里部分代码省略.........
开发者ID:Ravenwolfe,项目名称:xrunuo,代码行数:101,代码来源:PacketHandlers.cs

示例2: PlayCharacter

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

			if ( FeatureProtection.DisabledFeatures != 0 && ThirdPartyAuthCallback != null )
			{
				bool authOK = false;

				ulong razorFeatures = (((ulong)pvSrc.ReadUInt32())<<32) | ((ulong)pvSrc.ReadUInt32());

				if ( razorFeatures == (ulong)FeatureProtection.DisabledFeatures )
				{
					bool match = true;
					for ( int i=0; match && i < m_ThirdPartyAuthKey.Length; i++ )
						match = match && pvSrc.ReadByte() == m_ThirdPartyAuthKey[i];
						
					if ( match )
						authOK = true;
				}
                else
                {
                    pvSrc.Seek( 16, SeekOrigin.Current );
                }

				ThirdPartyAuthCallback( state, authOK );
			}
			else
			{
				pvSrc.Seek( 24, SeekOrigin.Current );
			}

			if ( ThirdPartyHackedCallback != null )
			{
				pvSrc.Seek( -2, SeekOrigin.Current );
				if ( pvSrc.ReadUInt16() == 0xDEAD )
					ThirdPartyHackedCallback( state, true );
			}

			if ( !state.Running )
				return;

			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.Send( new ClientVersionReq() );

					state.BlockAllPackets = true;

					state.Flags = (ClientFlags)flags;

					state.Mobile = m;
					m.NetState = state;

					new LoginTimer( state, m ).Start();
				}
			}
		}
开发者ID:Grimoric,项目名称:RunUO.2.3.r1083,代码行数:96,代码来源:PacketHandlers.cs

示例3: PlayCharacter

        public void PlayCharacter( GameClient 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();
            uint clientIP = pvSrc.ReadUInt32();

            clientIP = (uint) IPAddress.NetworkToHostOrder( (int) clientIP );
            state.ClientAddress = new IPAddress( (long) clientIP );

            IAccount a = state.Account;

            if ( Utility.IsUsingMulticlient( state, Environment.Config.Login.MaxLoginsPerPC ) )
            {
                Console.WriteLine( "Login: {0}: Multiclient detected, disconnecting...", state );
                state.Send( new PopupMessage( PMMessage.LoginSyncError ) );
                state.Dispose();
                return;
            }

            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.Client != null )
                        m.Client.Dispose();

                    GameServer.Instance.ProcessDisposedQueue();

                    state.BlockAllPackets = true;

                    state.Flags = flags;

                    state.Mobile = m;
                    m.Client = state;

                    state.BlockAllPackets = false;
                    DoLogin( state, m );
                }
            }
        }
开发者ID:Ravenwolfe,项目名称:xrunuo,代码行数:71,代码来源:PacketHandlers.cs


注:本文中的Server.Network.PacketReader.ReadUInt32方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。