diff options
Diffstat (limited to 'src/server/game/Handlers/QueryHandler.cpp')
-rw-r--r-- | src/server/game/Handlers/QueryHandler.cpp | 51 |
1 files changed, 27 insertions, 24 deletions
diff --git a/src/server/game/Handlers/QueryHandler.cpp b/src/server/game/Handlers/QueryHandler.cpp index d1febe6baa7..6e9db0a3c7f 100644 --- a/src/server/game/Handlers/QueryHandler.cpp +++ b/src/server/game/Handlers/QueryHandler.cpp @@ -18,6 +18,7 @@ #include "WorldSession.h" #include "CharacterCache.h" #include "Common.h" +#include "Corpse.h" #include "DatabaseEnv.h" #include "DBCStores.h" #include "GameTime.h" @@ -28,6 +29,7 @@ #include "ObjectMgr.h" #include "Player.h" #include "QueryPackets.h" +#include "Transport.h" #include "UpdateMask.h" #include "World.h" @@ -141,13 +143,13 @@ void WorldSession::HandleGameObjectQueryOpcode(WorldPackets::Query::QueryGameObj } } -void WorldSession::HandleCorpseQueryOpcode(WorldPacket & /*recvData*/) +void WorldSession::HandleQueryCorpseLocation(WorldPackets::Query::QueryCorpseLocationFromClient& /*queryCorpseLocation*/) { if (!_player->HasCorpse()) { - WorldPacket data(MSG_CORPSE_QUERY, 1); - data << uint8(0); // corpse not found - SendPacket(&data); + WorldPackets::Query::CorpseLocation packet; + packet.Valid = false; // corpse not found + SendPacket(packet.Write()); return; } @@ -178,15 +180,13 @@ void WorldSession::HandleCorpseQueryOpcode(WorldPacket & /*recvData*/) } } - WorldPacket data(MSG_CORPSE_QUERY, 1+(6*4)); - data << uint8(1); // corpse found - data << int32(mapID); - data << float(x); - data << float(y); - data << float(z); - data << int32(corpseMapID); - data << uint32(0); // unknown - SendPacket(&data); + WorldPackets::Query::CorpseLocation packet; + packet.Valid = true; + packet.MapID = corpseMapID; + packet.ActualMapID = mapID; + packet.Position = Position(x, y, z); + packet.Transport = 0; // TODO: If corpse is on transport, send transport offsets and transport guid + SendPacket(packet.Write()); } void WorldSession::HandleNpcTextQueryOpcode(WorldPacket& recvData) @@ -314,19 +314,22 @@ void WorldSession::HandleQueryPageText(WorldPacket& recvData) } } -void WorldSession::HandleCorpseMapPositionQuery(WorldPacket& recvData) +void WorldSession::HandleQueryCorpseTransport(WorldPackets::Query::QueryCorpseTransport& queryCorpseTransport) { - TC_LOG_DEBUG("network", "WORLD: Recv CMSG_CORPSE_MAP_POSITION_QUERY"); - - uint32 unk; - recvData >> unk; + WorldPackets::Query::CorpseTransportQuery response; + if (Corpse const* corpse = _player->GetCorpse()) + { + if (Transport const* transport = corpse->GetTransport()) + { + if (transport->GetGUID().GetCounter() == queryCorpseTransport.Transport) + { + response.Position = transport->GetPosition(); + response.Facing = transport->GetOrientation(); + } + } + } - WorldPacket data(SMSG_CORPSE_MAP_POSITION_QUERY_RESPONSE, 4+4+4+4); - data << float(0); - data << float(0); - data << float(0); - data << float(0); - SendPacket(&data); + SendPacket(response.Write()); } void WorldSession::HandleQuestPOIQuery(WorldPackets::Query::QuestPOIQuery& query) |