public static GetInfo ( CraftResource resource ) : |
||
resource | CraftResource | |
return |
public virtual int GetLuckBonus() { if (m_Resource == CraftResource.Heartwood) { return(0); } CraftResourceInfo resInfo = CraftResources.GetInfo(m_Resource); if (resInfo == null) { return(0); } CraftAttributeInfo attrInfo = resInfo.AttributeInfo; if (attrInfo == null) { return(0); } return(attrInfo.WeaponLuck); }
public virtual void OnResourceChanged() { Hue = 0x8000 | CraftResources.GetHue(_Resource); CraftResourceInfo resInfo = CraftResources.GetInfo(_Resource); if (resInfo == null) { return; } CraftAttributeInfo attrs = resInfo.AttributeInfo; if (attrs == null) { return; } SetResistance(ResistanceType.Physical, Utility.RandomMinMax(45, 50) + attrs.ArmorPhysicalResist); SetResistance(ResistanceType.Fire, Utility.RandomMinMax(45, 50) + attrs.ArmorFireResist); SetResistance(ResistanceType.Cold, Utility.RandomMinMax(45, 50) + attrs.ArmorColdResist); SetResistance(ResistanceType.Poison, Utility.RandomMinMax(45, 50) + attrs.ArmorPoisonResist); SetResistance(ResistanceType.Energy, Utility.RandomMinMax(45, 50) + attrs.ArmorEnergyResist); int fire = attrs.WeaponFireDamage; int cold = attrs.WeaponColdDamage; int poison = attrs.WeaponPoisonDamage; int energy = attrs.WeaponEnergyDamage; int physical = 100 - fire - cold - poison - energy; SetDamageType(ResistanceType.Physical, physical); SetDamageType(ResistanceType.Fire, fire); SetDamageType(ResistanceType.Cold, cold); SetDamageType(ResistanceType.Poison, poison); SetDamageType(ResistanceType.Energy, energy); }
protected override void OnTarget(Mobile from, object target) { if (m_HuePlating.Deleted || m_HuePlating.RootParent != from) { if (from == null) { return; } } CraftResourceInfo resourceInfo = CraftResources.GetInfo(m_HuePlating.ResourceType); if (target is Item) { Item item = target as Item; if (!item.IsChildOf(from.Backpack)) { from.SendMessage("You must target a metal-based weapon or armor in your backpack."); return; } if (item is BaseWeapon || item is BaseArmor) { if (item.Aspect != AspectEnum.None) { from.SendMessage("Aspect armor may not be hued with this item."); return; } if (item.LootType == LootType.Newbied || item.LootType == LootType.Blessed) { from.SendMessage("Newbied or blessed items may not be hued with this item."); return; } if (item is BaseWeapon) { BaseWeapon weapon = item as BaseWeapon; if (weapon is BaseStaff || weapon is BaseRanged || weapon is Club) { from.SendMessage("Only metal-based weapons may be hued with this item."); return; } } if (item is BaseArmor) { BaseArmor armor = item as BaseArmor; if (!(armor.MaterialType == ArmorMaterialType.Ringmail || armor.MaterialType == ArmorMaterialType.Chainmail || armor.MaterialType == ArmorMaterialType.Plate)) { from.SendMessage("Only metal-based armor may be hued with this item."); return; } } if (item is BaseShield) { BaseShield shield = item as BaseShield; if (shield is WoodenShield) { from.SendMessage("Only metal-based shields may be hued with this item."); return; } } if (item.Hue == resourceInfo.Hue) { from.SendMessage("That item is already that hue."); return; } else { item.Hue = resourceInfo.Hue; from.PlaySound(0x23E); from.SendMessage("You alter the hue of the item."); m_HuePlating.Delete(); } } else { from.SendMessage("You must target a metal-based weapon or piece or armor in your backpack."); return; } } else { from.SendMessage("You must target a metal-based weapon or piece or armor in your backpack."); return; } }
public bool TryTransmutate(Mobile from, Item dropped) { BaseHouse house = BaseHouse.FindHouseAt(from); if (house != null && house.IsOwner(from)) { CraftResource res = CraftResources.GetFromType(dropped.GetType()); if (res == Resource) { if (dropped.Amount < 3) { from.SendLocalizedMessage(1152634); // There is not enough to transmute } else if (Charges <= 0) { from.SendLocalizedMessage(1152635); // The cauldron's magic is exhausted } else { CraftResourceInfo info = CraftResources.GetInfo(Resource + 1); if (info != null && info.ResourceTypes.Length > 0) { int toDrop = Math.Min(Charges * 3, dropped.Amount); CraftResource newRes = (CraftResource)(int)res + 1; while (toDrop % 3 != 0) { toDrop--; } int newAmount = toDrop / 3; if (toDrop < dropped.Amount) { dropped.Amount -= toDrop; } else { dropped.Delete(); } Item item = Loot.Construct(info.ResourceTypes[0]); if (item != null) { item.Amount = newAmount; from.AddToBackpack(item); from.SendLocalizedMessage(1152636); // The cauldron transmutes the material from.PlaySound(Utility.RandomList(0x22, 0x23)); Charges -= newAmount; Components.ForEach(c => c.InvalidateProperties()); return(true); } } else { from.SendLocalizedMessage(1152633); // The cauldron cannot transmute that } } } } else { from.SendLocalizedMessage(1152632); // That is not yours! } return(false); }
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 (Ethics.Ethic.IsImbued(this)) { from.SendLocalizedMessage(502440); // Scissors can not be used on that to produce anything. return(false); } if (TestCenter.Enabled && !String.IsNullOrEmpty(Name) && Name.ToLower().IndexOf("beta") > -1) { from.SendMessage("This item is too special to be cut."); 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; } Item res = (Item)Activator.CreateInstance(resourceType); ScissorHelper(from, res, m_PlayerConstructed ? (item.Resources.GetAt(0).Amount / 2) : 1, !resourceType.IsSubclassOf(typeof(BaseLeather))); if (this is BaseShoes) { switch (((BaseShoes)this).Resource) { case CraftResource.RegularLeather: { res.Hue = 0; break; } case CraftResource.SpinedLeather: { res.Hue = 643; break; } case CraftResource.HornedLeather: { res.Hue = 551; break; } case CraftResource.BarbedLeather: { res.Hue = 449; break; } } } //Cutting up items with special hues only gives 1 cloth if (res.Amount >= 1 && res.Hue >= 1000) { from.SendMessage("The corrosive dye destroyed most of the cloth, yielding very little usable material."); res.Amount = 1; } res.LootType = LootType.Regular; return(true); } catch { } } from.SendLocalizedMessage(502440); // Scissors can not be used on that to produce anything. return(false); }
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); double skill = Math.Max(from.Skills[SkillName.Mining].Value, from.Skills[SkillName.Blacksmith].Value); if (item is DragonBardingDeed || item is BaseArmor armor && armor.PlayerConstructed || item is BaseWeapon weapon && weapon.PlayerConstructed || item is BaseClothing clothing && clothing.PlayerConstructed) { if (skill > 100.0) { skill = 100.0; } double amount = (((4 + skill) * craftResource.Amount - 4) * 0.0068); if (amount < 2) { ingot.Amount = 2; } else { ingot.Amount = (int)amount; } } else { ingot.Amount = 2; } if (difficulty > skill) { m_Failure = true; ingot.Delete(); } else { item.Delete(); } from.AddToBackpack(ingot); from.PlaySound(0x2A); from.PlaySound(0x240); return(true); }
public virtual int OnCraft(int quality, bool makersMark, Mobile from, CraftSystem craftSystem, Type typeRes, BaseTool tool, CraftItem craftItem, int resHue) { Quality = (ItemQuality)quality; if (makersMark) // Add to CraftItem.cs mark table { Crafter = from; } Type resourceType = typeRes; if (resourceType == null) { resourceType = craftItem.Resources.GetAt(0).ItemType; } if (!craftItem.ForceNonExceptional) { Resource = CraftResources.GetFromType(resourceType); } CraftContext context = craftSystem.GetContext(from); if (context != null && context.DoNotColor) { Hue = 0; } if (craftItem != null) { if (tool is BaseRunicTool) { ((BaseRunicTool)tool).ApplyAttributesTo(this); } CraftResourceInfo resInfo = CraftResources.GetInfo(m_Resource); if (resInfo == null) { return(quality); } CraftAttributeInfo attrInfo = resInfo.AttributeInfo; if (attrInfo == null) { return(quality); } if (m_Resource != CraftResource.Heartwood) { m_AosAttributes.WeaponDamage += attrInfo.WeaponDamage; m_AosAttributes.WeaponSpeed += attrInfo.WeaponSwingSpeed; m_AosAttributes.AttackChance += attrInfo.WeaponHitChance; m_AosAttributes.RegenHits += attrInfo.WeaponRegenHits; } else { switch (Utility.Random(6)) { case 0: m_AosAttributes.WeaponDamage += attrInfo.WeaponDamage; break; case 1: m_AosAttributes.WeaponSpeed += attrInfo.WeaponSwingSpeed; break; case 2: m_AosAttributes.AttackChance += attrInfo.WeaponHitChance; break; case 3: m_AosAttributes.Luck += attrInfo.WeaponLuck; break; } } if ((m_Resource == CraftResource.Frostwood || m_Resource == CraftResource.Heartwood) && m_AosAttributes.SpellChanneling == 0) { Attributes.SpellChanneling = 1; Attributes.CastSpeed -= 1; } } return(quality); }
public override void GetProperties(ObjectPropertyList list) { base.GetProperties(list); CraftResourceInfo info = CraftResources.IsStandard(this.m_Resource) ? null : CraftResources.GetInfo(this.m_Resource); if (info != null && info.Number > 0) { list.Add(info.Number); } }
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; case CraftResource.Nepturite: difficulty = 99.0; break; case CraftResource.Obsidian: difficulty = 99.0; break; case CraftResource.Steel: difficulty = 99.0; break; case CraftResource.Brass: difficulty = 105.0; break; case CraftResource.Mithril: difficulty = 124.0; break; case CraftResource.Xormite: difficulty = 124.0; break; case CraftResource.Dwarven: difficulty = 124.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); }
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.Cuivre: difficulty = 65.0; break; case CraftResource.Bronze: difficulty = 70.0; break; case CraftResource.Acier: difficulty = 75.0; break; case CraftResource.Argent: difficulty = 80.0; break; case CraftResource.Or: difficulty = 85.0; break; case CraftResource.Mytheril: difficulty = 90.0; break; case CraftResource.Luminium: difficulty = 95.0; break; case CraftResource.Obscurium: difficulty = 99.0; break; default: 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.Excavation].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.Excavation].Value) { m_Failure = true; ingot.Delete(); } else { item.Delete(); } from.AddToBackpack(ingot); from.PlaySound(0x2A); from.PlaySound(0x240); return(true); } catch (Exception ex) { Misc.ExceptionLogging.WriteLine(ex); } return(false); }
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); }
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); }
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 } //daat99 OWLTR start - smelting difficulty double difficulty = daat99.ResourceHelper.GetMinSkill(resource); //daat99 OWLTR end - smelting difficulty 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); }
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); }