private static void Targeted_Spell(TargetedSpellEventArgs e) { try { Mobile from = e.Mobile; if (!DesignContext.Check(from)) { return; // They are customizing } Spellbook book = null; int spellID = e.SpellID; if (book == null || !book.HasSpell(spellID)) { book = Find(from, spellID); } if (book != null && book.HasSpell(spellID)) { SpecialMove move = SpellRegistry.GetSpecialMove(spellID); if (move != null) { SpecialMove.SetCurrentMove(from, move); } else { Mobile to = World.FindMobile(e.Target.Serial); Item toI = World.FindItem(e.Target.Serial); Spell spell = SpellRegistry.NewSpell(spellID, from, null); if (to != null) { spell.InstantTarget = to; } else if (toI != null) { spell.InstantTarget = toI as IDamageableItem; } if (spell != null) { spell.Cast(); } else if (!Server.Spells.SkillMasteries.MasteryInfo.IsPassiveMastery(spellID)) { from.SendLocalizedMessage(502345); // This spell has been temporarily disabled. } } } else { from.SendLocalizedMessage(500015); // You do not have that spell! } } catch { } }
private static void Targeted_Spell(TargetedSpellEventArgs e) { try { Mobile from = e.Mobile; if (!DesignContext.Check(from)) { return; // They are customizing } int spellID = e.SpellID; Spellbook book = Find(from, spellID); if (book != null && book.HasSpell(spellID)) { SpecialMove move = SpellRegistry.GetSpecialMove(spellID); if (move != null) { SpecialMove.SetCurrentMove(from, move); } else if (e.Target != null) { Mobile to = World.FindMobile(e.Target.Serial); Item toI = World.FindItem(e.Target.Serial); Spell spell = SpellRegistry.NewSpell(spellID, from, null); if (spell != null && !Spells.SkillMasteries.MasteryInfo.IsPassiveMastery(spellID)) { if (to != null) { spell.InstantTarget = to; } else if (toI != null) { spell.InstantTarget = toI as IDamageableItem; } spell.Cast(); } } } else { from.SendLocalizedMessage(500015); // You do not have that spell! } } catch (Exception ex) { Diagnostics.ExceptionLogging.LogException(ex); } }
private static void Targeted_Spell(TargetedSpellEventArgs e) { Mobile from = e.NetState.Mobile; if (!Multis.DesignContext.Check(from)) { return; // They are customizing } int spellID = e.SpellID; SpecialMove move = SpellRegistry.GetSpecialMove(spellID); if (move != null) { SpecialMove.SetCurrentMove(from, move); } else { Spell spell = SpellRegistry.NewSpell(spellID, from, null); if (spell != null) { try { from.TargetLocked = true; Mobile targeted = World.FindMobile(e.Target.Serial); spell.DefineTargetForeignSpell(targeted); spell.Cast(); } catch { Console.WriteLine("Erro target Spell."); } finally { from.TargetLocked = false; } } else { from.SendLocalizedMessage(502345); // This spell has been temporarily disabled. } } }
public static void TargetedSpell(NetState ns, PacketReader pvSrc) { short spellId = (short)(pvSrc.ReadInt16() - 1); // zero based Serial target = pvSrc.ReadInt32(); TargetedSpellEventArgs e = new TargetedSpellEventArgs(ns, World.FindEntity(target), spellId); EventSink.InvokeTargetedSpellCast(e); }