diff --git a/src/game/Player.cpp b/src/game/Player.cpp index aadf62113..eadfe40f2 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -18654,6 +18654,31 @@ bool Player::RewardPlayerAndGroupAtKill(Unit* pVictim) return xp || honored_kill; } +void Player::RewardPlayerAndGroupAtEvent(uint32 creature_id, WorldObject* pRewardSource) +{ + uint64 creature_guid = pRewardSource->GetTypeId()==TYPEID_UNIT ? pRewardSource->GetGUID() : uint64(0); + + // prepare data for near group iteration + if(Group *pGroup = GetGroup()) + { + for(GroupReference *itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next()) + { + Player* pGroupGuy = itr->getSource(); + if(!pGroupGuy) + continue; + + if(!pGroupGuy->IsAtGroupRewardDistance(pRewardSource)) + continue; // member (alive or dead) or his corpse at req. distance + + // quest objectives updated only for alive group member or dead but with not released body + if(pGroupGuy->isAlive()|| !pGroupGuy->GetCorpse()) + pGroupGuy->KilledMonster(creature_id, creature_guid); + } + } + else // if (!pGroup) + KilledMonster(creature_id, creature_guid); +} + bool Player::IsAtGroupRewardDistance(WorldObject const* pRewardSource) const { if(pRewardSource->GetDistance(this) <= sWorld.getConfig(CONFIG_GROUP_XP_DISTANCE)) diff --git a/src/game/Player.h b/src/game/Player.h index 480ba7c40..8dc020ec8 100644 --- a/src/game/Player.h +++ b/src/game/Player.h @@ -1665,6 +1665,7 @@ class MANGOS_DLL_SPEC Player : public Unit bool IsAtGroupRewardDistance(WorldObject const* pRewardSource) const; bool RewardPlayerAndGroupAtKill(Unit* pVictim); + void RewardPlayerAndGroupAtEvent(uint32 creature_id,WorldObject* pRewardSource); bool isHonorOrXPTarget(Unit* pVictim); ReputationMgr& GetReputationMgr() { return m_reputationMgr; } diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp index 127b007af..7ac40b76c 100644 --- a/src/game/SpellEffects.cpp +++ b/src/game/SpellEffects.cpp @@ -1053,7 +1053,7 @@ void Spell::EffectDummy(uint32 i) return; pCreature->SetHealth(health); - ((Player*)m_caster)->KilledMonster(16992,pCreature->GetGUID()); + ((Player*)m_caster)->RewardPlayerAndGroupAtEvent(16992,pCreature); if (pCreature->AI()) pCreature->AI()->AttackStart(m_caster); @@ -6508,7 +6508,7 @@ void Spell::EffectKillCredit(uint32 i) if(!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER) return; - ((Player*)unitTarget)->KilledMonster(m_spellInfo->EffectMiscValue[i], 0); + ((Player*)unitTarget)->RewardPlayerAndGroupAtEvent(m_spellInfo->EffectMiscValue[i], unitTarget); } void Spell::EffectQuestFail(uint32 i) diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 82910751f..aa013c01c 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "7558" + #define REVISION_NR "7559" #endif // __REVISION_NR_H__