aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Server
diff options
context:
space:
mode:
authorForesterDev <11771800+ForesterDev@users.noreply.github.com>2020-05-29 19:26:53 +0300
committerGitHub <noreply@github.com>2020-05-29 18:26:53 +0200
commitf7ac6296b6d5ee10f4248f64ee090950499cd12d (patch)
treead9c1cd818c1e494be1ec2600afb74eaa020e75c /src/server/game/Server
parentf0060496f9c8c4a21c28552a95928f2d05e031a9 (diff)
Core/PacketIO: Create BankHandler & update bank opcodes to new packet class (#24695)
* Core/PacketIO: Create BankHandler & update bank opcodes to new packet class (cherry picked from commit 478e86c074cc9c6a19f6c83d2a265eb1ccd705fc) * fix nopch build * Update SMSG_BUY_BANK_SLOT_RESULT * fix naming * fix copypaste error Co-authored-by: Luzifix <luzifix19@gmail.com>
Diffstat (limited to 'src/server/game/Server')
-rw-r--r--src/server/game/Server/Packets/AllPackets.h1
-rw-r--r--src/server/game/Server/Packets/BankPackets.cpp49
-rw-r--r--src/server/game/Server/Packets/BankPackets.h81
-rw-r--r--src/server/game/Server/WorldSession.h17
4 files changed, 144 insertions, 4 deletions
diff --git a/src/server/game/Server/Packets/AllPackets.h b/src/server/game/Server/Packets/AllPackets.h
index 3fdad4e577f..5fb2c5b9e82 100644
--- a/src/server/game/Server/Packets/AllPackets.h
+++ b/src/server/game/Server/Packets/AllPackets.h
@@ -18,6 +18,7 @@
#ifndef AllPackets_h__
#define AllPackets_h__
+#include "BankPackets.h"
#include "CharacterPackets.h"
#include "ChatPackets.h"
#include "CombatLogPackets.h"
diff --git a/src/server/game/Server/Packets/BankPackets.cpp b/src/server/game/Server/Packets/BankPackets.cpp
new file mode 100644
index 00000000000..3356d293ed7
--- /dev/null
+++ b/src/server/game/Server/Packets/BankPackets.cpp
@@ -0,0 +1,49 @@
+/*
+ * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
+ *
+ * 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 "BankPackets.h"
+
+void WorldPackets::Bank::AutoBankItem::Read()
+{
+ _worldPacket >> Bag;
+ _worldPacket >> Slot;
+}
+
+void WorldPackets::Bank::AutoStoreBankItem::Read()
+{
+ _worldPacket >> Bag;
+ _worldPacket >> Slot;
+}
+
+void WorldPackets::Bank::BuyBankSlot::Read()
+{
+ _worldPacket >> Banker;
+}
+
+WorldPacket const* WorldPackets::Bank::BuyBankSlotResult::Write()
+{
+ _worldPacket << uint32(Result);
+
+ return &_worldPacket;
+}
+
+WorldPacket const* WorldPackets::Bank::ShowBank::Write()
+{
+ _worldPacket << Banker;
+
+ return &_worldPacket;
+}
diff --git a/src/server/game/Server/Packets/BankPackets.h b/src/server/game/Server/Packets/BankPackets.h
new file mode 100644
index 00000000000..8cff53f4912
--- /dev/null
+++ b/src/server/game/Server/Packets/BankPackets.h
@@ -0,0 +1,81 @@
+/*
+ * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
+ *
+ * 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 BankPackets_h__
+#define BankPackets_h__
+
+#include "Packet.h"
+#include "ObjectGuid.h"
+
+namespace WorldPackets
+{
+ namespace Bank
+ {
+ class AutoBankItem final : public ClientPacket
+ {
+ public:
+ AutoBankItem(WorldPacket&& packet) : ClientPacket(CMSG_AUTOBANK_ITEM, std::move(packet)) { }
+
+ void Read() override;
+
+ uint8 Bag = 0;
+ uint8 Slot = 0;
+ };
+
+ class AutoStoreBankItem final : public ClientPacket
+ {
+ public:
+ AutoStoreBankItem(WorldPacket&& packet) : ClientPacket(CMSG_AUTOSTORE_BANK_ITEM, std::move(packet)) { }
+
+ void Read() override;
+
+ uint8 Bag = 0;
+ uint8 Slot = 0;
+ };
+
+ class BuyBankSlot final : public ClientPacket
+ {
+ public:
+ BuyBankSlot(WorldPacket&& packet) : ClientPacket(CMSG_BUY_BANK_SLOT, std::move(packet)) { }
+
+ void Read() override;
+
+ ObjectGuid Banker;
+ };
+
+ class BuyBankSlotResult final : public ServerPacket
+ {
+ public:
+ BuyBankSlotResult() : ServerPacket(SMSG_BUY_BANK_SLOT_RESULT, 4) { }
+
+ WorldPacket const* Write() override;
+
+ uint32 Result;
+ };
+
+ class ShowBank final : public ServerPacket
+ {
+ public:
+ ShowBank() : ServerPacket(SMSG_SHOW_BANK, 8) { }
+
+ WorldPacket const* Write() override;
+
+ ObjectGuid Banker;
+ };
+ }
+}
+#endif // BankPackets_h__
diff --git a/src/server/game/Server/WorldSession.h b/src/server/game/Server/WorldSession.h
index cdc1c77111e..57794ac81bf 100644
--- a/src/server/game/Server/WorldSession.h
+++ b/src/server/game/Server/WorldSession.h
@@ -78,6 +78,13 @@ class RBACData;
namespace WorldPackets
{
+ namespace Bank
+ {
+ class AutoBankItem;
+ class AutoStoreBankItem;
+ class BuyBankSlot;
+ }
+
namespace Character
{
class LogoutCancel;
@@ -755,8 +762,6 @@ class TC_GAME_API WorldSession
void SendActivateTaxiReply(ActivateTaxiReply reply);
void HandleTabardVendorActivateOpcode(WorldPacket& recvPacket);
- void HandleBankerActivateOpcode(WorldPacket& recvPacket);
- void HandleBuyBankSlotOpcode(WorldPacket& recvPacket);
void HandleTrainerListOpcode(WorldPackets::NPC::Hello& packet);
void HandleTrainerBuySpellOpcode(WorldPackets::NPC::TrainerBuySpell& packet);
void HandlePetitionShowListOpcode(WorldPacket& recvPacket);
@@ -798,6 +803,12 @@ class TC_GAME_API WorldSession
void HandleAuctionPlaceBid(WorldPacket& recvData);
void HandleAuctionListPendingSales(WorldPacket& recvData);
+ // Bank
+ void HandleBankerActivateOpcode(WorldPackets::NPC::Hello& packet);
+ void HandleAutoBankItemOpcode(WorldPackets::Bank::AutoBankItem& packet);
+ void HandleAutoStoreBankItemOpcode(WorldPackets::Bank::AutoStoreBankItem& packet);
+ void HandleBuyBankSlotOpcode(WorldPackets::Bank::BuyBankSlot& buyBankSlot);
+
void HandleGetMailList(WorldPacket& recvData);
void HandleSendMail(WorldPacket& recvData);
void HandleMailTakeMoney(WorldPacket& recvData);
@@ -823,8 +834,6 @@ class TC_GAME_API WorldSession
void HandleAutoEquipItemSlotOpcode(WorldPacket& recvPacket);
void HandleSwapItem(WorldPacket& recvPacket);
void HandleBuybackItem(WorldPacket& recvPacket);
- void HandleAutoBankItemOpcode(WorldPacket& recvPacket);
- void HandleAutoStoreBankItemOpcode(WorldPacket& recvPacket);
void HandleWrapItemOpcode(WorldPacket& recvPacket);
void HandleAttackSwingOpcode(WorldPackets::Combat::AttackSwing& packet);