Пример #1
0
 public override void SerializeAttribute(OtItemAttribute attribute, OtPropertyWriter writer)
 {
     if (attribute == OtItemAttribute.HOUSEDOORID)
         writer.Write((byte)GetAttribute(attribute));
     else
         base.SerializeAttribute(attribute, writer);
 }
Пример #2
0
 public override void SerializeAttribute(OtItemAttribute attribute, OtPropertyWriter writer)
 {
     if (attribute == OtItemAttribute.TELE_DEST)
         writer.Write((Location)GetAttribute(attribute));
     else
         base.SerializeAttribute(attribute, writer);
 }
Пример #3
0
 public override void DeserializeAttribute(OtItemAttribute attribute, OtPropertyReader reader)
 {
     if (attribute == OtItemAttribute.CONTAINER_ITEMS)
         SetAttribute(OtItemAttribute.CONTAINER_ITEMS, reader.ReadUInt32());
     else
         base.DeserializeAttribute(attribute, reader);
 }
Пример #4
0
 public override void DeserializeAttribute(OtItemAttribute attribute, OtPropertyReader reader)
 {
     if (attribute == OtItemAttribute.TELE_DEST)
         SetAttribute(OtItemAttribute.TELE_DEST, reader.ReadLocation());
     else
         base.DeserializeAttribute(attribute, reader);
 }
Пример #5
0
 public override void DeserializeAttribute(OtItemAttribute attribute, OtPropertyReader reader)
 {
     if (attribute == OtItemAttribute.DEPOT_ID)
         SetAttribute(OtItemAttribute.DEPOT_ID, reader.ReadUInt16());
     else
         base.DeserializeAttribute(attribute, reader);
 }
Пример #6
0
 public override void SerializeAttribute(OtItemAttribute attribute, OtPropertyWriter writer)
 {
     if (attribute == OtItemAttribute.DEPOT_ID)
         writer.Write((ushort)GetAttribute(attribute));
     else
         base.SerializeAttribute(attribute, writer);
 }
Пример #7
0
 public override void DeserializeAttribute(OtItemAttribute attribute, OtPropertyReader reader)
 {
     if (attribute == OtItemAttribute.HOUSEDOORID)
         SetAttribute(OtItemAttribute.HOUSEDOORID, reader.ReadByte());
     else
         base.DeserializeAttribute(attribute, reader);
 }
Пример #8
0
 public void SetAttribute(OtItemAttribute attribute, object value)
 {
     if (attributes == null)
     {
         attributes = new Dictionary <OtItemAttribute, object>();
     }
     attributes[attribute] = value;
 }
Пример #9
0
        public object GetAttribute(OtItemAttribute attribute)
        {
            if (attributes == null || !attributes.ContainsKey(attribute))
            {
                return(null);
            }

            return(attributes[attribute]);
        }
Пример #10
0
 public override void DeserializeAttribute(OtItemAttribute attribute, OtPropertyReader reader)
 {
     if (attribute == OtItemAttribute.HOUSEDOORID)
     {
         SetAttribute(OtItemAttribute.HOUSEDOORID, reader.ReadByte());
     }
     else
     {
         base.DeserializeAttribute(attribute, reader);
     }
 }
Пример #11
0
 public override void SerializeAttribute(OtItemAttribute attribute, OtPropertyWriter writer)
 {
     if (attribute == OtItemAttribute.TELE_DEST)
     {
         writer.Write((Location)GetAttribute(attribute));
     }
     else
     {
         base.SerializeAttribute(attribute, writer);
     }
 }
Пример #12
0
 public override void DeserializeAttribute(OtItemAttribute attribute, OtPropertyReader reader)
 {
     if (attribute == OtItemAttribute.TELE_DEST)
     {
         SetAttribute(OtItemAttribute.TELE_DEST, reader.ReadLocation());
     }
     else
     {
         base.DeserializeAttribute(attribute, reader);
     }
 }
Пример #13
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);
     }
 }
Пример #14
0
 public override void DeserializeAttribute(OtItemAttribute attribute, OtPropertyReader reader)
 {
     if (attribute == OtItemAttribute.CONTAINER_ITEMS)
     {
         SetAttribute(OtItemAttribute.CONTAINER_ITEMS, reader.ReadUInt32());
     }
     else
     {
         base.DeserializeAttribute(attribute, reader);
     }
 }
Пример #15
0
 public override void SerializeAttribute(OtItemAttribute attribute, OtPropertyWriter writer)
 {
     if (attribute == OtItemAttribute.HOUSEDOORID)
     {
         writer.Write((byte)GetAttribute(attribute));
     }
     else
     {
         base.SerializeAttribute(attribute, writer);
     }
 }
Пример #16
0
 public override void SerializeAttribute(OtItemAttribute attribute, OtPropertyWriter writer)
 {
     if (attribute == OtItemAttribute.DEPOT_ID)
     {
         writer.Write((ushort)GetAttribute(attribute));
     }
     else
     {
         base.SerializeAttribute(attribute, writer);
     }
 }
