Esempio n. 1
0
// 과금정보의 ACK
void CDPBilling::OnGameStartReceive( CAr & ar, DPID dpid )
{
	char			szAccount[MAX_ID_LENGTH];
	char			szTimeOverDays[13];
	long			lRemainDays;
	long			lResult;

	ar >> lResult;
	ar.Read( szAccount, MAX_ID_LENGTH );
	ar >> lRemainDays;
	ar.Read( szTimeOverDays, 12 );
	szTimeOverDays[12] = '\0';

	lResult		= ntohl( lResult );		// 호스트 바이 오더로 변환한다.
	lRemainDays = ntohl( lRemainDays );

	// @flyff.jp가 붙은 유저 문자열에서 @flyff.jp를 제거한다
	int i;
	for(  i=0; i<MAX_ID_LENGTH; ++i )
	{
		if( szAccount[i] == 0x20 )
			break;
	}
	i -= ENDMARK_LENGTH;				// ENDMARK_LENGTH = strlen("@flyff.jp");
	szAccount[i] = '\0';

	char szBuffer[1024];
	sprintf(szBuffer, "recv 0x00010001 - GAME_START_RECEIVE\nstatus:%d user:%s remainday:%d enddate:%s\n",		     
		               lResult, szAccount, lRemainDays, szTimeOverDays );
	OutputDebugString( szBuffer );

	CTime tmOverDays = 0;
	if( lResult == SUCCESS )
	{
		char sYear[3]	= { 0, };
		char sMonth[3]	= { 0, };
		char sDay[3]	= { 0, };
		char sHour[3]	= { 0, };
		char sMin[3]	= { 0, };
		
		strncpy( sYear, szTimeOverDays, 2 );
		strncpy( sMonth, szTimeOverDays + 2, 2 );
		strncpy( sDay, szTimeOverDays + 4, 2 );
		strncpy( sHour, szTimeOverDays + 6, 2 );
		strncpy( sMin, szTimeOverDays + 8, 2 );
		
		tmOverDays	= CTime( 2000 + atoi( sYear ), atoi( sMonth ), atoi( sDay ), 0, 0, 0 );
	}

	BILLING_INFO info;
	info.szAccount = szAccount;
	info.dwKey = 0;
	info.lResult = lResult;
	info.pTimeOverDays = &tmOverDays;	// tmOverDays는 lResult가 SUCCESS인 경우에만 설정되면 된다.
	
	g_AccountMng.SendBillingResult( &info );
}
Esempio n. 2
0
int CRTMessenger::Serialize( CAr & ar )
{
	if( ar.IsStoring() )
	{
		ar << m_dwState;
		ar << static_cast<int>( size() );
		for( map<u_long, Friend>::iterator i = begin(); i != end(); ++i )
		{
			ar << i->first;
			ar.Write( &i->second, sizeof(Friend) );
		}
	}
	else
	{
		clear();
		ar >> m_dwState;
		int nSize;
		ar >> nSize;

		if( nSize > MAX_FRIEND )
			return nSize;

		u_long idFriend;

		int i; for( i = 0; i < nSize; i++ )
		{
			ar >> idFriend;
			Friend f;
			ar.Read( &f, sizeof(Friend) );
			SetFriend( idFriend, &f );
		}
	}
	return 0;
}
Esempio n. 3
0
void CGuildWar::Serialize( CAr & ar )
{
	if( ar.IsStoring() )
	{
		ar << m_idWar;
		ar.Write( &m_Decl, sizeof(m_Decl) );
		ar.Write( &m_Acpt, sizeof(m_Acpt) );
		ar << m_nFlag;
		ar << (time_t)m_time.GetTime();
	}
	else
	{
		ar >> m_idWar;
		ar.Read( &m_Decl, sizeof(m_Decl) );
		ar.Read( &m_Acpt, sizeof(m_Acpt) );
		ar >> m_nFlag;
		time_t time;
		ar >> time;
		m_time	= CTime( time );
	}
}