Пример #1
0
void CDPLoginSrvr::OnRemoveConnection( DPID dpid )
{
	if( s_dpid == dpid )
	{
		g_DPCacheSrvr.SendHdr( PACKETTYPE_DESTROY_ALLPLAYERS, DPID_ALLPLAYERS, DPID_ALLPLAYERS );
		s_dpid	= 0xFFFFFFFF;
		g_PlayerMng.Free();
	}
}
Пример #2
0
void OnTimer( WORD wTimerID )
{
	if( wTimerID == TIMER_ID_DEFAULT )
	{
		g_GameTimer.Compute();

	#ifdef __EVE_NEWYEAR
		static BOOL s_bCountdown	= FALSE;
		CTime tmCur		= CTime::GetCurrentTime();
		if( ::GetLanguage() == LANG_GER || ::GetLanguage() == LANG_FRE )
		{
			if( !s_bCountdown && tmCur > CTime( 2009, 12, 31, 22, 58, 59 ) && tmCur < CTime( 2009, 12, 31, 23, 0, 0 ) )
			{
				s_bCountdown	= TRUE;
				g_DPCacheSrvr.SendHdr( PACKETTYPE_NEWYEAR, DPID_ALLPLAYERS, DPID_ALLPLAYERS );
			}
			if( tmCur > CTime( 2009, 12, 31, 23, 0, 0 ) )
				s_bCountdown	= FALSE;
		}
		else
		{
			if( !s_bCountdown && tmCur > CTime( 2009, 12, 31, 23, 58, 59 ) && tmCur < CTime( 2010, 1, 1, 0, 0, 0 ) )
			{
				s_bCountdown	= TRUE;
				g_DPCacheSrvr.SendHdr( PACKETTYPE_NEWYEAR, DPID_ALLPLAYERS, DPID_ALLPLAYERS );
			}
			if( tmCur > CTime( 2010, 1, 1, 0, 0, 0 ) )
				s_bCountdown	= FALSE;
		}
	#endif	// __EVE_NEWYEAR

		return;
	}

#if !defined(__INTERNALSERVER)
	if( wTimerID == TIMER_ID_WANTED )	// 현상금 처리 
	{
		g_dpCoreSrvr.SendCWWantedList();	// 현상금 리스트를 보낸다.
		return;
	}
#endif // __INTERNALSERVER

#ifdef __EVENT0913
	if( wTimerID == TIMER_ID_EVENT0913 )
	{
		CTime	tmCurr	= CTime::GetCurrentTime();
		BOOL bEventTime		= ( tmCurr.GetHour() >= 17 && tmCurr.GetHour() < 18 ) || ( tmCurr.GetHour() >= 22 && tmCurr.GetHour() < 23 );
		if( bEventTime && !s_bEvent0913 )	// 이벤트 시간 - 이벤트 설정되어 있지 않으면,
		{
			g_dpCoreSrvr.SendEvent0913( s_bEvent0913 = TRUE );
		}
		else if( !bEventTime && s_bEvent0913 )	// 이벤트 시간이 아닌데 이벤트 설정되어 있으면,
		{
			g_dpCoreSrvr.SendEvent0913( s_bEvent0913 = FALSE );
		}
	}
#endif	// __EVENT0913
#ifdef __EVENT1206
	if( wTimerID == TIMER_ID_EVENT1206 )
	{
		CTime	tmCurr	= CTime::GetCurrentTime();
		BOOL bEventTime;
		if( s_bTest )
		{
			bEventTime	= ( tmCurr.GetHour() % 2 == 0 );	// even
		}
		else
		{
			bEventTime	= ( tmCurr >= CTime( 2005, 12, 10, 19, 0, 0 ) && tmCurr < CTime( 2005, 12, 10, 22, 0, 0 ) )
						|| ( tmCurr >= CTime( 2005, 12, 11, 19, 0, 0 ) && tmCurr < CTime( 2005, 12, 11, 22, 0, 0 ) );
		}
		if( bEventTime && !s_bEvent1206 )	// 이벤트 시간 - 이벤트 설정되어 있지 않으면,
		{
			g_dpCoreSrvr.SendEvent1206( s_bEvent1206 = TRUE );
		}
		else if( !bEventTime && s_bEvent1206 )	// 이벤트 시간이 아닌데 이벤트 설정되어 있으면,
		{
			g_dpCoreSrvr.SendEvent1206( s_bEvent1206 = FALSE );
		}
	}
#endif	// __EVENT1206

	if( wTimerID == TIMER_ID_EVENT )
	{
		BOOL	f	= FALSE;
		CTime	tmCurr	= CTime::GetCurrentTime();

		BOOL bXmas;
		if( s_bTest )
		{
			bXmas	= tmCurr < CTime( 2005, 12, 26, 10, 0, 0 );
		}
		else
		{
			bXmas	= ( tmCurr >= CTime( 2005, 12, 23, 0, 0, 0 ) && tmCurr < CTime( 2005, 12, 27, 9, 0, 0 ) );
		}

		BOOL bNewYear;
		if( s_bTest )
		{
			bNewYear	= tmCurr < CTime( 2006, 1, 31, 10, 0, 0 );
		}
		else
		{
			bNewYear	= ( tmCurr >= CTime( 2006, 1, 26, 0, 0, 0 ) && tmCurr < CTime( 2006, 1, 31, 10, 0, 0 ) );
		}

		BOOL bValentinesDay;
		if( s_bTest )
		{
			bValentinesDay	= tmCurr < CTime( 2006, 2, 15, 13, 0, 0 );
		}
		else
		{
			bValentinesDay	= ( tmCurr >= CTime( 2006, 2, 14, 0, 0, 0 ) && tmCurr < CTime( 2006, 2, 15, 13, 0, 0 ) );
		}
			
		if( bXmas && !( s_dwEvent & EVE_FLAG1219 ) )
		{
			s_dwEvent	|= EVE_FLAG1219;
			f	= TRUE;
		}
		else if( !bXmas && ( s_dwEvent & EVE_FLAG1219 ) )
		{
			s_dwEvent	&= ~EVE_FLAG1219;
			f	= TRUE;
		}

		if( bNewYear && !( s_dwEvent & EVE_FLAG0127 ) )
		{
			s_dwEvent	|= EVE_FLAG0127;
			f	= TRUE;
		}
		else if( !bNewYear && ( s_dwEvent & EVE_FLAG0127 ) )
		{
			s_dwEvent	&= ~EVE_FLAG0127;
			f	= TRUE;
		}
		
		if( bValentinesDay && !( s_dwEvent & EVE_FLAG0214 ) )
		{
			s_dwEvent	|= EVE_FLAG0214;
			f	= TRUE;
		}
		else if( !bValentinesDay && ( s_dwEvent & EVE_FLAG0214 ) )
		{
			s_dwEvent	&= ~EVE_FLAG0214;
			f	= TRUE;
		}

		if( f )
		{
			g_dpCoreSrvr.SendEvent( s_dwEvent );
		}
	}
}