Пример #17
0
 public override void DeserializeAttribute(OtItemAttribute attribute, OtPropertyReader reader)
 {
     if (attribute == OtItemAttribute.DEPOT_ID)
     {
         SetAttribute(OtItemAttribute.DEPOT_ID, reader.ReadUInt16());
     }
     else
     {
         base.DeserializeAttribute(attribute, reader);
     }
 }
Пример #18
0
        public virtual void DeserializeAttribute(OtItemAttribute attribute, OtPropertyReader reader)
        {
            switch (attribute)
            {
                case OtItemAttribute.COUNT:
                    SetAttribute(OtItemAttribute.COUNT, reader.ReadByte());
                    break;
                case OtItemAttribute.ACTION_ID:
                    SetAttribute(OtItemAttribute.ACTION_ID, reader.ReadUInt16());
                    break;
                case OtItemAttribute.UNIQUE_ID:
                    SetAttribute(OtItemAttribute.UNIQUE_ID, reader.ReadUInt16());
                    break;
                case OtItemAttribute.NAME:
                    SetAttribute(OtItemAttribute.NAME, reader.ReadString());
                    break;
                case OtItemAttribute.PLURALNAME:
                    SetAttribute(OtItemAttribute.PLURALNAME, reader.ReadString());
                    break;
                case OtItemAttribute.ARTICLE:
                    SetAttribute(OtItemAttribute.ARTICLE, reader.ReadString());
                    break;
                case OtItemAttribute.ATTACK:
                    SetAttribute(OtItemAttribute.ATTACK, reader.ReadInt32());
                    break;
                case OtItemAttribute.EXTRAATTACK:
                    SetAttribute(OtItemAttribute.EXTRAATTACK, reader.ReadInt32());
                    break;
                case OtItemAttribute.DEFENSE:
                    SetAttribute(OtItemAttribute.DEFENSE, reader.ReadInt32());
                    break;
                case OtItemAttribute.EXTRADEFENSE:
                    SetAttribute(OtItemAttribute.EXTRADEFENSE, reader.ReadInt32());
                    break;
                case OtItemAttribute.ARMOR:
                    SetAttribute(OtItemAttribute.ARMOR, reader.ReadInt32());
                    break;
                case OtItemAttribute.ATTACKSPEED:
                    SetAttribute(OtItemAttribute.ATTACKSPEED, reader.ReadInt32());
                    break;
                case OtItemAttribute.HITCHANCE:
                    SetAttribute(OtItemAttribute.HITCHANCE, reader.ReadInt32());
                    break;
                case OtItemAttribute.SCRIPTPROTECTED:
                    SetAttribute(OtItemAttribute.SCRIPTPROTECTED, reader.ReadByte() != 0);
                    break;
                case OtItemAttribute.DUALWIELD:
                    SetAttribute(OtItemAttribute.DUALWIELD, reader.ReadByte() != 0);
                    break;
                case OtItemAttribute.TEXT:
                    SetAttribute(OtItemAttribute.TEXT, reader.ReadString());
                    break;
                case OtItemAttribute.WRITTENDATE:
                    SetAttribute(OtItemAttribute.WRITTENDATE, reader.ReadInt32());
                    break;
                case OtItemAttribute.WRITTENBY:
                    SetAttribute(OtItemAttribute.WRITTENBY, reader.ReadString());
                    break;
                case OtItemAttribute.DESC:
                    SetAttribute(OtItemAttribute.DESC, reader.ReadString());
                    break;
                case OtItemAttribute.RUNE_CHARGES:
                    SetAttribute(OtItemAttribute.RUNE_CHARGES, reader.ReadByte());
                    break;
                case OtItemAttribute.CHARGES:
                    SetAttribute(OtItemAttribute.CHARGES, reader.ReadUInt16());
                    break;
                case OtItemAttribute.DURATION:
                    SetAttribute(OtItemAttribute.DURATION, reader.ReadInt32());
                    break;
                case OtItemAttribute.DECAYING_STATE:
                    SetAttribute(OtItemAttribute.DECAYING_STATE, reader.ReadByte());
                    break;

                //specific item properties
                //case OtItemAttribute.DEPOT_ID:
                //    SetAttribute(OtItemAttribute.DEPOT_ID, reader.ReadUInt16());
                //    break;
                //case OtItemAttribute.HOUSEDOORID:
                //    SetAttribute(OtItemAttribute.HOUSEDOORID, reader.ReadByte());
                //    break;
                //case OtItemAttribute.TELE_DEST:
                //    SetAttribute(OtItemAttribute.TELE_DEST, reader.ReadLocation());
                //    break;
                //case OtItemAttribute.SLEEPERGUID:
                //    SetAttribute(OtItemAttribute.SLEEPERGUID, reader.ReadUInt32());
                //    break;
                //case OtItemAttribute.SLEEPSTART:
                //    SetAttribute(OtItemAttribute.SLEEPSTART, reader.ReadUInt32());
                //    break;
                default:
                    throw new Exception("Unkonw item attribute: " + (byte)attribute);
            }
        }
Пример #19
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);
     }
 }
