private SmeltResult Resmelt(Mobile from, Item item, CraftResource resource) { try { if (Ethic.IsImbued(item)) { return(SmeltResult.Invalid); } if (CraftResources.GetType(resource) != CraftResourceType.Metal) { return(SmeltResult.Invalid); } CraftResourceInfo info = CraftResources.GetInfo(resource); if (info == null || info.ResourceTypes.Length == 0) { return(SmeltResult.Invalid); } CraftItem craftItem = m_CraftSystem.CraftItems.SearchFor(item.GetType()); if (craftItem == null || craftItem.Resources.Count == 0) { return(SmeltResult.Invalid); } CraftRes craftResource = craftItem.Resources.GetAt(0); if (craftResource.Amount < 2) { return(SmeltResult.Invalid); // Not enough metal to resmelt } var difficulty = resource switch { CraftResource.DullCopper => 65.0, CraftResource.ShadowIron => 70.0, CraftResource.Copper => 75.0, CraftResource.Bronze => 80.0, CraftResource.Gold => 85.0, CraftResource.Agapite => 90.0, CraftResource.Verite => 95.0, CraftResource.Valorite => 99.0, _ => 0.0 }; if (difficulty > from.Skills.Mining.Value) { return(SmeltResult.NoSkill); } Type resourceType = info.ResourceTypes[0]; Item ingot = (Item)ActivatorUtil.CreateInstance(resourceType); if (item is DragonBardingDeed || item is BaseArmor armor && armor.PlayerConstructed || item is BaseWeapon weapon && weapon.PlayerConstructed || item is BaseClothing clothing && clothing.PlayerConstructed) { ingot.Amount = craftResource.Amount / 2; } else { ingot.Amount = 1; } item.Delete(); from.AddToBackpack(ingot); from.PlaySound(0x2A); from.PlaySound(0x240); return(SmeltResult.Success); }
public virtual 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); } if (Ethic.IsImbued(this)) { from.SendLocalizedMessage(502440); // Scissors can not be used on that to produce anything. return(false); } CraftSystem system = DefTailoring.CraftSystem; CraftItem item = system.CraftItems.SearchFor(GetType()); if (item != null && item.Resources.Count == 1 && item.Resources.GetAt(0).Amount >= 2) { try { Type resourceType = null; CraftResourceInfo info = CraftResources.GetInfo(m_Resource); if (info != null && info.ResourceTypes.Length > 0) { resourceType = info.ResourceTypes[0]; } if (resourceType == null) { resourceType = item.Resources.GetAt(0).ItemType; } // Debug code //from.SendMessage("item: {0}", Layer); Item res = null; if (Layer == Layer.Shoes) { res = new Leather(); } else { res = new Bandage(); } ScissorHelper(from, res, (item.Resources.GetAt(0).Amount / 2)); res.LootType = LootType.Regular; return(true); } catch { } } from.SendLocalizedMessage(502440); // Scissors can not be used on that to produce anything. return(false); }