Server.Network.PacketReader.ReadUInt32 C# (CSharp) Method

ReadUInt32() public method

public ReadUInt32 ( ) : uint
return uint
		public uint ReadUInt32()
		{
			if ( (m_Index + 4) > m_Size )
				return 0;

			return (uint)((m_Data[m_Index++] << 24) | (m_Data[m_Index++] << 16) | (m_Data[m_Index++] << 8) | m_Data[m_Index++]);
		}

Usage Example

示例#1
0
        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],
                    new SkillNameValue[4]
                    {
                        new SkillNameValue( (SkillName)is1, vs1 ),
                        new SkillNameValue( (SkillName)is2, vs2 ),
                        new SkillNameValue( (SkillName)is3, vs3 ),
                        new SkillNameValue( (SkillName)is4, vs4 ),
                    },
                    shirtHue, pantsHue,
                    hairVal, hairHue,
                    hairValf, hairHuef,
                    prof,
                    race
                    );

                state.BlockAllPackets = true;

                try
                {
                    EventSink.Instance.InvokeCreateCharRequest( args );
                }
                catch ( Exception ex )
                {
                    Logger.Error( "Exception disarmed in CreateCharRequest {0}: {1}", name, ex );
                }

                Mobile m = args.Mobile;

                if ( m != null )
                {
                    state.Mobile = m;
                    m.Client = state;

                    state.BlockAllPackets = false;

                    try
                    {
                        EventSink.Instance.InvokeCharacterCreated( new CharacterCreatedEventArgs( m ) );
                    }
                    catch ( Exception ex )
                    {
                        Logger.Error( "Exception disarmed in CharacterCreated {0}: {1}", m, ex );
                    }

                    DoLogin( state, m );
                }
                else
                {
                    state.BlockAllPackets = false;
                    state.Dispose();
                }
            }
        }
All Usage Examples Of Server.Network.PacketReader::ReadUInt32