Core/Items: Fix an exploit where the player was able to send CMSG_SET_AMMO with items they didn't have in their bags. Only a visual bug (not sure if it gave bonuses too, which iirc do appear in later expansions).

This commit is contained in:
Discover-
2014-01-16 20:48:37 +01:00
parent 61f45283ef
commit 45dc95c8dc

View File

@@ -991,9 +991,9 @@ void WorldSession::HandleAutoStoreBankItemOpcode(WorldPacket& recvPacket)
void WorldSession::HandleSetAmmoOpcode(WorldPacket& recvData)
{
if (!GetPlayer()->IsAlive())
if (!_player->IsAlive())
{
GetPlayer()->SendEquipError(EQUIP_ERR_YOU_ARE_DEAD, NULL, NULL);
_player->SendEquipError(EQUIP_ERR_YOU_ARE_DEAD, NULL, NULL);
return;
}
@@ -1002,10 +1002,18 @@ void WorldSession::HandleSetAmmoOpcode(WorldPacket& recvData)
recvData >> item;
if (!item)
GetPlayer()->RemoveAmmo();
if (item)
{
if (!_player->GetItemCount(item))
{
_player->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, NULL, NULL);
return;
}
_player->SetAmmo(item);
}
else
GetPlayer()->SetAmmo(item);
_player->RemoveAmmo();
}
void WorldSession::SendEnchantmentLog(uint64 target, uint64 caster, uint32 itemId, uint32 enchantId)