diff options
author | Vincent-Michael <Vincent_Michael@gmx.de> | 2014-04-23 20:05:45 +0200 |
---|---|---|
committer | Vincent-Michael <Vincent_Michael@gmx.de> | 2014-04-23 20:05:45 +0200 |
commit | b39ba5656e76bfecac37701553b6886db06f9d88 (patch) | |
tree | 398c44d83b0f36949b7b7ec2e4590e9202674f58 /src/server/game/Handlers/AuctionHouseHandler.cpp | |
parent | 3eb2d615f3d84294817e8a1ee0f666becb6112f2 (diff) | |
parent | 6b42f99540dda13b622fe1653993e3b84709efc7 (diff) |
Merge branch 'master' of github.com:TrinityCore/TrinityCore into 4.3.4
Diffstat (limited to 'src/server/game/Handlers/AuctionHouseHandler.cpp')
-rw-r--r-- | src/server/game/Handlers/AuctionHouseHandler.cpp | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/src/server/game/Handlers/AuctionHouseHandler.cpp b/src/server/game/Handlers/AuctionHouseHandler.cpp index fddbfac0a5e..12bc18298b7 100644 --- a/src/server/game/Handlers/AuctionHouseHandler.cpp +++ b/src/server/game/Handlers/AuctionHouseHandler.cpp @@ -143,7 +143,9 @@ void WorldSession::HandleAuctionSellItem(WorldPacket& recvData) recvData >> itemsCount; uint64 itemGUIDs[MAX_AUCTION_ITEMS]; // 160 slot = 4x 36 slot bag + backpack 16 slot + memset(itemGUIDs, 0, sizeof(itemGUIDs)); uint32 count[MAX_AUCTION_ITEMS]; + memset(count, 0, sizeof(count)); if (itemsCount > MAX_AUCTION_ITEMS) { @@ -211,6 +213,7 @@ void WorldSession::HandleAuctionSellItem(WorldPacket& recvData) Item* items[MAX_AUCTION_ITEMS]; uint32 finalCount = 0; + uint32 itemEntry = 0; for (uint32 i = 0; i < itemsCount; ++i) { @@ -222,9 +225,12 @@ void WorldSession::HandleAuctionSellItem(WorldPacket& recvData) return; } + if (itemEntry == 0) + itemEntry = item->GetTemplate()->ItemId; + if (sAuctionMgr->GetAItem(item->GetGUIDLow()) || !item->CanBeTraded() || item->IsNotEmptyBag() || item->GetTemplate()->Flags & ITEM_PROTO_FLAG_CONJURED || item->GetUInt32Value(ITEM_FIELD_DURATION) || - item->GetCount() < count[i]) + item->GetCount() < count[i] || itemEntry != item->GetTemplate()->ItemId) { SendAuctionCommandResult(NULL, AUCTION_SELL_ITEM, ERR_AUCTION_DATABASE_ERROR); return; @@ -240,6 +246,19 @@ void WorldSession::HandleAuctionSellItem(WorldPacket& recvData) return; } + // check if there are 2 identical guids, in this case user is most likely cheating + for (uint32 i = 0; i < itemsCount - 1; ++i) + { + for (uint32 j = i + 1; j < itemsCount; ++j) + { + if (itemGUIDs[i] == itemGUIDs[j]) + { + SendAuctionCommandResult(0, AUCTION_SELL_ITEM, ERR_AUCTION_DATABASE_ERROR); + return; + } + } + } + for (uint32 i = 0; i < itemsCount; ++i) { Item* item = items[i]; |