Merge branch 'master' into 310

Conflicts:
	src/game/Player.cpp
This commit is contained in:
tomrus88 2009-05-28 10:16:02 +04:00
commit f6e2b55e2c
25 changed files with 382 additions and 240 deletions

View file

@ -696,18 +696,19 @@ bool Item::IsEquipped() const
return !IsInBag() && m_slot < EQUIPMENT_SLOT_END;
}
bool Item::CanBeTraded() const
bool Item::CanBeTraded(bool mail) const
{
if(IsSoulBound())
return false;
if(IsBag() && (Player::IsBagPos(GetPos()) || !((Bag const*)this)->IsEmpty()) )
if ((!mail || !IsBoundAccountWide()) && IsSoulBound())
return false;
if(Player* owner = GetOwner())
if (IsBag() && (Player::IsBagPos(GetPos()) || !((Bag const*)this)->IsEmpty()) )
return false;
if (Player* owner = GetOwner())
{
if(owner->CanUnequipItem(GetPos(),false) != EQUIP_ERR_OK )
if (owner->CanUnequipItem(GetPos(),false) != EQUIP_ERR_OK )
return false;
if(owner->GetLootGUID()==GetGUID())
if (owner->GetLootGUID()==GetGUID())
return false;
}
@ -941,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();
}
}