[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:
VladimirMangos 2010-01-21 10:19:18 +03:00
parent 4e6befc43d
commit 4995a6d298
5 changed files with 104 additions and 102 deletions

View file

@ -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)