public static DungeonCore GetRandomDungeonCore(int amount) { DungeonCore item = null; int dungeonIndex = Utility.RandomMinMax(1, 9); switch (dungeonIndex) { case 1: item = new CovetousDungeonCore(amount); break; case 2: item = new DespiseDungeonCore(amount); break; case 3: item = new DestardDungeonCore(amount); break; case 4: item = new DeceitDungeonCore(amount); break; case 5: item = new FireDungeonCore(amount); break; case 6: item = new HythlothDungeonCore(amount); break; case 7: item = new IceDungeonCore(amount); break; case 8: item = new ShameDungeonCore(amount); break; case 9: item = new WrongDungeonCore(amount); break; } return(item); }
public void AddAllDungeonCoresInPack(Mobile from) { if (from == null) { return; } if (from.Backpack == null) { return; } List <DungeonCore> m_DungeonCores = from.Backpack.FindItemsByType <DungeonCore>(); int totalCount = 0; Queue m_Queue = new Queue(); foreach (DungeonCore dungeonCore in m_DungeonCores) { m_Queue.Enqueue(dungeonCore); } while (m_Queue.Count > 0) { DungeonCore dungeonCore = (DungeonCore)m_Queue.Dequeue(); DungeonCoreLibraryEntry entry = GetEntryDetail(dungeonCore.Dungeon); if (entry == null) { continue; } entry.Count++; totalCount++; dungeonCore.Delete(); } if (totalCount > 1) { from.SendMessage("You add " + totalCount.ToString() + " dungeon cores to the library."); from.SendSound(addItemSound); } else if (totalCount == 1) { from.SendMessage("You add a dungeon core to the library."); from.SendSound(addItemSound); } else { from.SendMessage("You do not have any dungeon cores in your backpack."); } }
public static void ConsumeMaterials(Mobile from, Mobile mobileTarget, DungeonMould dungeonMould, bool newWeapon, DungeonEnum dungeon) { if (from == null || mobileTarget == null) { return; } List <DungeonCore> m_DungeonCores = mobileTarget.Backpack.FindItemsByType <DungeonCore>(); List <DungeonDistillation> m_DungeonDistillations = mobileTarget.Backpack.FindItemsByType <DungeonDistillation>(); List <DungeonCore> m_MatchingDungeonCores = new List <DungeonCore>(); List <DungeonDistillation> m_MatchingDungeonDistillations = new List <DungeonDistillation>(); int coresNeeded = DungeonWeapon.CoresNeededForUpgrade; int distillationsNeeded = DungeonWeapon.DistillationNeededForUpgrade; if (newWeapon) { coresNeeded = DungeonWeapon.CoresNeededForCreation; distillationsNeeded = DungeonWeapon.DistillationNeededForCreation; } Queue m_Queue = new Queue(); foreach (DungeonCore dungeonCore in m_DungeonCores) { if (dungeonCore.Dungeon == dungeon) { if (dungeonCore.Amount > coresNeeded) { dungeonCore.Amount -= coresNeeded; coresNeeded = 0; } else { //Queue for Deletion coresNeeded -= dungeonCore.Amount; m_Queue.Enqueue(dungeonCore); } } if (coresNeeded <= 0) { break; } } while (m_Queue.Count > 0) { DungeonCore dungeonCore = (DungeonCore)m_Queue.Dequeue(); dungeonCore.Delete(); } m_Queue = new Queue(); foreach (DungeonDistillation dungeonDistillation in m_DungeonDistillations) { if (dungeonDistillation.Dungeon == dungeon) { m_Queue.Enqueue(dungeonDistillation); distillationsNeeded--; } if (distillationsNeeded <= 0) { break; } } while (m_Queue.Count > 0) { DungeonDistillation dungeonDistillation = (DungeonDistillation)m_Queue.Dequeue(); dungeonDistillation.Delete(); } if (dungeonMould != null) { dungeonMould.Delete(); } }
public void EjectDungeonCore(Mobile from, DungeonEnum dungeon, bool removeAll) { if (from == null || dungeon == null) { return; } DungeonCoreLibraryEntry entry = GetEntryDetail(dungeon); if (entry == null) { return; } if (entry.Count == 0) { from.SendMessage("You do not have any of that dungeon core currently stored within this library."); return; } if (from.Backpack == null) { return; } if (from.Backpack.TotalItems == from.Backpack.MaxItems) { from.SendMessage("Your backpack is at capacity. Please remove some items and try again."); return; } if (removeAll) { int itemCount = 0; for (int a = 0; a < 1000; a++) { if (entry.Count == 0) { break; } if (from.Backpack.TotalItems == from.Backpack.MaxItems) { break; } DungeonCore dungeonCore = (DungeonCore)Activator.CreateInstance(typeof(DungeonCore)); dungeonCore.Dungeon = dungeon; if (dungeonCore != null) { entry.Count--; from.Backpack.DropItem(dungeonCore); itemCount++; } } if (itemCount > 1) { from.SendMessage("You retrieve " + itemCount.ToString() + " dungeon cores from the library."); from.SendSound(addItemSound); } else if (itemCount == 1) { from.SendMessage("You retrieve a dungeon core from the library."); from.SendSound(addItemSound); } else { from.SendMessage("You do not have any dungeon cores of that in the library."); } } else { DungeonCore dungeonCore = (DungeonCore)Activator.CreateInstance(typeof(DungeonCore)); dungeonCore.Dungeon = dungeon; if (dungeonCore != null) { entry.Count--; from.Backpack.DropItem(dungeonCore); from.SendMessage("You retrieve a dungeon core from the library."); from.SendSound(addItemSound); } } }