bool LoginPacket(CUserSocket *pSocket, const unsigned char* packet)
{
guard;
bool ret = true;
WCHAR accountName[16];
memset(accountName, 0, sizeof(accountName));
UINT accountId = 0, oneTimeKey = 0, session1 = 0, session2 = 0, country = 0;
Disassemble(packet, "Sddddd", 30, accountName, &accountId, &oneTimeKey, &session1, &session2, &country);
if(accountName[0] != 0 && accountName[15] == 0 && oneTimeKey != 0 && accountId > 0 && session2 > 0)
{
UINT error = g_LoginDb.CanLogin(accountId, accountName);
if(error == 0)
{
ret = UserSocketCallback(0x885F20L)(pSocket, packet);
}else
{
g_Log.Add(CLog::Error, "[%s] blocked login to acc[%S][%d] - error[%d]!", __FUNCTION__, accountName, accountId, error);
}
}else
{
CIPAddress ip(pSocket->addr);
g_Log.Add(CLog::Error, "[%s] Account[%S][%d] oneTimeKey[%d] s1[%d] s2[%d] country[%d] IP[%s] - hack!", __FUNCTION__, accountName, accountId, oneTimeKey, session1, session2, country, ip.ToString().c_str());
}
unguard;
return ret;
}