示例#1
0
        private Partner LoadPartnerFromXml(SecurityElement element)
        {
            Partner partner = new Partner {
                PartnerId           = StrParser.ParseHexInt(element.Attribute("PartnerId"), 0),
                RequirePlayerLevel  = StrParser.ParseDecInt(element.Attribute("RequirePlayerLevel"), 0),
                RequireVipLevel     = StrParser.ParseDecInt(element.Attribute("RequireVipLevel"), 0),
                IsOpen              = StrParser.ParseBool(element.Attribute("IsOpen"), false),
                AffectType          = TypeNameContainer <PositionConfig._EmBattleType> .Parse(element.Attribute("AffectType"), 0),
                PartnerPowerPercent = StrParser.ParseFloat(element.Attribute("PartnerPowerPercent"), 0f)
            };

            if (element.Children != null)
            {
                foreach (SecurityElement element2 in element.Children)
                {
                    if (element2.Tag == "Cost")
                    {
                        Cost item = Cost.LoadFromXml(element2);
                        partner.Costs.Add(item);
                    }
                    if (element2.Tag == "Modifier")
                    {
                        PropertyModifier modifier = PropertyModifier.LoadFromXml(element2);
                        partner.Modifiers.Add(modifier);
                    }
                }
            }
            return(partner);
        }
示例#2
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);
        }
        public static PropertyModifierSet CopyFrom(PropertyModifierSet other)
        {
            PropertyModifierSet set = new PropertyModifierSet {
                levelFilter = other.levelFilter
            };

            foreach (PropertyModifier modifier in other.modifiers)
            {
                set.modifiers.Add(PropertyModifier.CopyFrom(modifier));
            }
            return(set);
        }
        public static PropertyModifierSet genPropertyModifierSetBySp(int sp)
        {
            PropertyModifierSet set = new PropertyModifierSet {
                _levelFilter = 0
            };
            PropertyModifier mf = new PropertyModifier {
                type           = 1,
                attributeType  = 0x11,
                modifyType     = 1,
                attributeValue = sp
            };

            set.AddOneModifier(mf);
            return(set);
        }
示例#5
0
        private Illusion LoadIllusionFromXml(SecurityElement element)
        {
            Illusion illusion = new Illusion {
                Id              = StrParser.ParseHexInt(element.Attribute("Id"), 0),
                ContinueTime    = StrParser.ParseDecInt(element.Attribute("ContinueTime"), 0),
                ModelId         = StrParser.ParseHexInt(element.Attribute("ModelId"), 0),
                GetWay          = StrParser.ParseStr(element.Attribute("GetWay"), ""),
                ModifierSetDesc = StrParser.ParseStr(element.Attribute("ModifierSetDesc"), "", true),
                SortIndex       = StrParser.ParseDecInt(element.Attribute("SortIndex"), 0),
                IllusionPower   = StrParser.ParseFloat(element.Attribute("IllusionPower"), 0f)
            };

            if (element.Children != null)
            {
                foreach (SecurityElement element2 in element.Children)
                {
                    PropertyModifier modifier;
                    string           tag = element2.Tag;
                    if (tag != null)
                    {
                        if (tag != "Cost")
                        {
                            if (tag == "PropertyModifier")
                            {
                                goto Label_011E;
                            }
                            if (tag == "DanAttributeId")
                            {
                                goto Label_0133;
                            }
                        }
                        else
                        {
                            illusion.ActivateCost = Cost.LoadFromXml(element2);
                        }
                    }
                    continue;
Label_011E:
                    modifier = PropertyModifier.LoadFromXml(element2);
                    illusion.IllusionModifers.Add(modifier);
                    continue;
Label_0133:
                    illusion.DanAttributeIds.Add(StrParser.ParseHexInt(element2.Text, 0));
                }
            }
            return(illusion);
        }
        public static PropertyModifierSet LoadFromXml(SecurityElement element)
        {
            PropertyModifierSet set = new PropertyModifierSet {
                levelFilter = StrParser.ParseDecInt(element.Attribute("LevelFilter"), 0)
            };

            if (element.Children != null)
            {
                foreach (SecurityElement element2 in element.Children)
                {
                    if (element2.Tag == "Modifier")
                    {
                        set.modifiers.Add(PropertyModifier.LoadFromXml(element2));
                    }
                }
            }
            return(set);
        }
示例#7
0
 public static PropertyModifier CopyFrom(PropertyModifier other)
 {
     if (other == null)
     {
         return(null);
     }
     return(new PropertyModifier {
         _type = other._type,
         _modifyType = other._modifyType,
         _attributeType = other._attributeType,
         _attributeValue = other._attributeValue,
         _attributeIncrease = other._attributeIncrease,
         _color = ClientServerCommon.color.CopyFrom(other._color),
         _abilityType = other._abilityType,
         _abilityValue = other._abilityValue,
         _buffType = other._buffType
     });
 }
示例#8
0
        private EmBattleAttribute LoadAdditionsFromXml(SecurityElement element)
        {
            EmBattleAttribute attribute = new EmBattleAttribute {
                type = TypeNameContainer <PositionConfig._EmBattleType> .Parse(element.Attribute("AffectType"), 0),
                name = StrParser.ParseStr(element.Attribute("Name"), null),
                desc = StrParser.ParseStr(element.Attribute("Desc"), null)
            };

            if (element.Children != null)
            {
                foreach (SecurityElement element2 in element.Children)
                {
                    if (element2.Tag == "PropertyModifier")
                    {
                        PropertyModifier item = PropertyModifier.LoadFromXml(element2);
                        attribute.modifiers.Add(item);
                    }
                }
            }
            return(attribute);
        }
示例#9
0
        private EmBattleAttribute LoadEmBattleAttributeFromXml(SecurityElement element)
        {
            EmBattleAttribute attribute = new EmBattleAttribute {
                type = TypeNameContainer <_EmBattleType> .Parse(element.Attribute("Type"), 0),
                desc = StrParser.ParseStr(element.Attribute("Desc"), "", true)
            };

            if (element.Children != null)
            {
                foreach (SecurityElement element2 in element.Children)
                {
                    string str;
                    if (((str = element2.Tag) != null) && (str == "PropertyModifier"))
                    {
                        PropertyModifier item = PropertyModifier.LoadFromXml(element2);
                        attribute.modifiers.Add(item);
                    }
                }
            }
            return(attribute);
        }
示例#10
0
        public static List <PropertyModifier> GetIncreasedModifier(List <PropertyModifierSet> increaseList, int step)
        {
            PropertyModifierSet set = null;

            foreach (PropertyModifierSet set2 in increaseList)
            {
                if (((set == null) || (set._levelFilter <= set2._levelFilter)) && (step >= set2._levelFilter))
                {
                    set = set2;
                }
            }
            List <PropertyModifier> list = new List <PropertyModifier>();

            if (set != null)
            {
                foreach (PropertyModifier modifier in set.modifiers)
                {
                    PropertyModifier item = PropertyModifier.CopyFrom(modifier);
                    item.attributeValue += (step - set._levelFilter) * modifier.attributeIncrease;
                    list.Add(item);
                }
            }
            return(list);
        }
示例#11
0
 public void AddOneModifier(PropertyModifier mf)
 {
     this.modifiers.Add(mf);
 }