[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
This commit is contained in:
r00ty-tc authored and Aokromes committed 2017-03-03 01:17:15 +01:00
1 parent fda6446838
commit 4fcffe767c
3 files changed
+33 -6

No files matched your search

@@ -333,10 +333,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 " UI64FMTD " with buyout " UI64FMTD " 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();
@@ -384,10 +390,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 " UI64FMTD " with buyout " UI64FMTD " 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];