/// <summary> /// Apply custom proc settings from SpellProcEventEntry to a given spell /// </summary> private static void PatchSpell(Spell spell, SpellProcEventEntry procEntry) { if (procEntry.SchoolMask != 0) { spell.SchoolMask = procEntry.SchoolMask; } if (procEntry.SpellClassSet != 0) { spell.SpellClassSet = procEntry.SpellClassSet; } if (procEntry.ProcFlags != 0) { spell.ProcTriggerFlags = procEntry.ProcFlags; } if (procEntry.ProcFlagsEx != 0) { // Take just hit flags we don't need others spell.ProcHitFlags = (ProcHitFlags)procEntry.ProcFlagsEx & ProcHitFlags.All; } if (procEntry.CustomChance != 0) { // like the DBC, CustomChance only contains natural percentages spell.ProcChance = (uint)procEntry.CustomChance; } var procEffects = from effect in spell.Effects where effect.AuraType == AuraType.ProcTriggerSpell && effect.EffectIndex != EffectIndex.Custom select effect; foreach (var procEffect in procEffects) { var mask = procEntry.GetSpellFamilyMask(procEffect.EffectIndex); if (mask == null) { continue; } // copy AffectMask procEffect.AffectMask = mask.ToArray(); } }
/// <summary> /// Apply custom proc settings from SpellProcEventEntry to a given spell /// </summary> private static void PatchSpell(Spell spell, SpellProcEventEntry procEntry) { if (procEntry.SchoolMask != DamageSchoolMask.None) { spell.SchoolMask = procEntry.SchoolMask; } if (procEntry.SpellClassSet != SpellClassSet.Generic) { spell.SpellClassSet = procEntry.SpellClassSet; } if (procEntry.ProcFlags != ProcTriggerFlags.None) { spell.ProcTriggerFlagsProp = procEntry.ProcFlags; } if (procEntry.ProcFlagsEx != ProcFlagsExLegacy.None) { spell.ProcHitFlags = (ProcHitFlags)(procEntry.ProcFlagsEx & (ProcFlagsExLegacy.NormalHit | ProcFlagsExLegacy.CriticalHit | ProcFlagsExLegacy.Miss | ProcFlagsExLegacy.Resist | ProcFlagsExLegacy.Dodge | ProcFlagsExLegacy.Parry | ProcFlagsExLegacy.Block | ProcFlagsExLegacy.Evade | ProcFlagsExLegacy.Immune | ProcFlagsExLegacy.Deflect | ProcFlagsExLegacy.Absorb | ProcFlagsExLegacy.Reflect | ProcFlagsExLegacy.Interrupt | ProcFlagsExLegacy.FullBlock)); } if (procEntry.CustomChance != 0.0) { spell.ProcChance = (uint)procEntry.CustomChance; } foreach (SpellEffect spellEffect in spell.Effects.Where( effect => { if (effect.AuraType == AuraType.ProcTriggerSpell) { return(effect.EffectIndex != EffectIndex.Custom); } return(false); })) { uint[] spellFamilyMask = procEntry.GetSpellFamilyMask(spellEffect.EffectIndex); if (spellFamilyMask != null) { spellEffect.AffectMask = spellFamilyMask.ToArray(); } } }
/// <summary> /// Apply custom proc settings from SpellProcEventEntry to all spells /// </summary> public static void PatchSpells(Spell[] spells) { foreach (SpellId key in Entries.Keys) { Spell spell = spells[(int)key]; if (spell != null) { SpellProcEventEntry entry = Entries[spell.SpellId]; if (spell.Line == null) { PatchSpell(spell, entry); } else { spell.Line.LineId.Apply(spellToPatch => PatchSpell(spellToPatch, entry)); } } } }
/// <summary> /// Apply custom proc settings from SpellProcEventEntry to a given spell /// </summary> private static void PatchSpell(Spell spell, SpellProcEventEntry procEntry) { if (procEntry.SchoolMask != 0) { spell.SchoolMask = procEntry.SchoolMask; } if (procEntry.SpellClassSet != 0) { spell.SpellClassSet = procEntry.SpellClassSet; } if (procEntry.ProcFlags != 0) { spell.ProcTriggerFlags = procEntry.ProcFlags; } if (procEntry.ProcFlagsEx != 0) { // Take just hit flags we don't need others spell.ProcHitFlags = (ProcHitFlags)procEntry.ProcFlagsEx & ProcHitFlags.All; } if (procEntry.CustomChance != 0) { // like the DBC, CustomChance only contains natural percentages spell.ProcChance = (uint)procEntry.CustomChance; } var procEffects = from effect in spell.Effects where effect.AuraType == AuraType.ProcTriggerSpell && effect.EffectIndex != EffectIndex.Custom select effect; foreach (var procEffect in procEffects) { var mask = procEntry.GetSpellFamilyMask(procEffect.EffectIndex); if (mask == null) continue; // copy AffectMask procEffect.AffectMask = mask.ToArray(); } }
static void PatchSpell(Spell spell, SpellProcEventEntry procEntry) { foreach (var effect in spell.Effects) { if (effect.AuraType == AuraType.ProcTriggerSpell) { if (effect.EffectIndex == -1) continue; // custom effect var mask = procEntry.GetSpellFamilyMask(effect.EffectIndex); if (mask == null) continue; // copy AffectMask effect.AffectMask = mask.ToArray(); } } }