Server.Network.PacketHandlers.PlayCharacter C# (CSharp) Méthode

PlayCharacter() public static méthode

public static PlayCharacter ( NetState state, PacketReader pvSrc ) : void
state NetState
pvSrc PacketReader
Résultat void
        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();
                }
            }
        }
PacketHandlers