Jump to content

[Feature][7573] support ACHIEVEMENT_CRITERIA_TYPE_LEARN_SKILL_LEVEL


Guest Trazom

Recommended Posts

What features does the patch add?

supports the achievements based on criteria type ACHIEVEMENT_CRITERIA_TYPE_LEARN_SKILL_LEVEL (profession achievements)

For which repository revision was the patch created?

master [7553]

Is there a thread in the bug report section or at lighthouse?

None I know

Who has been writing this patch?

Myself

---
src/game/AchievementMgr.cpp |    7 ++++++-
src/game/Player.cpp         |    2 ++
2 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/src/game/AchievementMgr.cpp b/src/game/AchievementMgr.cpp
index 2c71cdf..177acd1 100644
--- a/src/game/AchievementMgr.cpp
+++ b/src/game/AchievementMgr.cpp
@@ -514,6 +514,10 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui
                if(uint32 skillvalue = GetPlayer()->GetBaseSkillValue(achievementCriteria->reach_skill_level.skillID))
                    SetCriteriaProgress(achievementCriteria, skillvalue);
                break;
+            case ACHIEVEMENT_CRITERIA_TYPE_LEARN_SKILL_LEVEL:
+                if(uint32 maxSkillvalue = GetPlayer()->GetMaxSkillValue(achievementCriteria->learn_skill_level.skillID))
+                    SetCriteriaProgress(achievementCriteria, maxSkillvalue);
+                break;
            case ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_ACHIEVEMENT:
                if(m_completedAchievements.find(achievementCriteria->complete_achievement.linkedAchievement) != m_completedAchievements.end())
                    SetCriteriaProgress(achievementCriteria, 1);
@@ -905,7 +909,6 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui
            case ACHIEVEMENT_CRITERIA_TYPE_WIN_RATED_ARENA:
            case ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_TEAM_RATING:
            case ACHIEVEMENT_CRITERIA_TYPE_REACH_TEAM_RATING:
-            case ACHIEVEMENT_CRITERIA_TYPE_LEARN_SKILL_LEVEL:
            case ACHIEVEMENT_CRITERIA_TYPE_OWN_RANK:
            case ACHIEVEMENT_CRITERIA_TYPE_EQUIP_EPIC_ITEM:
            case ACHIEVEMENT_CRITERIA_TYPE_HK_CLASS:
@@ -995,6 +998,8 @@ bool AchievementMgr::IsCompletedCriteria(AchievementCriteriaEntry const* achieve
        }
        case ACHIEVEMENT_CRITERIA_TYPE_REACH_SKILL_LEVEL:
            return progress->counter >= achievementCriteria->reach_skill_level.skillLevel;
+        case ACHIEVEMENT_CRITERIA_TYPE_LEARN_SKILL_LEVEL:
+            return progress->counter >= (achievementCriteria->learn_skill_level.skillLevel * 75);
        case ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_ACHIEVEMENT:
            return progress->counter >= 1;
        case ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_QUEST_COUNT:
diff --git a/src/game/Player.cpp b/src/game/Player.cpp
index aadf621..c85f639 100644
--- a/src/game/Player.cpp
+++ b/src/game/Player.cpp
@@ -5151,6 +5151,7 @@ void Player::SetSkill(uint32 id, uint16 currVal, uint16 maxVal)
            SetUInt32Value(PLAYER_SKILL_VALUE_INDEX(i),MAKE_SKILL_VALUE(currVal,maxVal));
            learnSkillRewardedSpells(id, currVal);
            GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_REACH_SKILL_LEVEL);
+            GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_LEARN_SKILL_LEVEL);
        }
        else                                                //remove
        {
@@ -5184,6 +5185,7 @@ void Player::SetSkill(uint32 id, uint16 currVal, uint16 maxVal)
                SetUInt32Value(PLAYER_SKILL_INDEX(i), MAKE_PAIR32(id,0));
            SetUInt32Value(PLAYER_SKILL_VALUE_INDEX(i),MAKE_SKILL_VALUE(currVal,maxVal));
            GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_REACH_SKILL_LEVEL);
+            GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_LEARN_SKILL_LEVEL);

            // apply skill bonuses
            SetUInt32Value(PLAYER_SKILL_BONUS_INDEX(i),0);
-- 

Link to comment
Share on other sites

updated to use GetPureMaxSkillValue instead of GetMaxSkillValue

---
src/game/AchievementMgr.cpp |    2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/game/AchievementMgr.cpp b/src/game/AchievementMgr.cpp
index 177acd1..d1692bd 100644
--- a/src/game/AchievementMgr.cpp
+++ b/src/game/AchievementMgr.cpp
@@ -515,7 +515,7 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui
                    SetCriteriaProgress(achievementCriteria, skillvalue);
                break;
            case ACHIEVEMENT_CRITERIA_TYPE_LEARN_SKILL_LEVEL:
-                if(uint32 maxSkillvalue = GetPlayer()->GetMaxSkillValue(achievementCriteria->learn_skill_level.skillID))
+                if(uint32 maxSkillvalue = GetPlayer()->GetPureMaxSkillValue(achievementCriteria->learn_skill_level.skillID))
                    SetCriteriaProgress(achievementCriteria, maxSkillvalue);
                break;
            case ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_ACHIEVEMENT:
-- 

ps: need help with git command here. how can I have only 1 patch file instead of 2, so that I can edit the first post.

Link to comment
Share on other sites

ps: need help with git command here. how can I have only 1 patch file instead of 2, so that I can edit the first post.

In git repo?

If you want only common diff file and have both commits as last comits in ypu branch then you can do:

git diff HEAD^^ > patchfile

If you have both last but want merge its to single commit then you need read about before and then use:

git rebase -i HEAD^^

For this case i not have problem apply its in current form.

Link to comment
Share on other sites

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy Terms of Use