aboutsummaryrefslogtreecommitdiff
path: root/src/game/Player.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/game/Player.cpp')
-rw-r--r--src/game/Player.cpp21
1 files changed, 13 insertions, 8 deletions
diff --git a/src/game/Player.cpp b/src/game/Player.cpp
index ba3773df262..2863068686d 100644
--- a/src/game/Player.cpp
+++ b/src/game/Player.cpp
@@ -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,14 +19389,19 @@ 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);
+ SendBuyError( BUY_ERR_CANT_FIND_ITEM, pCreature, item, 0);
return false;
}
- VendorItem const* crItem = vItems->m_items[vendor_slot];
+ 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;
+ }
// 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);
-} \ No newline at end of file
+}