diff options
| author | r00ty-tc <r00ty-tc@users.noreply.github.com> | 2017-02-19 00:47:59 +0000 |
|---|---|---|
| committer | r00ty-tc <r00ty-tc@users.noreply.github.com> | 2017-02-19 15:18:09 +0100 |
| commit | 6bd9aa27872cd0d76d785bc38162001c4bacd913 (patch) | |
| tree | 2a72c2b0a8cd0dfda34230f7068a640d6d54849d /src/server/game/Handlers/AuctionHouseHandler.cpp | |
| parent | 7ed8cf65c935afb7544aeeb71c3b6c528f8a6366 (diff) | |
[Core/AH] Correctly check player can pay deposit
- Deposit amount wasn't correctly checked in the case of multiple items,
player with insufficient funds could auctin more items than they should
Diffstat (limited to 'src/server/game/Handlers/AuctionHouseHandler.cpp')
| -rw-r--r-- | src/server/game/Handlers/AuctionHouseHandler.cpp | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/src/server/game/Handlers/AuctionHouseHandler.cpp b/src/server/game/Handlers/AuctionHouseHandler.cpp index b575f5faf0e..702da0d4b66 100644 --- a/src/server/game/Handlers/AuctionHouseHandler.cpp +++ b/src/server/game/Handlers/AuctionHouseHandler.cpp @@ -309,10 +309,16 @@ void WorldSession::HandleAuctionSellItem(WorldPacket& recvData) TC_LOG_INFO("network", "CMSG_AUCTION_SELL_ITEM: Player %s (guid %d) is selling item %s entry %u (guid %d) with count %u with initial bid %u with buyout %u and with time %u (in sec) in auctionhouse %u", _player->GetName().c_str(), _player->GetGUID().GetCounter(), item->GetTemplate()->Name1.c_str(), item->GetEntry(), item->GetGUID().GetCounter(), item->GetCount(), bid, buyout, auctionTime, AH->GetHouseId()); + + // Add to pending auctions, or fail with insufficient funds error + if (!sAuctionMgr->PendingAuctionAdd(_player, AH, item)) + { + SendAuctionCommandResult(AH->Id, AUCTION_SELL_ITEM, ERR_AUCTION_NOT_ENOUGHT_MONEY); + return; + } + sAuctionMgr->AddAItem(item); auctionHouse->AddAuction(AH); - sAuctionMgr->PendingAuctionAdd(_player, AH); - _player->MoveItemFromInventory(item->GetBagSlot(), item->GetSlot(), true); SQLTransaction trans = CharacterDatabase.BeginTransaction(); @@ -360,10 +366,16 @@ void WorldSession::HandleAuctionSellItem(WorldPacket& recvData) TC_LOG_INFO("network", "CMSG_AUCTION_SELL_ITEM: Player %s (guid %d) is selling item %s entry %u (guid %d) with count %u with initial bid %u with buyout %u and with time %u (in sec) in auctionhouse %u", _player->GetName().c_str(), _player->GetGUID().GetCounter(), newItem->GetTemplate()->Name1.c_str(), newItem->GetEntry(), newItem->GetGUID().GetCounter(), newItem->GetCount(), bid, buyout, auctionTime, AH->GetHouseId()); + + // Add to pending auctions, or fail with insufficient funds error + if (!sAuctionMgr->PendingAuctionAdd(_player, AH, newItem)) + { + SendAuctionCommandResult(AH->Id, AUCTION_SELL_ITEM, ERR_AUCTION_NOT_ENOUGHT_MONEY); + return; + } + sAuctionMgr->AddAItem(newItem); auctionHouse->AddAuction(AH); - sAuctionMgr->PendingAuctionAdd(_player, AH); - for (uint32 j = 0; j < itemsCount; ++j) { Item* item2 = items[j]; |
