mirror of
https://github.com/mangosfour/server.git
synced 2025-12-15 10:37:02 +00:00
Use enum InventoryResult as return type for few functions.
This commit is contained in:
parent
23a861e4a6
commit
730a907252
18 changed files with 184 additions and 185 deletions
|
|
@ -152,7 +152,7 @@ void WorldSession::HandleAutoEquipItemOpcode( WorldPacket & recv_data )
|
|||
return; // only at cheat
|
||||
|
||||
uint16 dest;
|
||||
uint8 msg = _player->CanEquipItem( NULL_SLOT, dest, pSrcItem, !pSrcItem->IsBag() );
|
||||
InventoryResult msg = _player->CanEquipItem( NULL_SLOT, dest, pSrcItem, !pSrcItem->IsBag() );
|
||||
if( msg != EQUIP_ERR_OK )
|
||||
{
|
||||
_player->SendEquipError( msg, pSrcItem, NULL );
|
||||
|
|
@ -246,7 +246,7 @@ void WorldSession::HandleDestroyItemOpcode( WorldPacket & recv_data )
|
|||
// prevent drop unequipable items (in combat, for example) and non-empty bags
|
||||
if(_player->IsEquipmentPos(pos) || _player->IsBagPos(pos))
|
||||
{
|
||||
uint8 msg = _player->CanUnequipItem( pos, false );
|
||||
InventoryResult msg = _player->CanUnequipItem( pos, false );
|
||||
if( msg != EQUIP_ERR_OK )
|
||||
{
|
||||
_player->SendEquipError( msg, _player->GetItemByPos(pos), NULL );
|
||||
|
|
@ -454,7 +454,7 @@ void WorldSession::HandleReadItemOpcode( WorldPacket & recv_data )
|
|||
{
|
||||
WorldPacket data;
|
||||
|
||||
uint8 msg = _player->CanUseItem( pItem );
|
||||
InventoryResult msg = _player->CanUseItem( pItem );
|
||||
if( msg == EQUIP_ERR_OK )
|
||||
{
|
||||
data.Initialize (SMSG_READ_ITEM_OK, 8);
|
||||
|
|
@ -629,7 +629,7 @@ void WorldSession::HandleBuybackItem(WorldPacket & recv_data)
|
|||
}
|
||||
|
||||
ItemPosCountVec dest;
|
||||
uint8 msg = _player->CanStoreItem( NULL_BAG, NULL_SLOT, dest, pItem, false );
|
||||
InventoryResult msg = _player->CanStoreItem( NULL_BAG, NULL_SLOT, dest, pItem, false );
|
||||
if( msg == EQUIP_ERR_OK )
|
||||
{
|
||||
_player->ModifyMoney( -(int32)price );
|
||||
|
|
@ -858,7 +858,7 @@ void WorldSession::HandleAutoStoreBagItemOpcode( WorldPacket & recv_data )
|
|||
// check unequip potability for equipped items and bank bags
|
||||
if(_player->IsEquipmentPos ( src ) || _player->IsBagPos ( src ))
|
||||
{
|
||||
uint8 msg = _player->CanUnequipItem( src, !_player->IsBagPos ( src ));
|
||||
InventoryResult msg = _player->CanUnequipItem( src, !_player->IsBagPos ( src ));
|
||||
if(msg != EQUIP_ERR_OK)
|
||||
{
|
||||
_player->SendEquipError( msg, pItem, NULL );
|
||||
|
|
@ -867,7 +867,7 @@ void WorldSession::HandleAutoStoreBagItemOpcode( WorldPacket & recv_data )
|
|||
}
|
||||
|
||||
ItemPosCountVec dest;
|
||||
uint8 msg = _player->CanStoreItem( dstbag, NULL_SLOT, dest, pItem, false );
|
||||
InventoryResult msg = _player->CanStoreItem( dstbag, NULL_SLOT, dest, pItem, false );
|
||||
if( msg != EQUIP_ERR_OK )
|
||||
{
|
||||
_player->SendEquipError( msg, pItem, NULL );
|
||||
|
|
@ -971,7 +971,7 @@ void WorldSession::HandleAutoBankItemOpcode(WorldPacket& recvPacket)
|
|||
return;
|
||||
|
||||
ItemPosCountVec dest;
|
||||
uint8 msg = _player->CanBankItem( NULL_BAG, NULL_SLOT, dest, pItem, false );
|
||||
InventoryResult msg = _player->CanBankItem( NULL_BAG, NULL_SLOT, dest, pItem, false );
|
||||
if( msg != EQUIP_ERR_OK )
|
||||
{
|
||||
_player->SendEquipError( msg, pItem, NULL );
|
||||
|
|
@ -1005,7 +1005,7 @@ void WorldSession::HandleAutoStoreBankItemOpcode(WorldPacket& recvPacket)
|
|||
if(_player->IsBankPos(srcbag, srcslot)) // moving from bank to inventory
|
||||
{
|
||||
ItemPosCountVec dest;
|
||||
uint8 msg = _player->CanStoreItem( NULL_BAG, NULL_SLOT, dest, pItem, false );
|
||||
InventoryResult msg = _player->CanStoreItem( NULL_BAG, NULL_SLOT, dest, pItem, false );
|
||||
if( msg != EQUIP_ERR_OK )
|
||||
{
|
||||
_player->SendEquipError( msg, pItem, NULL );
|
||||
|
|
@ -1018,7 +1018,7 @@ void WorldSession::HandleAutoStoreBankItemOpcode(WorldPacket& recvPacket)
|
|||
else // moving from inventory to bank
|
||||
{
|
||||
ItemPosCountVec dest;
|
||||
uint8 msg = _player->CanBankItem( NULL_BAG, NULL_SLOT, dest, pItem, false );
|
||||
InventoryResult msg = _player->CanBankItem( NULL_BAG, NULL_SLOT, dest, pItem, false );
|
||||
if( msg != EQUIP_ERR_OK )
|
||||
{
|
||||
_player->SendEquipError( msg, pItem, NULL );
|
||||
|
|
@ -1378,7 +1378,7 @@ void WorldSession::HandleSocketOpcode(WorldPacket& recv_data)
|
|||
// for equipped item check all equipment for duplicate equipped gems
|
||||
if(itemTarget->IsEquipped())
|
||||
{
|
||||
if(uint8 res = _player->CanEquipUniqueItem(Gems[i], slot, limit_newcount >= 0 ? limit_newcount : 0))
|
||||
if(InventoryResult res = _player->CanEquipUniqueItem(Gems[i], slot, limit_newcount >= 0 ? limit_newcount : 0))
|
||||
{
|
||||
_player->SendEquipError( res, itemTarget, NULL );
|
||||
return;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue