mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-18 08:28:32 +01:00
Core/Unit: Fixed race condition when loot recipient is in different map (#25312)
This commit is contained in:
@@ -10853,8 +10853,30 @@ bool Unit::InitTamedPet(Pet* pet, uint8 level, uint32 spell_id)
|
||||
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->GetOwnerGUID().IsPlayer())
|
||||
|
||||
Reference in New Issue
Block a user