Jump to content

[fix][7700] ACHIEVEMENT_CRITERIA_TYPE_EARN_HONORABLE_KILL


Guest DonTomika

Recommended Posts

What bug does the patch fix? What features does the patch add?

This patch implements achievements based on ACHIEVEMENT_CRITERIA_TYPE_EARN_HONORABLE_KILL.

For which repository revision was the patch created?

7698

Is there a thread in the bug report section or at lighthouse? If yes, please add a link to the thread.

Couldn't find any.

diff --git a/src/game/AchievementMgr.cpp b/src/game/AchievementMgr.cpp
index 7cdf486..bf56c26 100644
--- a/src/game/AchievementMgr.cpp
+++ b/src/game/AchievementMgr.cpp
@@ -1033,6 +1033,9 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui
                SetCriteriaProgress(achievementCriteria, spellCount);
                break;
            }
+            case ACHIEVEMENT_CRITERIA_TYPE_EARN_HONORABLE_KILL:
+                SetCriteriaProgress(achievementCriteria, GetPlayer()->GetUInt32Value(PLAYER_FIELD_LIFETIME_HONORBALE_KILLS));
+                break;
            // std case: not exist in DBC, not triggered in code as result
            case ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_HEALTH:
            case ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_SPELLPOWER:
@@ -1083,7 +1086,6 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui
            case ACHIEVEMENT_CRITERIA_TYPE_QUEST_ABANDONED:
            case ACHIEVEMENT_CRITERIA_TYPE_FLIGHT_PATHS_TAKEN:
            case ACHIEVEMENT_CRITERIA_TYPE_LOOT_TYPE:
-            case ACHIEVEMENT_CRITERIA_TYPE_EARN_HONORABLE_KILL:
            case ACHIEVEMENT_CRITERIA_TYPE_ACCEPTED_SUMMONINGS:
            case ACHIEVEMENT_CRITERIA_TYPE_TOTAL:
                break;                                   // Not implemented yet 
@@ -1208,6 +1210,8 @@ bool AchievementMgr::IsCompletedCriteria(AchievementCriteriaEntry const* achieve
            return progress->counter >= achievementCriteria->learn_skillline_spell.spellCount;
        case ACHIEVEMENT_CRITERIA_TYPE_LEARN_SKILL_LINE:
            return progress->counter >= achievementCriteria->learn_skill_line.spellCount;
+        case ACHIEVEMENT_CRITERIA_TYPE_EARN_HONORABLE_KILL:
+            return progress->counter >= achievementCriteria->honorable_kill.killCount;

        // handle all statistic-only criteria here
        case ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_BATTLEGROUND:
diff --git a/src/game/Level3.cpp b/src/game/Level3.cpp
index 8ffdb3f..44bb0ef 100644
--- a/src/game/Level3.cpp
+++ b/src/game/Level3.cpp
@@ -4522,6 +4522,8 @@ bool ChatHandler::HandleResetHonorCommand (const char * args)
    player->SetUInt32Value(PLAYER_FIELD_TODAY_CONTRIBUTION, 0);
    player->SetUInt32Value(PLAYER_FIELD_YESTERDAY_CONTRIBUTION, 0);

+    player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_EARN_HONORABLE_KILL);
+
    return true;
}

diff --git a/src/game/Player.cpp b/src/game/Player.cpp
index 74569e5..114786b 100644
--- a/src/game/Player.cpp
+++ b/src/game/Player.cpp
@@ -5856,6 +5856,7 @@ bool Player::RewardHonor(Unit *uVictim, uint32 groupsize, float honor)
            ApplyModUInt32Value(PLAYER_FIELD_KILLS, 1, true);
            // and those in a lifetime
            ApplyModUInt32Value(PLAYER_FIELD_LIFETIME_HONORBALE_KILLS, 1, true);
+            UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_EARN_HONORABLE_KILL);
        }
        else
        {

Link to comment
Share on other sites

  • 2 weeks later...
×
×
  • 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