Core/Gameobjects: Fix an exploit where it was possible to use gameobjects from any distance. Fixes for example picking up the WSG flag from any distance using hacking tools.

This commit is contained in:
Discover- committed 2014-01-25 16:59:01 +01:00
1 parent c6650ecc71
commit 6b25c2b414
4 files changed
+27 -23

No files matched your search

+3 -19
View File
@@ -2765,30 +2765,14 @@ GameObject* Player::GetGameObjectIfCanInteractWith(uint64 guid, GameobjectTypes
{
if (go->GetGoType() == type)
{
float maxdist;
switch (type)
{
/// @todo find out how the client calculates the maximal usage distance to spellless working
// gameobjects like guildbanks and mailboxes - 10.0 is a just an abitrary choosen number
case GAMEOBJECT_TYPE_GUILD_BANK:
case GAMEOBJECT_TYPE_MAILBOX:
maxdist = 10.0f;
break;
case GAMEOBJECT_TYPE_FISHINGHOLE:
maxdist = 20.0f+CONTACT_DISTANCE; // max spell range
break;
default:
maxdist = INTERACTION_DISTANCE;
break;
}
if (go->IsWithinDistInMap(this, maxdist))
if (go->IsWithinDistInMap(this, go->GetInteractionDistance()))
return go;
TC_LOG_DEBUG("maps", "IsGameObjectOfTypeInRange: GameObject '%s' [GUID: %u] is too far away from player %s [GUID: %u] to be used by him (distance=%f, maximal 10 is allowed)", go->GetGOInfo()->name.c_str(),
TC_LOG_DEBUG("maps", "GetGameObjectIfCanInteractWith: GameObject '%s' [GUID: %u] is too far away from player %s [GUID: %u] to be used by him (distance=%f, maximal 10 is allowed)", go->GetGOInfo()->name.c_str(),
go->GetGUIDLow(), GetName().c_str(), GetGUIDLow(), go->GetDistance(this));
}
}
return NULL;
}