Core/Player: fix issue with SendLoot when using Disarm Trap at maximum range

This commit is contained in:
ariel-
2018-01-02 01:19:23 -03:00
parent 95df8d5028
commit a0dcd9c798
+25 -3
View File
@@ -8344,10 +8344,32 @@ void Player::SendLoot(ObjectGuid guid, LootType loot_type)
if (guid.IsGameObject())
{
GameObject* go = GetMap()->GetGameObject(guid);
auto shouldLootRelease = [this](GameObject* go, LootType lootType) -> bool
{
// not check distance for GO in case owned GO (fishing bobber case, for example)
// And permit out of range GO with no owner in case fishing hole
if (!go)
return true;
// not check distance for GO in case owned GO (fishing bobber case, for example)
// And permit out of range GO with no owner in case fishing hole
if (!go || (loot_type != LOOT_FISHINGHOLE && ((loot_type != LOOT_FISHING && loot_type != LOOT_FISHING_JUNK) || go->GetOwnerGUID() != GetGUID()) && !go->IsWithinDistInMap(this, INTERACTION_DISTANCE)) || (loot_type == LOOT_CORPSE && go->GetRespawnTime() && go->isSpawnedByDefault()))
if (lootType == LOOT_SKINNING)
{
// Disarm Trap
if (!go->IsWithinDistInMap(this, 20.f))
return true;
}
else
{
if (lootType != LOOT_FISHINGHOLE && ((lootType != LOOT_FISHING && lootType != LOOT_FISHING_JUNK) || go->GetOwnerGUID() != GetGUID()) && !go->IsWithinDistInMap(this, INTERACTION_DISTANCE))
return true;
if (lootType == LOOT_CORPSE && go->GetRespawnTime() && go->isSpawnedByDefault())
return true;
}
return false;
};
if (shouldLootRelease(go, loot_type))
{
SendLootRelease(guid);
return;