diff options
author | Luzifix <luzifix19@gmail.com> | 2015-03-18 23:00:25 +0100 |
---|---|---|
committer | Luzifix <luzifix19@gmail.com> | 2015-03-19 00:10:26 +0100 |
commit | 478e86c074cc9c6a19f6c83d2a265eb1ccd705fc (patch) | |
tree | 0a870482696b95ac89c719a0f9682b08047f3f68 /src | |
parent | 4ee22e3c5e8feeb0f6e9d388e03908eb0aa927c1 (diff) |
Core/PacketIO: Create BankHandler & Bank opcode Structure
Thx @gigi1237 for search Opcodes
Thx @Nayd to help with InvUpdate & InvItem Structure
Diffstat (limited to 'src')
-rw-r--r-- | src/server/game/Handlers/BankHandler.cpp | 172 | ||||
-rw-r--r-- | src/server/game/Handlers/ItemHandler.cpp | 134 | ||||
-rw-r--r-- | src/server/game/Handlers/NPCHandler.cpp | 25 | ||||
-rw-r--r-- | src/server/game/Server/Packets/BankPackets.cpp | 38 | ||||
-rw-r--r-- | src/server/game/Server/Packets/BankPackets.h | 65 | ||||
-rw-r--r-- | src/server/game/Server/Protocol/Opcodes.cpp | 11 | ||||
-rw-r--r-- | src/server/game/Server/Protocol/Opcodes.h | 8 | ||||
-rw-r--r-- | src/server/game/Server/WorldSession.h | 15 |
8 files changed, 297 insertions, 171 deletions
diff --git a/src/server/game/Handlers/BankHandler.cpp b/src/server/game/Handlers/BankHandler.cpp new file mode 100644 index 00000000000..8879b4e2532 --- /dev/null +++ b/src/server/game/Handlers/BankHandler.cpp @@ -0,0 +1,172 @@ +/* + * Copyright (C) 2008-2015 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 "BankPackets.h" +#include "NPCPackets.h" +#include "ObjectMgr.h" +#include "Opcodes.h" +#include "Player.h" +#include "WorldPacket.h" +#include "WorldSession.h" + +void WorldSession::HandleAutoBankItemOpcode(WorldPackets::Bank::AutoBankItem& packet) +{ + TC_LOG_DEBUG("network", "STORAGE: receive bag = %u, slot = %u", packet.Bag, packet.Slot); + + if (!CanUseBank()) + { + TC_LOG_ERROR("network", "WORLD: HandleAutoBankItemOpcode - Unit (%s) not found or you can't interact with him.", m_currentBankerGUID.ToString().c_str()); + return; + } + + Item* item = _player->GetItemByPos(packet.Bag, packet.Slot); + if (!item) + return; + + ItemPosCountVec dest; + InventoryResult msg = _player->CanBankItem(NULL_BAG, NULL_SLOT, dest, item, false); + if (msg != EQUIP_ERR_OK) + { + _player->SendEquipError(msg, item, NULL); + return; + } + + if (dest.size() == 1 && dest[0].pos == item->GetPos()) + { + _player->SendEquipError(EQUIP_ERR_CANT_SWAP, item, NULL); + return; + } + + _player->RemoveItem(packet.Bag, packet.Slot, true); + _player->ItemRemovedQuestCheck(item->GetEntry(), item->GetCount()); + _player->BankItem(dest, item, true); +} + +void WorldSession::HandleBankerActivateOpcode(WorldPackets::NPC::Hello& packet) +{ + Creature* unit = GetPlayer()->GetNPCIfCanInteractWith(packet.Unit, UNIT_NPC_FLAG_BANKER); + if (!unit) + { + TC_LOG_ERROR("network", "WORLD: HandleBankerActivateOpcode - %s not found or you can not interact with him.", packet.Unit.ToString().c_str()); + return; + } + + // remove fake death + if (GetPlayer()->HasUnitState(UNIT_STATE_DIED)) + GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH); + + // set currentBankerGUID for other bank action + + SendShowBank(packet.Unit); +} + +void WorldSession::HandleAutoStoreBankItemOpcode(WorldPackets::Bank::AutoStoreBankItem& packet) +{ + TC_LOG_DEBUG("network", "STORAGE: receive bag = %u, slot = %u", packet.Bag, packet.Slot); + + if (!CanUseBank()) + { + TC_LOG_ERROR("network", "WORLD: HandleAutoStoreBankItemOpcode - Unit (%s) not found or you can't interact with him.", m_currentBankerGUID.ToString().c_str()); + return; + } + + Item* item = _player->GetItemByPos(packet.Bag, packet.Slot); + if (!item) + return; + + if (_player->IsBankPos(packet.Bag, packet.Slot)) // moving from bank to inventory + { + ItemPosCountVec dest; + InventoryResult msg = _player->CanStoreItem(NULL_BAG, NULL_SLOT, dest, item, false); + if (msg != EQUIP_ERR_OK) + { + _player->SendEquipError(msg, item, NULL); + return; + } + + _player->RemoveItem(packet.Bag, packet.Slot, true); + if (Item const* storedItem = _player->StoreItem(dest, item, true)) + _player->ItemAddedQuestCheck(storedItem->GetEntry(), storedItem->GetCount()); + + } + else // moving from inventory to bank + { + ItemPosCountVec dest; + InventoryResult msg = _player->CanBankItem(NULL_BAG, NULL_SLOT, dest, item, false); + if (msg != EQUIP_ERR_OK) + { + _player->SendEquipError(msg, item, NULL); + return; + } + + _player->RemoveItem(packet.Bag, packet.Slot, true); + _player->BankItem(dest, item, true); + } +} + +void WorldSession::HandleBuyBankSlotOpcode(WorldPackets::Bank::BuyBankSlot& packet) +{ + WorldPacket data(SMSG_BUY_BANK_SLOT_RESULT, 4); + if (!CanUseBank(packet.Guid)) + { + data << uint32(ERR_BANKSLOT_NOTBANKER); + SendPacket(&data); + TC_LOG_ERROR("network", "WORLD: HandleBuyBankSlotOpcode - %s not found or you can't interact with him.", packet.Guid.ToString().c_str()); + return; + } + + uint32 slot = _player->GetBankBagSlotCount(); + + // next slot + ++slot; + + TC_LOG_INFO("network", "PLAYER: Buy bank bag slot, slot number = %u", slot); + + BankBagSlotPricesEntry const* slotEntry = sBankBagSlotPricesStore.LookupEntry(slot); + + if (!slotEntry) + { + data << uint32(ERR_BANKSLOT_FAILED_TOO_MANY); + SendPacket(&data); + return; + } + + uint32 price = slotEntry->Cost; + + if (!_player->HasEnoughMoney(uint64(price))) + { + data << uint32(ERR_BANKSLOT_INSUFFICIENT_FUNDS); + SendPacket(&data); + return; + } + + _player->SetBankBagSlotCount(slot); + _player->ModifyMoney(-int64(price)); + + data << uint32(ERR_BANKSLOT_OK); + SendPacket(&data); + + _player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BUY_BANK_SLOT); +} + +void WorldSession::SendShowBank(ObjectGuid guid) +{ + m_currentBankerGUID = guid; + WorldPackets::NPC::ShowBank packet; + packet.Guid = guid; + SendPacket(packet.Write()); +} diff --git a/src/server/game/Handlers/ItemHandler.cpp b/src/server/game/Handlers/ItemHandler.cpp index e6803832a56..db7b49521c3 100644 --- a/src/server/game/Handlers/ItemHandler.cpp +++ b/src/server/game/Handlers/ItemHandler.cpp @@ -741,140 +741,6 @@ void WorldSession::HandleAutoStoreBagItemOpcode(WorldPackets::Item::AutoStoreBag _player->StoreItem(dest, item, true); } -void WorldSession::HandleBuyBankSlotOpcode(WorldPacket& recvPacket) -{ - TC_LOG_DEBUG("network", "WORLD: CMSG_BUY_BANK_SLOT"); - - ObjectGuid guid; - recvPacket >> guid; - - WorldPacket data(SMSG_BUY_BANK_SLOT_RESULT, 4); - if (!CanUseBank(guid)) - { - data << uint32(ERR_BANKSLOT_NOTBANKER); - SendPacket(&data); - TC_LOG_DEBUG("network", "WORLD: HandleBuyBankSlotOpcode - %s not found or you can't interact with him.", guid.ToString().c_str()); - return; - } - - uint32 slot = _player->GetBankBagSlotCount(); - - // next slot - ++slot; - - TC_LOG_INFO("network", "PLAYER: Buy bank bag slot, slot number = %u", slot); - - BankBagSlotPricesEntry const* slotEntry = sBankBagSlotPricesStore.LookupEntry(slot); - - if (!slotEntry) - { - data << uint32(ERR_BANKSLOT_FAILED_TOO_MANY); - SendPacket(&data); - return; - } - - uint32 price = slotEntry->Cost; - - if (!_player->HasEnoughMoney(uint64(price))) - { - data << uint32(ERR_BANKSLOT_INSUFFICIENT_FUNDS); - SendPacket(&data); - return; - } - - _player->SetBankBagSlotCount(slot); - _player->ModifyMoney(-int64(price)); - - data << uint32(ERR_BANKSLOT_OK); - SendPacket(&data); - - _player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BUY_BANK_SLOT); -} - -void WorldSession::HandleAutoBankItemOpcode(WorldPacket& recvPacket) -{ - TC_LOG_DEBUG("network", "WORLD: CMSG_AUTOBANK_ITEM"); - uint8 srcbag, srcslot; - - recvPacket >> srcbag >> srcslot; - TC_LOG_DEBUG("network", "STORAGE: receive srcbag = %u, srcslot = %u", srcbag, srcslot); - - if (!CanUseBank()) - { - TC_LOG_DEBUG("network", "WORLD: HandleAutoBankItemOpcode - Unit (%s) not found or you can't interact with him.", m_currentBankerGUID.ToString().c_str()); - return; - } - - Item* pItem = _player->GetItemByPos(srcbag, srcslot); - if (!pItem) - return; - - ItemPosCountVec dest; - InventoryResult msg = _player->CanBankItem(NULL_BAG, NULL_SLOT, dest, pItem, false); - if (msg != EQUIP_ERR_OK) - { - _player->SendEquipError(msg, pItem, NULL); - return; - } - - if (dest.size() == 1 && dest[0].pos == pItem->GetPos()) - { - _player->SendEquipError(EQUIP_ERR_CANT_SWAP, pItem, NULL); - return; - } - - _player->RemoveItem(srcbag, srcslot, true); - _player->ItemRemovedQuestCheck(pItem->GetEntry(), pItem->GetCount()); - _player->BankItem(dest, pItem, true); -} - -void WorldSession::HandleAutoStoreBankItemOpcode(WorldPacket& recvPacket) -{ - TC_LOG_DEBUG("network", "WORLD: CMSG_AUTOSTORE_BANK_ITEM"); - uint8 srcbag, srcslot; - - recvPacket >> srcbag >> srcslot; - TC_LOG_DEBUG("network", "STORAGE: receive srcbag = %u, srcslot = %u", srcbag, srcslot); - - if (!CanUseBank()) - { - TC_LOG_DEBUG("network", "WORLD: HandleAutoStoreBankItemOpcode - Unit (%s) not found or you can't interact with him.", m_currentBankerGUID.ToString().c_str()); - return; - } - - Item* pItem = _player->GetItemByPos(srcbag, srcslot); - if (!pItem) - return; - - if (_player->IsBankPos(srcbag, srcslot)) // moving from bank to inventory - { - ItemPosCountVec dest; - InventoryResult msg = _player->CanStoreItem(NULL_BAG, NULL_SLOT, dest, pItem, false); - if (msg != EQUIP_ERR_OK) - { - _player->SendEquipError(msg, pItem, NULL); - return; - } - - _player->RemoveItem(srcbag, srcslot, true); - if (Item const* storedItem = _player->StoreItem(dest, pItem, true)) - _player->ItemAddedQuestCheck(storedItem->GetEntry(), storedItem->GetCount()); - } - else // moving from inventory to bank - { - ItemPosCountVec dest; - InventoryResult msg = _player->CanBankItem(NULL_BAG, NULL_SLOT, dest, pItem, false); - if (msg != EQUIP_ERR_OK) - { - _player->SendEquipError(msg, pItem, NULL); - return; - } - - _player->RemoveItem(srcbag, srcslot, true); - _player->BankItem(dest, pItem, true); - } -} - void WorldSession::SendEnchantmentLog(ObjectGuid target, ObjectGuid caster, uint32 itemId, uint32 enchantId) { WorldPacket data(SMSG_ENCHANTMENT_LOG, (8+8+4+4)); diff --git a/src/server/game/Handlers/NPCHandler.cpp b/src/server/game/Handlers/NPCHandler.cpp index 80a2284aa7d..48e752b5d0b 100644 --- a/src/server/game/Handlers/NPCHandler.cpp +++ b/src/server/game/Handlers/NPCHandler.cpp @@ -73,31 +73,6 @@ void WorldSession::SendTabardVendorActivate(ObjectGuid guid) SendPacket(packet.Write()); } -void WorldSession::HandleBankerActivateOpcode(WorldPackets::NPC::Hello& packet) -{ - TC_LOG_DEBUG("network", "WORLD: Received CMSG_BANKER_ACTIVATE"); - - Creature* unit = GetPlayer()->GetNPCIfCanInteractWith(packet.Unit, UNIT_NPC_FLAG_BANKER); - if (!unit) - { - TC_LOG_DEBUG("network", "WORLD: HandleBankerActivateOpcode - %s not found or you can not interact with him.", packet.Unit.ToString().c_str()); - return; - } - - // remove fake death - if (GetPlayer()->HasUnitState(UNIT_STATE_DIED)) - GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH); - - SendShowBank(packet.Unit); -} - -void WorldSession::SendShowBank(ObjectGuid guid) -{ - WorldPackets::NPC::ShowBank packet; - packet.Guid = guid; - SendPacket(packet.Write()); -} - void WorldSession::SendShowMailBox(ObjectGuid guid) { WorldPacket data(SMSG_SHOW_MAILBOX, 8); diff --git a/src/server/game/Server/Packets/BankPackets.cpp b/src/server/game/Server/Packets/BankPackets.cpp new file mode 100644 index 00000000000..0f6af30bed0 --- /dev/null +++ b/src/server/game/Server/Packets/BankPackets.cpp @@ -0,0 +1,38 @@ +/* + * Copyright (C) 2008-2015 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 "BankPackets.h" +#include "ItemPackets.h" + +void WorldPackets::Bank::AutoBankItem::Read() +{ + _worldPacket >> Inv + >> Bag + >> Slot; +} + +void WorldPackets::Bank::AutoStoreBankItem::Read() +{ + _worldPacket >> Inv + >> Bag + >> Slot; +} + +void WorldPackets::Bank::BuyBankSlot::Read() +{ + _worldPacket >> Guid; +} diff --git a/src/server/game/Server/Packets/BankPackets.h b/src/server/game/Server/Packets/BankPackets.h new file mode 100644 index 00000000000..dc7883c3643 --- /dev/null +++ b/src/server/game/Server/Packets/BankPackets.h @@ -0,0 +1,65 @@ +/* + * Copyright (C) 2008-2015 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 BankPackets_h__ +#define BankPackets_h__ + +#include "ItemPackets.h" +#include "Packet.h" +#include "ObjectGuid.h" +#include "WorldSession.h" + +namespace WorldPackets +{ + namespace Bank + { + class AutoBankItem final : public ClientPacket + { + public: + AutoBankItem(WorldPacket&& packet) : ClientPacket(CMSG_AUTOBANK_ITEM, std::move(packet)) { } + + void Read() override; + + WorldPackets::Item::InvUpdate Inv; + 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; + + WorldPackets::Item::InvUpdate Inv; + 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 Guid; + }; + } +} +#endif // BankPackets_h__ diff --git a/src/server/game/Server/Protocol/Opcodes.cpp b/src/server/game/Server/Protocol/Opcodes.cpp index 86c5ba482cf..29c0496bbe8 100644 --- a/src/server/game/Server/Protocol/Opcodes.cpp +++ b/src/server/game/Server/Protocol/Opcodes.cpp @@ -20,6 +20,7 @@ #include "WorldSession.h" #include "Packets/AchievementPackets.h" #include "Packets/AuctionHousePackets.h" +#include "Packets/BankPackets.h" #include "Packets/BlackMarketPackets.h" #include "Packets/CharacterPackets.h" #include "Packets/ChannelPackets.h" @@ -178,12 +179,12 @@ void OpcodeTable::Initialize() DEFINE_OPCODE_HANDLER_OLD(CMSG_AUCTION_SELL_ITEM, STATUS_UNHANDLED, PROCESS_THREADUNSAFE, &WorldSession::HandleAuctionSellItem ); DEFINE_HANDLER(CMSG_AUTH_CONTINUED_SESSION, STATUS_NEVER, PROCESS_INPLACE, WorldPacket, &WorldSession::Handle_EarlyProccess); DEFINE_HANDLER(CMSG_AUTH_SESSION, STATUS_NEVER, PROCESS_INPLACE, WorldPacket, &WorldSession::Handle_EarlyProccess); - DEFINE_OPCODE_HANDLER_OLD(CMSG_AUTOBANK_ITEM, STATUS_UNHANDLED, PROCESS_THREADUNSAFE, &WorldSession::HandleAutoBankItemOpcode ); + DEFINE_HANDLER(CMSG_AUTOBANK_ITEM, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, WorldPackets::Bank::AutoBankItem, &WorldSession::HandleAutoBankItemOpcode); DEFINE_OPCODE_HANDLER_OLD(CMSG_AUTOEQUIP_GROUND_ITEM, STATUS_UNHANDLED, PROCESS_INPLACE, &WorldSession::Handle_NULL ); - DEFINE_HANDLER(CMSG_AUTOEQUIP_ITEM, STATUS_UNHANDLED, PROCESS_THREADUNSAFE, WorldPackets::Item::AutoEquipItem, &WorldSession::HandleAutoEquipItemOpcode); + DEFINE_HANDLER(CMSG_AUTOEQUIP_ITEM, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, WorldPackets::Item::AutoEquipItem, &WorldSession::HandleAutoEquipItemOpcode); DEFINE_OPCODE_HANDLER_OLD(CMSG_AUTOEQUIP_ITEM_SLOT, STATUS_UNHANDLED, PROCESS_THREADUNSAFE, &WorldSession::HandleAutoEquipItemSlotOpcode ); DEFINE_HANDLER(CMSG_AUTOSTORE_BAG_ITEM, STATUS_UNHANDLED, PROCESS_THREADUNSAFE, WorldPackets::Item::AutoStoreBagItem, &WorldSession::HandleAutoStoreBagItemOpcode); - DEFINE_OPCODE_HANDLER_OLD(CMSG_AUTOSTORE_BANK_ITEM, STATUS_UNHANDLED, PROCESS_THREADUNSAFE, &WorldSession::HandleAutoStoreBankItemOpcode ); + DEFINE_HANDLER(CMSG_AUTOSTORE_BANK_ITEM, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, WorldPackets::Bank::AutoStoreBankItem, &WorldSession::HandleAutoStoreBankItemOpcode); DEFINE_OPCODE_HANDLER_OLD(CMSG_AUTOSTORE_GROUND_ITEM, STATUS_UNHANDLED, PROCESS_INPLACE, &WorldSession::Handle_NULL ); DEFINE_HANDLER(CMSG_AUTOSTORE_LOOT_ITEM, STATUS_UNHANDLED, PROCESS_THREADUNSAFE, WorldPackets::Loot::AutoStoreLootItem, &WorldSession::HandleAutostoreLootItemOpcode); DEFINE_HANDLER(CMSG_BANKER_ACTIVATE, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, WorldPackets::NPC::Hello, &WorldSession::HandleBankerActivateOpcode); @@ -228,7 +229,7 @@ void OpcodeTable::Initialize() DEFINE_OPCODE_HANDLER_OLD(CMSG_BUG_REPORT, STATUS_UNHANDLED, PROCESS_THREADUNSAFE, &WorldSession::HandleBugReportOpcode ); DEFINE_OPCODE_HANDLER_OLD(CMSG_BUSY_TRADE, STATUS_UNHANDLED, PROCESS_THREADUNSAFE, &WorldSession::HandleBusyTradeOpcode ); DEFINE_HANDLER(CMSG_BUY_BACK_ITEM, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, WorldPackets::Item::BuyBackItem, &WorldSession::HandleBuybackItem); - DEFINE_OPCODE_HANDLER_OLD(CMSG_BUY_BANK_SLOT, STATUS_UNHANDLED, PROCESS_THREADUNSAFE, &WorldSession::HandleBuyBankSlotOpcode ); + DEFINE_HANDLER(CMSG_BUY_BANK_SLOT, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, WorldPackets::Bank::BuyBankSlot, &WorldSession::HandleBuyBankSlotOpcode); DEFINE_HANDLER(CMSG_BUY_ITEM, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, WorldPackets::Item::BuyItem, &WorldSession::HandleBuyItemOpcode); DEFINE_OPCODE_HANDLER_OLD(CMSG_CAGE_BATTLE_PET, STATUS_UNHANDLED, PROCESS_INPLACE, &WorldSession::Handle_NULL ); DEFINE_OPCODE_HANDLER_OLD(CMSG_CALENDAR_ADD_EVENT, STATUS_UNHANDLED, PROCESS_THREADUNSAFE, &WorldSession::HandleCalendarAddEvent ); @@ -808,7 +809,7 @@ void OpcodeTable::Initialize() DEFINE_OPCODE_HANDLER_OLD(CMSG_SUSPEND_COMMS_ACK, STATUS_UNHANDLED, PROCESS_INPLACE, &WorldSession::Handle_NULL ); DEFINE_OPCODE_HANDLER_OLD(CMSG_SUSPEND_TOKEN_RESPONSE, STATUS_UNHANDLED, PROCESS_INPLACE, &WorldSession::Handle_NULL ); DEFINE_HANDLER(CMSG_SWAP_INV_ITEM, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, WorldPackets::Item::SwapInvItem, &WorldSession::HandleSwapInvItemOpcode); - DEFINE_HANDLER(CMSG_SWAP_ITEM, STATUS_UNHANDLED, PROCESS_THREADUNSAFE, WorldPackets::Item::SwapItem, &WorldSession::HandleSwapItem); + DEFINE_HANDLER(CMSG_SWAP_ITEM, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, WorldPackets::Item::SwapItem, &WorldSession::HandleSwapItem); DEFINE_OPCODE_HANDLER_OLD(CMSG_SWAP_SUB_GROUPS, STATUS_UNHANDLED, PROCESS_INPLACE, &WorldSession::HandleGroupSwapSubGroupOpcode ); DEFINE_OPCODE_HANDLER_OLD(CMSG_SYNC_DANCE, STATUS_UNHANDLED, PROCESS_INPLACE, &WorldSession::Handle_NULL ); DEFINE_HANDLER(CMSG_TABARD_VENDOR_ACTIVATE, STATUS_UNHANDLED, PROCESS_THREADUNSAFE, WorldPackets::NPC::Hello, &WorldSession::HandleTabardVendorActivateOpcode); diff --git a/src/server/game/Server/Protocol/Opcodes.h b/src/server/game/Server/Protocol/Opcodes.h index 961ba613bd8..9e776488531 100644 --- a/src/server/game/Server/Protocol/Opcodes.h +++ b/src/server/game/Server/Protocol/Opcodes.h @@ -82,12 +82,12 @@ enum OpcodeClient : uint32 CMSG_AUCTION_SELL_ITEM = 0xBADD, CMSG_AUTH_CONTINUED_SESSION = 0x1A72, CMSG_AUTH_SESSION = 0x1872, - CMSG_AUTOBANK_ITEM = 0xBADD, + CMSG_AUTOBANK_ITEM = 0x00C6, CMSG_AUTOEQUIP_GROUND_ITEM = 0xBADD, - CMSG_AUTOEQUIP_ITEM = 0xBADD, - CMSG_AUTOEQUIP_ITEM_SLOT = 0xBADD, + CMSG_AUTOEQUIP_ITEM = 0x0235, + CMSG_AUTOEQUIP_ITEM_SLOT = 0x00E5, CMSG_AUTOSTORE_BAG_ITEM = 0xBADD, - CMSG_AUTOSTORE_BANK_ITEM = 0xBADD, + CMSG_AUTOSTORE_BANK_ITEM = 0x00D5, CMSG_AUTOSTORE_GROUND_ITEM = 0xBADD, CMSG_AUTOSTORE_LOOT_ITEM = 0x0843, CMSG_BANKER_ACTIVATE = 0x0931, diff --git a/src/server/game/Server/WorldSession.h b/src/server/game/Server/WorldSession.h index 71ce6546d3c..02eee5c18f4 100644 --- a/src/server/game/Server/WorldSession.h +++ b/src/server/game/Server/WorldSession.h @@ -90,6 +90,13 @@ namespace WorldPackets enum class ConnectToSerial : uint32; } + namespace Bank + { + class AutoBankItem; + class AutoStoreBankItem; + class BuyBankSlot; + } + namespace BlackMarket { class BlackMarketOpen; @@ -999,7 +1006,6 @@ class WorldSession void HandleTabardVendorActivateOpcode(WorldPackets::NPC::Hello& packet); void HandleBankerActivateOpcode(WorldPackets::NPC::Hello& packet); - void HandleBuyBankSlotOpcode(WorldPacket& recvPacket); void HandleTrainerListOpcode(WorldPackets::NPC::Hello& packet); void HandleTrainerBuySpellOpcode(WorldPacket& recvPacket); void HandlePetitionShowList(WorldPackets::Petition::PetitionShowList& packet); @@ -1043,6 +1049,11 @@ class WorldSession void HandleAuctionPlaceBid(WorldPacket& recvData); void HandleAuctionListPendingSales(WorldPacket& recvData); + // Bank + void HandleAutoBankItemOpcode(WorldPackets::Bank::AutoBankItem& packet); + void HandleAutoStoreBankItemOpcode(WorldPackets::Bank::AutoStoreBankItem& packet); + void HandleBuyBankSlotOpcode(WorldPackets::Bank::BuyBankSlot& packet); + // Black Market void HandleBlackMarketOpen(WorldPackets::BlackMarket::BlackMarketOpen& packet); @@ -1072,8 +1083,6 @@ class WorldSession void HandleAutoEquipItemSlotOpcode(WorldPacket& recvPacket); void HandleSwapItem(WorldPackets::Item::SwapItem& swapItem); void HandleBuybackItem(WorldPackets::Item::BuyBackItem& packet); - void HandleAutoBankItemOpcode(WorldPacket& recvPacket); - void HandleAutoStoreBankItemOpcode(WorldPacket& recvPacket); void HandleWrapItemOpcode(WorldPacket& recvPacket); void HandleAttackSwingOpcode(WorldPackets::Combat::AttackSwing& packet); |