Core/Packets: converted SMSG_QUERY_PLAYER_NAME_RESPONSE to packet class

This commit is contained in:
Ovahlord committed 2021-12-29 21:05:42 +01:00
1 parent 8202480a93
commit 2916a38ea6
5 files changed
+53 -26

No files matched your search

@@ -175,6 +175,9 @@ bool WorldPackets::Query::PlayerGuidLookupData::Initialize(ObjectGuid const& gui
Sex = player->getGender();
ClassID = player->getClass();
Level = player->getLevel();
if (DeclinedName const* names = player->GetDeclinedNames())
DeclinedNames = *names;
}
else
{
@@ -187,3 +190,30 @@ bool WorldPackets::Query::PlayerGuidLookupData::Initialize(ObjectGuid const& gui
return true;
}
ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::Query::PlayerGuidLookupData const& lookupData)
{
data << lookupData.Name;
data << lookupData.RealmName;
data << uint8(lookupData.Race);
data << uint8(lookupData.Sex);
data << uint8(lookupData.ClassID);
data << bool(lookupData.DeclinedNames.has_value());
if (lookupData.DeclinedNames.has_value())
for (uint8 i = 0; i < MAX_DECLINED_NAME_CASES; ++i)
data << lookupData.DeclinedNames->name[i];
return data;
}
WorldPacket const* WorldPackets::Query::QueryPlayerNameResponse::Write()
{
_worldPacket << Player.WriteAsPacked();
_worldPacket << uint8(Result);
if (Result == RESPONSE_SUCCESS)
_worldPacket << Data;
return &_worldPacket;
}