Example #1
0
 public static void LoadCallPetType()
 {
     try
     {
         lock (CallPetManager._CallPetMutex)
         {
             CallPetManager.CallPetTypeDict.Clear();
             string fileName = "Config/CallPetType.xml";
             GeneralCachingXmlMgr.RemoveCachingXml(Global.GameResPath(fileName));
             XElement xml = GeneralCachingXmlMgr.GetXElement(Global.GameResPath(fileName));
             if (null == xml)
             {
                 LogManager.WriteLog(LogTypes.Fatal, "加载Config/CallPetType.xml时出错!!!文件不存在", null, true);
             }
             else
             {
                 IEnumerable <XElement> xmlItems = xml.Elements();
                 foreach (XElement xmlItem in xmlItems)
                 {
                     CallPetType CfgData = new CallPetType();
                     CfgData.ID            = (int)Global.GetSafeAttributeLong(xmlItem, "ID");
                     CfgData.MinZhuanSheng = (int)Global.GetSafeAttributeLong(xmlItem, "MinZhuanSheng");
                     CfgData.MinLevel      = (int)Global.GetSafeAttributeLong(xmlItem, "MinLevel");
                     CfgData.MaxZhuanSheng = (int)Global.GetSafeAttributeLong(xmlItem, "MaxZhuanSheng");
                     CfgData.MaxLevel      = (int)Global.GetSafeAttributeLong(xmlItem, "MaxLevel");
                     CallPetManager.CallPetTypeDict[CfgData.ID] = CfgData;
                 }
             }
         }
     }
     catch (Exception ex)
     {
         LogManager.WriteLog(LogTypes.Fatal, "加载Config/CallPetType.xml时文件出错", ex, true);
     }
 }
        /// <summary>
        /// 加载版本系统开放配置表
        /// </summary>
        public void LoadVersionSystemOpenData()
        {
            lock (_VersionSystemOpenMutex)
            {
                string fileName = "Config/VersionSystemOpen.xml";                              // 配置文件地址
                GeneralCachingXmlMgr.RemoveCachingXml(Global.GameResPath(fileName));           // 移除缓存
                XElement xml = GeneralCachingXmlMgr.GetXElement(Global.GameResPath(fileName)); // 获取XML
                if (null == xml)
                {
                    LogManager.WriteLog(LogTypes.Error, string.Format("加载{0}时出错!!!文件异常", fileName));
                    return;
                }

                IEnumerable <XElement> xmlItems = xml.Elements();

                // 清空容器
                VersionSystemOpenDict.Clear();

                // 放入容器管理 key = SystemCode,value = IsOpen(0=不开,1=开放)
                foreach (var xmlItem in xmlItems)
                {
                    string key    = Global.GetSafeAttributeStr(xmlItem, "SystemName");
                    int    nValue = (int)Global.GetSafeAttributeLong(xmlItem, "IsOpen");

                    VersionSystemOpenDict[key] = nValue;
                }
            }
        }
Example #3
0
        public XElement GetFilterXElement()
        {
            string   fileName = "Config/ThemeActivityType.xml";
            XElement xml      = GeneralCachingXmlMgr.GetXElement(Global.GameResPath(fileName));
            XElement result;

            if (null == xml)
            {
                result = null;
            }
            else
            {
                XElement               filterxml  = new XElement(xml);
                List <XElement>        removeList = new List <XElement>();
                IEnumerable <XElement> xmlItems   = filterxml.Elements();
                foreach (XElement xmlItem in xmlItems)
                {
                    int activityid = Convert.ToInt32(Global.GetSafeAttributeStr(xmlItem, "Type"));
                    int endData    = this.GetEndData(activityid);
                    if (endData > 0 && TimeUtil.NowDateTime() > Global.GetKaiFuTime().AddDays((double)endData))
                    {
                        removeList.Add(xmlItem);
                    }
                }
                removeList.ForEach(delegate(XElement x)
                {
                    x.Remove();
                });
                result = filterxml;
            }
            return(result);
        }
Example #4
0
 public bool LoadAlchemyConfigFile()
 {
     try
     {
         GeneralCachingXmlMgr.RemoveCachingXml(Global.GameResPath("Config/CurrencyConversion.xml"));
         XElement xml = GeneralCachingXmlMgr.GetXElement(Global.GameResPath("Config/CurrencyConversion.xml"));
         if (null == xml)
         {
             return(false);
         }
         Dictionary <int, AlchemyConfigData> tempAlchemyConfig = new Dictionary <int, AlchemyConfigData>();
         IEnumerable <XElement> xmlItems = xml.Elements();
         foreach (XElement xmlItem in xmlItems)
         {
             AlchemyConfigData data = new AlchemyConfigData();
             data.ID      = (int)Global.GetSafeAttributeLong(xmlItem, "ID");
             data.TypeID  = (int)Global.GetSafeAttributeLong(xmlItem, "Type");
             data.Unit    = (int)Global.GetSafeAttributeLong(xmlItem, "Unit");
             data.Element = (int)Global.GetSafeAttributeLong(xmlItem, "Element");
             data.Limit   = (int)Global.GetSafeAttributeLong(xmlItem, "Limit");
             tempAlchemyConfig[data.TypeID] = data;
         }
         lock (this.ConfigMutex)
         {
             this.AlchemyConfig = tempAlchemyConfig;
         }
     }
     catch (Exception ex)
     {
         LogManager.WriteLog(LogTypes.Fatal, string.Format("{0}解析出现异常, {1}", "Config/CurrencyConversion.xml", ex.Message), null, true);
         return(false);
     }
     return(true);
 }
Example #5
0
        /// <summary>
        /// 加载某地图的所有npc角色,将该地图的所有NPC配置到相应的格子坐标中,
        /// 玩家移动的时候,动态推送到客户端
        /// </summary>
        /// <param name="mapCode"></param>
        public static Boolean LoadMapNPCRoles(int mapCode, GameMap gameMap)
        {
            string   fileName = string.Format("Map/{0}/npcs.xml", mapCode);
            XElement xml      = GeneralCachingXmlMgr.GetXElement(Global.ResPath(fileName));

            if (null == xml)
            {
                return(false);
            }

            IEnumerable <XElement> items = xml.Elements("NPCs").Elements();

            foreach (var item in items)
            {
                NPC myNpc = new NPC();

                myNpc.NpcID = Convert.ToInt32((string)item.Attribute("Code"));
                //myNpc.GridPoint.X = Convert.ToInt32((string)item.Attribute("X")) / gameMap.MapGridWidth;
                //myNpc.GridPoint.Y = Convert.ToInt32((string)item.Attribute("Y")) / gameMap.MapGridHeight;
                myNpc.MapCode    = mapCode;
                myNpc.CurrentPos = new Point(Convert.ToInt32((string)item.Attribute("X")), Convert.ToInt32((string)item.Attribute("Y")));
                //myNpc.CurrentDir = (Dircetions)Global.GetSafeAttributeLong(item, "Dir");

                if (item.Attribute("Dir") != null)
                {
                    myNpc.CurrentDir = (Dircetions)Global.GetSafeAttributeLong(item, "Dir");
                }
                else
                {
                    myNpc.CurrentDir = (Dircetions)4;
                }

                //将推送给客户端的数据缓存起来,以后直接取出发送就行
                myNpc.RoleBufferData = GenerateNpcRoleBufferData(myNpc);

                if (null == myNpc.RoleBufferData)
                {
                    continue;
                    //LogManager.WriteLog(LogTypes.Error, string.Format("加载地图{0}的({1}, {2})处旧的NPC数据失败", myNpc.MapCode, myNpc.GridPoint.X, myNpc.GridPoint.Y));
                    //throw new Exception("NPC配置数据出错");
                }

                AddNpcToMap(myNpc);

                //为地图中的某点设置安全区
                int           safeGridNum = 2;
                SystemXmlItem npcXmlItem;
                if (GameManager.SystemNPCsMgr.SystemXmlItemDict.TryGetValue(myNpc.NpcID, out npcXmlItem))
                {
                    safeGridNum = npcXmlItem.GetIntValue("IsSafe");
                }

                if (safeGridNum > 0)
                {
                    gameMap.SetPartialSafeRegion(myNpc.GridPoint, safeGridNum);
                }
            }

            return(true);
        }
