Core/Items: Really fix a trading spoof exploit.

Thanks Alexsot for fix.
This commit is contained in:
SignFinder
2012-01-18 11:56:34 +04:00
parent afc0d72761
commit cc88681dc5
2 changed files with 4 additions and 4 deletions
+3 -3
View File
@@ -319,11 +319,11 @@ Item* TradeData::GetSpellCastItem() const
return m_spellCastItem ? m_player->GetItemByGuid(m_spellCastItem) : NULL; return m_spellCastItem ? m_player->GetItemByGuid(m_spellCastItem) : NULL;
} }
void TradeData::SetItem(TradeSlots slot, Item* item) void TradeData::SetItem(TradeSlots slot, Item* item, bool update)
{ {
uint64 itemGuid = item ? item->GetGUID() : 0; uint64 itemGuid = item ? item->GetGUID() : 0;
if (m_items[slot] == itemGuid) if (m_items[slot] == itemGuid && !update)
return; return;
m_items[slot] = itemGuid; m_items[slot] = itemGuid;
@@ -12893,7 +12893,7 @@ void Player::SplitItem(uint16 src, uint16 dst, uint32 count)
//! in the underlying packet builder function //! in the underlying packet builder function
TradeSlots const slot = GetTradeData()->GetTradeSlotForItem(pSrcItem->GetGUID()); TradeSlots const slot = GetTradeData()->GetTradeSlotForItem(pSrcItem->GetGUID());
if (slot != TRADE_SLOT_INVALID) if (slot != TRADE_SLOT_INVALID)
GetTradeData()->SetItem(slot, pSrcItem); GetTradeData()->SetItem(slot, pSrcItem, true);
} }
void Player::SwapItem(uint16 src, uint16 dst) void Player::SwapItem(uint16 src, uint16 dst)
+1 -1
View File
@@ -1004,7 +1004,7 @@ class TradeData
Item* GetItem(TradeSlots slot) const; Item* GetItem(TradeSlots slot) const;
bool HasItem(uint64 itemGuid) const; bool HasItem(uint64 itemGuid) const;
TradeSlots const GetTradeSlotForItem(uint64 itemGuid); TradeSlots const GetTradeSlotForItem(uint64 itemGuid);
void SetItem(TradeSlots slot, Item* item); void SetItem(TradeSlots slot, Item* item, bool update = false);
uint32 GetSpell() const { return m_spell; } uint32 GetSpell() const { return m_spell; }
void SetSpell(uint32 spell_id, Item* castItem = NULL); void SetSpell(uint32 spell_id, Item* castItem = NULL);