Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/src/game/Item.cpp b/src/game/Item.cpp
- index 1d806be..6ef2bc7 100644
- --- a/src/game/Item.cpp
- +++ b/src/game/Item.cpp
- @@ -845,8 +845,20 @@ bool Item::IsEquipped() const
- bool Item::CanBeTraded() const
- {
- + return CanBeTradedWithAccount(0);
- +}
- +
- +bool Item::CanBeTradedWithAccount(uint32 account) const
- +{
- + Player* owner = GetOwner();
- +
- + if (!owner)
- + return false;
- +
- if (IsSoulBound())
- + if (account == 0 || !IsBoundAccountWide() || owner->GetSession()->GetAccountId() != account)
- return false;
- +
- if (IsBag() && (Player::IsBagPos(GetPos()) || !((Bag const*)this)->IsEmpty()))
- return false;
- @@ -1105,6 +1117,10 @@ bool Item::IsBindedNotWith(Player const* player) const
- if (!IsSoulBound())
- return false;
- + // Is the item bound to account ?
- + if (IsBoundAccountWide())
- + return false;
- +
- return true;
- }
- diff --git a/src/game/Item.h b/src/game/Item.h
- index ebe17d6..531c76a 100644
- --- a/src/game/Item.h
- +++ b/src/game/Item.h
- @@ -274,7 +274,17 @@ class MANGOS_DLL_SPEC Item : public Object
- Player* GetOwner()const;
- void SetBinding(bool val) { ApplyModFlag(ITEM_FIELD_FLAGS, ITEM_DYNFLAG_BINDED, val); }
- - bool IsSoulBound() const { return HasFlag(ITEM_FIELD_FLAGS, ITEM_DYNFLAG_BINDED); }
- +
- + bool IsSoulBound() const
- + {
- + return HasFlag(ITEM_FIELD_FLAGS, ITEM_DYNFLAG_BINDED) || IsBoundAccountWide();
- + }
- +
- + bool IsBoundAccountWide () const
- + {
- + return (GetProto()->Bonding & BIND_ACCOUNT) != 0;
- + }
- +
- bool IsBindedNotWith(Player const* player) const;
- bool IsBoundByEnchant() const;
- virtual void SaveToDB();
- @@ -292,6 +302,7 @@ class MANGOS_DLL_SPEC Item : public Object
- bool IsNotEmptyBag() const;
- bool IsBroken() const { return GetUInt32Value(ITEM_FIELD_MAXDURABILITY) > 0 && GetUInt32Value(ITEM_FIELD_DURABILITY) == 0; }
- bool CanBeTraded() const;
- + bool CanBeTradedWithAccount(uint32 account) const;
- void SetInTrade(bool b = true) { mb_in_trade = b; }
- bool IsInTrade() const { return mb_in_trade; }
- diff --git a/src/game/ItemPrototype.h b/src/game/ItemPrototype.h
- index 7c8a0fd..55320d3 100644
- --- a/src/game/ItemPrototype.h
- +++ b/src/game/ItemPrototype.h
- @@ -79,10 +79,11 @@ enum ItemBondingType
- BIND_WHEN_EQUIPPED = 2,
- BIND_WHEN_USE = 3,
- BIND_QUEST_ITEM = 4,
- - BIND_QUEST_ITEM1 = 5 // not used in game
- + BIND_QUEST_ITEM1 = 5, // not used in game
- + BIND_ACCOUNT = 6
- };
- -#define MAX_BIND_TYPE 6
- +#define MAX_BIND_TYPE 7
- // Mask for ItemPrototype.Flags field
- enum ItemPrototypeFlags
- diff --git a/src/game/MailHandler.cpp b/src/game/MailHandler.cpp
- index 0264f4e..07ffe53 100644
- --- a/src/game/MailHandler.cpp
- +++ b/src/game/MailHandler.cpp
- @@ -204,7 +204,7 @@ void WorldSession::HandleSendMail(WorldPacket& recv_data)
- return;
- }
- - if (!item->CanBeTraded())
- + if (!item->CanBeTradedWithAccount(rc_account))
- {
- pl->SendMailResult(0, MAIL_SEND, MAIL_ERR_EQUIP_ERROR, EQUIP_ERR_MAIL_BOUND_ITEM);
- return;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement