[7900] Now really allow recieve account bounded items by mail reciver.

This commit is contained in:
VladimirMangos 2009-05-27 10:53:02 +04:00
parent ba1d0684da
commit 1abe4c0d79
4 changed files with 33 additions and 7 deletions

View file

@ -942,3 +942,29 @@ Item* Item::CloneItem( uint32 count, Player const* player ) const
newItem->SetItemRandomProperties(GetItemRandomPropertyId());
return newItem;
}
bool Item::IsBindedNotWith( Player const* player ) const
{
// not binded item
if(!IsSoulBound())
return false;
// own item
if(GetOwnerGUID()== player->GetGUID())
return false;
// not BOA item case
if(!IsBoundAccountWide())
return true;
// online
if(Player* owner = objmgr.GetPlayer(GetOwnerGUID()))
{
return owner->GetSession()->GetAccountId() != player->GetSession()->GetAccountId();
}
// offline slow case
else
{
return objmgr.GetPlayerAccountIdByGUID(GetOwnerGUID()) != player->GetSession()->GetAccountId();
}
}

View file

@ -216,7 +216,7 @@ class MANGOS_DLL_SPEC Item : public Object
void SetBinding(bool val) { ApplyModFlag(ITEM_FIELD_FLAGS,ITEM_FLAGS_BINDED,val); }
bool IsSoulBound() const { return HasFlag(ITEM_FIELD_FLAGS, ITEM_FLAGS_BINDED); }
bool IsBoundAccountWide() const { return HasFlag(ITEM_FIELD_FLAGS, ITEM_FLAGS_BOA); }
bool IsBindedNotWith(uint64 guid) const { return IsSoulBound() && GetOwnerGUID()!= guid; }
bool IsBindedNotWith(Player const* player) const;
bool IsBoundByEnchant() const;
virtual void SaveToDB();
virtual bool LoadFromDB(uint32 guid, uint64 owner_guid, QueryResult *result = NULL);

View file

@ -8892,7 +8892,7 @@ uint8 Player::_CanStoreItem( uint8 bag, uint8 slot, ItemPosCountVec &dest, uint3
return swap ? EQUIP_ERR_ITEMS_CANT_BE_SWAPPED :EQUIP_ERR_ITEM_NOT_FOUND;
}
if(pItem && pItem->IsBindedNotWith(GetGUID()))
if(pItem && pItem->IsBindedNotWith(this))
{
if(no_space_count)
*no_space_count = count;
@ -9375,7 +9375,7 @@ uint8 Player::CanStoreItems( Item **pItems,int count) const
return EQUIP_ERR_ITEM_NOT_FOUND;
// item it 'bind'
if(pItem->IsBindedNotWith(GetGUID()))
if(pItem->IsBindedNotWith(this))
return EQUIP_ERR_DONT_OWN_THAT_ITEM;
Bag *pBag;
@ -9577,7 +9577,7 @@ uint8 Player::CanEquipItem( uint8 slot, uint16 &dest, Item *pItem, bool swap, bo
ItemPrototype const *pProto = pItem->GetProto();
if( pProto )
{
if(pItem->IsBindedNotWith(GetGUID()))
if(pItem->IsBindedNotWith(this))
return EQUIP_ERR_DONT_OWN_THAT_ITEM;
// check count of items (skip for auto move for same player from bank)
@ -9750,7 +9750,7 @@ uint8 Player::CanBankItem( uint8 bag, uint8 slot, ItemPosCountVec &dest, Item *p
if (!pProto)
return swap ? EQUIP_ERR_ITEMS_CANT_BE_SWAPPED : EQUIP_ERR_ITEM_NOT_FOUND;
if (pItem->IsBindedNotWith(GetGUID()))
if (pItem->IsBindedNotWith(this))
return EQUIP_ERR_DONT_OWN_THAT_ITEM;
// check count of items (skip for auto move for same player from bank)
@ -9930,7 +9930,7 @@ uint8 Player::CanUseItem( Item *pItem, bool not_loading ) const
ItemPrototype const *pProto = pItem->GetProto();
if (pProto)
{
if (pItem->IsBindedNotWith(GetGUID()))
if (pItem->IsBindedNotWith(this))
return EQUIP_ERR_DONT_OWN_THAT_ITEM;
if ((pProto->AllowableClass & getClassMask()) == 0 || (pProto->AllowableRace & getRaceMask()) == 0)

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "7899"
#define REVISION_NR "7900"
#endif // __REVISION_NR_H__