aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorXTZGZoReX <none@none>2010-01-29 22:24:18 +0100
committerXTZGZoReX <none@none>2010-01-29 22:24:18 +0100
commitc3ae3b88aa4baa5348d800237e5894d67b583b16 (patch)
tree391c7e31dbbc8957854e2905d90ec66dcb1393d6 /src
parenta385ea64b03cc7afbdeb8df3ea8a6d5025d6f96a (diff)
* 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
Diffstat (limited to 'src')
-rw-r--r--src/game/Map.cpp1
-rw-r--r--src/game/Player.cpp9
-rw-r--r--src/game/Player.h1
-rw-r--r--src/game/QueryHandler.cpp87
-rw-r--r--src/game/TicketHandler.cpp7
-rw-r--r--src/game/World.h2
-rw-r--r--src/game/WorldSession.h1
7 files changed, 82 insertions, 26 deletions
diff --git a/src/game/Map.cpp b/src/game/Map.cpp
index db09156d8b7..7a22645d639 100644
--- a/src/game/Map.cpp
+++ b/src/game/Map.cpp
@@ -388,7 +388,6 @@ Map::EnsureGridLoadedAtEnter(const Cell &cell, Player *player)
if (player)
{
- player->SendDelayResponse(MAX_GRID_LOAD_TIME);
DEBUG_LOG("Player %s enter cell[%u,%u] triggers of loading grid[%u,%u] on map %u", player->GetName(), cell.CellX(), cell.CellY(), cell.GridX(), cell.GridY(), GetId());
}
else
diff --git a/src/game/Player.cpp b/src/game/Player.cpp
index 222ad5e40e1..fe7e5e206f7 100644
--- a/src/game/Player.cpp
+++ b/src/game/Player.cpp
@@ -4391,15 +4391,6 @@ void Player::BuildPlayerRepop()
SetByteValue(UNIT_FIELD_BYTES_1, 3, UNIT_BYTE1_FLAG_ALWAYS_STAND);
}
-void Player::SendDelayResponse(const uint32 ml_seconds)
-{
- //FIXME: is this delay time arg really need? 50msec by default in code
- WorldPacket data( SMSG_QUERY_TIME_RESPONSE, 4+4 );
- data << (uint32)time(NULL);
- data << (uint32)0;
- GetSession()->SendPacket( &data );
-}
-
void Player::ResurrectPlayer(float restore_percent, bool applySickness)
{
WorldPacket data(SMSG_DEATH_RELEASE_LOC, 4*4); // remove spirit healer position
diff --git a/src/game/Player.h b/src/game/Player.h
index 8c17670700a..525d81a59bd 100644
--- a/src/game/Player.h
+++ b/src/game/Player.h
@@ -1771,7 +1771,6 @@ class TRINITY_DLL_SPEC Player : public Unit, public GridObject<Player>
void BuildCreateUpdateBlockForPlayer( UpdateData *data, Player *target ) const;
void DestroyForPlayer( Player *target, bool anim = false ) const;
- void SendDelayResponse(const uint32);
void SendLogXPGain(uint32 GivenXP,Unit* victim,uint32 RestXP);
// notifiers
diff --git a/src/game/QueryHandler.cpp b/src/game/QueryHandler.cpp
index af2ffbb7272..5375e938f56 100644
--- a/src/game/QueryHandler.cpp
+++ b/src/game/QueryHandler.cpp
@@ -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);
}
diff --git a/src/game/TicketHandler.cpp b/src/game/TicketHandler.cpp
index d4015067eed..2322084afbd 100644
--- a/src/game/TicketHandler.cpp
+++ b/src/game/TicketHandler.cpp
@@ -39,6 +39,8 @@ void WorldSession::HandleGMTicketCreateOpcode( WorldPacket & recv_data )
float x, y, z;
std::string ticketText, ticketText2;
+ SendQueryTimeResponse();
+
WorldPacket data(SMSG_GMTICKET_CREATE, 4);
recv_data >> map;
recv_data >> x;
@@ -116,10 +118,7 @@ void WorldSession::HandleGMTicketDeleteOpcode( WorldPacket & /*recv_data*/)
void WorldSession::HandleGMTicketGetTicketOpcode( WorldPacket & /*recv_data*/)
{
- WorldPacket data( SMSG_QUERY_TIME_RESPONSE, 4+4 );
- data << (uint32)time(NULL);
- data << (uint32)0;
- SendPacket( &data );
+ SendQueryTimeResponse();
GM_Ticket *ticket = objmgr.GetGMTicketByPlayer(GetPlayer()->GetGUID());
if(ticket)
diff --git a/src/game/World.h b/src/game/World.h
index 68684e1896b..ce680e10711 100644
--- a/src/game/World.h
+++ b/src/game/World.h
@@ -516,6 +516,8 @@ class World
/// Update time
uint32 GetUpdateTime() const { return m_updateTime; }
void SetRecordDiffInterval(int32 t) { if(t >= 0) m_configs[CONFIG_INTERVAL_LOG_UPDATE] = (uint32)t; }
+ /// Next daily quests reset time
+ time_t GetNextDailyQuestsResetTime() const { return m_NextDailyQuestReset; }
/// Get the maximum skill level a player can reach
uint16 GetConfigMaxSkillValue() const
diff --git a/src/game/WorldSession.h b/src/game/WorldSession.h
index 40021262fd1..2d03bde4996 100644
--- a/src/game/WorldSession.h
+++ b/src/game/WorldSession.h
@@ -123,6 +123,7 @@ class TRINITY_DLL_SPEC WorldSession
void SendPartyResult(PartyOperation operation, const std::string& member, PartyResult res);
void SendAreaTriggerMessage(const char* Text, ...) ATTR_PRINTF(2,3);
void SendSetPhaseShift(uint32 phaseShift);
+ void SendQueryTimeResponse();
AccountTypes GetSecurity() const { return _security; }
uint32 GetAccountId() const { return _accountId; }