mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-16 18:40:28 +00:00
feat(Core/Misc): implement ObjectGuid class (port from TC) (#4885)
This commit is contained in:
@@ -19,12 +19,12 @@
|
||||
#include "WorldPacket.h"
|
||||
#include "WorldSession.h"
|
||||
|
||||
void WorldSession::SendNameQueryOpcode(uint64 guid)
|
||||
void WorldSession::SendNameQueryOpcode(ObjectGuid guid)
|
||||
{
|
||||
GlobalPlayerData const* playerData = sWorld->GetGlobalPlayerData(GUID_LOPART(guid));
|
||||
GlobalPlayerData const* playerData = sWorld->GetGlobalPlayerData(guid.GetCounter());
|
||||
|
||||
WorldPacket data(SMSG_NAME_QUERY_RESPONSE, (8 + 1 + 1 + 1 + 1 + 1 + 10));
|
||||
data.appendPackGUID(guid);
|
||||
data << guid.WriteAsPacked();
|
||||
if (!playerData)
|
||||
{
|
||||
data << uint8(1); // name unknown
|
||||
@@ -32,7 +32,7 @@ void WorldSession::SendNameQueryOpcode(uint64 guid)
|
||||
return;
|
||||
}
|
||||
|
||||
Player* player = ObjectAccessor::FindPlayerInOrOutOfWorld(guid);
|
||||
Player* player = ObjectAccessor::FindConnectedPlayer(guid);
|
||||
|
||||
data << uint8(0); // name known
|
||||
data << playerData->name; // played name
|
||||
@@ -42,7 +42,7 @@ void WorldSession::SendNameQueryOpcode(uint64 guid)
|
||||
data << uint8(playerData->playerClass);
|
||||
|
||||
// pussywizard: optimization
|
||||
/*Player* player = ObjectAccessor::FindPlayerInOrOutOfWorld(guid);
|
||||
/*Player* player = ObjectAccessor::FindConnectedPlayer(guid);
|
||||
if (DeclinedName const* names = (player ? player->GetDeclinedNames() : nullptr))
|
||||
{
|
||||
data << uint8(1); // Name is declined
|
||||
@@ -57,7 +57,7 @@ void WorldSession::SendNameQueryOpcode(uint64 guid)
|
||||
|
||||
void WorldSession::HandleNameQueryOpcode(WorldPacket& recvData)
|
||||
{
|
||||
uint64 guid;
|
||||
ObjectGuid guid;
|
||||
recvData >> guid;
|
||||
|
||||
// This is disable by default to prevent lots of console spam
|
||||
@@ -84,7 +84,7 @@ void WorldSession::HandleCreatureQueryOpcode(WorldPacket& recvData)
|
||||
{
|
||||
uint32 entry;
|
||||
recvData >> entry;
|
||||
uint64 guid;
|
||||
ObjectGuid guid;
|
||||
recvData >> guid;
|
||||
|
||||
CreatureTemplate const* ci = sObjectMgr->GetCreatureTemplate(entry);
|
||||
@@ -138,7 +138,7 @@ void WorldSession::HandleCreatureQueryOpcode(WorldPacket& recvData)
|
||||
else
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("network", "WORLD: CMSG_CREATURE_QUERY - NO CREATURE INFO! (GUID: %u, ENTRY: %u)", GUID_LOPART(guid), entry);
|
||||
LOG_DEBUG("network", "WORLD: CMSG_CREATURE_QUERY - NO CREATURE INFO! (%s)", guid.ToString().c_str());
|
||||
#endif
|
||||
WorldPacket data(SMSG_CREATURE_QUERY_RESPONSE, 4);
|
||||
data << uint32(entry | 0x80000000);
|
||||
@@ -154,7 +154,7 @@ void WorldSession::HandleGameObjectQueryOpcode(WorldPacket& recvData)
|
||||
{
|
||||
uint32 entry;
|
||||
recvData >> entry;
|
||||
uint64 guid;
|
||||
ObjectGuid guid;
|
||||
recvData >> guid;
|
||||
|
||||
const GameObjectTemplate* info = sObjectMgr->GetGameObjectTemplate(entry);
|
||||
@@ -207,8 +207,7 @@ void WorldSession::HandleGameObjectQueryOpcode(WorldPacket& recvData)
|
||||
else
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("network", "WORLD: CMSG_GAMEOBJECT_QUERY - Missing gameobject info for (GUID: %u, ENTRY: %u)",
|
||||
GUID_LOPART(guid), entry);
|
||||
LOG_DEBUG("network", "WORLD: CMSG_GAMEOBJECT_QUERY - Missing gameobject info for (%s)", guid.ToString().c_str());
|
||||
#endif
|
||||
WorldPacket data (SMSG_GAMEOBJECT_QUERY_RESPONSE, 4);
|
||||
data << uint32(entry | 0x80000000);
|
||||
@@ -225,9 +224,7 @@ void WorldSession::HandleCorpseQueryOpcode(WorldPacket& /*recvData*/)
|
||||
LOG_DEBUG("network", "WORLD: Received MSG_CORPSE_QUERY");
|
||||
#endif
|
||||
|
||||
Corpse* corpse = GetPlayer()->GetCorpse();
|
||||
|
||||
if (!corpse)
|
||||
if (!_player->HasCorpse())
|
||||
{
|
||||
WorldPacket data(MSG_CORPSE_QUERY, 1);
|
||||
data << uint8(0); // corpse not found
|
||||
@@ -235,24 +232,25 @@ void WorldSession::HandleCorpseQueryOpcode(WorldPacket& /*recvData*/)
|
||||
return;
|
||||
}
|
||||
|
||||
uint32 mapid = corpse->GetMapId();
|
||||
float x = corpse->GetPositionX();
|
||||
float y = corpse->GetPositionY();
|
||||
float z = corpse->GetPositionZ();
|
||||
uint32 corpsemapid = mapid;
|
||||
WorldLocation corpseLocation = _player->GetCorpseLocation();
|
||||
uint32 corpseMapID = corpseLocation.GetMapId();
|
||||
uint32 mapID = corpseLocation.GetMapId();
|
||||
float x = corpseLocation.GetPositionX();
|
||||
float y = corpseLocation.GetPositionY();
|
||||
float z = corpseLocation.GetPositionZ();
|
||||
|
||||
// if corpse at different map
|
||||
if (mapid != _player->GetMapId())
|
||||
if (mapID != _player->GetMapId())
|
||||
{
|
||||
// search entrance map for proper show entrance
|
||||
if (MapEntry const* corpseMapEntry = sMapStore.LookupEntry(mapid))
|
||||
if (MapEntry const* corpseMapEntry = sMapStore.LookupEntry(mapID))
|
||||
{
|
||||
if (corpseMapEntry->IsDungeon() && corpseMapEntry->entrance_map >= 0)
|
||||
{
|
||||
// if corpse map have entrance
|
||||
if (Map const* entranceMap = sMapMgr->CreateBaseMap(corpseMapEntry->entrance_map))
|
||||
{
|
||||
mapid = corpseMapEntry->entrance_map;
|
||||
mapID = corpseMapEntry->entrance_map;
|
||||
x = corpseMapEntry->entrance_x;
|
||||
y = corpseMapEntry->entrance_y;
|
||||
z = entranceMap->GetHeight(GetPlayer()->GetPhaseMask(), x, y, MAX_HEIGHT);
|
||||
@@ -263,11 +261,11 @@ void WorldSession::HandleCorpseQueryOpcode(WorldPacket& /*recvData*/)
|
||||
|
||||
WorldPacket data(MSG_CORPSE_QUERY, 1 + (6 * 4));
|
||||
data << uint8(1); // corpse found
|
||||
data << int32(mapid);
|
||||
data << int32(mapID);
|
||||
data << float(x);
|
||||
data << float(y);
|
||||
data << float(z);
|
||||
data << int32(corpsemapid);
|
||||
data << int32(corpseMapID);
|
||||
data << uint32(0); // unknown
|
||||
SendPacket(&data);
|
||||
}
|
||||
@@ -275,7 +273,7 @@ void WorldSession::HandleCorpseQueryOpcode(WorldPacket& /*recvData*/)
|
||||
void WorldSession::HandleNpcTextQueryOpcode(WorldPacket& recvData)
|
||||
{
|
||||
uint32 textID;
|
||||
uint64 guid;
|
||||
ObjectGuid guid;
|
||||
|
||||
recvData >> textID;
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
|
||||
Reference in New Issue
Block a user