mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 22:37:03 +00:00
[9723] Finaly cleanup usage ventorslot values.
This is also fix recent showup problem buy items from vendors in case when some items usable (and then show in list) only for some class/races.
This commit is contained in:
parent
50c7e57541
commit
c6b56b512c
3 changed files with 9 additions and 17 deletions
|
|
@ -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<uint8>(8, count);
|
||||
data.put<uint8>(count_pos, count);
|
||||
SendPacket( &data );
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#ifndef __REVISION_NR_H__
|
||||
#define __REVISION_NR_H__
|
||||
#define REVISION_NR "9722"
|
||||
#define REVISION_NR "9723"
|
||||
#endif // __REVISION_NR_H__
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue