BOOL KSkillManager::LoadAttributes(BYTE*& pBuffer, size_t& uBufferSize, std::vector<KAttribData>& rVecAttributes) { BOOL bResult = false; BOOL bRetCode = false; KAttribData* pAttribData = NULL; unsigned short attributeCount = 0; const size_t MAX_ATTRIBUTE_NAME_SIZE = 32; char szAttributeName[MAX_ATTRIBUTE_NAME_SIZE]; bRetCode = g_ReadFromBufferTo(pBuffer, uBufferSize, attributeCount); KGLOG_PROCESS_ERROR(bRetCode); rVecAttributes.resize(attributeCount); for (size_t i = 0; i < attributeCount; ++i) { bRetCode = g_ReadStringFromBuffer(pBuffer, uBufferSize, szAttributeName, countof(szAttributeName)); KGLOG_PROCESS_ERROR(bRetCode); szAttributeName[countof(szAttributeName) - 1] = '\0'; bRetCode = ENUM_STR2INT(ATTRIBUTE_TYPE, szAttributeName,rVecAttributes[i].nKey); KGLOG_PROCESS_ERROR(bRetCode); bRetCode = g_ReadFromBufferTo(pBuffer, uBufferSize, rVecAttributes[i].nValue1); KGLOG_PROCESS_ERROR(bRetCode); bRetCode = g_ReadFromBufferTo(pBuffer, uBufferSize, rVecAttributes[i].nValue2); KGLOG_PROCESS_ERROR(bRetCode); } bResult = true; Exit0: return bResult; }
BOOL KActiveSettings::LoadData() { BOOL bResult = false; BOOL bRetCode = false; int nHeight = 0; int nEvent = 0; DWORD dwID = ERROR_ID; DWORD dwNextID = 1; ITabFile* piTabFile = NULL; char szEvent[64] = {0}; KActiveSettingsItem* pActiveInfo = NULL; KVEC_ACTIVE_UPDATOR* pvecActive = NULL; KMAP_ACTIVE_UPDATOR::iterator it; piTabFile = g_OpenTabFile(SETTING_DIR"/ActivePlayer.tab"); KGLOG_PROCESS_ERROR(piTabFile); nHeight = piTabFile->GetHeight(); m_vecActive.resize(nHeight - 1); for(int nRow = 2; nRow <= nHeight; ++nRow) { bRetCode = piTabFile->GetInteger(nRow, "ID", 0, (int*)&dwID); KGLOG_PROCESS_ERROR(bRetCode > 0); KGLOG_PROCESS_ERROR(dwID == dwNextID); ++dwNextID; pActiveInfo = &m_vecActive[dwID - 1]; pActiveInfo->dwID = dwID; szEvent[0] = '\0'; bRetCode = piTabFile->GetString(nRow, "Event", "peInvalid", szEvent, sizeof(szEvent)); KGLOG_PROCESS_ERROR(bRetCode); bRetCode = ENUM_STR2INT(PLAYER_EVENT_TYPE, szEvent, pActiveInfo->nEvent); KGLOG_PROCESS_ERROR(bRetCode); bRetCode = piTabFile->GetInteger(nRow, "FinishValue", 0, (int*)&(pActiveInfo->nFininshValue)); KGLOG_PROCESS_ERROR(bRetCode > 0); bRetCode = piTabFile->GetInteger(nRow, "UnLimitCount", 0, (BOOL*)&(pActiveInfo->bUnLimit)); KGLOG_PROCESS_ERROR(bRetCode > 0); bRetCode = piTabFile->GetInteger(nRow, "ActivePoint", 0, (int*)&(pActiveInfo->nAwardActive)); KGLOG_PROCESS_ERROR(bRetCode > 0); it = m_mapValueUpdator.find(pActiveInfo->nEvent); if (it == m_mapValueUpdator.end()) { pvecActive = KMEMORY_NEW(KVEC_ACTIVE_UPDATOR); m_mapValueUpdator[pActiveInfo->nEvent] = pvecActive; } else { pvecActive = it->second; } pvecActive->push_back(dwID); pvecActive = NULL; } Exit1: bResult = true; Exit0: KG_COM_RELEASE(piTabFile); return bResult; }
BOOL KAwardMgr::LoadOneAward(const char cszAwardFile[], KAwardTable* pAwardTable) { BOOL bResult = false; BOOL bRetCode = false; ITabFile* piTabFile = NULL; DWORD dwAwardItemID = 0; char szFilePath[MAX_PATH]; std::pair<KAWARD_ITEM_MAP::iterator, bool> InsRet; KAWARD_ITEM* pAwardItem = NULL; char szValue[64]; assert(cszAwardFile); assert(pAwardTable); snprintf(szFilePath, sizeof(szFilePath), "%s/%s/%s", SETTING_DIR, "award", cszAwardFile); szFilePath[sizeof(szFilePath) - 1] = '\0'; strncpy(pAwardTable->m_szAwardTableName, szFilePath, sizeof(pAwardTable->m_szAwardTableName)); pAwardTable->m_szAwardTableName[countof(pAwardTable->m_szAwardTableName) - 1] = '\0'; piTabFile = g_OpenTabFile(szFilePath); KGLOG_PROCESS_ERROR(piTabFile); for (int nRowIndex = 2; nRowIndex <= piTabFile->GetHeight(); nRowIndex++) { bRetCode = piTabFile->GetInteger(nRowIndex, "ID", 0, (int*)&dwAwardItemID); KGLOG_PROCESS_ERROR(bRetCode); KGLOG_PROCESS_ERROR(dwAwardItemID > 0); InsRet = pAwardTable->m_mapAwardItem.insert(std::make_pair(dwAwardItemID, KAWARD_ITEM())); KGLOG_PROCESS_ERROR(InsRet.second); pAwardItem = &InsRet.first->second; pAwardItem->dwID = dwAwardItemID; bRetCode = piTabFile->GetInteger(nRowIndex, "Tabtype", 0, (int*)&pAwardItem->dwTabType); KGLOG_PROCESS_ERROR(bRetCode); bRetCode = piTabFile->GetInteger(nRowIndex, "TabIndex", 0, (int*)&pAwardItem->dwIndex); KGLOG_PROCESS_ERROR(bRetCode); bRetCode = piTabFile->GetInteger(nRowIndex, "Stacknum", 0, (int*)&pAwardItem->nStackNum); KGLOG_PROCESS_ERROR(bRetCode); bRetCode = piTabFile->GetInteger(nRowIndex, "MoneyType", emotMoney, (int*)&pAwardItem->eMoneyType); KGLOG_PROCESS_ERROR(bRetCode); KGLOG_PROCESS_ERROR(pAwardItem->eMoneyType == emotMoney || pAwardItem->eMoneyType == emotMenterPoint); bRetCode = piTabFile->GetInteger(nRowIndex, "Money", 0, (int*)&pAwardItem->nMoney); KGLOG_PROCESS_ERROR(bRetCode); bRetCode = piTabFile->GetInteger(nRowIndex, "BuffID", 0, (int*)&pAwardItem->dwBuffID); KGLOG_PROCESS_ERROR(bRetCode); bRetCode = piTabFile->GetInteger(nRowIndex, "AwardItemRate", 0, (int*)&pAwardItem->nAwardItemRate); KGLOG_PROCESS_ERROR(bRetCode); pAwardItem->nQualityLevel = -1; bRetCode = piTabFile->GetString(nRowIndex, "QualityLevel", "", szValue, sizeof(szValue)); KGLOG_PROCESS_ERROR(bRetCode); szValue[countof(szValue) - 1] = '\0'; if (bRetCode > 0) { bRetCode = ENUM_STR2INT(ENUM_EQUIP_QUALITY, szValue, pAwardItem->nQualityLevel); KGLOG_PROCESS_ERROR(bRetCode); } bRetCode = piTabFile->GetInteger(nRowIndex, "MinValuePoint", 0, &pAwardItem->nMinValuePoint); KGLOG_PROCESS_ERROR(bRetCode); bRetCode = piTabFile->GetInteger(nRowIndex, "MaxValuePoint", 0, &pAwardItem->nMaxValuePoint); KGLOG_PROCESS_ERROR(bRetCode); KGLOG_PROCESS_ERROR(pAwardItem->nMaxValuePoint >= pAwardItem->nMinValuePoint && pAwardItem->nMinValuePoint >= 0); bRetCode = piTabFile->GetInteger(nRowIndex, "IsBroadcast", 0, &pAwardItem->bIsBroadcast); KGLOG_PROCESS_ERROR(bRetCode); } pAwardTable->RatePreProcess(); bResult = true; Exit0: KG_COM_RELEASE(piTabFile); return bResult; }
BOOL KPlayerValueInfoList::LoadData() { BOOL bResult = false; BOOL bRetCode = false; int nHeight = 0; ITabFile* piTabFile = NULL; DWORD dwNextID = 1; size_t uBitCount = 0; DWORD dwID = 0; size_t uOffset = 0; char szTemp[_NAME_LEN]; KPlayerValueInfo* pPlayerValueInfo = NULL; piTabFile = g_OpenTabFile(SETTING_DIR"/PlayerValue.tab"); KGLOG_PROCESS_ERROR(piTabFile); nHeight = piTabFile->GetHeight(); KGLOG_PROCESS_ERROR(nHeight > 0); m_vecPlayerValueInfo.resize(nHeight - 1); m_vecDailyReset.reserve(nHeight - 1); m_vecDailyReset.reserve(nHeight - 1); for(int nRow = 2; nRow <= nHeight; ++nRow) { bRetCode = piTabFile->GetInteger(nRow, "ID", 0, (int*)&dwID); KGLOG_PROCESS_ERROR(bRetCode > 0); KGLOG_PROCESS_ERROR(dwID == dwNextID); ++dwNextID; pPlayerValueInfo = &m_vecPlayerValueInfo[dwID - 1]; memset(pPlayerValueInfo, 0, sizeof(KPlayerValueInfo)); pPlayerValueInfo->dwID = dwID; pPlayerValueInfo->uOffset = uOffset; bRetCode = piTabFile->GetString(nRow, "Type", "", szTemp, sizeof(szTemp)); KGLOG_PROCESS_ERROR(bRetCode > 0); szTemp[countof(szTemp) - 1] = '\0'; bRetCode = ENUM_STR2INT(PLAYER_VALUE_TYPE, szTemp, pPlayerValueInfo->nType); KGLOG_PROCESS_ERROR(bRetCode); KGLOG_PROCESS_ERROR(pPlayerValueInfo->nType == KPLAYER_VALUE_TYPE_BOOLEAN || uOffset % UINT32_BIT_COUNT == 0 ); bRetCode = piTabFile->GetInteger(nRow, "IsInUse", 0, &pPlayerValueInfo->bIsInUse); KGLOG_PROCESS_ERROR(bRetCode > 0); bRetCode = piTabFile->GetString(nRow, "SetType", "", szTemp, sizeof(szTemp)); KGLOG_PROCESS_ERROR(bRetCode > 0); bRetCode = ENUM_STR2INT(KPLAYERVALUE_SET_TYPE, szTemp, pPlayerValueInfo->nSetType); KGLOG_PROCESS_ERROR(bRetCode); bRetCode = piTabFile->GetString(nRow, "ResetType", "", szTemp, sizeof(szTemp)); KGLOG_PROCESS_ERROR(bRetCode > 0); bRetCode = ENUM_STR2INT(KRESET_TYPE, szTemp, pPlayerValueInfo->nResetType); KGLOG_PROCESS_ERROR(bRetCode); bRetCode = GetBitCountOfType(pPlayerValueInfo->nType, uBitCount); KGLOG_PROCESS_ERROR(bRetCode); bRetCode = piTabFile->GetString(nRow, "ActivityGroup", "KACTIVITY_GROUP_INVALID", szTemp, sizeof(szTemp)); KGLOG_PROCESS_ERROR(bRetCode); bRetCode = ENUM_STR2INT(KACTIVITY_GROUP, szTemp, pPlayerValueInfo->nActivityGroup); KGLOG_PROCESS_ERROR(bRetCode); uOffset += uBitCount; switch(pPlayerValueInfo->nResetType) { case KRESET_TYPE_DAILY: m_vecDailyReset.push_back(pPlayerValueInfo); break; case KRESET_TYPE_WEEKLY: m_vecWeeklyReset.push_back(pPlayerValueInfo); break; case KRESET_TYPE_MONTHLY: m_vecMonthlyReset.push_back(pPlayerValueInfo); break; default: break; } m_PlayerValueGroup[pPlayerValueInfo->nActivityGroup].push_back(pPlayerValueInfo); } m_uTotalBytes = uOffset / 8 + 1; KGLOG_PROCESS_ERROR(m_uTotalBytes <= MAX_PLAYERVALUE_BYTES); bResult = true; Exit0: if (!bResult) { KGLogPrintf(KGLOG_DEBUG, "ID:%u", dwID); } KG_COM_RELEASE(piTabFile); return bResult; }
BOOL KAchievementSettings::LoadData() { BOOL bResult = false; BOOL bRetCode = false; int nHeight = 0; DWORD dwID = ERROR_ID; DWORD dwNextID = 1; ITabFile* piTabFile = NULL; KAchievementSettingsItem* pAchievementInfo = NULL; char szKey[64]; char szValue[256]; piTabFile = g_OpenTabFile(SETTING_DIR"/Achievement.tab"); KGLOG_PROCESS_ERROR(piTabFile); nHeight = piTabFile->GetHeight(); if (nHeight > 1 && nHeight - 1 <= cdMaxAchievenmentCount) m_vecAchievement.resize(nHeight - 1); for(int nRow = 2; nRow <= nHeight; ++nRow) { bRetCode = piTabFile->GetInteger(nRow, "ID", 0, (int*)&dwID); KGLOG_PROCESS_ERROR(bRetCode > 0); KGLOG_PROCESS_ERROR(dwID == dwNextID); ++dwNextID; pAchievementInfo = &m_vecAchievement[dwID - 1]; pAchievementInfo->dwID = dwID; bRetCode = piTabFile->GetInteger(nRow, "Expired", 0, &pAchievementInfo->bExpired); KGLOG_PROCESS_ERROR(bRetCode); bRetCode = piTabFile->GetInteger(nRow, "AchievementPoint", 0, &pAchievementInfo->nAchievementPoint); KGLOG_PROCESS_ERROR(bRetCode); KGLOG_PROCESS_ERROR(pAchievementInfo->nAchievementPoint >= 0); bRetCode = piTabFile->GetInteger(nRow, "AutoFinish", 0, &pAchievementInfo->bAutoFinish); KGLOG_PROCESS_ERROR(bRetCode); bRetCode = piTabFile->GetInteger(nRow, "MessageToFriend", 0, &pAchievementInfo->bMessageToFriend); KGLOG_PROCESS_ERROR(bRetCode); bRetCode = piTabFile->GetInteger(nRow, "MessageToServer", 0, &pAchievementInfo->bMessageToServer); KGLOG_PROCESS_ERROR(bRetCode); bRetCode = piTabFile->GetInteger(nRow, "MessageToClub", 0, &pAchievementInfo->bMessageToClub); KGLOG_PROCESS_ERROR(bRetCode); bRetCode = piTabFile->GetString(nRow, "AwardItem", "0,0,0,0", szValue, sizeof(szValue)); KGLOG_PROCESS_ERROR(bRetCode); bRetCode = sscanf(szValue, "%u,%u,%d,%d", &pAchievementInfo->dwAwardItemType, &pAchievementInfo->dwAwardItemIndex, &pAchievementInfo->nAwardItemCount, &pAchievementInfo->nAwardItemValuePoint); KGLOG_PROCESS_ERROR(bRetCode == 4); bRetCode = piTabFile->GetString(nRow, "Event", "peInvalid", szValue, sizeof(szValue)); KGLOG_PROCESS_ERROR(bRetCode); bRetCode = ENUM_STR2INT(PLAYER_EVENT_TYPE, szValue, pAchievementInfo->cEventCondition.nEvent); KGLOG_PROCESS_ERROR(bRetCode); for (int i = 0; i < countof(pAchievementInfo->cEventCondition.AllCondition); ++i) { sprintf(szKey, "Param%dConditon", i + 1); bRetCode = piTabFile->GetString(nRow, szKey, "", szValue, sizeof(szValue)); KGLOG_PROCESS_ERROR(bRetCode); bRetCode = pAchievementInfo->cEventCondition.AllCondition[i].InitFromString(szValue); KGLOG_PROCESS_ERROR(bRetCode); } bRetCode = piTabFile->GetString(nRow, "ValueUpdateType", "", szValue, sizeof(szValue)); KGLOG_PROCESS_ERROR(bRetCode); bRetCode = LoadUpdator(szValue, pAchievementInfo); KGLOG_PROCESS_ERROR(bRetCode); bRetCode = piTabFile->GetInteger(nRow, "TargetValue", 0, &pAchievementInfo->nTargetValue); KGLOG_PROCESS_ERROR(bRetCode); bRetCode = piTabFile->GetString(nRow, "Type", "", szValue, sizeof(szValue)); KGLOG_PROCESS_ERROR(bRetCode > 0); bRetCode = ENUM_STR2INT(KACHIEVEMENT_TYPE, szValue, pAchievementInfo->nAchievementType); KGLOG_PROCESS_ERROR(bRetCode); switch(pAchievementInfo->nAchievementType) { case KACHIEVEMENT_TYPE_DAILY: m_vecDailyAchievement.push_back(pAchievementInfo); break; case KACHIEVEMENT_TYPE_WEEKLY: m_vecWeekyAchievement.push_back(pAchievementInfo); break; default: break; } } Exit1: bResult = true; Exit0: KG_COM_RELEASE(piTabFile); return bResult; }
BOOL KSkillManager::LoadSkillTable() { BOOL bResult = false; BOOL bRetCode = false; DWORD dwSkillID = 0; DWORD dwStepID = 0; KSkill* pSkill = NULL; ITabFile* piTabFile = NULL; std::pair<KSkillTable::iterator, bool> InsRet; const int MAX_COLUMN_NAME_LEN = 64; char szMoveState[MAX_COLUMN_NAME_LEN] = ""; KAttribData AttributeData; KMAP_SKILL_DATA cSkillBinaryData; KMAP_SKILL_DATA::iterator it; char szValue[64]; char szScriptName[MAX_PATH]; bRetCode = LoadSkillBinaryData(cSkillBinaryData); KGLOG_PROCESS_ERROR(bRetCode); piTabFile = g_OpenTabFile(SETTING_DIR"/"SKILL_LIST_FILE_NAME); KGLOG_PROCESS_ERROR(piTabFile); for (int nRowIndex = 2; nRowIndex <= piTabFile->GetHeight(); nRowIndex++) { bRetCode = piTabFile->GetInteger(nRowIndex, "ID", 0, (int*)(&dwSkillID)); KGLOG_PROCESS_ERROR(bRetCode > 0); bRetCode = piTabFile->GetInteger(nRowIndex, "Step", 0, (int*)(&dwStepID)); KGLOG_PROCESS_ERROR(bRetCode); KGLOG_PROCESS_ERROR(dwStepID >= 0); InsRet = m_SkillTable.insert(std::make_pair(MAKE_INT64(dwSkillID, dwStepID), KSkill())); KGLOG_PROCESS_ERROR(InsRet.second); pSkill = &(InsRet.first->second); pSkill->m_dwID = dwSkillID; pSkill->m_dwStepID = dwStepID; bRetCode = piTabFile->GetInteger(nRowIndex, "NirvanaSkill", 0, &pSkill->m_bNirvanaSkill); KGLOG_PROCESS_ERROR(bRetCode); bRetCode = piTabFile->GetString(nRowIndex, "BelongToSlot", "", szValue, sizeof(szValue)); KGLOG_PROCESS_ERROR(bRetCode); bRetCode = g_ParseMutiInteger(szValue, ";", pSkill->m_vecBelongToSlots); KGLOG_PROCESS_ERROR(bRetCode); bRetCode = piTabFile->GetInteger(nRowIndex, "SrcBuffID", 0, (int*)(&pSkill->m_dwSrcBuffID)); KGLOG_PROCESS_ERROR(bRetCode); bRetCode = piTabFile->GetInteger(nRowIndex, "DestBuffID", 0, (int*)(&pSkill->m_dwDestBuffID)); KGLOG_PROCESS_ERROR(bRetCode); bRetCode = piTabFile->GetInteger(nRowIndex, "AimType", 0, (int*)(&pSkill->m_dwAimType)); KGLOG_PROCESS_ERROR(bRetCode); for (int i = 1; i <= 8; i++) { bRetCode = LoadAttribute(piTabFile, nRowIndex, "SrcAttribute", i, &AttributeData); KGLOG_PROCESS_ERROR(bRetCode); if (AttributeData.nKey != atInvalid) { APPEND_ATTRIB(pSkill->m_pSrcAttribute, AttributeData); } bRetCode = LoadAttribute(piTabFile, nRowIndex, "DestAttribute", i, &AttributeData); KGLOG_PROCESS_ERROR(bRetCode); if (AttributeData.nKey != atInvalid) { APPEND_ATTRIB(pSkill->m_pDestAttribute, AttributeData); } } bRetCode = piTabFile->GetInteger(nRowIndex, "CanCastWithBall", 0, &pSkill->m_bCanCastWithBall); KGLOG_PROCESS_ERROR(bRetCode); bRetCode = piTabFile->GetInteger(nRowIndex, "SkillType", skilltypeInvalid, (int*)&pSkill->m_eSkillType); KGLOG_PROCESS_ERROR(bRetCode); bRetCode = piTabFile->GetInteger(nRowIndex, "AttackIntervalFrame", 0, &pSkill->m_nAttackIntervalFrame); KGLOG_PROCESS_ERROR(bRetCode); bRetCode = piTabFile->GetInteger(nRowIndex, "TargetCostEndurance", 0, &pSkill->m_nTargetCostEndurance); KGLOG_PROCESS_ERROR(bRetCode); bRetCode = piTabFile->GetInteger(nRowIndex, "TargetCostStamina", 0, &pSkill->m_nTargetCostStamina); KGLOG_PROCESS_ERROR(bRetCode); bRetCode = piTabFile->GetInteger(nRowIndex, "TargetCostEndurancePercent", 0, &pSkill->m_nTargetCostEndurancePercent); KGLOG_PROCESS_ERROR(bRetCode); bRetCode = piTabFile->GetInteger(nRowIndex, "TargetCostStaminaPercent", 0, &pSkill->m_nTargetCostStaminaPercent); KGLOG_PROCESS_ERROR(bRetCode); bRetCode = piTabFile->GetString(nRowIndex, "MoveState", "cmsInvalid", szMoveState, sizeof(szMoveState)); KGLOG_PROCESS_ERROR(bRetCode); bRetCode = ENUM_STR2INT(HERO_MOVESTATE, szMoveState, pSkill->m_nMoveState); KGLOG_PROCESS_ERROR(bRetCode); bRetCode = piTabFile->GetInteger(nRowIndex, "MoveStateFrame", 0, &pSkill->m_nMoveStateFrame); KGLOG_PROCESS_ERROR(bRetCode); pSkill->m_nMoveStateFrame = pSkill->m_nMoveStateFrame * GAME_FPS / cdTimeBase; bRetCode = piTabFile->GetInteger(nRowIndex, "StepMinTime", 0, &pSkill->m_nStepMinFrame); KGLOG_PROCESS_ERROR(bRetCode); pSkill->m_nStepMinFrame = pSkill->m_nStepMinFrame * GAME_FPS / cdTimeBase; bRetCode = piTabFile->GetInteger(nRowIndex, "StepMaxTime", 0, &pSkill->m_nStepMaxFrame); KGLOG_PROCESS_ERROR(bRetCode); pSkill->m_nStepMaxFrame = pSkill->m_nStepMaxFrame * GAME_FPS / cdTimeBase; bRetCode = piTabFile->GetInteger(nRowIndex, "EndType", 0, (int*)&pSkill->m_eEndType); KGLOG_PROCESS_ERROR(bRetCode); bRetCode = piTabFile->GetInteger(nRowIndex, "EndFrame", 0, &pSkill->m_nEndFrame); KGLOG_PROCESS_ERROR(bRetCode); bRetCode = piTabFile->GetInteger(nRowIndex, "InterruptLevel", 0, &pSkill->m_nInterruptLevel); KGLOG_PROCESS_ERROR(bRetCode); bRetCode = piTabFile->GetString(nRowIndex, "Script", "", szScriptName, sizeof(szScriptName)); KGLOG_PROCESS_ERROR(bRetCode); szScriptName[sizeof(szScriptName) - 1] = '\0'; if (szScriptName[0] != '\0') pSkill->m_dwScriptID = g_FileNameHash(szScriptName); else pSkill->m_dwScriptID = 0; for (int i = 0; i < countof(pSkill->m_SubSkill); ++i) { char szKey[32] = ""; sprintf(szKey, "SubSkillID%d", i+1); bRetCode = piTabFile->GetInteger(nRowIndex, szKey, ERROR_ID, (int*)&pSkill->m_SubSkill[i].dwID); KGLOG_PROCESS_ERROR(bRetCode); sprintf(szKey, "SubSkillTriggerType%d", i+1); bRetCode = piTabFile->GetInteger(nRowIndex, szKey, KSKILL_TRIGGER_TYPE_INVALID, (int*)&pSkill->m_SubSkill[i].eType); KGLOG_PROCESS_ERROR(bRetCode); sprintf(szKey, "SubSkillTriggerTimer%d", i+1); bRetCode = piTabFile->GetInteger(nRowIndex, szKey, 0, &pSkill->m_SubSkill[i].nFrame); KGLOG_PROCESS_ERROR(bRetCode); pSkill->m_SubSkill[i].nFrame = pSkill->m_SubSkill[i].nFrame * GAME_FPS / cdTimeBase; sprintf(szKey, "SubSkillRate%d", i+1); bRetCode = piTabFile->GetInteger(nRowIndex, szKey, 0, (int*)&pSkill->m_SubSkill[i].dwRate); KGLOG_PROCESS_ERROR(bRetCode); } bRetCode = piTabFile->GetInteger(nRowIndex, "SelfAddAngry", 0, &pSkill->m_nSelfAddAngry); KGLOG_PROCESS_ERROR(bRetCode); bRetCode = piTabFile->GetInteger(nRowIndex, "TargetAddAngry", 0, &pSkill->m_nTargetAddAngry); KGLOG_PROCESS_ERROR(bRetCode); bRetCode = piTabFile->GetInteger(nRowIndex, "NeedAngry", 0, &pSkill->m_nNeedAngry); KGLOG_PROCESS_ERROR(bRetCode); bRetCode = piTabFile->GetInteger(nRowIndex, "CostAngry", 0, &pSkill->m_nCostAngry); KGLOG_PROCESS_ERROR(bRetCode); bRetCode = piTabFile->GetInteger(nRowIndex, "CostAngryPercent", 0, &pSkill->m_nCostAngryPercent); KGLOG_PROCESS_ERROR(bRetCode); bRetCode = piTabFile->GetInteger(nRowIndex, "TargetBuffLimit", 0, (int*)&pSkill->m_dwTargetBuffLimit); KGLOG_PROCESS_ERROR(bRetCode); bRetCode = piTabFile->GetInteger(nRowIndex, "CanCastCountInAir", 0, &pSkill->m_nCanCastCountInAir); KGLOG_PROCESS_ERROR(bRetCode); bRetCode = piTabFile->GetInteger(nRowIndex, "SpasticityTime", 0, &pSkill->m_nSpasticityFrame); KGLOG_PROCESS_ERROR(bRetCode); pSkill->m_nSpasticityFrame = pSkill->m_nSpasticityFrame * GAME_FPS / cdTimeBase; bRetCode = piTabFile->GetInteger(nRowIndex, "DelayEffect", 0, &pSkill->m_bDelayApplySkillEffect); KGLOG_PROCESS_ERROR(bRetCode); bRetCode = piTabFile->GetInteger(nRowIndex, "Invincible", 0, &pSkill->m_bInvincibleOnSpasticity); KGLOG_PROCESS_ERROR(bRetCode); bRetCode = piTabFile->GetInteger(nRowIndex, "IsCommonSkill", 0, (int*)&pSkill->m_bIsCommonSkill); KGLOG_PROCESS_ERROR(bRetCode); bRetCode = piTabFile->GetInteger(nRowIndex, "RequireLevel", 0, (int*)&pSkill->m_nRequireLevel); KGLOG_PROCESS_ERROR(bRetCode); bRetCode = piTabFile->GetInteger(nRowIndex, "GravityPercent", 0, &pSkill->m_nGravityPercent); KGLOG_PROCESS_ERROR(bRetCode > 0); bRetCode = piTabFile->GetInteger(nRowIndex, "JudgeBoxMinX", 0, &pSkill->m_nJudgeBoxMinX); KGLOG_PROCESS_ERROR(bRetCode > 0); bRetCode = piTabFile->GetInteger(nRowIndex, "JudgeBoxMaxX", 0, &pSkill->m_nJudgeBoxMaxX); KGLOG_PROCESS_ERROR(bRetCode > 0); bRetCode = piTabFile->GetInteger(nRowIndex, "JudgeBoxMinY", 0, &pSkill->m_nJudgeBoxMinY); KGLOG_PROCESS_ERROR(bRetCode > 0); bRetCode = piTabFile->GetInteger(nRowIndex, "JudgeBoxMaxY", 0, &pSkill->m_nJudgeBoxMaxY); KGLOG_PROCESS_ERROR(bRetCode > 0); bRetCode = piTabFile->GetInteger(nRowIndex, "JudgeBoxMinZ", 0, &pSkill->m_nJudgeBoxMinZ); KGLOG_PROCESS_ERROR(bRetCode > 0); bRetCode = piTabFile->GetInteger(nRowIndex, "JudgeBoxMaxZ", 0, &pSkill->m_nJudgeBoxMaxZ); KGLOG_PROCESS_ERROR(bRetCode > 0); bRetCode = piTabFile->GetInteger(nRowIndex, "CanSpecifyCastDir", 0, &pSkill->m_bCanSpecifyCastDir); KGLOG_PROCESS_ERROR(bRetCode > 0); bRetCode = piTabFile->GetInteger(nRowIndex, "CanSpecifyCastingDir", 0, &pSkill->m_bCanSpecifyCastingDir); KGLOG_PROCESS_ERROR(bRetCode > 0); bRetCode = piTabFile->GetString(nRowIndex, "RestraintType", "", szValue, countof(szValue)); KGLOG_PROCESS_ERROR(bRetCode > 0); szValue[countof(szValue) - 1] = '\0'; bRetCode = EnumStr2Int("RESTRAINT_TYPE", szValue, &pSkill->m_nRestraintType); KGLOG_PROCESS_ERROR(bRetCode); bRetCode = piTabFile->GetInteger(nRowIndex, "ClearVelocityAtEnd", 0, &pSkill->m_bClearVelocityAtEnd); KGLOG_PROCESS_ERROR(bRetCode > 0); bRetCode = piTabFile->GetInteger(nRowIndex, "Series", 0, &pSkill->m_nSeries); KGLOG_PROCESS_ERROR(bRetCode); bRetCode = piTabFile->GetInteger(nRowIndex, "FireAIEvent", 0, &pSkill->m_bFireAIEvent); KGLOG_PROCESS_ERROR(bRetCode); bRetCode = piTabFile->GetInteger(nRowIndex, "AIEventMinX", 0, &pSkill->m_nAIEventMinX); KGLOG_PROCESS_ERROR(bRetCode); bRetCode = piTabFile->GetInteger(nRowIndex, "AIEventMaxX", 0, &pSkill->m_nAIEventMaxX); KGLOG_PROCESS_ERROR(bRetCode); bRetCode = piTabFile->GetInteger(nRowIndex, "AIEventMinY", 0, &pSkill->m_nAIEventMinY); KGLOG_PROCESS_ERROR(bRetCode); bRetCode = piTabFile->GetInteger(nRowIndex, "AIEventMaxY", 0, &pSkill->m_nAIEventMaxY); KGLOG_PROCESS_ERROR(bRetCode); bRetCode = piTabFile->GetInteger(nRowIndex, "AIEventMinZ", 0, &pSkill->m_nAIEventMinZ); KGLOG_PROCESS_ERROR(bRetCode); bRetCode = piTabFile->GetInteger(nRowIndex, "AIEventMaxZ", 0, &pSkill->m_nAIEventMaxZ); KGLOG_PROCESS_ERROR(bRetCode); it = cSkillBinaryData.find(InsRet.first->first); if (it != cSkillBinaryData.end()) { pSkill->SetBinaryData(it->second); } // 以下代码用于验证输入内容的合法性 KGLOG_PROCESS_ERROR(pSkill->m_eSkillType > skilltypeInvalid && pSkill->m_eSkillType < skilltypeTotal); KGLOG_PROCESS_ERROR(pSkill->m_nMoveState >= cmsInvalid && pSkill->m_nMoveState < cmsTotal); KGLOG_PROCESS_ERROR(pSkill->m_eEndType >= KSKILL_END_TYPE_NONE && pSkill->m_eEndType < KSKILL_END_TYPE_TOTAL); // KGLOG_PROCESS_ERROR(pSkill->m_eSkillType != skilltypeGrab || pSkill->m_eEndType == KSKILL_END_TYPE_BY_TIME); KGLOG_PROCESS_ERROR(pSkill->m_eEndType != KSKILL_END_TYPE_BY_TIME || pSkill->m_nEndFrame >= 0); KGLOG_PROCESS_ERROR(pSkill->m_nSpasticityFrame >= 0); KGLOG_PROCESS_ERROR(pSkill->m_nSpasticityFrame != 0 || !pSkill->m_bDelayApplySkillEffect); KGLOG_PROCESS_ERROR(pSkill->m_nSpasticityFrame != 0 || !pSkill->m_bInvincibleOnSpasticity); for (int i = 0; i < countof(pSkill->m_SubSkill); ++i) { KGLOG_PROCESS_ERROR(pSkill->m_SubSkill[i].eType >= KSKILL_TRIGGER_TYPE_INVALID && pSkill->m_SubSkill[i].eType < KSKILL_TRIGGER_TYPE_TOTAL); KGLOG_PROCESS_ERROR(pSkill->m_SubSkill[i].dwRate >=0 && pSkill->m_SubSkill[i].dwRate <= SKILL_RATE_BASE); KGLOG_PROCESS_ERROR(pSkill->m_SubSkill[i].eType != KSKILL_TRIGGER_TYPE_TIMER || pSkill->m_SubSkill[i].nFrame > 0); } KGLOG_PROCESS_ERROR(pSkill->m_nSpasticityFrame >= 0); KGLOG_PROCESS_ERROR(pSkill->m_nAIEventMinX <= pSkill->m_nAIEventMaxX); KGLOG_PROCESS_ERROR(pSkill->m_nAIEventMinY <= pSkill->m_nAIEventMaxY); KGLOG_PROCESS_ERROR(pSkill->m_nAIEventMinZ <= pSkill->m_nAIEventMaxZ); } for (KSkillTable::iterator it = m_SkillTable.begin(); it != m_SkillTable.end(); ++it) { dwSkillID = it->second.m_dwID; bRetCode = it->second.UpdateOnSkillLoaded(); KGLOG_PROCESS_ERROR(bRetCode); } bResult = true; Exit0: if (!bResult) KGLogPrintf(KGLOG_ERR, "ID = %u", dwSkillID); KG_COM_RELEASE(piTabFile); return bResult; }