public override void OnResponse(NetState sender, RelayInfo info) { Mobile from = sender.Mobile; if (info.ButtonID < 3000 && info.ButtonID != 0) { if (Book[from] != null && (Book[from].Parent == from || (from.Backpack != null && Book[from].Parent == from.Backpack))) { if (Book[from].HasSpell(info.ButtonID)) { Spell spell = SpellRegistry.NewSpell(info.ButtonID, from, null); try { spell.Cast(); } catch (Exception e) { Misc.ExceptionLogging.WriteLine(e); } } if (from is PlayerMobile) { from.SendGump(new QuickSpellLaunchGump((PlayerMobile)from, m_List)); } } else { from.SendMessage("L'objet doit rester dans votre sac en tout temps !"); } } else if (info.ButtonID >= 3000 && info.ButtonID != 0) { if (Book[from] != null && (Book[from].Parent == from || (from.Backpack != null && Book[from].Parent == from.Backpack))) { string name = "Nom inconnu"; SpellBookEntry entry = (SpellBookEntry)NewSpellbookGump.FindEntryBySpellID(info.ButtonID - 2000); if (entry != null && Book[from].HasSpell(entry.SpellID)) { name = entry.Nom; } from.SendMessage(name); if (from is PlayerMobile) { from.SendGump(new QuickSpellLaunchGump((PlayerMobile)from, m_List)); } } else { from.SendMessage("L'objet doit rester dans votre sac en tout temps !"); } } }
public static ArrayList GetSpellList(PlayerMobile from, NewSpellbook book) { ArrayList list = new ArrayList(); for (int i = 0; i < from.QuickSpells.Count; i++) { int val = (int)from.QuickSpells[i]; SpellBookEntry entry = NewSpellbookGump.FindEntryBySpellID(val); if (entry != null && book.HasSpell(entry.SpellID)) { list.Add(entry); } } return(list); }