diff options
Diffstat (limited to 'src')
-rwxr-xr-x | src/server/game/Entities/Player/Player.cpp | 21 | ||||
-rwxr-xr-x | src/server/game/Entities/Player/Player.h | 2 |
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); |