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.
Author: VladimirMangos
--HG--
branch : trunk
This commit is contained in:
+13
-12
@@ -728,6 +728,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");
|
||||
@@ -805,12 +806,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
|
||||
@@ -12482,14 +12483,14 @@ void Unit::Kill(Unit *pVictim, bool durabilityLoss)
|
||||
}
|
||||
}
|
||||
|
||||
// achievement stuff
|
||||
if ( pVictim->GetTypeId() == TYPEID_PLAYER)
|
||||
{
|
||||
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);
|
||||
}
|
||||
// achievement stuff
|
||||
if (pVictim->GetTypeId() == TYPEID_PLAYER)
|
||||
{
|
||||
if (GetTypeId() == TYPEID_UNIT)
|
||||
((Player*)pVictim)->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_KILLED_BY_CREATURE, GetEntry());
|
||||
else if(GetTypeId() == TYPEID_PLAYER && pVictim != this)
|
||||
((Player*)pVictim)->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_KILLED_BY_PLAYER, 1, ((Player*)this)->GetTeam());
|
||||
}
|
||||
}
|
||||
|
||||
void Unit::SetControlled(bool apply, UnitState state)
|
||||
|
||||
Reference in New Issue
Block a user