public override bool OnDragDrop(Mobile from, Item dropped) { if (dropped is SkillMasteryScroll) { SkillMasteryScroll skillMasteryScroll = dropped as SkillMasteryScroll; SkillMasteryScrollLibraryEntry entry = GetLibraryEntry(skillMasteryScroll.Skill); if (entry != null) { skillMasteryScroll.Delete(); entry.Count++; from.SendMessage("You add a skill mastery scroll to the library."); from.SendSound(addItemSound); } return(true); } else { return(false); } }
public void AddAllScrollsInPack(Mobile from) { if (from == null) { return; } if (from.Backpack == null) { return; } List <SkillMasteryScroll> m_SkillMasteryScrolls = from.Backpack.FindItemsByType <SkillMasteryScroll>(); int totalCount = 0; Queue m_Queue = new Queue(); foreach (SkillMasteryScroll skillMasteryScroll in m_SkillMasteryScrolls) { m_Queue.Enqueue(skillMasteryScroll); } while (m_Queue.Count > 0) { SkillMasteryScroll skillMasteryScroll = (SkillMasteryScroll)m_Queue.Dequeue(); if (skillMasteryScroll == null) { continue; } if (skillMasteryScroll.Deleted) { continue; } SkillMasteryScrollLibraryEntry entry = GetLibraryEntry(skillMasteryScroll.Skill); if (entry == null) { continue; } entry.Count++; totalCount++; skillMasteryScroll.Delete(); } if (totalCount > 1) { from.SendMessage("You add " + totalCount.ToString() + " skill mastery scrolls to the library."); from.SendSound(addItemSound); } else if (totalCount == 1) { from.SendMessage("You add a skill mastery scroll to the library."); from.SendSound(addItemSound); } else { from.SendMessage("You do not have any skill mastery scrolls in your backpack."); } }