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

Port From (https://github.com/TrinityCore/TrinityCore/commit/b11c1e714184be6abeef61f38117c5c66c5d903e)
This commit is contained in:
hondacrx
2021-05-07 15:37:08 -04:00
parent 93a07915c2
commit 96dc601d37
+25 -4
View File
@@ -5961,11 +5961,32 @@ namespace Game.Entities
if (guid.IsGameObject())
{
GameObject go = GetMap().GetGameObject(guid);
bool shouldLootRelease(GameObject go, LootType lootType)
{
// 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 != LootType.Fishinghole && ((loot_type != LootType.Fishing && loot_type != LootType.FishingJunk) || go.GetOwnerGUID() != GetGUID())
&& !go.IsWithinDistInMap(this, SharedConst.InteractionDistance)) || (loot_type == LootType.Corpse && go.GetRespawnTime() != 0 && go.IsSpawnedByDefault()))
if (lootType == LootType.Skinning)
{
// Disarm Trap
if (!go.IsWithinDistInMap(this, 20.0f))
return true;
}
else
{
if (lootType != LootType.Fishinghole && ((lootType != LootType.Fishing && lootType != LootType.FishingJunk) || go.GetOwnerGUID() != GetGUID()) && !go.IsWithinDistInMap(this, SharedConst.InteractionDistance))
return true;
if (lootType == LootType.Corpse && go.GetRespawnTime() != 0 && go.IsSpawnedByDefault())
return true;
}
return false;
}
if (shouldLootRelease(go, loot_type))
{
SendLootRelease(guid);
return;