[10680] Update item buy code for new way vendor item lists work.

This commit is contained in:
VladimirMangos 2010-11-04 20:39:39 +03:00
parent 0bf8b0aa79
commit ef8789f780
2 changed files with 6 additions and 3 deletions

View file

@ -18694,13 +18694,16 @@ bool Player::BuyItemFromVendorSlot(uint64 vendorguid, uint32 vendorslot, uint32
return false;
}
if (vendorslot >= vItems->GetItemCount())
uint32 vCount = vItems ? vItems->GetItemCount() : 0;
uint32 tCount = tItems ? tItems->GetItemCount() : 0;
if (vendorslot >= vCount+tCount)
{
SendBuyError( BUY_ERR_CANT_FIND_ITEM, pCreature, item, 0);
return false;
}
VendorItem const* crItem = vItems->GetItem(vendorslot);
VendorItem const* crItem = vendorslot < vCount ? vItems->GetItem(vendorslot) : tItems->GetItem(vendorslot - vCount);
if(!crItem || crItem->item != item) // store diff item (cheating)
{
SendBuyError( BUY_ERR_CANT_FIND_ITEM, pCreature, item, 0);