Пример #1
0
        public static PropertyModifier LoadFromXml(SecurityElement element)
        {
            PropertyModifier modifier = new PropertyModifier();

            modifier._type = TypeNameContainer <_Type> .Parse(element.Attribute("Type"), modifier.type);

            modifier._modifyType = TypeNameContainer <_ValueModifyType> .Parse(element.Attribute("ModifyType"), modifier.modifyType);

            modifier._buffType = TypeNameContainer <ClientServerCommon.Buff._BuffType> .Parse(element.Attribute("BuffType"), 1);

            switch (modifier.type)
            {
            case 1:
                modifier._attributeType = TypeNameContainer <_AvatarAttributeType> .Parse(element.Attribute("AttributeType"), modifier.attributeType);

                modifier._attributeValue    = StrParser.ParseFloat(element.Attribute("Value"), 0f);
                modifier._attributeIncrease = StrParser.ParseFloat(element.Attribute("Increase"), 0f);
                return(modifier);

            case 2:
                modifier._color = ClientServerCommon.color.LoadFromXml(element.Attribute("Color"));
                return(modifier);

            case 3:
                modifier._abilityType = TypeNameContainer <_AvatarAbilityType> .Parse(element.Attribute("AbilityType"), modifier._abilityType);

                if (modifier._abilityType == 1)
                {
                    modifier._abilityValue = TypeNameContainer <ClientServerCommon.Buff._BuffType> .ParseBitList(element.Attribute("AbilityValue"), 0);
                }
                return(modifier);
            }
            modifier._attributeValue = StrParser.ParseFloat(element.Attribute("Value"), 0f);
            return(modifier);
        }
Пример #2
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);
        }
Пример #3
0
        public AvatarAction.Event LoadEventFromXml(SecurityElement element, int eventIdx, int sourceTurnID)
        {
            AvatarAction.Event event2 = new AvatarAction.Event {
                sourceTurnId = sourceTurnID,
                index        = eventIdx
            };
            event2.keyFrameId = StrParser.ParseDecInt(element.Attribute("KeyFrameId"), event2.keyFrameId);
            event2.eventType  = TypeNameContainer <AvatarAction.Event._Type> .Parse(element.Attribute("Type"), 0);

            event2.delay           = StrParser.ParseFloat(element.Attribute("Delay"), 0f);
            event2.loop            = StrParser.ParseBool(element.Attribute("Loop"), event2.loop);
            event2.playOnAllTarget = StrParser.ParseBool(element.Attribute("PlayOnAllTarget"), event2.playOnAllTarget);
            event2.weaponId        = StrParser.ParseHexInt(element.Attribute("WeaponId"), 0);
            event2.boneName        = StrParser.ParseStr(element.Attribute("BoneName"), "");
            event2.buffType        = TypeNameContainer <ClientServerCommon.Buff._BuffType> .ParseBitList(element.Attribute("BuffType"), 0);

            event2.modifyType = TypeNameContainer <PropertyModifier._ValueModifyType> .Parse(element.Attribute("ModifyType"), 2);

            if (element.Children != null)
            {
                foreach (SecurityElement element2 in element.Children)
                {
                    int    num;
                    string tag = element2.Tag;
                    if (tag != null)
                    {
                        if (tag != "Effect")
                        {
                            if (tag == "Buff")
                            {
                                goto Label_017E;
                            }
                            if (tag == "ModifierSet")
                            {
                                goto Label_0193;
                            }
                            if (tag == "TestType")
                            {
                                goto Label_01A6;
                            }
                        }
                        else
                        {
                            event2.effects.Add(this.LoadEffectFromXml(element2));
                        }
                    }
                    continue;
Label_017E:
                    this.buffs.Add(this.LoadBuffFromXml(element2, sourceTurnID));
                    continue;
Label_0193:
                    event2.modifierSets.Add(PropertyModifierSet.LoadFromXml(element2));
                    continue;
Label_01A6:
                    num = TypeNameContainer <CombatTurn._TestType> .Parse(element2.Text, 0);

                    if (num != 0)
                    {
                        event2.testType |= num;
                    }
                }
            }
            event2.buffId = StrParser.ParseHexInt(element.Attribute("BuffId"), 0);
            return(event2);
        }