Jump to content

Q: reset Achievement_criteria

Guest Trazom

Recommended Posts

I'm currently implementing the achievement based on this criteria ACHIEVEMENT_CRITERIA_TYPE_HEALING_DONE I'm in search of some advice from the dev team to implement the reset of the criteria. There is no problem to count the healing done.

(BTW, I'm also doing ACHIEVEMENT_CRITERIA_TYPE_DAMAGE_DONE for this achievement, but it's the same discussion)


There are 6 criteria of this type.

5 are counters related to healing done in BG for the achievement: http://www.wowhead.com/?achievement=227 Those 5 counters need to be reset for each BG as the target count shall be done in the same BG (cfr "in a single battle").

For those 5 counters, the value of "healing_done.flag" is ACHIEVEMENT_CRITERIA_CONDITION_MAP(3), and the "healing_done.mapid" is the mapid of the BG.

The last criteria is the counter for the total of healing done (statistics). Obviously, this shall never be reset. For this criteria, both the flag and the mapid are 0.


As far as I know, there is no such reset yet.

What would be the best way to implement this reset in a generic way, without hacking the criteria number of the criteria that shall not be reset?


I thought of adding a function in AchievementMgr, much like UpdateAchievementCriteria,

which would reset the criteria only if miscvalue1 and miscvalue2 match exactly the parameters.

@@ -248,10 +248,45 @@ void AchievementMgr::Reset()

    // re-fill data

+void AchievementMgr::ResetAchievementCriteria(AchievementCriteriaTypes type, uint32 miscvalue1, uint32 miscvalue2, Unit *unit, uint32 time)
+    if((sLog.getLogFilter() & LOG_FILTER_ACHIEVEMENT_UPDATES)==0)
+        sLog.outDetail("AchievementMgr::ResetAchievementCriteria(%u, %u, %u, %u)", type, miscvalue1, miscvalue2, time);
+    if (!sWorld.getConfig(CONFIG_GM_ALLOW_ACHIEVEMENT_GAINS) && m_player->GetSession()->GetSecurity() > SEC_PLAYER)
+        return;
+    AchievementCriteriaEntryList const& achievementCriteriaList = achievementmgr.GetAchievementCriteriaByType(type);
+    for(AchievementCriteriaEntryList::const_iterator i = achievementCriteriaList.begin(); i!=achievementCriteriaList.end(); ++i)
+    {
+        AchievementCriteriaEntry const *achievementCriteria = (*i);
+        AchievementEntry const *achievement = sAchievementStore.LookupEntry(achievementCriteria->referredAchievement);
+        if (!achievement)
+            continue;
+        // don't update already completed criteria
+        if (IsCompletedCriteria(achievementCriteria,achievement))
+            continue;
+        switch (type)
+        {
+                if (achievementCriteria->healing_done.flag == miscvalue1
+                    && achievementCriteria->healing_done.mapid == miscvalue2)
+                {
+                    SetCriteriaProgress(achievementCriteria, 0, PROGRESS_SET);
+                }
+                break;
+        }
+    }
void AchievementMgr::DeleteFromDB(uint32 lowguid)
    CharacterDatabase.BeginTransaction ();
    CharacterDatabase.PExecute("DELETE FROM character_achievement WHERE guid = %u",lowguid);
    CharacterDatabase.PExecute("DELETE FROM character_achievement_progress WHERE guid = %u",lowguid);

I would call it when a player is added to a bg (BattleGround::AddPlayer)

@@ -1113,10 +1113,13 @@ void BattleGround::AddPlayer(Player *plr)
        if(GetStatus() == STATUS_WAIT_JOIN)                 // not started yet
            plr->CastSpell(plr, SPELL_PREPARATION, true);   // reduces all mana cost of spells.

    // setup BG group membership
    AddOrSetPlayerToCorrectBgGroup(plr, guid, team);

    // Log

I would like to know if I continue that way, or may be a dev has a better suggestion?

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