refactor(Core/Packets): Rewrite various item packets to modern class. (#22758)
This commit is contained in:
@@ -29,91 +29,82 @@
|
|||||||
#include "WorldSession.h"
|
#include "WorldSession.h"
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
|
||||||
void WorldSession::HandleSplitItemOpcode(WorldPacket& recvData)
|
#include "ItemPackets.h"
|
||||||
|
|
||||||
|
void WorldSession::HandleSplitItemOpcode(WorldPackets::Item::SplitItem& packet)
|
||||||
{
|
{
|
||||||
//LOG_DEBUG("network.opcode", "WORLD: CMSG_SPLIT_ITEM");
|
//LOG_DEBUG("network.opcode", "WORLD: CMSG_SPLIT_ITEM");
|
||||||
uint8 srcbag, srcslot, dstbag, dstslot;
|
|
||||||
uint32 count;
|
|
||||||
|
|
||||||
recvData >> srcbag >> srcslot >> dstbag >> dstslot >> count;
|
uint16 src = ((packet.SourceBag << 8) | packet.SourceSlot);
|
||||||
|
uint16 dst = ((packet.DestinationBag << 8) | packet.DestinationSlot);
|
||||||
uint16 src = ((srcbag << 8) | srcslot);
|
|
||||||
uint16 dst = ((dstbag << 8) | dstslot);
|
|
||||||
|
|
||||||
if (src == dst)
|
if (src == dst)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (count == 0)
|
if (packet.Count == 0)
|
||||||
return; //check count - if zero it's fake packet
|
return; //check count - if zero it's fake packet
|
||||||
|
|
||||||
if (!_player->IsValidPos(srcbag, srcslot, true))
|
if (!_player->IsValidPos(packet.SourceBag, packet.SourceSlot, true))
|
||||||
{
|
{
|
||||||
_player->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, nullptr, nullptr);
|
_player->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, nullptr, nullptr);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!_player->IsValidPos(dstbag, dstslot, false)) // can be autostore pos
|
if (!_player->IsValidPos(packet.DestinationBag, packet.DestinationSlot, false)) // can be autostore pos
|
||||||
{
|
{
|
||||||
_player->SendEquipError(EQUIP_ERR_ITEM_DOESNT_GO_TO_SLOT, nullptr, nullptr);
|
_player->SendEquipError(EQUIP_ERR_ITEM_DOESNT_GO_TO_SLOT, nullptr, nullptr);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
_player->SplitItem(src, dst, count);
|
_player->SplitItem(src, dst, packet.Count);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WorldSession::HandleSwapInvItemOpcode(WorldPacket& recvData)
|
void WorldSession::HandleSwapInvItemOpcode(WorldPackets::Item::SwapInventoryItem& packet)
|
||||||
{
|
{
|
||||||
//LOG_DEBUG("network.opcode", "WORLD: CMSG_SWAP_INV_ITEM");
|
//LOG_DEBUG("network.opcode", "WORLD: CMSG_SWAP_INV_ITEM");
|
||||||
uint8 srcslot, dstslot;
|
|
||||||
|
|
||||||
recvData >> dstslot >> srcslot;
|
// prevent attempt swap same item to current position generated by client at special cheating sequence
|
||||||
|
if (packet.SourceSlot == packet.DestinationSlot)
|
||||||
// prevent attempt swap same item to current position generated by client at special checting sequence
|
|
||||||
if (srcslot == dstslot)
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!_player->IsValidPos(INVENTORY_SLOT_BAG_0, srcslot, true))
|
if (!_player->IsValidPos(INVENTORY_SLOT_BAG_0, packet.SourceSlot, true))
|
||||||
{
|
{
|
||||||
_player->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, nullptr, nullptr);
|
_player->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, nullptr, nullptr);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!_player->IsValidPos(INVENTORY_SLOT_BAG_0, dstslot, true))
|
if (!_player->IsValidPos(INVENTORY_SLOT_BAG_0, packet.DestinationSlot, true))
|
||||||
{
|
{
|
||||||
_player->SendEquipError(EQUIP_ERR_ITEM_DOESNT_GO_TO_SLOT, nullptr, nullptr);
|
_player->SendEquipError(EQUIP_ERR_ITEM_DOESNT_GO_TO_SLOT, nullptr, nullptr);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_player->IsBankPos(INVENTORY_SLOT_BAG_0, srcslot) && !CanUseBank())
|
if (_player->IsBankPos(INVENTORY_SLOT_BAG_0, packet.SourceSlot) && !CanUseBank())
|
||||||
{
|
{
|
||||||
//LOG_DEBUG("network", "WORLD: HandleSwapInvItemOpcode - Unit ({}) not found or you can't interact with him.", m_currentBankerGUID.ToString());
|
//LOG_DEBUG("network", "WORLD: HandleSwapInvItemOpcode - Unit ({}) not found or you can't interact with him.", m_currentBankerGUID.ToString());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_player->IsBankPos(INVENTORY_SLOT_BAG_0, dstslot) && !CanUseBank())
|
if (_player->IsBankPos(INVENTORY_SLOT_BAG_0, packet.DestinationSlot) && !CanUseBank())
|
||||||
{
|
{
|
||||||
//LOG_DEBUG("network", "WORLD: HandleSwapInvItemOpcode - Unit ({}) not found or you can't interact with him.", m_currentBankerGUID.ToString());
|
//LOG_DEBUG("network", "WORLD: HandleSwapInvItemOpcode - Unit ({}) not found or you can't interact with him.", m_currentBankerGUID.ToString());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16 src = ((INVENTORY_SLOT_BAG_0 << 8) | srcslot);
|
uint16 src = ((INVENTORY_SLOT_BAG_0 << 8) | packet.SourceSlot);
|
||||||
uint16 dst = ((INVENTORY_SLOT_BAG_0 << 8) | dstslot);
|
uint16 dst = ((INVENTORY_SLOT_BAG_0 << 8) | packet.DestinationSlot);
|
||||||
|
|
||||||
_player->SwapItem(src, dst);
|
_player->SwapItem(src, dst);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WorldSession::HandleAutoEquipItemSlotOpcode(WorldPacket& recvData)
|
void WorldSession::HandleAutoEquipItemSlotOpcode(WorldPackets::Item::AutoEquipItemSlot& packet)
|
||||||
{
|
{
|
||||||
ObjectGuid itemguid;
|
|
||||||
uint8 dstslot;
|
|
||||||
recvData >> itemguid >> dstslot;
|
|
||||||
|
|
||||||
// cheating attempt, client should never send opcode in that case
|
// cheating attempt, client should never send opcode in that case
|
||||||
if (!Player::IsEquipmentPos(INVENTORY_SLOT_BAG_0, dstslot))
|
if (!Player::IsEquipmentPos(INVENTORY_SLOT_BAG_0, packet.DestinationSlot))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Item* item = _player->GetItemByGuid(itemguid);
|
Item* item = _player->GetItemByGuid(packet.ItemGuid);
|
||||||
uint16 dstpos = dstslot | (INVENTORY_SLOT_BAG_0 << 8);
|
uint16 dstpos = packet.DestinationSlot | (INVENTORY_SLOT_BAG_0 << 8);
|
||||||
|
|
||||||
if (!item || item->GetPos() == dstpos)
|
if (!item || item->GetPos() == dstpos)
|
||||||
return;
|
return;
|
||||||
@@ -121,39 +112,36 @@ void WorldSession::HandleAutoEquipItemSlotOpcode(WorldPacket& recvData)
|
|||||||
_player->SwapItem(item->GetPos(), dstpos);
|
_player->SwapItem(item->GetPos(), dstpos);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WorldSession::HandleSwapItem(WorldPacket& recvData)
|
void WorldSession::HandleSwapItem(WorldPackets::Item::SwapItem& packet)
|
||||||
{
|
{
|
||||||
//LOG_DEBUG("network.opcode", "WORLD: CMSG_SWAP_ITEM");
|
//LOG_DEBUG("network.opcode", "WORLD: CMSG_SWAP_ITEM");
|
||||||
uint8 dstbag, dstslot, srcbag, srcslot;
|
|
||||||
|
|
||||||
recvData >> dstbag >> dstslot >> srcbag >> srcslot;
|
uint16 src = ((packet.SourceBag << 8) | packet.SourceSlot);
|
||||||
|
uint16 dst = ((packet.DestinationBag << 8) | packet.DestinationSlot);
|
||||||
|
|
||||||
uint16 src = ((srcbag << 8) | srcslot);
|
// prevent attempt swap same item to current position generated by client at special cheating sequence
|
||||||
uint16 dst = ((dstbag << 8) | dstslot);
|
|
||||||
|
|
||||||
// prevent attempt swap same item to current position generated by client at special checting sequence
|
|
||||||
if (src == dst)
|
if (src == dst)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!_player->IsValidPos(srcbag, srcslot, true))
|
if (!_player->IsValidPos(packet.SourceBag, packet.SourceSlot, true))
|
||||||
{
|
{
|
||||||
_player->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, nullptr, nullptr);
|
_player->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, nullptr, nullptr);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!_player->IsValidPos(dstbag, dstslot, true))
|
if (!_player->IsValidPos(packet.DestinationBag, packet.DestinationSlot, true))
|
||||||
{
|
{
|
||||||
_player->SendEquipError(EQUIP_ERR_ITEM_DOESNT_GO_TO_SLOT, nullptr, nullptr);
|
_player->SendEquipError(EQUIP_ERR_ITEM_DOESNT_GO_TO_SLOT, nullptr, nullptr);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_player->IsBankPos(srcbag, srcslot) && !CanUseBank())
|
if (_player->IsBankPos(packet.SourceBag, packet.SourceSlot) && !CanUseBank())
|
||||||
{
|
{
|
||||||
//LOG_DEBUG("network", "WORLD: HandleSwapItem - Unit ({}) not found or you can't interact with him.", m_currentBankerGUID.ToString());
|
//LOG_DEBUG("network", "WORLD: HandleSwapItem - Unit ({}) not found or you can't interact with him.", m_currentBankerGUID.ToString());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_player->IsBankPos(dstbag, dstslot) && !CanUseBank())
|
if (_player->IsBankPos(packet.DestinationBag, packet.DestinationSlot) && !CanUseBank())
|
||||||
{
|
{
|
||||||
//LOG_DEBUG("network", "WORLD: HandleSwapItem - Unit ({}) not found or you can't interact with him.", m_currentBankerGUID.ToString());
|
//LOG_DEBUG("network", "WORLD: HandleSwapItem - Unit ({}) not found or you can't interact with him.", m_currentBankerGUID.ToString());
|
||||||
return;
|
return;
|
||||||
@@ -162,14 +150,11 @@ void WorldSession::HandleSwapItem(WorldPacket& recvData)
|
|||||||
_player->SwapItem(src, dst);
|
_player->SwapItem(src, dst);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WorldSession::HandleAutoEquipItemOpcode(WorldPacket& recvData)
|
void WorldSession::HandleAutoEquipItemOpcode(WorldPackets::Item::AutoEquipItem& packet)
|
||||||
{
|
{
|
||||||
//LOG_DEBUG("network.opcode", "WORLD: CMSG_AUTOEQUIP_ITEM");
|
//LOG_DEBUG("network.opcode", "WORLD: CMSG_AUTOEQUIP_ITEM");
|
||||||
uint8 srcbag, srcslot;
|
|
||||||
|
|
||||||
recvData >> srcbag >> srcslot;
|
Item* pSrcItem = _player->GetItemByPos(packet.SourceBag, packet.SourceSlot);
|
||||||
|
|
||||||
Item* pSrcItem = _player->GetItemByPos(srcbag, srcslot);
|
|
||||||
if (!pSrcItem)
|
if (!pSrcItem)
|
||||||
return; // only at cheat
|
return; // only at cheat
|
||||||
|
|
||||||
@@ -219,7 +204,7 @@ void WorldSession::HandleAutoEquipItemOpcode(WorldPacket& recvData)
|
|||||||
|
|
||||||
if (!pDstItem) // empty slot, simple case
|
if (!pDstItem) // empty slot, simple case
|
||||||
{
|
{
|
||||||
_player->RemoveItem(srcbag, srcslot, true);
|
_player->RemoveItem(packet.SourceBag, packet.SourceSlot, true);
|
||||||
_player->EquipItem(dest, pSrcItem, true);
|
_player->EquipItem(dest, pSrcItem, true);
|
||||||
_player->AutoUnequipOffhandIfNeed();
|
_player->AutoUnequipOffhandIfNeed();
|
||||||
}
|
}
|
||||||
@@ -243,23 +228,23 @@ void WorldSession::HandleAutoEquipItemOpcode(WorldPacket& recvData)
|
|||||||
uint16 eSrc = 0;
|
uint16 eSrc = 0;
|
||||||
if (_player->IsInventoryPos(src))
|
if (_player->IsInventoryPos(src))
|
||||||
{
|
{
|
||||||
msg = _player->CanStoreItem(srcbag, srcslot, sSrc, pDstItem, true);
|
msg = _player->CanStoreItem(packet.SourceBag, packet.SourceSlot, sSrc, pDstItem, true);
|
||||||
if (msg != EQUIP_ERR_OK)
|
if (msg != EQUIP_ERR_OK)
|
||||||
msg = _player->CanStoreItem(srcbag, NULL_SLOT, sSrc, pDstItem, true);
|
msg = _player->CanStoreItem(packet.SourceBag, NULL_SLOT, sSrc, pDstItem, true);
|
||||||
if (msg != EQUIP_ERR_OK)
|
if (msg != EQUIP_ERR_OK)
|
||||||
msg = _player->CanStoreItem(NULL_BAG, NULL_SLOT, sSrc, pDstItem, true);
|
msg = _player->CanStoreItem(NULL_BAG, NULL_SLOT, sSrc, pDstItem, true);
|
||||||
}
|
}
|
||||||
else if (_player->IsBankPos(src))
|
else if (_player->IsBankPos(src))
|
||||||
{
|
{
|
||||||
msg = _player->CanBankItem(srcbag, srcslot, sSrc, pDstItem, true);
|
msg = _player->CanBankItem(packet.SourceBag, packet.SourceSlot, sSrc, pDstItem, true);
|
||||||
if (msg != EQUIP_ERR_OK)
|
if (msg != EQUIP_ERR_OK)
|
||||||
msg = _player->CanBankItem(srcbag, NULL_SLOT, sSrc, pDstItem, true);
|
msg = _player->CanBankItem(packet.SourceBag, NULL_SLOT, sSrc, pDstItem, true);
|
||||||
if (msg != EQUIP_ERR_OK)
|
if (msg != EQUIP_ERR_OK)
|
||||||
msg = _player->CanBankItem(NULL_BAG, NULL_SLOT, sSrc, pDstItem, true);
|
msg = _player->CanBankItem(NULL_BAG, NULL_SLOT, sSrc, pDstItem, true);
|
||||||
}
|
}
|
||||||
else if (_player->IsEquipmentPos(src))
|
else if (_player->IsEquipmentPos(src))
|
||||||
{
|
{
|
||||||
msg = _player->CanEquipItem(srcslot, eSrc, pDstItem, true);
|
msg = _player->CanEquipItem(packet.SourceSlot, eSrc, pDstItem, true);
|
||||||
if (msg == EQUIP_ERR_OK)
|
if (msg == EQUIP_ERR_OK)
|
||||||
msg = _player->CanUnequipItem(eSrc, true);
|
msg = _player->CanUnequipItem(eSrc, true);
|
||||||
}
|
}
|
||||||
@@ -272,7 +257,7 @@ void WorldSession::HandleAutoEquipItemOpcode(WorldPacket& recvData)
|
|||||||
|
|
||||||
// now do moves, remove...
|
// now do moves, remove...
|
||||||
_player->RemoveItem(dstbag, dstslot, true, true);
|
_player->RemoveItem(dstbag, dstslot, true, true);
|
||||||
_player->RemoveItem(srcbag, srcslot, true, true);
|
_player->RemoveItem(packet.SourceBag, packet.SourceSlot, true, true);
|
||||||
|
|
||||||
// add to dest
|
// add to dest
|
||||||
_player->EquipItem(dest, pSrcItem, true);
|
_player->EquipItem(dest, pSrcItem, true);
|
||||||
@@ -292,14 +277,11 @@ void WorldSession::HandleAutoEquipItemOpcode(WorldPacket& recvData)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void WorldSession::HandleDestroyItemOpcode(WorldPacket& recvData)
|
void WorldSession::HandleDestroyItemOpcode(WorldPackets::Item::DestroyItem& packet)
|
||||||
{
|
{
|
||||||
//LOG_DEBUG("network.opcode", "WORLD: CMSG_DESTROYITEM");
|
//LOG_DEBUG("network.opcode", "WORLD: CMSG_DESTROYITEM");
|
||||||
uint8 bag, slot, count, data1, data2, data3;
|
|
||||||
|
|
||||||
recvData >> bag >> slot >> count >> data1 >> data2 >> data3;
|
uint16 pos = (packet.Bag << 8) | packet.Slot;
|
||||||
|
|
||||||
uint16 pos = (bag << 8) | slot;
|
|
||||||
|
|
||||||
// prevent drop unequipable items (in combat, for example) and non-empty bags
|
// prevent drop unequipable items (in combat, for example) and non-empty bags
|
||||||
if (_player->IsEquipmentPos(pos) || _player->IsBagPos(pos))
|
if (_player->IsEquipmentPos(pos) || _player->IsBagPos(pos))
|
||||||
@@ -312,7 +294,7 @@ void WorldSession::HandleDestroyItemOpcode(WorldPacket& recvData)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Item* pItem = _player->GetItemByPos(bag, slot);
|
Item* pItem = _player->GetItemByPos(packet.Bag, packet.Slot);
|
||||||
if (!pItem)
|
if (!pItem)
|
||||||
{
|
{
|
||||||
_player->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, nullptr, nullptr);
|
_player->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, nullptr, nullptr);
|
||||||
@@ -327,14 +309,14 @@ void WorldSession::HandleDestroyItemOpcode(WorldPacket& recvData)
|
|||||||
|
|
||||||
recoveryItem(pItem);
|
recoveryItem(pItem);
|
||||||
|
|
||||||
if (count)
|
if (packet.Count)
|
||||||
{
|
{
|
||||||
uint32 i_count = count;
|
uint32 i_count = packet.Count;
|
||||||
_player->DestroyItemCount(pItem, i_count, true);
|
_player->DestroyItemCount(pItem, i_count, true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_player->DestroyItem(bag, slot, true);
|
_player->DestroyItem(packet.Bag, packet.Slot, true);
|
||||||
}
|
}
|
||||||
_player->SendQuestGiverStatusMultiple();
|
_player->SendQuestGiverStatusMultiple();
|
||||||
}
|
}
|
||||||
@@ -692,15 +674,12 @@ void WorldSession::HandleItemQuerySingleOpcode(WorldPacket& recvData)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void WorldSession::HandleReadItem(WorldPacket& recvData)
|
void WorldSession::HandleReadItem(WorldPackets::Item::ReadItem& packet)
|
||||||
{
|
{
|
||||||
//LOG_DEBUG("network.opcode", "WORLD: CMSG_READ_ITEM");
|
//LOG_DEBUG("network.opcode", "WORLD: CMSG_READ_ITEM");
|
||||||
|
|
||||||
uint8 bag, slot;
|
|
||||||
recvData >> bag >> slot;
|
|
||||||
|
|
||||||
//LOG_DEBUG("network.opcode", "STORAGE: Read bag = {}, slot = {}", bag, slot);
|
//LOG_DEBUG("network.opcode", "STORAGE: Read bag = {}, slot = {}", bag, slot);
|
||||||
Item* pItem = _player->GetItemByPos(bag, slot);
|
Item* pItem = _player->GetItemByPos(packet.Bag, packet.Slot);
|
||||||
|
|
||||||
if (pItem && pItem->GetTemplate()->PageText)
|
if (pItem && pItem->GetTemplate()->PageText)
|
||||||
{
|
{
|
||||||
@@ -725,27 +704,22 @@ void WorldSession::HandleReadItem(WorldPacket& recvData)
|
|||||||
_player->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, nullptr, nullptr);
|
_player->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, nullptr, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WorldSession::HandleSellItemOpcode(WorldPacket& recvData)
|
void WorldSession::HandleSellItemOpcode(WorldPackets::Item::SellItem& packet)
|
||||||
{
|
{
|
||||||
ObjectGuid vendorguid, itemguid;
|
if (!packet.ItemGuid)
|
||||||
uint32 count;
|
|
||||||
|
|
||||||
recvData >> vendorguid >> itemguid >> count;
|
|
||||||
|
|
||||||
if (!itemguid)
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Creature* creature = GetPlayer()->GetNPCIfCanInteractWith(vendorguid, UNIT_NPC_FLAG_VENDOR);
|
Creature* creature = GetPlayer()->GetNPCIfCanInteractWith(packet.VendorGuid, UNIT_NPC_FLAG_VENDOR);
|
||||||
if (!creature)
|
if (!creature)
|
||||||
{
|
{
|
||||||
LOG_DEBUG("network", "WORLD: HandleSellItemOpcode - Unit ({}) not found or you can not interact with him.", vendorguid.ToString());
|
LOG_DEBUG("network", "WORLD: HandleSellItemOpcode - Unit ({}) not found or you can not interact with him.", packet.VendorGuid.ToString());
|
||||||
_player->SendSellError(SELL_ERR_CANT_FIND_VENDOR, nullptr, itemguid, 0);
|
_player->SendSellError(SELL_ERR_CANT_FIND_VENDOR, nullptr, packet.ItemGuid, 0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (creature->HasFlagsExtra(CREATURE_FLAG_EXTRA_NO_SELL_VENDOR))
|
if (creature->HasFlagsExtra(CREATURE_FLAG_EXTRA_NO_SELL_VENDOR))
|
||||||
{
|
{
|
||||||
_player->SendSellError(SELL_ERR_CANT_SELL_TO_THIS_MERCHANT, creature, itemguid, 0);
|
_player->SendSellError(SELL_ERR_CANT_SELL_TO_THIS_MERCHANT, creature, packet.ItemGuid, 0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -753,7 +727,7 @@ void WorldSession::HandleSellItemOpcode(WorldPacket& recvData)
|
|||||||
if (GetPlayer()->HasUnitState(UNIT_STATE_DIED))
|
if (GetPlayer()->HasUnitState(UNIT_STATE_DIED))
|
||||||
GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH);
|
GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH);
|
||||||
|
|
||||||
Item* pItem = _player->GetItemByGuid(itemguid);
|
Item* pItem = _player->GetItemByGuid(packet.ItemGuid);
|
||||||
if (pItem)
|
if (pItem)
|
||||||
{
|
{
|
||||||
if (!sScriptMgr->OnPlayerCanSellItem(_player, pItem, creature))
|
if (!sScriptMgr->OnPlayerCanSellItem(_player, pItem, creature))
|
||||||
@@ -762,21 +736,21 @@ void WorldSession::HandleSellItemOpcode(WorldPacket& recvData)
|
|||||||
// prevent sell not owner item
|
// prevent sell not owner item
|
||||||
if (_player->GetGUID() != pItem->GetOwnerGUID())
|
if (_player->GetGUID() != pItem->GetOwnerGUID())
|
||||||
{
|
{
|
||||||
_player->SendSellError(SELL_ERR_CANT_SELL_ITEM, creature, itemguid, 0);
|
_player->SendSellError(SELL_ERR_CANT_SELL_ITEM, creature, packet.ItemGuid, 0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// prevent sell non empty bag by drag-and-drop at vendor's item list
|
// prevent sell non empty bag by drag-and-drop at vendor's item list
|
||||||
if (pItem->IsNotEmptyBag())
|
if (pItem->IsNotEmptyBag())
|
||||||
{
|
{
|
||||||
_player->SendSellError(SELL_ERR_CANT_SELL_ITEM, creature, itemguid, 0);
|
_player->SendSellError(SELL_ERR_CANT_SELL_ITEM, creature, packet.ItemGuid, 0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// prevent sell currently looted item
|
// prevent sell currently looted item
|
||||||
if (_player->GetLootGUID() == pItem->GetGUID())
|
if (_player->GetLootGUID() == pItem->GetGUID())
|
||||||
{
|
{
|
||||||
_player->SendSellError(SELL_ERR_CANT_SELL_ITEM, creature, itemguid, 0);
|
_player->SendSellError(SELL_ERR_CANT_SELL_ITEM, creature, packet.ItemGuid, 0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -787,16 +761,14 @@ void WorldSession::HandleSellItemOpcode(WorldPacket& recvData)
|
|||||||
return; // Therefore, no feedback to client
|
return; // Therefore, no feedback to client
|
||||||
|
|
||||||
// special case at auto sell (sell all)
|
// special case at auto sell (sell all)
|
||||||
if (count == 0)
|
if (packet.Count == 0)
|
||||||
{
|
packet.Count = pItem->GetCount();
|
||||||
count = pItem->GetCount();
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// prevent sell more items that exist in stack (possible only not from client)
|
// prevent sell more items that exist in stack (possible only not from client)
|
||||||
if (count > pItem->GetCount())
|
if (packet.Count > pItem->GetCount())
|
||||||
{
|
{
|
||||||
_player->SendSellError(SELL_ERR_CANT_SELL_ITEM, creature, itemguid, 0);
|
_player->SendSellError(SELL_ERR_CANT_SELL_ITEM, creature, packet.ItemGuid, 0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -806,11 +778,11 @@ void WorldSession::HandleSellItemOpcode(WorldPacket& recvData)
|
|||||||
{
|
{
|
||||||
if (pProto->SellPrice > 0)
|
if (pProto->SellPrice > 0)
|
||||||
{
|
{
|
||||||
uint32 money = pProto->SellPrice * count;
|
uint32 money = pProto->SellPrice * packet.Count;
|
||||||
if (_player->GetMoney() >= MAX_MONEY_AMOUNT - money) // prevent exceeding gold limit
|
if (_player->GetMoney() >= MAX_MONEY_AMOUNT - money) // prevent exceeding gold limit
|
||||||
{
|
{
|
||||||
_player->SendEquipError(EQUIP_ERR_TOO_MUCH_GOLD, nullptr, nullptr);
|
_player->SendEquipError(EQUIP_ERR_TOO_MUCH_GOLD, nullptr, nullptr);
|
||||||
_player->SendSellError(SELL_ERR_UNK, creature, itemguid, 0);
|
_player->SendSellError(SELL_ERR_UNK, creature, packet.ItemGuid, 0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -828,8 +800,8 @@ void WorldSession::HandleSellItemOpcode(WorldPacket& recvData)
|
|||||||
DurabilityCostsEntry const* dcost = sDurabilityCostsStore.LookupEntry(pProto->ItemLevel);
|
DurabilityCostsEntry const* dcost = sDurabilityCostsStore.LookupEntry(pProto->ItemLevel);
|
||||||
if (!dcost)
|
if (!dcost)
|
||||||
{
|
{
|
||||||
_player->SendSellError(SELL_ERR_CANT_SELL_ITEM, creature, itemguid, 0);
|
_player->SendSellError(SELL_ERR_CANT_SELL_ITEM, creature, packet.ItemGuid, 0);
|
||||||
LOG_ERROR("network.opcode", "WORLD: HandleSellItemOpcode - Wrong item lvl {} for item {} count = {}", pProto->ItemLevel, pItem->GetEntry(), count);
|
LOG_ERROR("network.opcode", "WORLD: HandleSellItemOpcode - Wrong item lvl {} for item {} count = {}", pProto->ItemLevel, pItem->GetEntry(), packet.Count);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -837,8 +809,8 @@ void WorldSession::HandleSellItemOpcode(WorldPacket& recvData)
|
|||||||
DurabilityQualityEntry const* dQualitymodEntry = sDurabilityQualityStore.LookupEntry(dQualitymodEntryId);
|
DurabilityQualityEntry const* dQualitymodEntry = sDurabilityQualityStore.LookupEntry(dQualitymodEntryId);
|
||||||
if (!dQualitymodEntry)
|
if (!dQualitymodEntry)
|
||||||
{
|
{
|
||||||
_player->SendSellError(SELL_ERR_CANT_SELL_ITEM, creature, itemguid, 0);
|
_player->SendSellError(SELL_ERR_CANT_SELL_ITEM, creature, packet.ItemGuid, 0);
|
||||||
LOG_ERROR("network.opcode", "WORLD: HandleSellItemOpcode - Wrong dQualityModEntry {} for item {} count = {}", dQualitymodEntryId, pItem->GetEntry(), count);
|
LOG_ERROR("network.opcode", "WORLD: HandleSellItemOpcode - Wrong dQualityModEntry {} for item {} count = {}", dQualitymodEntryId, pItem->GetEntry(), packet.Count);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -846,36 +818,30 @@ void WorldSession::HandleSellItemOpcode(WorldPacket& recvData)
|
|||||||
uint32 refund = uint32(std::ceil(LostDurability * dmultiplier * double(dQualitymodEntry->quality_mod)));
|
uint32 refund = uint32(std::ceil(LostDurability * dmultiplier * double(dQualitymodEntry->quality_mod)));
|
||||||
|
|
||||||
if (!refund)
|
if (!refund)
|
||||||
{
|
|
||||||
refund = 1;
|
refund = 1;
|
||||||
}
|
|
||||||
|
|
||||||
//starter items can cost more to refund than vendorprice
|
//starter items can cost more to refund than vendorprice
|
||||||
if (refund > money)
|
if (refund > money)
|
||||||
{
|
|
||||||
money = 1;
|
money = 1;
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
|
||||||
money -= refund;
|
money -= refund;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (count < pItem->GetCount()) // need split items
|
if (packet.Count < pItem->GetCount()) // need split items
|
||||||
{
|
{
|
||||||
Item* pNewItem = pItem->CloneItem(count, _player);
|
Item* pNewItem = pItem->CloneItem(packet.Count, _player);
|
||||||
if (!pNewItem)
|
if (!pNewItem)
|
||||||
{
|
{
|
||||||
LOG_ERROR("network.opcode", "WORLD: HandleSellItemOpcode - could not create clone of item {}; count = {}", pItem->GetEntry(), count);
|
LOG_ERROR("network.opcode", "WORLD: HandleSellItemOpcode - could not create clone of item {}; count = {}", pItem->GetEntry(), packet.Count);
|
||||||
_player->SendSellError(SELL_ERR_CANT_SELL_ITEM, creature, itemguid, 0);
|
_player->SendSellError(SELL_ERR_CANT_SELL_ITEM, creature, packet.ItemGuid, 0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
pNewItem->SetUInt32Value(ITEM_FIELD_DURABILITY, pItem->GetUInt32Value(ITEM_FIELD_DURABILITY));
|
pNewItem->SetUInt32Value(ITEM_FIELD_DURABILITY, pItem->GetUInt32Value(ITEM_FIELD_DURABILITY));
|
||||||
|
|
||||||
pItem->SetCount(pItem->GetCount() - count);
|
pItem->SetCount(pItem->GetCount() - packet.Count);
|
||||||
_player->ItemRemovedQuestCheck(pItem->GetEntry(), count);
|
_player->ItemRemovedQuestCheck(pItem->GetEntry(), packet.Count);
|
||||||
if (_player->IsInWorld())
|
if (_player->IsInWorld())
|
||||||
pItem->SendUpdateToPlayer(_player);
|
pItem->SendUpdateToPlayer(_player);
|
||||||
pItem->SetState(ITEM_CHANGED, _player);
|
pItem->SetState(ITEM_CHANGED, _player);
|
||||||
@@ -897,25 +863,20 @@ void WorldSession::HandleSellItemOpcode(WorldPacket& recvData)
|
|||||||
_player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_MONEY_FROM_VENDORS, money);
|
_player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_MONEY_FROM_VENDORS, money);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
_player->SendSellError(SELL_ERR_CANT_SELL_ITEM, creature, itemguid, 0);
|
_player->SendSellError(SELL_ERR_CANT_SELL_ITEM, creature, packet.ItemGuid, 0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_player->SendSellError(SELL_ERR_CANT_FIND_ITEM, creature, itemguid, 0);
|
_player->SendSellError(SELL_ERR_CANT_FIND_ITEM, creature, packet.ItemGuid, 0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
void WorldSession::HandleBuybackItem(WorldPacket& recvData)
|
void WorldSession::HandleBuybackItem(WorldPackets::Item::BuybackItem& packet)
|
||||||
{
|
{
|
||||||
ObjectGuid vendorguid;
|
Creature* creature = GetPlayer()->GetNPCIfCanInteractWith(packet.VendorGuid, UNIT_NPC_FLAG_VENDOR);
|
||||||
uint32 slot;
|
|
||||||
|
|
||||||
recvData >> vendorguid >> slot;
|
|
||||||
|
|
||||||
Creature* creature = GetPlayer()->GetNPCIfCanInteractWith(vendorguid, UNIT_NPC_FLAG_VENDOR);
|
|
||||||
if (!creature)
|
if (!creature)
|
||||||
{
|
{
|
||||||
LOG_DEBUG("network", "WORLD: HandleBuybackItem - Unit ({}) not found or you can not interact with him.", vendorguid.ToString());
|
LOG_DEBUG("network", "WORLD: HandleBuybackItem - Unit ({}) not found or you can not interact with him.", packet.VendorGuid.ToString());
|
||||||
_player->SendSellError(SELL_ERR_CANT_FIND_VENDOR, nullptr, ObjectGuid::Empty, 0);
|
_player->SendSellError(SELL_ERR_CANT_FIND_VENDOR, nullptr, ObjectGuid::Empty, 0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -924,10 +885,10 @@ void WorldSession::HandleBuybackItem(WorldPacket& recvData)
|
|||||||
if (GetPlayer()->HasUnitState(UNIT_STATE_DIED))
|
if (GetPlayer()->HasUnitState(UNIT_STATE_DIED))
|
||||||
GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH);
|
GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH);
|
||||||
|
|
||||||
Item* pItem = _player->GetItemFromBuyBackSlot(slot);
|
Item* pItem = _player->GetItemFromBuyBackSlot(packet.Slot);
|
||||||
if (pItem)
|
if (pItem)
|
||||||
{
|
{
|
||||||
uint32 price = _player->GetUInt32Value(PLAYER_FIELD_BUYBACK_PRICE_1 + slot - BUYBACK_SLOT_START);
|
uint32 price = _player->GetUInt32Value(PLAYER_FIELD_BUYBACK_PRICE_1 + packet.Slot - BUYBACK_SLOT_START);
|
||||||
if (!_player->HasEnoughMoney(price))
|
if (!_player->HasEnoughMoney(price))
|
||||||
{
|
{
|
||||||
_player->SendBuyError(BUY_ERR_NOT_ENOUGHT_MONEY, creature, pItem->GetEntry(), 0);
|
_player->SendBuyError(BUY_ERR_NOT_ENOUGHT_MONEY, creature, pItem->GetEntry(), 0);
|
||||||
@@ -948,7 +909,7 @@ void WorldSession::HandleBuybackItem(WorldPacket& recvData)
|
|||||||
}
|
}
|
||||||
|
|
||||||
_player->ModifyMoney(-(int32)price);
|
_player->ModifyMoney(-(int32)price);
|
||||||
_player->RemoveItemFromBuyBackSlot(slot, false);
|
_player->RemoveItemFromBuyBackSlot(packet.Slot, false);
|
||||||
_player->ItemAddedQuestCheck(pItem->GetEntry(), pItem->GetCount());
|
_player->ItemAddedQuestCheck(pItem->GetEntry(), pItem->GetCount());
|
||||||
_player->StoreItem(dest, pItem, true);
|
_player->StoreItem(dest, pItem, true);
|
||||||
}
|
}
|
||||||
@@ -960,24 +921,18 @@ void WorldSession::HandleBuybackItem(WorldPacket& recvData)
|
|||||||
_player->SendBuyError(BUY_ERR_CANT_FIND_ITEM, creature, 0, 0);
|
_player->SendBuyError(BUY_ERR_CANT_FIND_ITEM, creature, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WorldSession::HandleBuyItemInSlotOpcode(WorldPacket& recvData)
|
void WorldSession::HandleBuyItemInSlotOpcode(WorldPackets::Item::BuyItemInSlot& packet)
|
||||||
{
|
{
|
||||||
ObjectGuid vendorguid, bagguid;
|
|
||||||
uint32 item, slot, count;
|
|
||||||
uint8 bagslot;
|
|
||||||
|
|
||||||
recvData >> vendorguid >> item >> slot >> bagguid >> bagslot >> count;
|
|
||||||
|
|
||||||
// client expects count starting at 1, and we send vendorslot+1 to client already
|
// client expects count starting at 1, and we send vendorslot+1 to client already
|
||||||
if (slot > 0)
|
if (packet.Slot > 0)
|
||||||
--slot;
|
--packet.Slot;
|
||||||
else
|
else
|
||||||
return; // cheating
|
return; // cheating
|
||||||
|
|
||||||
uint8 bag = NULL_BAG; // init for case invalid bagGUID
|
uint8 bag = NULL_BAG; // init for case invalid bagGUID
|
||||||
|
|
||||||
// find bag slot by bag guid
|
// find bag slot by bag guid
|
||||||
if (bagguid == _player->GetGUID())
|
if (packet.BagGuid == _player->GetGUID())
|
||||||
bag = INVENTORY_SLOT_BAG_0;
|
bag = INVENTORY_SLOT_BAG_0;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -985,7 +940,7 @@ void WorldSession::HandleBuyItemInSlotOpcode(WorldPacket& recvData)
|
|||||||
{
|
{
|
||||||
if (Bag* pBag = _player->GetBagByPos(i))
|
if (Bag* pBag = _player->GetBagByPos(i))
|
||||||
{
|
{
|
||||||
if (bagguid == pBag->GetGUID())
|
if (packet.BagGuid == pBag->GetGUID())
|
||||||
{
|
{
|
||||||
bag = i;
|
bag = i;
|
||||||
break;
|
break;
|
||||||
@@ -998,38 +953,28 @@ void WorldSession::HandleBuyItemInSlotOpcode(WorldPacket& recvData)
|
|||||||
if (bag == NULL_BAG)
|
if (bag == NULL_BAG)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
GetPlayer()->BuyItemFromVendorSlot(vendorguid, slot, item, count, bag, bagslot);
|
GetPlayer()->BuyItemFromVendorSlot(packet.VendorGuid, packet.Slot, packet.Item, packet.Count, bag, packet.BagSlot);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WorldSession::HandleBuyItemOpcode(WorldPacket& recvData)
|
void WorldSession::HandleBuyItemOpcode(WorldPackets::Item::BuyItem& packet)
|
||||||
{
|
{
|
||||||
ObjectGuid vendorguid;
|
|
||||||
uint32 item, slot, count;
|
|
||||||
uint8 unk1;
|
|
||||||
|
|
||||||
recvData >> vendorguid >> item >> slot >> count >> unk1;
|
|
||||||
|
|
||||||
// client expects count starting at 1, and we send vendorslot+1 to client already
|
// client expects count starting at 1, and we send vendorslot+1 to client already
|
||||||
if (slot > 0)
|
if (packet.Slot > 0)
|
||||||
--slot;
|
--packet.Slot;
|
||||||
else
|
else
|
||||||
return; // cheating
|
return; // cheating
|
||||||
|
|
||||||
GetPlayer()->BuyItemFromVendorSlot(vendorguid, slot, item, count, NULL_BAG, NULL_SLOT);
|
GetPlayer()->BuyItemFromVendorSlot(packet.VendorGuid, packet.Slot, packet.Item, packet.Count, NULL_BAG, NULL_SLOT);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WorldSession::HandleListInventoryOpcode(WorldPacket& recvData)
|
void WorldSession::HandleListInventoryOpcode(WorldPackets::Item::ListInventory& packet)
|
||||||
{
|
{
|
||||||
ObjectGuid guid;
|
|
||||||
|
|
||||||
recvData >> guid;
|
|
||||||
|
|
||||||
if (!GetPlayer()->IsAlive())
|
if (!GetPlayer()->IsAlive())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
LOG_DEBUG("network", "WORLD: Recvd CMSG_LIST_INVENTORY");
|
LOG_DEBUG("network", "WORLD: Recvd CMSG_LIST_INVENTORY");
|
||||||
|
|
||||||
SendListInventory(guid);
|
SendListInventory(packet.VendorGuid);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WorldSession::SendListInventory(ObjectGuid vendorGuid, uint32 vendorEntry)
|
void WorldSession::SendListInventory(ObjectGuid vendorGuid, uint32 vendorEntry)
|
||||||
@@ -1143,18 +1088,14 @@ void WorldSession::SendListInventory(ObjectGuid vendorGuid, uint32 vendorEntry)
|
|||||||
SendPacket(&data);
|
SendPacket(&data);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WorldSession::HandleAutoStoreBagItemOpcode(WorldPacket& recvData)
|
void WorldSession::HandleAutoStoreBagItemOpcode(WorldPackets::Item::AutoStoreBagItem& packet)
|
||||||
{
|
{
|
||||||
//LOG_DEBUG("network.opcode", "WORLD: CMSG_AUTOSTORE_BAG_ITEM");
|
//LOG_DEBUG("network.opcode", "WORLD: CMSG_AUTOSTORE_BAG_ITEM");
|
||||||
uint8 srcbag, srcslot, dstbag;
|
Item* pItem = _player->GetItemByPos(packet.SourceBag, packet.SourceSlot);
|
||||||
|
|
||||||
recvData >> srcbag >> srcslot >> dstbag;
|
|
||||||
|
|
||||||
Item* pItem = _player->GetItemByPos(srcbag, srcslot);
|
|
||||||
if (!pItem)
|
if (!pItem)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!_player->IsValidPos(dstbag, NULL_SLOT, false)) // can be autostore pos
|
if (!_player->IsValidPos(packet.DestinationBag, NULL_SLOT, false)) // can be autostore pos
|
||||||
{
|
{
|
||||||
_player->SendEquipError(EQUIP_ERR_ITEM_DOESNT_GO_TO_SLOT, nullptr, nullptr);
|
_player->SendEquipError(EQUIP_ERR_ITEM_DOESNT_GO_TO_SLOT, nullptr, nullptr);
|
||||||
return;
|
return;
|
||||||
@@ -1174,7 +1115,7 @@ void WorldSession::HandleAutoStoreBagItemOpcode(WorldPacket& recvData)
|
|||||||
}
|
}
|
||||||
|
|
||||||
ItemPosCountVec dest;
|
ItemPosCountVec dest;
|
||||||
InventoryResult msg = _player->CanStoreItem(dstbag, NULL_SLOT, dest, pItem, false);
|
InventoryResult msg = _player->CanStoreItem(packet.DestinationBag, NULL_SLOT, dest, pItem, false);
|
||||||
if (msg != EQUIP_ERR_OK)
|
if (msg != EQUIP_ERR_OK)
|
||||||
{
|
{
|
||||||
_player->SendEquipError(msg, pItem, nullptr);
|
_player->SendEquipError(msg, pItem, nullptr);
|
||||||
@@ -1189,7 +1130,7 @@ void WorldSession::HandleAutoStoreBagItemOpcode(WorldPacket& recvData)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
_player->RemoveItem(srcbag, srcslot, true);
|
_player->RemoveItem(packet.SourceBag, packet.SourceSlot, true);
|
||||||
_player->StoreItem(dest, pItem, true);
|
_player->StoreItem(dest, pItem, true);
|
||||||
_player->UpdateTitansGrip();
|
_player->UpdateTitansGrip();
|
||||||
}
|
}
|
||||||
@@ -1223,23 +1164,22 @@ void WorldSession::HandleSetAmmoOpcode(WorldPacket& recvData)
|
|||||||
|
|
||||||
void WorldSession::SendEnchantmentLog(ObjectGuid target, ObjectGuid caster, uint32 itemId, uint32 enchantId)
|
void WorldSession::SendEnchantmentLog(ObjectGuid target, ObjectGuid caster, uint32 itemId, uint32 enchantId)
|
||||||
{
|
{
|
||||||
WorldPacket data(SMSG_ENCHANTMENTLOG, (8 + 8 + 4 + 4)); // last check 2.0.10
|
WorldPackets::Item::EnchantmentLog enchantmentLog;
|
||||||
data << target.WriteAsPacked();
|
enchantmentLog.Target = target.WriteAsPacked();
|
||||||
data << caster.WriteAsPacked();
|
enchantmentLog.Caster = caster.WriteAsPacked();
|
||||||
data << uint32(itemId);
|
enchantmentLog.ItemId = itemId;
|
||||||
data << uint32(enchantId);
|
enchantmentLog.EnchantId = enchantId;
|
||||||
GetPlayer()->SendMessageToSet(&data, true);
|
GetPlayer()->SendMessageToSet(enchantmentLog.Write(), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WorldSession::SendItemEnchantTimeUpdate(ObjectGuid Playerguid, ObjectGuid Itemguid, uint32 slot, uint32 Duration)
|
void WorldSession::SendItemEnchantTimeUpdate(ObjectGuid Playerguid, ObjectGuid Itemguid, uint32 slot, uint32 Duration)
|
||||||
{
|
{
|
||||||
// last check 2.0.10
|
WorldPackets::Item::ItemEnchantTimeUpdate itemEnchantTimeUpdate;
|
||||||
WorldPacket data(SMSG_ITEM_ENCHANT_TIME_UPDATE, (8 + 4 + 4 + 8));
|
itemEnchantTimeUpdate.ItemGuid = Itemguid;
|
||||||
data << Itemguid;
|
itemEnchantTimeUpdate.Slot = slot;
|
||||||
data << uint32(slot);
|
itemEnchantTimeUpdate.Duration = Duration;
|
||||||
data << uint32(Duration);
|
itemEnchantTimeUpdate.PlayerGuid = Playerguid;
|
||||||
data << Playerguid;
|
SendPacket(itemEnchantTimeUpdate.Write());
|
||||||
SendPacket(&data);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void WorldSession::HandleItemNameQueryOpcode(WorldPacket& recvData)
|
void WorldSession::HandleItemNameQueryOpcode(WorldPacket& recvData)
|
||||||
@@ -1266,18 +1206,13 @@ void WorldSession::HandleItemNameQueryOpcode(WorldPacket& recvData)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void WorldSession::HandleWrapItemOpcode(WorldPacket& recvData)
|
void WorldSession::HandleWrapItemOpcode(WorldPackets::Item::WrapItem& packet)
|
||||||
{
|
{
|
||||||
LOG_DEBUG("network", "Received opcode CMSG_WRAP_ITEM");
|
LOG_DEBUG("network", "Received opcode CMSG_WRAP_ITEM");
|
||||||
|
|
||||||
uint8 gift_bag, gift_slot, item_bag, item_slot;
|
LOG_DEBUG("network", "WRAP: receive GiftBag = {}, GiftSlot = {}, ItemBag = {}, ItemSlot = {}", packet.GiftBag, packet.GiftSlot, packet.ItemBag, packet.ItemSlot);
|
||||||
|
|
||||||
recvData >> gift_bag >> gift_slot; // paper
|
Item* gift = _player->GetItemByPos(packet.GiftBag, packet.GiftSlot);
|
||||||
recvData >> item_bag >> item_slot; // item
|
|
||||||
|
|
||||||
LOG_DEBUG("network", "WRAP: receive gift_bag = {}, gift_slot = {}, item_bag = {}, item_slot = {}", gift_bag, gift_slot, item_bag, item_slot);
|
|
||||||
|
|
||||||
Item* gift = _player->GetItemByPos(gift_bag, gift_slot);
|
|
||||||
if (!gift)
|
if (!gift)
|
||||||
{
|
{
|
||||||
_player->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, gift, nullptr);
|
_player->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, gift, nullptr);
|
||||||
@@ -1290,7 +1225,7 @@ void WorldSession::HandleWrapItemOpcode(WorldPacket& recvData)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Item* item = _player->GetItemByPos(item_bag, item_slot);
|
Item* item = _player->GetItemByPos(packet.ItemBag, packet.ItemSlot);
|
||||||
|
|
||||||
if (!item)
|
if (!item)
|
||||||
{
|
{
|
||||||
@@ -1305,7 +1240,7 @@ void WorldSession::HandleWrapItemOpcode(WorldPacket& recvData)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item == gift) // not possable with pacjket from real client
|
if (item == gift) // not possible with packet from real client
|
||||||
{
|
{
|
||||||
_player->SendEquipError(EQUIP_ERR_WRAPPED_CANT_BE_WRAPPED, item, nullptr);
|
_player->SendEquipError(EQUIP_ERR_WRAPPED_CANT_BE_WRAPPED, item, nullptr);
|
||||||
return;
|
return;
|
||||||
@@ -1399,26 +1334,19 @@ void WorldSession::HandleWrapItemOpcode(WorldPacket& recvData)
|
|||||||
_player->DestroyItemCount(gift, count, true);
|
_player->DestroyItemCount(gift, count, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WorldSession::HandleSocketOpcode(WorldPacket& recvData)
|
void WorldSession::HandleSocketOpcode(WorldPackets::Item::SocketGems& packet)
|
||||||
{
|
{
|
||||||
LOG_DEBUG("network", "WORLD: CMSG_SOCKET_GEMS");
|
LOG_DEBUG("network", "WORLD: CMSG_SOCKET_GEMS");
|
||||||
|
|
||||||
ObjectGuid item_guid;
|
if (!packet.ItemGuid)
|
||||||
ObjectGuid gem_guids[MAX_GEM_SOCKETS];
|
|
||||||
|
|
||||||
recvData >> item_guid;
|
|
||||||
if (!item_guid)
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (int i = 0; i < MAX_GEM_SOCKETS; ++i)
|
|
||||||
recvData >> gem_guids[i];
|
|
||||||
|
|
||||||
//cheat -> tried to socket same gem multiple times
|
//cheat -> tried to socket same gem multiple times
|
||||||
if ((gem_guids[0] && (gem_guids[0] == gem_guids[1] || gem_guids[0] == gem_guids[2])) ||
|
if ((packet.GemGuids[0] && (packet.GemGuids[0] == packet.GemGuids[1] || packet.GemGuids[0] == packet.GemGuids[2])) ||
|
||||||
(gem_guids[1] && (gem_guids[1] == gem_guids[2])))
|
(packet.GemGuids[1] && (packet.GemGuids[1] == packet.GemGuids[2])))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Item* itemTarget = _player->GetItemByGuid(item_guid);
|
Item* itemTarget = _player->GetItemByGuid(packet.ItemGuid);
|
||||||
if (!itemTarget) //missing item to socket
|
if (!itemTarget) //missing item to socket
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -1431,7 +1359,7 @@ void WorldSession::HandleSocketOpcode(WorldPacket& recvData)
|
|||||||
|
|
||||||
Item* Gems[MAX_GEM_SOCKETS];
|
Item* Gems[MAX_GEM_SOCKETS];
|
||||||
for (int i = 0; i < MAX_GEM_SOCKETS; ++i)
|
for (int i = 0; i < MAX_GEM_SOCKETS; ++i)
|
||||||
Gems[i] = gem_guids[i] ? _player->GetItemByGuid(gem_guids[i]) : nullptr;
|
Gems[i] = packet.GemGuids[i] ? _player->GetItemByGuid(packet.GemGuids[i]) : nullptr;
|
||||||
|
|
||||||
GemPropertiesEntry const* GemProps[MAX_GEM_SOCKETS];
|
GemPropertiesEntry const* GemProps[MAX_GEM_SOCKETS];
|
||||||
for (int i = 0; i < MAX_GEM_SOCKETS; ++i) //get geminfo from dbc storage
|
for (int i = 0; i < MAX_GEM_SOCKETS; ++i) //get geminfo from dbc storage
|
||||||
@@ -1572,7 +1500,7 @@ void WorldSession::HandleSocketOpcode(WorldPacket& recvData)
|
|||||||
if (GemEnchants[i])
|
if (GemEnchants[i])
|
||||||
{
|
{
|
||||||
itemTarget->SetEnchantment(EnchantmentSlot(SOCK_ENCHANTMENT_SLOT + i), GemEnchants[i], 0, 0, _player->GetGUID());
|
itemTarget->SetEnchantment(EnchantmentSlot(SOCK_ENCHANTMENT_SLOT + i), GemEnchants[i], 0, 0, _player->GetGUID());
|
||||||
if (Item* guidItem = _player->GetItemByGuid(gem_guids[i]))
|
if (Item* guidItem = _player->GetItemByGuid(packet.GemGuids[i]))
|
||||||
_player->DestroyItem(guidItem->GetBagSlot(), guidItem->GetSlot(), true);
|
_player->DestroyItem(guidItem->GetBagSlot(), guidItem->GetSlot(), true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1597,19 +1525,15 @@ void WorldSession::HandleSocketOpcode(WorldPacket& recvData)
|
|||||||
itemTarget->SendUpdateSockets();
|
itemTarget->SendUpdateSockets();
|
||||||
}
|
}
|
||||||
|
|
||||||
void WorldSession::HandleCancelTempEnchantmentOpcode(WorldPacket& recvData)
|
void WorldSession::HandleCancelTempEnchantmentOpcode(WorldPackets::Item::CancelTempEnchantment& packet)
|
||||||
{
|
{
|
||||||
LOG_DEBUG("network", "WORLD: CMSG_CANCEL_TEMP_ENCHANTMENT");
|
LOG_DEBUG("network", "WORLD: CMSG_CANCEL_TEMP_ENCHANTMENT");
|
||||||
|
|
||||||
uint32 eslot;
|
|
||||||
|
|
||||||
recvData >> eslot;
|
|
||||||
|
|
||||||
// apply only to equipped item
|
// apply only to equipped item
|
||||||
if (!Player::IsEquipmentPos(INVENTORY_SLOT_BAG_0, eslot))
|
if (!Player::IsEquipmentPos(INVENTORY_SLOT_BAG_0, packet.EquipmentSlot))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Item* item = GetPlayer()->GetItemByPos(INVENTORY_SLOT_BAG_0, eslot);
|
Item* item = GetPlayer()->GetItemByPos(INVENTORY_SLOT_BAG_0, packet.EquipmentSlot);
|
||||||
|
|
||||||
if (!item)
|
if (!item)
|
||||||
return;
|
return;
|
||||||
@@ -1621,14 +1545,11 @@ void WorldSession::HandleCancelTempEnchantmentOpcode(WorldPacket& recvData)
|
|||||||
item->ClearEnchantment(TEMP_ENCHANTMENT_SLOT);
|
item->ClearEnchantment(TEMP_ENCHANTMENT_SLOT);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WorldSession::HandleItemRefundInfoRequest(WorldPacket& recvData)
|
void WorldSession::HandleItemRefundInfoRequest(WorldPackets::Item::ItemRefundInfo& packet)
|
||||||
{
|
{
|
||||||
LOG_DEBUG("network", "WORLD: CMSG_ITEM_REFUND_INFO");
|
LOG_DEBUG("network", "WORLD: CMSG_ITEM_REFUND_INFO");
|
||||||
|
|
||||||
ObjectGuid guid;
|
Item* item = _player->GetItemByGuid(packet.ItemGuid);
|
||||||
recvData >> guid; // item guid
|
|
||||||
|
|
||||||
Item* item = _player->GetItemByGuid(guid);
|
|
||||||
if (!item)
|
if (!item)
|
||||||
{
|
{
|
||||||
LOG_DEBUG("network", "Item refund: item not found!");
|
LOG_DEBUG("network", "Item refund: item not found!");
|
||||||
@@ -1638,13 +1559,11 @@ void WorldSession::HandleItemRefundInfoRequest(WorldPacket& recvData)
|
|||||||
GetPlayer()->SendRefundInfo(item);
|
GetPlayer()->SendRefundInfo(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WorldSession::HandleItemRefund(WorldPacket& recvData)
|
void WorldSession::HandleItemRefund(WorldPackets::Item::ItemRefund& packet)
|
||||||
{
|
{
|
||||||
LOG_DEBUG("network", "WORLD: CMSG_ITEM_REFUND");
|
LOG_DEBUG("network", "WORLD: CMSG_ITEM_REFUND");
|
||||||
ObjectGuid guid;
|
|
||||||
recvData >> guid; // item guid
|
|
||||||
|
|
||||||
Item* item = _player->GetItemByGuid(guid);
|
Item* item = _player->GetItemByGuid(packet.ItemGuid);
|
||||||
if (!item)
|
if (!item)
|
||||||
{
|
{
|
||||||
LOG_DEBUG("network", "Item refund: item not found!");
|
LOG_DEBUG("network", "Item refund: item not found!");
|
||||||
@@ -1652,7 +1571,7 @@ void WorldSession::HandleItemRefund(WorldPacket& recvData)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Don't try to refund item currently being disenchanted
|
// Don't try to refund item currently being disenchanted
|
||||||
if (_player->GetLootGUID() == guid)
|
if (_player->GetLootGUID() == packet.ItemGuid)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
GetPlayer()->RefundItem(item);
|
GetPlayer()->RefundItem(item);
|
||||||
|
|||||||
@@ -24,6 +24,7 @@
|
|||||||
#include "CombatLogPackets.h"
|
#include "CombatLogPackets.h"
|
||||||
#include "CombatPackets.h"
|
#include "CombatPackets.h"
|
||||||
#include "GuildPackets.h"
|
#include "GuildPackets.h"
|
||||||
|
#include "ItemPackets.h"
|
||||||
#include "LFGPackets.h"
|
#include "LFGPackets.h"
|
||||||
#include "MiscPackets.h"
|
#include "MiscPackets.h"
|
||||||
#include "PetPackets.h"
|
#include "PetPackets.h"
|
||||||
|
|||||||
@@ -0,0 +1,163 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of the AzerothCore 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 Affero General Public License as published by the
|
||||||
|
* Free Software Foundation; either version 3 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 Affero 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 "ItemPackets.h"
|
||||||
|
|
||||||
|
void WorldPackets::Item::SplitItem::Read()
|
||||||
|
{
|
||||||
|
_worldPacket >> SourceBag;
|
||||||
|
_worldPacket >> SourceSlot;
|
||||||
|
_worldPacket >> DestinationBag;
|
||||||
|
_worldPacket >> DestinationSlot;
|
||||||
|
_worldPacket >> Count;
|
||||||
|
}
|
||||||
|
|
||||||
|
void WorldPackets::Item::SwapInventoryItem::Read()
|
||||||
|
{
|
||||||
|
_worldPacket >> DestinationSlot;
|
||||||
|
_worldPacket >> SourceSlot;
|
||||||
|
}
|
||||||
|
|
||||||
|
void WorldPackets::Item::AutoEquipItemSlot::Read()
|
||||||
|
{
|
||||||
|
_worldPacket >> ItemGuid;
|
||||||
|
_worldPacket >> DestinationSlot;
|
||||||
|
}
|
||||||
|
|
||||||
|
void WorldPackets::Item::SwapItem::Read()
|
||||||
|
{
|
||||||
|
_worldPacket >> DestinationBag;
|
||||||
|
_worldPacket >> DestinationSlot;
|
||||||
|
_worldPacket >> SourceBag;
|
||||||
|
_worldPacket >> SourceSlot;
|
||||||
|
}
|
||||||
|
|
||||||
|
void WorldPackets::Item::AutoEquipItem::Read()
|
||||||
|
{
|
||||||
|
_worldPacket >> SourceBag;
|
||||||
|
_worldPacket >> SourceSlot;
|
||||||
|
}
|
||||||
|
|
||||||
|
void WorldPackets::Item::DestroyItem::Read()
|
||||||
|
{
|
||||||
|
_worldPacket >> Bag;
|
||||||
|
_worldPacket >> Slot;
|
||||||
|
_worldPacket >> Count;
|
||||||
|
_worldPacket >> Data1;
|
||||||
|
_worldPacket >> Data2;
|
||||||
|
_worldPacket >> Data3;
|
||||||
|
}
|
||||||
|
|
||||||
|
void WorldPackets::Item::ReadItem::Read()
|
||||||
|
{
|
||||||
|
_worldPacket >> Bag;
|
||||||
|
_worldPacket >> Slot;
|
||||||
|
}
|
||||||
|
|
||||||
|
void WorldPackets::Item::SellItem::Read()
|
||||||
|
{
|
||||||
|
_worldPacket >> VendorGuid;
|
||||||
|
_worldPacket >> ItemGuid;
|
||||||
|
_worldPacket >> Count;
|
||||||
|
}
|
||||||
|
|
||||||
|
void WorldPackets::Item::BuybackItem::Read()
|
||||||
|
{
|
||||||
|
_worldPacket >> VendorGuid;
|
||||||
|
_worldPacket >> Slot;
|
||||||
|
}
|
||||||
|
|
||||||
|
void WorldPackets::Item::BuyItemInSlot::Read()
|
||||||
|
{
|
||||||
|
_worldPacket >> VendorGuid;
|
||||||
|
_worldPacket >> Item;
|
||||||
|
_worldPacket >> Slot;
|
||||||
|
_worldPacket >> BagGuid;
|
||||||
|
_worldPacket >> BagSlot;
|
||||||
|
_worldPacket >> Count;
|
||||||
|
}
|
||||||
|
|
||||||
|
void WorldPackets::Item::BuyItem::Read()
|
||||||
|
{
|
||||||
|
_worldPacket >> VendorGuid;
|
||||||
|
_worldPacket >> Item;
|
||||||
|
_worldPacket >> Slot;
|
||||||
|
_worldPacket >> Count;
|
||||||
|
_worldPacket >> Unk;
|
||||||
|
}
|
||||||
|
|
||||||
|
void WorldPackets::Item::ListInventory::Read()
|
||||||
|
{
|
||||||
|
_worldPacket >> VendorGuid;
|
||||||
|
}
|
||||||
|
|
||||||
|
void WorldPackets::Item::AutoStoreBagItem::Read()
|
||||||
|
{
|
||||||
|
_worldPacket >> SourceBag;
|
||||||
|
_worldPacket >> SourceSlot;
|
||||||
|
_worldPacket >> DestinationBag;
|
||||||
|
}
|
||||||
|
|
||||||
|
WorldPacket const* WorldPackets::Item::EnchantmentLog::Write()
|
||||||
|
{
|
||||||
|
_worldPacket << Target;
|
||||||
|
_worldPacket << Caster;
|
||||||
|
_worldPacket << ItemId;
|
||||||
|
_worldPacket << EnchantId;
|
||||||
|
|
||||||
|
return &_worldPacket;
|
||||||
|
}
|
||||||
|
|
||||||
|
WorldPacket const* WorldPackets::Item::ItemEnchantTimeUpdate::Write()
|
||||||
|
{
|
||||||
|
_worldPacket << ItemGuid;
|
||||||
|
_worldPacket << Slot;
|
||||||
|
_worldPacket << Duration;
|
||||||
|
_worldPacket << PlayerGuid;
|
||||||
|
|
||||||
|
return &_worldPacket;
|
||||||
|
}
|
||||||
|
|
||||||
|
void WorldPackets::Item::WrapItem::Read()
|
||||||
|
{
|
||||||
|
_worldPacket >> GiftBag;
|
||||||
|
_worldPacket >> GiftSlot;
|
||||||
|
_worldPacket >> ItemBag;
|
||||||
|
_worldPacket >> ItemSlot;
|
||||||
|
}
|
||||||
|
|
||||||
|
void WorldPackets::Item::SocketGems::Read()
|
||||||
|
{
|
||||||
|
_worldPacket >> ItemGuid;
|
||||||
|
for (int i = 0; i < MAX_GEM_SOCKETS; ++i)
|
||||||
|
_worldPacket >> GemGuids[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
void WorldPackets::Item::CancelTempEnchantment::Read()
|
||||||
|
{
|
||||||
|
_worldPacket >> EquipmentSlot;
|
||||||
|
}
|
||||||
|
|
||||||
|
void WorldPackets::Item::ItemRefundInfo::Read()
|
||||||
|
{
|
||||||
|
_worldPacket >> ItemGuid;
|
||||||
|
}
|
||||||
|
|
||||||
|
void WorldPackets::Item::ItemRefund::Read()
|
||||||
|
{
|
||||||
|
_worldPacket >> ItemGuid;
|
||||||
|
}
|
||||||
@@ -0,0 +1,272 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of the AzerothCore 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 Affero General Public License as published by the
|
||||||
|
* Free Software Foundation; either version 3 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 Affero 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 ItemPackets_h__
|
||||||
|
#define ItemPackets_h__
|
||||||
|
|
||||||
|
#include "Item.h"
|
||||||
|
#include "ObjectGuid.h"
|
||||||
|
#include "Packet.h"
|
||||||
|
|
||||||
|
namespace WorldPackets
|
||||||
|
{
|
||||||
|
namespace Item
|
||||||
|
{
|
||||||
|
class SplitItem final : public ClientPacket
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
SplitItem(WorldPacket&& packet) : ClientPacket(CMSG_SPLIT_ITEM, std::move(packet)) {}
|
||||||
|
|
||||||
|
void Read() override;
|
||||||
|
|
||||||
|
uint8 SourceBag = 0;
|
||||||
|
uint8 SourceSlot = 0;
|
||||||
|
uint8 DestinationBag = 0;
|
||||||
|
uint8 DestinationSlot = 0;
|
||||||
|
uint32 Count = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
class SwapInventoryItem final : public ClientPacket
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
SwapInventoryItem(WorldPacket&& packet) : ClientPacket(CMSG_SWAP_INV_ITEM, std::move(packet)) {}
|
||||||
|
|
||||||
|
void Read() override;
|
||||||
|
|
||||||
|
uint8 DestinationSlot = 0;
|
||||||
|
uint8 SourceSlot = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
class AutoEquipItemSlot final : public ClientPacket
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
AutoEquipItemSlot(WorldPacket&& packet) : ClientPacket(CMSG_AUTOEQUIP_ITEM_SLOT, std::move(packet)) {}
|
||||||
|
|
||||||
|
void Read() override;
|
||||||
|
|
||||||
|
ObjectGuid ItemGuid;
|
||||||
|
uint8 DestinationSlot = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
class SwapItem final : public ClientPacket
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
SwapItem(WorldPacket&& packet) : ClientPacket(CMSG_SWAP_ITEM, std::move(packet)) {}
|
||||||
|
|
||||||
|
void Read() override;
|
||||||
|
|
||||||
|
uint8 DestinationBag = 0;
|
||||||
|
uint8 DestinationSlot = 0;
|
||||||
|
uint8 SourceBag = 0;
|
||||||
|
uint8 SourceSlot = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
class AutoEquipItem final : public ClientPacket
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
AutoEquipItem(WorldPacket&& packet) : ClientPacket(CMSG_AUTOEQUIP_ITEM, std::move(packet)) {}
|
||||||
|
|
||||||
|
void Read() override;
|
||||||
|
|
||||||
|
uint8 SourceBag = 0;
|
||||||
|
uint8 SourceSlot = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
class DestroyItem final : public ClientPacket
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
DestroyItem(WorldPacket&& packet) : ClientPacket(CMSG_DESTROYITEM, std::move(packet)) {}
|
||||||
|
|
||||||
|
void Read() override;
|
||||||
|
|
||||||
|
uint8 Bag = 0;
|
||||||
|
uint8 Slot = 0;
|
||||||
|
uint8 Count = 0;
|
||||||
|
uint8 Data1 = 0;
|
||||||
|
uint8 Data2 = 0;
|
||||||
|
uint8 Data3 = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
class ReadItem final : public ClientPacket
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
ReadItem(WorldPacket&& packet) : ClientPacket(CMSG_READ_ITEM, std::move(packet)) {}
|
||||||
|
|
||||||
|
void Read() override;
|
||||||
|
|
||||||
|
uint8 Bag = 0;
|
||||||
|
uint8 Slot = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
class SellItem final : public ClientPacket
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
SellItem(WorldPacket&& packet) : ClientPacket(CMSG_SELL_ITEM, std::move(packet)) {}
|
||||||
|
|
||||||
|
void Read() override;
|
||||||
|
|
||||||
|
ObjectGuid VendorGuid;
|
||||||
|
ObjectGuid ItemGuid;
|
||||||
|
uint32 Count = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
class BuybackItem final : public ClientPacket
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
BuybackItem(WorldPacket&& packet) : ClientPacket(CMSG_BUYBACK_ITEM, std::move(packet)) {}
|
||||||
|
|
||||||
|
void Read() override;
|
||||||
|
|
||||||
|
ObjectGuid VendorGuid;
|
||||||
|
uint32 Slot = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
class BuyItemInSlot final : public ClientPacket
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
BuyItemInSlot(WorldPacket&& packet) : ClientPacket(CMSG_BUY_ITEM_IN_SLOT, std::move(packet)) {}
|
||||||
|
|
||||||
|
void Read() override;
|
||||||
|
|
||||||
|
ObjectGuid VendorGuid;
|
||||||
|
uint32 Item = 0;
|
||||||
|
uint32 Slot = 0;
|
||||||
|
ObjectGuid BagGuid;
|
||||||
|
uint8 BagSlot = 0;
|
||||||
|
uint32 Count = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
class BuyItem final : public ClientPacket
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
BuyItem(WorldPacket&& packet) : ClientPacket(CMSG_BUY_ITEM, std::move(packet)) {}
|
||||||
|
|
||||||
|
void Read() override;
|
||||||
|
|
||||||
|
ObjectGuid VendorGuid;
|
||||||
|
uint32 Item = 0;
|
||||||
|
uint32 Slot = 0;
|
||||||
|
uint32 Count = 0;
|
||||||
|
uint8 Unk = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
class ListInventory final : public ClientPacket
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
ListInventory(WorldPacket&& packet) : ClientPacket(CMSG_LIST_INVENTORY, std::move(packet)) {}
|
||||||
|
|
||||||
|
void Read() override;
|
||||||
|
|
||||||
|
ObjectGuid VendorGuid;
|
||||||
|
};
|
||||||
|
|
||||||
|
class AutoStoreBagItem final : public ClientPacket
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
AutoStoreBagItem(WorldPacket&& packet) : ClientPacket(CMSG_AUTOSTORE_BAG_ITEM, std::move(packet)) {}
|
||||||
|
|
||||||
|
void Read() override;
|
||||||
|
|
||||||
|
uint8 SourceBag = 0;
|
||||||
|
uint8 SourceSlot = 0;
|
||||||
|
uint8 DestinationBag = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
class EnchantmentLog final : public ServerPacket
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
EnchantmentLog() : ServerPacket(SMSG_ENCHANTMENTLOG, 8 + 8 + 4 + 4) {}
|
||||||
|
|
||||||
|
WorldPacket const* Write() override;
|
||||||
|
|
||||||
|
PackedGuid Target;
|
||||||
|
PackedGuid Caster;
|
||||||
|
uint32 ItemId = 0;
|
||||||
|
uint32 EnchantId = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
class ItemEnchantTimeUpdate final : public ServerPacket
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
ItemEnchantTimeUpdate() : ServerPacket(SMSG_ITEM_ENCHANT_TIME_UPDATE, 8 + 4 + 4 + 8) {}
|
||||||
|
|
||||||
|
WorldPacket const* Write() override;
|
||||||
|
|
||||||
|
// last check 2.0.10
|
||||||
|
ObjectGuid ItemGuid;
|
||||||
|
uint32 Slot = 0;
|
||||||
|
uint32 Duration = 0;
|
||||||
|
ObjectGuid PlayerGuid;
|
||||||
|
};
|
||||||
|
|
||||||
|
class WrapItem final : public ClientPacket
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
WrapItem(WorldPacket&& packet) : ClientPacket(CMSG_WRAP_ITEM, std::move(packet)) {}
|
||||||
|
|
||||||
|
void Read() override;
|
||||||
|
|
||||||
|
uint8 GiftBag = 0;
|
||||||
|
uint8 GiftSlot = 0;
|
||||||
|
uint8 ItemBag = 0;
|
||||||
|
uint8 ItemSlot = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
class SocketGems final : public ClientPacket
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
SocketGems(WorldPacket&& packet) : ClientPacket(CMSG_SOCKET_GEMS, std::move(packet)) {}
|
||||||
|
|
||||||
|
void Read() override;
|
||||||
|
|
||||||
|
ObjectGuid ItemGuid;
|
||||||
|
ObjectGuid GemGuids[MAX_GEM_SOCKETS];
|
||||||
|
};
|
||||||
|
|
||||||
|
class CancelTempEnchantment final : public ClientPacket
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CancelTempEnchantment(WorldPacket&& packet) : ClientPacket(CMSG_CANCEL_TEMP_ENCHANTMENT, std::move(packet)) {}
|
||||||
|
|
||||||
|
void Read() override;
|
||||||
|
|
||||||
|
uint32 EquipmentSlot = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
class ItemRefundInfo final : public ClientPacket
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
ItemRefundInfo(WorldPacket&& packet) : ClientPacket(CMSG_ITEM_REFUND_INFO, std::move(packet)) {}
|
||||||
|
|
||||||
|
void Read() override;
|
||||||
|
|
||||||
|
ObjectGuid ItemGuid;
|
||||||
|
};
|
||||||
|
|
||||||
|
class ItemRefund final : public ClientPacket
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
ItemRefund(WorldPacket&& packet) : ClientPacket(CMSG_ITEM_REFUND, std::move(packet)) {}
|
||||||
|
|
||||||
|
void Read() override;
|
||||||
|
|
||||||
|
ObjectGuid ItemGuid;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // ItemPackets_h__
|
||||||
@@ -167,6 +167,28 @@ namespace WorldPackets
|
|||||||
class TimeQuery;
|
class TimeQuery;
|
||||||
class CorpseMapPositionQuery;
|
class CorpseMapPositionQuery;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
namespace Item
|
||||||
|
{
|
||||||
|
class SplitItem;
|
||||||
|
class SwapInventoryItem;
|
||||||
|
class AutoEquipItemSlot;
|
||||||
|
class SwapItem;
|
||||||
|
class AutoEquipItem;
|
||||||
|
class DestroyItem;
|
||||||
|
class ReadItem;
|
||||||
|
class SellItem;
|
||||||
|
class BuybackItem;
|
||||||
|
class BuyItemInSlot;
|
||||||
|
class BuyItem;
|
||||||
|
class ListInventory;
|
||||||
|
class AutoStoreBagItem;
|
||||||
|
class WrapItem;
|
||||||
|
class SocketGems;
|
||||||
|
class CancelTempEnchantment;
|
||||||
|
class ItemRefundInfo;
|
||||||
|
class ItemRefund;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
enum AccountDataType
|
enum AccountDataType
|
||||||
@@ -810,21 +832,21 @@ public: // opcodes handlers
|
|||||||
void HandleQueryNextMailTime(WorldPacket& recvData);
|
void HandleQueryNextMailTime(WorldPacket& recvData);
|
||||||
void HandleCancelChanneling(WorldPacket& recvData);
|
void HandleCancelChanneling(WorldPacket& recvData);
|
||||||
|
|
||||||
void HandleSplitItemOpcode(WorldPacket& recvPacket);
|
void HandleSplitItemOpcode(WorldPackets::Item::SplitItem& packet);
|
||||||
void HandleSwapInvItemOpcode(WorldPacket& recvPacket);
|
void HandleSwapInvItemOpcode(WorldPackets::Item::SwapInventoryItem& packet);
|
||||||
void HandleDestroyItemOpcode(WorldPacket& recvPacket);
|
void HandleDestroyItemOpcode(WorldPackets::Item::DestroyItem& packet);
|
||||||
void HandleAutoEquipItemOpcode(WorldPacket& recvPacket);
|
void HandleAutoEquipItemOpcode(WorldPackets::Item::AutoEquipItem& packet);
|
||||||
void HandleItemQuerySingleOpcode(WorldPacket& recvPacket);
|
void HandleItemQuerySingleOpcode(WorldPacket& recvPacket);
|
||||||
void HandleSellItemOpcode(WorldPacket& recvPacket);
|
void HandleSellItemOpcode(WorldPackets::Item::SellItem& packet);
|
||||||
void HandleBuyItemInSlotOpcode(WorldPacket& recvPacket);
|
void HandleBuyItemInSlotOpcode(WorldPackets::Item::BuyItemInSlot& packet);
|
||||||
void HandleBuyItemOpcode(WorldPacket& recvPacket);
|
void HandleBuyItemOpcode(WorldPackets::Item::BuyItem& packet);
|
||||||
void HandleListInventoryOpcode(WorldPacket& recvPacket);
|
void HandleListInventoryOpcode(WorldPackets::Item::ListInventory& packet);
|
||||||
void HandleAutoStoreBagItemOpcode(WorldPacket& recvPacket);
|
void HandleAutoStoreBagItemOpcode(WorldPackets::Item::AutoStoreBagItem& packet);
|
||||||
void HandleReadItem(WorldPacket& recvPacket);
|
void HandleReadItem(WorldPackets::Item::ReadItem& packet);
|
||||||
void HandleAutoEquipItemSlotOpcode(WorldPacket& recvPacket);
|
void HandleAutoEquipItemSlotOpcode(WorldPackets::Item::AutoEquipItemSlot& packet);
|
||||||
void HandleSwapItem(WorldPacket& recvPacket);
|
void HandleSwapItem(WorldPackets::Item::SwapItem& packet);
|
||||||
void HandleBuybackItem(WorldPacket& recvPacket);
|
void HandleBuybackItem(WorldPackets::Item::BuybackItem& packet);
|
||||||
void HandleWrapItemOpcode(WorldPacket& recvPacket);
|
void HandleWrapItemOpcode(WorldPackets::Item::WrapItem& packet);
|
||||||
|
|
||||||
void HandleAttackSwingOpcode(WorldPacket& recvPacket);
|
void HandleAttackSwingOpcode(WorldPacket& recvPacket);
|
||||||
void HandleAttackStopOpcode(WorldPacket& recvPacket);
|
void HandleAttackStopOpcode(WorldPacket& recvPacket);
|
||||||
@@ -1014,12 +1036,12 @@ public: // opcodes handlers
|
|||||||
void HandleRequestPetInfo(WorldPackets::Pet::RequestPetInfo& packet);
|
void HandleRequestPetInfo(WorldPackets::Pet::RequestPetInfo& packet);
|
||||||
|
|
||||||
// Socket gem
|
// Socket gem
|
||||||
void HandleSocketOpcode(WorldPacket& recvData);
|
void HandleSocketOpcode(WorldPackets::Item::SocketGems& packet);
|
||||||
|
|
||||||
void HandleCancelTempEnchantmentOpcode(WorldPacket& recvData);
|
void HandleCancelTempEnchantmentOpcode(WorldPackets::Item::CancelTempEnchantment& packet);
|
||||||
|
|
||||||
void HandleItemRefundInfoRequest(WorldPacket& recvData);
|
void HandleItemRefundInfoRequest(WorldPackets::Item::ItemRefundInfo& packet);
|
||||||
void HandleItemRefund(WorldPacket& recvData);
|
void HandleItemRefund(WorldPackets::Item::ItemRefund& packet);
|
||||||
|
|
||||||
void HandleChannelVoiceOnOpcode(WorldPacket& recvData);
|
void HandleChannelVoiceOnOpcode(WorldPacket& recvData);
|
||||||
void HandleVoiceSessionEnableOpcode(WorldPacket& recvData);
|
void HandleVoiceSessionEnableOpcode(WorldPacket& recvData);
|
||||||
|
|||||||
Reference in New Issue
Block a user