Example #6
0
        /// <summary>
        /// 加载配置文件 GleeFeastAward.xml
        /// </summary>
        public void LoadQingGongYanConfig()
        {
            lock (_QingGongYanMutex)
            {
                QingGongYanDict.Clear();

                string fileName = "Config/GleeFeastAward.xml";
                GeneralCachingXmlMgr.RemoveCachingXml(Global.GameResPath(fileName));
                XElement xml = GeneralCachingXmlMgr.GetXElement(Global.GameResPath(fileName));
                if (null == xml)
                {
                    return;
                }

                IEnumerable <XElement> xmlItems = xml.Elements();
                foreach (var xmlItem in xmlItems)
                {
                    QingGongYanInfo InfoData = new QingGongYanInfo();
                    InfoData.Index     = (int)Global.GetSafeAttributeLong(xmlItem, "ID");
                    InfoData.NpcID     = (int)Global.GetSafeAttributeLong(xmlItem, "NPCID");
                    InfoData.MapCode   = (int)Global.GetSafeAttributeLong(xmlItem, "MapCode");
                    InfoData.X         = (int)Global.GetSafeAttributeLong(xmlItem, "X");
                    InfoData.Y         = (int)Global.GetSafeAttributeLong(xmlItem, "Y");
                    InfoData.Direction = (int)Global.GetSafeAttributeLong(xmlItem, "Direction");

                    // Week

                    /*string[] strWeek = Global.GetSafeAttributeStr(xmlItem, "Week").Split(',');
                     * if (null != strWeek)
                     * {
                     *  for (int i = 0; i < strWeek.Length; i++)
                     *  {
                     *      InfoData.DayOfWeek.Add(Convert.ToInt32(strWeek[i]));
                     *  }
                     * }*/
                    string[] strBanTime = Global.GetSafeAttributeStr(xmlItem, "ProhibitedTime").Split('|');
                    for (int i = 0; i < strBanTime.Length; i++)
                    {
                        InfoData.ProhibitedTimeList.Add(strBanTime[i]);
                    }

                    InfoData.BeginTime  = Global.GetSafeAttributeStr(xmlItem, "BeginTime");
                    InfoData.OverTime   = Global.GetSafeAttributeStr(xmlItem, "OverTime");
                    InfoData.FunctionID = (int)Global.GetSafeAttributeLong(xmlItem, "FunctionID");

                    InfoData.HoldBindJinBi = (int)Global.GetSafeAttributeLong(xmlItem, "ConductBindJinBi");
                    InfoData.TotalNum      = (int)Global.GetSafeAttributeLong(xmlItem, "SumNum");
                    InfoData.SingleNum     = (int)Global.GetSafeAttributeLong(xmlItem, "UseNum");
                    InfoData.JoinBindJinBi = (int)Global.GetSafeAttributeLong(xmlItem, "BindJinBi");
                    InfoData.ExpAward      = (int)Global.GetSafeAttributeLong(xmlItem, "EXPAward");
                    InfoData.XingHunAward  = (int)Global.GetSafeAttributeLong(xmlItem, "XingHunAward");
                    InfoData.ZhanGongAward = (int)Global.GetSafeAttributeLong(xmlItem, "ZhanGongAward");
                    InfoData.ZuanShiCoe    = (int)Global.GetSafeAttributeLong(xmlItem, "ZuanShiRatio");

                    QingGongYanDict[InfoData.Index] = InfoData;
                }
            }
        }
Example #7
0
        public static bool ReloadMapNPCRoles(int mapCode)
        {
            string fileName = string.Format("Map/{0}/npcs.xml", mapCode);

            GeneralCachingXmlMgr.Reload(Global.ResPath(fileName));
            GameManager.SystemNPCsMgr.ReloadLoadFromXMlFile();
            GameMap gameMap = GameManager.MapMgr.DictMaps[mapCode];

            return(NPCGeneralManager.LoadMapNPCRoles(mapCode, gameMap));
        }
        public static XElement GetXElement(string xmlFileName)
        {
            XElement xml = null;

            lock (GeneralCachingXmlMgr.CachingXmlDict)
            {
                if (GeneralCachingXmlMgr.CachingXmlDict.TryGetValue(xmlFileName, out xml))
                {
                    return(xml);
                }
            }
            return(GeneralCachingXmlMgr.CachingXml(xmlFileName));
        }
Example #9
0
        public static bool LoadMapNPCRoles(int mapCode, GameMap gameMap)
        {
            string   fileName = string.Format("Map/{0}/npcs.xml", mapCode);
            XElement xml      = GeneralCachingXmlMgr.GetXElement(Global.ResPath(fileName));
            bool     result;

            if (null == xml)
            {
                result = false;
            }
            else
            {
                IEnumerable <XElement> items = xml.Elements("NPCs").Elements <XElement>();
                foreach (XElement item in items)
                {
                    NPC myNpc = new NPC();
                    myNpc.NpcID      = Convert.ToInt32((string)item.Attribute("Code"));
                    myNpc.MapCode    = mapCode;
                    myNpc.CurrentPos = new Point((double)Convert.ToInt32((string)item.Attribute("X")), (double)Convert.ToInt32((string)item.Attribute("Y")));
                    if (item.Attribute("Dir") != null)
                    {
                        myNpc.CurrentDir = (Dircetions)Global.GetSafeAttributeLong(item, "Dir");
                    }
                    else
                    {
                        myNpc.CurrentDir = Dircetions.DR_DOWN;
                    }
                    myNpc.RoleBufferData = NPCGeneralManager.GenerateNpcRoleBufferData(myNpc);
                    if (null != myNpc.RoleBufferData)
                    {
                        NPCGeneralManager.AddNpcToMap(myNpc);
                        int           safeGridNum = 2;
                        SystemXmlItem npcXmlItem;
                        if (GameManager.SystemNPCsMgr.SystemXmlItemDict.TryGetValue(myNpc.NpcID, out npcXmlItem))
                        {
                            safeGridNum = npcXmlItem.GetIntValue("IsSafe", -1);
                        }
                        if (safeGridNum > 0)
                        {
                            gameMap.SetPartialSafeRegion(myNpc.GridPoint, safeGridNum);
                        }
                    }
                }
                result = true;
            }
            return(result);
        }
Example #10
0
 public bool LoadShenJiFuWenConfigFile()
 {
     try
     {
         GeneralCachingXmlMgr.RemoveCachingXml(Global.GameResPath("Config/ShenJiFuWen.xml"));
         XElement xml = GeneralCachingXmlMgr.GetXElement(Global.GameResPath("Config/ShenJiFuWen.xml"));
         if (null == xml)
         {
             return(false);
         }
         Dictionary <int, ShenJiFuWenConfigData> tempShenJiConfig = new Dictionary <int, ShenJiFuWenConfigData>();
         IEnumerable <XElement> xmlItems = xml.Elements();
         foreach (XElement xmlItem in xmlItems)
         {
             ShenJiFuWenConfigData data = new ShenJiFuWenConfigData();
             data.ShenJiID     = (int)Global.GetSafeAttributeLong(xmlItem, "ID");
             data.PreShenJiID  = (int)Global.GetSafeAttributeLong(xmlItem, "Prev");
             data.PreShenJiLev = (int)Global.GetSafeAttributeLong(xmlItem, "PrevLevel");
             data.MaxLevel     = (int)Global.GetSafeAttributeLong(xmlItem, "MaxLevel");
             data.UpNeed       = (int)Global.GetSafeAttributeLong(xmlItem, "UpNeed");
             for (int levelloop = 1; levelloop <= 5; levelloop++)
             {
                 ShenJiFuWenEffectData effectItem = this.ParseShenJiFuWenEffectData(xmlItem, levelloop.ToString());
                 if (null == effectItem)
                 {
                     break;
                 }
                 data.ShenJiEffectList.Add(effectItem);
             }
             tempShenJiConfig[data.ShenJiID] = data;
         }
         lock (this.ConfigMutex)
         {
             this.ShenJiConfig = tempShenJiConfig;
         }
     }
     catch (Exception ex)
     {
         LogManager.WriteLog(LogTypes.Fatal, string.Format("{0}解析出现异常, {1}", "Config/ShenJiFuWen.xml", ex.Message), null, true);
         return(false);
     }
     return(true);
 }
Example #11
0
 public bool LoadShenJiPointConfigFile()
 {
     try
     {
         GeneralCachingXmlMgr.RemoveCachingXml(Global.GameResPath("Config/ShenJiDian.xml"));
         XElement xml = GeneralCachingXmlMgr.GetXElement(Global.GameResPath("Config/ShenJiDian.xml"));
         if (null == xml)
         {
             return(false);
         }
         List <ShenJiPointConfigData> tempShenJiPointConfig = new List <ShenJiPointConfigData>();
         IEnumerable <XElement>       xmlItems = xml.Elements();
         foreach (XElement xmlItem in xmlItems)
         {
             ShenJiPointConfigData data = new ShenJiPointConfigData();
             data.ShenJiPoint = (int)Global.GetSafeAttributeLong(xmlItem, "ShenJiDian");
             data.NeedJiFen   = (int)Global.GetSafeAttributeLong(xmlItem, "NeedShenJi");
             string   tempValue   = Global.GetSafeAttributeStr(xmlItem, "NeedLevel");
             string[] ValueFileds = tempValue.Split(new char[]
             {
                 '|'
             });
             if (ValueFileds.Length == 2)
             {
                 int zhuanSheng = Global.SafeConvertToInt32(ValueFileds[0]);
                 int level      = Global.SafeConvertToInt32(ValueFileds[1]);
                 data.NeedLevel = Global.GetUnionLevel2(zhuanSheng, level);
             }
             tempShenJiPointConfig.Add(data);
         }
         lock (this.ConfigMutex)
         {
             this.ShenJiPointConfig = tempShenJiPointConfig;
         }
     }
     catch (Exception ex)
     {
         LogManager.WriteLog(LogTypes.Fatal, string.Format("{0}解析出现异常, {1}", "Config/ShenJiDian.xml", ex.Message), null, true);
         return(false);
     }
     return(true);
 }
 public void LoadVersionSystemOpenData()
 {
     lock (this._VersionSystemOpenMutex)
     {
         string fileName = "Config/VersionSystemOpen.xml";
         GeneralCachingXmlMgr.RemoveCachingXml(Global.GameResPath(fileName));
         XElement xml = GeneralCachingXmlMgr.GetXElement(Global.GameResPath(fileName));
         if (null == xml)
         {
             LogManager.WriteLog(LogTypes.Error, string.Format("加载{0}时出错!!!文件异常", fileName), null, true);
         }
         else
         {
             IEnumerable <XElement> xmlItems = xml.Elements();
             this.VersionSystemOpenDict.Clear();
             this.SystemOpenDict.Clear();
             foreach (XElement xmlItem in xmlItems)
             {
                 string key    = Global.GetSafeAttributeStr(xmlItem, "SystemName");
                 int    nValue = (int)Global.GetSafeAttributeLong(xmlItem, "IsOpen");
                 this.VersionSystemOpenDict[key] = nValue;
                 int gongNengId = (int)Global.GetSafeAttributeLong(xmlItem, "ID");
                 if (gongNengId >= 100000)
                 {
                     if (gongNengId >= 100000 && gongNengId < 120000)
                     {
                         this.SystemOpenDict[gongNengId - 100000] = (nValue > 0);
                     }
                     else
                     {
                         this.SystemOpenDict[gongNengId] = (nValue > 0);
                     }
                 }
             }
         }
     }
 }
