public static bool TryConsumeSfMaterials(Mobile from) { Container pack = from.Backpack; var toDelete = new List <Item>(); var dragonboneshards = new List <DragonBoneShards>(); var dragonhearts = new List <DragonHeart>(); DevourerSoul devourersoul = null; HarrowerSoul harrowersoul = null; HeartofRikktor rikktorheart = null; foreach (Item item in pack.Items) { if (rikktorheart == null && item is HeartofRikktor) { rikktorheart = item as HeartofRikktor; toDelete.Add(item); } else if (devourersoul == null && item is DevourerSoul) { devourersoul = item as DevourerSoul; toDelete.Add(item); } else if (harrowersoul == null && item is HarrowerSoul) { harrowersoul = item as HarrowerSoul; toDelete.Add(item); } else if (dragonboneshards.Count < 20 && item is DragonBoneShards) { dragonboneshards.Add(item as DragonBoneShards); toDelete.Add(item); } else if (dragonhearts.Count < 2 && item is DragonHeart) { dragonhearts.Add(item as DragonHeart); toDelete.Add(item); } } if (rikktorheart != null && devourersoul != null && harrowersoul != null && dragonboneshards.Count == 20 && dragonhearts.Count == 2) { foreach (Item item in toDelete) { item.Delete(); } return(true); } return(false); }
public override void GiveSpecialItems(List <Mobile> eligibleMobs, List <double> eligibleMobScores, double totalScores) { double currentTestValue = 0.0; double roll = Utility.RandomDouble() * totalScores; for (int i = 0; i < eligibleMobScores.Count; i++) { currentTestValue += eligibleMobScores[i]; if (roll > currentTestValue) { continue; } HeartofRikktor heart = new HeartofRikktor(); if (eligibleMobs[i] is PlayerMobile && eligibleMobs[i].Backpack != null) { eligibleMobs[i].Backpack.DropItem(heart); eligibleMobs[i].SendMessage(54, "You have received the smouldering heart of Rikktor!"); break; } } currentTestValue = 0.0; roll = Utility.RandomDouble() * totalScores; if (0.2 > Utility.RandomDouble()) { for (int i = 0; i < eligibleMobScores.Count; i++) { currentTestValue += eligibleMobScores[i]; if (roll > currentTestValue) { continue; } Random rand = new Random(); int value = rand.Next(0, 3); Item item = null; switch (value) { case 0: { item = new RikktorsHead(); } break; case 1: { item = new RocksAnimatedArtifact(); } break; case 2: { item = new StoneFaceTrapNoDamageArtifact(); } break; } if (eligibleMobs[i] is PlayerMobile && eligibleMobs[i].Backpack != null && item != null) { eligibleMobs[i].Backpack.DropItem(item); eligibleMobs[i].SendMessage(54, "You have received " + item.Name + "."); break; } } } if (0.2 > Utility.RandomDouble()) { for (int i = 0; i < eligibleMobScores.Count; i++) { currentTestValue += eligibleMobScores[i]; if (roll > currentTestValue) { continue; } if (eligibleMobs[i] is PlayerMobile && eligibleMobs[i].Backpack != null) { eligibleMobs[i].Backpack.DropItem(new TitleScroll("The Dragoon")); eligibleMobs[i].SendMessage(54, "You have received a title scroll."); return; } } } }