Core/Entities: Fix a minor disrepancy in the handling of weapon specializations introduced in revision a83f26ef71 - patch by Dr.Tenma
Fixes issue 5059. Fixes issue 5265. --HG-- branch : trunk
This commit is contained in:
@@ -21681,7 +21681,7 @@ OutdoorPvP * Player::GetOutdoorPvP() const
|
||||
return sOutdoorPvPMgr->GetOutdoorPvPToZoneId(GetZoneId());
|
||||
}
|
||||
|
||||
bool Player::HasItemFitToSpellReqirements(SpellEntry const* spellInfo, Item const* ignoreItem)
|
||||
bool Player::HasItemFitToSpellRequirements(SpellEntry const* spellInfo, Item const* ignoreItem)
|
||||
{
|
||||
if (spellInfo->EquippedItemClass < 0)
|
||||
return true;
|
||||
@@ -21719,7 +21719,7 @@ bool Player::HasItemFitToSpellReqirements(SpellEntry const* spellInfo, Item cons
|
||||
break;
|
||||
}
|
||||
default:
|
||||
sLog->outError("HasItemFitToSpellReqirements: Not handled spell requirement for item class %u",spellInfo->EquippedItemClass);
|
||||
sLog->outError("HasItemFitToSpellRequirements: Not handled spell requirement for item class %u",spellInfo->EquippedItemClass);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -21759,7 +21759,7 @@ void Player::RemoveItemDependentAurasAndCasts(Item * pItem)
|
||||
}
|
||||
|
||||
// skip if not item dependent or have alternative item
|
||||
if (HasItemFitToSpellReqirements(spellInfo,pItem))
|
||||
if (HasItemFitToSpellRequirements(spellInfo,pItem))
|
||||
{
|
||||
++itr;
|
||||
continue;
|
||||
@@ -21772,7 +21772,7 @@ void Player::RemoveItemDependentAurasAndCasts(Item * pItem)
|
||||
// currently casted spells can be dependent from item
|
||||
for (uint32 i = 0; i < CURRENT_MAX_SPELL; ++i)
|
||||
if (Spell* spell = GetCurrentSpell(CurrentSpellTypes(i)))
|
||||
if (spell->getState() != SPELL_STATE_DELAYED && !HasItemFitToSpellReqirements(spell->m_spellInfo,pItem))
|
||||
if (spell->getState() != SPELL_STATE_DELAYED && !HasItemFitToSpellRequirements(spell->m_spellInfo,pItem))
|
||||
InterruptSpell(CurrentSpellTypes(i));
|
||||
}
|
||||
|
||||
|
||||
@@ -1155,7 +1155,7 @@ class Player : public Unit, public GridObject<Player>
|
||||
uint8 GetBankBagSlotCount() const { return GetByteValue(PLAYER_BYTES_2, 2); }
|
||||
void SetBankBagSlotCount(uint8 count) { SetByteValue(PLAYER_BYTES_2, 2, count); }
|
||||
bool HasItemCount(uint32 item, uint32 count, bool inBankAlso = false) const;
|
||||
bool HasItemFitToSpellReqirements(SpellEntry const* spellInfo, Item const* ignoreItem = NULL);
|
||||
bool HasItemFitToSpellRequirements(SpellEntry const* spellInfo, Item const* ignoreItem = NULL);
|
||||
bool CanNoReagentCast(SpellEntry const* spellInfo) const;
|
||||
bool HasItemOrGemWithIdEquipped(uint32 item, uint32 count, uint8 except_slot = NULL_SLOT) const;
|
||||
bool HasItemOrGemWithLimitCategoryEquipped(uint32 limitCategory, uint32 count, uint8 except_slot = NULL_SLOT) const;
|
||||
|
||||
@@ -10327,9 +10327,18 @@ uint32 Unit::SpellDamageBonus(Unit *pVictim, SpellEntry const *spellProto, uint3
|
||||
AuraEffectList const &mModDamagePercentDone = GetAuraEffectsByType(SPELL_AURA_MOD_DAMAGE_PERCENT_DONE);
|
||||
for (AuraEffectList::const_iterator i = mModDamagePercentDone.begin(); i != mModDamagePercentDone.end(); ++i)
|
||||
if ((*i)->GetMiscValue() & GetSpellSchoolMask(spellProto))
|
||||
if (((*i)->GetSpellProto()->EquippedItemClass == -1) ||
|
||||
(((*i)->GetSpellProto()->EquippedItemClass & spellProto->EquippedItemClass) &&
|
||||
((*i)->GetSpellProto()->EquippedItemSubClassMask & spellProto->EquippedItemSubClassMask)))
|
||||
if ((*i)->GetSpellProto()->EquippedItemClass == -1)
|
||||
{
|
||||
AddPctN(DoneTotalMod, (*i)->GetAmount());
|
||||
}
|
||||
else if (!((*i)->GetSpellProto()->AttributesEx5 & SPELL_ATTR5_SPECIAL_ITEM_CLASS_CHECK))
|
||||
{
|
||||
if ((*i)->GetSpellProto()->EquippedItemClass & spellProto->EquippedItemClass)
|
||||
if (((*i)->GetSpellProto()->EquippedItemSubClassMask == 0) ||
|
||||
((*i)->GetSpellProto()->EquippedItemSubClassMask & spellProto->EquippedItemSubClassMask))
|
||||
AddPctN(DoneTotalMod, (*i)->GetAmount());
|
||||
}
|
||||
else if (ToPlayer() && ToPlayer()->HasItemFitToSpellRequirements((*i)->GetSpellProto()))
|
||||
AddPctN(DoneTotalMod, (*i)->GetAmount());
|
||||
}
|
||||
|
||||
@@ -11620,27 +11629,43 @@ void Unit::MeleeDamageBonus(Unit *pVictim, uint32 *pdamage, WeaponAttackType att
|
||||
for (AuraEffectList::const_iterator i = mModDamagePercentDone.begin(); i != mModDamagePercentDone.end(); ++i)
|
||||
if (spellProto)
|
||||
{
|
||||
if ((*i)->GetMiscValue() & GetSpellSchoolMask(spellProto))
|
||||
if (((*i)->GetSpellProto()->EquippedItemClass == -1) ||
|
||||
((*i)->GetSpellProto()->EquippedItemClass & spellProto->EquippedItemClass) &&
|
||||
((*i)->GetSpellProto()->EquippedItemSubClassMask & spellProto->EquippedItemSubClassMask))
|
||||
AddPctN(DoneTotalMod, (*i)->GetAmount());
|
||||
AuraEffectList const &mModDamagePercentDone = GetAuraEffectsByType(SPELL_AURA_MOD_DAMAGE_PERCENT_DONE);
|
||||
for (AuraEffectList::const_iterator i = mModDamagePercentDone.begin(); i != mModDamagePercentDone.end(); ++i)
|
||||
if ((*i)->GetMiscValue() & GetSpellSchoolMask(spellProto))
|
||||
if ((*i)->GetSpellProto()->EquippedItemClass == -1)
|
||||
{
|
||||
AddPctN(DoneTotalMod, (*i)->GetAmount());
|
||||
}
|
||||
else if (!((*i)->GetSpellProto()->AttributesEx5 & SPELL_ATTR5_SPECIAL_ITEM_CLASS_CHECK))
|
||||
{
|
||||
if ((*i)->GetSpellProto()->EquippedItemClass & spellProto->EquippedItemClass)
|
||||
if (((*i)->GetSpellProto()->EquippedItemSubClassMask == 0) ||
|
||||
((*i)->GetSpellProto()->EquippedItemSubClassMask & spellProto->EquippedItemSubClassMask))
|
||||
AddPctN(DoneTotalMod, (*i)->GetAmount());
|
||||
}
|
||||
else if (ToPlayer() && ToPlayer()->HasItemFitToSpellRequirements((*i)->GetSpellProto()))
|
||||
AddPctN(DoneTotalMod, (*i)->GetAmount());
|
||||
}
|
||||
else if (ToPlayer())
|
||||
{
|
||||
EquipmentSlots slot;
|
||||
|
||||
switch (attType)
|
||||
if (!((*i)->GetSpellProto()->AttributesEx5 & SPELL_ATTR5_SPECIAL_ITEM_CLASS_CHECK))
|
||||
{
|
||||
case BASE_ATTACK: slot = EQUIPMENT_SLOT_MAINHAND; break;
|
||||
case OFF_ATTACK: slot = EQUIPMENT_SLOT_OFFHAND; break;
|
||||
case RANGED_ATTACK: slot = EQUIPMENT_SLOT_RANGED; break;
|
||||
default: return;
|
||||
EquipmentSlots slot;
|
||||
|
||||
switch (attType)
|
||||
{
|
||||
case BASE_ATTACK: slot = EQUIPMENT_SLOT_MAINHAND; break;
|
||||
case OFF_ATTACK: slot = EQUIPMENT_SLOT_OFFHAND; break;
|
||||
case RANGED_ATTACK: slot = EQUIPMENT_SLOT_RANGED; break;
|
||||
default: return;
|
||||
}
|
||||
|
||||
Item * item = ToPlayer()->GetItemByPos(INVENTORY_SLOT_BAG_0, slot);
|
||||
|
||||
if (item && !item->IsBroken() && item->IsFitToSpellRequirements((*i)->GetSpellProto()))
|
||||
AddPctN(DoneTotalMod, (*i)->GetAmount());
|
||||
}
|
||||
|
||||
Item * item = ToPlayer()->GetItemByPos(INVENTORY_SLOT_BAG_0, slot);
|
||||
|
||||
if (item && !item->IsBroken() && item->IsFitToSpellRequirements((*i)->GetSpellProto()))
|
||||
else if (ToPlayer()->HasItemFitToSpellRequirements((*i)->GetSpellProto()))
|
||||
AddPctN(DoneTotalMod, (*i)->GetAmount());
|
||||
}
|
||||
|
||||
|
||||
@@ -459,7 +459,7 @@ enum SpellAttr5
|
||||
SPELL_ATTR5_UNK13 = 0x00002000, // 13
|
||||
SPELL_ATTR5_UNK14 = 0x00004000, // 14
|
||||
SPELL_ATTR5_UNK15 = 0x00008000, // 15
|
||||
SPELL_ATTR5_UNK16 = 0x00010000, // 16
|
||||
SPELL_ATTR5_SPECIAL_ITEM_CLASS_CHECK = 0x00010000, // 16 this allows spells with EquippedItemClass to affect spells from other items if the required item is equipped
|
||||
SPELL_ATTR5_USABLE_WHILE_FEARED = 0x00020000, // 17 usable while feared
|
||||
SPELL_ATTR5_USABLE_WHILE_CONFUSED = 0x00040000, // 18 usable while confused
|
||||
SPELL_ATTR5_UNK19 = 0x00080000, // 19
|
||||
|
||||
@@ -6029,7 +6029,7 @@ SpellCastResult Spell::CheckItems()
|
||||
// if not item target then required item must be equipped
|
||||
else
|
||||
{
|
||||
if (m_caster->GetTypeId() == TYPEID_PLAYER && !m_caster->ToPlayer()->HasItemFitToSpellReqirements(m_spellInfo))
|
||||
if (m_caster->GetTypeId() == TYPEID_PLAYER && !m_caster->ToPlayer()->HasItemFitToSpellRequirements(m_spellInfo))
|
||||
return SPELL_FAILED_EQUIPPED_ITEM_CLASS;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user