Example #13
0
 public bool init()
 {
     this.DanBiChongZhiAwardDic.Clear();
     try
     {
         string fileName = "Config/JieRiGifts/JieRiDanBiChongZhi.xml";
         GeneralCachingXmlMgr.RemoveCachingXml(Global.GameResPath(fileName));
         XElement xml = GeneralCachingXmlMgr.GetXElement(Global.GameResPath(fileName));
         if (null == xml)
         {
             return(false);
         }
         XElement args = xml.Element("Activities");
         if (null != args)
         {
             this.FromDate       = Global.GetSafeAttributeStr(args, "FromDate");
             this.ToDate         = Global.GetSafeAttributeStr(args, "ToDate");
             this.AwardStartDate = Global.GetSafeAttributeStr(args, "AwardStartDate");
             this.AwardEndDate   = Global.GetSafeAttributeStr(args, "AwardEndDate");
             this.ActivityType   = (int)Global.GetSafeAttributeLong(args, "ActivityType");
         }
         args = xml.Element("GiftList");
         if (null != args)
         {
             IEnumerable <XElement> xmlItems = args.Elements();
             foreach (XElement xmlItem in xmlItems)
             {
                 if (null != xmlItem)
                 {
                     DanBiChongZhiAwardDetail danBiChongZhiAwardDetail = new DanBiChongZhiAwardDetail();
                     AwardItem           myAwardItem         = new AwardItem();
                     AwardItem           myAwardItem2        = new AwardItem();
                     AwardEffectTimeItem effectTimeAwardItem = new AwardEffectTimeItem();
                     string goodsIDs = Global.GetSafeAttributeStr(xmlItem, "GoodsOne");
                     if (string.IsNullOrEmpty(goodsIDs))
                     {
                         LogManager.WriteLog(LogTypes.Warning, string.Format("读取单笔充值活动配置文件中的物品配置项1失败", new object[0]), null, true);
                     }
                     else
                     {
                         string[] fields = goodsIDs.Split(new char[]
                         {
                             '|'
                         });
                         if (fields.Length <= 0)
                         {
                             LogManager.WriteLog(LogTypes.Warning, string.Format("读取单笔充值活动配置文件中的物品配置项失败", new object[0]), null, true);
                         }
                         else
                         {
                             myAwardItem.GoodsDataList = HuodongCachingMgr.ParseGoodsDataList(fields, "单笔充值活动配置");
                         }
                     }
                     goodsIDs = Global.GetSafeAttributeStr(xmlItem, "GoodsTwo");
                     if (string.IsNullOrEmpty(goodsIDs))
                     {
                         LogManager.WriteLog(LogTypes.Warning, string.Format("读取单笔充值活动配置文件中的物品配置项1失败", new object[0]), null, true);
                     }
                     else
                     {
                         string[] fields = goodsIDs.Split(new char[]
                         {
                             '|'
                         });
                         if (fields.Length <= 0)
                         {
                             LogManager.WriteLog(LogTypes.Warning, string.Format("读取单笔充值活动配置文件中的物品配置项失败", new object[0]), null, true);
                         }
                         else
                         {
                             myAwardItem2.GoodsDataList = HuodongCachingMgr.ParseGoodsDataList(fields, "单笔充值活动配置");
                         }
                     }
                     string timeGoods = Global.GetSafeAttributeStr(xmlItem, "GoodsThr");
                     string timeList  = Global.GetSafeAttributeStr(xmlItem, "EffectiveTime");
                     effectTimeAwardItem.Init(timeGoods, timeList, fileName + " 时效性物品");
                     int minYuanBao     = (int)Global.GetSafeAttributeLong(xmlItem, "MinYuanBao");
                     int maxYuanBao     = (int)Global.GetSafeAttributeLong(xmlItem, "MaxYuanBao");
                     int singlePurchase = (int)Global.GetSafeAttributeLong(xmlItem, "SinglePurchase");
                     int ID             = (int)Global.GetSafeAttributeLong(xmlItem, "ID");
                     danBiChongZhiAwardDetail.ID                  = ID;
                     danBiChongZhiAwardDetail.AwardDict           = myAwardItem;
                     danBiChongZhiAwardDetail.AwardDict2          = myAwardItem2;
                     danBiChongZhiAwardDetail.EffectTimeAwardDict = effectTimeAwardItem;
                     danBiChongZhiAwardDetail.MinYuanBao          = minYuanBao;
                     danBiChongZhiAwardDetail.MaxYuanBao          = maxYuanBao;
                     danBiChongZhiAwardDetail.SinglePurchase      = singlePurchase;
                     this.DanBiChongZhiAwardDic[ID]               = danBiChongZhiAwardDetail;
                 }
             }
         }
         base.PredealDateTime();
     }
     catch (Exception ex)
     {
         LogManager.WriteLog(LogTypes.Fatal, "Config/JieRiGifts/JieRiDanBiChongZhi.xml解析出现异常", ex, true);
         return(false);
     }
     return(true);
 }
Example #14
0
        /// <summary>
        /// 加载神器套装信息
        /// </summary>
        public static void LoadArtifactSuitData()
        {
            string fileName = "Config/TaoZhuangProps.xml";

            GeneralCachingXmlMgr.RemoveCachingXml(Global.GameResPath(fileName));

            XElement xml = GeneralCachingXmlMgr.GetXElement(Global.GameResPath(fileName));

            if (null == xml)
            {
                LogManager.WriteLog(LogTypes.Fatal, "加载Config/TaoZhuangProps.xml时出错!!!文件不存在");
                return;
            }

            try
            {
                _artifactSuitList.Clear();

                IEnumerable <XElement> xmlItems = xml.Elements();
                foreach (var xmlItem in xmlItems)
                {
                    if (xmlItem == null)
                    {
                        continue;
                    }

                    ArtifactSuitData config = new ArtifactSuitData();
                    config.SuitID   = Convert.ToInt32(Global.GetDefAttributeStr(xmlItem, "ID", "0"));
                    config.SuitName = Convert.ToString(Global.GetDefAttributeStr(xmlItem, "Name", ""));
                    config.IsMulti  = Convert.ToInt32(Global.GetDefAttributeStr(xmlItem, "Multi", "0")) > 0;

                    string equipIdStr = Convert.ToString(Global.GetDefAttributeStr(xmlItem, "GoodsID", "0"));
                    if (equipIdStr.Length > 0)
                    {
                        config.EquipIDList = new List <int>();

                        string[] all = equipIdStr.Split(',');
                        foreach (string one in all)
                        {
                            config.EquipIDList.Add(int.Parse(one));
                        }
                    }

                    string addString = Convert.ToString(Global.GetDefAttributeStr(xmlItem, "TaoZhuangProps", ""));
                    if (addString.Length > 0)
                    {
                        config.SuitAttr = new Dictionary <int, Dictionary <string, string> >();
                        string[] addArr = addString.Split('|');
                        foreach (string str in addArr)
                        {
                            string[] oneArr = str.Split(',');

                            int count = int.Parse(oneArr[0]);
                            if (config.SuitAttr.ContainsKey(count))
                            {
                                config.SuitAttr[count].Add(oneArr[1], oneArr[2]);
                            }
                            else
                            {
                                Dictionary <string, string> value = new Dictionary <string, string>();
                                value.Add(oneArr[1], oneArr[2]);
                                config.SuitAttr.Add(int.Parse(oneArr[0]), value);
                            }
                        }
                    }

                    _artifactSuitList.Add(config);
                }
            }
            catch (Exception ex)
            {
                LogManager.WriteLog(LogTypes.Fatal, "加载Config/TaoZhuangProps.xml时文件出错", ex);
            }
        }
