Пример #1
0
        public static TargetCondition LoadFromXml(SecurityElement element)
        {
            int num = TypeNameContainer <_Type> .Parse(element.Attribute("Type"), 0);

            if (num == 0)
            {
                return(null);
            }
            TargetCondition condition = new TargetCondition {
                type = num
            };

            switch (num)
            {
            case 1:
            case 2:
            case 3:
                condition.intValue = TypeNameContainer <_SubType> .Parse(element.Text, 0);

                return(condition);

            case 4:
            case 5:
            case 0x10:
            case 0x11:
                return(condition);

            case 6:
                condition.stringValue = StrParser.ParseStr(element.Text, condition.stringValue);
                condition.intValue    = TypeNameContainer <_ConditionValueCompareType> .Parse(element.Attribute("Compare"), condition.intValue);

                condition.doubleValue = StrParser.ParseDouble(element.Attribute("CompareValue"), condition.doubleValue);
                return(condition);

            case 7:
            case 8:
                condition.boolValue = StrParser.ParseBool(element.Attribute("SingleRowColumn"), false);
                condition.intValue  = TypeNameContainer <_SubType> .Parse(element.Text, 0);

                return(condition);

            case 9:
                condition.intValue = StrParser.ParseDecInt(element.Text, 0);
                return(condition);

            case 10:
                condition.intValue = TypeNameContainer <_SubType> .Parse(element.Text, 0);

                condition.intValue1 = TypeNameContainer <_AvatarAttributeType> .Parse(element.Attribute("AttributeType"), 0);

                condition.boolValue = StrParser.ParseBool(element.Attribute("AscendingSort"), true);
                return(condition);

            case 11:
                condition.intValue = TypeNameContainer <AvatarConfig._AvatarCountryType> .ParseBitList(element.Text, 0);

                return(condition);

            case 12:
            {
                string[] strArray = element.Text.Split(new char[] { ',' });
                condition.intValue  = StrParser.ParseDecInt(strArray[0], 1);
                condition.intValue1 = StrParser.ParseDecInt(strArray[1], 1);
                return(condition);
            }

            case 13:
                condition.intValue = TypeNameContainer <AvatarConfig._CharacterType> .Parse(element.Text, 0);

                return(condition);

            case 14:
                condition.intValue = StrParser.ParseHexInt(element.Text, 0);
                return(condition);

            case 15:
                condition.enumList.AddRange(TypeNameContainer <CombatTurn._Type> .ParseList(element.Text, 0));
                return(condition);

            case 0x12:
                condition.intValue = TypeNameContainer <ClientServerCommon.Buff._BuffType> .Parse(element.Attribute("BuffType"), 0);

                condition.intValue1 = StrParser.ParseHexInt(element.Attribute("BuffId"), 0);
                return(condition);

            case 0x13:
                condition.stringValue = StrParser.ParseStr(element.Text, condition.stringValue);
                condition.intValue    = TypeNameContainer <_ConditionValueCompareType> .Parse(element.Attribute("Compare"), 0);

                condition.doubleValue = StrParser.ParseDouble(element.Attribute("CompareValue"), 0.0);
                condition.intValue1   = TypeNameContainer <_ConditionValueCompareType> .Parse(element.Attribute("CountCompare"), 0);

                condition.doubleValue1 = StrParser.ParseDouble(element.Attribute("CountCompareValue"), 0.0);
                return(condition);

            case 20:
                condition.intValue = TypeNameContainer <_SubType> .Parse(element.Text, 0);

                return(condition);

            case 0x15:
                condition.stringValue = StrParser.ParseStr(element.Text, string.Empty);
                condition.intValue    = TypeNameContainer <_ConditionValueCompareType> .Parse(element.Attribute("Compare"), 0);

                condition.doubleValue = StrParser.ParseDouble(element.Attribute("CompareValue"), 0.0);
                return(condition);

            case 0x16:
                condition.enumList.AddRange(TypeNameContainer <_SubType> .ParseList(element.Text, 0));
                return(condition);

            case 0x17:
                condition.intValue = TypeNameContainer <_SubType> .Parse(element.Text, 0);

                return(condition);

            case 0x18:
                condition.intValue = TypeNameContainer <AvatarAction.Event._Type> .Parse(element.Text, 0);

                condition.intValue1 = TypeNameContainer <ClientServerCommon.Buff._BuffType> .Parse(element.Attribute("BuffType"), 0);

                return(condition);
            }
            return(condition);
        }