void Scene_ActorTarget::Update() { help_window->Update(); target_window->Update(); status_window->Update(); if (use_item) { UpdateItem(); } else { UpdateSkill(); } }
BOOL KSkillList::ForgetSkill(DWORD dwSkillID) { BOOL bResult = false; BOOL bRetCode = false; bRetCode = UpdateSkill(dwSkillID, 0, 0); KGLOG_PROCESS_ERROR(bRetCode); bResult = true; Exit0: return bResult; }
BOOL KSkillList::Load(BYTE* pbyData, size_t uDataLen) { BOOL bResult = false; BOOL bRetCode = false; size_t uLeftSize = uDataLen; BYTE* pbyOffset = pbyData; KDB_SKILL_DATA* pSkillData = NULL; int nItemCount = 0; KGLOG_PROCESS_ERROR(uLeftSize >= sizeof(KDB_SKILL_DATA)); pSkillData = (KDB_SKILL_DATA*)pbyOffset; uLeftSize -= sizeof(KDB_SKILL_DATA); pbyOffset += sizeof(KDB_SKILL_DATA); KGLOG_PROCESS_ERROR(uLeftSize >= sizeof(KDB_SKILL_DATA::KDB_SKILL_ITEM) * pSkillData->nSkillCount); uLeftSize -= sizeof(KDB_SKILL_DATA::KDB_SKILL_ITEM) * pSkillData->nSkillCount; pbyOffset += sizeof(KDB_SKILL_DATA::KDB_SKILL_ITEM) * pSkillData->nSkillCount; for (int nIndex = 0; nIndex < pSkillData->nSkillCount; nIndex++) { bRetCode = UpdateSkill( pSkillData->SkillItems[nIndex].wSkillID, pSkillData->SkillItems[nIndex].byMaxLevel, pSkillData->SkillItems[nIndex].dwExp, false ); if (!bRetCode) { KGLogPrintf( KGLOG_ERR, "[Skill] Role \"%s\", Load skill(%u, %u) failed !\n", m_pPlayer->m_szName, pSkillData->SkillItems[nIndex].wSkillID, pSkillData->SkillItems[nIndex].byMaxLevel ); } } if (pSkillData->dwMountKungfuID != INVALID_SKILL_ID) { m_pPlayer->MountKungfu(pSkillData->dwMountKungfuID, pSkillData->dwMountKungfuLevel); } KGLOG_PROCESS_ERROR(uLeftSize == 0); bResult = true; Exit0: return bResult; }
void Scene_ActorTarget::Update() { help_window->Update(); target_window->Update(); status_window->Update(); if (use_item) { UpdateItem(); } else { UpdateSkill(); } if (Input::IsTriggered(Input::CANCEL)) { Game_System::SePlay(Game_System::GetSystemSE(Game_System::SFX_Cancel)); Scene::Pop(); } }
void Scene_ActorTarget::Update() { help_window->Update(); target_window->Update(); status_window->Update(); if (use_item) { UpdateItem(); } else { UpdateSkill(); } if (Input::IsTriggered(Input::CANCEL)) { Game_System::SePlay(Main_Data::game_data.system.cancel_se); Scene::Pop(); } }
BOOL KSkillList::AddSkillExp(DWORD dwSkillID, DWORD dwExp) { BOOL bResult = false; BOOL bRetCode = false; int nOdds = 0; DWORD dwSkillExp = 0; KSkill* pSkill = NULL; const KPlayerSkill* cpPlayerSkill = NULL; PLAYER_SKILL_LIST::const_iterator cit; cit = m_PlayerSkillList.find(dwSkillID); KG_PROCESS_ERROR(cit != m_PlayerSkillList.end()); cpPlayerSkill = &cit->second; pSkill = g_pSO3World->m_SkillManager.GetSkill_RAW(dwSkillID, cit->second.dwLevel); KG_PROCESS_ERROR(pSkill); KG_PROCESS_ERROR(pSkill->m_dwLevelUpExp); nOdds = (int)g_Random(KILO_NUM); KG_PROCESS_SUCCESS(nOdds + pSkill->m_nExpAddOdds < KILO_NUM); dwSkillExp = cpPlayerSkill->dwExp + dwExp; MAKE_IN_RANGE(dwSkillExp, 0, pSkill->m_dwLevelUpExp); bRetCode = UpdateSkill(dwSkillID, cpPlayerSkill->dwLevel, dwSkillExp); if (CanRealizeSkill(dwSkillID)) { LearnSkill(dwSkillID, true); } Exit1: bResult = true; Exit0: return bResult; }
bool Player::OnSurvey(uint32& entry, float& x, float& y, float& z, float &orientation) { entry = 0; uint16 skill_now = GetSkillValue(SKILL_ARCHAEOLOGY); if (!skill_now) return false; uint16 site_id = GetResearchSiteID(); if (!site_id) return false; uint8 i = 0; for(; i < MAX_RESEARCH_SITES; ++i) if (GetUInt16Value(PLAYER_FIELD_RESERACH_SITE_1 + i / 2, i % 2) == site_id) break; MANGOS_ASSERT(i < MAX_RESEARCH_SITES); DigSite &site = _digSites[i]; if (site.site_id != site_id) { if (!GenerateDigSiteLoot(site_id, site)) return false; site.site_id = site_id; } orientation = GetAngle(site.loot_x, site.loot_y); float dist_now = GetDistance2d(site.loot_x, site.loot_y); if (dist_now >= ARCHAEOLOGY_DIG_SITE_FAR_DIST) { entry = GO_FAR_SURVEYBOT; return false; } if (dist_now >= ARCHAEOLOGY_DIG_SITE_MED_DIST) { entry = GO_MEDIUM_SURVEYBOT; return false; } if (dist_now >= ARCHAEOLOGY_DIG_SITE_FIND_DIST) { entry = GO_CLOSE_SURVEYBOT; return false; } if (skill_now < 50) UpdateSkill(SKILL_ARCHAEOLOGY, 1); entry = site.find_id; x = site.loot_x; y = site.loot_y; z = GetMap()->GetTerrain()->GetHeightStatic(x, y, GetPositionZ(), true, 5); if (site.count < 2) { ++site.count; if (!GenerateDigSiteLoot(site_id, site)) return true; } else { site.clear(); UseResearchSite(site_id); } _archaeologyChanged = true; return true; }
BOOL KSkillList::LearnSkill(DWORD dwSkillID, BOOL bNotifyPlayer, DWORD dwMasterID /* = 0 */) { BOOL bResult = false; BOOL bRetCode = false; DWORD dwNewLevel = 0; const KPlayerSkill* cpPlayerSkill = NULL; KSkill* pOldSkill = NULL; KSkill* pNewSkill = NULL; int nSkillCount = 0; PLAYER_SKILL_LIST::const_iterator cit; KGLOG_PROCESS_ERROR(dwSkillID != INVALID_SKILL_ID); cit = m_PlayerSkillList.find(dwSkillID); if (cit == m_PlayerSkillList.end()) { nSkillCount = (int)m_PlayerSkillList.size(); KGLOG_PROCESS_ERROR(nSkillCount < MAX_PLAYER_SKILL_COUNT); pNewSkill = g_pSO3World->m_SkillManager.GetSkill_RAW(dwSkillID, 1); KGLOG_PROCESS_ERROR(pNewSkill); if (pNewSkill->m_pBaseInfo->dwBelongKungfu != INVALID_SKILL_ID) { DWORD dwKungfuLevel = GetSkillLevel(pNewSkill->m_pBaseInfo->dwBelongKungfu); KGLOG_PROCESS_ERROR(dwKungfuLevel); } dwNewLevel = 1; } else { cpPlayerSkill = &cit->second; pOldSkill = g_pSO3World->m_SkillManager.GetSkill_RAW(dwSkillID, cpPlayerSkill->dwLevel); KGLOG_PROCESS_ERROR(pOldSkill); KG_PROCESS_ERROR(cpPlayerSkill->dwLevel < pOldSkill->m_pBaseInfo->dwMaxLevel); pNewSkill = g_pSO3World->m_SkillManager.GetSkill_RAW(dwSkillID, cpPlayerSkill->dwLevel + 1); KGLOG_PROCESS_ERROR(pNewSkill); dwNewLevel = cpPlayerSkill->dwLevel + 1; } bRetCode = UpdateSkill(dwSkillID, dwNewLevel, 0, bNotifyPlayer); KGLOG_PROCESS_ERROR(bRetCode); bRetCode = pNewSkill->CallLevelUpScript(m_pPlayer); KGLOG_CHECK_ERROR(bRetCode); if (dwSkillID == m_dwMountKungfuID) // 如果升级的技能是目前装备的内功,则更换内功 { m_pPlayer->UmountKungfu(); m_pPlayer->MountKungfu(dwSkillID, dwNewLevel); } if (dwMasterID) { KSKILL_LEARNING_INFO* pSkillLearningInfo = NULL; int nPlayerMoney = 0; int nCostTrain = 0; pSkillLearningInfo = g_pSO3World->m_SkillManager.GetSkillLearningInfo( dwMasterID, dwSkillID, dwNewLevel ); KGLOG_PROCESS_ERROR(pSkillLearningInfo); nPlayerMoney = m_pPlayer->m_ItemList.GetMoney(); nPlayerMoney -= pSkillLearningInfo->nPrice; nPlayerMoney = max(nPlayerMoney, 0); nCostTrain = min(m_pPlayer->m_nCurrentTrainValue, pSkillLearningInfo->nCostTrain); if (nCostTrain) { m_pPlayer->AddTrain(-nCostTrain); } bRetCode = m_pPlayer->m_ItemList.SetMoney(nPlayerMoney); KGLOG_CHECK_ERROR(bRetCode); g_LogClient.LogPlayerMoneyChange(-pSkillLearningInfo->nPrice, m_pPlayer, "learn skill"); } bResult = true; Exit0: return bResult; }