diff --git a/src/game/ItemHandler.cpp b/src/game/ItemHandler.cpp index 82572bf1c..c8cd72270 100644 --- a/src/game/ItemHandler.cpp +++ b/src/game/ItemHandler.cpp @@ -643,11 +643,6 @@ void WorldSession::HandleBuyItemInSlotOpcode( WorldPacket & recv_data ) recv_data >> vendorguid >> item >> slot >> bagguid >> bagslot >> count; - if (slot < 1) - return; // client numbering slots from 1 - - --slot; - uint8 bag = NULL_BAG; // init for case invalid bagGUID // find bag slot by bag guid @@ -684,11 +679,6 @@ void WorldSession::HandleBuyItemOpcode( WorldPacket & recv_data ) recv_data >> vendorguid >> item >> slot >> count >> unk1; - if (slot < 1) - return; // client numbering slots from 1 - - --slot; - GetPlayer()->BuyItemFromVendorSlot(vendorguid, slot, item, count, NULL_BAG, NULL_SLOT); } @@ -740,13 +730,15 @@ void WorldSession::SendListInventory(uint64 vendorguid) WorldPacket data( SMSG_LIST_INVENTORY, (8+1+numitems*8*4) ); data << uint64(vendorguid); - data << uint8(numitems); + + size_t count_pos = data.wpos(); + data << uint8(count); // placeholder float discountMod = _player->GetReputationPriceDiscount(pCreature); - for(int i = 0; i < numitems; ++i ) + for(uint8 vendorslot = 0; vendorslot < numitems; ++vendorslot ) { - if(VendorItem const* crItem = vItems->GetItem(i)) + if(VendorItem const* crItem = vItems->GetItem(vendorslot)) { if(ItemPrototype const *pProto = ObjectMgr::GetItemPrototype(crItem->item)) { @@ -758,7 +750,7 @@ void WorldSession::SendListInventory(uint64 vendorguid) // reputation discount uint32 price = uint32(floor(pProto->BuyPrice * discountMod)); - data << uint32(count); + data << uint32(vendorslot); data << uint32(crItem->item); data << uint32(pProto->DisplayInfoID); data << uint32(crItem->maxcount <= 0 ? 0xFFFFFFFF : pCreature->GetVendorItemCurrentCount(crItem)); @@ -773,7 +765,7 @@ void WorldSession::SendListInventory(uint64 vendorguid) if ( count == 0 || data.size() != 8 + 1 + size_t(count) * 8 * 4 ) return; - data.put(8, count); + data.put(count_pos, count); SendPacket( &data ); } diff --git a/src/game/Player.cpp b/src/game/Player.cpp index c9d2e76c9..68c5eb150 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -18332,7 +18332,7 @@ bool Player::BuyItemFromVendorSlot(uint64 vendorguid, uint32 vendorslot, uint32 return false; } - VendorItem const* crItem = vItems->m_items[vendorslot]; + VendorItem const* crItem = vItems->GetItem(vendorslot); if(!crItem || crItem->item != item) // store diff item (cheating) { SendBuyError( BUY_ERR_CANT_FIND_ITEM, pCreature, item, 0); diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 5816f11ba..7f7716bbc 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "9722" + #define REVISION_NR "9723" #endif // __REVISION_NR_H__