mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 13:37:05 +00:00
[11464] Some item related guids convertion to ObjectGuids
This commit is contained in:
parent
4181b8f28b
commit
a925db80fa
8 changed files with 45 additions and 38 deletions
|
|
@ -225,11 +225,11 @@ uint32 Bag::GetItemCountWithLimitCategory(uint32 limitCategory, Item* eItem) con
|
|||
return count;
|
||||
}
|
||||
|
||||
uint8 Bag::GetSlotByItemGUID(uint64 guid) const
|
||||
uint8 Bag::GetSlotByItemGUID(ObjectGuid guid) const
|
||||
{
|
||||
for (uint32 i = 0; i < GetBagSize(); ++i)
|
||||
if (m_bagslot[i] != 0)
|
||||
if (m_bagslot[i]->GetGUID() == guid)
|
||||
if (m_bagslot[i]->GetObjectGuid() == guid)
|
||||
return i;
|
||||
|
||||
return NULL_SLOT;
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ class Bag : public Item
|
|||
uint32 GetItemCount(uint32 item, Item* eItem = NULL) const;
|
||||
uint32 GetItemCountWithLimitCategory(uint32 limitCategory, Item* eItem = NULL) const;
|
||||
|
||||
uint8 GetSlotByItemGUID(uint64 guid) const;
|
||||
uint8 GetSlotByItemGUID(ObjectGuid guid) const;
|
||||
bool IsEmpty() const;
|
||||
uint32 GetFreeSlots() const;
|
||||
uint32 GetBagSize() const { return GetUInt32Value(CONTAINER_FIELD_NUM_SLOTS); }
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ void Camera::SetView(WorldObject *obj, bool update_far_sight_field /*= true*/)
|
|||
m_source->GetViewPoint().Attach(this);
|
||||
|
||||
if (update_far_sight_field)
|
||||
m_owner.SetUInt64Value(PLAYER_FARSIGHT, (m_source == &m_owner ? 0 : m_source->GetGUID()));
|
||||
m_owner.SetGuidValue(PLAYER_FARSIGHT, (m_source == &m_owner ? ObjectGuid() : m_source->GetObjectGuid()));
|
||||
|
||||
UpdateForCurrentViewPoint();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1073,7 +1073,7 @@ void Item::SendTimeUpdate(Player* owner)
|
|||
return;
|
||||
|
||||
WorldPacket data(SMSG_ITEM_TIME_UPDATE, (8+4));
|
||||
data << uint64(GetGUID());
|
||||
data << ObjectGuid(GetObjectGuid());
|
||||
data << uint32(duration);
|
||||
owner->GetSession()->SendPacket(&data);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -92,15 +92,15 @@ void WorldSession::HandleSwapInvItemOpcode( WorldPacket & recv_data )
|
|||
|
||||
void WorldSession::HandleAutoEquipItemSlotOpcode( WorldPacket & recv_data )
|
||||
{
|
||||
uint64 itemguid;
|
||||
ObjectGuid itemGuid;
|
||||
uint8 dstslot;
|
||||
recv_data >> itemguid >> dstslot;
|
||||
recv_data >> itemGuid >> dstslot;
|
||||
|
||||
// cheating attempt, client should never send opcode in that case
|
||||
if(!Player::IsEquipmentPos(INVENTORY_SLOT_BAG_0, dstslot))
|
||||
return;
|
||||
|
||||
Item* item = _player->GetItemByGuid(itemguid);
|
||||
Item* item = _player->GetItemByGuid(itemGuid);
|
||||
uint16 dstpos = dstslot | (INVENTORY_SLOT_BAG_0 << 8);
|
||||
|
||||
if(!item || item->GetPos() == dstpos)
|
||||
|
|
@ -1049,25 +1049,25 @@ void WorldSession::HandleSetAmmoOpcode(WorldPacket & recv_data)
|
|||
GetPlayer()->SetAmmo(item);
|
||||
}
|
||||
|
||||
void WorldSession::SendEnchantmentLog(uint64 Target, uint64 Caster,uint32 ItemID,uint32 SpellID)
|
||||
void WorldSession::SendEnchantmentLog(ObjectGuid targetGuid, ObjectGuid casterGuid, uint32 itemId, uint32 spellId)
|
||||
{
|
||||
WorldPacket data(SMSG_ENCHANTMENTLOG, (8+8+4+4+1)); // last check 2.0.10
|
||||
data << uint64(Target);
|
||||
data << uint64(Caster);
|
||||
data << uint32(ItemID);
|
||||
data << uint32(SpellID);
|
||||
data << ObjectGuid(targetGuid);
|
||||
data << ObjectGuid(casterGuid);
|
||||
data << uint32(itemId);
|
||||
data << uint32(spellId);
|
||||
data << uint8(0);
|
||||
SendPacket(&data);
|
||||
}
|
||||
|
||||
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));
|
||||
data << uint64(Itemguid);
|
||||
data << ObjectGuid(itemGuid);
|
||||
data << uint32(slot);
|
||||
data << uint32(Duration);
|
||||
data << uint64(Playerguid);
|
||||
data << uint32(duration);
|
||||
data << ObjectGuid(playerGuid);
|
||||
SendPacket(&data);
|
||||
}
|
||||
|
||||
|
|
@ -1222,22 +1222,29 @@ void WorldSession::HandleSocketOpcode(WorldPacket& recv_data)
|
|||
{
|
||||
DEBUG_LOG("WORLD: CMSG_SOCKET_GEMS");
|
||||
|
||||
uint64 item_guid;
|
||||
uint64 gem_guids[MAX_GEM_SOCKETS];
|
||||
ObjectGuid itemGuid;
|
||||
ObjectGuid gemGuids[MAX_GEM_SOCKETS];
|
||||
|
||||
recv_data >> item_guid;
|
||||
if(!item_guid)
|
||||
recv_data >> itemGuid;
|
||||
if (!itemGuid.IsItem())
|
||||
return;
|
||||
|
||||
for(int i = 0; i < MAX_GEM_SOCKETS; ++i)
|
||||
recv_data >> gem_guids[i];
|
||||
recv_data >> gemGuids[i];
|
||||
|
||||
//cheat -> tried to socket same gem multiple times
|
||||
if ((gem_guids[0] && (gem_guids[0] == gem_guids[1] || gem_guids[0] == gem_guids[2])) ||
|
||||
(gem_guids[1] && (gem_guids[1] == gem_guids[2])))
|
||||
return;
|
||||
for(int i = 0; i < MAX_GEM_SOCKETS; ++i)
|
||||
{
|
||||
ObjectGuid gemGuid = gemGuids[0];
|
||||
if (!gemGuid.IsItem())
|
||||
return;
|
||||
|
||||
Item *itemTarget = _player->GetItemByGuid(item_guid);
|
||||
for(int j = i+1; j < MAX_GEM_SOCKETS; ++j)
|
||||
if (gemGuids[j] == gemGuid)
|
||||
return;
|
||||
}
|
||||
|
||||
Item *itemTarget = _player->GetItemByGuid(itemGuid);
|
||||
if(!itemTarget) //missing item to socket
|
||||
return;
|
||||
|
||||
|
|
@ -1250,7 +1257,7 @@ void WorldSession::HandleSocketOpcode(WorldPacket& recv_data)
|
|||
|
||||
Item *Gems[MAX_GEM_SOCKETS];
|
||||
for(int i = 0; i < MAX_GEM_SOCKETS; ++i)
|
||||
Gems[i] = gem_guids[i] ? _player->GetItemByGuid(gem_guids[i]) : NULL;
|
||||
Gems[i] = !gemGuids[i].IsEmpty() ? _player->GetItemByGuid(gemGuids[i]) : NULL;
|
||||
|
||||
GemPropertiesEntry const *GemProps[MAX_GEM_SOCKETS];
|
||||
for(int i = 0; i < MAX_GEM_SOCKETS; ++i) //get geminfo from dbc storage
|
||||
|
|
@ -1392,15 +1399,15 @@ void WorldSession::HandleSocketOpcode(WorldPacket& recv_data)
|
|||
//if a meta gem is being equipped, all information has to be written to the item before testing if the conditions for the gem are met
|
||||
|
||||
//remove ALL enchants
|
||||
for(uint32 enchant_slot = SOCK_ENCHANTMENT_SLOT; enchant_slot < SOCK_ENCHANTMENT_SLOT + MAX_GEM_SOCKETS; ++enchant_slot)
|
||||
for (uint32 enchant_slot = SOCK_ENCHANTMENT_SLOT; enchant_slot < SOCK_ENCHANTMENT_SLOT + MAX_GEM_SOCKETS; ++enchant_slot)
|
||||
_player->ApplyEnchantment(itemTarget, EnchantmentSlot(enchant_slot), false);
|
||||
|
||||
for(int i = 0; i < MAX_GEM_SOCKETS; ++i)
|
||||
for (int i = 0; i < MAX_GEM_SOCKETS; ++i)
|
||||
{
|
||||
if(GemEnchants[i])
|
||||
if (GemEnchants[i])
|
||||
{
|
||||
itemTarget->SetEnchantment(EnchantmentSlot(SOCK_ENCHANTMENT_SLOT + i), GemEnchants[i], 0, 0);
|
||||
if(Item* guidItem = _player->GetItemByGuid(gem_guids[i]))
|
||||
if(Item* guidItem = !gemGuids[i].IsEmpty() ? _player->GetItemByGuid(gemGuids[i]) : NULL)
|
||||
_player->DestroyItem(guidItem->GetBagSlot(), guidItem->GetSlot(), true );
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12195,7 +12195,7 @@ void Player::AddItemToBuyBackSlot( Item *pItem )
|
|||
uint32 etime = uint32(base - m_logintime + (30 * 3600));
|
||||
uint32 eslot = slot - BUYBACK_SLOT_START;
|
||||
|
||||
SetUInt64Value( PLAYER_FIELD_VENDORBUYBACK_SLOT_1 + (eslot * 2), pItem->GetGUID() );
|
||||
SetGuidValue(PLAYER_FIELD_VENDORBUYBACK_SLOT_1 + (eslot * 2), pItem->GetObjectGuid());
|
||||
if (ItemPrototype const *pProto = pItem->GetProto())
|
||||
SetUInt32Value( PLAYER_FIELD_BUYBACK_PRICE_1 + eslot, pProto->SellPrice * pItem->GetCount() );
|
||||
else
|
||||
|
|
@ -12456,7 +12456,7 @@ void Player::AddEnchantmentDuration(Item *item,EnchantmentSlot slot,uint32 durat
|
|||
}
|
||||
if (item && duration > 0 )
|
||||
{
|
||||
GetSession()->SendItemEnchantTimeUpdate(GetGUID(), item->GetGUID(), slot, uint32(duration/1000));
|
||||
GetSession()->SendItemEnchantTimeUpdate(GetObjectGuid(), item->GetObjectGuid(), slot, uint32(duration/1000));
|
||||
m_enchantDuration.push_back(EnchantDuration(item, slot, duration));
|
||||
}
|
||||
}
|
||||
|
|
@ -12818,7 +12818,7 @@ void Player::SendEnchantmentDurations()
|
|||
{
|
||||
for(EnchantDurationList::const_iterator itr = m_enchantDuration.begin(); itr != m_enchantDuration.end(); ++itr)
|
||||
{
|
||||
GetSession()->SendItemEnchantTimeUpdate(GetGUID(), itr->item->GetGUID(), itr->slot, uint32(itr->leftduration) / 1000);
|
||||
GetSession()->SendItemEnchantTimeUpdate(GetObjectGuid(), itr->item->GetObjectGuid(), itr->slot, uint32(itr->leftduration) / 1000);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -15652,7 +15652,7 @@ bool Player::LoadFromDB(ObjectGuid guid, SqlQueryHolder *holder )
|
|||
|
||||
// reset some aura modifiers before aura apply
|
||||
|
||||
SetUInt64Value(PLAYER_FARSIGHT, 0);
|
||||
SetGuidValue(PLAYER_FARSIGHT, ObjectGuid());
|
||||
SetUInt32Value(PLAYER_TRACK_CREATURES, 0 );
|
||||
SetUInt32Value(PLAYER_TRACK_RESOURCES, 0 );
|
||||
|
||||
|
|
|
|||
|
|
@ -362,8 +362,8 @@ class MANGOS_DLL_SPEC WorldSession
|
|||
AuctionHouseEntry const* GetCheckedAuctionHouseForAuctioneer(ObjectGuid guid);
|
||||
|
||||
//Item Enchantment
|
||||
void SendEnchantmentLog(uint64 Target, uint64 Caster,uint32 ItemID,uint32 SpellID);
|
||||
void SendItemEnchantTimeUpdate(uint64 Playerguid, uint64 Itemguid,uint32 slot,uint32 Duration);
|
||||
void SendEnchantmentLog(ObjectGuid targetGuid, ObjectGuid casterGuid, uint32 itemId, uint32 spellId);
|
||||
void SendItemEnchantTimeUpdate(ObjectGuid playerGuid, ObjectGuid itemGuid, uint32 slot, uint32 duration);
|
||||
|
||||
//Taxi
|
||||
void SendTaxiStatus(ObjectGuid guid);
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#ifndef __REVISION_NR_H__
|
||||
#define __REVISION_NR_H__
|
||||
#define REVISION_NR "11463"
|
||||
#define REVISION_NR "11464"
|
||||
#endif // __REVISION_NR_H__
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue