mirror of
https://github.com/mangosfour/server.git
synced 2026-01-02 01:37:05 +00:00
[9227] More wide check item looting state at item operations.
Move some checks from packet handlers to Player::Can functions Patch base at idea suggested originally by zhenya.
This commit is contained in:
parent
4e6befc43d
commit
4995a6d298
5 changed files with 104 additions and 102 deletions
|
|
@ -709,6 +709,9 @@ bool Item::IsEquipped() const
|
|||
|
||||
bool Item::CanBeTraded(bool mail) const
|
||||
{
|
||||
if (m_lootGenerated)
|
||||
return false;
|
||||
|
||||
if ((!mail || !IsBoundAccountWide()) && IsSoulBound())
|
||||
return false;
|
||||
|
||||
|
|
@ -1017,6 +1020,23 @@ void Item::BuildUpdateData(UpdateDataMapType& update_players)
|
|||
ClearUpdateMask(false);
|
||||
}
|
||||
|
||||
uint8 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 (m_lootGenerated)
|
||||
return EQUIP_ERR_ALREADY_LOOTED;
|
||||
|
||||
return EQUIP_ERR_OK;
|
||||
}
|
||||
|
||||
bool ItemRequiredTarget::IsFitToRequirements( Unit* pUnitTarget ) const
|
||||
{
|
||||
if(pUnitTarget->GetTypeId() != TYPEID_UNIT)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue