public override bool OnDragDrop(Mobile from, Item dropped) { if (dropped is SpellScroll) { SpellScroll spellScroll = dropped as SpellScroll; SpellScrollLibraryEntry entry = GetLibraryEntry(spellScroll.GetType()); if (entry != null) { entry.Count += spellScroll.Amount; if (spellScroll.Amount == 1) { from.SendMessage("You add a spell scroll to the library."); } else { from.SendMessage("You add a " + spellScroll.Amount.ToString() + " spell scrolls to the library."); } from.SendSound(addItemSound); spellScroll.Delete(); } return(true); } else { return(false); } }
public void AddAllScrollsInPack(Mobile from) { if (from == null) { return; } if (from.Backpack == null) { return; } List <SpellScroll> m_MasterScrolls = from.Backpack.FindItemsByType <SpellScroll>(); int totalCount = 0; Queue m_Queue = new Queue(); foreach (SpellScroll spellScroll in m_MasterScrolls) { if (spellScroll.MasterStatus != 1) { continue; } m_Queue.Enqueue(spellScroll); } while (m_Queue.Count > 0) { SpellScroll spellScroll = (SpellScroll)m_Queue.Dequeue(); MasterScrollLibraryEntry entry = GetEntryDetail(spellScroll.GetType()); if (entry == null) { continue; } entry.Charges += spellScroll.UsesRemaining; totalCount++; spellScroll.Delete(); } if (totalCount > 1) { from.SendMessage("You add " + totalCount.ToString() + " master scrolls to the library."); from.SendSound(addItemSound); } else if (totalCount == 1) { from.SendMessage("You add a master scroll to the library."); from.SendSound(addItemSound); } else { from.SendMessage("You do not have any master scrolls in your backpack."); } }
public void AddAllScrollsInPack(Mobile from) { if (from == null) { return; } if (from.Backpack == null) { return; } List <SpellScroll> m_SpellScrolls = from.Backpack.FindItemsByType <SpellScroll>(); int totalCount = 0; Queue m_Queue = new Queue(); foreach (SpellScroll spellScroll in m_SpellScrolls) { m_Queue.Enqueue(spellScroll); } while (m_Queue.Count > 0) { SpellScroll spellScroll = (SpellScroll)m_Queue.Dequeue(); SpellScrollLibraryEntry entry = GetLibraryEntry(spellScroll.GetType()); if (entry == null) { continue; } entry.Count += spellScroll.Amount; totalCount += spellScroll.Amount; spellScroll.Delete(); } if (totalCount > 1) { from.SendMessage("You add " + totalCount.ToString() + " spells scrolls to the library."); from.SendSound(addItemSound); } else if (totalCount == 1) { from.SendMessage("You add a spell scroll to the library."); from.SendSound(addItemSound); } else { from.SendMessage("You do not have any spell scrolls in your backpack."); } }