Core/Battle.net: Downgrade packet structures to 4.3.4
This commit is contained in:
1 parent
e67e8ecd36
commit
e085f1d909
4 files changed
+41
-40
No files matched your search
@@ -166,16 +166,14 @@ void Battlenet::AuthComplete::Write()
|
||||
_stream.WriteString(LastName, 8); // Last name - not set for WoW
|
||||
|
||||
_stream.Write(GameAccountId, 32);
|
||||
|
||||
_stream.Write(2, 8);
|
||||
_stream.Write(0, 64);
|
||||
_stream.Write(2, 8);
|
||||
|
||||
_stream.WriteString(GameAccountName, 5, -1);
|
||||
|
||||
_stream.Write(AccountFlags, 64);
|
||||
|
||||
_stream.Write(0, 32);
|
||||
_stream.Write(0, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -222,10 +220,9 @@ void Battlenet::RealmCharacterCounts::Write()
|
||||
_stream.Write(CharacterCounts.size(), 7);
|
||||
for (CharacterCountEntry const& entry : CharacterCounts)
|
||||
{
|
||||
_stream.Write(entry.Realm.Region, 8);
|
||||
_stream.Write(0, 12);
|
||||
_stream.Write(entry.Realm.Battlegroup, 8);
|
||||
_stream.Write(entry.Realm.Index, 32);
|
||||
_stream.Write(entry.Realm.Region, 8);
|
||||
_stream.Write(entry.CharacterCount, 16);
|
||||
}
|
||||
|
||||
@@ -242,7 +239,10 @@ std::string Battlenet::RealmCharacterCounts::ToString() const
|
||||
stream << "Battlenet::RealmCharacterCounts Realms " << CharacterCounts.size();
|
||||
|
||||
for (CharacterCountEntry const& entry : CharacterCounts)
|
||||
stream << std::endl << "Region " << entry.Realm.Region << " Battlegroup " << entry.Realm.Region << " Index " << entry.Realm.Index << " Characters " << entry.CharacterCount;
|
||||
stream << std::endl << "Region " << uint32(entry.Realm.Region) << " Battlegroup " << uint32(entry.Realm.Region) << " Index " << entry.Realm.Index << " Characters " << entry.CharacterCount;
|
||||
|
||||
for (ServerPacket* realmData : RealmData)
|
||||
stream << std::endl << realmData->ToString();
|
||||
|
||||
return stream.str().c_str();
|
||||
}
|
||||
@@ -250,13 +250,11 @@ std::string Battlenet::RealmCharacterCounts::ToString() const
|
||||
void Battlenet::RealmUpdate::Write()
|
||||
{
|
||||
_stream.Write(true, 1); // Success
|
||||
_stream.Write(Timezone, 32);
|
||||
_stream.Write(Type + -std::numeric_limits<int32>::min(), 32);
|
||||
_stream.WriteFloat(Population);
|
||||
_stream.Write(Flags, 8);
|
||||
_stream.Write(Lock, 8);
|
||||
_stream.Write(0, 19);
|
||||
_stream.Write(Type + std::numeric_limits<int32>::min(), 32);
|
||||
_stream.WriteString(Name, 10);
|
||||
|
||||
_stream.Write(Timezone, 32);
|
||||
_stream.Write(!Version.empty(), 1);
|
||||
if (!Version.empty())
|
||||
{
|
||||
@@ -273,18 +271,18 @@ void Battlenet::RealmUpdate::Write()
|
||||
_stream.WriteBytes(&port, 2);
|
||||
}
|
||||
|
||||
_stream.Write(Flags, 8);
|
||||
_stream.Write(Region, 8);
|
||||
_stream.Write(0, 12);
|
||||
_stream.WriteString(Name, 10);
|
||||
|
||||
_stream.Write(Battlegroup, 8);
|
||||
_stream.Write(Index, 32);
|
||||
_stream.Write(Region, 8);
|
||||
}
|
||||
|
||||
std::string Battlenet::RealmUpdate::ToString() const
|
||||
{
|
||||
std::ostringstream stream;
|
||||
stream << "Battlenet::RealmUpdate Timezone " << Timezone << " Population " << Population << " Lock " << Lock << " Type " << Type << " Name " << Name
|
||||
<< " Flags " << Flags << " Region " << Region << " Battlegroup " << Battlegroup << " Index " << Index;
|
||||
stream << "Battlenet::RealmUpdate Timezone " << Timezone << " Population " << Population << " Lock " << uint32(Lock) << " Type " << Type << " Name " << Name
|
||||
<< " Flags " << uint32(Flags) << " Region " << uint32(Region) << " Battlegroup " << uint32(Battlegroup) << " Index " << Index;
|
||||
|
||||
if (!Version.empty())
|
||||
stream << " Version " << Version;
|
||||
@@ -294,18 +292,16 @@ std::string Battlenet::RealmUpdate::ToString() const
|
||||
|
||||
void Battlenet::RealmJoinRequest::Read()
|
||||
{
|
||||
ClientSeed = _stream.Read<uint32>(32);
|
||||
Unknown = _stream.Read<uint32>(20);
|
||||
Realm.Region = _stream.Read<uint8>(8);
|
||||
_stream.Read<uint16>(12);
|
||||
Realm.Battlegroup = _stream.Read<uint8>(8);
|
||||
Realm.Index = _stream.Read<uint32>(32);
|
||||
Realm.Region = _stream.Read<uint8>(8);
|
||||
ClientSeed = _stream.Read<uint32>(32);
|
||||
}
|
||||
|
||||
std::string Battlenet::RealmJoinRequest::ToString() const
|
||||
{
|
||||
std::ostringstream stream;
|
||||
stream << "Battlenet::RealmJoinRequest ClientSeed" << ClientSeed << " Region " << Realm.Region << " Battlegroup " << Realm.Battlegroup << " Index " << Realm.Index;
|
||||
stream << "Battlenet::RealmJoinRequest ClientSeed " << ClientSeed << " Region " << uint32(Realm.Region) << " Battlegroup " << uint32(Realm.Battlegroup) << " Index " << Realm.Index;
|
||||
return stream.str().c_str();
|
||||
}
|
||||
|
||||
@@ -313,6 +309,7 @@ void Battlenet::RealmJoinResult::Write()
|
||||
{
|
||||
_stream.Write(0, 1); // Fail
|
||||
_stream.Write(ServerSeed, 32);
|
||||
_stream.Write(0, 5); // IPv6 addresses
|
||||
_stream.Write(IPv4.size(), 5);
|
||||
for (ACE_INET_Addr const& addr : IPv4)
|
||||
{
|
||||
@@ -325,11 +322,14 @@ void Battlenet::RealmJoinResult::Write()
|
||||
_stream.WriteBytes(&ip, 4);
|
||||
_stream.WriteBytes(&port, 2);
|
||||
}
|
||||
|
||||
_stream.Write(0, 5); // IPv6 addresses
|
||||
}
|
||||
|
||||
std::string Battlenet::RealmJoinResult::ToString() const
|
||||
{
|
||||
return "Battlenet::RealmJoinResult";
|
||||
std::ostringstream stream;
|
||||
stream << "Battlenet::RealmJoinResult ServerSeed " << ServerSeed << " Addresses (IPv4)" << IPv4.size();
|
||||
for (ACE_INET_Addr const& addr : IPv4)
|
||||
stream << std::endl << "Battlenet::RealmJoinResult::Address " << GetAddressString(addr);
|
||||
|
||||
return stream.str().c_str();
|
||||
}
|
||||
@@ -39,30 +39,33 @@ namespace Battlenet
|
||||
enum AuthOpcode
|
||||
{
|
||||
CMSG_AUTH_CHALLENGE = 0x0,
|
||||
CMSG_AUTH_RECONNECT = 0x1,
|
||||
CMSG_AUTH_PROOF_RESPONSE = 0x2,
|
||||
CMSG_AUTH_CHALLENGE_NEW = 0x9, // MoP
|
||||
|
||||
SMSG_AUTH_COMPLETE = 0x0,
|
||||
SMSG_AUTH_PROOF_REQUEST = 0x2,
|
||||
SMSG_AUTH_PROOF_REQUEST = 0x2
|
||||
};
|
||||
|
||||
enum CreepOpcodes
|
||||
{
|
||||
CMSG_PING = 0x0,
|
||||
CMSG_ENABLE_ENCRYPTION = 0x5,
|
||||
CMSG_INVALID_PACKET = 0x9,
|
||||
|
||||
SMSG_PONG = 0x0
|
||||
};
|
||||
|
||||
enum WoWOpcodes
|
||||
{
|
||||
CMSG_REALM_UPDATE = 0x0,
|
||||
CMSG_JOIN_REQUEST = 0x8,
|
||||
CMSG_REALM_UPDATE_SUBSCRIBE = 0x0,
|
||||
CMSG_REALM_UPDATE_UNSUBSCRIBE = 0x1,
|
||||
CMSG_JOIN_REQUEST = 0x8,
|
||||
|
||||
SMSG_CHARACTER_COUNTS = 0x0,
|
||||
SMSG_REALM_UPDATE = 0x2,
|
||||
SMSG_REALM_UPDATE_END = 0x3,
|
||||
SMSG_JOIN_RESULT = 0x8
|
||||
SMSG_CHARACTER_COUNTS = 0x0,
|
||||
SMSG_REALM_UPDATE = 0x2,
|
||||
SMSG_REALM_UPDATE_END = 0x3,
|
||||
SMSG_JOIN_RESULT = 0x8
|
||||
};
|
||||
|
||||
struct PacketHeader
|
||||
@@ -118,9 +121,7 @@ namespace Battlenet
|
||||
public:
|
||||
ClientPacket(PacketHeader const& header, BitStream& stream) : Packet(header, stream) { }
|
||||
|
||||
void Write() override { ASSERT(!"Write not implemented for this packet."); }
|
||||
|
||||
virtual std::string ToString() const override { return "Battenet::ClientPacket"; };
|
||||
void Write() override final { ASSERT(!"Write not implemented for this packet."); }
|
||||
};
|
||||
|
||||
class ServerPacket : public Packet
|
||||
@@ -129,9 +130,7 @@ namespace Battlenet
|
||||
ServerPacket(PacketHeader const& header);
|
||||
~ServerPacket();
|
||||
|
||||
void Read() override { ASSERT(!"Read not implemented for server packets."); }
|
||||
|
||||
virtual std::string ToString() const override { return "Battenet::ServerPacket"; };
|
||||
void Read() override final { ASSERT(!"Read not implemented for server packets."); }
|
||||
|
||||
uint8 const* GetData() const { return _stream.GetBuffer(); }
|
||||
size_t GetSize() const { return _stream.GetSize(); }
|
||||
|
||||
@@ -39,7 +39,7 @@ std::map<Battlenet::PacketHeader, Battlenet::Socket::PacketHandler> InitHandlers
|
||||
handlers[Battlenet::PacketHeader(Battlenet::CMSG_PING, Battlenet::CREEP)] = &Battlenet::Socket::HandlePing;
|
||||
handlers[Battlenet::PacketHeader(Battlenet::CMSG_ENABLE_ENCRYPTION, Battlenet::CREEP)] = &Battlenet::Socket::HandleEnableEncryption;
|
||||
|
||||
handlers[Battlenet::PacketHeader(Battlenet::CMSG_REALM_UPDATE, Battlenet::WOW)] = &Battlenet::Socket::HandleRealmUpdate;
|
||||
handlers[Battlenet::PacketHeader(Battlenet::CMSG_REALM_UPDATE_SUBSCRIBE, Battlenet::WOW)] = &Battlenet::Socket::HandleRealmUpdateSubscribe;
|
||||
handlers[Battlenet::PacketHeader(Battlenet::CMSG_JOIN_REQUEST, Battlenet::WOW)] = &Battlenet::Socket::HandleRealmJoinRequest;
|
||||
|
||||
return handlers;
|
||||
@@ -371,7 +371,7 @@ bool Battlenet::Socket::HandleEnableEncryption(PacketHeader& /*header*/, BitStre
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Battlenet::Socket::HandleRealmUpdate(PacketHeader& /*header*/, BitStream& /*packet*/)
|
||||
bool Battlenet::Socket::HandleRealmUpdateSubscribe(PacketHeader& /*header*/, BitStream& /*packet*/)
|
||||
{
|
||||
sRealmList->UpdateIfNeed();
|
||||
|
||||
@@ -535,6 +535,8 @@ void Battlenet::Socket::OnClose()
|
||||
|
||||
void Battlenet::Socket::Send(ServerPacket& packet)
|
||||
{
|
||||
TC_LOG_TRACE("server.battlenet", "Battlenet::Socket::Send %s", packet.ToString().c_str());
|
||||
|
||||
packet.Write();
|
||||
|
||||
_crypt.EncryptSend(const_cast<uint8*>(packet.GetData()), packet.GetSize());
|
||||
|
||||
@@ -60,7 +60,7 @@ namespace Battlenet
|
||||
bool HandleEnableEncryption(PacketHeader& header, BitStream& packet);
|
||||
|
||||
// WoW
|
||||
bool HandleRealmUpdate(PacketHeader& header, BitStream& packet);
|
||||
bool HandleRealmUpdateSubscribe(PacketHeader& header, BitStream& packet);
|
||||
bool HandleRealmJoinRequest(PacketHeader& header, BitStream& packet);
|
||||
|
||||
void OnRead() override;
|
||||
|
||||
Reference in new issue
Block a user