bool Item::IsBindedNotWith(Player const* player) const { // own item if (GetOwnerGuid() == player->GetObjectGuid()) return false; if (HasFlag(ITEM_FIELD_FLAGS, ITEM_DYNFLAG_BOP_TRADEABLE)) { if (m_allowedLooterGuids.find(player->GetObjectGuid().GetCounter()) != m_allowedLooterGuids.end()) return false; } // has loot with diff owner if (HasGeneratedLoot()) return true; // not binded item if (!IsSoulBound()) return false; // not BOA item case if (!IsBoundAccountWide()) return true; // online if (Player* owner = GetOwner()) { return owner->GetSession()->GetAccountId() != player->GetSession()->GetAccountId(); } // offline slow case else { return sAccountMgr.GetPlayerAccountIdByGUID(GetOwnerGuid()) != player->GetSession()->GetAccountId(); } }
bool Item::CanBeTraded(bool mail, bool trade) const { if ((!mail || !IsBoundAccountWide()) && (IsSoulBound() && (!HasFlag(ITEM_FIELD_FLAGS, ITEM_DYNFLAG_BOP_TRADEABLE) || !trade))) return false; if (IsBag() && (Player::IsBagPos(GetPos()) || !((Bag const*)this)->IsEmpty()) ) return false; if (Player* owner = GetOwner()) { if (owner->CanUnequipItem(GetPos(),false) != EQUIP_ERR_OK ) return false; if (owner->GetLootGUID()==GetGUID()) return false; } if (HasGeneratedLoot()) return false; if (IsBoundByEnchant()) return false; return true; }
bool Item::IsBindedNotWith(Player const* player) const { // own item if (GetOwnerGuid() == player->GetObjectGuid()) return false; // has loot with diff owner if (HasGeneratedLoot()) return true; // not binded item if (!IsSoulBound()) return false; // not BOA item case if (!IsBoundAccountWide()) return true; // online if (Player* owner = GetOwner()) { return owner->GetSession()->GetAccountId() != player->GetSession()->GetAccountId(); } // offline slow case else { return sObjectMgr.GetPlayerAccountIdByGUID(GetOwnerGuid()) != player->GetSession()->GetAccountId(); } }
InventoryResult Item::CanBeMergedPartlyWith(ItemPrototype const* proto) const { // check item type if (GetEntry() != proto->ItemId) return EQUIP_ERR_ITEM_CANT_STACK; // check free space (full stacks can't be target of merge if (GetCount() >= proto->GetMaxStackSize()) return EQUIP_ERR_ITEM_CANT_STACK; // not allow merge looting currently items if (HasGeneratedLoot()) return EQUIP_ERR_ALREADY_LOOTED; return EQUIP_ERR_OK; }
bool Item::IsBindedNotWith(Player const* player) const { // own item if (GetOwnerGuid() == player->GetObjectGuid()) return false; // has loot with diff owner if (HasGeneratedLoot()) return true; // not binded item if (!IsSoulBound()) return false; return true; }
bool Item::CanBeTraded() const { if (IsSoulBound()) return false; if (IsBag() && (Player::IsBagPos(GetPos()) || !((Bag const*)this)->IsEmpty())) return false; if (Player* owner = GetOwner()) { if (owner->CanUnequipItem(GetPos(), false) != EQUIP_ERR_OK) return false; if (owner->GetLootGuid() == GetObjectGuid()) return false; } if (HasGeneratedLoot()) return false; if (IsBoundByEnchant()) return false; return true; }