[7703] Implement heal/damage total counters and related BG achievments.

* ACHIEVEMENT_CRITERIA_TYPE_DAMAGE_DONE
* ACHIEVEMENT_CRITERIA_TYPE_HEALING_DONE

Signed-off-by: VladimirMangos <vladimir@getmangos.com>
This commit is contained in:
Trazom 2009-04-23 23:50:31 +04:00 committed by VladimirMangos
parent 9136354e7f
commit eedc10d46f
5 changed files with 66 additions and 9 deletions

View file

@ -510,6 +510,7 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa
}
}
killer->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_DAMAGE_DONE, damage, 0, pVictim);
killer->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_HIT_DEALT, damage);
}
@ -7450,12 +7451,9 @@ int32 Unit::DealHeal(Unit *pVictim, uint32 addhealth, SpellEntry const *spellPro
if (BattleGround *bg = ((Player*)this)->GetBattleGround())
bg->UpdatePlayerScore((Player*)this, SCORE_HEALING_DONE, gain);
// healing done is count ONLY if the target is a player.
if (pVictim->GetTypeId()==TYPEID_PLAYER)
{
// use the actual gain, as the overheal shall not be counted.
((Player*)this)->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_HEALING_DONE, gain);
}
// use the actual gain, as the overheal shall not be counted, skip gain 0 (it ignored anyway in to criteria)
if (gain)
((Player*)this)->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_HEALING_DONE, gain, 0, pVictim);
((Player*)this)->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_HEAL_CASTED, addhealth);
}