Implement some death related achievements

* ACHIEVEMENT_CRITERIA_TYPE_DEATH (normal and arena types counting)
* ACHIEVEMENT_CRITERIA_TYPE_DEATH_IN_DUNGEON (instance types by man limit counting)
  Note: need fixed for cases when max allowed players different from recommended count.
* ACHIEVEMENT_CRITERIA_TYPE_DEATHS_FROM (environment damage sources by types)

Fixed:
* ACHIEVEMENT_CRITERIA_TYPE_KILLED_BY_PLAYER
   - self-kill counting as death from players
   - same team player kill in opposition kills counter.

Also cleanup in Player::EnvironmentalDamage use DBCStructure.h comment.
This commit is contained in:
VladimirMangos 2009-03-06 01:10:54 +03:00
parent bfa785fdb8
commit c18d20782b
4 changed files with 195 additions and 76 deletions

View file

@ -528,6 +528,7 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa
if (pVictim->GetTypeId() == TYPEID_UNIT && !((Creature*)pVictim)->isPet() && !((Creature*)pVictim)->hasLootRecipient())
((Creature*)pVictim)->SetLootRecipient(this);
if (health <= damage)
{
DEBUG_LOG("DealDamage: victim just died");
@ -604,12 +605,12 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa
((Creature*)this)->AI()->KilledUnit(pVictim);
// achievement stuff
if ( pVictim->GetTypeId() == TYPEID_PLAYER)
if (pVictim->GetTypeId() == TYPEID_PLAYER)
{
if(GetTypeId() == TYPEID_UNIT)
if (GetTypeId() == TYPEID_UNIT)
((Player*)pVictim)->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_KILLED_BY_CREATURE, GetEntry());
else if(GetTypeId() == TYPEID_PLAYER)
((Player*)pVictim)->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_KILLED_BY_PLAYER, 1);
else if(GetTypeId() == TYPEID_PLAYER && pVictim != this)
((Player*)pVictim)->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_KILLED_BY_PLAYER, 1, ((Player*)this)->GetTeam());
}
// 10% durability loss on death