}
@Override
public void runImpl()
{
L2LoginClient client = getClient();
byte[] decrypted;
try
{
Cipher rsaCipher = Cipher.getInstance("RSA/ECB/nopadding");
rsaCipher.init(Cipher.DECRYPT_MODE, client.getRSAPrivateKey());
decrypted = rsaCipher.doFinal(_raw, 0x00, 0x80);
}
catch(GeneralSecurityException e)
{
e.printStackTrace();
return;
}
_user = new String(decrypted, 0x5E, 14).trim();
_user = _user.toLowerCase();
_password = new String(decrypted, 0x6C, 16).trim();
_ncotp = decrypted[0x7c];
_ncotp |= decrypted[0x7d] << 8;
_ncotp |= decrypted[0x7e] << 16;
_ncotp |= decrypted[0x7f] << 24;
LoginController lc = LoginController.getInstance();
Status status = lc.tryAuthLogin(_user, _password, client);
if(status.state == State.IN_USE)
{
L2LoginClient oldClient = lc.getAuthedClient(_user);
// кикаем другого клиента, подключенного к логину
if(oldClient != null)
{
oldClient.close(LoginFailReason.REASON_ACCOUNT_IN_USE);
}
if(lc.isAccountInLoginServer(_user))
{
lc.removeAuthedLoginClient(_user).close(LoginFailReason.REASON_ACCOUNT_IN_USE);
}