Skip to content

Commit

Permalink
Core/Items: Fix an exploit where the player was able to send CMSG_SET…
Browse files Browse the repository at this point in the history
…_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).
  • Loading branch information
Discover- committed Jan 16, 2014
1 parent 61f4528 commit 45dc95c
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions src/server/game/Handlers/ItemHandler.cpp
Expand Up @@ -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;
}

Expand All @@ -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)
Expand Down

0 comments on commit 45dc95c

Please sign in to comment.