public static GetType ( CraftResource resource ) : CraftResourceType | ||
resource | CraftResource | |
리턴 | CraftResourceType |
private bool Resmelt(Mobile from, Item item, CraftResource resource) { try { if (CraftResources.GetType(resource) != CraftResourceType.Metal) { return(false); } CraftResourceInfo info = CraftResources.GetInfo(resource); if (info == null || info.ResourceTypes.Length == 0) { return(false); } CraftItem craftItem = DefBlacksmithy.CraftSystem.CraftItems.SearchFor(item.GetType()); if (craftItem == null || craftItem.Resources.Count == 0) { return(false); } CraftRes craftResource = craftItem.Resources.GetAt(0); if (craftResource.Amount < 2) { return(false); // 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 }; Type resourceType = info.ResourceTypes[0]; Item ingot = (Item)Activator.CreateInstance(resourceType); if (item is DragonBardingDeed || item is BaseArmor armor && armor.PlayerConstructed || item is BaseWeapon weapon && weapon.PlayerConstructed || item is BaseClothing clothing && clothing.PlayerConstructed) { double mining = from.Skills.Mining.Value; if (mining > 100.0) { mining = 100.0; } double amount = ((4 + mining) * craftResource.Amount - 4) * 0.0068; if (amount < 2) { ingot.Amount = 2; } else { ingot.Amount = (int)amount; } } else { ingot.Amount = 2; } if (difficulty > from.Skills.Mining.Value) { m_Failure = true; ingot.Delete(); } else { item.Delete(); } from.AddToBackpack(ingot); from.PlaySound(0x2A); from.PlaySound(0x240); return(true); }
private bool Resmelt(Mobile from, Item item, CraftResource resource) { try { if (CraftResources.GetType(resource) != CraftResourceType.Metal) { return(false); } CraftResourceInfo info = CraftResources.GetInfo(resource); if (info == null || info.ResourceTypes.Length == 0) { return(false); } CraftItem craftItem = DefBlacksmithy.CraftSystem.CraftItems.SearchFor(item.GetType()); if (craftItem == null || craftItem.Resources.Count == 0) { return(false); } CraftRes craftResource = craftItem.Resources.GetAt(0); if (craftResource.Amount < 2) { return(false); // Not enough metal to resmelt } double difficulty = 0.0; switch (resource) { case CraftResource.DullCopper: difficulty = 65.0; break; case CraftResource.ShadowIron: difficulty = 70.0; break; case CraftResource.Copper: difficulty = 75.0; break; case CraftResource.Bronze: difficulty = 80.0; break; case CraftResource.Gold: difficulty = 85.0; break; case CraftResource.Agapite: difficulty = 90.0; break; case CraftResource.Verite: difficulty = 95.0; break; case CraftResource.Valorite: difficulty = 99.0; break; } Type resourceType = info.ResourceTypes[0]; Item ingot = (Item)Activator.CreateInstance(resourceType); if (item is DragonBardingDeed || (item is BaseArmor && ((BaseArmor)item).PlayerConstructed) || (item is BaseWeapon && ((BaseWeapon)item).PlayerConstructed) || (item is BaseClothing && ((BaseClothing)item).PlayerConstructed)) { double mining = from.Skills[SkillName.Mining].Value; if (mining > 100.0) { mining = 100.0; } double amount = (((4 + mining) * craftResource.Amount - 4) * 0.0068); if (amount < 2) { ingot.Amount = 2; } else { ingot.Amount = (int)amount; } } else { ingot.Amount = 2; } if (difficulty > from.Skills[SkillName.Mining].Value) { this.m_Failure = true; ingot.Delete(); } else { item.Delete(); } from.AddToBackpack(ingot); from.PlaySound(0x2A); from.PlaySound(0x240); return(true); } catch (Exception ex) { Console.WriteLine(ex.ToString()); } return(false); }
protected override void OnTarget(Mobile from, object targeted) { if (m_Item.Deleted) { return; } Item item = targeted as Item; if (null != item) { bool valid = (item is IDyable || item is BaseBook || item is BaseClothing || item is BaseJewel || item is BaseStatuette || item is BaseWeapon || item is Runebook || item is Spellbook); if (!valid && item is BaseArmor) { CraftResourceType restype = CraftResources.GetType(((BaseArmor)item).Resource); if ((CraftResourceType.Leather == restype || CraftResourceType.Metal == restype) && ArmorMaterialType.Bone != ((BaseArmor)item).MaterialType) { valid = true; } } if (!valid && FurnitureAttribute.Check(item)) { if (!from.InRange(m_Item.GetWorldLocation(), 1) || !from.InRange(item.GetWorldLocation(), 1)) { from.SendLocalizedMessage(500446); // That is too far away. return; } else { BaseHouse house = BaseHouse.FindHouseAt(item); if (house == null || (!house.IsLockedDown(item) && !house.IsSecure(item))) { from.SendLocalizedMessage(501022); // Furniture must be locked down to paint it. return; } else if (!house.IsCoOwner(from)) { from.SendLocalizedMessage(501023); // You must be the owner to use this item. return; } else { valid = true; } } } // need to add any bags, chests, boxes, crates not IDyable but dyable by natural dyes if (valid) { item.Hue = PlantPigmentHueInfo.GetInfo(m_Item.PigmentHue).Hue; from.PlaySound(0x23E); if (--m_Item.UsesRemaining > 0) { m_Item.InvalidateProperties(); } else { m_Item.Delete(); } return; } } from.SendLocalizedMessage(1042083); // You cannot dye that. }
private bool Resmelt(Mobile from, Item item, CraftResource resource) { try { if (CraftResources.GetType(resource) != CraftResourceType.Metal) { return(false); } CraftResourceInfo info = CraftResources.GetInfo(resource); if (info == null || info.ResourceTypes.Length == 0) { return(false); } CraftItem craftItem = DefBlacksmithy.CraftSystem.CraftItems.SearchFor(item.GetType()); if (craftItem == null || craftItem.Resources.Count == 0) { return(false); } CraftRes craftResource = craftItem.Resources.GetAt(0); if (craftResource.Amount < 2) { return(false); // Not enough metal to resmelt } double difficulty = 0.0; switch (resource) { case CraftResource.MRusty: difficulty = 50.0; break; case CraftResource.MOldcopper: difficulty = 60.0; break; case CraftResource.MDullcopper: difficulty = 65.0; break; case CraftResource.MShadow: difficulty = 70.0; break; case CraftResource.MCopper: difficulty = 75.0; break; case CraftResource.MBronze: difficulty = 80.0; break; case CraftResource.MGold: difficulty = 85.0; break; case CraftResource.MRose: difficulty = 87.0; break; case CraftResource.MAgapite: difficulty = 90.0; break; case CraftResource.MValorite: difficulty = 90.0; break; case CraftResource.MBloodrock: difficulty = 93.0; break; case CraftResource.MVerite: difficulty = 95.0; break; case CraftResource.MSilver: difficulty = 95.0; break; case CraftResource.MDragon: difficulty = 95.0; break; case CraftResource.MTitan: difficulty = 95.0; break; case CraftResource.MCrystaline: difficulty = 95.0; break; case CraftResource.MKrynite: difficulty = 95.0; break; case CraftResource.MVulcan: difficulty = 95.0; break; case CraftResource.MBloodcrest: difficulty = 95.0; break; case CraftResource.MElvin: difficulty = 95.0; break; case CraftResource.MAcid: difficulty = 95.0; break; case CraftResource.MAqua: difficulty = 95.0; break; case CraftResource.MEldar: difficulty = 95.0; break; case CraftResource.MGlowing: difficulty = 95.0; break; case CraftResource.MGorgan: difficulty = 95.0; break; case CraftResource.MSteel: difficulty = 95.5; break; case CraftResource.MSandrock: difficulty = 95.0; break; case CraftResource.MMytheril: difficulty = 97.5; break; case CraftResource.MBlackrock: difficulty = 98.0; break; } Type resourceType = info.ResourceTypes[0]; Item ingot = (Item)Activator.CreateInstance(resourceType); if (item is DragonBardingDeed || (item is BaseArmor && ((BaseArmor)item).PlayerConstructed) || (item is BaseWeapon && ((BaseWeapon)item).PlayerConstructed) || (item is BaseClothing && ((BaseClothing)item).PlayerConstructed)) { double mining = from.Skills[SkillName.Mining].Value; if (mining > 100.0) { mining = 100.0; } double amount = (((4 + mining) * craftResource.Amount - 4) * 0.0068); if (amount < 2) { ingot.Amount = 2; } else { ingot.Amount = (int)amount; } } else { ingot.Amount = 2; } if (difficulty > from.Skills[SkillName.Mining].Value) { m_Failure = true; ingot.Delete(); } else { item.Delete(); } from.AddToBackpack(ingot); from.PlaySound(0x2A); from.PlaySound(0x240); return(true); } catch (Exception ex) { Console.WriteLine(ex.ToString()); } return(false); }
protected override void OnTarget(Mobile from, object targeted) { if (this.m_Item.Deleted) { return; } Item item = targeted as Item; bool valid = false; if (item != null) { if (m_Item.BooksOnly && !(item is Spellbook)) { valid = false; } else { valid = (item is IDyable || item is BaseBook || item is BaseClothing || item is BaseJewel || item is BaseStatuette || item is BaseWeapon || item is Runebook || item is BaseTalisman || item is Spellbook || item.IsArtifact || BasePigmentsOfTokuno.IsValidItem(item)); if (!valid && item is BaseArmor) { CraftResourceType restype = CraftResources.GetType(((BaseArmor)item).Resource); if ((CraftResourceType.Leather == restype || CraftResourceType.Metal == restype) && ArmorMaterialType.Bone != ((BaseArmor)item).MaterialType) { valid = true; } } if (!valid && FurnitureAttribute.Check(item)) { if (!from.InRange(this.m_Item.GetWorldLocation(), 1) || !from.InRange(item.GetWorldLocation(), 1)) { from.SendLocalizedMessage(500446); // That is too far away. return; } else { BaseHouse house = BaseHouse.FindHouseAt(item); if (house == null || (!house.IsLockedDown(item) && !house.IsSecure(item))) { from.SendLocalizedMessage(501022); // Furniture must be locked down to paint it. return; } else if (!house.IsCoOwner(from)) { from.SendLocalizedMessage(501023); // You must be the owner to use this item. return; } else { valid = true; } } } } if (valid) { item.Hue = m_Item.Hue; from.PlaySound(0x23E); if (--this.m_Item.UsesRemaining > 0) { this.m_Item.InvalidateProperties(); } else { this.m_Item.Delete(); } return; } } from.SendLocalizedMessage(1042083); // You cannot dye that. }