示例#1
0
BOOL OpenseSetting::ReadOpenseTemplate()
{
	m_MapOpenseCfg.clear();
	INT nFileHeight = 0;
	ITabFile* tabFile = g_OpenTabFile(OPENSE_FILE_PATH);

	CHAR szFilePath[_MAX_PATH];
	QString szFileTemp;
	ITabFile* pFile = NULL;
	LOG_PROCESS_ERROR(tabFile);

	nFileHeight = tabFile->GetHeight();

	for (INT i = 3; i <= nFileHeight; i++)  // µÚ3ÐÐ
	{
		OpenseCfg* openseTemplate = new OpenseCfg();
		tabFile->GetInteger(i, "id", 0, &openseTemplate->nId);
		tabFile->GetInteger(i, "awardId", 0, &openseTemplate->nAwardId);
		tabFile->GetInteger(i, "autoGive", 0, &openseTemplate->nAutoGive);
		tabFile->GetString(i, "conditionPath", "", szFilePath, _MAX_PATH);

		szFileTemp = OPENSE_DAY_FOLD;
		szFileTemp = szFileTemp + szFilePath;
		pFile = g_OpenTabFile(szFileTemp.CStr());
		QCONFIRM_RET_FALSE(pFile);
		for (int j = 3; j <= pFile->GetHeight(); j++)
		{
			OpenseDayCfg* openseDay = new OpenseDayCfg();
			pFile->GetInteger(j, "id", 0, &openseDay->nId);
			pFile->GetInteger(j, "awardId", 0, &openseDay->nAwardId);
			pFile->GetInteger(j, "finishCount", 0, &openseDay->nFinishCount);
			pFile->GetInteger(j, "autoGive", 0, &openseDay->nAutoGive);

			openseTemplate->mapOpenseDay.insert(std::make_pair(openseDay->nId, openseDay));
		}
		m_MapOpenseCfg.insert(std::make_pair(openseTemplate->nId, openseTemplate));
	}

	return TRUE;

EXIT0:
	return FALSE;
}
示例#2
0
BOOL KAwardSetting::ReadExpAwardConfigs()
{
	INT nExpAwardId = 0;
	CHAR szPath[_MAX_PATH];
	QString szFileTemp;
	ITabFile* pExpAwardFile = NULL;
	ITabFile* pTabFile = g_OpenTabFile(EXP_AWARD_FILE);
	QCONFIRM_RET_FALSE(pTabFile);

	for (INT i = 2; i < pTabFile->GetHeight(); i++)
	{
		pTabFile->GetInteger(i + 1, "ExpAwardId", 0, &nExpAwardId);
		pTabFile->GetString(i + 1, "Path", "", szPath, _MAX_PATH);

		szFileTemp = EXP_AWARD_FILE_FOLDER;
		szFileTemp = szFileTemp + szPath;

		pExpAwardFile = g_OpenTabFile(szFileTemp.CStr());
		QCONFIRM_RET_FALSE(pExpAwardFile);

		MAP_EXP_AWARD mapExpAward;

		for (INT j = 2; j < pExpAwardFile->GetHeight(); j++)
		{
			KExpAward sAward;
			
			pExpAwardFile->GetInteger(j + 1, "Level", 0, &sAward.nLevel);
			pExpAwardFile->GetInteger(j + 1, "Percent", 0, &sAward.nPercent);
			mapExpAward[sAward.nLevel] = sAward;
		}

		m_mapExpAwards[nExpAwardId] = mapExpAward;
	}

	return TRUE;
}
示例#3
0
BOOL KAwardSetting::ReadNumericalAwardConfigs()
{
	CHAR szStageAwardName[_MAX_PATH];
	CHAR szLevelAwardName[_MAX_PATH];
	ITabFile* pStageAwardFile = NULL;
	ITabFile* pLevelAwardFile = NULL;
	QString szFileTemp;

	ITabFile* pTabFile = g_OpenTabFile(NUMERICAL_TABLE_FILE);
	QCONFIRM_RET_FALSE(pTabFile);

	for (INT i = 1; i < pTabFile->GetHeight(); i++)
	{
		QModuleNumericalAward* pModuleAward = new QModuleNumericalAward();
		QCONFIRM_RET_FALSE(pModuleAward);

		pTabFile->GetString(i + 1, "ModuleName", "", pModuleAward->szModuleName, MAX_NAME_LEN);
		pTabFile->GetString(i + 1, "StageAwardName", "", szStageAwardName, _MAX_PATH);
		pTabFile->GetString(i + 1, "LevelAwardName", "", szLevelAwardName, _MAX_PATH);

		szFileTemp = AWARD_TABLE_FILE_FOLDER;
		szFileTemp = szFileTemp + szStageAwardName;
		pStageAwardFile = g_OpenTabFile(szFileTemp.CStr());
		QCONFIRM_RET_FALSE(pStageAwardFile);

		for (INT j = 2; j < pStageAwardFile->GetHeight(); j++)
		{
			QNumericalStageAward* pNumericalStageAward = new QNumericalStageAward();
			QCONFIRM_RET_FALSE(pNumericalStageAward);

			pStageAwardFile->GetInteger(j + 1, "StageID", 0, &pNumericalStageAward->nStageId);
			pStageAwardFile->GetInteger(j + 1, "MinLineNum", 0, &pNumericalStageAward->nStartIndex);
			pStageAwardFile->GetInteger(j + 1, "MaxLineNum", 0, &pNumericalStageAward->nEndIndex);

			// 减去开头的2行,从0开始
			pNumericalStageAward->nStartIndex -= 2;
			pNumericalStageAward->nEndIndex -= 2;

			pModuleAward->mapNumericalStageAwards[pNumericalStageAward->nStageId] = pNumericalStageAward;
		}

		szFileTemp = AWARD_TABLE_FILE_FOLDER;
		szFileTemp = szFileTemp + szLevelAwardName;
		pLevelAwardFile = g_OpenTabFile(szFileTemp.CStr());
		QCONFIRM_RET_FALSE(pLevelAwardFile);

		for (INT j = 2; j < pLevelAwardFile->GetHeight(); j++)
		{
			QNumericalAward* pNumericalAward = new QNumericalAward();
			QCONFIRM_RET_FALSE(pNumericalAward);
			pLevelAwardFile->GetInteger(j + 1, "Level", 0, &pNumericalAward->nLevel);
			pLevelAwardFile->GetInteger(j + 1, "Life", 0, &pNumericalAward->nLife);
			pLevelAwardFile->GetInteger(j + 1, "Ability", 0, &pNumericalAward->nAbility);
			pLevelAwardFile->GetInteger(j + 1, "Attack", 0, &pNumericalAward->nAttack);
			pLevelAwardFile->GetInteger(j + 1, "Defense", 0, &pNumericalAward->nDefense);
			pLevelAwardFile->GetInteger(j + 1, "Hit", 0, &pNumericalAward->nHit);
			pLevelAwardFile->GetInteger(j + 1, "Dodge", 0, &pNumericalAward->nDodge);
			pLevelAwardFile->GetInteger(j + 1, "Crit", 0, &pNumericalAward->nCrit);
			pLevelAwardFile->GetInteger(j + 1, "Resist", 0, &pNumericalAward->nResist);
			pLevelAwardFile->GetInteger(j + 1, "Cost", 0, &pNumericalAward->nCost);

			pModuleAward->vecNumericalAwards.push_back(pNumericalAward);
			pModuleAward->vecNumericalIDs.push_back(pNumericalAward->nLevel);
		}

		m_vecModuleNumericalAwards.push_back(pModuleAward);
	}

	return TRUE;
}
示例#4
0
BOOL KAwardSetting::ReadAssetAwardConfigs()
{
	CHAR szLevelAwardName[_MAX_PATH];
	ITabFile* pAssetAwardFile = NULL;
	QString szFileTemp;

	ITabFile* pTabFile = g_OpenTabFile(ASSET_AWARD_FILE);
	QCONFIRM_RET_FALSE(pTabFile);

	for (INT i = 1; i < pTabFile->GetHeight(); i++)
	{
		QModuleAssetAward* pModuleAssetAward = new QModuleAssetAward();
		QCONFIRM_RET_FALSE(pModuleAssetAward);

		pTabFile->GetString(i + 1, "ModuleName", "", pModuleAssetAward->szModuleName, MAX_NAME_LEN);
		pTabFile->GetString(i + 1, "LevelAwardName", "", szLevelAwardName, _MAX_PATH);

		szFileTemp = ASSET_AWARD_FILE_FOLDER;
		szFileTemp = szFileTemp + szLevelAwardName;

		pAssetAwardFile = g_OpenTabFile(szFileTemp.CStr());
		assert(pAssetAwardFile);
		QCONFIRM_RET_FALSE(pAssetAwardFile);

		for (INT j = 2; j < pAssetAwardFile->GetHeight(); j++)
		{
			QAssetAward* pAssetAward = new QAssetAward();
			QCONFIRM_RET_FALSE(pAssetAward);

			pAssetAwardFile->GetInteger(j + 1, "Level", 0, &pAssetAward->nLevel);

			pAssetAwardFile->GetInteger(j + 1, "IsSave", 0, &pAssetAward->nSave);
			pAssetAwardFile->GetInteger(j + 1, "OverlayDay", 0, &pAssetAward->nOverlayDay);
			pAssetAwardFile->GetInteger(j + 1, "AutoGive", 0, &pAssetAward->nAutoGive);
			pAssetAwardFile->GetInteger(j + 1, "IsSync", 0, &pAssetAward->nSync);

			pAssetAwardFile->GetInteger(j + 1, "FightingSpirit", 0, &pAssetAward->nFightingSpirit);
			pAssetAwardFile->GetInteger(j + 1, "Energy", 0, &pAssetAward->nEnergy);
			pAssetAwardFile->GetInteger(j + 1, "Prestige", 0, &pAssetAward->nPrestige);
			pAssetAwardFile->GetInteger(j + 1, "Silver", 0, &pAssetAward->nSilver);
			pAssetAwardFile->GetInteger(j + 1, "Exp", 0, &pAssetAward->nExpAwardId);

			ZeroMemory(&pAssetAward->arrAwardItem, sizeof(pAssetAward->arrAwardItem));

			for(INT k = 0; k < ASSET_AWARD_MAX_ITEM_NUM; ++k)
			{
				CHAR szItem[20];
				CHAR szTabItem[10];
				CHAR szTabItemAmountMin[20];
				CHAR szTabItemAmountMax[20];
				CHAR szTabItemRate[15];
				CHAR szTabItemTimeOut[20];

				snprintf(szTabItem, sizeof(szTabItem), "Item%d", k + 1);
				snprintf(szTabItemAmountMin, sizeof(szTabItemAmountMin), "Item%dAmountMin", k + 1);
				snprintf(szTabItemAmountMax, sizeof(szTabItemAmountMax), "Item%dAmountMax", k + 1);
				snprintf(szTabItemRate, sizeof(szTabItemRate), "Item%dRate", k + 1);
				snprintf(szTabItemTimeOut, sizeof(szTabItemTimeOut), "Item%dTimeOut", k + 1);

				pAssetAwardFile->GetString(j + 1, szTabItem, "", szItem, 20);
				std::string strItem(szItem);

				if(!strItem.size())
				{
					pAssetAward->nItemNum = k;
					break;
				}

				{
					INT nIdx = 0;
					std::basic_string<char>::size_type iBegin = 0, iEnd = 0;
					while((iEnd = strItem.find(',', iBegin)) != std::string::npos)
					{
						switch(nIdx++)
						{
						case 0:
							pAssetAward->arrAwardItem[k].sIndex.nGenre = atoi((strItem.substr(iBegin, iEnd - iBegin)).c_str());
							break;
						case 1:
							pAssetAward->arrAwardItem[k].sIndex.nDetailType = atoi((strItem.substr(iBegin, iEnd - iBegin)).c_str());
							break;
						case 2:
							pAssetAward->arrAwardItem[k].sIndex.nParticular = atoi((strItem.substr(iBegin, iEnd - iBegin)).c_str());
							break;
						default:
							ASSERT(FALSE);
						}
						iBegin = iEnd + 1;
					}
					if(iBegin < strItem.size())
					{
						pAssetAward->arrAwardItem[k].sIndex.nLevel = atoi((strItem.substr(iBegin, strItem.size() - iBegin)).c_str());
					}
				}

				pAssetAwardFile->GetInteger(j + 1, szTabItemAmountMin, 0, &pAssetAward->arrAwardItem[k].nAmountMin);
				pAssetAwardFile->GetInteger(j + 1, szTabItemAmountMax, 0, &pAssetAward->arrAwardItem[k].nAmountMax);
				pAssetAwardFile->GetInteger(j + 1, szTabItemRate, 0, &pAssetAward->arrAwardItem[k].nRate);
				pAssetAwardFile->GetInteger(j + 1, szTabItemTimeOut, 0, &pAssetAward->arrAwardItem[k].nTimeOut);

			}
			pModuleAssetAward->mapAssetAwards[pAssetAward->nLevel] = pAssetAward;
		}

		m_vecModuleAssetAwards.push_back(pModuleAssetAward);
	}

	return TRUE;
}