Add support for vendors selling the same items with different extendedCost - original code by Vladimir (thanks mate)
Closes issue #1756 --HG-- branch : trunk
This commit is contained in:
+13
-8
@@ -19355,7 +19355,7 @@ void Player::InitDisplayIds()
|
||||
}
|
||||
|
||||
// Return true is the bought item has a max count to force refresh of window by caller
|
||||
bool Player::BuyItemFromVendor(uint64 vendorguid, uint32 item, uint8 count, uint8 bag, uint8 slot)
|
||||
bool Player::BuyItemFromVendorSlot(uint64 vendorguid, uint32 vendorslot, uint32 item, uint8 count, uint8 bag, uint8 slot)
|
||||
{
|
||||
// cheating attempt
|
||||
if (count < 1) count = 1;
|
||||
@@ -19389,15 +19389,20 @@ bool Player::BuyItemFromVendor(uint64 vendorguid, uint32 item, uint8 count, uint
|
||||
return false;
|
||||
}
|
||||
|
||||
size_t vendor_slot = vItems->FindItemSlot(item);
|
||||
if (vendor_slot >= vItems->GetItemCount())
|
||||
if (vendorslot >= vItems->GetItemCount())
|
||||
{
|
||||
SendBuyError( BUY_ERR_CANT_FIND_ITEM, pCreature, item, 0);
|
||||
return false;
|
||||
}
|
||||
|
||||
VendorItem const* crItem = vItems->GetItem(vendorslot);
|
||||
// store diff item (cheating)
|
||||
if(!crItem || crItem->item != item)
|
||||
{
|
||||
SendBuyError(BUY_ERR_CANT_FIND_ITEM, pCreature, item, 0);
|
||||
return false;
|
||||
}
|
||||
|
||||
VendorItem const* crItem = vItems->m_items[vendor_slot];
|
||||
|
||||
// check current item amount if it limited
|
||||
if (crItem->maxcount != 0)
|
||||
{
|
||||
@@ -19509,7 +19514,7 @@ bool Player::BuyItemFromVendor(uint64 vendorguid, uint32 item, uint8 count, uint
|
||||
|
||||
WorldPacket data(SMSG_BUY_ITEM, (8+4+4+4));
|
||||
data << uint64(pCreature->GetGUID());
|
||||
data << uint32(vendor_slot+1); // numbered from 1 at client
|
||||
data << uint32(vendorslot+1); // numbered from 1 at client
|
||||
data << int32(crItem->maxcount > 0 ? new_count : 0xFFFFFFFF);
|
||||
data << uint32(count);
|
||||
GetSession()->SendPacket(&data);
|
||||
@@ -19564,7 +19569,7 @@ bool Player::BuyItemFromVendor(uint64 vendorguid, uint32 item, uint8 count, uint
|
||||
|
||||
WorldPacket data(SMSG_BUY_ITEM, (8+4+4+4));
|
||||
data << uint64(pCreature->GetGUID());
|
||||
data << uint32(vendor_slot + 1); // numbered from 1 at client
|
||||
data << uint32(vendorslot + 1); // numbered from 1 at client
|
||||
data << int32(crItem->maxcount > 0 ? new_count : 0xFFFFFFFF);
|
||||
data << uint32(count);
|
||||
GetSession()->SendPacket(&data);
|
||||
@@ -23755,4 +23760,4 @@ void Player::RefundItem(Item *item)
|
||||
if (arenaRefund)
|
||||
ModifyArenaPoints(arenaRefund);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user