On my server whatever amount of ores you smelt you get double back and then this message: You smelt the ore removing the impurities and put the metal in your backpack.
So, by removing "impurities" why would I get double the amount of ingots back? Doesn't seem right to me.:rolleyes:
Was wondering can my script be set to where it'll give out half the amount of ingots to whatever amount of ores I start with?
Here's the part of my script where it shows adding ingots to my backpack. Just not sure how to reword the code to work. I tried putting 1's in all the places showing 2's and then it gave me back the exact amount of ingots to ores.
C#:
                            int ingotAmount;

                            if (this.m_Ore.ItemID == 0x19B7)
                            {
                                ingotAmount = toConsume / 2;

                                if (toConsume % 2 != 0)
                                    --toConsume;
                            }
                            else if (this.m_Ore.ItemID == 0x19B9)
                            {
                                ingotAmount = toConsume * 2;
                            }
                            else
                            {
                                ingotAmount = toConsume;
                            }

                            BaseIngot ingot = this.m_Ore.GetIngot();
                            ingot.Amount = ingotAmount;

                            this.m_Ore.Consume(toConsume);
                            from.AddToBackpack(ingot);
 
Last edited:
It came out with the change to ores. When you mine you get different kinds of ore, with different stacking and weight. The amount of ingots you get has to do with the base weight of the ore, not the number of ore in the stack.
 
Thank you for the response

DragnMaw

I tried putting 1's in all the places showing 2's and then it gave me back the exact amount of ingots as to ores (if I smelt 10 ores, I get 10 ingots). Before I changed the 2's to 1's I would smelt 10 ores and I got 20 ingots (in the bit of script that I included in my last post). Just wondering if it's done by weight how would I change it to get half? Here's my entire script:
C#:
using System;
using Server.Engines.Craft;
using Server.Mobiles;
using Server.Targeting;

using daat99; //OWLTR


namespace Server.Items
{
    public abstract class BaseOre : Item
    {
        protected virtual CraftResource DefaultResource { get { return CraftResource.Iron; } }

        private CraftResource m_Resource;

        [CommandProperty(AccessLevel.GameMaster)]
        public CraftResource Resource
        {
            get
            {
                return this.m_Resource;
            }
            set
            {
                this.m_Resource = value;
                this.InvalidateProperties();
            }
        }

        public abstract BaseIngot GetIngot();

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

            writer.Write((int)1); // version

            writer.Write((int)this.m_Resource);
        }

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

            int version = reader.ReadInt();

