Core/Unit: Fixed race condition when loot recipient is in different map
This commit is contained in:
1 parent
359d6f3a9f
commit
1aaa949fff
1 file changed
+24
-2
@@ -11482,8 +11482,30 @@ void Unit::Kill(Unit* victim, bool durabilityLoss)
|
||||
creature->SetLootRecipient(nullptr);
|
||||
}
|
||||
|
||||
if (isRewardAllowed && creature && creature->GetLootRecipient())
|
||||
player = creature->GetLootRecipient();
|
||||
if (isRewardAllowed && creature)
|
||||
{
|
||||
if (Player* lootRecipient = creature->GetLootRecipient())
|
||||
{
|
||||
// Loot recipient can be in a different map
|
||||
if (!creature->IsInMap(lootRecipient))
|
||||
{
|
||||
if (Group* group = creature->GetLootRecipientGroup())
|
||||
{
|
||||
for (GroupReference* itr = group->GetFirstMember(); itr != nullptr; itr = itr->next())
|
||||
{
|
||||
Player* member = itr->GetSource();
|
||||
if (!member || !creature->IsInMap(member))
|
||||
continue;
|
||||
|
||||
player = member;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
player = creature->GetLootRecipient();
|
||||
}
|
||||
}
|
||||
|
||||
// Exploit fix
|
||||
if (creature && creature->IsPet() && creature->GetOwnerOrCreatorGUID().IsPlayer())
|
||||
|
||||
Reference in new issue
Block a user