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-
2014-01-25 16:59:01 +01:00
parent c6650ecc71
commit 6b25c2b414
4 changed files with 27 additions and 23 deletions

View File

@@ -266,19 +266,21 @@ void WorldSession::HandleOpenItemOpcode(WorldPacket& recvPacket)
void WorldSession::HandleGameObjectUseOpcode(WorldPacket& recvData)
{
uint64 guid;
recvData >> guid;
TC_LOG_DEBUG("network", "WORLD: Recvd CMSG_GAMEOBJ_USE Message [guid=%u]", GUID_LOPART(guid));
if (GameObject* obj = GetPlayer()->GetMap()->GetGameObject(guid))
{
if (!obj->IsWithinDistInMap(GetPlayer(), obj->GetInteractionDistance()))
return;
// ignore for remote control state
if (_player->m_mover != _player)
if (!(_player->IsOnVehicle(_player->m_mover) || _player->IsMounted()) && !obj->GetGOInfo()->IsUsableMounted())
if (GetPlayer()->m_mover != GetPlayer())
if (!(GetPlayer()->IsOnVehicle(GetPlayer()->m_mover) || GetPlayer()->IsMounted()) && !obj->GetGOInfo()->IsUsableMounted())
return;
obj->Use(_player);
obj->Use(GetPlayer());
}
}