Dramoor

Member
So I was going to have an item have the date they got the item added under the reward they got. I just want the year really.....What would be the best way to do that? Any help? Would u go normal on the Properties list? I am more needing to figure out how to add that. Thanks.
 
Would you mind posting your finding for others to use when looking this question up?
I don't need the answer but others might sometime.

;):D
 
Here is the finished product for my item.

Code:
using System;
namespace Server.Items
{
    public class RewardItem : Item
    {
        private string m_dateobtained;
        [Constructable]
        public RewardItem( int itemid, string name, int hue ) : base( itemid )
        {
            Weight = 1.0;
            Name = name;
            Hue = hue;
            DateTime dt = DateTime.Now;
            m_dateobtained = dt.ToString("yyyy");
        }

        public override void GetProperties(ObjectPropertyList list)
        {
            base.GetProperties(list);
            list.Add("Found in {0}", m_dateobtained);
        }

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

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

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

            writer.Write((string)this.m_dateobtained);

        }

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

            int version = reader.ReadInt();
            switch (version)
            {
                case 0:
                    {
                        this.m_dateobtained = reader.ReadString();

                        break;
                    }
            }
        }
    }
}
 

Active Shards

Donations

Total amount
$0.00
Goal
$1,000.00
Back