mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-21 17:54:48 +01:00
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:
@@ -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());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user