diff options
Diffstat (limited to 'src/game/Player.cpp')
-rw-r--r-- | src/game/Player.cpp | 28 |
1 files changed, 10 insertions, 18 deletions
diff --git a/src/game/Player.cpp b/src/game/Player.cpp index e63b3ab8ff0..b73a49fb990 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -8626,14 +8626,6 @@ uint8 Player::GetAttackBySlot( uint8 slot ) } } -bool Player::HasBankBagSlot( uint8 slot ) const -{ - uint32 maxslot = GetByteValue(PLAYER_BYTES_2, 2) + BANK_SLOT_BAG_START; - if( slot < maxslot ) - return true; - return false; -} - bool Player::IsInventoryPos( uint8 bag, uint8 slot ) { if( bag == INVENTORY_SLOT_BAG_0 && slot == NULL_SLOT ) @@ -10022,44 +10014,44 @@ uint8 Player::CanUnequipItem( uint16 pos, bool swap ) const uint8 Player::CanBankItem( uint8 bag, uint8 slot, ItemPosCountVec &dest, Item *pItem, bool swap, bool not_loading ) const { - if( !pItem ) + if (!pItem) return swap ? EQUIP_ERR_ITEMS_CANT_BE_SWAPPED : EQUIP_ERR_ITEM_NOT_FOUND; uint32 count = pItem->GetCount(); sLog.outDebug( "STORAGE: CanBankItem bag = %u, slot = %u, item = %u, count = %u", bag, slot, pItem->GetEntry(), pItem->GetCount()); ItemPrototype const *pProto = pItem->GetProto(); - if( !pProto ) + if (!pProto) return swap ? EQUIP_ERR_ITEMS_CANT_BE_SWAPPED : EQUIP_ERR_ITEM_NOT_FOUND; - if( pItem->IsBindedNotWith(GetGUID()) ) + if (pItem->IsBindedNotWith(GetGUID())) return EQUIP_ERR_DONT_OWN_THAT_ITEM; // check count of items (skip for auto move for same player from bank) uint8 res = CanTakeMoreSimilarItems(pItem); - if(res != EQUIP_ERR_OK) + if (res != EQUIP_ERR_OK) return res; // in specific slot - if( bag != NULL_BAG && slot != NULL_SLOT ) + if (bag != NULL_BAG && slot != NULL_SLOT) { - if( slot >= BANK_SLOT_BAG_START && slot < BANK_SLOT_BAG_END ) + if (slot >= BANK_SLOT_BAG_START && slot < BANK_SLOT_BAG_END) { if (!pItem->IsBag()) return EQUIP_ERR_ITEM_DOESNT_GO_TO_SLOT; - if( !HasBankBagSlot( slot ) ) + if (slot - BANK_SLOT_BAG_START >= GetBankBagSlotCount()) return EQUIP_ERR_MUST_PURCHASE_THAT_BAG_SLOT; - if( uint8 cantuse = CanUseItem( pItem, not_loading ) != EQUIP_ERR_OK ) + if (uint8 cantuse = CanUseItem( pItem, not_loading ) != EQUIP_ERR_OK) return cantuse; } res = _CanStoreItem_InSpecificSlot(bag,slot,dest,pProto,count,swap,pItem); - if(res!=EQUIP_ERR_OK) + if (res!=EQUIP_ERR_OK) return res; - if(count==0) + if (count==0) return EQUIP_ERR_OK; } |