Esempio n. 1
0
//--------------------------------------------------------------------------------------
//
//
void CEventControl::AddCounterNum( int num, int counterType, int Id )
{
    for( int i = 0; i < MAX_TASK_EVNET; i++ )
    {
        CBaseDataEvent* pBaseDataEvent =  g_pClientLoader->GetEventDataFromId(  m_TaskData[i].EventId );

        if( NULL != pBaseDataEvent )
        {
            if( 0 == GetEventFlag( m_TaskData[i].EventId ) )
            {
                CBaseFunLimitData *pFunData = g_pClientLoader->GetFunLimitDataFromId( pBaseDataEvent->m_SubEvent.m_iLimitId[0] );

                if( pFunData->GetFunId() == counterType && m_TaskData[i].GameCounter[0].CounterId == Id )
                {
                    m_TaskData[i].GameCounter[0].CurCount += num;

                    if( m_TaskData[i].GameCounter[0].CurCount >= m_TaskData[i].GameCounter[0].MaxCount )
                    {
                        m_TaskData[i].GameCounter[0].CurCount = m_TaskData[i].GameCounter[0].MaxCount;
                    }

                }
            }
        }
    }
}
Esempio n. 2
0
//------------------------------------------
//
//
bool HandleLimitCheck( int Index  )
{ 
	CBaseFunLimitData *pData = g_pClientLoader->GetFunLimitDataFromId( Index );
	if( NULL == pData )
	{
		return (m_pLimitFunctionArray[0])( NULL );
	}
	int Funid = pData->GetFunId();
	return (m_pLimitFunctionArray[Funid])( pData );
}
Esempio n. 3
0
//-------------------------------------------------------------------------------------
//
//
void CClientLoader::LoadBaseDataLimit()
{
	std::string fullpath(CCFileUtils::fullPathFromRelativePath(jsonFileFunctionLimit));

	std::string strBuffer = readInputTestFile( fullpath.c_str() );

	if( isCheat( strBuffer,  eventlimit_json[0]) )
	{
		char buffer[512];
		sprintf( buffer, the_message_cheat_json[g_iCurLanguageIndex], jsonFileFunctionLimit  );
		CCMessageBox( buffer, the_message_alert[g_iCurLanguageIndex] );
	}

	if( strBuffer.empty() ) 
	{ 
		CCAssert( NULL, "Can not found json file!" );
		return;
	}

	Json::Value root;
	if( parseAndSaveValueTree( strBuffer,"", root ) )
	{ 
		CCAssert( NULL, "read jsonfile is not success!" );
		return;
	}

	Json::Value Root;
	m_vBaseFunLimitData.clear();

	for( int i = 0;; i++ ) 
	{
		char buffer[32];
		sprintf( buffer, "key%d", i + 1 );
		Root = root["eventlimit"][buffer]; 
		if( Root.isNull() )
		{
			break; 
		} 
		CBaseFunLimitData BaseData;

		BaseData.m_iID		= Root["id"].asInt();
		BaseData.m_iFunId	= BaseData.FindIdFormName( FIND_TYPEID_LIMIT_NAME, Root["functionname"].asString().c_str() );
		BaseData.m_iOperator= BaseData.FindIdFormName( FIND_TYPEID_LIMIT_OPERATOR, Root["operator"].asString().c_str() );

		if( Root["param"].isArray() )
		{
			int count = Root["param"].size();
			for( int j = 0; j < count; j++ )
			{
				BaseData.m_arrParam[j]	=  Root["param"][j].asInt();
			}
		}
		m_vBaseFunLimitData.push_back( BaseData );
	} 
}