// Generate By EToy
// Don't Edit It!!

using XGame.Framework.Database;
using XGame.Framework.Serialization;

namespace XGame.Database
{
    /// <summary> Equipment </summary>
    public sealed class EquipmentTable : ITable
    {
        long ITable.Key => Id;

        /// <summary> 部位*100000+类型*10000+品质*100+序号定制ID：1000000+部位*100000+类型*10000+品质*100+序号 </summary>
        public int Id { get; private set; }

        /// <summary> 名称 </summary>
        public string Name { get; private set; } // c

        /// <summary> 图标 </summary>
        public string Icon { get; private set; } // c

        /// <summary> 1普通：正常掉落2活动：定制 </summary>
        public int Type { get; private set; } // c

        /// <summary> 生成等级0：跟随角色(对应类型的1)非0：定制到对应等级 </summary>
        public int Level { get; private set; }

        /// <summary> 部位1：武器2：头3：衣服4：手5：裤子6：鞋子 </summary>
        public EEquipType Part { get; private set; } // sc

        /// <summary> 品质1：白2：绿3：蓝4：紫5：黄6：橙7：红8：粉9：蓝钻10：鎏金11：璀璨 </summary>
        public EQualityLevel Quality { get; private set; } // sc

        void ISerializable.Deserialize(IReader reader)
        {
            Id = reader.ReadInt();
            Name = reader.ReadString();
            Icon = reader.ReadString();
            Type = reader.ReadInt();
            Level = reader.ReadInt();
            Part = (EEquipType)reader.ReadInt();
            Quality = (EQualityLevel)reader.ReadInt();
        }

        void ISerializable.Serialize(IWriter writer)
        {
            writer.Write(Id);
            writer.Write(Name);
            writer.Write(Icon);
            writer.Write(Type);
            writer.Write(Level);
            writer.Write((int)Part);
            writer.Write((int)Quality);
        }
    }
}
