void CDPAccountClient::OnServersetList( CAr & ar, DPID dpid ) { ar.ReadString( g_dpCertifier.m_szVer ); #ifdef __SECURITY_0628 ar.ReadString( g_dpCertifier.m_szResVer ); #endif // __SECURITY_0628 ar >> g_dpCertifier.m_dwSizeofServerset; LPSERVER_DESC pServer; for( DWORD i = 0; i < g_dpCertifier.m_dwSizeofServerset; i++ ) { pServer = g_dpCertifier.m_aServerset + i; ar >> pServer->dwParent; ar >> pServer->dwID; ar.ReadString( pServer->lpName, 36 ); ar.ReadString( pServer->lpAddr, 16 ); ar >> pServer->b18; ar >> pServer->lCount; ar >> pServer->lEnable; ar >> pServer->lMax; // if( pServer->dwParent != NULL_ID ) { u_long uId = pServer->dwParent * 100 + pServer->dwID; g_dpCertifier.m_2ServersetPtr.insert( map<u_long, LPSERVER_DESC>::value_type( uId, pServer ) ); } } }
void CParty::Serialize( CAr & ar ) { if( ar.IsStoring() ) { ar << m_uPartyId << m_nKindTroup << m_nSizeofMember; ar << m_nLevel << m_nExp << m_nPoint; ar << m_nTroupsShareExp << m_nTroupeShareItem; ar << m_idDuelParty; for( int i = 0 ; i < MAX_PARTYMODE ; i++ ) { ar << m_nModeTime[i]; } if( m_nKindTroup ) ar.WriteString( m_sParty ); for( i = 0 ; i < m_nSizeofMember ; i++ ) { ar << m_aMember[i].m_uPlayerId; #if __VER < 11 // __SYS_PLAYER_DATA ar << m_aMember[i].m_nLevel; ar << m_aMember[i].m_nJob; #endif // __SYS_PLAYER_DATA ar << m_aMember[i].m_bRemove; #if __VER < 11 // __SYS_PLAYER_DATA ar << m_aMember[i].m_nSex; ar.WriteString( m_aMember[i].m_szName ); #endif // __SYS_PLAYER_DATA } } else { ar >> m_uPartyId >> m_nKindTroup >> m_nSizeofMember; ar >> m_nLevel >> m_nExp >> m_nPoint; ar >> m_nTroupsShareExp >> m_nTroupeShareItem; ar >> m_idDuelParty; for( int i = 0 ; i < MAX_PARTYMODE ; i++ ) { ar >> m_nModeTime[i]; } if( m_nKindTroup ) ar.ReadString( m_sParty, 33 ); for( i = 0 ; i < m_nSizeofMember ; i++ ) { ar >> m_aMember[i].m_uPlayerId; #if __VER < 11 // __SYS_PLAYER_DATA ar >> m_aMember[i].m_nLevel; ar >> m_aMember[i].m_nJob; #endif // __SYS_PLAYER_DATA ar >> m_aMember[i].m_bRemove; #if __VER < 11 // __SYS_PLAYER_DATA ar >> m_aMember[i].m_nSex; ar.ReadString( m_aMember[i].m_szName, 20 ); #endif // __SYS_PLAYER_DATA } } }
void CServerDesc::Serialize( CAr & ar ) { if( ar.IsStoring() ) { ar << m_uKey; ar << (short)m_lspJurisdiction.size(); for( list<CJurisdiction*>::iterator i = m_lspJurisdiction.begin(); i != m_lspJurisdiction.end(); ++i ) { ar << (*i)->m_dwWorldID; ar << (*i)->m_rect; ar << (*i)->m_wLeft; ar << (*i)->m_wRight; } ar.WriteString( m_szAddr ); } else { u_long uKey; ar >> uKey; SetKey( uKey ); short nSize; ar >> nSize; for( int i =0; i < nSize; i++ ) { CJurisdiction* pJurisdiction = new CJurisdiction; ar >> pJurisdiction->m_dwWorldID; ar >> pJurisdiction->m_rect; ar >> pJurisdiction->m_wLeft; ar >> pJurisdiction->m_wRight; m_lspJurisdiction.push_back( pJurisdiction ); } ar.ReadString( m_szAddr ); } }
void CDPConsole::OnOverview( CAr & ar ) { CTime tm = CTime::GetCurrentTime(); printf( "\n%s", tm.Format( "%Y/%m/%d %H:%M:%S" ) ); printf( "\n--------------------------------------------------------------------------------" ); *sOverview = '\0'; ar.ReadString( sOverview ); #ifdef __QLORD HideAddr( sOverview ); #endif // __QLORD printf( "%s", sOverview ); printf( "--------------------------------------------------------------------------------" ); #ifdef __QLORD printf( "\nCommand: q>" ); #else // __QLORD printf( "\nCommand: r, s, q>" ); #endif // __QLORD if( strstr( sOverview, "x" ) != NULL ) sndPlaySound( "type.wav", SND_ASYNC | SND_LOOP ); else sndPlaySound( NULL, SND_ASYNC ); SetEvent( hPrompt ); }
void CDPLoginSrvr::OnPreJoin( CAr & ar ) { static \ TCHAR lpszAccount[MAX_ACCOUNT], lpszPlayer[MAX_PLAYER]; u_long idPlayer; DWORD dwAuthKey; ar >> dwAuthKey; ar.ReadString( lpszAccount, MAX_ACCOUNT ); ar >> idPlayer; ar.ReadString( lpszPlayer, MAX_PLAYER ); CMclAutoLock Lock( g_PlayerMng.m_AddRemoveLock ); BOOL f = g_PlayerMng.AddPlayer( idPlayer, lpszPlayer, lpszAccount ); // lock if( f == FALSE ) { WriteLog( "OnPreJoin(): AddPlayer() return false, %d, %s", idPlayer, lpszPlayer ); CPlayer* pPlayer = g_PlayerMng.GetPlayer( idPlayer ); // if( !pPlayer ) // { // WriteLog( "OnPreJoin(): ID not found" ); // pPlayer = g_PlayerMng.GetPlayer( lpszPlayer ); // } if( pPlayer ) { if( *pPlayer->lpszAccount != '\0' ) SendQueryRemovePlayer( pPlayer->lpszAccount ); else WriteLog( "OnPreJoin(): lpszAccount == '\0'" ); g_PlayerMng.RemovePlayer( pPlayer ); } else WriteLog( "OnPreJoin(): Player not found" ); } BEFORESEND( ar1, PACKETTYPE_PRE_JOIN ); // result ar1 << dwAuthKey; ar1.WriteString( lpszAccount ); ar1 << idPlayer; ar1.WriteString( lpszPlayer ); ar1 << (BYTE)f; // o SEND( ar1, this, DPID_ALLPLAYERS ); }
void CWantedListSnapshot::Read( CAr& ar ) { m_wantedList.clear(); int nCount; // 리스트의 갯수 ar >> m_lRecvTime; ar >> nCount; for( int i=0; i<nCount; i++) { WANTED_ENTRY entry; ar.ReadString( entry.szPlayer, 64 ); ar >> entry.nGold; ar >> entry.nEnd; ar.ReadString( entry.szMsg, WANTED_MSG_MAX + 1 ); m_wantedList.push_back( entry ); } }
void CDPCoreClient::OnPreJoin( CAr & ar ) { CHAR lpszAccount[MAX_ACCOUNT], lpszPlayer[MAX_PLAYER]; DWORD dwAuthKey; u_long idPlayer; BYTE f; ar >> dwAuthKey; ar.ReadString( lpszAccount, MAX_ACCOUNT ); ar >> idPlayer; ar.ReadString( lpszPlayer, MAX_PLAYER ); ar >> f; CMclAutoLock Lock( g_UserMng.m_AddRemoveLock ); CUser* pUser = g_UserMng.GetUser( lpszAccount ); if( pUser ) { if( pUser->m_dwAuthKey == dwAuthKey ) { if( f ) // o g_dpLoginSrvr.SendHdr( PACKETTYPE_PRE_JOIN, pUser->m_dpid ); else { WriteLog( "OnPreJoin(): recv 0 from CORE, %s", lpszAccount ); pUser->m_idPlayer = 0; g_dpLoginSrvr.DestroyPlayer( pUser->m_dpid ); } } else { WriteLog( "OnPreJoin(): Different dwAuthKey" ); g_dpLoginSrvr.DestroyPlayer( pUser->m_dpid ); } } else { WriteLog( "OnPreJoin(): Account not found, %s", lpszAccount ); // } }
// Handlers void CDPCertified::OnSrvrList( CAr & ar, DPID ) { g_bRecvSvrList = TRUE; ar >> g_Neuz.m_dwAuthKey; ar >> g_Neuz.m_cbAccountFlag; long lTimeSpan = 0; #ifdef __BILLING0712 // 결재가 1일 미만 남은경우, 유저가 로그인 할때 몇시간 몇분 남았습니다 라는 메세지를 보여주는 것 ar >> lTimeSpan; #endif // __BILLING0712 #ifdef __GPAUTH_01 if( g_Neuz.m_bGPotatoAuth ) { ar.ReadString( g_Neuz.m_szGPotatoNo, 10 ); #ifdef __GPAUTH_02 ar.ReadString( g_Neuz.m_szCheck, 255 ); #endif // __GPAUTH_02 } #ifdef __EUROPE_0514 char szBak[MAX_ACCOUNT] = { 0,}; ar.ReadString( szBak, MAX_ACCOUNT ); if( lstrcmp( g_Neuz.m_szAccount, szBak ) ) { Error( "CDPCertified.OnSrvrList" ); exit( 0 ); } #endif // __EUROPE_0514 #endif // __GPAUTH_01 if( ::GetLanguage() == LANG_THA ) { long lTimeLeft; ar >> lTimeLeft; // 태국의 경우 돌아오는 22:00시까지의 남은 시간을 받는다. g_Neuz.SetLeftTime( lTimeLeft ); }
void CItemBase::Serialize( CAr & ar ) // 11 // 20 { if( ar.IsStoring() ) { ar << m_dwObjId << m_dwItemId; ar << m_liSerialNumber; ar.WriteString( m_szItemText ); } else { ar >> m_dwObjId >> m_dwItemId; ar >> m_liSerialNumber; ar.ReadString( m_szItemText, 32 ); } }
void CDPCoreClient::OnQueryRemovePlayer( CAr & ar ) { char lpszAccount[MAX_ACCOUNT] = { 0, }; ar.ReadString( lpszAccount, MAX_ACCOUNT ); CMclAutoLock Lock( g_UserMng.m_AddRemoveLock ); CUser* pUser = g_UserMng.GetUser( lpszAccount ); if( pUser ) { pUser->m_idPlayer = 0; g_dpLoginSrvr.DestroyPlayer( pUser->m_dpid ); } else { WriteLog( "OnQueryRemovePlayer(): lpszAccount not found, %s", lpszAccount ); } }
void CDPLoginSrvr::OnCloseError( CAr & ar, DPID dpid, LPBYTE lpBuf, u_long uBufSize ) { char lpszAccount[MAX_ACCOUNT] = { 0, }; ar.ReadString( lpszAccount, MAX_ACCOUNT ); #ifdef __SECURITY_FIXES if(!prj.IsAllowedLetter(lpszAccount,FALSE)) { return; } #endif // __SECURITY_FIXES g_dpAccountClient.SendRemoveAccount( lpszAccount ); #ifdef __INTERNALSERVER time_t cur = time(NULL); WriteLog( "CDPLoginSrvr::OnCloseError(%s) - %s\n", lpszAccount, ctime( &cur )); #endif }
void CDPLoginSrvr::OnLeave( CAr & ar, DPID dpid, LPBYTE lpBuf, u_long uBufSize ) { #ifdef __SECURITY_FIXES CAr arRead(lpBuf,uBufSize); char szAccount[MAX_ACCOUNT] = {0,}; arRead.ReadString( szAccount, MAX_ACCOUNT ); if(!prj.IsAllowedLetter(szAccount,FALSE)) { return; } #endif // __SECURITY_FIXES char lpszAccount[MAX_ACCOUNT] = { 0, }; ar.ReadString( lpszAccount, MAX_ACCOUNT ); #ifdef __SECURITY_FIXES if(!prj.IsAllowedLetter(lpszAccount,FALSE)) { return; } #endif // __SECURITY_FIXES g_dpAccountClient.SendRemoveAccount( lpszAccount ); u_long idPlayer; ar >> idPlayer; if( idPlayer == 0 ) return; LPDB_OVERLAPPED_PLUS lpDbOverlappedPlus = g_DbManager.AllocRequest(); g_DbManager.MakeRequest( lpDbOverlappedPlus, lpBuf, uBufSize ); lpDbOverlappedPlus->dpid = dpid; lpDbOverlappedPlus->nQueryMode = SAVE_PLAY_TIME; PostQueuedCompletionStatus( g_DbManager.m_hIOCPPut, 1, NULL, &lpDbOverlappedPlus->Overlapped ); #ifdef __INTERNALSERVER time_t cur = time(NULL); WriteLog( "CDPLoginSrvr::OnLeave(%s) - %s\n", lpszAccount, ctime( &cur )); #endif }
void CUserTaskBar::Serialize( CAr &ar ) { if( ar.IsStoring() ) { int nCount = 0; u_long uOffset = ar.GetOffset(); ar << nCount; for( int i = 0; i < MAX_SLOT_APPLET; i++ ) { if( m_aSlotApplet[i].m_dwShortcut != SHORTCUT_NONE ) // 값이 들어있는지 검사 { ar << i; ar << m_aSlotApplet[i].m_dwShortcut << m_aSlotApplet[i].m_dwId << m_aSlotApplet[i].m_dwType; ar << m_aSlotApplet[i].m_dwIndex << m_aSlotApplet[i].m_dwUserId << m_aSlotApplet[i].m_dwData; if( m_aSlotApplet[i].m_dwShortcut == SHORTCUT_CHAT) ar.WriteString( m_aSlotApplet[i].m_szString ); nCount++; } } int nBufSize; LPBYTE lpBuf = ar.GetBuffer( &nBufSize ); *(UNALIGNED int*)( lpBuf + uOffset ) = nCount; nCount = 0; uOffset = ar.GetOffset(); ar << nCount; for( i = 0; i < MAX_SLOT_ITEM_COUNT; i++ ) { for( int j = 0; j < MAX_SLOT_ITEM; j++ ) { if( m_aSlotItem[i][j].m_dwShortcut != SHORTCUT_NONE ) // 값이 들어있는지 검사 { ar << i << j; ar << m_aSlotItem[i][j].m_dwShortcut << m_aSlotItem[i][j].m_dwId << m_aSlotItem[i][j].m_dwType; ar << m_aSlotItem[i][j].m_dwIndex << m_aSlotItem[i][j].m_dwUserId << m_aSlotItem[i][j].m_dwData; if( m_aSlotItem[i][j].m_dwShortcut == SHORTCUT_CHAT) ar.WriteString( m_aSlotItem[i][j].m_szString ); nCount++; } // m_aSlotItem[i][j]이 유효한 숏컷이라면 // ar << i << j << m_aSlotItem[i][j]의 필요한 정보 저장 // if( m_aSlotItem[i][j].m_dwType == SHORTCUT_CHAT ) // ar.WriteString( } } lpBuf = ar.GetBuffer( &nBufSize ); *(UNALIGNED int*)( lpBuf + uOffset ) = nCount; nCount = 0; uOffset = ar.GetOffset(); ar << nCount; for( i = 0; i < MAX_SLOT_QUEUE; i++ ) { if( m_aSlotQueue[i].m_dwShortcut != SHORTCUT_NONE ) // 값이 들어있는지 검사 { ar << i; ar << m_aSlotQueue[i].m_dwShortcut << m_aSlotQueue[i].m_dwId << m_aSlotQueue[i].m_dwType; ar << m_aSlotQueue[i].m_dwIndex << m_aSlotQueue[i].m_dwUserId << m_aSlotQueue[i].m_dwData; nCount++; } // m_aSlotQueue[i]이 유효한 숏컷이라면 // ar << i << m_aSlotQueue[i]의 필요한 정보 저장 } ar << m_nActionPoint; lpBuf = ar.GetBuffer( &nBufSize ); *(UNALIGNED int*)( lpBuf + uOffset ) = nCount; } else { memset( m_aSlotApplet, 0, sizeof(m_aSlotApplet) ); memset( m_aSlotItem, 0, sizeof(m_aSlotItem) ); memset( m_aSlotQueue, 0, sizeof(m_aSlotQueue) ); int nCount, nIndex; ar >> nCount; // applet count for( int i = 0; i < nCount; i++ ) { ar >> nIndex; ar >> m_aSlotApplet[nIndex].m_dwShortcut >> m_aSlotApplet[nIndex].m_dwId >> m_aSlotApplet[nIndex].m_dwType; ar >> m_aSlotApplet[nIndex].m_dwIndex >> m_aSlotApplet[nIndex].m_dwUserId >> m_aSlotApplet[nIndex].m_dwData; if( m_aSlotApplet[nIndex].m_dwShortcut == SHORTCUT_CHAT) ar.ReadString( m_aSlotApplet[nIndex].m_szString, MAX_SHORTCUT_STRING ); // ar >> m_aSlotApplet[nIndex]에 아까 넣은 필요한 정보를 넣는다. } ar >> nCount; // slot item count int nIndex2; for( i = 0; i < nCount; i++ ) { ar >> nIndex >> nIndex2; // index ar >> m_aSlotItem[nIndex][nIndex2].m_dwShortcut >> m_aSlotItem[nIndex][nIndex2].m_dwId >> m_aSlotItem[nIndex][nIndex2].m_dwType; ar >> m_aSlotItem[nIndex][nIndex2].m_dwIndex >> m_aSlotItem[nIndex][nIndex2].m_dwUserId >> m_aSlotItem[nIndex][nIndex2].m_dwData; if( m_aSlotItem[nIndex][nIndex2].m_dwShortcut == SHORTCUT_CHAT) ar.ReadString( m_aSlotItem[nIndex][nIndex2].m_szString, MAX_SHORTCUT_STRING ); } ar >> nCount; for( i = 0; i < nCount; i++ ) { ar >> nIndex; ar >> m_aSlotQueue[nIndex].m_dwShortcut >> m_aSlotQueue[nIndex].m_dwId >> m_aSlotQueue[nIndex].m_dwType; ar >> m_aSlotQueue[nIndex].m_dwIndex >> m_aSlotQueue[nIndex].m_dwUserId >> m_aSlotQueue[nIndex].m_dwData; // ar >> m_aSlotQueue[nIndex]에 정보를 넣는다. } ar >> m_nActionPoint; } }
void CDPAccountClient::OnAddAccount( CAr & ar, DPID dpid ) { BYTE cbResult; DWORD dwAuthKey = 0; BYTE cbAccountFlag = 0; long lTimeSpan = 0; ar >> cbResult; ar >> dwAuthKey; ar >> cbAccountFlag; #ifdef __BILLING0712 ar >> lTimeSpan; #endif #ifdef __GPAUTH_01 char szGPotatoNo[10] = { 0,}; #ifdef __GPAUTH_02 char szCheck[255] = { 0,}; #endif // __GPAUTH_02 #ifdef __EUROPE_0514 char szBak[MAX_ACCOUNT] = { 0,}; #endif // __EUROPE_0514 BOOL bGPotatoAuth = ::GetLanguage() == LANG_GER || ::GetLanguage() == LANG_FRE; if( bGPotatoAuth ) { ar.ReadString( szGPotatoNo, 10 ); #ifdef __GPAUTH_02 ar.ReadString( szCheck, 255 ); #endif // __GPAUTH_02 } #ifdef __EUROPE_0514 ar.ReadString( szBak, MAX_ACCOUNT ); #endif // __EUROPE_0514 #endif // __GPAUTH_01 switch( cbResult ) { case ACCOUNT_DUPLIACTE: // 중복 에러 g_dpCertifier.SendError( ERROR_DUPLICATE_ACCOUNT, dpid ); break; case ACCOUNT_CHECK_OK: // 성공 { { CMclAutoLock Lock( CUserMng::GetInstance()->m_AddRemoveLock ); CUser* pUser = CUserMng::GetInstance()->GetUser( dpid ); if( !pUser ) return; pUser->m_dwTick = 0xffffffff; #ifdef __EUROPE_0514 if( lstrcmp( pUser->GetAccount(), szBak ) ) { Error( "CDPAccountClient.OnAddAccount: %s, %s", pUser->GetAccount(), szBak ); return; } #endif // __EUROPE_0514 } #ifdef __GPAUTH_01 #ifdef __GPAUTH_02 #ifdef __EUROPE_0514 g_dpCertifier.SendServerList( dpid, dwAuthKey, cbAccountFlag, lTimeSpan, szGPotatoNo, szCheck, szBak ); #else // __EUROPE_0514 g_dpCertifier.SendServerList( dpid, dwAuthKey, cbAccountFlag, lTimeSpan, szGPotatoNo, szCheck ); #endif // __EUROPE_0514 #else // __GPAUTH_02 g_dpCertifier.SendServerList( dpid, dwAuthKey, cbAccountFlag, lTimeSpan, szGPotatoNo ); #endif // __GPAUTH_02 #else // __GPAUTH_01 g_dpCertifier.SendServerList( dpid, dwAuthKey, cbAccountFlag, lTimeSpan ); #endif // __GPAUTH_01 break; } case ACCOUNT_EXTERNAL_ADDR: // 허용되지 않는 주소 g_dpCertifier.SendError( ERROR_EXTERNAL_ADDR, dpid ); break; case ACCOUNT_OVERFLOW: // 인원초과 g_dpCertifier.SendError( ERROR_OVERFLOW, dpid ); break; case ACCOUNT_BILLING_INFO_FAILED: // 빌링 정보 없음 g_dpCertifier.SendError( ERROR_BILLING_INFO_FAILED, dpid ); break; case ACCOUNT_BILLING_DATABASE_ERROR: // 빌링 DB 에러 g_dpCertifier.SendError( ERROR_BILLING_DATABASE_ERROR, dpid ); break; case ACCOUNT_BILLING_TIME_OVER: // 빌링 사용시간 만료 g_dpCertifier.SendError( ERROR_BILLING_TIME_OVER, dpid ); break; case ACCOUNT_BILLING_OTHER_ERROR: // 빌링 기타 다른 에러 g_dpCertifier.SendError( ERROR_BILLING_OTHER_ERROR, dpid ); break; case ACCOUNT_BILLING_DISCONNECTED: g_dpCertifier.SendError( ERROR_BILLING_DISCONNECTED, dpid ); break; case ACCOUNT_IPCUT_ADDR: g_dpCertifier.SendError( ERROR_IP_CUT, dpid ); break; default: { Error("CDPAccountClient::OnAddAccount result:%d ", cbResult ); CMclAutoLock Lock( CUserMng::GetInstance()->m_AddRemoveLock ); CUser* pUser = CUserMng::GetInstance()->GetUser( dpid ); if( pUser ) Error("account: %s", pUser->GetAccount() ); break; } } }