diff options
author | SnapperRy <snapperryen@gmail.com> | 2016-10-06 10:50:50 +0200 |
---|---|---|
committer | SnapperRy <snapperryen@gmail.com> | 2016-10-06 10:50:50 +0200 |
commit | 5417a1a37f28d2746e83a7423f82abc46e2b4a4a (patch) | |
tree | c104f09601393d5255d4479538bf23b26b1406e5 /src | |
parent | b930d99e599d5d799da726d2e1e5d1e37ef7e14a (diff) |
Core/Creature: don't give kill and achievement credit if a creature kills itself.
Prevents Wintergrasp vehicles from giving credit when killed by Wintergrasp Water and other similar exploits.
Diffstat (limited to 'src')
-rw-r--r-- | src/server/game/Entities/Unit/Unit.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 4dcb9a505ea..07d4413565f 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -11642,7 +11642,9 @@ void Unit::Kill(Unit* victim, bool durabilityLoss) } } - player->RewardPlayerAndGroupAtKill(victim, false); + // Don't give kill credit if creature killed itself + if (this != victim) + player->RewardPlayerAndGroupAtKill(victim, false); } // Do KILL and KILLED procs. KILL proc is called only for the unit who landed the killing blow (and its owner - for pets and totems) regardless of who tapped the victim @@ -11659,10 +11661,11 @@ void Unit::Kill(Unit* victim, bool durabilityLoss) // Proc auras on death - must be before aura/combat remove victim->ProcSkillsAndAuras(victim, PROC_FLAG_NONE, PROC_FLAG_DEATH, PROC_SPELL_TYPE_MASK_ALL, PROC_SPELL_PHASE_NONE, PROC_HIT_NONE, nullptr, nullptr, nullptr); - // update get killing blow achievements, must be done before setDeathState to be able to require auras on target + // update get killing blow achievements (only if creature did not kill itself), must be done before setDeathState to be able to require auras on target // and before Spirit of Redemption as it also removes auras - if (Player* killerPlayer = GetCharmerOrOwnerPlayerOrPlayerItself()) - killerPlayer->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_GET_KILLING_BLOWS, 1, 0, victim); + if (this != victim) + if (Player* killerPlayer = GetCharmerOrOwnerPlayerOrPlayerItself()) + killerPlayer->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_GET_KILLING_BLOWS, 1, 0, victim); // if talent known but not triggered (check priest class for speedup check) bool spiritOfRedemption = false; |