public void FindCraftingComponent(Mobile from) { Item item = CraftingComponent.GetRandomCraftingComponent(1); if (item != null) { if (from.AddToBackpack(item)) { from.SendMessage("You retrieve " + item.Name + " from the shipwreck and place it in your backpack."); } else { from.SendMessage("You retrieve " + item.Name + " from the shipwreck, and place it at your feet."); item.MoveToWorld(from.Location, from.Map); } } }
public void RetrievalAttempt(Mobile from, bool fishing) { if (m_CurrentItem >= m_MaxItems) { return; } PlayerMobile pm_From = from as PlayerMobile; if (pm_From == null) { return; } if (!from.InRange(Location, 2) && from.AccessLevel == AccessLevel.Player) { from.SendMessage("You are too far from the fountain to continue searching."); return; } pm_From.RevealingAction(); double baseChance = .10; if (fishing) { baseChance *= 1.25 + (.25 * (from.Skills.Fishing.Value / 120)); } if (Utility.RandomDouble() <= baseChance) { m_CurrentItem++; Item item = null; switch (m_CurrentItem) { case 1: Bag bag = new Bag(); for (int a = 0; a < 10; a++) { bag.DropItem(CraftingComponent.GetRandomCraftingComponent(1)); } item = bag; break; case 2: item = new MiniatureHouse(); break; case 3: switch (m_TreasurePileLevel) { case 1: item = new TreasurePileSmallAddonDeed(); break; case 2: item = new TreasurePileMediumAddonDeed(); break; case 3: item = new TreasurePileLargeAddonDeed(); break; case 4: item = new TreasurePileHugeAddonDeed(); break; } break; case 4: item = new MiniatureTree(); break; //case 5: item = DungeonArmor.CreateDungeonArmor(DungeonEnum.None, DungeonArmor.ArmorTierEnum.Tier1, DungeonArmor.ArmorLocation.Unspecified); break; case 6: item = new MiniatureFountain(); break; //case 7: item = new DungeonArmorUpgradeHammer(); break; break; } if (item != null) { if (pm_From.AddToBackpack(item)) { pm_From.SendMessage("You retrieve an item from the fountain!"); pm_From.PlaySound(0x025); return; } else { item.MoveToWorld(from.Location, from.Map); pm_From.PlaySound(0x025); pm_From.SendMessage("You retrieve an item from the fountain! Your pack, however, was full and the item has been placed at your feet."); return; } } int waterCount = Utility.RandomMinMax(1, 2); for (int a = 0; a < waterCount; a++) { TimedStatic water = new TimedStatic(Utility.RandomList(4650, 4651, 4653, 4654, 4655), 10); water.Name = "foul water"; water.Hue = 1107; Point3D waterLocation = new Point3D(Location.X + Utility.RandomMinMax(-1, 1), Location.Y + Utility.RandomMinMax(-1, 1), Location.Z); SpellHelper.AdjustField(ref waterLocation, Map, 12, false); water.MoveToWorld(waterLocation, Map); } } else { if (Utility.RandomDouble() <= .25) { PublicOverheadMessage(MessageType.Regular, 0, false, "something ancient stirs from within the fountain!"); int waterCount = Utility.RandomMinMax(3, 5); for (int a = 0; a < waterCount; a++) { TimedStatic water = new TimedStatic(Utility.RandomList(4650, 4651, 4653, 4654, 4655), 10); water.Name = "foul water"; water.Hue = 1107; Point3D waterLocation = new Point3D(Location.X + Utility.RandomMinMax(-2, 2), Location.Y + Utility.RandomMinMax(-2, 2), Location.Z); SpellHelper.AdjustField(ref waterLocation, Map, 12, false); water.MoveToWorld(waterLocation, Map); } int creatureCount = 0; double result = Utility.RandomDouble(); if (result < .10) { creatureCount = 1; for (int a = 0; a < creatureCount; a++) { new FountainOfEvil().MoveToWorld(from.Location, from.Map); } } else if (result < .15) { creatureCount = Utility.RandomMinMax(1, 2); for (int a = 0; a < creatureCount; a++) { new ElderWaterElemental().MoveToWorld(from.Location, from.Map); } } else if (result < .20) { creatureCount = Utility.RandomMinMax(1, 2); for (int a = 0; a < creatureCount; a++) { new ElderToxicElemental().MoveToWorld(from.Location, from.Map); } } else if (result < .25) { creatureCount = Utility.RandomMinMax(1, 2); for (int a = 0; a < creatureCount; a++) { new ElderPoisonElemental().MoveToWorld(from.Location, from.Map); } } else if (result < .50) { creatureCount = Utility.RandomMinMax(2, 4); for (int a = 0; a < creatureCount; a++) { WaterElemental waterElemental = new WaterElemental(); waterElemental.Hue = 1107; waterElemental.Name = "foul water"; waterElemental.MoveToWorld(from.Location, from.Map); } } else if (result < .75) { creatureCount = Utility.RandomMinMax(2, 4); for (int a = 0; a < creatureCount; a++) { new VoidSlime().MoveToWorld(from.Location, from.Map); } } else { creatureCount = Utility.RandomMinMax(3, 5); for (int a = 0; a < creatureCount; a++) { Puddle foulPuddle = new Puddle(); foulPuddle.Hue = 1107; foulPuddle.Name = "foul puddle"; foulPuddle.MoveToWorld(from.Location, from.Map); } } return; } else { pm_From.SendMessage("You search the fountain but are unable to locate anything of value."); return; } } }