            switch ( version )
            {
                case 2: // Reset from Resource System
                    this.m_Resource = this.DefaultResource;
                    reader.ReadString();
                    break;
                case 1:
                    {
                        this.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;
                             //daat99 OWLTR start - custom ores
                            case 9:
                                info = OreInfo.Blaze;
                                break;
                            case 10:
                                info = OreInfo.Ice;
                                break;
                            case 11:
                                info = OreInfo.Toxic;
                                break;
                            case 12:
                                info = OreInfo.Electrum;
                                break;
                                //Zeron's Custom Ores - start
                          
                            //case 13:
                                //info = OreInfo.MytherilIngot;
                                //break;
                            //case 13:
                                //info = OreInfo.MytherilOre;
                                //break;
                          
                                //Zeron's Custom Ores - end                              
                            case 13:
                                info = OreInfo.Platinum;
                                break;
                            //daat99 OWLTR end - custom ores
                            default:
                                info = null;
                                break;
                        }

                        this.m_Resource = CraftResources.GetFromOreInfo(info);
                        break;
                    }
            }
        }

        private static int RandomSize()
        {
            double rand = Utility.RandomDouble();

            if (rand < 0.12)
                return 0x19B7;
            else if (rand < 0.18)
                return 0x19B8;
            else if (rand < 0.25)
                return 0x19BA;
            else
                return 0x19B9;
        }

        public BaseOre(CraftResource resource)
            : this(resource, 1)
        {
        }

        public BaseOre(CraftResource resource, int amount)
            : base(RandomSize())
        {
            this.Stackable = true;
            this.Amount = amount;
            this.Hue = CraftResources.GetHue(resource);

            this.m_Resource = resource;
        }

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

        public override void AddNameProperty(ObjectPropertyList list)
        {
            if (this.Amount > 1)
                list.Add(1050039, "{0}\t#{1}", this.Amount, 1026583); // ~1_NUMBER~ ~2_ITEMNAME~
            else
                list.Add(1026583); // ore
        }

        public override void GetProperties(ObjectPropertyList list)
        {
            base.GetProperties(list);

            if (!CraftResources.IsStandard(this.m_Resource))
            {
                int num = CraftResources.GetLocalizationNumber(this.m_Resource);

                if (num > 0)
                    list.Add(num);
                else
                    list.Add(CraftResources.GetName(this.m_Resource));
            }
        }

        public override int LabelNumber
        {
            get
            {
                if (this.m_Resource >= CraftResource.DullCopper && this.m_Resource <= CraftResource.Valorite)
                    return 1042845 + (int)(this.m_Resource - CraftResource.DullCopper);

                return 1042853; // iron ore;
            }
        }

        public override void OnDoubleClick(Mobile from)
        {
            if (!this.Movable)
                return;

            if (this.RootParent is BaseCreature)
            {
                from.SendLocalizedMessage(500447); // That is not accessible
            }
            else if (from.InRange(this.GetWorldLocation(), 2))
            {
                from.SendLocalizedMessage(501971); // Select the forge on which to smelt the ore, or another pile of ore with which to combine it.
               // from.Target = new InternalTarget(this);
                //daat99 OWLTR start - mule forge
                from.Target = new InternalTarget(this, from);
                //daat99 OWLTR end - mule forge
            }
            else
            {
                from.SendLocalizedMessage(501976); // The ore is too far away.
            }
        }

        private class InternalTarget : Target
        {
            private readonly BaseOre m_Ore;
//daat99 OWLTR start - mule forge
            private Mobile player;
          
          
            //public InternalTarget(BaseOre ore)
               // : base(2, false, TargetFlags.None)
             public InternalTarget(BaseOre ore, Mobile from)
                : base(2, false, TargetFlags.None)
            {
            player = from;
                //daat99 OWLTR end - mule forge
                this.m_Ore = ore;
            }

            private bool IsForge(object obj)
            {
                if (Core.ML && obj is Mobile && ((Mobile)obj).IsDeadBondedPet)
                    return false;

                if (obj.GetType().IsDefined(typeof(ForgeAttribute), false))
                    return true;
                  
                //daat99 OWLTR start - mule-forge
                if (player != null && player as PlayerMobile != null && OWLTROptionsManager.IsEnabled(OWLTROptionsManager.OPTIONS_ENUM.MULE_FORGE))
                {
                    if (obj is Mule)
                    {
                        Mule mule = obj as Mule;
                        if (mule.ControlMaster != player)
                        {
                            player.SendMessage(53, "You don't own that mule!!!");
                            player.PlaySound(1074); //no
                            return false;
                        }
                        else
                            return true;
                    }
                }
                //daat99 OWLTR end - mule-forge

                int itemID = 0;

                if (obj is Item)
                    itemID = ((Item)obj).ItemID;
                else if (obj is StaticTarget)
                    itemID = ((StaticTarget)obj).ItemID;

                return (itemID == 4017 || (itemID >= 6522 && itemID <= 6569));
            }

            protected override void OnTarget(Mobile from, object targeted)
            {
                if (this.m_Ore.Deleted)
                    return;

                if (!from.InRange(this.m_Ore.GetWorldLocation(), 2))
                {
                    from.SendLocalizedMessage(501976); // The ore is too far away.
                    return;
                }

                #region Combine Ore
                if (targeted is BaseOre)
                {
                    BaseOre ore = (BaseOre)targeted;

                    if (!ore.Movable)
                    {
                        return;
                    }
                    else if (this.m_Ore == ore)
                    {
                        from.SendLocalizedMessage(501972); // Select another pile or ore with which to combine this.
                       // from.Target = new InternalTarget(ore);
                     
                       //daat99 OWLTR start - mule forge
                        from.Target = new InternalTarget(ore, from);
                        //daat99 OWLTR end - mule forge
                      
                        return;
                    }
                    else if (ore.Resource != this.m_Ore.Resource)
                    {
                        from.SendLocalizedMessage(501979); // You cannot combine ores of different metals.
                        return;
                    }

                    int worth = ore.Amount;

                    if (ore.ItemID == 0x19B9)
                        worth *= 8;
                    else if (ore.ItemID == 0x19B7)
                        worth *= 2;
                    else
                        worth *= 4;

                    int sourceWorth = this.m_Ore.Amount;

                    if (this.m_Ore.ItemID == 0x19B9)
                        sourceWorth *= 8;
                    else if (this.m_Ore.ItemID == 0x19B7)
                        sourceWorth *= 2;
                    else
                        sourceWorth *= 4;

                    worth += sourceWorth;

                    int plusWeight = 0;
                    int newID = ore.ItemID;

                    if (ore.DefaultWeight != this.m_Ore.DefaultWeight)
                    {
                        if (ore.ItemID == 0x19B7 || this.m_Ore.ItemID == 0x19B7)
                        {
                            newID = 0x19B7;
                        }
                        else if (ore.ItemID == 0x19B9)
                        {
                            newID = this.m_Ore.ItemID;
                            plusWeight = ore.Amount * 2;
                        }
                        else
                        {
                            plusWeight = this.m_Ore.Amount * 2;
                        }
                    }

                    if ((ore.ItemID == 0x19B9 && worth > 120000) || ((ore.ItemID == 0x19B8 || ore.ItemID == 0x19BA) && worth > 60000) || (ore.ItemID == 0x19B7 && worth > 30000))
                    {
                        from.SendLocalizedMessage(1062844); // There is too much ore to combine.
                        return;
                    }
                    else if (ore.RootParent is Mobile && (plusWeight + ((Mobile)ore.RootParent).Backpack.TotalWeight) > ((Mobile)ore.RootParent).Backpack.MaxWeight)
                    {
                        from.SendLocalizedMessage(501978); // The weight is too great to combine in a container.
                        return;
                    }

                    ore.ItemID = newID;

                    if (ore.ItemID == 0x19B9)
                        ore.Amount = worth / 8;
                    else if (ore.ItemID == 0x19B7)
                        ore.Amount = worth / 2;
                    else
                        ore.Amount = worth / 4;

                    this.m_Ore.Delete();
                    return;
                }
                #endregion

                if (this.IsForge(targeted))
                {
                    double difficulty;

                    #region Void Pool Rewards
                    bool talisman = false;
                    SmeltersTalisman t = from.FindItemOnLayer(Layer.Talisman) as SmeltersTalisman;
                    if (t != null && t.Resource == m_Ore.Resource)
                        talisman = true;
                    #endregion

                    switch ( this.m_Ore.Resource )
                    {
                        default:
                            difficulty = 50.0;
                            break;
                        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.Blaze:
                            difficulty = 100.0;
                            break;
                        case CraftResource.Ice:
                            difficulty = 105.0;
                            break;
                        case CraftResource.Toxic:
                            difficulty = 110.0;
                            break;
                        case CraftResource.Electrum:
                            difficulty = 115.0;
                            break;
                        case CraftResource.Platinum:
                            difficulty = 119.0;
                            break;                          
                    }

                    double minSkill = difficulty - 25.0;
                    double maxSkill = difficulty + 25.0;

                    if (difficulty > 50.0 && difficulty > from.Skills[SkillName.Mining].Value && !talisman)
                    {
                        from.SendLocalizedMessage(501986); // You have no idea how to smelt this strange ore!
                        return;
                    }

                    if (this.m_Ore.ItemID == 0x19B7 && this.m_Ore.Amount < 2)
                    {
                        from.SendLocalizedMessage(501987); // There is not enough metal-bearing ore in this pile to make an ingot.
                        return;
                    }

                    if (talisman || from.CheckTargetSkill(SkillName.Mining, targeted, minSkill, maxSkill))
                    {
                        int toConsume = this.m_Ore.Amount;

                        if (toConsume <= 0)
                        {
                            from.SendLocalizedMessage(501987); // There is not enough metal-bearing ore in this pile to make an ingot.
                        }
                        else
                        {
                            if (toConsume > 30000)
                                toConsume = 30000;

                            int ingotAmount;

                            if (this.m_Ore.ItemID == 0x19B7)
                            {
                                ingotAmount = toConsume / 1;

                                if (toConsume % 1 != 0)
                                    --toConsume;
                            }
                            else if (this.m_Ore.ItemID == 0x19B9)
                            {
                                ingotAmount = toConsume * 1;
                            }
                            else
                            {
                                ingotAmount = toConsume;
                            }

                            BaseIngot ingot = this.m_Ore.GetIngot();
                          
                            ingot.Amount = ingotAmount;

                            this.m_Ore.Consume(toConsume);
                            from.AddToBackpack(ingot);
                            //from.PlaySound( 0x57 );

                            if (talisman && t != null)
                            {
                                t.UsesRemaining--;
                                from.SendLocalizedMessage(1152620); // The magic of your talisman guides your hands as you purify the metal. Success is ensured!
                            }
                            else
                                //from.SendLocalizedMessage(501988); // You smelt the ore removing the impurities and put the metal in your backpack.
                                  from.SendMessage( "You smelt the ore into ingots and add them to your backpack!" );
                        }
                    }
                    else
                    {
                        if (this.m_Ore.Amount < 1)
                        {
                            if (this.m_Ore.ItemID == 0x19B9)
                                this.m_Ore.ItemID = 0x19B8;
                            else
                                this.m_Ore.ItemID = 0x19B7;
                        }
                        else
                        {
                            this.m_Ore.Amount /= 1;
                        }

                        from.SendLocalizedMessage(501990); // You burn away the impurities but are left with less useable metal.
                    }
                }
            }
        }
    }

    public class IronOre : BaseOre
    {
        [Constructable]
        public IronOre()
            : this(1)
        {
        }

        [Constructable]
        public IronOre(int amount)
            : base(CraftResource.Iron, amount)
        {
         Name = "Iron Ore"; //daat99 OWLTR - custom resource name
        }

        public IronOre(bool fixedSize)
            : this(1)
        {
            if (fixedSize)
                this.ItemID = 0x19B8;
        }

        public IronOre(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 override BaseIngot GetIngot()
        {
            return new IronIngot();
        }
    }

    public class DullCopperOre : BaseOre
    {
        protected override CraftResource DefaultResource { get { return CraftResource.DullCopper; } }

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

        [Constructable]
        public DullCopperOre(int amount)
            : base(CraftResource.DullCopper, amount)
        {
        Name = "Dull Copper Ore"; //daat99 OWLTR - custom resource name
        }

        public DullCopperOre(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 override BaseIngot GetIngot()
        {
            return new DullCopperIngot();
        }
    }

    public class ShadowIronOre : BaseOre
    {
        protected override CraftResource DefaultResource { get { return CraftResource.ShadowIron; } }

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

        [Constructable]
        public ShadowIronOre(int amount)
            : base(CraftResource.ShadowIron, amount)
        {
        Name = "Shadow Iron Ore"; //daat99 OWLTR - custom resource name
        }

        public ShadowIronOre(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 override BaseIngot GetIngot()
        {
            return new ShadowIronIngot();
        }
    }

    public class CopperOre : BaseOre
    {
        protected override CraftResource DefaultResource { get { return CraftResource.Copper; } }

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

        [Constructable]
        public CopperOre(int amount)
            : base(CraftResource.Copper, amount)
        {
         Name = "Copper Ore"; //daat99 OWLTR - custom resource name
        }

        public CopperOre(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 override BaseIngot GetIngot()
        {
            return new CopperIngot();
        }
    }

    public class BronzeOre : BaseOre
    {
        protected override CraftResource DefaultResource { get { return CraftResource.Bronze; } }

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

        [Constructable]
        public BronzeOre(int amount)
            : base(CraftResource.Bronze, amount)
        {
        Name = "Bronze Ore"; //daat99 OWLTR - custom resource name
        }

        public BronzeOre(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 override BaseIngot GetIngot()
        {
            return new BronzeIngot();
        }
    }

    public class GoldOre : BaseOre
    {
        protected override CraftResource DefaultResource { get { return CraftResource.Gold; } }

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

        [Constructable]
        public GoldOre(int amount)
            : base(CraftResource.Gold, amount)
        {
            Name = "Golden Ore"; //daat99 OWLTR - custom resource name
        }

        public GoldOre(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 override BaseIngot GetIngot()
        {
            return new GoldIngot();
        }
    }

    public class AgapiteOre : BaseOre
    {
        protected override CraftResource DefaultResource { get { return CraftResource.Agapite; } }

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

        [Constructable]
        public AgapiteOre(int amount)
            : base(CraftResource.Agapite, amount)
        {
            Name = "Agapite Ore"; //daat99 OWLTR - custom resource name
        }

        public AgapiteOre(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 override BaseIngot GetIngot()
        {
            return new AgapiteIngot();
        }
    }

    public class VeriteOre : BaseOre
    {
        protected override CraftResource DefaultResource { get { return CraftResource.Verite; } }

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

        [Constructable]
        public VeriteOre(int amount)
            : base(CraftResource.Verite, amount)
        {
            Name = "Verite Ore"; //daat99 OWLTR - custom resource name
        }

        public VeriteOre(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 override BaseIngot GetIngot()
        {
            return new VeriteIngot();
        }
    }

    public class ValoriteOre : BaseOre
    {
        protected override CraftResource DefaultResource { get { return CraftResource.Valorite; } }

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

        [Constructable]
        public ValoriteOre(int amount)
            : base(CraftResource.Valorite, amount)
        {
            Name = "Valorite Ore"; //daat99 OWLTR - custom resource name
        }

        public ValoriteOre(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 override BaseIngot GetIngot()
        {
            return new ValoriteIngot();
        }
    }
  
     public class BlazeOre : BaseOre
    {
        [Constructable]
        public BlazeOre()
            : this(1)
        {
        }

        [Constructable]
        public BlazeOre(int amount)
            : base(CraftResource.Blaze, amount)
        {
            Name = "Blaze Ore"; //daat99 OWLTR - custom resource name
        }

        public BlazeOre(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 override BaseIngot GetIngot()
        {
            return new BlazeIngot();
        }
    }
    public class IceOre : BaseOre
    {
        [Constructable]
        public IceOre()
            : this(1)
        {
        }

        [Constructable]
        public IceOre(int amount)
            : base(CraftResource.Ice, amount)
        {
            Name = "Ice Ore"; //daat99 OWLTR - custom resource name
        }

        public IceOre(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 override BaseIngot GetIngot()
        {
            return new IceIngot();
        }
    }
    public class ToxicOre : BaseOre
    {
        [Constructable]
        public ToxicOre()
            : this(1)
        {
        }

        [Constructable]
        public ToxicOre(int amount)
            : base(CraftResource.Toxic, amount)
        {
            Name = "Toxic Ore"; //daat99 OWLTR - custom resource name
        }

        public ToxicOre(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 override BaseIngot GetIngot()
        {
            return new ToxicIngot();
        }
    }
    public class ElectrumOre : BaseOre
    {
        [Constructable]
        public ElectrumOre()
            : this(1)
        {
        }

        [Constructable]
        public ElectrumOre(int amount)
            : base(CraftResource.Electrum, amount)
        {
            Name = "Electrum Ore"; //daat99 OWLTR - custom resource name
        }

        public ElectrumOre(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 override BaseIngot GetIngot()
        {
            return new ElectrumIngot();
        }
    }
    /*public class MytherilOre : BaseOre
    {
        [Constructable]
        public MytherilOre()
            : this(1)
        {
        }

        [Constructable]
        public MytherilOre(int amount)
            : base(CraftResource.MytherilOre, amount)
        {
            Name = "Mytheril Ore"; // Zeron's custom resource name
            Hue = 2625;
        }

        public MytherilOre(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 override BaseIngot GetIngot()
        {
            return new MytherilIngot();
        }
    }*/  
    public class PlatinumOre : BaseOre
    {
        [Constructable]
        public PlatinumOre()
            : this(1)
        {
        }

        [Constructable]
        public PlatinumOre(int amount)
            : base(CraftResource.Platinum, amount)
        {
            Name = "Platinum Ore"; //daat99 OWLTR - custom resource name
        }

        public PlatinumOre(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 override BaseIngot GetIngot()
        {
            return new PlatinumIngot();
        }
    }
}
 
it's not based on weight really. There are 3 types of ore.
small - 1/2 ingot
medium - 1 ingot
large 2 ingots

The larger ores do weight more, but weight isn't how it calculated, it's calculated based on the graphic of the ore.
 
an ingot doesn't match the ore. There are 2 ingots in an ore. The reason for this is in case you fail the smelt you lose 1 ingot out of an ore or half of your ore pile. It just the number they went with if they went with three ingots per ore it would still be possible as the ore pile is rather large compared to the ingots.
 
I just played around with the ItemId's to where the bigger pile would give out the half amount, that way it makes sence, to go along with the wording: You smelt the ore, removing the impurities and add the metal to your backpack!
In case anyone wants to set theirs like this here's the bit of coding I changed in my Ore.cs script:

C#:
                            int ingotAmount;

                            if (this.m_Ore.ItemID == 0x19B9) //a Lrg pile
                            {
                                ingotAmount = toConsume / 2; 
                                  from.SendMessage( "You smelt the ore, removing the impurities and add the metal to your backpack!" );
                                  if (toConsume % 1 != 0)
                                    --toConsume;
                                
                            }
                            else if (this.m_Ore.ItemID == 0x19B7)   //Sml pile
                            {
                                ingotAmount = toConsume * 1;
                                  from.SendMessage( "You smelt the ore, without impurities and add the metal to your backpack!" );
                                
                            }
                            //added ItemIDs
                            else if (this.m_Ore.ItemID == 0x19B8)   //Sml pile
                            {
                                ingotAmount = toConsume * 1;
                                  from.SendMessage( "You smelt the ore, without impurities and add the metal to your backpack!" );
                                
                            }
                            else if (this.m_Ore.ItemID == 0x19BA)   //Sml pile
                            {
                                ingotAmount = toConsume * 1;
                                  from.SendMessage( "You smelt the ore, without impurities and add the metal to your backpack!" );
                                
                            }
                                        
                            // finish added ItemIDs
                            
                            else
                            {
                                ingotAmount = toConsume;
                            }

                            BaseIngot ingot = this.m_Ore.GetIngot();
                            
                            ingot.Amount = ingotAmount;

                            this.m_Ore.Consume(toConsume);
                            from.AddToBackpack(ingot);
                            //from.PlaySound( 0x57 );

                            if (talisman && t != null)
                            {
                                t.UsesRemaining--;
                                from.SendLocalizedMessage(1152620); // The magic of your talisman guides your hands as you purify the metal. Success is ensured!
                            }
                            //else
                                //from.SendLocalizedMessage(501988); // You smelt the ore removing the impurities and put the metal in your backpack.
                        }
                    }
 
i actually did this once too a year or 2 ago. I thought the same thing. All it did was make the mining process more tedius. I ended up taking out the possibility of failing a smelt and kept it at 2 ingots per ore.
 
On my server whatever amount of ores you smelt you get double back and then this message: You smelt the ore removing the impurities and put the metal in your backpack.
So, by removing "impurities" why would I get double the amount of ingots back? Doesn't seem right to me.:rolleyes:
Was wondering can my script be set to where it'll give out half the amount of ingots to whatever amount of ores I start with?
Here's the part of my script where it shows adding ingots to my backpack. Just not sure how to reword the code to work. I tried putting 1's in all the places showing 2's and then it gave me back the exact amount of ingots to ores.
You are trying to complicate it :)

A pile of ore is very heavy. An ingot is not. Everyone who knows UO knows what to expect. If you halve the number of ingots miners get, you will have unhappy players. Also only the big pile of ore will ever produce an ingot. I recommend you leave it as the default, other than some shards remove the small ore size because you need two of those to produce one ingot and that's a pain.
 
Well if you think about rea life, if you stick a ton of iron ore into a blast furnace you don't get a ton of iron out. So it actually makes sense. :)
 
Well if you think about rea life, if you stick a ton of iron ore into a blast furnace you don't get a ton of iron out. So it actually makes sense. :)
Yeah, that's what I was going for;) But, I don't want players to be disgruntled either! Hmm... what to do.
 
On Renaissance, they got rid of the two smaller sizes so they just have the large pile which produces two ore. People seem to like that.
On my own shard I just left it the way it was.
 
i like the small piles... if you really want to make people happier reduce the weight of the ores to 0 lol. that way their backpacks will be filled with up to 24 piles of ores. lots of colors and stuff. i feel removing the small piles borifies me.
 
I'm interested in making the small, medium, and large ore graphics stackable with each other, the same way gold works. I can't even figure out how the gold works though - the Gold.cs script doesn't contain anything about how to make different item id's stack. In the core, Item.cs, I can find a bool StackIgnoreItemID but every effort I make to utilize that fails. Plus even if they could stack, which item id would prevail? I'm guessing gold is somehow handled in the client. Does anyone know how this works?
Post automatically merged:


Post automatically merged:

I tried putting a couple of override methods from item.cs in my script: StackWith and WillStack. I left off the parts checking if itemID's matched. This partially worked - drag-dropping into a container works but just trying to drop a "small" ore graphic onto a "medium" or "large" one on the map doesn't. I found a method in item.cs GetGraphicsBounds - it is only called by one line in container.cs (core); anyway it references different item id's used by coins. Calling it from my ore.cs script didn't make any difference.
 
Last edited:
Back