aboutsummaryrefslogtreecommitdiff
path: root/src/game/ItemHandler.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/game/ItemHandler.cpp')
-rw-r--r--src/game/ItemHandler.cpp28
1 files changed, 27 insertions, 1 deletions
diff --git a/src/game/ItemHandler.cpp b/src/game/ItemHandler.cpp
index cf762dd0cb2..114393f4287 100644
--- a/src/game/ItemHandler.cpp
+++ b/src/game/ItemHandler.cpp
@@ -674,7 +674,31 @@ void WorldSession::HandleBuyItemInSlotOpcode( WorldPacket & recv_data )
recv_data >> vendorguid >> item >> slot >> bagguid >> bagslot >> count;
- GetPlayer()->BuyItemFromVendor(vendorguid,item,count,bagguid,bagslot);
+ uint8 bag = NULL_BAG; // init for case invalid bagGUID
+
+ // find bag slot by bag guid
+ if (bagguid == _player->GetGUID())
+ bag = INVENTORY_SLOT_BAG_0;
+ else
+ {
+ for (int i = INVENTORY_SLOT_BAG_START; i < INVENTORY_SLOT_BAG_END;++i)
+ {
+ if (Bag *pBag = (Bag*)_player->GetItemByPos(INVENTORY_SLOT_BAG_0,i))
+ {
+ if (bagguid == pBag->GetGUID())
+ {
+ bag = i;
+ break;
+ }
+ }
+ }
+ }
+
+ // bag not found, cheating?
+ if (bag == NULL_BAG)
+ return;
+
+ GetPlayer()->BuyItemFromVendor(vendorguid,item,count,bag,bagslot);
}
void WorldSession::HandleBuyItemOpcode( WorldPacket & recv_data )
@@ -838,12 +862,14 @@ void WorldSession::HandleBuyBankSlotOpcode(WorldPacket& recvPacket)
recvPacket >> guid;
// cheating protection
+ /* not critical if "cheated", and check skip allow by slots in bank windows open by .bank command.
Creature *pCreature = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_BANKER);
if(!pCreature)
{
sLog.outDebug( "WORLD: HandleBuyBankSlotOpcode - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid)) );
return;
}
+ */
uint32 slot = _player->GetBankBagSlotCount();