Resource icon

Code Adding Custom Leather

version 1.0
*DISCLAIMER!!!*
This tutorial is for guidance on adding custom leather. This is not a simple process nor could it be considered easy. If your looking for a drag and drop solution this is not for you. If you're new to C# this is not for you. If you're looking for a little help or want to know how I add custom leather then continue reading.
I do not cover adding custom leathers to bods in this tutorial I may or may not add how to do so in the future.
Make sure you double check all your code before replying with errors or for help.
Always backup your files before modifying them.

This is how I add custom leather and it may not be 100% accurate.
I'll be providing the files mentioned in this tutorial in a rar file. You can search them for the keyword "Custom Leather Code" to go directly to the spots I mention in the tutorial.

If you find any improper spelling please PM me do not reply to tell me.

The first thing you'll need before you begin is a good code editor program. I personally recommend using either Visual Studio or Notepad++
Visual Studio: IDE and Code Editor for Software Developers and Teams
Notepad++

Next you will need the latest copy of Servuo or Runuo.
All code lines mentioned in this tutorial are based on Servuo Publish 54

As you work through the different sections, please be aware that simple things, like capitalization and ordering, are very important!. One simple mistake in punctuation or Capitalization which could generate hundreds of errors when you try to compile. Take your time and be thorough.

[accordion=bleft|100%]
{slide=1. Leather Order|center}
1. Leather Order
Create a list of custom leathers you wish to add starting with the most common and ending with the least common. Keep this handy as you'll need to refer to it through this tutorial.

I will be showing you how to add 2 new custom leathers in this tutorial Mongbat and Dragon.
So my order will be: Plain, Spined, Horned, Barbed, Mongbat, Dragon
{/slide}
{slide=2. Hides.cs|center}
2. Scripts\Items\Resources\Tailor\Hides.cs
Lines: 44 to 53
Code:
public override int LabelNumber
  {
  get
  {
  if (this.m_Resource >= CraftResource.SpinedLeather && this.m_Resource <= CraftResource.BarbedLeather)
  return 1049687 + (int)(this.m_Resource - CraftResource.SpinedLeather);

  return 1047023;
  }
  }
You want to change Line 48
Code:
if (this.m_Resource >= CraftResource.SpinedLeather && this.m_Resource <= CraftResource.BarbedLeather)
So that the Least Common Leather is listed in place of BarbedLeather.
In the case of this tutorial that would be DragonLeather so it would look like this:
Code:
if (this.m_Resource >= CraftResource.SpinedLeather && this.m_Resource <= CraftResource.DragonLeather)

Next and final step for Hides.cs you'll find this at the very bottom:
Code:
[FlipableAttribute(0x1079, 0x1078)]
  public class BarbedHides : BaseHides, IScissorable
  {
  protected override CraftResource DefaultResource { get { return CraftResource.BarbedLeather; } }

  [Constructable]
  public BarbedHides()
  : this(1)
  {
  }

  [Constructable]
  public BarbedHides(int amount)
  : base(CraftResource.BarbedLeather, amount)
  {
  }

  public BarbedHides(Serial serial)
  : base(serial)
  {
  }

  public override void Serialize(GenericWriter writer)
  {
  base.Serialize(writer);

  writer.Write((int)0); // version
  }

  public override void Deserialize(GenericReader reader)
  {
  base.Deserialize(reader);

  int version = reader.ReadInt();
  }

  public bool Scissor(Mobile from, Scissors scissors)
  {
  if (this.Deleted || !from.CanSee(this))
  return false;

  if (Core.AOS && !this.IsChildOf(from.Backpack))
  {
  from.SendLocalizedMessage(502437); // Items you wish to cut must be in your backpack
  return false;
  }

  base.ScissorHelper(from, new BarbedLeather(), 1);

  return true;
  }
  }
You'll have to add this for every custom leather you're adding. So in the case of this tutorial the bottom of Hides.cs will look like this.
Code:
[FlipableAttribute(0x1079, 0x1078)]
  public class BarbedHides : BaseHides, IScissorable
  {
  protected override CraftResource DefaultResource { get { return CraftResource.BarbedLeather; } }

  [Constructable]
  public BarbedHides()
  : this(1)
  {
  }

  [Constructable]
  public BarbedHides(int amount)
  : base(CraftResource.BarbedLeather, amount)
  {
  }

  public BarbedHides(Serial serial)
  : base(serial)
  {
  }

  public override void Serialize(GenericWriter writer)
  {
  base.Serialize(writer);

  writer.Write((int)0); // version
  }

  public override void Deserialize(GenericReader reader)
  {
  base.Deserialize(reader);

  int version = reader.ReadInt();
  }

  public bool Scissor(Mobile from, Scissors scissors)
  {
  if (this.Deleted || !from.CanSee(this))
  return false;

  if (Core.AOS && !this.IsChildOf(from.Backpack))
  {
  from.SendLocalizedMessage(502437); // Items you wish to cut must be in your backpack
  return false;
  }

  base.ScissorHelper(from, new BarbedLeather(), 1);

  return true;
  }
  }

  [FlipableAttribute(0x1079, 0x1078)]
  public class MongbatHides : BaseHides, IScissorable
  {
  protected override CraftResource DefaultResource { get { return CraftResource.MongbatLeather; } }

  [Constructable]
  public MongbatHides()
  : this(1)
  {
  }

  [Constructable]
  public MongbatHides(int amount)
  : base(CraftResource.MongbatLeather, amount)
  {
  }

  public MongbatHides(Serial serial)
  : base(serial)
  {
  }

  public override void Serialize(GenericWriter writer)
  {
  base.Serialize(writer);

  writer.Write((int)0); // version
  }

  public override void Deserialize(GenericReader reader)
  {
  base.Deserialize(reader);

  int version = reader.ReadInt();
  }

  public bool Scissor(Mobile from, Scissors scissors)
  {
  if (this.Deleted || !from.CanSee(this))
  return false;

  if (Core.AOS && !this.IsChildOf(from.Backpack))
  {
  from.SendLocalizedMessage(502437); // Items you wish to cut must be in your backpack
  return false;
  }

  base.ScissorHelper(from, new MongbatLeather(), 1);

  return true;
  }
  }

  [FlipableAttribute(0x1079, 0x1078)]
  public class DragonHides : BaseHides, IScissorable
  {
  protected override CraftResource DefaultResource { get { return CraftResource.DragonLeather; } }

  [Constructable]
  public DragonHides()
  : this(1)
  {
  }

  [Constructable]
  public DragonHides(int amount)
  : base(CraftResource.DragonLeather, amount)
  {
  }

  public DragonHides(Serial serial)
  : base(serial)
  {
  }

  public override void Serialize(GenericWriter writer)
  {
  base.Serialize(writer);

  writer.Write((int)0); // version
  }

  public override void Deserialize(GenericReader reader)
  {
  base.Deserialize(reader);

  int version = reader.ReadInt();
  }

  public bool Scissor(Mobile from, Scissors scissors)
  {
  if (this.Deleted || !from.CanSee(this))
  return false;

  if (Core.AOS && !this.IsChildOf(from.Backpack))
  {
  from.SendLocalizedMessage(502437); // Items you wish to cut must be in your backpack
  return false;
  }

  base.ScissorHelper(from, new DragonLeather(), 1);

  return true;
  }
  }
{/slide}
{slide=3. Leathers.cs|center}
3. Scripts\Items\Resources\Tailor\Leathers.cs
Lines: 44 to 53
Code:
public override int LabelNumber
  {
  get
  {
  if (this.m_Resource >= CraftResource.SpinedLeather && this.m_Resource <= CraftResource.BarbedLeather)
  return 1049684 + (int)(this.m_Resource - CraftResource.SpinedLeather);

  return 1047022;
  }
  }
