public bool Scissor(Mobile from, Scissors scissors) { if (!IsChildOf(from.Backpack)) { from.SendLocalizedMessage(502437); // Items you wish to cut must be in your backpack. return(false); } // CraftSystem system = DefTailoring.CraftSystem; CraftSystem system = new DefTailoring(); system.CustomSystem(from); CraftItem item = system.CraftItems.SearchFor(GetType()); if (item != null && item.Ressources.Count == 1 && item.Ressources.GetAt(0).Amount >= 2) { try { Type resourceType = null; if (this is BaseShoes) { CraftResourceInfo info = CraftResources.GetInfo(((BaseShoes)this).Resource); if (info != null && info.ResourceTypes.Length > 0) { resourceType = info.ResourceTypes[0]; } } if (resourceType == null) { resourceType = item.Ressources.GetAt(0).ItemType; } Item res = (Item)Activator.CreateInstance(resourceType); ScissorHelper(from, res, m_PlayerConstructed ? (item.Ressources.GetAt(0).Amount / 2) : 1); res.LootType = LootType.Regular; return(true); } catch { } } from.SendLocalizedMessage(502440); // Scissors can not be used on that to produce anything. return(false); }
public static void Initialize() { CraftSystem = new DefTailoring(); }
public static SmallTailorBOD CreateRandomFor(Mobile m) { SmallBulkEntry[] entries; bool useMaterials; if (useMaterials = Utility.RandomBool()) { entries = SmallBulkEntry.TailorLeather; } else { entries = SmallBulkEntry.TailorCloth; } if (entries.Length > 0) { double theirSkill = m.Skills[SkillName.Tailoring].Base; int amountMax; if (theirSkill >= 70.1) { amountMax = Utility.RandomList(10, 15, 20, 20); } else if (theirSkill >= 50.1) { amountMax = Utility.RandomList(10, 15, 15, 20); } else { amountMax = Utility.RandomList(10, 10, 15, 20); } BulkMaterialType material = BulkMaterialType.None; if (useMaterials && theirSkill >= 70.1) { for (int i = 0; i < 20; ++i) { BulkMaterialType check = GetRandomMaterial(BulkMaterialType.Spined, m_TailoringMaterialChances); double skillReq = 0.0; switch (check) { case BulkMaterialType.DullCopper: skillReq = 65.0; break; case BulkMaterialType.Bronze: skillReq = 80.0; break; case BulkMaterialType.Gold: skillReq = 85.0; break; case BulkMaterialType.Agapite: skillReq = 90.0; break; case BulkMaterialType.Verite: skillReq = 95.0; break; case BulkMaterialType.Valorite: skillReq = 100.0; break; case BulkMaterialType.Spined: skillReq = 65.0; break; case BulkMaterialType.Horned: skillReq = 80.0; break; case BulkMaterialType.Barbed: skillReq = 99.0; break; } if (theirSkill >= skillReq) { material = check; break; } } } double excChance = 0.0; if (theirSkill >= 70.1) { excChance = (theirSkill + 80.0) / 200.0; } bool reqExceptional = (excChance > Utility.RandomDouble()); SmallBulkEntry entry = null; // CraftSystem system = DefTailoring.CraftSystem; CraftSystem system = new DefTailoring(); system.CustomSystem(m); for (int i = 0; i < 150; ++i) { SmallBulkEntry check = entries[Utility.Random(entries.Length)]; CraftItem item = system.CraftItems.SearchFor(check.Type); if (item != null) { bool allRequiredSkills = true; double chance = item.GetSuccessChance(m, null, system, false, ref allRequiredSkills); if (allRequiredSkills && chance >= 0.0) { if (reqExceptional) { chance = item.GetExceptionalChance(system, chance, m); } if (chance > 0.0) { entry = check; break; } } } } if (entry != null) { return(new SmallTailorBOD(entry, material, amountMax, reqExceptional)); } } return(null); }