namespace Server.Items { public abstract class BaseIngot : Item, ICommodity, IResource { protected virtual CraftResource DefaultResource => CraftResource.Iron; private CraftResource m_Resource; public BaseIngot(CraftResource resource) : this(resource, 1) { } public BaseIngot(CraftResource resource, int amount) : base(0x1BF2) { Stackable = true; Amount = amount; Hue = CraftResources.GetHue(resource); m_Resource = resource; } public BaseIngot(Serial serial) : base(serial) { } [CommandProperty(AccessLevel.GameMaster)] public CraftResource Resource { get { return m_Resource; } set { m_Resource = value; InvalidateProperties(); } } public override double DefaultWeight => 0.1; public override int LabelNumber { get { if (m_Resource >= CraftResource.DullCopper && m_Resource <= CraftResource.Valorite) return 1042684 + (m_Resource - CraftResource.DullCopper); return 1042692; } } TextDefinition ICommodity.Description => LabelNumber; bool ICommodity.IsDeedable => true; public override void Serialize(GenericWriter writer) { base.Serialize(writer); writer.Write(1); // version writer.Write((int)m_Resource); } public override void Deserialize(GenericReader reader) { base.Deserialize(reader); int version = reader.ReadInt(); switch (version) { case 2: // Reset from Resource System m_Resource = DefaultResource; reader.ReadString(); break; case 1: { m_Resource = (CraftResource)reader.ReadInt(); break; } case 0: { OreInfo info; switch (reader.ReadInt()) { case 0: info = OreInfo.Iron; break; case 1: info = OreInfo.DullCopper; break; case 2: info = OreInfo.ShadowIron; break; case 3: info = OreInfo.Copper; break; case 4: info = OreInfo.Bronze; break; case 5: info = OreInfo.Gold; break; case 6: info = OreInfo.Agapite; break; case 7: info = OreInfo.Verite; break; case 8: info = OreInfo.Valorite; break; default: info = null; break; } m_Resource = CraftResources.GetFromOreInfo(info); break; } } } public override void AddNameProperty(ObjectPropertyList list) { if (Amount > 1) list.Add(1050039, "{0}\t#{1}", Amount, 1027154); // ~1_NUMBER~ ~2_ITEMNAME~ else list.Add(1027154); // ingots } public override void GetProperties(ObjectPropertyList list) { base.GetProperties(list); if (!CraftResources.IsStandard(m_Resource)) { int num = CraftResources.GetLocalizationNumber(m_Resource); if (num > 0) list.Add(num); else list.Add(CraftResources.GetName(m_Resource)); } } } [Flipable(0x1BF2, 0x1BEF)] public class IronIngot : BaseIngot { [Constructable] public IronIngot() : this(1) { } [Constructable] public IronIngot(int amount) : base(CraftResource.Iron, amount) { } public IronIngot(Serial serial) : base(serial) { } public override void Serialize(GenericWriter writer) { base.Serialize(writer); writer.Write(0); // version } public override void Deserialize(GenericReader reader) { base.Deserialize(reader); int version = reader.ReadInt(); } } [Flipable(0x1BF2, 0x1BEF)] public class DullCopperIngot : BaseIngot { protected override CraftResource DefaultResource => CraftResource.DullCopper; [Constructable] public DullCopperIngot() : this(1) { } [Constructable] public DullCopperIngot(int amount) : base(CraftResource.DullCopper, amount) { } public DullCopperIngot(Serial serial) : base(serial) { } public override void Serialize(GenericWriter writer) { base.Serialize(writer); writer.Write(0); // version } public override void Deserialize(GenericReader reader) { base.Deserialize(reader); int version = reader.ReadInt(); } } [Flipable(0x1BF2, 0x1BEF)] public class ShadowIronIngot : BaseIngot { protected override CraftResource DefaultResource => CraftResource.ShadowIron; [Constructable] public ShadowIronIngot() : this(1) { } [Constructable] public ShadowIronIngot(int amount) : base(CraftResource.ShadowIron, amount) { } public ShadowIronIngot(Serial serial) : base(serial) { } public override void Serialize(GenericWriter writer) { base.Serialize(writer); writer.Write(0); // version } public override void Deserialize(GenericReader reader) { base.Deserialize(reader); int version = reader.ReadInt(); } } [Flipable(0x1BF2, 0x1BEF)] public class CopperIngot : BaseIngot { protected override CraftResource DefaultResource => CraftResource.Copper; [Constructable] public CopperIngot() : this(1) { } [Constructable] public CopperIngot(int amount) : base(CraftResource.Copper, amount) { } public CopperIngot(Serial serial) : base(serial) { } public override void Serialize(GenericWriter writer) { base.Serialize(writer); writer.Write(0); // version } public override void Deserialize(GenericReader reader) { base.Deserialize(reader); int version = reader.ReadInt(); } } [Flipable(0x1BF2, 0x1BEF)] public class BronzeIngot : BaseIngot { protected override CraftResource DefaultResource => CraftResource.Bronze; [Constructable] public BronzeIngot() : this(1) { } [Constructable] public BronzeIngot(int amount) : base(CraftResource.Bronze, amount) { } public BronzeIngot(Serial serial) : base(serial) { } public override void Serialize(GenericWriter writer) { base.Serialize(writer); writer.Write(0); // version } public override void Deserialize(GenericReader reader) { base.Deserialize(reader); int version = reader.ReadInt(); } } [Flipable(0x1BF2, 0x1BEF)] public class GoldIngot : BaseIngot { protected override CraftResource DefaultResource => CraftResource.Gold; [Constructable] public GoldIngot() : this(1) { } [Constructable] public GoldIngot(int amount) : base(CraftResource.Gold, amount) { } public GoldIngot(Serial serial) : base(serial) { } public override void Serialize(GenericWriter writer) { base.Serialize(writer); writer.Write(0); // version } public override void Deserialize(GenericReader reader) { base.Deserialize(reader); int version = reader.ReadInt(); } } [Flipable(0x1BF2, 0x1BEF)] public class AgapiteIngot : BaseIngot { protected override CraftResource DefaultResource => CraftResource.Agapite; [Constructable] public AgapiteIngot() : this(1) { } [Constructable] public AgapiteIngot(int amount) : base(CraftResource.Agapite, amount) { } public AgapiteIngot(Serial serial) : base(serial) { } public override void Serialize(GenericWriter writer) { base.Serialize(writer); writer.Write(0); // version } public override void Deserialize(GenericReader reader) { base.Deserialize(reader); int version = reader.ReadInt(); } } [Flipable(0x1BF2, 0x1BEF)] public class VeriteIngot : BaseIngot { protected override CraftResource DefaultResource => CraftResource.Verite; [Constructable] public VeriteIngot() : this(1) { } [Constructable] public VeriteIngot(int amount) : base(CraftResource.Verite, amount) { } public VeriteIngot(Serial serial) : base(serial) { } public override void Serialize(GenericWriter writer) { base.Serialize(writer); writer.Write(0); // version } public override void Deserialize(GenericReader reader) { base.Deserialize(reader); int version = reader.ReadInt(); } } [Flipable(0x1BF2, 0x1BEF)] public class ValoriteIngot : BaseIngot { protected override CraftResource DefaultResource => CraftResource.Valorite; [Constructable] public ValoriteIngot() : this(1) { } [Constructable] public ValoriteIngot(int amount) : base(CraftResource.Valorite, amount) { } public ValoriteIngot(Serial serial) : base(serial) { } public override void Serialize(GenericWriter writer) { base.Serialize(writer); writer.Write(0); // version } public override void Deserialize(GenericReader reader) { base.Deserialize(reader); int version = reader.ReadInt(); } } }