You want to change Line 48
Code:
if (this.m_Resource >= CraftResource.SpinedLeather && this.m_Resource <= CraftResource.BarbedLeather)
So that the Least Common Leather is listed in place of BarbedLeather.
In the case of this tutorial that would be DragonLeather so it would look like this:
Code:
if (this.m_Resource >= CraftResource.SpinedLeather && this.m_Resource <= CraftResource.DragonLeather)

Next and final step for Leathers.cs you'll find this at the very bottom:
Code:
[FlipableAttribute(0x1081, 0x1082)]
  public class BarbedLeather : BaseLeather
  {
  protected override CraftResource DefaultResource { get { return CraftResource.BarbedLeather; } }

  [Constructable]
  public BarbedLeather()
  : this(1)
  {
  }

  [Constructable]
  public BarbedLeather(int amount)
  : base(CraftResource.BarbedLeather, amount)
  {
  }

  public BarbedLeather(Serial serial)
  : base(serial)
  {
  }

  public override void Serialize(GenericWriter writer)
  {
  base.Serialize(writer);

  writer.Write((int)0); // version
  }

  public override void Deserialize(GenericReader reader)
  {
  base.Deserialize(reader);

  int version = reader.ReadInt();
  }
  }
You'll have to add this for every custom leather you're adding. So in the case of this tutorial the bottom of Leathers.cs will look like this.
Code:
[FlipableAttribute(0x1081, 0x1082)]
  public class BarbedLeather : BaseLeather
  {
  protected override CraftResource DefaultResource { get { return CraftResource.BarbedLeather; } }

  [Constructable]
  public BarbedLeather()
  : this(1)
  {
  }

  [Constructable]
  public BarbedLeather(int amount)
  : base(CraftResource.BarbedLeather, amount)
  {
  }

  public BarbedLeather(Serial serial)
  : base(serial)
  {
  }

  public override void Serialize(GenericWriter writer)
  {
  base.Serialize(writer);

  writer.Write((int)0); // version
  }

  public override void Deserialize(GenericReader reader)
  {
  base.Deserialize(reader);

  int version = reader.ReadInt();
  }
  }

   [FlipableAttribute(0x1081, 0x1082)]
  public class MongbatLeather : BaseLeather
  {
  protected override CraftResource DefaultResource { get { return CraftResource.MongbatLeather; } }

  [Constructable]
  public MongbatLeather()
  : this(1)
  {
  }

  [Constructable]
  public MongbatLeather(int amount)
  : base(CraftResource.MongbatLeather, amount)
  {
  }

  public MongbatLeather(Serial serial)
  : base(serial)
  {
  }

  public override void Serialize(GenericWriter writer)
  {
  base.Serialize(writer);

  writer.Write((int)0); // version
  }

  public override void Deserialize(GenericReader reader)
  {
  base.Deserialize(reader);

  int version = reader.ReadInt();
  }
  }

   [FlipableAttribute(0x1081, 0x1082)]
  public class DragonLeather : BaseLeather
  {
  protected override CraftResource DefaultResource { get { return CraftResource.DragonLeather; } }

  [Constructable]
  public DragonLeather()
  : this(1)
  {
  }

  [Constructable]
  public DragonLeather(int amount)
  : base(CraftResource.DragonLeather, amount)
  {
  }

  public DragonLeather(Serial serial)
  : base(serial)
  {
  }

  public override void Serialize(GenericWriter writer)
  {
  base.Serialize(writer);

  writer.Write((int)0); // version
  }

  public override void Deserialize(GenericReader reader)
  {
  base.Deserialize(reader);

  int version = reader.ReadInt();
  }
  }
{/slide}
{slide=4. ResourceInfo.cs|center}
4. Scripts\Misc\ResourceInfo.cs
At the top of the script inside
Code:
 public enum CraftResource
You will see this Lines 19 to 22
Code:
  RegularLeather = 101,
  SpinedLeather,
  HornedLeather,
  BarbedLeather,
Add the Custom Leathers to the enum in the proper order established in step 1
In the case of this tutorial it will look like this.
Make sure you have the commas If you want to know why, look up how enum works in c#.
Code:
  RegularLeather = 101,
  SpinedLeather,
  HornedLeather,
  BarbedLeather,
  MongbatLeather,
  DragonLeather,

