public override bool OnDragDrop(Mobile from, Item dropped) { if (dropped is TreasureMap) { TreasureMap treasureMap = dropped as TreasureMap; if (treasureMap.Completed) { from.SendMessage("Only uncompleted treasure maps may be stored within this library."); return(false); } TreasureMapLibraryEntry entry = GetLibraryEntry(treasureMap.Level, treasureMap.Decoded); if (entry != null) { if (treasureMap.Decoded) { treasureMap.Archived = true; m_DecodedMaps.Add(treasureMap); treasureMap.Internalize(); } else { treasureMap.Delete(); } entry.Count++; from.SendMessage("You add a treasure map to the library."); from.SendSound(addItemSound); } return(true); } else { return(false); } }
public void AddAllMapsInPack(Mobile from) { if (from == null) { return; } if (from.Backpack == null) { return; } List <TreasureMap> m_TreasureMaps = from.Backpack.FindItemsByType <TreasureMap>(); int totalCount = 0; Queue m_Queue = new Queue(); foreach (TreasureMap treasureMap in m_TreasureMaps) { if (treasureMap.Completed) { continue; } m_Queue.Enqueue(treasureMap); } while (m_Queue.Count > 0) { TreasureMap treasureMap = (TreasureMap)m_Queue.Dequeue(); TreasureMapLibraryEntry entry = GetLibraryEntry(treasureMap.Level, treasureMap.Decoded); if (entry == null) { continue; } entry.Count++; totalCount++; if (treasureMap.Decoded) { m_DecodedMaps.Add(treasureMap); treasureMap.Archived = true; treasureMap.Internalize(); } else { treasureMap.Delete(); } } if (totalCount > 1) { from.SendMessage("You add " + totalCount.ToString() + " treasure maps to the library."); from.SendSound(addItemSound); } else if (totalCount == 1) { from.SendMessage("You add a treasure map to the library."); from.SendSound(addItemSound); } else { from.SendMessage("You do not have any uncompleted treasure maps in your backpack."); } }