Example #1
0
 public override void SerializeAttribute(OtItemAttribute attribute, OtPropertyWriter writer)
 {
     if (attribute == OtItemAttribute.DEPOT_ID)
     {
         writer.Write((ushort)GetAttribute(attribute));
     }
     else
     {
         base.SerializeAttribute(attribute, writer);
     }
 }
Example #2
0
 public override void SerializeAttribute(OtItemAttribute attribute, OtPropertyWriter writer)
 {
     if (attribute == OtItemAttribute.HOUSEDOORID)
     {
         writer.Write((byte)GetAttribute(attribute));
     }
     else
     {
         base.SerializeAttribute(attribute, writer);
     }
 }
Example #3
0
 public override void SerializeAttribute(OtItemAttribute attribute, OtPropertyWriter writer)
 {
     if (attribute == OtItemAttribute.TELE_DEST)
     {
         writer.Write((Location)GetAttribute(attribute));
     }
     else
     {
         base.SerializeAttribute(attribute, writer);
     }
 }
Example #4
0
 public override void SerializeAttribute(OtItemAttribute attribute, OtPropertyWriter writer)
 {
     if (attribute == OtItemAttribute.CONTAINER_ITEMS)
     {
         writer.Write((uint)(items != null ? items.Count : 0));
     }
     else
     {
         base.SerializeAttribute(attribute, writer);
     }
 }
Example #5
0
        public virtual void Serialize(OtPropertyWriter writer)
        {
            if (attributes == null)
            {
                return;
            }

            foreach (var attr in attributes)
            {
                writer.Write((byte)attr.Key);
                SerializeAttribute(attr.Key, writer);
            }
        }
Example #6
0
        public virtual void SerializeAttribute(OtItemAttribute attribute, OtPropertyWriter writer)
        {
            switch (attribute)
            {
            case OtItemAttribute.COUNT:
                writer.Write((byte)GetAttribute(attribute));
                break;

            case OtItemAttribute.ACTION_ID:
                writer.Write((ushort)GetAttribute(attribute));
                break;

            case OtItemAttribute.UNIQUE_ID:
                writer.Write((ushort)GetAttribute(attribute));
                break;

            case OtItemAttribute.NAME:
                writer.Write((string)GetAttribute(attribute));
                break;

            case OtItemAttribute.PLURALNAME:
                writer.Write((string)GetAttribute(attribute));
                break;

            case OtItemAttribute.ARTICLE:
                writer.Write((string)GetAttribute(attribute));
                break;

            case OtItemAttribute.ATTACK:
                writer.Write((int)GetAttribute(attribute));
                break;

            case OtItemAttribute.EXTRAATTACK:
                writer.Write((int)GetAttribute(attribute));
                break;

            case OtItemAttribute.DEFENSE:
                writer.Write((int)GetAttribute(attribute));
                break;

            case OtItemAttribute.EXTRADEFENSE:
                writer.Write((int)GetAttribute(attribute));
                break;

            case OtItemAttribute.ARMOR:
                writer.Write((int)GetAttribute(attribute));
                break;

            case OtItemAttribute.ATTACKSPEED:
                writer.Write((int)GetAttribute(attribute));
                break;

            case OtItemAttribute.HITCHANCE:
                writer.Write((int)GetAttribute(attribute));
                break;

            case OtItemAttribute.SCRIPTPROTECTED:
                writer.Write((byte)((bool)GetAttribute(attribute) ? 1 : 0));
                break;

            case OtItemAttribute.DUALWIELD:
                writer.Write((byte)((bool)GetAttribute(attribute) ? 1 : 0));
                break;

            case OtItemAttribute.TEXT:
                writer.Write((string)GetAttribute(attribute));
                break;

            case OtItemAttribute.WRITTENDATE:
                writer.Write((int)GetAttribute(attribute));
                break;

            case OtItemAttribute.WRITTENBY:
                writer.Write((string)GetAttribute(attribute));
                break;

            case OtItemAttribute.DESC:
                writer.Write((string)GetAttribute(attribute));
                break;

            case OtItemAttribute.RUNE_CHARGES:
                writer.Write((byte)GetAttribute(attribute));
                break;

            case OtItemAttribute.CHARGES:
                writer.Write((ushort)GetAttribute(attribute));
                break;

            case OtItemAttribute.DURATION:
                writer.Write((int)GetAttribute(attribute));
                break;

            case OtItemAttribute.DECAYING_STATE:
                writer.Write((byte)GetAttribute(attribute));
                break;

            default:
                throw new Exception("Unkonw item attribute: " + attribute);
            }
        }