Example #15
0
        /// <summary>
        /// 加载神器基本信息
        /// </summary>
        public static void LoadArtifactData()
        {
            string fileName = "Config/ZaiZao.xml";

            GeneralCachingXmlMgr.RemoveCachingXml(Global.GameResPath(fileName));

            XElement xml = GeneralCachingXmlMgr.GetXElement(Global.GameResPath(fileName));

            if (null == xml)
            {
                LogManager.WriteLog(LogTypes.Fatal, "加载Config/ZaiZao.xml时出错!!!文件不存在");
                return;
            }

            try
            {
                _artifactList.Clear();

                IEnumerable <XElement> xmlItems = xml.Elements();
                foreach (var xmlItem in xmlItems)
                {
                    if (xmlItem == null)
                    {
                        continue;
                    }

                    ArtifactData config = new ArtifactData();
                    config.ArtifactID   = Convert.ToInt32(Global.GetDefAttributeStr(xmlItem, "ID", "0"));
                    config.ArtifactName = Convert.ToString(Global.GetDefAttributeStr(xmlItem, "Name", ""));
                    config.NewEquitID   = Convert.ToInt32(Global.GetDefAttributeStr(xmlItem, "NewEquitID", "0"));
                    config.NeedEquitID  = Convert.ToInt32(Global.GetDefAttributeStr(xmlItem, "NeedEquitID", "0"));
                    config.NeedGoldBind = Convert.ToInt32(Global.GetDefAttributeStr(xmlItem, "NeedBandJinBi", "0"));
                    config.NeedZaiZao   = Convert.ToInt32(Global.GetDefAttributeStr(xmlItem, "NeedZaiZao", "0"));
                    config.SuccessRate  = (int)(Convert.ToDouble(Global.GetDefAttributeStr(xmlItem, "SuccessRate", "0")) * 100);

                    string needMaterial = Convert.ToString(Global.GetDefAttributeStr(xmlItem, "NeedGoods", ""));
                    if (needMaterial.Length > 0)
                    {
                        config.NeedMaterial = new Dictionary <int, int>();

                        string[] materials = needMaterial.Split('|');
                        foreach (string str in materials)
                        {
                            string[] one = str.Split(',');

                            int key   = int.Parse(one[0]);
                            int value = int.Parse(one[1]);
                            config.NeedMaterial.Add(key, value);
                        }
                    }

                    string failMaterial = Convert.ToString(Global.GetDefAttributeStr(xmlItem, "XiaoHuiGoods", ""));
                    if (failMaterial.Length > 0)
                    {
                        config.FailMaterial = new Dictionary <int, int>();

                        string[] materials = failMaterial.Split('|');
                        foreach (string str in materials)
                        {
                            string[] one = str.Split(',');

                            int key   = int.Parse(one[0]);
                            int value = int.Parse(one[1]);
                            config.FailMaterial.Add(key, value);
                        }
                    }

                    _artifactList.Add(config);
                }
            }
            catch (Exception ex)
            {
                LogManager.WriteLog(LogTypes.Fatal, "加载Config/ZaiZao.xml时文件出错", ex);
            }
        }
Example #16
0
 public static void LoadCallPetConfig()
 {
     try
     {
         lock (CallPetManager._CallPetMutex)
         {
             CallPetManager.CallPetConfigList.Clear();
             CallPetManager.FreeCallPetConfigList.Clear();
             CallPetManager.HuoDongCallPetConfigList.Clear();
             CallPetManager.TeQuanCallPetConfigList.Clear();
             string fileName = "Config/CallPet.xml";
             GeneralCachingXmlMgr.RemoveCachingXml(Global.GameResPath(fileName));
             XElement xml = GeneralCachingXmlMgr.GetXElement(Global.GameResPath(fileName));
             if (null == xml)
             {
                 LogManager.WriteLog(LogTypes.Fatal, "加载Config/CallPet.xml时出错!!!文件不存在", null, true);
             }
             else
             {
                 IEnumerable <XElement> xmlItems = xml.Elements();
                 foreach (XElement xmlItem in xmlItems)
                 {
                     CallPetConfig CfgData = new CallPetConfig();
                     CfgData.ID              = (int)Global.GetSafeAttributeLong(xmlItem, "ID");
                     CfgData.GoodsID         = (int)Global.GetSafeAttributeLong(xmlItem, "GoodsID");
                     CfgData.Num             = (int)Global.GetSafeAttributeLong(xmlItem, "Num");
                     CfgData.QiangHuaFallID  = (int)Global.GetSafeAttributeLong(xmlItem, "QiangHuaFallID");
                     CfgData.ZhuiJiaFallID   = (int)Global.GetSafeAttributeLong(xmlItem, "ZhuiJiaFallID");
                     CfgData.LckyProbability = (int)Global.GetSafeAttributeLong(xmlItem, "LckyProbability");
                     CfgData.ZhuoYueFallID   = (int)Global.GetSafeAttributeLong(xmlItem, "ZhuoYueFallID");
                     CfgData.MinMoney        = (int)Global.GetSafeAttributeLong(xmlItem, "MinMoney");
                     CfgData.MaxMoney        = (int)Global.GetSafeAttributeLong(xmlItem, "MaxMoney");
                     CfgData.MinBindYuanBao  = (int)Global.GetSafeAttributeLong(xmlItem, "MinBindYuanBao");
                     CfgData.MaxBindYuanBao  = (int)Global.GetSafeAttributeLong(xmlItem, "MaxBindYuanBao");
                     CfgData.MinExp          = (int)Global.GetSafeAttributeLong(xmlItem, "MinExp");
                     CfgData.MaxExp          = (int)Global.GetSafeAttributeLong(xmlItem, "MaxExp");
                     CfgData.StartValues     = (int)Global.GetSafeAttributeLong(xmlItem, "StartValues");
                     CfgData.EndValues       = (int)Global.GetSafeAttributeLong(xmlItem, "EndValues");
                     CallPetManager.CallPetConfigList.Add(CfgData);
                 }
                 fileName = "Config/FreeCallPet.xml";
                 GeneralCachingXmlMgr.RemoveCachingXml(Global.GameResPath(fileName));
                 xml = GeneralCachingXmlMgr.GetXElement(Global.GameResPath(fileName));
                 if (null == xml)
                 {
                     LogManager.WriteLog(LogTypes.Fatal, "加载Config/FreeCallPet.xml时出错!!!文件不存在", null, true);
                 }
                 else
                 {
                     xmlItems = xml.Elements();
                     foreach (XElement xmlItem in xmlItems)
                     {
                         CallPetConfig CfgData = new CallPetConfig();
                         CfgData.ID              = (int)Global.GetSafeAttributeLong(xmlItem, "ID");
                         CfgData.GoodsID         = (int)Global.GetSafeAttributeLong(xmlItem, "GoodsID");
                         CfgData.Num             = (int)Global.GetSafeAttributeLong(xmlItem, "Num");
                         CfgData.QiangHuaFallID  = (int)Global.GetSafeAttributeLong(xmlItem, "QiangHuaFallID");
                         CfgData.ZhuiJiaFallID   = (int)Global.GetSafeAttributeLong(xmlItem, "ZhuiJiaFallID");
                         CfgData.LckyProbability = (int)Global.GetSafeAttributeLong(xmlItem, "LckyProbability");
                         CfgData.ZhuoYueFallID   = (int)Global.GetSafeAttributeLong(xmlItem, "ZhuoYueFallID");
                         CfgData.MinMoney        = (int)Global.GetSafeAttributeLong(xmlItem, "MinMoney");
                         CfgData.MaxMoney        = (int)Global.GetSafeAttributeLong(xmlItem, "MaxMoney");
                         CfgData.MinBindYuanBao  = (int)Global.GetSafeAttributeLong(xmlItem, "MinBindYuanBao");
                         CfgData.MaxBindYuanBao  = (int)Global.GetSafeAttributeLong(xmlItem, "MaxBindYuanBao");
                         CfgData.MinExp          = (int)Global.GetSafeAttributeLong(xmlItem, "MinExp");
                         CfgData.MaxExp          = (int)Global.GetSafeAttributeLong(xmlItem, "MaxExp");
                         CfgData.StartValues     = (int)Global.GetSafeAttributeLong(xmlItem, "StartValues");
                         CfgData.EndValues       = (int)Global.GetSafeAttributeLong(xmlItem, "EndValues");
                         CallPetManager.FreeCallPetConfigList.Add(CfgData);
                     }
                     fileName = "Config/HuoDongCallPet.xml";
                     GeneralCachingXmlMgr.RemoveCachingXml(Global.GameResPath(fileName));
                     xml = GeneralCachingXmlMgr.GetXElement(Global.GameResPath(fileName));
                     if (null == xml)
                     {
                         LogManager.WriteLog(LogTypes.Fatal, "加载Config/HuoDongCallPet.xml时出错!!!文件不存在", null, true);
                     }
                     else
                     {
                         xmlItems = xml.Elements();
                         foreach (XElement xmlItem in xmlItems)
                         {
                             CallPetConfig CfgData = new CallPetConfig();
                             CfgData.ID              = (int)Global.GetSafeAttributeLong(xmlItem, "ID");
                             CfgData.GoodsID         = (int)Global.GetSafeAttributeLong(xmlItem, "GoodsID");
                             CfgData.Num             = (int)Global.GetSafeAttributeLong(xmlItem, "Num");
                             CfgData.QiangHuaFallID  = (int)Global.GetSafeAttributeLong(xmlItem, "QiangHuaFallID");
                             CfgData.ZhuiJiaFallID   = (int)Global.GetSafeAttributeLong(xmlItem, "ZhuiJiaFallID");
                             CfgData.LckyProbability = (int)Global.GetSafeAttributeLong(xmlItem, "LckyProbability");
                             CfgData.ZhuoYueFallID   = (int)Global.GetSafeAttributeLong(xmlItem, "ZhuoYueFallID");
                             CfgData.MinMoney        = (int)Global.GetSafeAttributeLong(xmlItem, "MinMoney");
                             CfgData.MaxMoney        = (int)Global.GetSafeAttributeLong(xmlItem, "MaxMoney");
                             CfgData.MinBindYuanBao  = (int)Global.GetSafeAttributeLong(xmlItem, "MinBindYuanBao");
                             CfgData.MaxBindYuanBao  = (int)Global.GetSafeAttributeLong(xmlItem, "MaxBindYuanBao");
                             CfgData.MinExp          = (int)Global.GetSafeAttributeLong(xmlItem, "MinExp");
                             CfgData.MaxExp          = (int)Global.GetSafeAttributeLong(xmlItem, "MaxExp");
                             CfgData.StartValues     = (int)Global.GetSafeAttributeLong(xmlItem, "StartValues");
                             CfgData.EndValues       = (int)Global.GetSafeAttributeLong(xmlItem, "EndValues");
                             CallPetManager.HuoDongCallPetConfigList.Add(CfgData);
                         }
                         fileName = "Config/TeQuanCallPet.xml";
                         GeneralCachingXmlMgr.RemoveCachingXml(Global.GameResPath(fileName));
                         xml = GeneralCachingXmlMgr.GetXElement(Global.GameResPath(fileName));
                         if (null == xml)
                         {
                             LogManager.WriteLog(LogTypes.Fatal, "加载Config/TeQuanBuHuo.xml时出错!!!文件不存在", null, true);
                         }
                         else
                         {
                             xmlItems = xml.Elements();
                             foreach (XElement xmlItem in xmlItems)
                             {
                                 CallPetConfig CfgData = new CallPetConfig();
                                 CfgData.ID              = (int)Global.GetSafeAttributeLong(xmlItem, "ID");
                                 CfgData.GoodsID         = (int)Global.GetSafeAttributeLong(xmlItem, "GoodsID");
                                 CfgData.Num             = (int)Global.GetSafeAttributeLong(xmlItem, "Num");
                                 CfgData.QiangHuaFallID  = (int)Global.GetSafeAttributeLong(xmlItem, "QiangHuaFallID");
                                 CfgData.ZhuiJiaFallID   = (int)Global.GetSafeAttributeLong(xmlItem, "ZhuiJiaFallID");
                                 CfgData.LckyProbability = (int)Global.GetSafeAttributeLong(xmlItem, "LckyProbability");
                                 CfgData.ZhuoYueFallID   = (int)Global.GetSafeAttributeLong(xmlItem, "ZhuoYueFallID");
                                 CfgData.MinMoney        = (int)Global.GetSafeAttributeLong(xmlItem, "MinMoney");
                                 CfgData.MaxMoney        = (int)Global.GetSafeAttributeLong(xmlItem, "MaxMoney");
                                 CfgData.MinBindYuanBao  = (int)Global.GetSafeAttributeLong(xmlItem, "MinBindYuanBao");
                                 CfgData.MaxBindYuanBao  = (int)Global.GetSafeAttributeLong(xmlItem, "MaxBindYuanBao");
                                 CfgData.MinExp          = (int)Global.GetSafeAttributeLong(xmlItem, "MinExp");
                                 CfgData.MaxExp          = (int)Global.GetSafeAttributeLong(xmlItem, "MaxExp");
                                 CfgData.StartValues     = (int)Global.GetSafeAttributeLong(xmlItem, "StartValues");
                                 CfgData.EndValues       = (int)Global.GetSafeAttributeLong(xmlItem, "EndValues");
                                 CallPetManager.TeQuanCallPetConfigList.Add(CfgData);
                             }
                         }
                     }
                 }
             }
         }
     }
     catch (Exception ex)
     {
         LogManager.WriteLog(LogTypes.Fatal, "加载Config/CallPet.xml或FreeCallPet.xml时文件出错", ex, true);
     }
 }
