mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-21 01:37:37 +01:00
*Merge.
--HG-- branch : trunk
This commit is contained in:
@@ -711,8 +711,15 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa
|
||||
if (pVictim->GetTypeId() == TYPEID_PLAYER)
|
||||
((Player*)pVictim)->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_HIT_RECEIVED, damage);
|
||||
|
||||
if (pVictim->GetTypeId() == TYPEID_UNIT && !((Creature*)pVictim)->isPet() && !((Creature*)pVictim)->hasLootRecipient())
|
||||
((Creature*)pVictim)->SetLootRecipient(this);
|
||||
if (pVictim->GetTypeId() == TYPEID_UNIT && !((Creature*)pVictim)->isPet())
|
||||
{
|
||||
if(!((Creature*)pVictim)->hasLootRecipient())
|
||||
((Creature*)pVictim)->SetLootRecipient(this);
|
||||
|
||||
if(GetCharmerOrOwnerPlayerOrPlayerItself())
|
||||
((Creature*)pVictim)->AddDamageByPlayers(health < damage ? health : damage);
|
||||
}
|
||||
|
||||
if (health <= damage)
|
||||
{
|
||||
DEBUG_LOG("DealDamage: victim just died");
|
||||
@@ -13005,11 +13012,19 @@ void Unit::Kill(Unit *pVictim, bool durabilityLoss)
|
||||
// find player: owner of controlled `this` or `this` itself maybe
|
||||
Player *player = GetCharmerOrOwnerPlayerOrPlayerItself();
|
||||
|
||||
if(pVictim->GetTypeId() == TYPEID_UNIT && ((Creature*)pVictim)->GetLootRecipient())
|
||||
bool bRewardIsAllowed = true;
|
||||
if(pVictim->GetTypeId() == TYPEID_UNIT)
|
||||
{
|
||||
bRewardIsAllowed = ((Creature*)pVictim)->IsDamageEnoughForLootingAndReward();
|
||||
if(!bRewardIsAllowed)
|
||||
((Creature*)pVictim)->SetLootRecipient(NULL);
|
||||
}
|
||||
|
||||
if(bRewardIsAllowed && pVictim->GetTypeId() == TYPEID_UNIT && ((Creature*)pVictim)->GetLootRecipient())
|
||||
player = ((Creature*)pVictim)->GetLootRecipient();
|
||||
// Reward player, his pets, and group/raid members
|
||||
// call kill spell proc event (before real die and combat stop to triggering auras removed at death/combat stop)
|
||||
if(player && player!=pVictim)
|
||||
if(bRewardIsAllowed && player && player!=pVictim)
|
||||
{
|
||||
if(player->RewardPlayerAndGroupAtKill(pVictim))
|
||||
player->ProcDamageAndSpell(pVictim, PROC_FLAG_KILL, PROC_FLAG_KILLED, PROC_EX_NONE, 0);
|
||||
|
||||
Reference in New Issue
Block a user