A few hundred lines down you will find this:
Code:
public static readonly CraftAttributeInfo Spined, Horned, Barbed;
You will want to add your custom Leathers to this, also in order.
So for this tutorial it will look like this:
Code:
public static readonly CraftAttributeInfo Spined, Horned, Barbed, Mongbat, Dragon;

A couple hundred lines down you will find this:
Code:
  CraftAttributeInfo barbed = Barbed = new CraftAttributeInfo();

  barbed.ArmorPhysicalResist = 2;
  barbed.ArmorFireResist = 1;
  barbed.ArmorColdResist = 2;
  barbed.ArmorPoisonResist = 3;
  barbed.ArmorEnergyResist = 4;
  barbed.RunicMinAttributes = 4;
  barbed.RunicMaxAttributes = 5;
  if (Core.ML)
  {
  barbed.RunicMinIntensity = 50;
  barbed.RunicMaxIntensity = 100;
  }
  else
  {
  barbed.RunicMinIntensity = 40;
  barbed.RunicMaxIntensity = 100;
  }
This is what defines a Leathers bonuses when it is used to craft armor.
Barbed Leather adds 2 phsyical resistance, 1 fire resistance, 2 cold resistance, 3 poison resistance and 4 energy resistance to armour when barbed leather is used to craft it.
RunicMinAttributes is the number of minimum attributes the armor will recieve when a barbed runic sewing kit is used to crafting leather armor.
RunicMaxAttributes is the number of maximum attributes the armor will recieve when a barbed runic sewing kit is used to crafting leather armor.
RunicMinIntensity is the minimum percent intensity of the attributes that armor will recieve when a barbed runic sewing kit is used to crafting leather armor.
RunicMaxIntensity is the maximum percent intensity of the attributes that armor will recieve when a barbed runic sewing kit is used to crafting leather armor.
So a barbed runic can get 5 attributes at 100% (really rare tho)

You'll have to add this for every custom leather you're adding. So in the case of this tutorial it will look like this.
Code:
CraftAttributeInfo barbed = Barbed = new CraftAttributeInfo();

  barbed.ArmorPhysicalResist = 2;
  barbed.ArmorFireResist = 1;
  barbed.ArmorColdResist = 2;
  barbed.ArmorPoisonResist = 3;
  barbed.ArmorEnergyResist = 4;
  barbed.RunicMinAttributes = 4;
  barbed.RunicMaxAttributes = 5;
  if (Core.ML)
  {
  barbed.RunicMinIntensity = 50;
  barbed.RunicMaxIntensity = 100;
  }
  else
  {
  barbed.RunicMinIntensity = 40;
  barbed.RunicMaxIntensity = 100;
  }
    
CraftAttributeInfo mongbat = Mongbat = new CraftAttributeInfo();

  mongbat.ArmorPhysicalResist = 1;
  mongbat.RunicMinAttributes = 0;
  mongbat.RunicMaxAttributes = 1;
  if (Core.ML)
  {
  mongbat.RunicMinIntensity = 10;
  mongbat.RunicMaxIntensity = 20;
  }
  else
  {
  mongbat.RunicMinIntensity = 10;
  mongbat.RunicMaxIntensity = 20;
  }
    
CraftAttributeInfo dragon = Dragon = new CraftAttributeInfo();

  dragon.ArmorPhysicalResist = 2;
  dragon.ArmorFireResist = 4;
  dragon.ArmorColdResist = 2;
  dragon.ArmorPoisonResist = 3;
  dragon.ArmorEnergyResist = 4;
  dragon.RunicMinAttributes = 4;
  dragon.RunicMaxAttributes = 5;
  if (Core.ML)
  {
  dragon.RunicMinIntensity = 50;
  dragon.RunicMaxIntensity = 100;
  }
  else
  {
  dragon.RunicMinIntensity = 40;
  dragon.RunicMaxIntensity = 100;
  }

A few hundred lines down you'll find this
Code:
private static readonly CraftResourceInfo[] m_LeatherInfo = new CraftResourceInfo[]
Within this you'll see an entry for normal, spined, horned and barbed.
This is the entry for BarbedLeather
Code:
new CraftResourceInfo(0x1C1, 1049356, "Barbed", CraftAttributeInfo.Barbed, CraftResource.BarbedLeather,   typeof(BarbedLeather),   typeof(BarbedHides))
0x1C1 = Hue
1049356 = Cliloc
"Barbed" = Name
CraftAttributeInfo.Barbed = attributeInfo
CraftResource.BarbedLeather = resource
typeof(BarbedLeather) = resourceType
typeof(BarbedHides) = resourceType

You have to add your custom leathers in the same way, in the same order you've been using.
So for this tutorial it will look like this.
Make note of the commas at the end of the lines!
Code:
  new CraftResourceInfo(0x1C1, 1049356, "Barbed", CraftAttributeInfo.Barbed, CraftResource.BarbedLeather,   typeof(BarbedLeather),   typeof(BarbedHides)),
  new CraftResourceInfo(0x722, 0, "Mongbat", CraftAttributeInfo.Mongbat, CraftResource.MongbatLeather,   typeof(MongbatLeather),   typeof(MongbatHides)),
  new CraftResourceInfo(0x1B5, 0, "Dragon", CraftAttributeInfo.Dragon, CraftResource.DragonLeather,   typeof(DragonLeather),   typeof(DragonHides))

Now just below this you'll find this:
Code:
private static readonly CraftResourceInfo[] m_AOSLeatherInfo = new CraftResourceInfo[]
You have to do the same exact thing that you just did.
But in this one you add a comma to the end of the dragon line
So for this tutorial it will look like this
Code:
  new CraftResourceInfo(0x851, 1049356, "Barbed", CraftAttributeInfo.Barbed, CraftResource.BarbedLeather,   typeof(BarbedLeather),   typeof(BarbedHides)),
  new CraftResourceInfo(0x722, 0, "Mongbat", CraftAttributeInfo.Mongbat, CraftResource.MongbatLeather,   typeof(MongbatLeather),   typeof(MongbatHides)),
  new CraftResourceInfo(0x1B5, 0, "Dragon", CraftAttributeInfo.Dragon, CraftResource.DragonLeather,   typeof(DragonLeather),   typeof(DragonHides)),
