fix(Core/GameObject): credit nearby group members on object activation if they're in reward range (#8240)

Ported from: cd625a12e2
Credits to @Treeston
This commit is contained in:
Skjalf
2021-10-07 08:08:30 -03:00
committed by GitHub
parent cdb45a7ef1
commit 72de7a9a22

View File

@@ -1491,7 +1491,23 @@ void GameObject::Use(Unit* user)
if (Battleground* bg = player->GetBattleground())
bg->EventPlayerUsedGO(player, this);
player->KillCreditGO(info->entry, GetGUID());
if (Group* group = player->GetGroup())
{
for (GroupReference const* itr = group->GetFirstMember(); itr != nullptr; itr = itr->next())
{
if (Player* member = itr->GetSource())
{
if (member->IsAtGroupRewardDistance(this))
{
member->KillCreditGO(info->entry, GetGUID());
}
}
}
}
else
{
player->KillCreditGO(info->entry, GetGUID());
}
}
if (uint32 trapEntry = info->goober.linkedTrapId)