/// <summary>Sends updates to the client for spell-modifier</summary> public static void SendModifierUpdate(Character chr, SpellEffect effect, bool isPercent) { SpellModifierType miscValue = (SpellModifierType)effect.MiscValue; List <AddModifierEffectHandler> modifierEffectHandlerList = isPercent ? chr.PlayerAuras.SpellModifiersPct : chr.PlayerAuras.SpellModifiersFlat; foreach (uint affectMaskBit in effect.AffectMaskBitSet) { int amount = 0; uint num1 = affectMaskBit >> 5; uint num2 = affectMaskBit - (num1 << 5); for (int index = 0; index < modifierEffectHandlerList.Count; ++index) { AddModifierEffectHandler modifierEffectHandler = modifierEffectHandlerList[index]; if ((SpellModifierType)modifierEffectHandler.SpellEffect.MiscValue == miscValue && modifierEffectHandler.SpellEffect.Spell.SpellClassSet == effect.Spell.SpellClassSet && (modifierEffectHandler.SpellEffect.AffectMask[num1] & 1 << (int)num2) != 0L) { amount += modifierEffectHandler.SpellEffect.ValueMin; } } SpellHandler.SendSpellModifier(chr, (byte)affectMaskBit, miscValue, amount, isPercent); } }
private void OnModifierChange(AddModifierEffectHandler modifier) { foreach (Aura aura in Owner.Auras) { if (aura.IsActivated && !aura.Spell.IsEnhancer && modifier.SpellEffect.MatchesSpell(aura.Spell)) { aura.ReApplyNonPeriodicEffects(); } } }
public void RemoveSpellModifierFlat(AddModifierEffectHandler modifier) { if (modifier.Charges > 0) { --ModifierWithChargesCount; } OnModifierChange(modifier); AuraHandler.SendModifierUpdate((Character)m_owner, modifier.SpellEffect, false); SpellModifiersFlat.Remove(modifier); }
public void AddSpellModifierFlat(AddModifierEffectHandler modifier) { if (modifier.Charges > 0) { ++ModifierWithChargesCount; } SpellModifiersFlat.Add(modifier); OnModifierChange(modifier); AuraHandler.SendModifierUpdate((Character)m_owner, modifier.SpellEffect, false); }
public void RemoveSpellModifierPercent(AddModifierEffectHandler modifier) { if (modifier.Charges > 0) { ModifierWithChargesCount--; } OnModifierChange(modifier); AuraHandler.SendModifierUpdate((Character)m_owner, modifier.SpellEffect, true); SpellModifiersPct.Remove(modifier); }
public void AddSpellModifierPercent(AddModifierEffectHandler modifier) { if (modifier.Charges > 0) { ++this.ModifierWithChargesCount; } this.SpellModifiersPct.Add(modifier); this.OnModifierChange(modifier); AuraHandler.SendModifierUpdate((Character)this.m_owner, modifier.SpellEffect, true); }
private void OnModifierChange(AddModifierEffectHandler modifier) { foreach (var aura in Owner.Auras) { if (aura.IsActivated && !aura.Spell.IsEnhancer && modifier.SpellEffect.MatchesSpell(aura.Spell)) { // activated, passive Aura, affected by this modifier -> Needs to re-apply aura.ReApplyNonPeriodicEffects(); } } }
/// <summary> /// Returns the flat modifier (through certain talents) of the given type for the given spell /// </summary> public int GetModifierFlat(SpellModifierType type, Spell spell) { int num = 0; for (int index = 0; index < SpellModifiersFlat.Count; ++index) { AddModifierEffectHandler modifierEffectHandler = SpellModifiersFlat[index]; if ((SpellModifierType)modifierEffectHandler.SpellEffect.MiscValue == type && modifierEffectHandler.SpellEffect.MatchesSpell(spell)) { num += modifierEffectHandler.SpellEffect.ValueMin; } } return(num); }