public override void DeserializeAttribute(OtItemAttribute attribute, OtPropertyReader reader)
 {
     if (attribute == OtItemAttribute.DEPOT_ID)
         SetAttribute(OtItemAttribute.DEPOT_ID, reader.ReadUInt16());
     else
         base.DeserializeAttribute(attribute, reader);
 }
示例#2
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);
            }
        }