Core/Entities: Use ObjectGuid class in game project
This commit is contained in:
1 parent
ce67a097bf
commit
a0e50ea35f
256 files changed
+3334
-3833
No files matched your search
@@ -87,13 +87,13 @@ void WorldSession::HandleSwapInvItemOpcode(WorldPacket& recvData)
|
||||
|
||||
if (_player->IsBankPos(INVENTORY_SLOT_BAG_0, srcslot) && !CanUseBank())
|
||||
{
|
||||
TC_LOG_DEBUG("network", "WORLD: HandleSwapInvItemOpcode - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(m_currentBankerGUID)));
|
||||
TC_LOG_DEBUG("network", "WORLD: HandleSwapInvItemOpcode - Unit (%s) not found or you can't interact with him.", m_currentBankerGUID.ToString().c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
if (_player->IsBankPos(INVENTORY_SLOT_BAG_0, dstslot) && !CanUseBank())
|
||||
{
|
||||
TC_LOG_DEBUG("network", "WORLD: HandleSwapInvItemOpcode - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(m_currentBankerGUID)));
|
||||
TC_LOG_DEBUG("network", "WORLD: HandleSwapInvItemOpcode - Unit (%s) not found or you can't interact with him.", m_currentBankerGUID.ToString().c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -105,7 +105,7 @@ void WorldSession::HandleSwapInvItemOpcode(WorldPacket& recvData)
|
||||
|
||||
void WorldSession::HandleAutoEquipItemSlotOpcode(WorldPacket& recvData)
|
||||
{
|
||||
uint64 itemguid;
|
||||
ObjectGuid itemguid;
|
||||
uint8 dstslot;
|
||||
recvData >> itemguid >> dstslot;
|
||||
|
||||
@@ -151,13 +151,13 @@ void WorldSession::HandleSwapItem(WorldPacket& recvData)
|
||||
|
||||
if (_player->IsBankPos(srcbag, srcslot) && !CanUseBank())
|
||||
{
|
||||
TC_LOG_DEBUG("network", "WORLD: HandleSwapItem - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(m_currentBankerGUID)));
|
||||
TC_LOG_DEBUG("network", "WORLD: HandleSwapItem - Unit (%s) not found or you can't interact with him.", m_currentBankerGUID.ToString().c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
if (_player->IsBankPos(dstbag, dstslot) && !CanUseBank())
|
||||
{
|
||||
TC_LOG_DEBUG("network", "WORLD: HandleSwapItem - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(m_currentBankerGUID)));
|
||||
TC_LOG_DEBUG("network", "WORLD: HandleSwapItem - Unit (%s) not found or you can't interact with him.", m_currentBankerGUID.ToString().c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -497,7 +497,7 @@ void WorldSession::HandleReadItem(WorldPacket& recvData)
|
||||
void WorldSession::HandleSellItemOpcode(WorldPacket& recvData)
|
||||
{
|
||||
TC_LOG_DEBUG("network", "WORLD: Received CMSG_SELL_ITEM");
|
||||
uint64 vendorguid, itemguid;
|
||||
ObjectGuid vendorguid, itemguid;
|
||||
uint32 count;
|
||||
|
||||
recvData >> vendorguid >> itemguid >> count;
|
||||
@@ -508,7 +508,7 @@ void WorldSession::HandleSellItemOpcode(WorldPacket& recvData)
|
||||
Creature* creature = GetPlayer()->GetNPCIfCanInteractWith(vendorguid, UNIT_NPC_FLAG_VENDOR);
|
||||
if (!creature)
|
||||
{
|
||||
TC_LOG_DEBUG("network", "WORLD: HandleSellItemOpcode - Unit (GUID: %u) not found or you can not interact with him.", uint32(GUID_LOPART(vendorguid)));
|
||||
TC_LOG_DEBUG("network", "WORLD: HandleSellItemOpcode - %s not found or you can not interact with him.", vendorguid.ToString().c_str());
|
||||
_player->SendSellError(SELL_ERR_CANT_FIND_VENDOR, NULL, itemguid, 0);
|
||||
return;
|
||||
}
|
||||
@@ -609,7 +609,7 @@ void WorldSession::HandleSellItemOpcode(WorldPacket& recvData)
|
||||
void WorldSession::HandleBuybackItem(WorldPacket& recvData)
|
||||
{
|
||||
TC_LOG_DEBUG("network", "WORLD: Received CMSG_BUYBACK_ITEM");
|
||||
uint64 vendorguid;
|
||||
ObjectGuid vendorguid;
|
||||
uint32 slot;
|
||||
|
||||
recvData >> vendorguid >> slot;
|
||||
@@ -617,8 +617,8 @@ void WorldSession::HandleBuybackItem(WorldPacket& recvData)
|
||||
Creature* creature = GetPlayer()->GetNPCIfCanInteractWith(vendorguid, UNIT_NPC_FLAG_VENDOR);
|
||||
if (!creature)
|
||||
{
|
||||
TC_LOG_DEBUG("network", "WORLD: HandleBuybackItem - Unit (GUID: %u) not found or you can not interact with him.", uint32(GUID_LOPART(vendorguid)));
|
||||
_player->SendSellError(SELL_ERR_CANT_FIND_VENDOR, NULL, 0, 0);
|
||||
TC_LOG_DEBUG("network", "WORLD: HandleBuybackItem - Unit (GUID: %u) not found or you can not interact with him.", vendorguid.ToString().c_str());
|
||||
_player->SendSellError(SELL_ERR_CANT_FIND_VENDOR, NULL, ObjectGuid::Empty, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -657,7 +657,7 @@ void WorldSession::HandleBuybackItem(WorldPacket& recvData)
|
||||
void WorldSession::HandleBuyItemInSlotOpcode(WorldPacket& recvData)
|
||||
{
|
||||
TC_LOG_DEBUG("network", "WORLD: Received CMSG_BUY_ITEM_IN_SLOT");
|
||||
uint64 vendorguid, bagguid;
|
||||
ObjectGuid vendorguid, bagguid;
|
||||
uint32 item, slot, count;
|
||||
uint8 bagslot;
|
||||
|
||||
@@ -699,7 +699,7 @@ void WorldSession::HandleBuyItemInSlotOpcode(WorldPacket& recvData)
|
||||
void WorldSession::HandleBuyItemOpcode(WorldPacket& recvData)
|
||||
{
|
||||
TC_LOG_DEBUG("network", "WORLD: Received CMSG_BUY_ITEM");
|
||||
uint64 vendorguid;
|
||||
ObjectGuid vendorguid;
|
||||
uint32 item, slot, count;
|
||||
uint8 unk1;
|
||||
|
||||
@@ -716,7 +716,7 @@ void WorldSession::HandleBuyItemOpcode(WorldPacket& recvData)
|
||||
|
||||
void WorldSession::HandleListInventoryOpcode(WorldPacket& recvData)
|
||||
{
|
||||
uint64 guid;
|
||||
ObjectGuid guid;
|
||||
|
||||
recvData >> guid;
|
||||
|
||||
@@ -728,15 +728,15 @@ void WorldSession::HandleListInventoryOpcode(WorldPacket& recvData)
|
||||
SendListInventory(guid);
|
||||
}
|
||||
|
||||
void WorldSession::SendListInventory(uint64 vendorGuid)
|
||||
void WorldSession::SendListInventory(ObjectGuid vendorGuid)
|
||||
{
|
||||
TC_LOG_DEBUG("network", "WORLD: Sent SMSG_LIST_INVENTORY");
|
||||
|
||||
Creature* vendor = GetPlayer()->GetNPCIfCanInteractWith(vendorGuid, UNIT_NPC_FLAG_VENDOR);
|
||||
if (!vendor)
|
||||
{
|
||||
TC_LOG_DEBUG("network", "WORLD: SendListInventory - Unit (GUID: %u) not found or you can not interact with him.", uint32(GUID_LOPART(vendorGuid)));
|
||||
_player->SendSellError(SELL_ERR_CANT_FIND_VENDOR, NULL, 0, 0);
|
||||
TC_LOG_DEBUG("network", "WORLD: SendListInventory - %s not found or you can not interact with him.", vendorGuid.ToString().c_str());
|
||||
_player->SendSellError(SELL_ERR_CANT_FIND_VENDOR, NULL, ObjectGuid::Empty, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -879,12 +879,12 @@ void WorldSession::HandleBuyBankSlotOpcode(WorldPacket& recvPacket)
|
||||
{
|
||||
TC_LOG_DEBUG("network", "WORLD: CMSG_BUY_BANK_SLOT");
|
||||
|
||||
uint64 guid;
|
||||
ObjectGuid guid;
|
||||
recvPacket >> guid;
|
||||
|
||||
if (!CanUseBank(guid))
|
||||
{
|
||||
TC_LOG_DEBUG("network", "WORLD: HandleBuyBankSlotOpcode - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid)));
|
||||
TC_LOG_DEBUG("network", "WORLD: HandleBuyBankSlotOpcode - %s not found or you can't interact with him.", guid.ToString().c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -934,7 +934,7 @@ void WorldSession::HandleAutoBankItemOpcode(WorldPacket& recvPacket)
|
||||
|
||||
if (!CanUseBank())
|
||||
{
|
||||
TC_LOG_DEBUG("network", "WORLD: HandleAutoBankItemOpcode - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(m_currentBankerGUID)));
|
||||
TC_LOG_DEBUG("network", "WORLD: HandleAutoBankItemOpcode - Unit (%s) not found or you can't interact with him.", m_currentBankerGUID.ToString().c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -971,7 +971,7 @@ void WorldSession::HandleAutoStoreBankItemOpcode(WorldPacket& recvPacket)
|
||||
|
||||
if (!CanUseBank())
|
||||
{
|
||||
TC_LOG_DEBUG("network", "WORLD: HandleAutoStoreBankItemOpcode - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(m_currentBankerGUID)));
|
||||
TC_LOG_DEBUG("network", "WORLD: HandleAutoStoreBankItemOpcode - Unit (%s) not found or you can't interact with him.", m_currentBankerGUID.ToString().c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1035,17 +1035,17 @@ void WorldSession::HandleSetAmmoOpcode(WorldPacket& recvData)
|
||||
_player->RemoveAmmo();
|
||||
}
|
||||
|
||||
void WorldSession::SendEnchantmentLog(uint64 target, uint64 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
|
||||
data.appendPackGUID(target);
|
||||
data.appendPackGUID(caster);
|
||||
data << target.WriteAsPacked();
|
||||
data << caster.WriteAsPacked();
|
||||
data << uint32(itemId);
|
||||
data << uint32(enchantId);
|
||||
GetPlayer()->SendMessageToSet(&data, true);
|
||||
}
|
||||
|
||||
void WorldSession::SendItemEnchantTimeUpdate(uint64 Playerguid, uint64 Itemguid, uint32 slot, uint32 Duration)
|
||||
void WorldSession::SendItemEnchantTimeUpdate(ObjectGuid Playerguid, ObjectGuid Itemguid, uint32 slot, uint32 Duration)
|
||||
{
|
||||
// last check 2.0.10
|
||||
WorldPacket data(SMSG_ITEM_ENCHANT_TIME_UPDATE, (8+4+4+8));
|
||||
@@ -1124,7 +1124,7 @@ void WorldSession::HandleWrapItemOpcode(WorldPacket& recvData)
|
||||
return;
|
||||
}
|
||||
|
||||
if (item->GetUInt64Value(ITEM_FIELD_GIFTCREATOR)) // HasFlag(ITEM_FIELD_FLAGS, ITEM_FLAGS_WRAPPED);
|
||||
if (!item->GetGuidValue(ITEM_FIELD_GIFTCREATOR).IsEmpty()) // HasFlag(ITEM_FIELD_FLAGS, ITEM_FLAGS_WRAPPED);
|
||||
{
|
||||
_player->SendEquipError(EQUIP_ERR_WRAPPED_CANT_BE_WRAPPED, item, NULL);
|
||||
return;
|
||||
@@ -1158,7 +1158,7 @@ void WorldSession::HandleWrapItemOpcode(WorldPacket& recvData)
|
||||
SQLTransaction trans = CharacterDatabase.BeginTransaction();
|
||||
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHAR_GIFT);
|
||||
stmt->setUInt32(0, GUID_LOPART(item->GetOwnerGUID()));
|
||||
stmt->setUInt32(0, item->GetOwnerGUID().GetCounter());
|
||||
stmt->setUInt32(1, item->GetGUIDLow());
|
||||
stmt->setUInt32(2, item->GetEntry());
|
||||
stmt->setUInt32(3, item->GetUInt32Value(ITEM_FIELD_FLAGS));
|
||||
@@ -1175,7 +1175,7 @@ void WorldSession::HandleWrapItemOpcode(WorldPacket& recvData)
|
||||
case 17307: item->SetEntry(17308); break;
|
||||
case 21830: item->SetEntry(21831); break;
|
||||
}
|
||||
item->SetUInt64Value(ITEM_FIELD_GIFTCREATOR, _player->GetGUID());
|
||||
item->SetGuidValue(ITEM_FIELD_GIFTCREATOR, _player->GetGUID());
|
||||
item->SetUInt32Value(ITEM_FIELD_FLAGS, ITEM_FLAG_WRAPPED);
|
||||
item->SetState(ITEM_CHANGED, _player);
|
||||
|
||||
@@ -1195,8 +1195,8 @@ void WorldSession::HandleSocketOpcode(WorldPacket& recvData)
|
||||
{
|
||||
TC_LOG_DEBUG("network", "WORLD: CMSG_SOCKET_GEMS");
|
||||
|
||||
uint64 item_guid;
|
||||
uint64 gem_guids[MAX_GEM_SOCKETS];
|
||||
ObjectGuid item_guid;
|
||||
ObjectGuid gem_guids[MAX_GEM_SOCKETS];
|
||||
|
||||
recvData >> item_guid;
|
||||
if (!item_guid)
|
||||
@@ -1417,7 +1417,7 @@ void WorldSession::HandleItemRefundInfoRequest(WorldPacket& recvData)
|
||||
{
|
||||
TC_LOG_DEBUG("network", "WORLD: CMSG_ITEM_REFUND_INFO");
|
||||
|
||||
uint64 guid;
|
||||
ObjectGuid guid;
|
||||
recvData >> guid; // item guid
|
||||
|
||||
Item* item = _player->GetItemByGuid(guid);
|
||||
@@ -1433,7 +1433,7 @@ void WorldSession::HandleItemRefundInfoRequest(WorldPacket& recvData)
|
||||
void WorldSession::HandleItemRefund(WorldPacket &recvData)
|
||||
{
|
||||
TC_LOG_DEBUG("network", "WORLD: CMSG_ITEM_REFUND");
|
||||
uint64 guid;
|
||||
ObjectGuid guid;
|
||||
recvData >> guid; // item guid
|
||||
|
||||
Item* item = _player->GetItemByGuid(guid);
|
||||
@@ -1457,10 +1457,10 @@ void WorldSession::HandleItemRefund(WorldPacket &recvData)
|
||||
*/
|
||||
void WorldSession::HandleItemTextQuery(WorldPacket& recvData )
|
||||
{
|
||||
uint64 itemGuid;
|
||||
ObjectGuid itemGuid;
|
||||
recvData >> itemGuid;
|
||||
|
||||
TC_LOG_DEBUG("network", "CMSG_ITEM_TEXT_QUERY item guid: %u", GUID_LOPART(itemGuid));
|
||||
TC_LOG_DEBUG("network", "CMSG_ITEM_TEXT_QUERY %s", itemGuid.ToString().c_str());
|
||||
|
||||
WorldPacket data(SMSG_ITEM_TEXT_QUERY_RESPONSE, (4+10)); // guess size
|
||||
|
||||
@@ -1478,7 +1478,7 @@ void WorldSession::HandleItemTextQuery(WorldPacket& recvData )
|
||||
SendPacket(&data);
|
||||
}
|
||||
|
||||
bool WorldSession::CanUseBank(uint64 bankerGUID) const
|
||||
bool WorldSession::CanUseBank(ObjectGuid bankerGUID) const
|
||||
{
|
||||
// bankerGUID parameter is optional, set to 0 by default.
|
||||
if (!bankerGUID)
|
||||
|
||||
Reference in new issue
Block a user