Example #17
0
        /// <summary>
        /// 加载CallPet.xml
        /// </summary>
        public static void LoadCallPetConfig()
        {
            try
            {
                lock (_CallPetMutex)
                {
                    CallPetConfigList.Clear();
                    FreeCallPetConfigList.Clear();
                    HuoDongCallPetConfigList.Clear();

                    string fileName = "Config/CallPet.xml";
                    GeneralCachingXmlMgr.RemoveCachingXml(Global.GameResPath(fileName));
                    XElement xml = GeneralCachingXmlMgr.GetXElement(Global.GameResPath(fileName));
                    if (null == xml)
                    {
                        LogManager.WriteLog(LogTypes.Fatal, "加载Config/CallPet.xml时出错!!!文件不存在");
                        return;
                    }

                    IEnumerable <XElement> xmlItems = xml.Elements();
                    foreach (var xmlItem in xmlItems)
                    {
                        CallPetConfig CfgData = new CallPetConfig();
                        CfgData.ID              = (int)Global.GetSafeAttributeLong(xmlItem, "ID");              // 流水号
                        CfgData.GoodsID         = (int)Global.GetSafeAttributeLong(xmlItem, "GoodsID");         // 物品ID
                        CfgData.Num             = (int)Global.GetSafeAttributeLong(xmlItem, "Num");             // 数量
                        CfgData.QiangHuaFallID  = (int)Global.GetSafeAttributeLong(xmlItem, "QiangHuaFallID");  // 强化掉落ID
                        CfgData.ZhuiJiaFallID   = (int)Global.GetSafeAttributeLong(xmlItem, "ZhuiJiaFallID");   // 追加掉落ID
                        CfgData.LckyProbability = (int)Global.GetSafeAttributeLong(xmlItem, "LckyProbability"); // 幸运掉落概率
                        CfgData.ZhuoYueFallID   = (int)Global.GetSafeAttributeLong(xmlItem, "ZhuoYueFallID");   // 卓越掉落ID
                        CfgData.MinMoney        = (int)Global.GetSafeAttributeLong(xmlItem, "MinMoney");        // 最小金币
                        CfgData.MaxMoney        = (int)Global.GetSafeAttributeLong(xmlItem, "MaxMoney");        // 最大金币
                        CfgData.MinBindYuanBao  = (int)Global.GetSafeAttributeLong(xmlItem, "MinBindYuanBao");  // 最少绑定元宝
                        CfgData.MaxBindYuanBao  = (int)Global.GetSafeAttributeLong(xmlItem, "MaxBindYuanBao");  // 最大绑定元宝
                        CfgData.MinExp          = (int)Global.GetSafeAttributeLong(xmlItem, "MinExp");          // 最少经验
                        CfgData.MaxExp          = (int)Global.GetSafeAttributeLong(xmlItem, "MaxExp");          // 最大经验
                        CfgData.StartValues     = (int)Global.GetSafeAttributeLong(xmlItem, "StartValues");     // 起始值
                        CfgData.EndValues       = (int)Global.GetSafeAttributeLong(xmlItem, "EndValues");       // 结束值
                        CallPetConfigList.Add(CfgData);
                    }

                    fileName = "Config/FreeCallPet.xml";
                    GeneralCachingXmlMgr.RemoveCachingXml(Global.GameResPath(fileName));
                    xml = GeneralCachingXmlMgr.GetXElement(Global.GameResPath(fileName));
                    if (null == xml)
                    {
                        LogManager.WriteLog(LogTypes.Fatal, "加载Config/FreeCallPet.xml时出错!!!文件不存在");
                        return;
                    }

                    xmlItems = xml.Elements();
                    foreach (var xmlItem in xmlItems)
                    {
                        CallPetConfig CfgData = new CallPetConfig();
                        CfgData.ID              = (int)Global.GetSafeAttributeLong(xmlItem, "ID");              // 流水号
                        CfgData.GoodsID         = (int)Global.GetSafeAttributeLong(xmlItem, "GoodsID");         // 物品ID
                        CfgData.Num             = (int)Global.GetSafeAttributeLong(xmlItem, "Num");             // 数量
                        CfgData.QiangHuaFallID  = (int)Global.GetSafeAttributeLong(xmlItem, "QiangHuaFallID");  // 强化掉落ID
                        CfgData.ZhuiJiaFallID   = (int)Global.GetSafeAttributeLong(xmlItem, "ZhuiJiaFallID");   // 追加掉落ID
                        CfgData.LckyProbability = (int)Global.GetSafeAttributeLong(xmlItem, "LckyProbability"); // 幸运掉落概率
                        CfgData.ZhuoYueFallID   = (int)Global.GetSafeAttributeLong(xmlItem, "ZhuoYueFallID");   // 卓越掉落ID
                        CfgData.MinMoney        = (int)Global.GetSafeAttributeLong(xmlItem, "MinMoney");        // 最小金币
                        CfgData.MaxMoney        = (int)Global.GetSafeAttributeLong(xmlItem, "MaxMoney");        // 最大金币
                        CfgData.MinBindYuanBao  = (int)Global.GetSafeAttributeLong(xmlItem, "MinBindYuanBao");  // 最少绑定元宝
                        CfgData.MaxBindYuanBao  = (int)Global.GetSafeAttributeLong(xmlItem, "MaxBindYuanBao");  // 最大绑定元宝
                        CfgData.MinExp          = (int)Global.GetSafeAttributeLong(xmlItem, "MinExp");          // 最少经验
                        CfgData.MaxExp          = (int)Global.GetSafeAttributeLong(xmlItem, "MaxExp");          // 最大经验
                        CfgData.StartValues     = (int)Global.GetSafeAttributeLong(xmlItem, "StartValues");     // 起始值
                        CfgData.EndValues       = (int)Global.GetSafeAttributeLong(xmlItem, "EndValues");       // 结束值
                        FreeCallPetConfigList.Add(CfgData);
                    }

                    fileName = "Config/HuoDongCallPet.xml";
                    GeneralCachingXmlMgr.RemoveCachingXml(Global.GameResPath(fileName));
                    xml = GeneralCachingXmlMgr.GetXElement(Global.GameResPath(fileName));
                    if (null == xml)
                    {
                        LogManager.WriteLog(LogTypes.Fatal, "加载Config/HuoDongCallPet.xml时出错!!!文件不存在");
                        return;
                    }

                    xmlItems = xml.Elements();
                    foreach (var xmlItem in xmlItems)
                    {
                        CallPetConfig CfgData = new CallPetConfig();
                        CfgData.ID              = (int)Global.GetSafeAttributeLong(xmlItem, "ID");              // 流水号
                        CfgData.GoodsID         = (int)Global.GetSafeAttributeLong(xmlItem, "GoodsID");         // 物品ID
                        CfgData.Num             = (int)Global.GetSafeAttributeLong(xmlItem, "Num");             // 数量
                        CfgData.QiangHuaFallID  = (int)Global.GetSafeAttributeLong(xmlItem, "QiangHuaFallID");  // 强化掉落ID
                        CfgData.ZhuiJiaFallID   = (int)Global.GetSafeAttributeLong(xmlItem, "ZhuiJiaFallID");   // 追加掉落ID
                        CfgData.LckyProbability = (int)Global.GetSafeAttributeLong(xmlItem, "LckyProbability"); // 幸运掉落概率
                        CfgData.ZhuoYueFallID   = (int)Global.GetSafeAttributeLong(xmlItem, "ZhuoYueFallID");   // 卓越掉落ID
                        CfgData.MinMoney        = (int)Global.GetSafeAttributeLong(xmlItem, "MinMoney");        // 最小金币
                        CfgData.MaxMoney        = (int)Global.GetSafeAttributeLong(xmlItem, "MaxMoney");        // 最大金币
                        CfgData.MinBindYuanBao  = (int)Global.GetSafeAttributeLong(xmlItem, "MinBindYuanBao");  // 最少绑定元宝
                        CfgData.MaxBindYuanBao  = (int)Global.GetSafeAttributeLong(xmlItem, "MaxBindYuanBao");  // 最大绑定元宝
                        CfgData.MinExp          = (int)Global.GetSafeAttributeLong(xmlItem, "MinExp");          // 最少经验
                        CfgData.MaxExp          = (int)Global.GetSafeAttributeLong(xmlItem, "MaxExp");          // 最大经验
                        CfgData.StartValues     = (int)Global.GetSafeAttributeLong(xmlItem, "StartValues");     // 起始值
                        CfgData.EndValues       = (int)Global.GetSafeAttributeLong(xmlItem, "EndValues");       // 结束值
                        HuoDongCallPetConfigList.Add(CfgData);
                    }
                }
            }

            catch (Exception ex)
            {
                LogManager.WriteLog(LogTypes.Fatal, "加载Config/CallPet.xml或FreeCallPet.xml时文件出错", ex);
            }
        }
