aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Server/Packets
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2016-03-28 17:12:57 +0200
committerShauren <shauren.trinity@gmail.com>2016-03-28 17:12:57 +0200
commitdde620c402daf4ea8d132fb72a77eabc22f7a6d0 (patch)
tree7c12161d7a22915736b0c9a106de896eeb283399 /src/server/game/Server/Packets
parent619669c6209441fc2fb5b483d553badee8c30ad5 (diff)
Core: Updated to 6.2.4
* Rewrite bnetserver for new authentication protocol
Diffstat (limited to 'src/server/game/Server/Packets')
-rw-r--r--src/server/game/Server/Packets/AllPackets.h1
-rw-r--r--src/server/game/Server/Packets/BattlenetPackets.cpp89
-rw-r--r--src/server/game/Server/Packets/BattlenetPackets.h108
-rw-r--r--src/server/game/Server/Packets/QueryPackets.cpp2
4 files changed, 199 insertions, 1 deletions
diff --git a/src/server/game/Server/Packets/AllPackets.h b/src/server/game/Server/Packets/AllPackets.h
index 60dd2493b12..0d6d28446bc 100644
--- a/src/server/game/Server/Packets/AllPackets.h
+++ b/src/server/game/Server/Packets/AllPackets.h
@@ -24,6 +24,7 @@
#include "BankPackets.h"
#include "BattlefieldPackets.h"
#include "BattlegroundPackets.h"
+#include "BattlenetPackets.h"
#include "BattlePetPackets.h"
#include "BlackMarketPackets.h"
#include "CalendarPackets.h"
diff --git a/src/server/game/Server/Packets/BattlenetPackets.cpp b/src/server/game/Server/Packets/BattlenetPackets.cpp
new file mode 100644
index 00000000000..de3d6ab3010
--- /dev/null
+++ b/src/server/game/Server/Packets/BattlenetPackets.cpp
@@ -0,0 +1,89 @@
+/*
+ * Copyright (C) 2008-2016 TrinityCore <http://www.trinitycore.org/>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "BattlenetPackets.h"
+
+ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::Battlenet::MethodCall const& method)
+{
+ data << uint64(method.Type);
+ data << uint64(method.ObjectId);
+ data << uint32(method.Token);
+ return data;
+}
+
+ByteBuffer& operator>>(ByteBuffer& data, WorldPackets::Battlenet::MethodCall& method)
+{
+ data >> method.Type;
+ data >> method.ObjectId;
+ data >> method.Token;
+ return data;
+}
+
+WorldPacket const* WorldPackets::Battlenet::Notification::Write()
+{
+ _worldPacket << Method;
+ _worldPacket << uint32(Data.size());
+ _worldPacket.append(Data);
+
+ return &_worldPacket;
+}
+
+WorldPacket const* WorldPackets::Battlenet::Response::Write()
+{
+ _worldPacket << uint32(BnetStatus);
+ _worldPacket << Method;
+ _worldPacket << uint32(Data.size());
+ _worldPacket.append(Data);
+
+ return &_worldPacket;
+}
+
+WorldPacket const* WorldPackets::Battlenet::SetSessionState::Write()
+{
+ _worldPacket.WriteBits(State, 2);
+ _worldPacket.FlushBits();
+
+ return &_worldPacket;
+}
+
+WorldPacket const* WorldPackets::Battlenet::RealmListTicket::Write()
+{
+ _worldPacket << uint32(Token);
+ _worldPacket.WriteBit(Allow);
+ _worldPacket << uint32(Ticket.size());
+ _worldPacket.append(Ticket);
+
+ return &_worldPacket;
+}
+
+void WorldPackets::Battlenet::Request::Read()
+{
+ uint32 protoSize;
+
+ _worldPacket >> Method;
+ _worldPacket >> protoSize;
+
+ Data.Resize(protoSize);
+ _worldPacket.read(Data.GetWritePointer(), Data.GetRemainingSpace());
+ Data.WriteCompleted(protoSize);
+}
+
+void WorldPackets::Battlenet::RequestRealmListTicket::Read()
+{
+ _worldPacket >> Token;
+ _worldPacket.read(Secret.data(), Secret.size());
+}
diff --git a/src/server/game/Server/Packets/BattlenetPackets.h b/src/server/game/Server/Packets/BattlenetPackets.h
new file mode 100644
index 00000000000..f059b39b75f
--- /dev/null
+++ b/src/server/game/Server/Packets/BattlenetPackets.h
@@ -0,0 +1,108 @@
+/*
+ * Copyright (C) 2008-2016 TrinityCore <http://www.trinitycore.org/>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef BattlenetPackets_h__
+#define BattlenetPackets_h__
+
+#include "Packet.h"
+#include "MessageBuffer.h"
+#include "BattlenetRpcErrorCodes.h"
+
+namespace WorldPackets
+{
+ namespace Battlenet
+ {
+ struct MethodCall
+ {
+ uint64 Type = 0;
+ uint64 ObjectId = 0;
+ uint32 Token = 0;
+
+ uint32 GetServiceHash() const { return uint32(Type >> 32); }
+ uint32 GetMethodId() const { return uint32(Type & 0xFFFFFFFF); }
+ };
+
+ class Notification final : public ServerPacket
+ {
+ public:
+ Notification() : ServerPacket(SMSG_BATTLENET_NOTIFICATION, 8 + 8 + 4 + 4) { }
+
+ WorldPacket const* Write() override;
+
+ MethodCall Method;
+ ByteBuffer Data;
+ };
+
+ class Response final : public ServerPacket
+ {
+ public:
+ Response() : ServerPacket(SMSG_BATTLENET_RESPONSE, 4 + 8 + 8 + 4 + 4) { }
+
+ WorldPacket const* Write() override;
+
+ BattlenetRpcErrorCode BnetStatus = ERROR_OK;
+ MethodCall Method;
+ ByteBuffer Data;
+ };
+
+ class SetSessionState final : public ServerPacket
+ {
+ public:
+ SetSessionState() : ServerPacket(SMSG_BATTLENET_SET_SESSION_STATE, 1) { }
+
+ WorldPacket const* Write() override;
+
+ uint8 State = 0;
+ };
+
+ class RealmListTicket final : public ServerPacket
+ {
+ public:
+ RealmListTicket() : ServerPacket(SMSG_BATTLENET_REALM_LIST_TICKET) { }
+
+ WorldPacket const* Write() override;
+
+ uint32 Token;
+ bool Allow;
+ ByteBuffer Ticket;
+ };
+
+ class Request final : public ClientPacket
+ {
+ public:
+ Request(WorldPacket&& packet) : ClientPacket(CMSG_BATTLENET_REQUEST, std::move(packet)) { }
+
+ void Read() override;
+
+ MethodCall Method;
+ MessageBuffer Data;
+ };
+
+ class RequestRealmListTicket final : public ClientPacket
+ {
+ public:
+ RequestRealmListTicket(WorldPacket&& packet) : ClientPacket(CMSG_BATTLENET_REQUEST_REALM_LIST_TICKET, std::move(packet)) { }
+
+ void Read() override;
+
+ uint32 Token = 0;
+ std::array<uint8, 32> Secret;
+ };
+ }
+}
+
+#endif // BattlenetPackets_h__
diff --git a/src/server/game/Server/Packets/QueryPackets.cpp b/src/server/game/Server/Packets/QueryPackets.cpp
index ca37b04f484..aeaf43e6e8a 100644
--- a/src/server/game/Server/Packets/QueryPackets.cpp
+++ b/src/server/game/Server/Packets/QueryPackets.cpp
@@ -137,7 +137,7 @@ bool WorldPackets::Query::PlayerGuidLookupData::Initialize(ObjectGuid const& gui
else
{
uint32 accountId = ObjectMgr::GetPlayerAccountIdByGUID(guid);
- uint32 bnetAccountId = Battlenet::AccountMgr::GetIdByGameAccount(accountId);
+ uint32 bnetAccountId = ::Battlenet::AccountMgr::GetIdByGameAccount(accountId);
AccountID = ObjectGuid::Create<HighGuid::WowAccount>(accountId);
BnetAccountID = ObjectGuid::Create<HighGuid::BNetAccount>(bnetAccountId);