示例#1
0
        /// <summary>
        /// Determine a match based on the given type object.
        /// </summary>
        /// <param name="type">Type to compare against</param>
        /// <returns>true if there is a match; false is there is no match</returns>
        public override bool Match(Type type)
        {
            if (RequiredType == null)
            {
                return(false);
            }

            return(type.GetInterfaces().Any(i => i.Equals(RequiredType)) || RequiredType.Equals(type.BaseType));
        }
 /// <summary>
 /// 必要性验证
 /// </summary>
 /// <param name="assertType"></param>
 public void Assert(RequiredType assertType)
 {
     GetType().GetProperties().ToList().ForEach(prop =>
     {
         if (assertType.HasFlag(prop.GetCustomAttribute <WeChatRequiredAttribute>()?.WeChatRequiredType ?? RequiredType.None))
         {
             prop.GetCustomAttribute <WeChatRequiredAttribute>().Valid(prop.GetValue(this));
         }
     });
 }
示例#3
0
        protected override void OnPreRender(EventArgs e)
        {
            this.Page.ClientScript.RegisterClientScriptInclude("webcontrolsscript",
                                                               Page.ClientScript.GetWebResourceUrl(this.GetType(), "WebControls.JS.WebControlsScript.js"));
            this.Page.ClientScript.RegisterClientScriptInclude("webvalidatscript",
                                                               Page.ClientScript.GetWebResourceUrl(this.GetType(), "WebControls.JS.jqueryvalidat.js"));

            string script = string.Empty;

            if (!string.IsNullOrEmpty(RegularExpressionString))
            {
                script += string.Format("$(document).ready(function(){{AddToVerifyArray($(\"#{0}\"),'{1}');}});\n",
                                        this.ClientID, this.RegularExpressionString);
            }

            if (!IsAllowNull)
            {
                script += string.Format("$(document).ready(function(){{AddToCheckNullArray($(\"#{0}\"));}});\n",
                                        this.ClientID);
            }

            if (IsReadOnly)
            {
                script += string.Format("$(document).ready(function(){{AddToDisabledArray($(\"#{0}\"));}});\n", this.ClientID);
            }

            if (!string.IsNullOrEmpty(script))
            {
                this.Page.ClientScript.RegisterStartupScript(this.GetType(), "startup" + this.ClientID, script, true);
            }

            //this.Attributes.Add("onmouseover", "showhintinfo(this, 0,0,'测试','email格式错误','20','up')");
            //this.Attributes.Add("onmouseout", "hidehintinfo()");
            if (RequiredType != DataType.Empty)
            {
                if (this.Attributes["onblur"] != null)
                {
                    this.Attributes.Add("onblur", string.Format("ValidatData('{0}','{1}',{2},{3},'{4}','{5}','{6}','{7}',{8});{9}", this.ClientID
                                                                , RequiredType.ToString().ToLower(), HintLeftOffSet, HintTopOffSet, HintTitle, HintInfo, HintHeight, HintShowType.ToString(), HintTimeOut, this.Attributes["onblur"]));
                }
                else
                {
                    this.Attributes.Add("onblur", string.Format("ValidatData('{0}','{1}',{2},{3},'{4}','{5}','{6}','{7}',{8});", this.ClientID
                                                                , RequiredType.ToString().ToLower(), HintLeftOffSet, HintTopOffSet, HintTitle, HintInfo, HintHeight, HintShowType.ToString(), HintTimeOut));
                }
            }

            //this.Page.ClientScript.RegisterOnSubmitStatement(this.Page.GetType(), "checkonsubmit", "return  CheckAll()");

            base.OnPreRender(e);
        }
        /// <summary>
        /// 属性名称,仅仅用于c#
        /// </summary>
        /// <param name="name"></param>
        /// <returns></returns>
        private string PropertyName(string name, RequiredType requiredType)
        {
            string[]      strings = name.Split(new string[] { "_" }, StringSplitOptions.RemoveEmptyEntries);
            StringBuilder sb      = new StringBuilder();

            for (int i = 0; i < strings.Length; i++)
            {
                sb.Append(StringUtil.ToFirstUpper(strings[i]));
            }
            if (requiredType == RequiredType.Repeated)
            {
                sb.Append("List");
            }
            return(sb.ToString());
        }
        /// <summary>
        /// 得到检查required的名称
        /// </summary>
        /// <param name="name"></param>
        /// <returns></returns>
        private string CheckRequiredName(string name, RequiredType requiredType)
        {
            string result = null;

            switch (LanguageType)
            {
            case LanguageType.CShape:
                result = "Has" + PropertyName(name, requiredType);
                break;

            case LanguageType.Java:
                result = "has" + PropertyName(name, requiredType);
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
            return(result);
        }
        public static Type ConvertTypeToGraphType(Type propertyType, RequiredType requiredType = RequiredType.Default, bool isInputType = false)
        {
            if (typeof(GraphType).IsAssignableFrom(propertyType))
            {
                return(propertyType);
            }

            if (requiredType == RequiredType.Default && propertyType.IsValueType)
            {
                if (propertyType.IsAssignableToGenericType(typeof(Nullable <>)))
                {
                    requiredType = RequiredType.NotRequired;
                    propertyType = propertyType.GetGenericArguments()[0];
                }
                else
                {
                    requiredType = RequiredType.Required;
                }
            }

            var graphType = BaseGraphType(propertyType, isInputType);

            if (propertyType == typeof(string) && isInputType)
            {
                return(graphType);
            }

            if (graphType.IsAssignableToGenericType(typeof(InputObjectGraphTypeWrapper <>)))
            {
                return(graphType);
            }

            if (graphType != null && requiredType == RequiredType.Required)
            {
                if (!typeof(NonNullGraphType).IsAssignableFrom(graphType))
                {
                    return(typeof(NonNullGraphType <>).MakeGenericType(graphType));
                }
            }

            return(graphType);
        }
示例#7
0
        public static void DrawRequired(Rect fieldRect, RequiredType requiredType)
        {
            if (requiredType == RequiredType.None)
            {
                return;
            }

            string iconPath    = string.Empty;
            string description = string.Empty;
            Color  color       = Color.white;

            switch (requiredType)
            {
            case RequiredType.Warning:
                iconPath    = "warning_icon";
                description = "Reference is desired! May be you forgot to provide a link.";
                color       = new Color(0.7f, 0.7f, 0.3f, 1f);
                break;

            case RequiredType.Error:
                iconPath    = "error_icon";
                description = "Reference is required! Please provide a link, otherwise this component will not be able to start properly.";
                color       = new Color(0.7f, 0.3f, 0.3f, 1f);
                break;
            }

            var icon     = Resources.Load <Texture>("EditorAssets/" + iconPath);
            var iconRect = fieldRect;

            iconRect.width = iconRect.height;
            iconRect.x     = fieldRect.width - iconRect.width;
            using (new GUILayoutExt.GUIColorUsing(color)) {
                GUI.DrawTexture(iconRect, icon);
                GUI.Label(iconRect, new GUIContent(string.Empty, description));
            }
        }
示例#8
0
 /// <summary>Validates the selected item.</summary>
 public void Validate()
 {
     IsValid = RequiredType == null ||
               SelectedItem == null ||
               RequiredType.IsAssignableFrom(SelectedItem.GetContentType());
 }
示例#9
0
    public ItemInfo(BinaryReader reader, int version = int.MaxValue, int Customversion = int.MaxValue)
    {
        Index = reader.ReadInt32();
        Name = reader.ReadString();
        Type = (ItemType) reader.ReadByte();
        if (version >= 40) Grade = (ItemGrade)reader.ReadByte();
        RequiredType = (RequiredType) reader.ReadByte();
        RequiredClass = (RequiredClass) reader.ReadByte();
        RequiredGender = (RequiredGender) reader.ReadByte();
        if(version >= 17) Set = (ItemSet)reader.ReadByte();

        Shape = version >= 30 ? reader.ReadInt16() : reader.ReadSByte();
        Weight = reader.ReadByte();
        Light = reader.ReadByte();
        RequiredAmount = reader.ReadByte();

        Image = reader.ReadUInt16();
        Durability = reader.ReadUInt16();

        StackSize = reader.ReadUInt32();
        Price = reader.ReadUInt32();

        MinAC = reader.ReadByte();
        MaxAC = reader.ReadByte();
        MinMAC = reader.ReadByte();
        MaxMAC = reader.ReadByte();
        MinDC = reader.ReadByte();
        MaxDC = reader.ReadByte();
        MinMC = reader.ReadByte();
        MaxMC = reader.ReadByte();
        MinSC = reader.ReadByte();
        MaxSC = reader.ReadByte();
        if (version < 25)
        {
            HP = reader.ReadByte();
            MP = reader.ReadByte();
        }
        else
        {
            HP = reader.ReadUInt16();
            MP = reader.ReadUInt16();
        }
        Accuracy = reader.ReadByte();
        Agility = reader.ReadByte();

        Luck = reader.ReadSByte();
        AttackSpeed = reader.ReadSByte();

        StartItem = reader.ReadBoolean();

        BagWeight = reader.ReadByte();
        HandWeight = reader.ReadByte();
        WearWeight = reader.ReadByte();

        if (version >= 9) Effect = reader.ReadByte();
        if (version >= 20)
        {
            Strong = reader.ReadByte();
            MagicResist = reader.ReadByte();
            PoisonResist = reader.ReadByte();
            HealthRecovery = reader.ReadByte();
            SpellRecovery = reader.ReadByte();
            PoisonRecovery = reader.ReadByte();
            HPrate = reader.ReadByte();
            MPrate = reader.ReadByte();
            CriticalRate = reader.ReadByte();
            CriticalDamage = reader.ReadByte();
            byte bools = reader.ReadByte();
            NeedIdentify = (bools & 0x01) == 0x01;
            ShowGroupPickup = (bools & 0x02) == 0x02;
            ClassBased = (bools & 0x04) == 0x04;
            LevelBased = (bools & 0x08) == 0x08;
            CanMine = (bools & 0x10) == 0x10;
            MaxAcRate = reader.ReadByte();
            MaxMacRate = reader.ReadByte();
            Holy = reader.ReadByte();
            Freezing = reader.ReadByte();
            PoisonAttack = reader.ReadByte();
            if (version < 55)
            {
                Bind = (BindMode)reader.ReadByte();
            }
            else
            {
                Bind = (BindMode)reader.ReadInt16();
            }
            
        }
        if (version >= 21)
        {
            Reflect = reader.ReadByte();
            HpDrainRate = reader.ReadByte();
            Unique = (SpecialItemMode)reader.ReadInt16();
        }
        if (version >= 24)
        {
            RandomStatsId = reader.ReadByte();
        }
        else
        {
            RandomStatsId = 255;
            if ((Type == ItemType.Weapon) || (Type == ItemType.Armour) || (Type == ItemType.Helmet) || (Type == ItemType.Necklace) || (Type == ItemType.Bracelet) || (Type == ItemType.Ring) || (Type == ItemType.Mount))
                RandomStatsId = (byte)Type;
            if ((Type == ItemType.Belt) || (Type == ItemType.Boots))
                RandomStatsId = 7;
        }

        if (version >= 40) CanFastRun = reader.ReadBoolean();

        if (version >= 41)
        {
            CanAwakening = reader.ReadBoolean();
            bool isTooltip = reader.ReadBoolean();
            if (isTooltip)
                ToolTip = reader.ReadString();
        }
    }
示例#10
0
文件: ItemData.cs 项目: cpp1992/mir2
    public ItemInfo(BinaryReader reader, int version = int.MaxValue, int Customversion = int.MaxValue)
    {
        Index          = reader.ReadInt32();
        Name           = reader.ReadString();
        Type           = (ItemType)reader.ReadByte();
        Grade          = (ItemGrade)reader.ReadByte();
        RequiredType   = (RequiredType)reader.ReadByte();
        RequiredClass  = (RequiredClass)reader.ReadByte();
        RequiredGender = (RequiredGender)reader.ReadByte();
        Set            = (ItemSet)reader.ReadByte();

        Shape          = reader.ReadInt16();
        Weight         = reader.ReadByte();
        Light          = reader.ReadByte();
        RequiredAmount = reader.ReadByte();

        Image      = reader.ReadUInt16();
        Durability = reader.ReadUInt16();

        StackSize = reader.ReadUInt32();
        Price     = reader.ReadUInt32();

        MinAC    = reader.ReadByte();
        MaxAC    = reader.ReadByte();
        MinMAC   = reader.ReadByte();
        MaxMAC   = reader.ReadByte();
        MinDC    = reader.ReadByte();
        MaxDC    = reader.ReadByte();
        MinMC    = reader.ReadByte();
        MaxMC    = reader.ReadByte();
        MinSC    = reader.ReadByte();
        MaxSC    = reader.ReadByte();
        HP       = reader.ReadUInt16();
        MP       = reader.ReadUInt16();
        Accuracy = reader.ReadByte();
        Agility  = reader.ReadByte();

        Luck        = reader.ReadSByte();
        AttackSpeed = reader.ReadSByte();

        StartItem = reader.ReadBoolean();

        BagWeight  = reader.ReadByte();
        HandWeight = reader.ReadByte();
        WearWeight = reader.ReadByte();

        Effect         = reader.ReadByte();
        Strong         = reader.ReadByte();
        MagicResist    = reader.ReadByte();
        PoisonResist   = reader.ReadByte();
        HealthRecovery = reader.ReadByte();
        SpellRecovery  = reader.ReadByte();
        PoisonRecovery = reader.ReadByte();
        HPrate         = reader.ReadByte();
        MPrate         = reader.ReadByte();
        CriticalRate   = reader.ReadByte();
        CriticalDamage = reader.ReadByte();
        byte bools = reader.ReadByte();

        NeedIdentify    = (bools & 0x01) == 0x01;
        ShowGroupPickup = (bools & 0x02) == 0x02;
        ClassBased      = (bools & 0x04) == 0x04;
        LevelBased      = (bools & 0x08) == 0x08;
        CanMine         = (bools & 0x10) == 0x10;

        if (version >= 77)
        {
            GlobalDropNotify = (bools & 0x20) == 0x20;
        }

        MaxAcRate     = reader.ReadByte();
        MaxMacRate    = reader.ReadByte();
        Holy          = reader.ReadByte();
        Freezing      = reader.ReadByte();
        PoisonAttack  = reader.ReadByte();
        Bind          = (BindMode)reader.ReadInt16();
        Reflect       = reader.ReadByte();
        HpDrainRate   = reader.ReadByte();
        Unique        = (SpecialItemMode)reader.ReadInt16();
        RandomStatsId = reader.ReadByte();

        CanFastRun = reader.ReadBoolean();

        CanAwakening = reader.ReadBoolean();
        bool isTooltip = reader.ReadBoolean();

        if (isTooltip)
        {
            ToolTip = reader.ReadString();
        }

        if (version < 70) //before db version 70 all specialitems had wedding rings disabled, after that it became a server option
        {
            if ((Type == ItemType.Ring) && (Unique != SpecialItemMode.None))
            {
                Bind |= BindMode.NoWeddingRing;
            }
        }
    }
示例#11
0
        public override string ToString()
        {
            StringBuilder sb = new StringBuilder();

            sb.Append("{");
            sb.Append(string.Format("RequiredType = {0},DataType = {1},DataName = {2},Name = {3},FieldNumber = {4},", RequiredType.ToString(), DataType.ToString(), DataName, Name, FieldNumber));

            sb.Append("Summarys:[");

            for (int i = 0; i < Summarys.Count; i++)
            {
                if (i == Summarys.Count - 1)
                {
                    sb.Append(Summarys[i]);
                }
                else
                {
                    sb.Append(Summarys[i]).Append(",");
                }
            }
            sb.Append("]");
            sb.Append("}");
            return(sb.ToString());
        }
示例#12
0
        private static bool AddFieldToContentType(SPContentType contentType, SPField field, bool updateContentType, RequiredType isRequired)
        {
            // Create the field ref.
            SPFieldLink fieldOneLink = new SPFieldLink(field);
            if (contentType.FieldLinks[fieldOneLink.Id] == null)
            {
                // Set the RequiredType value on the Content Type
                switch (isRequired)
                {
                    case RequiredType.Required:
                        fieldOneLink.Required = true;
                        break;
                    case RequiredType.NotRequired:
                        fieldOneLink.Required = false;
                        break;
                    case RequiredType.Inherit:
                    default:
                        // Do nothing, it will inherit from the Field definition
                        break;
                }

                // Field is not in the content type so we add it.
                contentType.FieldLinks.Add(fieldOneLink);

                // Update the content type.
                if (updateContentType)
                {
                    contentType.Update(true);
                }

                return true;
            }

            return false;
        }
示例#13
0
 public RequiredScopeAttribute(ScopeType scope, RequiredType required)
 {
     this.Scope    = scope;
     this.Required = required;
 }
 /// <summary>
 /// 属性名称,仅仅用于c#
 /// </summary>
 /// <param name="name"></param>
 /// <returns></returns>
 private string PropertyName(string name,RequiredType requiredType)
 {
     string[] strings = name.Split(new string[] { "_" }, StringSplitOptions.RemoveEmptyEntries);
     StringBuilder sb = new StringBuilder();
     for (int i = 0; i < strings.Length; i++)
     {
         sb.Append(StringUtil.ToFirstUpper(strings[i]));
     }
     if (requiredType == RequiredType.Repeated)
     {
         sb.Append("List");
     }
     return sb.ToString();
 }
示例#15
0
    public ItemInfo(BinaryReader reader, int version = int.MaxValue)
    {
        Index = reader.ReadInt32();
        Name = reader.ReadString();
        Type = (ItemType) reader.ReadByte();
        RequiredType = (RequiredType) reader.ReadByte();
        RequiredClass = (RequiredClass) reader.ReadByte();
        RequiredGender = (RequiredGender) reader.ReadByte();

        Shape = reader.ReadSByte();
        Weight = reader.ReadByte();
        Light = reader.ReadByte();
        RequiredAmount = reader.ReadByte();

        Image = reader.ReadUInt16();
        Durability = reader.ReadUInt16();

        StackSize = reader.ReadUInt32();
        Price = reader.ReadUInt32();

        MinAC = reader.ReadByte();
        MaxAC = reader.ReadByte();
        MinMAC = reader.ReadByte();
        MaxMAC = reader.ReadByte();
        MinDC = reader.ReadByte();
        MaxDC = reader.ReadByte();
        MinMC = reader.ReadByte();
        MaxMC = reader.ReadByte();
        MinSC = reader.ReadByte();
        MaxSC = reader.ReadByte();
        HP = reader.ReadByte();
        MP = reader.ReadByte();
        Accuracy = reader.ReadByte();
        Agility = reader.ReadByte();

        Luck = reader.ReadSByte();
        AttackSpeed = reader.ReadSByte();

        StartItem = reader.ReadBoolean();

        BagWeight = reader.ReadByte();
        HandWeight = reader.ReadByte();
        WearWeight = reader.ReadByte();

        if (version >= 9) Effect = reader.ReadByte();
    }
 /// <summary>
 /// 得到检查required的名称
 /// </summary>
 /// <param name="name"></param>
 /// <returns></returns>
 private string CheckRequiredName(string name,RequiredType requiredType)
 {
     string result = null;
     switch (LanguageType)
     {
         case LanguageType.CShape:
             result = "Has" + PropertyName(name,requiredType);
             break;
         case LanguageType.Java:
             result = "has" + PropertyName(name,requiredType);
             break;
         default:
             throw new ArgumentOutOfRangeException();
     }
     return result;
 }
示例#17
0
 public Required(RequiredType requiredType)
 {
     Type = requiredType;
 }
 public WeChatRequiredAttribute(RequiredType weChatRequiredType = RequiredType.App)
 {
     WeChatRequiredType = weChatRequiredType;
 }
示例#19
0
        private static bool AddFieldToContentType(SPContentType contentType, SPField field, bool updateContentType, RequiredType isRequired)
        {
            // Create the field ref.
            SPFieldLink fieldOneLink = new SPFieldLink(field);

            if (contentType.FieldLinks[fieldOneLink.Id] == null)
            {
                // Set the RequiredType value on the Content Type
                switch (isRequired)
                {
                case RequiredType.Required:
                    fieldOneLink.Required = true;
                    break;

                case RequiredType.NotRequired:
                    fieldOneLink.Required = false;
                    break;

                case RequiredType.Inherit:
                default:
                    // Do nothing, it will inherit from the Field definition
                    break;
                }

                // Field is not in the content type so we add it.
                contentType.FieldLinks.Add(fieldOneLink);

                // Update the content type.
                if (updateContentType)
                {
                    contentType.Update(true);
                }

                return(true);
            }

            return(false);
        }
 public GraphNotRequiredAttribute(RequiredType type = RequiredType.NotRequired)
 {
     Type = type;
 }
示例#21
0
    public ItemInfo(BinaryReader reader, int version = int.MaxValue, int customVersion = int.MaxValue)
    {
        Index          = reader.ReadInt32();
        Name           = reader.ReadString();
        Type           = (ItemType)reader.ReadByte();
        Grade          = (ItemGrade)reader.ReadByte();
        RequiredType   = (RequiredType)reader.ReadByte();
        RequiredClass  = (RequiredClass)reader.ReadByte();
        RequiredGender = (RequiredGender)reader.ReadByte();
        Set            = (ItemSet)reader.ReadByte();

        Shape          = reader.ReadInt16();
        Weight         = reader.ReadByte();
        Light          = reader.ReadByte();
        RequiredAmount = reader.ReadByte();

        Image      = reader.ReadUInt16();
        Durability = reader.ReadUInt16();

        if (version <= 84)
        {
            StackSize = (ushort)reader.ReadUInt32();
        }
        else
        {
            StackSize = reader.ReadUInt16();
        }

        Price = reader.ReadUInt32();

        if (version <= 84)
        {
            Stats                = new Stats();
            Stats[Stat.MinAC]    = reader.ReadByte();
            Stats[Stat.MaxAC]    = reader.ReadByte();
            Stats[Stat.MinMAC]   = reader.ReadByte();
            Stats[Stat.MaxMAC]   = reader.ReadByte();
            Stats[Stat.MinDC]    = reader.ReadByte();
            Stats[Stat.MaxDC]    = reader.ReadByte();
            Stats[Stat.MinMC]    = reader.ReadByte();
            Stats[Stat.MaxMC]    = reader.ReadByte();
            Stats[Stat.MinSC]    = reader.ReadByte();
            Stats[Stat.MaxSC]    = reader.ReadByte();
            Stats[Stat.HP]       = reader.ReadUInt16();
            Stats[Stat.MP]       = reader.ReadUInt16();
            Stats[Stat.Accuracy] = reader.ReadByte();
            Stats[Stat.Agility]  = reader.ReadByte();

            Stats[Stat.Luck]        = reader.ReadSByte();
            Stats[Stat.AttackSpeed] = reader.ReadSByte();
        }

        StartItem = reader.ReadBoolean();

        if (version <= 84)
        {
            Stats[Stat.BagWeight]  = reader.ReadByte();
            Stats[Stat.HandWeight] = reader.ReadByte();
            Stats[Stat.WearWeight] = reader.ReadByte();
        }

        Effect = reader.ReadByte();

        if (version <= 84)
        {
            Stats[Stat.Strong]         = reader.ReadByte();
            Stats[Stat.MagicResist]    = reader.ReadByte();
            Stats[Stat.PoisonResist]   = reader.ReadByte();
            Stats[Stat.HealthRecovery] = reader.ReadByte();
            Stats[Stat.SpellRecovery]  = reader.ReadByte();
            Stats[Stat.PoisonRecovery] = reader.ReadByte();
            Stats[Stat.HPRatePercent]  = reader.ReadByte();
            Stats[Stat.MPRatePercent]  = reader.ReadByte();
            Stats[Stat.CriticalRate]   = reader.ReadByte();
            Stats[Stat.CriticalDamage] = reader.ReadByte();
        }


        byte bools = reader.ReadByte();

        NeedIdentify    = (bools & 0x01) == 0x01;
        ShowGroupPickup = (bools & 0x02) == 0x02;
        ClassBased      = (bools & 0x04) == 0x04;
        LevelBased      = (bools & 0x08) == 0x08;
        CanMine         = (bools & 0x10) == 0x10;

        if (version >= 77)
        {
            GlobalDropNotify = (bools & 0x20) == 0x20;
        }

        if (version <= 84)
        {
            Stats[Stat.MaxACRatePercent]  = reader.ReadByte();
            Stats[Stat.MaxMACRatePercent] = reader.ReadByte();
            Stats[Stat.Holy]         = reader.ReadByte();
            Stats[Stat.Freezing]     = reader.ReadByte();
            Stats[Stat.PoisonAttack] = reader.ReadByte();
        }

        Bind = (BindMode)reader.ReadInt16();

        if (version <= 84)
        {
            Stats[Stat.Reflect]            = reader.ReadByte();
            Stats[Stat.HPDrainRatePercent] = reader.ReadByte();
        }

        Unique        = (SpecialItemMode)reader.ReadInt16();
        RandomStatsId = reader.ReadByte();

        CanFastRun = reader.ReadBoolean();

        CanAwakening = reader.ReadBoolean();

        if (version > 83)
        {
            Slots = reader.ReadByte();
        }

        if (version > 84)
        {
            Stats = new Stats(reader);
        }

        bool isTooltip = reader.ReadBoolean();

        if (isTooltip)
        {
            ToolTip = reader.ReadString();
        }

        if (version < 70) //before db version 70 all specialitems had wedding rings disabled, after that it became a server option
        {
            if ((Type == ItemType.Ring) && (Unique != SpecialItemMode.None))
            {
                Bind |= BindMode.NoWeddingRing;
            }
        }
    }
 public ResourceTypeAttribute(System.Type type, RequiredType required = RequiredType.None)
 {
     this.type     = type;
     this.required = required;
 }