Core/Auras: define and implement attribute SPELL_ATTR3_NO_PROC_EQUIP_REQUIREMENT

Port From (https://github.com/TrinityCore/TrinityCore/commit/b27e741096b59d3e07503bb8db30df6596dee1f2)
This commit is contained in:
hondacrx
2021-06-23 13:22:42 -04:00
parent 62119923f2
commit 7eed87f51c
2 changed files with 23 additions and 22 deletions
@@ -1634,7 +1634,7 @@ namespace Framework.Constants
public enum SpellAttr3 : uint public enum SpellAttr3 : uint
{ {
Unk0 = 0x01, // 0 Unk0 = 0x01, // 0
Unk1 = 0x02, // 1 NoProcEquipRequirement = 0x02, // 1 Ignores subclass mask check when checking proc
Unk2 = 0x04, // 2 Unk2 = 0x04, // 2
BlockableSpell = 0x08, // 3 Only Dmg Class Melee In 3.1.3 BlockableSpell = 0x08, // 3 Only Dmg Class Melee In 3.1.3
IgnoreResurrectionTimer = 0x10, // 4 You Don'T Have To Wait To Be Resurrected With These Spells IgnoreResurrectionTimer = 0x10, // 4 You Don'T Have To Wait To Be Resurrected With These Spells
+22 -21
View File
@@ -1706,32 +1706,33 @@ namespace Game.Spells
// 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.IsTypeId(TypeId.Player)) if (IsPassive() && target.IsPlayer() && GetSpellInfo().EquippedItemClass != ItemClass.None)
{ {
if (GetSpellInfo().EquippedItemClass == ItemClass.Weapon) if (!GetSpellInfo().HasAttribute(SpellAttr3.NoProcEquipRequirement))
{ {
if (target.ToPlayer().IsInFeralForm()) Item item = null;
return 0; if (GetSpellInfo().EquippedItemClass == ItemClass.Weapon)
DamageInfo damageInfo = eventInfo.GetDamageInfo();
if (damageInfo != null)
{ {
WeaponAttackType attType = damageInfo.GetAttackType(); if (target.ToPlayer().IsInFeralForm())
Item item = null;
if (attType == WeaponAttackType.BaseAttack || attType == WeaponAttackType.RangedAttack)
item = target.ToPlayer().GetUseableItemByPos(InventorySlots.Bag0, EquipmentSlot.MainHand);
else if (attType == WeaponAttackType.OffAttack)
item = target.ToPlayer().GetUseableItemByPos(InventorySlots.Bag0, EquipmentSlot.OffHand);
if (item == null || item.IsBroken() || item.GetTemplate().GetClass() != ItemClass.Weapon || !Convert.ToBoolean((1 << (int)item.GetTemplate().GetSubClass()) & GetSpellInfo().EquippedItemSubClassMask))
return 0; return 0;
DamageInfo damageInfo = eventInfo.GetDamageInfo();
if (damageInfo != null)
{
WeaponAttackType attType = damageInfo.GetAttackType();
if (damageInfo.GetAttackType() != WeaponAttackType.OffAttack)
item = target.ToPlayer().GetUseableItemByPos(InventorySlots.Bag0, EquipmentSlot.MainHand);
else
item = target.ToPlayer().GetUseableItemByPos(InventorySlots.Bag0, EquipmentSlot.OffHand);
}
} }
} else if (GetSpellInfo().EquippedItemClass == ItemClass.Armor)
else if (GetSpellInfo().EquippedItemClass == ItemClass.Armor) {
{ // Check if player is wearing shield
// Check if player is wearing shield item = target.ToPlayer().GetUseableItemByPos(InventorySlots.Bag0, EquipmentSlot.OffHand);
Item item = target.ToPlayer().GetUseableItemByPos(InventorySlots.Bag0, EquipmentSlot.OffHand); }
if (item == null || item.IsBroken() || item.GetTemplate().GetClass() != ItemClass.Armor || !Convert.ToBoolean((1 << (int)item.GetTemplate().GetSubClass()) & GetSpellInfo().EquippedItemSubClassMask))
if (!item || item.IsBroken() || !item.IsFitToSpellRequirements(GetSpellInfo()))
return 0; return 0;
} }
} }