mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-02-02 02:23:49 +00:00
fix(Core/Spell): make use of SPELL_ATTR3_IGNORE_PROC_SUBCLASS_MASK (#5005)
This commit is contained in:
@@ -2131,34 +2131,42 @@ bool Aura::IsProcTriggeredOnEvent(AuraApplication* aurApp, ProcEventInfo& eventI
|
|||||||
// do that only for passive spells
|
// do that only for passive spells
|
||||||
// TODO: this needs to be unified for all kinds of auras
|
// TODO: this needs to be unified for all kinds of auras
|
||||||
Unit* target = aurApp->GetTarget();
|
Unit* target = aurApp->GetTarget();
|
||||||
if (IsPassive() && target->GetTypeId() == TYPEID_PLAYER)
|
if (IsPassive() && target->GetTypeId() == TYPEID_PLAYER && GetSpellInfo()->EquippedItemClass != -1)
|
||||||
{
|
{
|
||||||
if (GetSpellInfo()->EquippedItemClass == ITEM_CLASS_WEAPON)
|
if (!GetSpellInfo()->HasAttribute(SPELL_ATTR3_IGNORE_PROC_SUBCLASS_MASK))
|
||||||
{
|
{
|
||||||
if (target->ToPlayer()->IsInFeralForm())
|
Item* item = nullptr;
|
||||||
return false;
|
if (GetSpellInfo()->EquippedItemClass == ITEM_CLASS_WEAPON)
|
||||||
|
|
||||||
if (eventInfo.GetDamageInfo())
|
|
||||||
{
|
{
|
||||||
WeaponAttackType attType = eventInfo.GetDamageInfo()->GetAttackType();
|
if (target->ToPlayer()->IsInFeralForm())
|
||||||
Item* item = nullptr;
|
|
||||||
if (attType == BASE_ATTACK)
|
|
||||||
item = target->ToPlayer()->GetUseableItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_MAINHAND);
|
|
||||||
else if (attType == OFF_ATTACK)
|
|
||||||
item = target->ToPlayer()->GetUseableItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_OFFHAND);
|
|
||||||
else
|
|
||||||
item = target->ToPlayer()->GetUseableItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_RANGED);
|
|
||||||
|
|
||||||
if (!item || item->IsBroken() || item->GetTemplate()->Class != ITEM_CLASS_WEAPON || !((1 << item->GetTemplate()->SubClass) & GetSpellInfo()->EquippedItemSubClassMask))
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
if (DamageInfo const* damageInfo = eventInfo.GetDamageInfo())
|
||||||
|
{
|
||||||
|
switch (damageInfo->GetAttackType())
|
||||||
|
{
|
||||||
|
case BASE_ATTACK:
|
||||||
|
item = target->ToPlayer()->GetUseableItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_MAINHAND);
|
||||||
|
break;
|
||||||
|
case OFF_ATTACK:
|
||||||
|
item = target->ToPlayer()->GetUseableItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_OFFHAND);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
item = target->ToPlayer()->GetUseableItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_RANGED);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (GetSpellInfo()->EquippedItemClass == ITEM_CLASS_ARMOR)
|
||||||
|
{
|
||||||
|
// Check if player is wearing shield
|
||||||
|
item = target->ToPlayer()->GetUseableItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_OFFHAND);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!item || item->IsBroken() || !item->IsFitToSpellRequirements(GetSpellInfo()))
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else if (GetSpellInfo()->EquippedItemClass == ITEM_CLASS_ARMOR)
|
|
||||||
{
|
|
||||||
// Check if player is wearing shield
|
|
||||||
Item* item = target->ToPlayer()->GetUseableItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_OFFHAND);
|
|
||||||
if (!item || item->IsBroken() || item->GetTemplate()->Class != ITEM_CLASS_ARMOR || !((1 << item->GetTemplate()->SubClass) & GetSpellInfo()->EquippedItemSubClassMask))
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user