Esempio n. 1
0
void CAniClientConnection::OnPrivateChatInvitation( int iChatID, int iSocket, LPCSTR lpszUserName )
	{
	CDlgPrivateChatChoice* pDlg = new CDlgPrivateChatChoice;
	pDlg->m_iChatID = iChatID;
	pDlg->m_sUser = lpszUserName;
	pDlg->m_iUserSocket = iSocket;
	m_pDialog->AddPropertyPage( pDlg );
	PlayEvent( &m_pDialog->m_pServerData->GetServerOptions( )->m_PrivateChat );
	}
Esempio n. 2
0
void CAniClientConnection::OnPublicChatReceived( LPCSTR lpszMessage )
	{
	ASSERT( m_pDialog );
	if ( m_pDialog->m_pServerData->GetServerOptions( )->m_bChatTime )
		{
		AddToPublicChat( "\n", m_pDialog->m_pServerData->m_pServerOptions->GetChatColor( ) );
		AddTime( m_pDialog->m_pServerData->m_pServerOptions->GetChatColor( ) );
		lpszMessage++;
		}
	AddToPublicChat( lpszMessage, m_pDialog->m_pServerData->m_pServerOptions->GetChatColor( ) );
	PlayEvent( &m_pDialog->m_pServerData->GetServerOptions( )->m_PublicChat );
	}
Esempio n. 3
0
void CScript::Think()
{
    double flCurrentTime = GameServer()->GetGameTime() - m_flStartTime;

    for (size_t i = 0; i < m_aEvents.size(); i++ )
    {
        CScriptEvent* pEvent = &m_aEvents[i];

        if (flCurrentTime >= pEvent->m_flStartTime && !pEvent->m_bStarted)
            PlayEvent(i);
        else if (pEvent->m_flEndTime && pEvent->m_bStarted && !pEvent->m_bExecuted && flCurrentTime >= pEvent->m_flEndTime)
            FinishEvent(i);
        else if (pEvent->m_bStarted && pEvent->m_flEndTime && !pEvent->m_bExecuted)
            ThinkEvent(i);
    }
}
Esempio n. 4
0
void CAniClientConnection::OnUserChange( int iSocket, bool bIsNew, CHotlineUser& huOld, CHotlineUser& huNew )
	{
	ASSERT( m_pDialog );
	CString sMessage;
	LPCSTR lpszMessage;
	COLORREF crColor = 0;
	if ( bIsNew )
		{
		crColor = m_pDialog->m_pServerData->m_pServerOptions->GetUserJoinColor( );
		sMessage.Format( IDS_USER_JOIN, LPCSTR( huNew.GetName( ) ) );
		lpszMessage = sMessage;
		PlayEvent( &m_pDialog->m_pServerData->GetServerOptions( )->m_UserJoin );
		}
	else
		{
		if ( !strcmp( huOld.GetName( ), huNew.GetName( ) ) && ( huOld.GetIconNumber( ) == huNew.GetIconNumber( ) ) )
			{
			m_pDialog->UserJoinChange( iSocket );
			return;
			}

		if ( !strcmp( huOld.GetName( ), huNew.GetName( ) ) )
			{
			m_pDialog->UserJoinChange( iSocket );
			return;
			}

		crColor = m_pDialog->m_pServerData->m_pServerOptions->GetUserChangeColor( );
		sMessage.Format( IDS_USER_CHANGE, LPCSTR( huOld.GetName( ) ), LPCSTR( huNew.GetName( ) ) );
		lpszMessage = sMessage;
		}

	if ( m_pDialog->m_pServerData->GetServerOptions( )->m_bUserEnter )
		{
		if ( ( bIsNew && m_pDialog->m_pServerData->GetServerOptions( )->m_bUserEnterTime )
			|| ( ( !bIsNew && m_pDialog->m_pServerData->GetServerOptions( )->m_bChatTime ) ) )
			{
			AddToPublicChat( "\n", crColor );
			lpszMessage++;
			AddTime( crColor );
			}
		AddToPublicChat( lpszMessage, crColor );
		}

	m_pDialog->UserJoinChange( iSocket );
	}
Esempio n. 5
0
void CAniClientConnection::OnUserLeave( int iSocket, CHotlineUser& huUser )
	{
	ASSERT( m_pDialog );
	CString sMessage;
	sMessage.Format( IDS_USER_LEAVE, LPCSTR( huUser.GetName( ) ) );

	if ( m_pDialog->m_pServerData->GetServerOptions( )->m_bUserLeave )
		{
		if ( m_pDialog->m_pServerData->GetServerOptions( )->m_bUserLeaveTime )
			{
			AddToPublicChat( "\n", m_pDialog->m_pServerData->m_pServerOptions->GetUserLeaveColor( ) );
			sMessage = sMessage.Mid( 1 );
			AddTime( m_pDialog->m_pServerData->m_pServerOptions->GetUserLeaveColor( ) );
			}
		AddToPublicChat( sMessage, m_pDialog->m_pServerData->m_pServerOptions->GetUserLeaveColor( ) );
		}
	m_pDialog->UserLeave( iSocket );
	PlayEvent( &m_pDialog->m_pServerData->GetServerOptions( )->m_UserLeave );
	}
Esempio n. 6
0
void CAniClientConnection::OnPrivateMessage( LPCSTR lpszMessage, int iSocket )
	{
	ASSERT( m_pDialog );

	CHotlineUser huUser;
	CDlgPrivateMessage* pDlg = new CDlgPrivateMessage;
	pDlg->m_PMUserIcon.m_pDatFile = m_pDialog->m_pMainDialog->GetHotlineDat( );
	if ( GetUserInfoBySocket( iSocket, huUser ) )
		{
		pDlg->m_sFrom = huUser.GetName( );
		pDlg->m_PMUserIcon.m_iIcon = huUser.GetIconNumber( );
		}
	else
		{
		pDlg->m_sFrom = "<unknown user>";
		pDlg->m_PMUserIcon.m_iIcon = 1;
		}
	pDlg->m_sOriginalMessage = lpszMessage;

	pDlg->m_iSocketFrom = iSocket;
	m_pDialog->AddPropertyPage( pDlg );

	PlayEvent( &m_pDialog->m_pServerData->GetServerOptions( )->m_PrivateMessage );
	}