* Implement CMSG_CORPSE_MAP_POSITION_QUERY/CMSG_CORPSE_MAP_POSITION_QUERY_RESPONSE opcodes. Thanks to: Ceris, Lightguard, raczman for helping with research/code.

* Fix SMSG_QUERY_TIME_RESPONSE use/structure. Patch/research by TOM_RUS.

--HG--
branch : trunk
This commit is contained in:
XTZGZoReX
2010-01-29 22:24:18 +01:00
parent a385ea64b0
commit c3ae3b88aa
7 changed files with 82 additions and 26 deletions

View File

@@ -137,10 +137,15 @@ void WorldSession::HandleNameQueryOpcode( WorldPacket & recv_data )
void WorldSession::HandleQueryTimeOpcode( WorldPacket & /*recv_data*/ )
{
WorldPacket data( SMSG_QUERY_TIME_RESPONSE, 4+4 );
data << (uint32)time(NULL);
data << (uint32)0;
SendPacket( &data );
SendQueryTimeResponse();
}
void WorldSession::SendQueryTimeResponse()
{
WorldPacket data(SMSG_QUERY_TIME_RESPONSE, 4+4);
data << uint32(time(NULL));
data << uint32(sWorld.GetNextDailyQuestsResetTime() - time(NULL));
SendPacket(&data);
}
/// Only _static_ data send in this packet !!!
@@ -315,7 +320,7 @@ void WorldSession::HandleCorpseQueryOpcode(WorldPacket & /*recv_data*/)
data << float(y);
data << float(z);
data << int32(corpsemapid);
data << uint32(0);
data << uint32(corpse->GetGUIDLow());
SendPacket(&data);
}
@@ -456,13 +461,73 @@ void WorldSession::HandleCorpseMapPositionQuery( WorldPacket & recv_data )
{
sLog.outDebug( "WORLD: Recv CMSG_CORPSE_MAP_POSITION_QUERY" );
uint32 unk;
recv_data >> unk;
uint32 lowGuid;
recv_data >> lowGuid; // not needed
Player* player = _player;
Corpse* corpse = player->GetCorpse();
if (!corpse)
return;
WorldPacket data(CMSG_CORPSE_MAP_POSITION_QUERY_RESPONSE, 4+4+4+4);
data << float(0);
data << float(0);
data << float(0);
data << float(0);
Map* map = corpse->GetMap();
float cx, cy, cz;
if (map->IsDungeon())
{
int32 mapId;
float mx, my;
map->GetEntrancePos(mapId, mx, my);
const Map* newMap = MapManager::Instance().CreateBaseMap(mapId);
uint32 zoneId = newMap->GetZoneId(mx, my, 0);
float _mx = mx;
float _my = my;
Map2ZoneCoordinates(mx, my, zoneId);
float x = corpse->GetPositionX();
float y = corpse->GetPositionY();
Map2ZoneCoordinates(x, y, zoneId);
cx = x - mx;
cy = y - my;
cz = corpse->GetPositionZ() - map->GetHeight(_mx, _my, MAX_HEIGHT);
}
else
{
WorldSafeLocsEntry const *ClosestGrave = NULL;
// Special handle for battleground maps
if (BattleGround *bg = player->GetBattleGround())
ClosestGrave = bg->GetClosestGraveYard(player);
else
ClosestGrave = objmgr.GetClosestGraveYard(player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), player->GetMapId(), player->GetTeam());
if (!ClosestGrave)
return;
uint32 zoneId = corpse->GetZoneId();
float gx = ClosestGrave->x;
float gy = ClosestGrave->y;
Map2ZoneCoordinates(gx, gy, zoneId);
float x = corpse->GetPositionX();
float y = corpse->GetPositionY();
Map2ZoneCoordinates(x, y, zoneId);
cx = x - gx;
cy = y - gy;
cz = corpse->GetPositionZ() - ClosestGrave->z;
}
data << float(cx);
data << float(cy);
data << float(cz);
data << float(0); // unknown
SendPacket(&data);
}