Ejemplo n.º 1
0
int KGameserverEyes::DoSendPlayerCount(DWORD dwFrames)
{
	if ( dwFrames > m_dwNextSendPlayerCountFrame )
	{
		INT nOnline = g_cPlayerMgr.GetPlayerCount();
		SendPlayerCount(nOnline);
		m_dwNextSendPlayerCountFrame = dwFrames + m_dwSendPlayerCountInterval;
	}
	return 1;
}
Ejemplo n.º 2
0
void KGatewayEyes::Activate()
{
    BYTE*               pbyData             = NULL;
    size_t              nPackLen            = 0;
    BYTE                byProtocol          = 0;
    PROTOCOL_FUNCTION   ProtocolFunction    = NULL;
    time_t              nTimeNow            = time(NULL);

    while (true)
    {
        pbyData = (BYTE*)m_Stream.GetPack(nPackLen);

        if (!pbyData)
        {
            break;
        }

        byProtocol = *pbyData;

        ProtocolFunction = m_ProtocolFunctions[byProtocol];

        if (ProtocolFunction)
        {
            (this->*ProtocolFunction)(pbyData, nPackLen);
        }
        else
        {
            KGLogPrintf(KGLOG_DEBUG, "Invalid FSEyes protocol : %d\n", byProtocol);
        }

        m_Stream.PopPack();
    }

    if (nTimeNow >= m_nNextPingTime)
    {
        Ping();
        m_nNextPingTime = nTimeNow + 20;
    }

    if (nTimeNow > m_nNextSendPlayerCountTime)
    {
        SendPlayerCount();
        m_nNextSendPlayerCountTime = nTimeNow + 2;
    }

    if (nTimeNow > m_nNextSendCustomInfoTime)
    {
        SendCustomInfo();
        m_nNextSendCustomInfoTime = nTimeNow + 2;
    }
}