public static void GameLogin( NetState state, PacketReader pvSrc )
{
if ( state.SentFirstPacket )
{
state.Dispose();
return;
}
state.SentFirstPacket = true;
int authID = pvSrc.ReadInt32();
if ( m_AuthIDWindow.ContainsKey( authID ) ) {
AuthIDPersistence ap = m_AuthIDWindow[authID];
m_AuthIDWindow.Remove( authID );
state.Version = ap.Version;
} else if ( m_ClientVerification ) {
Console.WriteLine( "Login: {0}: Invalid client detected, disconnecting", state );
state.Dispose();
return;
}
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 );
GameLoginEventArgs e = new GameLoginEventArgs( state, username, password );
EventSink.InvokeGameLogin( e );
if ( e.Accepted )
{
state.CityInfo = e.CityInfo;
state.CompressionEnabled = true;
state.Send( SupportedFeatures.Instantiate( state ) );
if ( state.NewCharacterList ) {
state.Send( new CharacterList( state.Account, state.CityInfo ) );
} else {
state.Send( new CharacterListOld( state.Account, state.CityInfo ) );
}
}
else
{
state.Dispose();
}
}