Esempio n. 1
0
        public static TargetCondition CopyFrom(TargetCondition other)
        {
            TargetCondition condition = new TargetCondition {
                boolValue   = other.boolValue,
                doubleValue = other.doubleValue
            };

            condition.enumList.AddRange(other.enumList);
            condition.intValue    = other.intValue;
            condition.intValue1   = other.intValue1;
            condition.type        = other.type;
            condition.stringValue = other.stringValue;
            return(condition);
        }
Esempio n. 2
0
        public override bool Equals(object obj)
        {
            Predicate <int> match = null;

            if (obj is TargetCondition)
            {
                TargetCondition tc = obj as TargetCondition;
                if ((((tc.type == this.type) && (tc.intValue == this.intValue)) && ((tc.intValue1 == this.intValue1) && (tc.doubleValue == this.doubleValue))) && (((tc.boolValue == this.boolValue) && (tc.stringValue == this.stringValue)) && (tc.enumList.Count == this.enumList.Count)))
                {
                    if (match == null)
                    {
                        match = n => this.enumList.Contains(n);
                    }
                    if (tc.enumList.TrueForAll(match))
                    {
                        return(this.enumList.TrueForAll(n => tc.enumList.Contains(n)));
                    }
                }
            }
            return(false);
        }
Esempio n. 3
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);
        }
Esempio n. 4
0
 public static int CompareTargetCondition(TargetCondition c1, TargetCondition c2)
 {
     return(c1.type - c2.type);
 }