Skip to content

Commit

Permalink
[9266] Implement CMSG_CORPSE_MAP_POSITION_QUERY opcode.
Browse files Browse the repository at this point in the history
* Send coordinates of corpse on world map, if outside instance.
* Send coordinates of instance entrance, if inside instance.

Thanks to Ceris and Lightguard for helping with research/code.
  • Loading branch information
XTZGZoReX committed Jan 29, 2010
1 parent af146f1 commit 102abf5
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 8 deletions.
74 changes: 67 additions & 7 deletions src/game/QueryHandler.cpp
Expand Up @@ -314,7 +314,7 @@ void WorldSession::HandleCorpseQueryOpcode(WorldPacket & /*recv_data*/)
data << float(y);
data << float(z);
data << int32(corpsemapid);
data << uint32(0); // unknown
data << uint32(corpse->GetGUIDLow());
SendPacket(&data);
}

Expand Down Expand Up @@ -455,14 +455,74 @@ 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 = sMapMgr.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 = sObjectMgr.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);
}

Expand Down
2 changes: 1 addition & 1 deletion src/shared/revision_nr.h
@@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "9265"
#define REVISION_NR "9266"
#endif // __REVISION_NR_H__

6 comments on commit 102abf5

@darsh
Copy link

@darsh darsh commented on 102abf5 Jan 29, 2010

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just tested now and when a player dies that's no corpse to revive...
200on in the server and a lot of souls runing =O

@darsh
Copy link

@darsh darsh commented on 102abf5 Jan 30, 2010

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry my mistake i got that error on 9265 i will try out on 9266.
But the error is a litle "random" some players get and others dont.

@darsh
Copy link

@darsh darsh commented on 102abf5 Jan 30, 2010

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now i have crashes form hell the server cant stay on for 1 minute, and it's a clean version. [9266]

Call stack:
Address Frame Function SourceFile
00866ED9 00000000 WorldSession::HandleCorpseMapPositionQuery+B9
005F8460 00000000 WorldSession::Update+120
0060A053 00000000 World::UpdateSessions+C3
006088E5 00000000 World::Update+365
00430632 00000000 WorldRunnable::run+A2
00888479 00000000 ACE_Based::Thread::ThreadTask+19

@HybridEidolon
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm... not something I can confirm guys.

@Wowka321
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Crashes very often
http://paste2.org/p/640838

@digitalni
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Crashes very often, every 15 minutes or so.

Please sign in to comment.