Example #18
0
 public static void LoadConfig()
 {
     lock (CopyTargetManager._Mutex)
     {
         CopyTargetManager.CopyTargetInfoDict.Clear();
         string fileName = "Config/FuBenMuBiao.xml";
         GeneralCachingXmlMgr.RemoveCachingXml(Global.GameResPath(fileName));
         XElement xml = GeneralCachingXmlMgr.GetXElement(Global.GameResPath(fileName));
         if (null != xml)
         {
             IEnumerable <XElement> xmlItems = xml.Elements("FuBenMuBiao");
             foreach (XElement xmlItem in xmlItems)
             {
                 IEnumerable <XElement> nodes = xmlItem.Elements("MuBiao");
                 foreach (XElement node in nodes)
                 {
                     int      fubenID   = (int)Global.GetSafeAttributeLong(node, "FuBenID");
                     int      targetIdx = (int)Global.GetSafeAttributeLong(node, "MuBiaoID");
                     string[] strFields = Global.GetSafeAttributeStr(node, "MuBiaoCanShu").Split(new char[]
                     {
                         '|'
                     });
                     foreach (string field in strFields)
                     {
                         CopyTargetInfo InfoData = new CopyTargetInfo();
                         string[]       strInfo  = field.Split(new char[]
                         {
                             ','
                         });
                         if (2 != strInfo.Length)
                         {
                             LogManager.WriteLog(LogTypes.Error, string.Format("Config/FuBenMuBiao.xml 解析失败 fubenID={0} targetID={1} field={2}", fubenID, targetIdx, field), null, true);
                         }
                         else
                         {
                             InfoData.MonsterID = Global.SafeConvertToInt32(strInfo[0]);
                             InfoData.Count     = Global.SafeConvertToInt32(strInfo[1]);
                             if (!CopyTargetManager.CopyTargetInfoDict.ContainsKey(fubenID))
                             {
                                 Dictionary <int, List <CopyTargetInfo> > dictTarget = new Dictionary <int, List <CopyTargetInfo> >();
                                 dictTarget.Add(targetIdx, new List <CopyTargetInfo>
                                 {
                                     InfoData
                                 });
                                 CopyTargetManager.CopyTargetInfoDict[fubenID] = dictTarget;
                             }
                             else if (!CopyTargetManager.CopyTargetInfoDict[fubenID].ContainsKey(targetIdx))
                             {
                                 List <CopyTargetInfo> listTarget = new List <CopyTargetInfo>();
                                 listTarget.Add(InfoData);
                                 CopyTargetManager.CopyTargetInfoDict[fubenID][targetIdx] = listTarget;
                             }
                             else
                             {
                                 CopyTargetManager.CopyTargetInfoDict[fubenID][targetIdx].Add(InfoData);
                             }
                             CopyTargetKey key = new CopyTargetKey();
                             key.fubenID   = fubenID;
                             key.targetIdx = targetIdx;
                             if (!CopyTargetManager.CopyTargetKeyDict.ContainsKey(InfoData.MonsterID))
                             {
                                 List <CopyTargetKey> listTarget2 = new List <CopyTargetKey>();
                                 listTarget2.Add(key);
                                 CopyTargetManager.CopyTargetKeyDict[InfoData.MonsterID] = listTarget2;
                             }
                             else
                             {
                                 CopyTargetManager.CopyTargetKeyDict[InfoData.MonsterID].Add(key);
                             }
                         }
                     }
                 }
             }
         }
     }
 }