Пример #20
0
 public void SetAttribute(OtItemAttribute attribute, object value)
 {
     if (attributes == null)
         attributes = new Dictionary<OtItemAttribute, object>();
     attributes[attribute] = value;
 }
Пример #21
0
        public virtual void DeserializeAttribute(OtItemAttribute attribute, OtPropertyReader reader)
        {
            switch (attribute)
            {
            case OtItemAttribute.COUNT:
                SetAttribute(OtItemAttribute.COUNT, reader.ReadByte());
                break;

            case OtItemAttribute.ACTION_ID:
                SetAttribute(OtItemAttribute.ACTION_ID, reader.ReadUInt16());
                break;

            case OtItemAttribute.UNIQUE_ID:
                SetAttribute(OtItemAttribute.UNIQUE_ID, reader.ReadUInt16());
                break;

            case OtItemAttribute.NAME:
                SetAttribute(OtItemAttribute.NAME, reader.ReadString());
                break;

            case OtItemAttribute.PLURALNAME:
                SetAttribute(OtItemAttribute.PLURALNAME, reader.ReadString());
                break;

            case OtItemAttribute.ARTICLE:
                SetAttribute(OtItemAttribute.ARTICLE, reader.ReadString());
                break;

            case OtItemAttribute.ATTACK:
                SetAttribute(OtItemAttribute.ATTACK, reader.ReadInt32());
                break;

            case OtItemAttribute.EXTRAATTACK:
                SetAttribute(OtItemAttribute.EXTRAATTACK, reader.ReadInt32());
                break;

            case OtItemAttribute.DEFENSE:
                SetAttribute(OtItemAttribute.DEFENSE, reader.ReadInt32());
                break;

            case OtItemAttribute.EXTRADEFENSE:
                SetAttribute(OtItemAttribute.EXTRADEFENSE, reader.ReadInt32());
                break;

            case OtItemAttribute.ARMOR:
                SetAttribute(OtItemAttribute.ARMOR, reader.ReadInt32());
                break;

            case OtItemAttribute.ATTACKSPEED:
                SetAttribute(OtItemAttribute.ATTACKSPEED, reader.ReadInt32());
                break;

            case OtItemAttribute.HITCHANCE:
                SetAttribute(OtItemAttribute.HITCHANCE, reader.ReadInt32());
                break;

            case OtItemAttribute.SCRIPTPROTECTED:
                SetAttribute(OtItemAttribute.SCRIPTPROTECTED, reader.ReadByte() != 0);
                break;

            case OtItemAttribute.DUALWIELD:
                SetAttribute(OtItemAttribute.DUALWIELD, reader.ReadByte() != 0);
                break;

            case OtItemAttribute.TEXT:
                SetAttribute(OtItemAttribute.TEXT, reader.ReadString());
                break;

            case OtItemAttribute.WRITTENDATE:
                SetAttribute(OtItemAttribute.WRITTENDATE, reader.ReadInt32());
                break;

            case OtItemAttribute.WRITTENBY:
                SetAttribute(OtItemAttribute.WRITTENBY, reader.ReadString());
                break;

            case OtItemAttribute.DESC:
                SetAttribute(OtItemAttribute.DESC, reader.ReadString());
                break;

            case OtItemAttribute.RUNE_CHARGES:
                SetAttribute(OtItemAttribute.RUNE_CHARGES, reader.ReadByte());
                break;

            case OtItemAttribute.CHARGES:
                SetAttribute(OtItemAttribute.CHARGES, reader.ReadUInt16());
                break;

            case OtItemAttribute.DURATION:
                SetAttribute(OtItemAttribute.DURATION, reader.ReadInt32());
                break;

            case OtItemAttribute.DECAYING_STATE:
                SetAttribute(OtItemAttribute.DECAYING_STATE, reader.ReadByte());
                break;

            //specific item properties
            //case OtItemAttribute.DEPOT_ID:
            //    SetAttribute(OtItemAttribute.DEPOT_ID, reader.ReadUInt16());
            //    break;
            //case OtItemAttribute.HOUSEDOORID:
            //    SetAttribute(OtItemAttribute.HOUSEDOORID, reader.ReadByte());
            //    break;
            //case OtItemAttribute.TELE_DEST:
            //    SetAttribute(OtItemAttribute.TELE_DEST, reader.ReadLocation());
            //    break;
            //case OtItemAttribute.SLEEPERGUID:
            //    SetAttribute(OtItemAttribute.SLEEPERGUID, reader.ReadUInt32());
            //    break;
            //case OtItemAttribute.SLEEPSTART:
            //    SetAttribute(OtItemAttribute.SLEEPSTART, reader.ReadUInt32());
            //    break;
            default:
                throw new Exception("Unkonw item attribute: " + (byte)attribute);
            }
        }
Пример #22
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);
            }
        }
Пример #23
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);
 }
Пример #24
0
        public object GetAttribute(OtItemAttribute attribute)
        {
            if (attributes == null || !attributes.ContainsKey(attribute))
                return null;

            return attributes[attribute];
        }