mirror of
https://github.com/mangosfour/server.git
synced 2025-12-21 19:37:02 +00:00
Merge commit 'origin/master' into 310
This commit is contained in:
commit
05b1bda879
20 changed files with 299 additions and 38 deletions
|
|
@ -762,6 +762,23 @@ bool Item::IsFitToSpellRequirements(SpellEntry const* spellInfo) const
|
|||
return true;
|
||||
}
|
||||
|
||||
bool Item::IsTargetValidForItemUse(Unit* pUnitTarget)
|
||||
{
|
||||
ItemRequiredTargetMapBounds bounds = objmgr.GetItemRequiredTargetMapBounds(GetProto()->ItemId);
|
||||
|
||||
if (bounds.first == bounds.second)
|
||||
return true;
|
||||
|
||||
if (!pUnitTarget)
|
||||
return false;
|
||||
|
||||
for(ItemRequiredTargetMap::const_iterator itr = bounds.first; itr != bounds.second; ++itr)
|
||||
if(itr->second.IsFitToRequirements(pUnitTarget))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void Item::SetEnchantment(EnchantmentSlot slot, uint32 id, uint32 duration, uint32 charges)
|
||||
{
|
||||
// Better lost small time at check in comparison lost time at item save to DB.
|
||||
|
|
@ -967,4 +984,17 @@ bool Item::IsBindedNotWith( Player const* player ) const
|
|||
{
|
||||
return objmgr.GetPlayerAccountIdByGUID(GetOwnerGUID()) != player->GetSession()->GetAccountId();
|
||||
}
|
||||
}
|
||||
|
||||
bool ItemRequiredTarget::IsFitToRequirements( Unit* pUnitTarget ) const
|
||||
{
|
||||
switch(m_uiType)
|
||||
{
|
||||
case ITEM_TARGET_TYPE_CREATURE:
|
||||
return pUnitTarget->isAlive();
|
||||
case ITEM_TARGET_TYPE_DEAD:
|
||||
return !pUnitTarget->isAlive();
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue