aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Server/Packets
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2019-07-12 20:41:33 +0200
committerShauren <shauren.trinity@gmail.com>2019-07-14 19:20:44 +0200
commit0e4c5697704359f648be4eab52eeb739528eb9d2 (patch)
treebc7377eb7ab1f5a3b5f2620bda06b665a764e05d /src/server/game/Server/Packets
parent901d36b0a73fa0e181771e97b1848532a778d2e9 (diff)
Core/PacketIO: Updated packet structures to 8.2
Diffstat (limited to 'src/server/game/Server/Packets')
-rw-r--r--src/server/game/Server/Packets/AuthenticationPackets.cpp115
-rw-r--r--src/server/game/Server/Packets/AuthenticationPackets.h38
-rw-r--r--src/server/game/Server/Packets/BattlegroundPackets.cpp30
-rw-r--r--src/server/game/Server/Packets/BattlegroundPackets.h16
-rw-r--r--src/server/game/Server/Packets/BattlenetPackets.cpp1
-rw-r--r--src/server/game/Server/Packets/BattlenetPackets.h1
-rw-r--r--src/server/game/Server/Packets/ChannelPackets.cpp2
-rw-r--r--src/server/game/Server/Packets/GarrisonPackets.h4
-rw-r--r--src/server/game/Server/Packets/GuildPackets.cpp6
-rw-r--r--src/server/game/Server/Packets/InspectPackets.cpp53
-rw-r--r--src/server/game/Server/Packets/InspectPackets.h27
-rw-r--r--src/server/game/Server/Packets/ItemPackets.cpp17
-rw-r--r--src/server/game/Server/Packets/ItemPackets.h24
-rw-r--r--src/server/game/Server/Packets/SocialPackets.cpp2
-rw-r--r--src/server/game/Server/Packets/SocialPackets.h2
15 files changed, 178 insertions, 160 deletions
diff --git a/src/server/game/Server/Packets/AuthenticationPackets.cpp b/src/server/game/Server/Packets/AuthenticationPackets.cpp
index 88edeed4698..76cafe75ee2 100644
--- a/src/server/game/Server/Packets/AuthenticationPackets.cpp
+++ b/src/server/game/Server/Packets/AuthenticationPackets.cpp
@@ -21,6 +21,7 @@
#include "HmacHash.h"
#include "ObjectMgr.h"
#include "RSA.h"
+#include "SHA256.h"
#include "Util.h"
ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::Auth::VirtualRealmNameInfo const& virtualRealmInfo)
@@ -73,7 +74,7 @@ const WorldPacket* WorldPackets::Auth::Pong::Write()
WorldPacket const* WorldPackets::Auth::AuthChallenge::Write()
{
- _worldPacket.append(DosChallenge, 8);
+ _worldPacket.append(DosChallenge.data(), DosChallenge.size());
_worldPacket.append(Challenge.data(), Challenge.size());
_worldPacket << uint8(DosZeroBits);
return &_worldPacket;
@@ -201,25 +202,6 @@ WorldPacket const* WorldPackets::Auth::WaitQueueUpdate::Write()
return &_worldPacket;
}
-std::string const WorldPackets::Auth::ConnectTo::Haiku("An island of peace\nCorruption is brought ashore\nPandarens will rise\n\0\0", 71);
-
-uint8 const WorldPackets::Auth::ConnectTo::PiDigits[130] =
-{
- 0x31, 0x41, 0x59, 0x26, 0x53, 0x58, 0x97, 0x93, 0x23, 0x84,
- 0x62, 0x64, 0x33, 0x83, 0x27, 0x95, 0x02, 0x88, 0x41, 0x97,
- 0x16, 0x93, 0x99, 0x37, 0x51, 0x05, 0x82, 0x09, 0x74, 0x94,
- 0x45, 0x92, 0x30, 0x78, 0x16, 0x40, 0x62, 0x86, 0x20, 0x89,
- 0x98, 0x62, 0x80, 0x34, 0x82, 0x53, 0x42, 0x11, 0x70, 0x67,
- 0x98, 0x21, 0x48, 0x08, 0x65, 0x13, 0x28, 0x23, 0x06, 0x64,
- 0x70, 0x93, 0x84, 0x46, 0x09, 0x55, 0x05, 0x82, 0x23, 0x17,
- 0x25, 0x35, 0x94, 0x08, 0x12, 0x84, 0x81, 0x11, 0x74, 0x50,
- 0x28, 0x41, 0x02, 0x70, 0x19, 0x38, 0x52, 0x11, 0x05, 0x55,
- 0x96, 0x44, 0x62, 0x29, 0x48, 0x95, 0x49, 0x30, 0x38, 0x19,
- 0x64, 0x42, 0x88, 0x10, 0x97, 0x56, 0x65, 0x93, 0x34, 0x46,
- 0x12, 0x84, 0x75, 0x64, 0x82, 0x33, 0x78, 0x67, 0x83, 0x16,
- 0x52, 0x71, 0x20, 0x19, 0x09, 0x14, 0x56, 0x48, 0x56, 0x69,
-};
-
namespace
{
std::string RSAPrivateKey = R"(-----BEGIN RSA PRIVATE KEY-----
@@ -252,14 +234,6 @@ OHYtKG3GK3GEcFDwZU2LPHq21EroUAdtRfbrJ4KW2yc8igtXKxTBYw==
)";
std::unique_ptr<Trinity::Crypto::RSA> ConnectToRSA;
-
-uint8 const WherePacketHmac[] =
-{
- 0x2C, 0x1F, 0x1D, 0x80, 0xC3, 0x8C, 0x23, 0x64, 0xDA, 0x90, 0xCA, 0x8E, 0x2C, 0xFC, 0x0C, 0xCE,
- 0x09, 0xD3, 0x62, 0xF9, 0xF3, 0x8B, 0xBE, 0x9F, 0x19, 0xEF, 0x58, 0xA1, 0x1C, 0x34, 0x14, 0x41,
- 0x3F, 0x23, 0xFD, 0xD3, 0xE8, 0x14, 0xEC, 0x2A, 0xFD, 0x4F, 0x95, 0xBA, 0x30, 0x7E, 0x56, 0x5D,
- 0x83, 0x95, 0x81, 0x69, 0xB0, 0x5A, 0xB4, 0x9D, 0xA8, 0x55, 0xFF, 0xFC, 0xEE, 0x58, 0x0A, 0x2F
-};
}
bool WorldPackets::Auth::ConnectTo::InitializeEncryption()
@@ -272,50 +246,44 @@ bool WorldPackets::Auth::ConnectTo::InitializeEncryption()
return true;
}
-WorldPackets::Auth::ConnectTo::ConnectTo() : ServerPacket(SMSG_CONNECT_TO, 8 + 4 + 256 + 1)
+WorldPackets::Auth::ConnectTo::ConnectTo() : ServerPacket(SMSG_CONNECT_TO, 256 + 1 + 16 + 2 + 4 + 1 + 8)
{
- Payload.Where.fill(0);
- HexStrToByteArray("F41DCB2D728CF3337A4FF338FA89DB01BBBE9C3B65E9DA96268687353E48B94C", Payload.PanamaKey);
- Payload.Adler32 = 0xA0A66C10;
}
WorldPacket const* WorldPackets::Auth::ConnectTo::Write()
{
- HmacSha1 hmacHash(64, WherePacketHmac);
- hmacHash.UpdateData(Payload.Where.data(), 16);
- hmacHash.UpdateData((uint8* const)&Payload.Type, 1);
- hmacHash.UpdateData((uint8* const)&Payload.Port, 2);
- hmacHash.UpdateData((uint8* const)Haiku.c_str(), 71);
- hmacHash.UpdateData(Payload.PanamaKey, 32);
- hmacHash.UpdateData(PiDigits, 108);
- hmacHash.UpdateData(&Payload.XorMagic, 1);
- hmacHash.Finalize();
-
- ByteBuffer payload;
- payload << uint32(Payload.Adler32);
- payload << uint8(Payload.Type);
- payload.append(Payload.Where.data(), 16);
- payload << uint16(Payload.Port);
- payload.append(Haiku.data(), 71);
- payload.append(Payload.PanamaKey, 32);
- payload.append(PiDigits, 108);
- payload << uint8(Payload.XorMagic);
- payload.append(hmacHash.GetDigest(), hmacHash.GetLength());
-
- uint32 rsaSize = ConnectToRSA->GetOutputSize();
- if (payload.size() < rsaSize)
- payload.resize(rsaSize);
+ ByteBuffer whereBuffer;
+ whereBuffer << uint8(Payload.Where.Type);
+ switch (Payload.Where.Type)
+ {
+ case IPv4:
+ whereBuffer.append(Payload.Where.Address.V4.data(), Payload.Where.Address.V4.size());
+ break;
+ case IPv6:
+ whereBuffer.append(Payload.Where.Address.V6.data(), Payload.Where.Address.V6.size());
+ break;
+ case NamedSocket:
+ whereBuffer << Payload.Where.Address.Name.data();
+ break;
+ default:
+ break;
+ }
- _worldPacket << uint64(Key);
+ uint32 type = Payload.Where.Type;
+ SHA256Hash hash;
+ hash.UpdateData(whereBuffer.contents(), whereBuffer.size());
+ hash.UpdateData(reinterpret_cast<uint8 const*>(&type), 4);
+ hash.UpdateData(reinterpret_cast<uint8 const*>(&Payload.Port), 2);
+ hash.Finalize();
+
+ ConnectToRSA->Sign(hash.GetDigest(), hash.GetLength(), Payload.Signature.data(), Trinity::Crypto::RSA::SHA256{});
+
+ _worldPacket.append(Payload.Signature.data(), Payload.Signature.size());
+ _worldPacket.append(whereBuffer);
+ _worldPacket << uint16(Payload.Port);
_worldPacket << uint32(Serial);
- size_t encryptedPayloadPos = _worldPacket.wpos();
- _worldPacket.resize(_worldPacket.size() + rsaSize);
_worldPacket << uint8(Con);
-
- ConnectToRSA->Encrypt(payload.contents(), payload.size(),
- _worldPacket.contents() + encryptedPayloadPos,
- Trinity::Crypto::RSA::PrivateKey{},
- Trinity::Crypto::RSA::NoPadding{});
+ _worldPacket << uint64(Key);
return &_worldPacket;
}
@@ -333,3 +301,22 @@ void WorldPackets::Auth::ConnectToFailed::Read()
Serial = _worldPacket.read<ConnectToSerial>();
_worldPacket >> Con;
}
+
+uint8 constexpr EnableEncryptionSeed[16] = { 0x90, 0x9C, 0xD0, 0x50, 0x5A, 0x2C, 0x14, 0xDD, 0x5C, 0x2C, 0xC0, 0x64, 0x14, 0xF3, 0xFE, 0xC9 };
+
+WorldPacket const* WorldPackets::Auth::EnableEncryption::Write()
+{
+ HmacSha256 hash(16, EncryptionKey);
+ hash.UpdateData(reinterpret_cast<uint8 const*>(&Enabled), 1);
+ hash.UpdateData(EnableEncryptionSeed, 16);
+ hash.Finalize();
+
+ _worldPacket.resize(_worldPacket.size() + ConnectToRSA->GetOutputSize());
+
+ ConnectToRSA->Sign(hash.GetDigest(), hash.GetLength(), _worldPacket.contents(), Trinity::Crypto::RSA::SHA256{});
+
+ _worldPacket.WriteBit(Enabled);
+ _worldPacket.FlushBits();
+
+ return &_worldPacket;
+}
diff --git a/src/server/game/Server/Packets/AuthenticationPackets.h b/src/server/game/Server/Packets/AuthenticationPackets.h
index 556a4db0594..661676ed6af 100644
--- a/src/server/game/Server/Packets/AuthenticationPackets.h
+++ b/src/server/game/Server/Packets/AuthenticationPackets.h
@@ -63,12 +63,12 @@ namespace WorldPackets
class AuthChallenge final : public ServerPacket
{
public:
- AuthChallenge() : ServerPacket(SMSG_AUTH_CHALLENGE, 4 + 32 + 1) { }
+ AuthChallenge() : ServerPacket(SMSG_AUTH_CHALLENGE, 16 + 4 * 8 + 1) { }
WorldPacket const* Write() override;
std::array<uint8, 16> Challenge = { };
- uint32 DosChallenge[8] = { }; ///< Encryption seeds
+ std::array<uint32, 8> DosChallenge = { };
uint8 DosZeroBits = 0;
};
@@ -200,26 +200,32 @@ namespace WorldPackets
class ConnectTo final : public ServerPacket
{
- static std::string const Haiku;
- static uint8 const PiDigits[130];
-
public:
static bool InitializeEncryption();
enum AddressType : uint8
{
IPv4 = 1,
- IPv6 = 2
+ IPv6 = 2,
+ NamedSocket = 3 // not supported by windows client
+ };
+
+ struct SocketAddress
+ {
+ AddressType Type;
+ union
+ {
+ std::array<uint8, 4> V4;
+ std::array<uint8, 16> V6;
+ std::array<char, 128> Name;
+ } Address;
};
struct ConnectPayload
{
- std::array<uint8, 16> Where;
+ SocketAddress Where;
uint16 Port;
- AddressType Type;
- uint32 Adler32 = 0;
- uint8 XorMagic = 0x2A;
- uint8 PanamaKey[32];
+ std::array<uint8, 256> Signature;
};
ConnectTo();
@@ -275,9 +281,15 @@ namespace WorldPackets
class EnableEncryption final : public ServerPacket
{
public:
- EnableEncryption() : ServerPacket(SMSG_ENABLE_ENCRYPTION, 0) { }
+ EnableEncryption(uint8 const* encryptionKey, bool enabled) : ServerPacket(SMSG_ENABLE_ENCRYPTION, 256 + 1),
+ EncryptionKey(encryptionKey), Enabled(enabled)
+ {
+ }
- WorldPacket const* Write() override { return &_worldPacket; }
+ WorldPacket const* Write() override;
+
+ uint8 const* EncryptionKey;
+ bool Enabled = false;
};
}
}
diff --git a/src/server/game/Server/Packets/BattlegroundPackets.cpp b/src/server/game/Server/Packets/BattlegroundPackets.cpp
index f4cd72123db..3c66cbc4853 100644
--- a/src/server/game/Server/Packets/BattlegroundPackets.cpp
+++ b/src/server/game/Server/Packets/BattlegroundPackets.cpp
@@ -19,9 +19,10 @@
WorldPacket const* WorldPackets::Battleground::PVPSeason::Write()
{
- _worldPacket << uint32(CurrentSeason);
- _worldPacket << uint32(PreviousSeason);
- _worldPacket << uint32(PvpSeasonID);
+ _worldPacket << int32(MythicPlusSeasonID);
+ _worldPacket << int32(CurrentSeason);
+ _worldPacket << int32(PreviousSeason);
+ _worldPacket << int32(PvpSeasonID);
return &_worldPacket;
}
@@ -46,9 +47,12 @@ WorldPacket const* WorldPackets::Battleground::AreaSpiritHealerTime::Write()
ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::Battleground::PVPLogData::RatingData const& ratingData)
{
- data.append(ratingData.Prematch, 2);
- data.append(ratingData.Postmatch, 2);
- data.append(ratingData.PrematchMMR, 2);
+ for (std::size_t i = 0; i < 2; ++i)
+ {
+ data << int32(ratingData.Prematch[i]);
+ data << int32(ratingData.Postmatch[i]);
+ data << int32(ratingData.PrematchMMR[i]);
+ }
return data;
}
@@ -60,7 +64,7 @@ ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::Battleground::PVPLogData:
return data;
}
-ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::Battleground::PVPLogData::PlayerData const& playerData)
+ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::Battleground::PVPLogData::PVPMatchPlayerStatistics const& playerData)
{
data << playerData.PlayerGUID;
data << uint32(playerData.Kills);
@@ -105,20 +109,16 @@ ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::Battleground::PVPLogData:
WorldPacket const* WorldPackets::Battleground::PVPLogData::Write()
{
- _worldPacket.reserve(Players.size() * sizeof(PlayerData) + sizeof(PVPLogData));
+ _worldPacket.reserve(Statistics.size() * sizeof(PVPMatchPlayerStatistics) + sizeof(PVPLogData));
_worldPacket.WriteBit(Ratings.is_initialized());
- _worldPacket.WriteBit(Winner.is_initialized());
- _worldPacket << uint32(Players.size());
- _worldPacket.append(PlayerCount, 2);
+ _worldPacket << uint32(Statistics.size());
+ _worldPacket.append(PlayerCount.data(), PlayerCount.size());
if (Ratings.is_initialized())
_worldPacket << *Ratings;
- if (Winner)
- _worldPacket << uint8(*Winner);
-
- for (PlayerData const& player : Players)
+ for (PVPMatchPlayerStatistics const& player : Statistics)
_worldPacket << player;
return &_worldPacket;
diff --git a/src/server/game/Server/Packets/BattlegroundPackets.h b/src/server/game/Server/Packets/BattlegroundPackets.h
index c470ad7bbf6..d7084704b41 100644
--- a/src/server/game/Server/Packets/BattlegroundPackets.h
+++ b/src/server/game/Server/Packets/BattlegroundPackets.h
@@ -32,13 +32,14 @@ namespace WorldPackets
class PVPSeason final : public ServerPacket
{
public:
- PVPSeason() : ServerPacket(SMSG_PVP_SEASON, 8) { }
+ PVPSeason() : ServerPacket(SMSG_PVP_SEASON, 4 + 4 + 4 + 4) { }
WorldPacket const* Write() override;
- uint32 PreviousSeason = 0;
- uint32 CurrentSeason = 0;
- uint32 PvpSeasonID = 0;
+ int32 MythicPlusSeasonID = 0;
+ int32 PreviousSeason = 0;
+ int32 CurrentSeason = 0;
+ int32 PvpSeasonID = 0;
};
class AreaSpiritHealerQuery final : public ClientPacket
@@ -109,7 +110,7 @@ namespace WorldPackets
uint32 ContributionPoints = 0;
};
- struct PlayerData
+ struct PVPMatchPlayerStatistics
{
ObjectGuid PlayerGUID;
uint32 Kills = 0;
@@ -131,10 +132,9 @@ namespace WorldPackets
int32 HonorLevel = 0;
};
- Optional<uint8> Winner;
- std::vector<PlayerData> Players;
+ std::vector<PVPMatchPlayerStatistics> Statistics;
Optional<RatingData> Ratings;
- int8 PlayerCount[2] = { };
+ std::array<int8, 2> PlayerCount = { };
};
struct BattlefieldStatusHeader
diff --git a/src/server/game/Server/Packets/BattlenetPackets.cpp b/src/server/game/Server/Packets/BattlenetPackets.cpp
index ea0ba7f9052..5fc6b6d3767 100644
--- a/src/server/game/Server/Packets/BattlenetPackets.cpp
+++ b/src/server/game/Server/Packets/BattlenetPackets.cpp
@@ -55,6 +55,7 @@ WorldPacket const* WorldPackets::Battlenet::Response::Write()
WorldPacket const* WorldPackets::Battlenet::SetSessionState::Write()
{
_worldPacket.WriteBits(State, 2);
+ _worldPacket.WriteBit(SuppressNotification);
_worldPacket.FlushBits();
return &_worldPacket;
diff --git a/src/server/game/Server/Packets/BattlenetPackets.h b/src/server/game/Server/Packets/BattlenetPackets.h
index 797c53ee6df..d10646e23d2 100644
--- a/src/server/game/Server/Packets/BattlenetPackets.h
+++ b/src/server/game/Server/Packets/BattlenetPackets.h
@@ -68,6 +68,7 @@ namespace WorldPackets
WorldPacket const* Write() override;
uint8 State = 0;
+ bool SuppressNotification = true;
};
class RealmListTicket final : public ServerPacket
diff --git a/src/server/game/Server/Packets/ChannelPackets.cpp b/src/server/game/Server/Packets/ChannelPackets.cpp
index 4ad4331f5d5..e9ce0b17b4a 100644
--- a/src/server/game/Server/Packets/ChannelPackets.cpp
+++ b/src/server/game/Server/Packets/ChannelPackets.cpp
@@ -65,7 +65,7 @@ WorldPacket const* WorldPackets::Channel::ChannelNotify::Write()
WorldPacket const* WorldPackets::Channel::ChannelNotifyJoined::Write()
{
_worldPacket.WriteBits(_Channel.length(), 7);
- _worldPacket.WriteBits(ChannelWelcomeMsg.length(), 10);
+ _worldPacket.WriteBits(ChannelWelcomeMsg.length(), 11);
_worldPacket << uint32(_ChannelFlags);
_worldPacket << int32(ChatChannelID);
_worldPacket << uint64(InstanceID);
diff --git a/src/server/game/Server/Packets/GarrisonPackets.h b/src/server/game/Server/Packets/GarrisonPackets.h
index 7eddbb46cf9..444f022d3ae 100644
--- a/src/server/game/Server/Packets/GarrisonPackets.h
+++ b/src/server/game/Server/Packets/GarrisonPackets.h
@@ -236,7 +236,7 @@ namespace WorldPackets
class GarrisonBuildingRemoved final : public ServerPacket
{
public:
- GarrisonBuildingRemoved() : ServerPacket(SMSG_GARRISON_BUILDING_REMOVED, 4 + 4 + 4) { }
+ GarrisonBuildingRemoved() : ServerPacket(SMSG_GARRISON_BUILDING_REMOVED, 4 + 4 + 4 + 4) { }
WorldPacket const* Write() override;
@@ -353,7 +353,7 @@ namespace WorldPackets
class GarrisonRemoveFollowerResult final : public ServerPacket
{
public:
- GarrisonRemoveFollowerResult() : ServerPacket(SMSG_GARRISON_REMOVE_FOLLOWER_RESULT, 8 + 4 + 4) { }
+ GarrisonRemoveFollowerResult() : ServerPacket(SMSG_GARRISON_REMOVE_FOLLOWER_RESULT, 8 + 4 + 4 + 4) { }
WorldPacket const* Write() override;
diff --git a/src/server/game/Server/Packets/GuildPackets.cpp b/src/server/game/Server/Packets/GuildPackets.cpp
index 56768fafe8f..1e074cb3025 100644
--- a/src/server/game/Server/Packets/GuildPackets.cpp
+++ b/src/server/game/Server/Packets/GuildPackets.cpp
@@ -68,7 +68,7 @@ WorldPacket const* WorldPackets::Guild::GuildRoster::Write()
_worldPacket.AppendPackedTime(CreateDate);
_worldPacket << int32(GuildFlags);
_worldPacket << uint32(MemberData.size());
- _worldPacket.WriteBits(WelcomeText.length(), 10);
+ _worldPacket.WriteBits(WelcomeText.length(), 11);
_worldPacket.WriteBits(InfoText.length(), 11);
_worldPacket.FlushBits();
@@ -93,7 +93,7 @@ WorldPacket const* WorldPackets::Guild::GuildRosterUpdate::Write()
void WorldPackets::Guild::GuildUpdateMotdText::Read()
{
- uint32 textLen = _worldPacket.ReadBits(10);
+ uint32 textLen = _worldPacket.ReadBits(11);
MotdText = _worldPacket.ReadString(textLen);
}
@@ -205,7 +205,7 @@ WorldPacket const* WorldPackets::Guild::GuildEventPresenceChange::Write()
WorldPacket const* WorldPackets::Guild::GuildEventMotd::Write()
{
- _worldPacket.WriteBits(MotdText.length(), 10);
+ _worldPacket.WriteBits(MotdText.length(), 11);
_worldPacket.FlushBits();
_worldPacket.WriteString(MotdText);
diff --git a/src/server/game/Server/Packets/InspectPackets.cpp b/src/server/game/Server/Packets/InspectPackets.cpp
index b4be28ae025..e65279b1d4a 100644
--- a/src/server/game/Server/Packets/InspectPackets.cpp
+++ b/src/server/game/Server/Packets/InspectPackets.cpp
@@ -54,6 +54,49 @@ ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::Inspect::InspectItemData
return data;
}
+void WorldPackets::Inspect::PlayerModelDisplayInfo::Initialize(Player const* player)
+{
+ GUID = player->GetGUID();
+ SpecializationID = player->GetPrimarySpecialization();
+ Name = player->GetName();
+ GenderID = player->m_playerData->NativeSex;
+ Skin = player->m_playerData->SkinID;
+ HairColor = player->m_playerData->HairColorID;
+ HairStyle = player->m_playerData->HairStyleID;
+ FacialHairStyle = player->m_playerData->FacialHairStyleID;
+ Face = player->m_playerData->FaceID;
+ Race = player->getRace();
+ ClassID = player->getClass();
+ std::copy(player->m_playerData->CustomDisplayOption.begin(), player->m_playerData->CustomDisplayOption.end(), CustomDisplay.begin());
+
+ for (uint8 i = 0; i < EQUIPMENT_SLOT_END; ++i)
+ if (::Item* item = player->GetItemByPos(INVENTORY_SLOT_BAG_0, i))
+ Items.emplace_back(item, i);
+}
+
+ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::Inspect::PlayerModelDisplayInfo const& displayInfo)
+{
+ data << displayInfo.GUID;
+ data << int32(displayInfo.SpecializationID);
+ data << uint32(displayInfo.Items.size());
+ data.WriteBits(displayInfo.Name.length(), 6);
+ data << uint8(displayInfo.GenderID);
+ data << uint8(displayInfo.Skin);
+ data << uint8(displayInfo.HairColor);
+ data << uint8(displayInfo.HairStyle);
+ data << uint8(displayInfo.FacialHairStyle);
+ data << uint8(displayInfo.Face);
+ data << uint8(displayInfo.Race);
+ data << uint8(displayInfo.ClassID);
+ data.append(displayInfo.CustomDisplay.data(), displayInfo.CustomDisplay.size());
+ data.WriteString(displayInfo.Name);
+
+ for (WorldPackets::Inspect::InspectItemData const& item : displayInfo.Items)
+ data << item;
+
+ return data;
+}
+
ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::Inspect::InspectGuildData const& guildData)
{
data << guildData.GuildGUID;
@@ -110,14 +153,11 @@ WorldPackets::Inspect::InspectItemData::InspectItemData(::Item const* item, uint
WorldPacket const* WorldPackets::Inspect::InspectResult::Write()
{
- _worldPacket << InspecteeGUID;
- _worldPacket << uint32(Items.size());
+ _worldPacket << DisplayInfo;
_worldPacket << uint32(Glyphs.size());
_worldPacket << uint32(Talents.size());
_worldPacket << uint32(PvpTalents.size());
- _worldPacket << int32(ClassID);
- _worldPacket << int32(SpecializationID);
- _worldPacket << int32(GenderID);
+ _worldPacket << int32(ItemLevel);
_worldPacket << uint8(LifetimeMaxRank);
_worldPacket << uint16(TodayHK);
_worldPacket << uint16(YesterdayHK);
@@ -143,9 +183,6 @@ WorldPacket const* WorldPackets::Inspect::InspectResult::Write()
if (AzeriteLevel)
_worldPacket << int32(*AzeriteLevel);
- for (InspectItemData const& item : Items)
- _worldPacket << item;
-
return &_worldPacket;
}
diff --git a/src/server/game/Server/Packets/InspectPackets.h b/src/server/game/Server/Packets/InspectPackets.h
index 51b1248e286..86ac8f286c4 100644
--- a/src/server/game/Server/Packets/InspectPackets.h
+++ b/src/server/game/Server/Packets/InspectPackets.h
@@ -24,6 +24,7 @@
#include "SharedDefines.h"
class Item;
+class Player;
namespace WorldPackets
{
@@ -60,6 +61,25 @@ namespace WorldPackets
std::vector<int32> AzeritePowers;
};
+ struct PlayerModelDisplayInfo
+ {
+ ObjectGuid GUID;
+ std::vector<InspectItemData> Items;
+ std::string Name;
+ int32 SpecializationID = 0;
+ uint8 GenderID = GENDER_NONE;
+ uint8 Skin = 0;
+ uint8 HairColor = 0;
+ uint8 HairStyle = 0;
+ uint8 FacialHairStyle = 0;
+ uint8 Face = 0;
+ uint8 Race = RACE_NONE;
+ uint8 ClassID = CLASS_NONE;
+ std::array<uint8, PLAYER_CUSTOM_DISPLAY_SIZE> CustomDisplay;
+
+ void Initialize(Player const* player);
+ };
+
struct InspectGuildData
{
ObjectGuid GuildGUID;
@@ -92,17 +112,14 @@ namespace WorldPackets
WorldPacket const* Write() override;
- ObjectGuid InspecteeGUID;
- std::vector<InspectItemData> Items;
+ PlayerModelDisplayInfo DisplayInfo;
std::vector<uint16> Glyphs;
std::vector<uint16> Talents;
std::array<uint16, MAX_PVP_TALENT_SLOTS> PvpTalents;
- int32 ClassID = CLASS_NONE;
- int32 GenderID = GENDER_NONE;
Optional<InspectGuildData> GuildData;
std::array<PVPBracketData, 6> Bracket;
- int32 SpecializationID = 0;
Optional<int32> AzeriteLevel;
+ int32 ItemLevel = 0;
uint32 LifetimeHK = 0;
uint32 HonorLevel = 0;
uint16 TodayHK = 0;
diff --git a/src/server/game/Server/Packets/ItemPackets.cpp b/src/server/game/Server/Packets/ItemPackets.cpp
index 653a49ea748..b45dcb290c1 100644
--- a/src/server/game/Server/Packets/ItemPackets.cpp
+++ b/src/server/game/Server/Packets/ItemPackets.cpp
@@ -328,15 +328,6 @@ void WorldPackets::Item::UseCritterItem::Read()
_worldPacket >> ItemGuid;
}
-void WorldPackets::Item::UpgradeItem::Read()
-{
- _worldPacket >> ItemMaster;
- _worldPacket >> ItemGUID;
- _worldPacket >> UpgradeID;
- _worldPacket >> ContainerSlot;
- _worldPacket >> Slot;
-}
-
void WorldPackets::Item::SocketGems::Read()
{
_worldPacket >> ItemGuid;
@@ -351,14 +342,6 @@ WorldPacket const* WorldPackets::Item::SocketGemsResult::Write()
return &_worldPacket;
}
-WorldPacket const* WorldPackets::Item::ItemUpgradeResult::Write()
-{
- _worldPacket.WriteBit(Success);
- _worldPacket.FlushBits();
-
- return &_worldPacket;
-}
-
void WorldPackets::Item::RemoveNewItem::Read()
{
_worldPacket >> ItemGuid;
diff --git a/src/server/game/Server/Packets/ItemPackets.h b/src/server/game/Server/Packets/ItemPackets.h
index 695f589612f..105fbfeae44 100644
--- a/src/server/game/Server/Packets/ItemPackets.h
+++ b/src/server/game/Server/Packets/ItemPackets.h
@@ -447,30 +447,6 @@ namespace WorldPackets
ObjectGuid ItemGuid;
};
- class UpgradeItem final : public ClientPacket
- {
- public:
- UpgradeItem(WorldPacket&& packet) : ClientPacket(CMSG_UPGRADE_ITEM, std::move(packet)) { }
-
- void Read() override;
-
- ObjectGuid ItemMaster;
- ObjectGuid ItemGUID;
- int32 ContainerSlot = 0;
- int32 UpgradeID = 0;
- int32 Slot = 0;
- };
-
- class ItemUpgradeResult final : public ServerPacket
- {
- public:
- ItemUpgradeResult() : ServerPacket(SMSG_ITEM_UPGRADE_RESULT, 1) { }
-
- WorldPacket const* Write() override;
-
- bool Success = false;
- };
-
class SocketGems final : public ClientPacket
{
public:
diff --git a/src/server/game/Server/Packets/SocialPackets.cpp b/src/server/game/Server/Packets/SocialPackets.cpp
index ba0bcff90bb..0854f33fc5e 100644
--- a/src/server/game/Server/Packets/SocialPackets.cpp
+++ b/src/server/game/Server/Packets/SocialPackets.cpp
@@ -51,6 +51,7 @@ ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::Social::ContactInfo const
data << uint32(contact.Level);
data << uint32(contact.ClassID);
data.WriteBits(contact.Notes.length(), 10);
+ data.WriteBit(contact.Mobile);
data.FlushBits();
data.WriteString(contact.Notes);
@@ -93,6 +94,7 @@ WorldPacket const* WorldPackets::Social::FriendStatus::Write()
_worldPacket << uint32(Level);
_worldPacket << uint32(ClassID);
_worldPacket.WriteBits(Notes.length(), 10);
+ _worldPacket.WriteBit(Mobile);
_worldPacket.FlushBits();
_worldPacket.WriteString(Notes);
diff --git a/src/server/game/Server/Packets/SocialPackets.h b/src/server/game/Server/Packets/SocialPackets.h
index 2d870b29de1..70cb6101465 100644
--- a/src/server/game/Server/Packets/SocialPackets.h
+++ b/src/server/game/Server/Packets/SocialPackets.h
@@ -53,6 +53,7 @@ namespace WorldPackets
uint32 AreaID = 0;
uint32 Level = 0;
uint32 ClassID = CLASS_NONE;
+ bool Mobile = false;
};
class ContactList final : public ServerPacket
@@ -84,6 +85,7 @@ namespace WorldPackets
uint32 Level = 0;
uint32 AreaID = 0;
uint8 FriendResult = 0; ///< @see enum FriendsResult
+ bool Mobile = false;
};
struct QualifiedGUID