Lemke

Citizen
Hello!
Just see the add properties attachment seems to work on some items,and not working on others,here pics:
1.png2.png
Here the code from the full attachment:

C#:
using System;
using System.Collections;
using System.Collections.Generic;
using Server.Items;
using Server.Mobiles;



namespace Server.Engines.XmlSpawner2
{
    public class GenericEnchanted : XmlAttachment
    {
        
        [Attachable]
        public GenericEnchanted() {}

       public GenericEnchanted(ASerial serial) : base(serial){}

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

            writer.Write((int)0);
        }

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

            int version = reader.ReadInt();
        }
        
        public override void OnAttach()
        {
            base.OnAttach();

            if (this.AttachedTo is Item)
            {
                ((Item)this.AttachedTo).InvalidateProperties();
                
            }
        }


        public override void AddProperties(ObjectPropertyList list)
        {
            base.AddProperties(list);
            
             if (AttachedTo is Item)
             {
                list.Add("<BASEFONT COLOR=#F80BF1>[Enchanted]<BASEFONT COLOR=#FFFFFF>");
             }
        }

      
    }
}
Any advice?Thank you!
 

tass23

Moderator
Hello!
Just see the add properties attachment seems to work on some items,and not working on others,here pics:
View attachment 19413View attachment 19414
Here the code from the full attachment:

C#:
using System;
using System.Collections;
using System.Collections.Generic;
using Server.Items;
using Server.Mobiles;



namespace Server.Engines.XmlSpawner2
{
    public class GenericEnchanted : XmlAttachment
    {
       
        [Attachable]
        public GenericEnchanted() {}

       public GenericEnchanted(ASerial serial) : base(serial){}

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

            writer.Write((int)0);
        }

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

            int version = reader.ReadInt();
        }
       
        public override void OnAttach()
        {
            base.OnAttach();

            if (this.AttachedTo is Item)
            {
                ((Item)this.AttachedTo).InvalidateProperties();
               
            }
        }


        public override void AddProperties(ObjectPropertyList list)
        {
            base.AddProperties(list);
           
             if (AttachedTo is Item)
             {
                list.Add("<BASEFONT COLOR=#F80BF1>[Enchanted]<BASEFONT COLOR=#FFFFFF>");
             }
        }

     
    }
}
Any advice?Thank you!
Hi Lem :)
Items handle AddProperties a bit differently. Weapons and Armor work with AddProperties, but Jewelry for example only has GetProperties. So this attachment is only going to work on items that have AddProperties and not if it has GetProperties. :)