diff options
author | ariel- <ariel-@users.noreply.github.com> | 2018-01-02 01:19:23 -0300 |
---|---|---|
committer | ariel- <ariel-@users.noreply.github.com> | 2018-01-02 01:19:23 -0300 |
commit | a0dcd9c7988912e97909df2ba9ab0b86d20ff22d (patch) | |
tree | 8b081c2c75a9f2f068305ee7efed9300d032fe8c /src | |
parent | 95df8d5028a84391e7810b5604f4ea8e48ccf7fc (diff) |
Core/Player: fix issue with SendLoot when using Disarm Trap at maximum range
Diffstat (limited to 'src')
-rw-r--r-- | src/server/game/Entities/Player/Player.cpp | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 4a6d959d3f0..ff4e0667ac1 100644 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -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; + + 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; + }; - // 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 (shouldLootRelease(go, loot_type)) { SendLootRelease(guid); return; |