Example #19
0
        /// <summary>
        /// 加载配置文件 WeddingFeasttAward.xml
        /// </summary>
        public void LoadMarryPartyConfig()
        {
            lock (MarryPartyConfigList)
            {
                MarryPartyConfigList.Clear();

                string fileName = "Config/WeddingFeasttAward.xml";
                GeneralCachingXmlMgr.RemoveCachingXml(Global.GameResPath(fileName));
                XElement xml = GeneralCachingXmlMgr.GetXElement(Global.GameResPath(fileName));
                if (null == xml)
                {
                    return;
                }

                IEnumerable <XElement> xmlItems = xml.Elements();
                foreach (var xmlItem in xmlItems)
                {
                    MarryPartyConfigData data = new MarryPartyConfigData();
                    data.PartyID            = (int)Global.GetSafeAttributeLong(xmlItem, "ID");
                    data.PartyType          = (int)Global.GetSafeAttributeLong(xmlItem, "Type");
                    data.PartyCost          = (int)Global.GetSafeAttributeLong(xmlItem, "ConductBindJinBi");
                    data.PartyMaxJoinCount  = (int)Global.GetSafeAttributeLong(xmlItem, "SumNum");
                    data.PlayerMaxJoinCount = (int)Global.GetSafeAttributeLong(xmlItem, "UseNum");
                    data.JoinCost           = (int)Global.GetSafeAttributeLong(xmlItem, "BindJinBi");
                    data.RewardExp          = (int)Global.GetSafeAttributeLong(xmlItem, "EXPAward");
                    data.RewardXingHun      = (int)Global.GetSafeAttributeLong(xmlItem, "XingHunAward");
                    data.RewardShengWang    = (int)Global.GetSafeAttributeLong(xmlItem, "ShengWangAward");
                    data.GoodWillRatio      = (int)Global.GetSafeAttributeLong(xmlItem, "GoodWillRatio");

                    string   strGoodsAward = Global.GetSafeAttributeStr(xmlItem, "GoodsAward");
                    string[] fields        = strGoodsAward.Split(',');
                    if (fields.Length == 7)
                    {
                        data.RewardItem = new AwardsItemData()
                        {
                            Occupation          = 0,
                            RoleSex             = 0,
                            GoodsID             = Convert.ToInt32(fields[0]),
                            GoodsNum            = Convert.ToInt32(fields[1]),
                            Binding             = Convert.ToInt32(fields[2]),
                            Level               = Convert.ToInt32(fields[3]),
                            AppendLev           = Convert.ToInt32(fields[4]), // 追加等级
                            IsHaveLuckyProp     = Convert.ToInt32(fields[5]), // 是否有幸运属性
                            ExcellencePorpValue = Convert.ToInt32(fields[6]), // 卓越属性值
                            EndTime             = Global.ConstGoodsEndTime,
                        };
                    }

                    MarryPartyConfigList.Add(data.PartyType, data);
                }
            }

            string npcDataString = GameManager.systemParamsList.GetParamValueByName("HunYanNPC");

            string[] npcAttrString = npcDataString.Split(',');
            if (npcAttrString.Length >= 5)
            {
                int.TryParse(npcAttrString[0], out MarryPartyNPCConfig.MapCode);
                int.TryParse(npcAttrString[1], out MarryPartyNPCConfig.NpcID);
                int.TryParse(npcAttrString[2], out MarryPartyNPCConfig.NpcX);
                int.TryParse(npcAttrString[3], out MarryPartyNPCConfig.NpcY);
                int.TryParse(npcAttrString[4], out MarryPartyNPCConfig.NpcDir);
            }

            MarryPartyPlayerMaxJoinCount = (int)GameManager.systemParamsList.GetParamValueIntByName("HunYanUseMaxNum");
            MarryPartyJoinListResetTime  = TimeUtil.NowDateTime().DayOfYear;

            MarryPartyQueryList();
        }
 public static XElement Reload(string xmlFileName)
 {
     return(GeneralCachingXmlMgr.CachingXml(xmlFileName));
 }
Example #21
0
        public bool Init()
        {
            GeneralCachingXmlMgr.RemoveCachingXml(Global.GameResPath("Config\\HuiGuiDayZhiGou.xml"));
            XElement xml = GeneralCachingXmlMgr.GetXElement(Global.GameResPath("Config\\HuiGuiDayZhiGou.xml"));
            bool     result;

            if (null == xml)
            {
                LogManager.WriteLog(LogTypes.Fatal, string.Format("加载系统xml配置文件:{0}, 失败。没有找到相关XML配置文件!", "Config\\HuiGuiDayZhiGou.xml"), null, true);
                result = false;
            }
            else
            {
                this.ActivityType   = 113;
                this.FromDate       = "-1";
                this.ToDate         = "-1";
                this.AwardStartDate = "-1";
                this.AwardEndDate   = "-1";
                try
                {
                    IEnumerable <XElement> xmlItems = xml.Elements();
                    foreach (XElement xmlItem in xmlItems)
                    {
                        RegressActiveDayBuyXML Regress      = new RegressActiveDayBuyXML();
                        Dictionary <int, int>  TotalYuanBao = new Dictionary <int, int>();
                        Regress.ID = Convert.ToInt32(Global.GetSafeAttributeStr(xmlItem, "ID"));
                        string[] Price = Global.GetSafeAttributeStr(xmlItem, "Price").Split(new char[]
                        {
                            '|'
                        });
                        Regress.ZhiGouID     = Convert.ToInt32(Price[2]);
                        Regress.HuoDongLevel = Convert.ToInt32(Global.GetSafeAttributeStr(xmlItem, "HuoDongLevel"));
                        string[] StrRegress = Global.GetSafeAttributeStr(xmlItem, "TotalYuanBao").Split(new char[]
                        {
                            ','
                        });
                        TotalYuanBao.Add(Convert.ToInt32(StrRegress[0]), Convert.ToInt32(StrRegress[1]));
                        Regress.TotalYuanBao = TotalYuanBao;
                        Regress.Day          = Convert.ToInt32(Global.GetSafeAttributeStr(xmlItem, "Day"));
                        Regress.Max          = Convert.ToInt32(Global.GetSafeAttributeStr(xmlItem, "Max"));
                        string goods  = Global.GetSafeAttributeStr(xmlItem, "GoodsID1");
                        string goods2 = Global.GetSafeAttributeStr(xmlItem, "GoodsID2");
                        this.regressActiveDayBuyXML.Add(Regress.ID, Regress);
                        this.ActZhiGouIDSet.Add(Regress.ZhiGouID);
                        UserMoneyMgr.getInstance().CheckChargeItemConfigLogic(Regress.ZhiGouID, Regress.Max, goods, goods2, string.Format("三周年直购 ID={0}", Regress.ID));
                    }
                    if (this.regressActiveDayBuyXML == null || this.ActZhiGouIDSet == null)
                    {
                        return(false);
                    }
                    base.PredealDateTime();
                    GlobalEventSource.getInstance().registerListener(36, this);
                }
                catch (Exception ex)
                {
                    LogManager.WriteException(ex.ToString());
                }
                result = true;
            }
            return(result);
        }
