Fixed a bug that caused the client to crash when listing more than 50.. (#155)

.. owned auctions. This is a client limitation.
This commit is contained in:
Tristan 'Natrist' Cormier 2021-05-14 03:17:36 -04:00 committed by GitHub
parent 767abf6be0
commit c4b3884c0c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -351,6 +351,32 @@ void WorldSession::HandleAuctionSellItem(WorldPacket& recv_data)
GetPlayerName(), GetAccountId(), it->GetProto()->Name1, it->GetEntry(), it->GetCount());
}
/* The client limits owned auctions to 50: */
/* Make sure we do not go over this limit, or the client will crash */
char numTotalOwned = 0;
for (AuctionHouseObject::AuctionEntryMap::const_iterator itr = auctionHouse->GetAuctions().begin(); itr != auctionHouse->GetAuctions().end(); ++itr)
{
AuctionEntry* Aentry = itr->second;
if (Aentry->owner == pl->GetGUIDLow())
{
Item *pItem = sAuctionMgr.GetAItem(Aentry->itemGuidLow);
if (!pItem)
{
sLog.outError("%s:%d:\tItem %id doesn't exist!", __FILE__, __LINE__, Aentry->itemGuidLow);
}
else
{
numTotalOwned++;
if (numTotalOwned == 50)
{
/* Player already listed 50 auctions; */
/* Send an internal error result back down to the client... */
return SendAuctionCommandResult(NULL, AUCTION_STARTED, AUCTION_ERR_DATABASE, EQUIP_ERR_OK);
}
}
}
}
pl->ModifyMoney(-int32(deposit));
AuctionEntry* AH = auctionHouse->AddAuction(auctionHouseEntry, it, etime, bid, buyout, deposit, pl);