private PowerScroll CreateRandomPowerScroll() { int level; double random = Utility.RandomDouble(); //if ( 0.05 >= random ) // level = 25; /*else*/ if (0.05 >= random) { level = 20; } else if (0.25 >= random) { level = 15; } else if (0.50 >= random) { level = 10; } else { level = 5; } return(PowerScroll.CreateRandom(level, level, Expansion)); }
public override void DoTransmute(Mobile from, Recipe r) { if (r == null || from == null) { return; } Recipes rid = (Recipes)r.RecipeID; switch (rid) { case Recipes.PowerScrollSkillChange: { // get the target value from one of the powerscrolls Item[] slist = this.FindItemsByType(typeof(PowerScroll), true); double value = 0; // make sure they are all of the same value foreach (Item s in slist) { if (value == 0) { value = ((PowerScroll)s).Value; } else { if (value != ((PowerScroll)s).Value) { from.SendMessage("All powerscrolls must be of the same level"); return; } } } PowerScroll newps = PowerScroll.CreateRandom((int)(value - 100), (int)(value - 100)); // consume ingredients this.ConsumeAll(); // add the new powerscroll this.DropItem(newps); break; } case Recipes.SmallBODChange: { // get the target value from one of the powerscrolls Item[] slist = this.FindItemsByType(typeof(SmallBOD), true); Type t = null; // make sure they are all of the same type foreach (Item s in slist) { if (t == null) { t = ((SmallBOD)s).GetType(); } else { if (t != ((SmallBOD)s).GetType()) { from.SendMessage("All BODs must be of the same type"); return; } } } SmallBOD newbod = null; if (t == typeof(SmallTailorBOD)) { newbod = new SmallTailorBOD(); } else if (t == typeof(SmallSmithBOD)) { newbod = new SmallSmithBOD(); } else { from.SendMessage("Cannot transmute those BODs"); return; } if (newbod == null) { return; } // consume ingredients this.ConsumeAll(); // add the new powerscroll this.DropItem(newbod); break; } case Recipes.LargeBODChange: { // get the target value from one of the powerscrolls Item[] slist = this.FindItemsByType(typeof(LargeBOD), true); Type t = null; // make sure they are all of the same type foreach (Item s in slist) { if (t == null) { t = ((LargeBOD)s).GetType(); } else { if (t != ((LargeBOD)s).GetType()) { from.SendMessage("All BODs must be of the same type"); return; } } } LargeBOD newbod = null; if (t == typeof(LargeTailorBOD)) { newbod = new LargeTailorBOD(); } else if (t == typeof(LargeSmithBOD)) { newbod = new LargeSmithBOD(); } else { from.SendMessage("Cannot transmute those BODs"); return; } if (newbod == null) { return; } // consume ingredients this.ConsumeAll(); // add the new powerscroll this.DropItem(newbod); break; } case Recipes.UpgradeAncientAugment: { // check what type of augment is being upgraded BaseSocketAugmentation augment = null; if (this.Items.Count > 0) { augment = this.Items[0] as BaseSocketAugmentation; } if (augment == null) { return; } // make sure they are all the same foreach (Item i in this.Items) { if (augment.GetType() != i.GetType()) { return; } } // take the ingredients this.ConsumeAll(); // and add the result if (augment is AncientDiamond) { this.DropItem(new LegendaryDiamond()); } else if (augment is AncientSapphire) { this.DropItem(new LegendarySapphire()); } else if (augment is AncientSkull) { this.DropItem(new LegendarySkull()); } else if (augment is AncientTourmaline) { this.DropItem(new LegendaryTourmaline()); } else if (augment is AncientWood) { this.DropItem(new LegendaryWood()); } else if (augment is AncientRuby) { this.DropItem(new LegendaryRuby()); } else if (augment is AncientEmerald) { this.DropItem(new LegendaryEmerald()); } else if (augment is AncientAmethyst) { this.DropItem(new LegendaryAmethyst()); } break; } case Recipes.UpgradeLegendaryAugment: { // check what type of augment is being upgraded BaseSocketAugmentation augment = null; if (this.Items.Count > 0) { augment = this.Items[0] as BaseSocketAugmentation; } if (augment == null) { return; } // make sure they are all the same foreach (Item i in this.Items) { if (augment.GetType() != i.GetType()) { return; } } // take the ingredients this.ConsumeAll(); // and add the result if (augment is LegendaryDiamond) { this.DropItem(new MythicDiamond()); } else if (augment is LegendarySapphire) { this.DropItem(new MythicSapphire()); } else if (augment is LegendarySkull) { this.DropItem(new MythicSkull()); } else if (augment is LegendaryTourmaline) { this.DropItem(new MythicTourmaline()); } else if (augment is LegendaryWood) { this.DropItem(new MythicWood()); } else if (augment is LegendaryRuby) { this.DropItem(new MythicRuby()); } else if (augment is LegendaryEmerald) { this.DropItem(new MythicEmerald()); } else if (augment is LegendaryAmethyst) { this.DropItem(new MythicAmethyst()); } break; } case Recipes.UpgradeCrystalAugment: { // check what type of augment is being upgraded BaseSocketAugmentation augment = null; if (this.Items.Count > 0) { augment = this.Items[0] as BaseSocketAugmentation; } if (augment == null) { return; } // make sure they are all the same foreach (Item i in this.Items) { if (augment.GetType() != i.GetType()) { return; } } // take the ingredients this.ConsumeAll(); // and add the result if (augment is RhoCrystal) { this.DropItem(new RadiantRhoCrystal()); } else if (augment is RysCrystal) { this.DropItem(new RadiantRysCrystal()); } else if (augment is WyrCrystal) { this.DropItem(new RadiantWyrCrystal()); } else if (augment is FreCrystal) { this.DropItem(new RadiantFreCrystal()); } else if (augment is TorCrystal) { this.DropItem(new RadiantTorCrystal()); } else if (augment is VelCrystal) { this.DropItem(new RadiantVelCrystal()); } else if (augment is XenCrystal) { this.DropItem(new RadiantXenCrystal()); } else if (augment is PolCrystal) { this.DropItem(new RadiantPolCrystal()); } else if (augment is WolCrystal) { this.DropItem(new RadiantWolCrystal()); } else if (augment is BalCrystal) { this.DropItem(new RadiantBalCrystal()); } else if (augment is TalCrystal) { this.DropItem(new RadiantTalCrystal()); } else if (augment is JalCrystal) { this.DropItem(new RadiantJalCrystal()); } else if (augment is RalCrystal) { this.DropItem(new RadiantRalCrystal()); } else if (augment is KalCrystal) { this.DropItem(new RadiantKalCrystal()); } break; } case Recipes.RecoverAugmentation: { // does item have any sockets on it? Item b = this.FindItemByType(typeof(BaseArmor), true); if (b == null) { b = this.FindItemByType(typeof(BaseWeapon), true); } if (b == null) { b = this.FindItemByType(typeof(BaseJewel), true); } XmlSockets a = XmlAttach.FindAttachment(b, typeof(XmlSockets)) as XmlSockets; if (a == null) { // if so then forget it from.SendMessage("This item is not socketed."); return; } if (a.NSockets == 0) { from.SendMessage("This item is has no sockets."); return; } BaseSocketAugmentation augment = a.RecoverRandomAugmentation(from, b); if (augment != null) { // consume the crystal this.ConsumeTotal(typeof(AncientRuby), 1, true); // put the recovered augment in the container this.DropItem(augment); from.SendMessage("Recovered a {0} augmentation.", augment.Name); // update the sockets gump a.OnIdentify(from); } else { from.SendMessage("Failed to recover augmentation."); } break; } case Recipes.HammerOfRecovery: { // consume ingredients this.ConsumeAll(); // add the hammer this.DropItem(new HammerOfRecovery(1)); break; } case Recipes.ExceptionalSocketHammer: { // consume ingredients this.ConsumeAll(); // add the hammer this.DropItem(new ExceptionalSocketHammer(1)); break; } case Recipes.SocketWeapon: { // does the weapon already have any sockets on it? Item b = this.FindItemByType(typeof(BaseWeapon), true); XmlAttachment a = XmlAttach.FindAttachment(b, typeof(XmlSockets)); if (a != null) { // if so then forget it from.SendMessage("Weapon already socketed."); return; } // otherwise add the socket XmlAttach.AttachTo(b, new XmlSockets(1)); // consume the crystal this.ConsumeTotal(typeof(RadiantRhoCrystal), 1, true); break; } case Recipes.SocketArmor: { // does the armor already have any sockets on it? Item b = this.FindItemByType(typeof(BaseArmor), true); XmlAttachment a = XmlAttach.FindAttachment(b, typeof(XmlSockets)); if (a != null) { // if so then forget it from.SendMessage("Armor already socketed."); return; } // otherwise add the socket XmlAttach.AttachTo(b, new XmlSockets(1)); // consume the crystal this.ConsumeTotal(typeof(RadiantRhoCrystal), 1, true); break; } // Uncomment the follow recipes if you have XmlMobFactions installed and you would like to allow faction gain through these recipes #if (XMLMOBFACTIONS) case Recipes.UndeadFaction: { // how much gold is being offered Item b = FindItemByType(typeof(Gold), true); int value = 0; if (b != null) { value = b.Amount / 10; } // take the ingredients ConsumeAll(); // add the faction XmlAttach.AttachTo(from, new XmlAddFaction("Undead", value)); break; } case Recipes.AbyssFaction: { // how much gold is being offered Item b = FindItemByType(typeof(Gold), true); int value = 0; if (b != null) { value = b.Amount / 10; } // take the ingredients ConsumeAll(); // add the faction XmlAttach.AttachTo(from, new XmlAddFaction("Abyss", value)); break; } case Recipes.HumanoidFaction: { // how much gold is being offered Item b = FindItemByType(typeof(Gold), true); int value = 0; if (b != null) { value = b.Amount / 10; } // take the ingredients ConsumeAll(); // add the faction XmlAttach.AttachTo(from, new XmlAddFaction("Humanoid", value)); break; } case Recipes.ReptilianFaction: { // how much gold is being offered Item b = FindItemByType(typeof(Gold), true); int value = 0; if (b != null) { value = b.Amount / 10; } // take the ingredients ConsumeAll(); // add the faction XmlAttach.AttachTo(from, new XmlAddFaction("Reptilian", value)); break; } case Recipes.ArachnidFaction: { // how much gold is being offered Item b = FindItemByType(typeof(Gold), true); int value = 0; if (b != null) { value = b.Amount / 10; } // take the ingredients ConsumeAll(); // add the faction XmlAttach.AttachTo(from, new XmlAddFaction("Arachnid", value)); break; } case Recipes.ElementalFaction: { // how much gold is being offered Item b = FindItemByType(typeof(Gold), true); int value = 0; if (b != null) { value = b.Amount / 10; } // take the ingredients ConsumeAll(); // add the faction XmlAttach.AttachTo(from, new XmlAddFaction("Elemental", value)); break; } case Recipes.UnderworldFaction: { // how much gold is being offered Item b = FindItemByType(typeof(Gold), true); int value = 0; if (b != null) { value = b.Amount / 10; } // take the ingredients ConsumeAll(); // add the faction XmlAttach.AttachTo(from, new XmlAddFaction("Underworld", value)); break; } // end of commented-out XmlMobFactions recipes #endif } // give effects for successful transmutation from.PlaySound(503); base.DoTransmute(from, r); }
public static void Fill(LockableContainer cont, int level) { cont.Movable = false; cont.Locked = true; if (level == 0) { cont.LockLevel = 0; // Can't be unlocked cont.DropItem(new Gold(Utility.RandomMinMax(200, 300))); if (Utility.RandomDouble() < 0.75) { cont.DropItem(new TreasureMap(0, Map.Felucca)); } } else { cont.TrapType = TrapType.ExplosionTrap; cont.TrapPower = level * 25; cont.TrapLevel = level; switch (level) { case 1: cont.RequiredSkill = 35; break; case 2: cont.RequiredSkill = 50; break; case 3: cont.RequiredSkill = 75; break; case 4: cont.RequiredSkill = 90; break; case 5: cont.RequiredSkill = 98; break; case 6: cont.RequiredSkill = 100; break; } cont.LockLevel = cont.RequiredSkill - 10; cont.MaxLockLevel = cont.RequiredSkill + 40; var gold = new Gold(level * 500); if (level == 6) { gold.Amount = 5000; } cont.DropItem(gold); int reagents = level == 0 ? 4 : 8; for (int i = 0; i < reagents; i++) { Item item = Loot.RandomPossibleReagent(); item.Amount = RegsPerLevel[level]; cont.DropItem(item); } for (int i = 0; i < level * 3; ++i) { cont.DropItem(Loot.RandomScroll(0, Math.Min(47, (level + 1) * 8 - 1), SpellbookType.Regular)); } int minimumMod = 1; int maximumMod = MaxModPerLevel[level]; //Luthius Expansion double craftingComponentLoops = 4; double prestigeScrollLoops = 3; double spellHueDeedLoops = 1; double craftingComponentChance = .02; double prestigeScrollChance = .1; double spellHueDeedChance = .005; switch (level) { case 1: craftingComponentChance = .10; prestigeScrollChance = .1; spellHueDeedChance = .005; break; case 2: craftingComponentChance = .15; prestigeScrollChance = .2; spellHueDeedChance = .01; break; case 3: craftingComponentChance = .20; prestigeScrollChance = .3; spellHueDeedChance = .015; break; case 4: craftingComponentChance = .25; prestigeScrollChance = .4; spellHueDeedChance = .02; break; case 5: craftingComponentChance = .30; prestigeScrollChance = .5; spellHueDeedChance = .025; break; case 6: craftingComponentChance = .40; prestigeScrollChance = .6; spellHueDeedChance = .03; break; } for (int a = 0; a < craftingComponentLoops; a++) { if (Utility.RandomDouble() <= craftingComponentChance) { cont.DropItem(CraftingComponent.GetRandomCraftingComponent(1)); } } for (int a = 0; a < prestigeScrollLoops; a++) { if (Utility.RandomDouble() <= prestigeScrollChance) { cont.DropItem(new PrestigeScroll()); } } for (int a = 0; a < spellHueDeedLoops; a++) { if (Utility.RandomDouble() <= spellHueDeedChance) { cont.DropItem(new SpellHueDeed()); } } for (int i = 0; i < ItemsPerLevel[level]; ++i) { if (Utility.RandomDouble() < 0.30) { BaseWeapon weapon = Loot.RandomWeapon(); weapon.DamageLevel = (WeaponDamageLevel)Utility.RandomMinMax(minimumMod, maximumMod); weapon.AccuracyLevel = (WeaponAccuracyLevel)Utility.RandomMinMax(minimumMod, maximumMod); weapon.DurabilityLevel = (WeaponDurabilityLevel)Utility.RandomMinMax(minimumMod, maximumMod); cont.DropItem(weapon); } else { BaseArmor armor = Loot.RandomArmorOrShield(); armor.ProtectionLevel = (ArmorProtectionLevel)Utility.RandomMinMax(minimumMod, maximumMod); armor.DurabilityLevel = (ArmorDurabilityLevel)Utility.RandomMinMax(minimumMod, maximumMod); cont.DropItem(armor); } } } for (int i = 0; i < level; i++) { Item item = Loot.RandomGem(); item.Amount = GemsPerLevel[level]; cont.DropItem(item); } // rares if (level == 6 && Utility.Random(50) == 0) { cont.DropItem(new SpecialHairDye()); } switch (level) { case 6: if (Utility.RandomDouble() < 0.09) { cont.DropItem(PowerScroll.CreateRandom(5, 10)); } break; case 5: if (Utility.RandomDouble() < 0.06) { cont.DropItem(new RareSandals()); } break; case 4: if (Utility.RandomDouble() < 0.03) { cont.DropItem(new BossCloth()); } break; default: if (Utility.RandomDouble() < RareChancePerLevel[level]) { int index = Utility.Random(LootPack.RareCraftingIngredients.Length); var rare = LootPack.RareCraftingIngredients[index].Construct(); cont.DropItem(rare); } break; } int chance = 610 - (100 * level); if (Utility.Random(chance) == 0) { cont.DropItem(new RareCloth()); } }