Пример #1
0
        public static CostAsset LoadCostAssetFromXml(SecurityElement element)
        {
            CostAsset asset = new CostAsset {
                iconId                = StrParser.ParseHexInt(element.Attribute("IconId"), 0),
                type                  = TypeNameContainer <IDSeg> .Parse(element.Attribute("Type"), 0),
                count                 = StrParser.ParseDecInt(element.Attribute("Count"), 0),
                qualityLevel          = StrParser.ParseDecInt(element.Attribute("QualityLevel"), 0),
                breakThroughLevelFrom = StrParser.ParseDecInt(element.Attribute("BreakThroughLevelFrom"), 0),
                breakThroughLevelTo   = StrParser.ParseDecInt(element.Attribute("BreakThroughLevelTo"), 0)
            };

            switch (asset.type)
            {
            case 3:
                asset._subType = TypeNameContainer <AvatarConfig._AvatarCountryType> .Parse(element.Attribute("SubType"), 0);

                return(asset);

            case 4:
                asset.subType = TypeNameContainer <EquipmentConfig._Type> .Parse(element.Attribute("SubType"), 0);

                return(asset);

            case 0x57:
                asset._subType = TypeNameContainer <DanConfig._DanType> .Parse(element.Attribute("SubType"), 0);

                return(asset);
            }
            return(asset);
        }
        private GuildExchangeGoods LoadExchangGoodsFromXml(SecurityElement element)
        {
            GuildExchangeGoods goods = new GuildExchangeGoods {
                GoodsId                = StrParser.ParseHexInt(element.Attribute("Id"), 0),
                ShowIndex              = StrParser.ParseDecInt(element.Attribute("ShowIndex"), 0),
                ActiveConditionType    = TypeNameContainer <_ActiveConditionType> .Parse(element.Attribute("ActiveConditionType"), 0),
                ActiveConditionValue   = StrParser.ParseStr(element.Attribute("ActiveConditionValue"), ""),
                ExistTimeMs            = StrParser.ParseDecInt(element.Attribute("ExistTimeMs"), 0),
                BuyCountLimitPerActive = StrParser.ParseDecInt(element.Attribute("BuyCountLimitPerActive"), 0),
                ConditionDesc          = StrParser.ParseStr(element.Attribute("ConditionDesc"), "")
            };

            if (element.Children != null)
            {
                foreach (SecurityElement element2 in element.Children)
                {
                    string tag = element2.Tag;
                    if (tag != null)
                    {
                        if (tag != "CostAsset")
                        {
                            if (tag == "ItemEx")
                            {
                                goto Label_011A;
                            }
                            if (tag == "Reward")
                            {
                                goto Label_012D;
                            }
                        }
                        else
                        {
                            goods.CostAssets.Add(CostAsset.LoadCostAssetFromXml(element2));
                        }
                    }
                    continue;
Label_011A:
                    goods.Costs.Add(ItemEx.LoadItemExFromXml(element2));
                    continue;
Label_012D:
                    goods.Reward = Reward.LoadFromXml(element2);
                }
            }
            return(goods);
        }