aboutsummaryrefslogtreecommitdiff
path: root/src/game/Item.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/game/Item.cpp')
-rw-r--r--src/game/Item.cpp30
1 files changed, 28 insertions, 2 deletions
diff --git a/src/game/Item.cpp b/src/game/Item.cpp
index 5f281f6b98d..36ddcd16828 100644
--- a/src/game/Item.cpp
+++ b/src/game/Item.cpp
@@ -699,10 +699,11 @@ bool Item::IsEquipped() const
return !IsInBag() && m_slot < EQUIPMENT_SLOT_END;
}
-bool Item::CanBeTraded() const
+bool Item::CanBeTraded(bool mail) const
{
- if (IsSoulBound())
+ if ((!mail || !IsBoundAccountWide()) && IsSoulBound())
return false;
+
if (IsBag() && (Player::IsBagPos(GetPos()) || !((Bag const*)this)->IsEmpty()) )
return false;
@@ -956,3 +957,28 @@ Item* Item::CloneItem( uint32 count, Player const* player ) const
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();
+ }
+}