diff options
Diffstat (limited to 'src/server/game/Handlers/AuctionHouseHandler.cpp')
-rw-r--r-- | src/server/game/Handlers/AuctionHouseHandler.cpp | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/src/server/game/Handlers/AuctionHouseHandler.cpp b/src/server/game/Handlers/AuctionHouseHandler.cpp index 6c29619d38b..6cc5c0b3012 100644 --- a/src/server/game/Handlers/AuctionHouseHandler.cpp +++ b/src/server/game/Handlers/AuctionHouseHandler.cpp @@ -268,10 +268,16 @@ void WorldSession::HandleAuctionSellItem(WorldPackets::AuctionHouse::AuctionSell TC_LOG_INFO("network", "CMSG_AUCTION_SELL_ITEM: %s %s is selling item %s %s to auctioneer " UI64FMTD " with count %u with initial bid " UI64FMTD " with buyout " UI64FMTD " and with time %u (in sec) in auctionhouse %u", _player->GetGUID().ToString().c_str(), _player->GetName().c_str(), item->GetGUID().ToString().c_str(), item->GetTemplate()->GetDefaultLocaleName(), AH->auctioneer, item->GetCount(), packet.MinBid, packet.BuyoutPrice, auctionTime, AH->GetHouseId()); + + // Add to pending auctions, or fail with insufficient funds error + if (!sAuctionMgr->PendingAuctionAdd(_player, AH, item)) + { + SendAuctionCommandResult(AH, 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(); @@ -319,9 +325,16 @@ void WorldSession::HandleAuctionSellItem(WorldPackets::AuctionHouse::AuctionSell TC_LOG_INFO("network", "CMSG_AUCTION_SELL_ITEM: %s %s is selling %s %s to auctioneer " UI64FMTD " with count %u with initial bid " UI64FMTD " with buyout " UI64FMTD " and with time %u (in sec) in auctionhouse %u", _player->GetGUID().ToString().c_str(), _player->GetName().c_str(), newItem->GetGUID().ToString().c_str(), newItem->GetTemplate()->GetDefaultLocaleName(), AH->auctioneer, newItem->GetCount(), packet.MinBid, packet.BuyoutPrice, auctionTime, AH->GetHouseId()); + + // Add to pending auctions, or fail with insufficient funds error + if (!sAuctionMgr->PendingAuctionAdd(_player, AH, newItem)) + { + SendAuctionCommandResult(AH, AUCTION_SELL_ITEM, ERR_AUCTION_NOT_ENOUGHT_MONEY); + return; + } + sAuctionMgr->AddAItem(newItem); auctionHouse->AddAuction(AH); - sAuctionMgr->PendingAuctionAdd(_player, AH); for (std::size_t i = 0; i < packet.Items.size(); ++i) { |