The reason that 0 is used in place of the Cliloc # is so that it uses the name instead of a cliloc #
This way you will see the name on the hide(s) & leather(s).

Now about 100 lines down you'll find this:
Code:
public static CraftResourceType GetType(CraftResource resource)
  {
  if (resource >= CraftResource.Iron && resource <= CraftResource.Valorite)
  return CraftResourceType.Metal;

  if (resource >= CraftResource.RegularLeather && resource <= CraftResource.BarbedLeather)
  return CraftResourceType.Leather;
You will want to change it so that BarbedLeather is the last custom Leather in order
In the case of this tutorial that is DragonLeather so it will look like this:
Code:
if (resource >= CraftResource.RegularLeather && resource <= CraftResource.DragonLeather)
  return CraftResourceType.Leather;
Now about 100 lines down you'll find this:
Code:
public static CraftResource GetFromOreInfo(OreInfo info)
  {
  if (info.Name.IndexOf("Spined") >= 0)
  return CraftResource.SpinedLeather;
  else if (info.Name.IndexOf("Horned") >= 0)
  return CraftResource.HornedLeather;
  else if (info.Name.IndexOf("Barbed") >= 0)
  return CraftResource.BarbedLeather;
  else if (info.Name.IndexOf("Leather") >= 0)
  return CraftResource.RegularLeather;
You will have to add your custom leathers in order to this.
In the case of this tutorial it will look like this:
Code:
public static CraftResource GetFromOreInfo(OreInfo info)
  {
  if (info.Name.IndexOf("Spined") >= 0)
  return CraftResource.SpinedLeather;
  else if (info.Name.IndexOf("Horned") >= 0)
  return CraftResource.HornedLeather;
  else if (info.Name.IndexOf("Barbed") >= 0)
  return CraftResource.BarbedLeather;
  else if (info.Name.IndexOf("Leather") >= 0)
  return CraftResource.RegularLeather;
  else if (info.Name.IndexOf("Mongbat") >= 0)
  return CraftResource.MongbatLeather;
  else if (info.Name.IndexOf("Dragon") >= 0)
  return CraftResource.DragonLeather;

A little ways down you'll find this:
Code:
public static CraftResource GetFromOreInfo(OreInfo info, ArmorMaterialType material)
  {
  if (material == ArmorMaterialType.Studded || material == ArmorMaterialType.Leather || material == ArmorMaterialType.Spined ||
  material == ArmorMaterialType.Horned || material == ArmorMaterialType.Barbed)
  {
  if (info.Level == 0)
  return CraftResource.RegularLeather;
  else if (info.Level == 1)
  return CraftResource.SpinedLeather;
  else if (info.Level == 2)
  return CraftResource.HornedLeather;
  else if (info.Level == 3)
  return CraftResource.BarbedLeather;

You have to add your custom leathers to both spots, also make sure it is formatted properly.
In the case of this tutorial it will look like this:
Code:
public static CraftResource GetFromOreInfo(OreInfo info, ArmorMaterialType material)
  {
  if (material == ArmorMaterialType.Studded || material == ArmorMaterialType.Leather || material == ArmorMaterialType.Spined ||
  material == ArmorMaterialType.Horned || material == ArmorMaterialType.Barbed || material == ArmorMaterialType.Mongbat ||
  material == ArmorMaterialType.Dragon)
  {
  if (info.Level == 0)
  return CraftResource.RegularLeather;
  else if (info.Level == 1)
  return CraftResource.SpinedLeather;
  else if (info.Level == 2)
  return CraftResource.HornedLeather;
  else if (info.Level == 3)
  return CraftResource.BarbedLeather;
  else if (info.Level == 4)
  return CraftResource.MongbatLeather;
  else if (info.Level == 5)
  return CraftResource.DragonLeather;
{/slide}
{slide=5. BaseArmor.cs|center}
5. Scripts\Items\- BaseClasses\BaseArmor.cs
Line 346 You'll find this:
Code:
public virtual double ArmorRating
  {
  get
  {
  int ar = this.BaseArmorRating;

  if (this.m_Protection != ArmorProtectionLevel.Regular)
  ar += 10 + (5 * (int)this.m_Protection);

  switch ( this.m_Resource )
  {
  case CraftResource.DullCopper:
  ar += 2;
  break;
  case CraftResource.ShadowIron:
  ar += 4;
  break;
  case CraftResource.Copper:
  ar += 6;
  break;
  case CraftResource.Bronze:
  ar += 8;
  break;
  case CraftResource.Gold:
  ar += 10;
  break;
  case CraftResource.Agapite:
  ar += 12;
  break;
  case CraftResource.Verite:
  ar += 14;
  break;
  case CraftResource.Valorite:
  ar += 16;
  break;
  case CraftResource.SpinedLeather:
  ar += 10;
  break;
  case CraftResource.HornedLeather:
  ar += 13;
  break;
  case CraftResource.BarbedLeather:
  ar += 16;
  break;
  }
You'll want to add your custom leathers to this in order.
So for this tutorial it will look like this:
Code:
public virtual double ArmorRating
  {
  get
  {
  int ar = this.BaseArmorRating;

  if (this.m_Protection != ArmorProtectionLevel.Regular)
  ar += 10 + (5 * (int)this.m_Protection);

  switch ( this.m_Resource )
  {
  case CraftResource.DullCopper:
  ar += 2;
  break;
  case CraftResource.ShadowIron:
  ar += 4;
  break;
  case CraftResource.Copper:
  ar += 6;
  break;
  case CraftResource.Bronze:
  ar += 8;
  break;
  case CraftResource.Gold:
  ar += 10;
  break;
  case CraftResource.Agapite:
  ar += 12;
  break;
  case CraftResource.Verite:
  ar += 14;
  break;
  case CraftResource.Valorite:
  ar += 16;
  break;
  case CraftResource.SpinedLeather:
  ar += 10;
  break;
  case CraftResource.HornedLeather:
  ar += 13;
  break;
  case CraftResource.BarbedLeather:
  ar += 16;
  break;
  case CraftResource.MongbatLeather:
  ar += 1;
  break;
  case CraftResource.DragonLeather:
  ar += 16;
  break;
  }
Now you have to add to baseamor.cs Deserialize
So look for this at the bottom
Code:
public override void Deserialize(GenericReader reader)
Scroll down from there until you find this:
Code:
if (this.m_Resource == CraftResource.None)
  {
  if (mat == ArmorMaterialType.Studded || mat == ArmorMaterialType.Leather)
  this.m_Resource = CraftResource.RegularLeather;
  else if (mat == ArmorMaterialType.Spined)
  this.m_Resource = CraftResource.SpinedLeather;
  else if (mat == ArmorMaterialType.Horned)
  this.m_Resource = CraftResource.HornedLeather;
  else if (mat == ArmorMaterialType.Barbed)
  this.m_Resource = CraftResource.BarbedLeather;
  else
  this.m_Resource = CraftResource.Iron;
  }
You now want to add your custom leathers in order before the else
So for this tutorial it will look like this:
Code:
if (this.m_Resource == CraftResource.None)
  {
  if (mat == ArmorMaterialType.Studded || mat == ArmorMaterialType.Leather)
  this.m_Resource = CraftResource.RegularLeather;
  else if (mat == ArmorMaterialType.Spined)
  this.m_Resource = CraftResource.SpinedLeather;
  else if (mat == ArmorMaterialType.Horned)
  this.m_Resource = CraftResource.HornedLeather;
  else if (mat == ArmorMaterialType.Barbed)
  this.m_Resource = CraftResource.BarbedLeather;
  else if (mat == ArmorMaterialType.Mongbat)
  this.m_Resource = CraftResource.MongbatLeather;
  else if (mat == ArmorMaterialType.Dragon)
  this.m_Resource = CraftResource.DragonLeather;
  else
  this.m_Resource = CraftResource.Iron;
  }
A few hundred lines down you'll find this:
Code:
public override void AddNameProperty(ObjectPropertyList list)
  {
  int oreType;
       string oreName;

  switch ( this.m_Resource )
  {
  case CraftResource.DullCopper:
  oreType = 1053108;
  break; // dull copper
  case CraftResource.ShadowIron:
  oreType = 1053107;
  break; // shadow iron
  case CraftResource.Copper:
  oreType = 1053106;
  break; // copper
  case CraftResource.Bronze:
  oreType = 1053105;
  break; // bronze
  case CraftResource.Gold:
  oreType = 1053104;
  break; // golden
  case CraftResource.Agapite:
  oreType = 1053103;
  break; // agapite
  case CraftResource.Verite:
  oreType = 1053102;
  break; // verite
  case CraftResource.Valorite:
  oreType = 1053101;
  break; // valorite
  case CraftResource.SpinedLeather:
  oreType = 1061118;
  break; // spined
  case CraftResource.HornedLeather:
  oreType = 1061117;
  break; // horned
  case CraftResource.BarbedLeather:
  oreType = 1061116;
  break; // barbed
...
You're going to comment out this method and add my replacement method.
This is how I chose to handle it to get around having to use cliloc int.
Code:
//Hank's Custom Leather Code
    public override void AddNameProperty(ObjectPropertyList list)
     {
       string resourceName = CraftResources.GetName(m_Resource);
  
       if (string.IsNullOrEmpty(resourceName) || resourceName.ToLower() == "none" || resourceName.ToLower() == "normal" || resourceName.ToLower() == "iron")
  resourceName = "";
      
       list.Add(1053099, ((m_Quality == ArmorQuality.Exceptional) ? "Exceptional " : "") + "{0}\t{1}", resourceName, GetNameString());
     }
/*  public override void AddNameProperty(ObjectPropertyList list)
  {
  int oreType;
       string oreName;

  switch ( this.m_Resource )
  {
  case CraftResource.DullCopper:
  oreType = 1053108;
  break; // dull copper
  case CraftResource.ShadowIron:
  oreType = 1053107;
  break; // shadow iron
  case CraftResource.Copper:
  oreType = 1053106;
  break; // copper
  case CraftResource.Bronze:
  oreType = 1053105;
  break; // bronze
  case CraftResource.Gold:
  oreType = 1053104;
  break; // golden
  case CraftResource.Agapite:
  oreType = 1053103;
  break; // agapite
  case CraftResource.Verite:
  oreType = 1053102;
  break; // verite
  case CraftResource.Valorite:
  oreType = 1053101;
  break; // valorite
  case CraftResource.SpinedLeather:
  oreType = 1061118;
  break; // spined
  case CraftResource.HornedLeather:
  oreType = 1061117;
  break; // horned
  case CraftResource.BarbedLeather:
  oreType = 1061116;
  break; // barbed
  case CraftResource.RedScales:
  oreType = 1060814;
  break; // red
  case CraftResource.YellowScales:
  oreType = 1060818;
  break; // yellow
  case CraftResource.BlackScales:
  oreType = 1060820;
  break; // black
  case CraftResource.GreenScales:
  oreType = 1060819;
  break; // green
  case CraftResource.WhiteScales:
  oreType = 1060821;
  break; // white
  case CraftResource.BlueScales:
  oreType = 1060815;
  break; // blue
  case CraftResource.OakWood:
  oreType = 1072533;
  break; // oak
  case CraftResource.AshWood:
  oreType = 1072534;
  break; // ash
  case CraftResource.YewWood:
  oreType = 1072535;
  break; // yew
  case CraftResource.Heartwood:
  oreType = 1072536;
  break; // heartwood
  case CraftResource.Bloodwood:
  oreType = 1072538;
  break; // bloodwood
  case CraftResource.Frostwood:
  oreType = 1072539;
  break; // frostwood
  default:
  oreType = 0;
  break;
  }

  if (this.m_Quality == ArmorQuality.Exceptional)
  {
  if (oreType != 0)
  list.Add(1053100, "#{0}\t{1}", oreType, this.GetNameString()); // exceptional ~1_oretype~ ~2_armortype~
  else
  list.Add(1050040, this.GetNameString()); // exceptional ~1_ITEMNAME~
  }
  else
  {
  if (oreType != 0)
  list.Add(1053099, "#{0}\t{1}", oreType, this.GetNameString()); // ~1_oretype~ ~2_armortype~
  else if (this.Name == null)
  list.Add(this.LabelNumber);
  else
  list.Add(this.Name);
  }
  }
*/
{/slide}
{slide=6. ArmorEnums.cs|center}
6. Scripts\Items\Armor\ArmorEnums.cs
You will find this:
Code:
public enum ArmorMaterialType
  {
  Cloth,
  Leather,
  Studded,
  Bone,
  Spined,
  Horned,
  Barbed,
  Ringmail,
  Chainmail,
  Plate,
  Dragon   // On OSI, Dragon is seen and considered its own type.
  }
You're going to want to add your custom leathers to this and make a change.
So for this tutorial it will look like this:
Code:
public enum ArmorMaterialType
  {
  Cloth,
  Leather,
  Studded,
  Bone,
  Spined,
  Horned,
  Barbed,
  Ringmail,
  Chainmail,
  Plate,
  DragonScales,   // On OSI, Dragon is seen and considered its own type.
  Mongbat,
  Dragon
  }
{/slide}
{slide=7. BaseWeapon.cs|center}
7. Scripts\Items\- BaseClasses\BaseWeapon.cs
Line: 4352 You'll find this method:
Code:
public override void AddNameProperty(ObjectPropertyList list)
     {
       int oreType;

       switch (m_Resource)
       {
         case CraftResource.DullCopper:
           oreType = 1053108;
           break; // dull copper
         case CraftResource.ShadowIron:
           oreType = 1053107;
           break; // shadow iron
         case CraftResource.Copper:
           oreType = 1053106;
           break; // copper
         case CraftResource.Bronze:
           oreType = 1053105;
           break; // bronze
         case CraftResource.Gold:
           oreType = 1053104;
           break; // golden
         case CraftResource.Agapite:
           oreType = 1053103;
           break; // agapite
         case CraftResource.Verite:
           oreType = 1053102;
           break; // verite
         case CraftResource.Valorite:
           oreType = 1053101;
           break; // valorite
         case CraftResource.SpinedLeather:
           oreType = 1061118;
           break; // spined
         case CraftResource.HornedLeather:
           oreType = 1061117;
           break; // horned
         case CraftResource.BarbedLeather:
           oreType = 1061116;
           break; // barbed
	...
You're going to want to comment out this entire method and add a new method like this:
Code:
//Hank's Custom Leather Code
     public override void AddNameProperty(ObjectPropertyList list)
  {
  string resourceName = CraftResources.GetName(m_Resource);

  if (string.IsNullOrEmpty(resourceName) || resourceName.ToLower() == "none" || resourceName.ToLower() == "normal" || resourceName.ToLower() == "iron")
  resourceName = "";

  list.Add(1053099, ((m_Quality == WeaponQuality.Exceptional) ? "Exceptional" : "") + "{0}\t{1}", resourceName, GetNameString());

  if (!String.IsNullOrEmpty(m_EngravedText))
  list.Add(1062613, m_EngravedText);
  }
/*  
     public override void AddNameProperty(ObjectPropertyList list)
     {
       int oreType;

       switch (m_Resource)
       {
         case CraftResource.DullCopper:
           oreType = 1053108;
           break; // dull copper
         case CraftResource.ShadowIron:
           oreType = 1053107;
           break; // shadow iron
         case CraftResource.Copper:
           oreType = 1053106;
           break; // copper
         case CraftResource.Bronze:
           oreType = 1053105;
           break; // bronze
         case CraftResource.Gold:
           oreType = 1053104;
           break; // golden
         case CraftResource.Agapite:
           oreType = 1053103;
           break; // agapite
         case CraftResource.Verite:
           oreType = 1053102;
           break; // verite
         case CraftResource.Valorite:
           oreType = 1053101;
           break; // valorite
         case CraftResource.SpinedLeather:
           oreType = 1061118;
           break; // spined
         case CraftResource.HornedLeather:
           oreType = 1061117;
           break; // horned
         case CraftResource.BarbedLeather:
           oreType = 1061116;
           break; // barbed
         case CraftResource.RedScales:
           oreType = 1060814;
           break; // red
         case CraftResource.YellowScales:
           oreType = 1060818;
           break; // yellow
         case CraftResource.BlackScales:
           oreType = 1060820;
           break; // black
         case CraftResource.GreenScales:
           oreType = 1060819;
           break; // green
         case CraftResource.WhiteScales:
           oreType = 1060821;
           break; // white
         case CraftResource.BlueScales:
           oreType = 1060815;
           break; // blue

           #region Mondain's Legacy
         case CraftResource.OakWood:
           oreType = 1072533;
           break; // oak
         case CraftResource.AshWood:
           oreType = 1072534;
           break; // ash
         case CraftResource.YewWood:
           oreType = 1072535;
           break; // yew
         case CraftResource.Heartwood:
           oreType = 1072536;
           break; // heartwood
         case CraftResource.Bloodwood:
           oreType = 1072538;
           break; // bloodwood
         case CraftResource.Frostwood:
           oreType = 1072539;
           break; // frostwood
           #endregion

         default:
           oreType = 0;
           break;
       }

       if (oreType != 0)
       {
         list.Add(1053099, "#{0}\t{1}", oreType, GetNameString()); // ~1_oretype~ ~2_armortype~
       }
       else if (Name == null)
       {
         list.Add(LabelNumber);
       }
       else
       {
         list.Add(Name);
       }

       /*
  * Want to move this to the engraving tool, let the non-harmful
  * formatting show, and remove CLILOCs embedded: more like OSI
  * did with the books that had markup, etc.
  *
  * This will have a negative effect on a few event things imgame
  * as is.
  *
  * If we cant find a more OSI-ish way to clean it up, we can
  * easily put this back, and use it in the deserialize
  * method and engraving tool, to make it perm cleaned up.
  */
/*
       if (!String.IsNullOrEmpty(m_EngravedText))
       {
         list.Add(1062613, m_EngravedText);
       }
       /* list.Add( 1062613, Utility.FixHtml( m_EngravedText ) ); */
/*     }
*/
{/slide}
{slide=8. BaseCreature.cs|center}
Scripts\Mobiles\BaseCreature.cs
Line 118 you'll see this
Code:
  public enum HideType
   {
     Regular,
     Spined,
     Horned,
     Barbed,
     Fur
   }
You're going to want to add your custom leathers in order to this.
So for this tutorial it will look like this:
Code:
public enum HideType
   {
     Regular,
     Spined,
     Horned,
     Barbed,
     Mongbat,
     Dragon,
     Fur
   }
Now in this method:
Code:
public virtual void OnCarve(Mobile from, Corpse corpse, Item with)
Find this:
Code:
switch (HideType)
             {
               case HideType.Regular:
                 leather = new Leather(hides);
                 break;
               case HideType.Spined:
                 leather = new SpinedLeather(hides);
                 break;
               case HideType.Horned:
                 leather = new HornedLeather(hides);
                 break;
               case HideType.Barbed:
                 leather = new BarbedLeather(hides);
                 break;
             }
Add your custom leathers to this in order.
So for this tutorial it will look like this:
Code:
switch (HideType)
             {
               case HideType.Regular:
                 leather = new Leather(hides);
                 break;
               case HideType.Spined:
                 leather = new SpinedLeather(hides);
                 break;
               case HideType.Horned:
                 leather = new HornedLeather(hides);
                 break;
               case HideType.Barbed:
                 leather = new BarbedLeather(hides);
                 break;
               case HideType.Mongbat:
                 leather = new MongbatLeather(hides);
                 break;
               case HideType.Dragon:
                 leather = new DragonLeather(hides);
                 break;
             }
Now just a little bit below that you'll find this:
Code:
else
           {
             if (HideType == HideType.Regular)
             {
               corpse.DropItem(new Hides(hides));
             }
             else if (HideType == HideType.Spined)
             {
               corpse.DropItem(new SpinedHides(hides));
             }
             else if (HideType == HideType.Horned)
             {
               corpse.DropItem(new HornedHides(hides));
             }
             else if (HideType == HideType.Barbed)
             {
               corpse.DropItem(new BarbedHides(hides));
             }

             from.SendLocalizedMessage(500471); // You skin it, and the hides are now in the corpse.
           }
Add your custom leathers to this in order.
So for this tutorial it will look like this:
Code:
else
           {
             if (HideType == HideType.Regular)
             {
               corpse.DropItem(new Hides(hides));
             }
             else if (HideType == HideType.Spined)
             {
               corpse.DropItem(new SpinedHides(hides));
             }
             else if (HideType == HideType.Horned)
             {
               corpse.DropItem(new HornedHides(hides));
             }
             else if (HideType == HideType.Barbed)
             {
               corpse.DropItem(new BarbedHides(hides));
             }
             else if (HideType == HideType.Mongbat)
             {
               corpse.DropItem(new MongbatHides(hides));
             }
             else if (HideType == HideType.Dragon)
             {
               corpse.DropItem(new DragonHides(hides));
             }

             from.SendLocalizedMessage(500471); // You skin it, and the hides are now in the corpse.
           }
{/slide}
{slide=9. DefTailoring.cs|center}
9. Scripts\Services\Craft\DefTailoring.cs
Lines 560 to 563 you will find this:
Code:
this.AddSubRes(typeof(Leather), 1049150, 00.0, 1044462, 1049311);
  this.AddSubRes(typeof(SpinedLeather), 1049151, 65.0, 1044462, 1049311);
  this.AddSubRes(typeof(HornedLeather), 1049152, 80.0, 1044462, 1049311);
  this.AddSubRes(typeof(BarbedLeather), 1049153, 99.0, 1044462, 1049311);
You will want to add your custom leathers to this in order
This is what players will see when they are choosing the leather type with the sewing kit
For BarbedLeather:
1049153 = textname
99.0 = minimum skill to use leather\hide
1044462 = cliloc text = Leather or Hides
1049311 = message you get if your skill is too low to work with the leather\hide
So for this tutorial it will look like this:
Code:
this.AddSubRes(typeof(Leather), 1049150, 00.0, 1044462, 1049311);
  this.AddSubRes(typeof(SpinedLeather), 1049151, 65.0, 1044462, 1049311);
  this.AddSubRes(typeof(HornedLeather), 1049152, 80.0, 1044462, 1049311);
  this.AddSubRes(typeof(BarbedLeather), 1049153, 99.0, 1044462, 1049311);
       this.AddSubRes(typeof(MongbatLeather), "Mongbat Leather/Hides", 00.0, 1049311 );
       this.AddSubRes(typeof(DragonLeather), "Dragon Leather/Hides", 99.0, 1049311 );
{/slide}
{slide=10. CraftItem.cs|center}
10. Scripts\Services\Craft\Core\CraftItem.cs
Line 332 you'll find this:
Code:
private static readonly Type[][] m_TypesTable = new[]
     {
       new[] {typeof(Log), typeof(Board)}, new[] {typeof(HeartwoodLog), typeof(HeartwoodBoard)},
       new[] {typeof(BloodwoodLog), typeof(BloodwoodBoard)}, new[] {typeof(FrostwoodLog), typeof(FrostwoodBoard)},
       new[] {typeof(OakLog), typeof(OakBoard)}, new[] {typeof(AshLog), typeof(AshBoard)},
       new[] {typeof(YewLog), typeof(YewBoard)}, new[] {typeof(Leather), typeof(Hides)},
       new[] {typeof(SpinedLeather), typeof(SpinedHides)}, new[] {typeof(HornedLeather), typeof(HornedHides)},
       new[] {typeof(BarbedLeather), typeof(BarbedHides)}, new[] {typeof(BlankMap), typeof(BlankScroll)},
       new[] {typeof(Cloth), typeof(UncutCloth), typeof(AbyssalCloth)}, new[] {typeof(CheeseWheel), typeof(CheeseWedge)},
       new[] {typeof(Pumpkin), typeof(SmallPumpkin)}, new[] {typeof(WoodenBowlOfPeas), typeof(PewterBowlOfPeas)}
     };
add your custom leather to this in order like it does for the leathers and hides.
So for this tutorial it will look like this:
Code:
private static readonly Type[][] m_TypesTable = new[]
     {
       new[] {typeof(Log), typeof(Board)}, new[] {typeof(HeartwoodLog), typeof(HeartwoodBoard)},
       new[] {typeof(BloodwoodLog), typeof(BloodwoodBoard)}, new[] {typeof(FrostwoodLog), typeof(FrostwoodBoard)},
       new[] {typeof(OakLog), typeof(OakBoard)}, new[] {typeof(AshLog), typeof(AshBoard)},
       new[] {typeof(YewLog), typeof(YewBoard)}, new[] {typeof(Leather), typeof(Hides)},
       new[] {typeof(SpinedLeather), typeof(SpinedHides)}, new[] {typeof(HornedLeather), typeof(HornedHides)},
       new[] {typeof(BarbedLeather), typeof(BarbedHides)}, new[] {typeof(MongbatLeather), typeof(MongbatHides)},
       new[] {typeof(DragonLeather), typeof(DragonHides)}, new[] {typeof(BlankMap), typeof(BlankScroll)},
       new[] {typeof(Cloth), typeof(UncutCloth), typeof(AbyssalCloth)}, new[] {typeof(CheeseWheel), typeof(CheeseWedge)},
       new[] {typeof(Pumpkin), typeof(SmallPumpkin)}, new[] {typeof(WoodenBowlOfPeas), typeof(PewterBowlOfPeas)}
     };
{/slide}
{slide=11. Stealth.cs|center}
11. Scripts\Skills\Stealth.cs
You'll find this:
Code:
private static readonly int[,] m_ArmorTable = new int[,]
  {
  //   Gorget   Gloves   Helmet   Arms   Legs   Chest   Shield
  /* Cloth   */ { 0, 0, 0, 0, 0, 0, 0 },
  /* Leather   */ { 0, 0, 0, 0, 0, 0, 0 },
  /* Studded   */ { 2, 2, 0, 4, 6, 10, 0 },
  /* Bone     */ { 0, 5, 10, 10, 15, 25, 0 },
  /* Spined   */ { 0, 0, 0, 0, 0, 0, 0 },
  /* Horned   */ { 0, 0, 0, 0, 0, 0, 0 },
  /* Barbed   */ { 0, 0, 0, 0, 0, 0, 0 },
  /* Ring     */ { 0, 5, 0, 10, 15, 25, 0 },
  /* Chain   */ { 0, 0, 10, 0, 15, 25, 0 },
  /* Plate   */ { 5, 5, 10, 10, 15, 25, 0 },
  /* Dragon   */ { 0, 5, 10, 10, 15, 25, 0 }
  };
This has to do with stealth chance of being shown I believe.
This is the same order as public enum ArmorMaterialType from ArmorEnums.cs
So for this tutorial it will look like this:
Code:
private static readonly int[,] m_ArmorTable = new int[,]
  {
  //   Gorget   Gloves   Helmet   Arms   Legs   Chest   Shield
  /* Cloth   */ { 0, 0, 0, 0, 0, 0, 0 },
  /* Leather   */ { 0, 0, 0, 0, 0, 0, 0 },
  /* Studded   */ { 2, 2, 0, 4, 6, 10, 0 },
  /* Bone     */ { 0, 5, 10, 10, 15, 25, 0 },
  /* Spined   */ { 0, 0, 0, 0, 0, 0, 0 },
  /* Horned   */ { 0, 0, 0, 0, 0, 0, 0 },
  /* Barbed   */ { 0, 0, 0, 0, 0, 0, 0 },
  /* Ring     */ { 0, 5, 0, 10, 15, 25, 0 },
  /* Chain   */ { 0, 0, 10, 0, 15, 25, 0 },
  /* Plate   */ { 5, 5, 10, 10, 15, 25, 0 },
  /* DragonScales   */ { 0, 5, 10, 10, 15, 25, 0 },
       /* Mongbat   */ { 0, 0, 0, 0, 0, 0, 0 },
  /* Dragon   */ { 0, 0, 0, 0, 0, 0, 0 }
  };
{/slide}
{slide=12. Mongbat.cs|center}
12. Scripts\Mobiles\Monsters\Humanoid\Mongbat.cs
Find this:
Code:
public override int Meat
  {
  get
  {
  return 1;
  }
  }
Add to it under it
So for this tutorial it looks like this:
Code:
public override int Meat
  {
  get
  {
  return 1;
  }
  }
     public override int Hides
  {
  get
  {
  return 2;
  }
  }
     public override HideType HideType
  {
  get
  {
  return HideType.Mongbat;
  }
  }

{/slide}
{slide=13. Dragon.cs|center}
13. Scripts\Mobiles\Monsters\Reptile\Magic\Dragon.cs
find this:
Code:
public override HideType HideType
  {
  get
  {
  return HideType.Barbed;
  }
  }
So for this tutorial change it to this:
Code:
public override HideType HideType
  {
  get
  {
  return HideType.Dragon;
  }
  }
{/slide}
[/accordion]
Author
Hank
Views
65
First release
Last update
Rating
0.00 star(s) 0 ratings

More resources from Hank