Example #22
0
        public static void LoadConfig()
        {
            XElement xml = null;

            #region 加载LingYuTypeFile

            GeneralCachingXmlMgr.RemoveCachingXml(Global.GameResPath(LingYuTypeFile));
            xml = GeneralCachingXmlMgr.GetXElement(Global.GameResPath(LingYuTypeFile));
            if (xml == null)
            {
                LogManager.WriteLog(LogTypes.Error, string.Format("加载{0}时出错!!!文件不存在", LingYuTypeFile));
            }
            else
            {
                try
                {
                    LingYuTypeDict.Clear();
                    IEnumerable <XElement> xmlItems = xml.Elements();
                    foreach (var xmlItem in xmlItems)
                    {
                        if (null == xmlItem)
                        {
                            continue;
                        }

                        LingYuType lyType = new LingYuType();
                        lyType.Type                 = Convert.ToInt32(Global.GetDefAttributeStr(xmlItem, "TypeID", "0"));
                        lyType.Name                 = Global.GetDefAttributeStr(xmlItem, "Name", "no-name");
                        lyType.LifeScale            = Global.GetSafeAttributeDouble(xmlItem, "LifeScale");
                        lyType.AttackScale          = Global.GetSafeAttributeDouble(xmlItem, "AttackScale");
                        lyType.DefenseScale         = Global.GetSafeAttributeDouble(xmlItem, "DefenseScale");
                        lyType.MAttackScale         = Global.GetSafeAttributeDouble(xmlItem, "MAttackScale");
                        lyType.MDefenseScale        = Global.GetSafeAttributeDouble(xmlItem, "MDefenseScale");
                        lyType.HitScale             = Global.GetSafeAttributeDouble(xmlItem, "HitScale");
                        LingYuTypeDict[lyType.Type] = lyType;
                    }
                }
                catch (Exception ex)
                {
                    LogManager.WriteLog(LogTypes.Error, string.Format("加载{0}时异常{1}", LingYuTypeFile, ex));
                }
            }

            #endregion

            #region 加载LingYuLevelUpFile

            xml = null;
            GeneralCachingXmlMgr.RemoveCachingXml(Global.GameResPath(LingYuLevelUpFile));
            xml = GeneralCachingXmlMgr.GetXElement(Global.GameResPath(LingYuLevelUpFile));
            if (xml == null)
            {
                LogManager.WriteLog(LogTypes.Error, string.Format("加载{0}时出错!!!文件不存在", LingYuLevelUpFile));
            }
            else
            {
                try
                {
                    IEnumerable <XElement> xmlItems = xml.Elements();
                    foreach (var xmlItem in xmlItems)
                    {
                        if (null == xmlItem)
                        {
                            continue;
                        }

                        // 先读取翎羽类型
                        int        TypeID = Convert.ToInt32(Global.GetDefAttributeStr(xmlItem, "TypeID", "0"));
                        LingYuType lyType = null;
                        if (!LingYuTypeDict.TryGetValue(TypeID, out lyType))
                        {
                            LogManager.WriteLog(LogTypes.Error, string.Format("加载翎羽升级文件{0}时,未找到类型为{1}的翎羽配置", LingYuLevelUpFile, TypeID));
                            continue;
                        }

                        // 读取翎羽的每个级别的信息
                        IEnumerable <XElement> xmlItemLevels = xmlItem.Elements();
                        foreach (var xmlItemLevel in xmlItemLevels)
                        {
                            LingYuLevel lyLevel = new LingYuLevel();
                            lyLevel.Level        = Convert.ToInt32(Global.GetDefAttributeStr(xmlItemLevel, "Level", "0"));
                            lyLevel.MinAttackV   = Convert.ToInt32(Global.GetDefAttributeStr(xmlItemLevel, "MinAttackV", "0"));
                            lyLevel.MaxAttackV   = Convert.ToInt32(Global.GetDefAttributeStr(xmlItemLevel, "MaxAttackV", "0"));
                            lyLevel.MinMAttackV  = Convert.ToInt32(Global.GetDefAttributeStr(xmlItemLevel, "MinMAttackV", "0"));
                            lyLevel.MaxMAttackV  = Convert.ToInt32(Global.GetDefAttributeStr(xmlItemLevel, "MaxMAttackV", "0"));
                            lyLevel.MinDefenseV  = Convert.ToInt32(Global.GetDefAttributeStr(xmlItemLevel, "MinDefenseV", "0"));
                            lyLevel.MaxDefenseV  = Convert.ToInt32(Global.GetDefAttributeStr(xmlItemLevel, "MaxDefenseV", "0"));
                            lyLevel.MinMDefenseV = Convert.ToInt32(Global.GetDefAttributeStr(xmlItemLevel, "MinMDefenseV", "0"));
                            lyLevel.MaxMDefenseV = Convert.ToInt32(Global.GetDefAttributeStr(xmlItemLevel, "MaxMDefenseV", "0"));
                            lyLevel.HitV         = Convert.ToInt32(Global.GetDefAttributeStr(xmlItemLevel, "HitV", "0"));
                            lyLevel.LifeV        = Convert.ToInt32(Global.GetDefAttributeStr(xmlItemLevel, "LifeV", "0"));
                            lyLevel.JinBiCost    = Convert.ToInt32(Global.GetDefAttributeStr(xmlItemLevel, "JinBiCost", "0"));
                            string   costGoods      = Global.GetDefAttributeStr(xmlItemLevel, "GoodsCost", "0");
                            string[] costGoodsField = costGoods.Split(',');
                            if (costGoodsField.Length != 2)
                            {
                                LogManager.WriteLog(LogTypes.Error, string.Format("翎羽Type{0},级别{1}, 消耗物品配置错误", TypeID, lyLevel.Level));
                                continue;
                            }

                            lyLevel.GoodsCost    = Convert.ToInt32(costGoodsField[0]);
                            lyLevel.GoodsCostCnt = Convert.ToInt32(costGoodsField[1]);

                            lyType.LevelDict[lyLevel.Level] = lyLevel;

                            LingYuLevelLimit = Global.GMax(LingYuLevelLimit, lyLevel.Level);
                        }
                    }
                }
                catch (Exception ex)
                {
                    LogManager.WriteLog(LogTypes.Error, string.Format("加载{0}时异常{1}", LingYuLevelUpFile, ex));
                }
            }

            #endregion

            #region 加载LingYuSuitUpFile

            xml = null;
            GeneralCachingXmlMgr.RemoveCachingXml(Global.GameResPath(LingYuSuitUpFile));
            xml = GeneralCachingXmlMgr.GetXElement(Global.GameResPath(LingYuSuitUpFile));
            if (xml == null)
            {
                LogManager.WriteLog(LogTypes.Error, string.Format("加载{0}时出错!!!文件不存在", LingYuSuitUpFile));
            }
            else
            {
                try
                {
                    lock (LingYuTypeDict)
                    {
                        IEnumerable <XElement> xmlItems = xml.Elements();
                        foreach (var xmlItem in xmlItems)
                        {
                            if (null == xmlItem)
                            {
                                continue;
                            }

                            // 先读取翎羽类型
                            int        TypeID = Convert.ToInt32(Global.GetDefAttributeStr(xmlItem, "TypeID", "0"));
                            LingYuType lyType = null;
                            if (!LingYuTypeDict.TryGetValue(TypeID, out lyType))
                            {
                                LogManager.WriteLog(LogTypes.Error, string.Format("加载翎羽进阶文件{0}时,未找到类型为{1}的翎羽配置", LingYuSuitUpFile, TypeID));
                                continue;
                            }

                            // 读取翎羽的每个级别的信息
                            IEnumerable <XElement> xmlItemLevels = xmlItem.Elements();
                            foreach (var xmlItemLevel in xmlItemLevels)
                            {
                                LingYuSuit lySuit = new LingYuSuit();
                                lySuit.Suit         = Convert.ToInt32(Global.GetDefAttributeStr(xmlItemLevel, "SuitID", "0"));
                                lySuit.MinAttackV   = Convert.ToInt32(Global.GetDefAttributeStr(xmlItemLevel, "MinAttackV", "0"));
                                lySuit.MaxAttackV   = Convert.ToInt32(Global.GetDefAttributeStr(xmlItemLevel, "MaxAttackV", "0"));
                                lySuit.MinMAttackV  = Convert.ToInt32(Global.GetDefAttributeStr(xmlItemLevel, "MinMAttackV", "0"));
                                lySuit.MaxMAttackV  = Convert.ToInt32(Global.GetDefAttributeStr(xmlItemLevel, "MaxMAttackV", "0"));
                                lySuit.MinDefenseV  = Convert.ToInt32(Global.GetDefAttributeStr(xmlItemLevel, "MinDefenseV", "0"));
                                lySuit.MaxDefenseV  = Convert.ToInt32(Global.GetDefAttributeStr(xmlItemLevel, "MaxDefenseV", "0"));
                                lySuit.MinMDefenseV = Convert.ToInt32(Global.GetDefAttributeStr(xmlItemLevel, "MinMDefenseV", "0"));
                                lySuit.MaxMDefenseV = Convert.ToInt32(Global.GetDefAttributeStr(xmlItemLevel, "MaxMDefenseV", "0"));
                                lySuit.HitV         = Convert.ToInt32(Global.GetDefAttributeStr(xmlItemLevel, "HitV", "0"));
                                lySuit.LifeV        = Convert.ToInt32(Global.GetDefAttributeStr(xmlItemLevel, "LifeV", "0"));
                                lySuit.JinBiCost    = Convert.ToInt32(Global.GetDefAttributeStr(xmlItemLevel, "JinBiCost", "0"));
                                string   costGoods      = Global.GetDefAttributeStr(xmlItemLevel, "GoodsCost", "0");
                                string[] costGoodsField = costGoods.Split(',');
                                if (costGoodsField.Length != 2)
                                {
                                    LogManager.WriteLog(LogTypes.Error, string.Format("翎羽Type{0},级别{1}, 消耗物品配置错误", TypeID, lySuit.Suit));
                                    continue;
                                }

                                lySuit.GoodsCost    = Convert.ToInt32(costGoodsField[0]);
                                lySuit.GoodsCostCnt = Convert.ToInt32(costGoodsField[1]);

                                lyType.SuitDict[lySuit.Suit] = lySuit;

                                LingYuSuitLimit = Global.GMax(LingYuSuitLimit, lySuit.Suit);
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    LogManager.WriteLog(LogTypes.Error, string.Format("加载{0}时异常{1}", LingYuSuitUpFile, ex));
                }
            }

            #endregion

            #region 加载LingYuCollect

            xml = null;
            GeneralCachingXmlMgr.RemoveCachingXml(Global.GameResPath(LingYuCollectFile));
            xml = GeneralCachingXmlMgr.GetXElement(Global.GameResPath(LingYuCollectFile));
            if (xml == null)
            {
                LogManager.WriteLog(LogTypes.Error, string.Format("加载{0}时出错!!!文件不存在", LingYuCollectFile));
            }
            else
            {
                try
                {
                    LingYuCollectList.Clear();
                    IEnumerable <XElement> xmlItems = xml.Elements();
                    foreach (var xmlItem in xmlItems)
                    {
                        if (null == xmlItem)
                        {
                            continue;
                        }

                        LingYuCollect lyCollect = new LingYuCollect();
                        lyCollect.Num      = Convert.ToInt32(Global.GetDefAttributeStr(xmlItem, "Num", "0"));
                        lyCollect.NeedSuit = Convert.ToInt32(Global.GetDefAttributeStr(xmlItem, "NeedSuit", "0"));
                        lyCollect.Luck     = Global.GetSafeAttributeDouble(xmlItem, "Luck");
                        lyCollect.DeLuck   = Global.GetSafeAttributeDouble(xmlItem, "DeLuck");

                        LingYuCollectList.Add(lyCollect);
                    }

                    //排序
                    LingYuCollectList.Sort((left, right) =>
                    {
                        if (left.NeedSuit > right.NeedSuit)
                        {
                            return(1);
                        }
                        else if (left.NeedSuit == right.NeedSuit)
                        {
                            if (left.Num > right.Num)
                            {
                                return(1);
                            }
                            else if (left.Num == right.Num)
                            {
                                return(0);
                            }
                            else
                            {
                                return(-1);
                            }
                        }
                        else
                        {
                            return(-1);
                        }
                    });
                }
                catch (Exception ex)
                {
                    LogManager.WriteLog(LogTypes.Error, string.Format("加载{0}时异常{1}", LingYuCollectFile, ex));
                }
            }

            #endregion
        }