aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMachiavelli <machiavelli.trinity@gmail.com>2012-01-18 18:57:21 +0100
committerMachiavelli <machiavelli.trinity@gmail.com>2012-01-18 18:57:21 +0100
commit46dda033c8b5abe45286ac94c4c727e57710ded3 (patch)
treeaaf6e8968d85ead9a989186122105e355e11b882
parentabd94e324b1ba872da331e19a3e80a6667edb363 (diff)
Core/Items: Blizzlike fix for the recent trade exploit fix
-rwxr-xr-xsrc/server/game/Entities/Player/Player.cpp21
-rwxr-xr-xsrc/server/game/Entities/Player/Player.h2
2 files changed, 9 insertions, 14 deletions
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp
index eb270521500..ddd1cdc8849 100755
--- a/src/server/game/Entities/Player/Player.cpp
+++ b/src/server/game/Entities/Player/Player.cpp
@@ -12814,6 +12814,14 @@ void Player::SplitItem(uint16 src, uint16 dst, uint32 count)
return;
}
+ //! If trading
+ if (TradeData* tradeData = GetTradeData())
+ {
+ //! If current item is in trade window (only possible with packet spoofing - silent return)
+ if (GetTradeData()->GetTradeSlotForItem(pSrcItem->GetGUID()) != TRADE_SLOT_INVALID)
+ return;
+ }
+
sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "STORAGE: SplitItem bag = %u, slot = %u, item = %u, count = %u", dstbag, dstslot, pSrcItem->GetEntry(), count);
Item* pNewItem = pSrcItem->CloneItem(count, this);
if (!pNewItem)
@@ -12883,19 +12891,6 @@ void Player::SplitItem(uint16 src, uint16 dst, uint32 count)
EquipItem(dest, pNewItem, true);
AutoUnequipOffhandIfNeed();
}
-
- //! Make sure that code below only is executed when trading
- if (!GetTradeData())
- return;
-
- //! 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
- //! Note that this is not blizzlike, the item should be greyed out when in trade.
- //! TODO: Figure out which packet(s) are responsible for that.
- TradeSlots const slot = GetTradeData() ? GetTradeData()->GetTradeSlotForItem(pSrcItem->GetGUID()) : TRADE_SLOT_INVALID;
- if (slot != TRADE_SLOT_INVALID)
- GetTradeData()->SetItem(slot, pSrcItem, true);
}
void Player::SwapItem(uint16 src, uint16 dst)
diff --git a/src/server/game/Entities/Player/Player.h b/src/server/game/Entities/Player/Player.h
index ae889e342c3..fccd380bd29 100755
--- a/src/server/game/Entities/Player/Player.h
+++ b/src/server/game/Entities/Player/Player.h
@@ -1004,7 +1004,7 @@ class TradeData
Item* GetItem(TradeSlots slot) const;
bool HasItem(uint64 itemGuid) const;
TradeSlots const GetTradeSlotForItem(uint64 itemGuid);
- void SetItem(TradeSlots slot, Item* item, bool update = false);
+ void SetItem(TradeSlots slot, Item* item);
uint32 GetSpell() const { return m_spell; }
void SetSpell(uint32 spell_id, Item* castItem = NULL);