@@ -296,15 +296,24 @@ Item* TradeData::GetItem(TradeSlots slot) const
|
||||
return m_items[slot] ? m_player->GetItemByGuid(m_items[slot]) : NULL;
|
||||
}
|
||||
|
||||
bool TradeData::HasItem(uint64 item_guid) const
|
||||
bool TradeData::HasItem(uint64 itemGuid) const
|
||||
{
|
||||
for (uint8 i = 0; i < TRADE_SLOT_COUNT; ++i)
|
||||
if (m_items[i] == item_guid)
|
||||
if (m_items[i] == itemGuid)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
TradeSlots const TradeData::GetTradeSlotForItem(uint64 itemGuid)
|
||||
{
|
||||
for (uint8 i = 0; i < TRADE_SLOT_COUNT; ++i)
|
||||
if (m_items[i] == itemGuid)
|
||||
return TradeSlots(i);
|
||||
|
||||
return TRADE_SLOT_INVALID;
|
||||
}
|
||||
|
||||
Item* TradeData::GetSpellCastItem() const
|
||||
{
|
||||
return m_spellCastItem ? m_player->GetItemByGuid(m_spellCastItem) : NULL;
|
||||
@@ -12874,6 +12883,13 @@ void Player::SplitItem(uint16 src, uint16 dst, uint32 count)
|
||||
EquipItem(dest, pNewItem, true);
|
||||
AutoUnequipOffhandIfNeed();
|
||||
}
|
||||
|
||||
//! Update item count in trade window, prevent spoofing
|
||||
//! Since pSrcItem has its count updated (see above), Item::GetCount() will return the new count
|
||||
//! in the underlying packet builder function
|
||||
TradeSlots const slot = GetTradeData()->GetTradeSlotForItem(pSrcItem->GetGUID());
|
||||
if (slot != TRADE_SLOT_INVALID)
|
||||
GetTradeData()->SetItem(slot, pSrcItem);
|
||||
}
|
||||
|
||||
void Player::SwapItem(uint16 src, uint16 dst)
|
||||
|
||||
Reference in New Issue
Block a user