Ejemplo n.º 1
0
        public virtual void Serialize(PropertyWriter writer)
        {
            if (attributes == null)
            {
                return;
            }

            foreach (var attr in attributes)
            {
                writer.Write((byte)attr.Key);
                SerializeAttribute(attr.Key, writer);
            }
        }
Ejemplo n.º 2
0
        public virtual void SerializeAttribute(OtItemAttribute attribute, PropertyWriter 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);
            }
        }