示例#1
0
 public void GMStartHuoDongNow(int v)
 {
     try
     {
         lock (RuntimeData.Mutex)
         {
             if (v == 0)
             {
                 ConfigParser.ParserTimeRangeList(RuntimeData.TimePoints, RuntimeData.TimePointsStr);
             }
             else
             {
                 ConfigParser.ParserTimeRangeList(RuntimeData.TimePoints, "00:00-23:59:59");
             }
         }
     }
     catch (System.Exception ex)
     {
     }
 }
示例#2
0
 private static void LoadLianZhanConfig()
 {
     try
     {
         Data.LianZhanTimes = ConfigParser.ParserIntArrayList(GameManager.systemParamsList.GetParamValueByName("RebornLianZhan"), true, '|', ',');
         Data.LianZhanMaps  = GameManager.systemParamsList.GetParamValueIntArrayByName("RebornLianZhanMap", '|');
         string fileName = Global.GameResPath("Config/RebornLianZhan.xml");
         Data._LianZhanConfigList.Load(fileName, null);
         if (Data._LianZhanConfigList.Value.Count > 0)
         {
             Data.MinLianZhanNum = Data.LianZhanConfigList.Min((LianZhanConfig x) => x.Num);
             Data.MaxLianZhanNum = Data.LianZhanConfigList.Max((LianZhanConfig x) => x.Num);
             Data.MinLianZhanNum = MathEx.GCD(Data.MinLianZhanNum, Data.MaxLianZhanNum);
         }
     }
     catch (Exception ex)
     {
         LogManager.WriteException(ex.ToString());
     }
 }
示例#3
0
        private ShenJiFuWenEffectData ParseShenJiFuWenEffectData(XElement xmlItem, string Key)
        {
            string TempValueString = Global.GetSafeAttributeStr(xmlItem, string.Format("Effect{0}", Key));

            string[] ValueFileds = TempValueString.Split(new char[]
            {
                '|'
            });
            ShenJiFuWenEffectData result;

            if (ValueFileds.Length == 0)
            {
                result = null;
            }
            else
            {
                ShenJiFuWenEffectData data = new ShenJiFuWenEffectData();
                foreach (string value in ValueFileds)
                {
                    string[] KvpFileds = value.Split(new char[]
                    {
                        ','
                    });
                    if (KvpFileds.Length == 2)
                    {
                        ExtPropIndexes index = ConfigParser.GetPropIndexByPropName(KvpFileds[0]);
                        if (index != ExtPropIndexes.Max)
                        {
                            data.ExtProps[(int)index] = Global.SafeConvertToDouble(KvpFileds[1]);
                        }
                    }
                }
                result = data;
            }
            return(result);
        }
示例#4
0
        public void LoadAwakenLevelXml()
        {
            string fileName = "";

            try
            {
                fileName = Global.GameResPath(JueXingConsts.AwakenLevel);
                XElement xml = CheckHelper.LoadXml(fileName, true);
                if (null != xml)
                {
                    Dictionary <int, AwakenLevelItem> awakenLevelDict = new Dictionary <int, AwakenLevelItem>();
                    IEnumerable <XElement>            nodes           = xml.Elements();
                    double[] extProps = new double[177];
                    foreach (XElement xmlItem in nodes)
                    {
                        if (xmlItem != null)
                        {
                            int      id = Convert.ToInt32(Global.GetDefAttributeStr(xmlItem, "ID", "0"));
                            string   tempValueString = Global.GetSafeAttributeStr(xmlItem, "AdvancedEffect");
                            string[] valueFileds     = tempValueString.Split(new char[]
                            {
                                '|'
                            });
                            if (valueFileds.Length > 0)
                            {
                                foreach (string value in valueFileds)
                                {
                                    string[] KvpFileds = value.Split(new char[]
                                    {
                                        ','
                                    });
                                    if (KvpFileds.Length == 2)
                                    {
                                        ExtPropIndexes index = ConfigParser.GetPropIndexByPropName(KvpFileds[0]);
                                        if (index < ExtPropIndexes.Max)
                                        {
                                            extProps[(int)index] += Global.SafeConvertToDouble(KvpFileds[1]);
                                        }
                                    }
                                }
                            }
                            awakenLevelDict[id] = new AwakenLevelItem
                            {
                                ID                 = id,
                                Order              = Convert.ToInt32(Global.GetDefAttributeStr(xmlItem, "Order", "0")),
                                Star               = Convert.ToInt32(Global.GetDefAttributeStr(xmlItem, "Star", "0")),
                                Awakenment         = Convert.ToInt32(Global.GetDefAttributeStr(xmlItem, "Awakenment", "0")),
                                AwakenAdvancedment = Global.GetDefAttributeStr(xmlItem, "AwakenAdvancedment", "0"),
                                EnlargeRate        = Convert.ToDouble(Global.GetDefAttributeStr(xmlItem, "EnlargeRate", "0")),
                                ExtProps           = (double[])extProps.Clone()
                            };
                        }
                    }
                    lock (this.JueXingRunTimeData.Mutex)
                    {
                        this.JueXingRunTimeData.AwakenLevelDict = awakenLevelDict;
                    }
                }
            }
            catch (Exception ex)
            {
                LogManager.WriteLog(LogTypes.Fatal, string.Format("加载xml配置文件:{0}, 失败。", fileName), ex, true);
            }
        }
示例#5
0
        public void LoadAwakenSuitXml()
        {
            string fileName = "";

            try
            {
                fileName = Global.GameResPath(JueXingConsts.AwakenSuit);
                XElement xml = CheckHelper.LoadXml(fileName, true);
                if (null != xml)
                {
                    Dictionary <int, TaoZhuang> taoZhuangDict = new Dictionary <int, TaoZhuang>();
                    IEnumerable <XElement>      nodes         = xml.Elements();
                    foreach (XElement xmlItem in nodes)
                    {
                        if (xmlItem != null)
                        {
                            int      id = Convert.ToInt32(Global.GetDefAttributeStr(xmlItem, "ID", "0"));
                            string   tempValueString = Global.GetSafeAttributeStr(xmlItem, "TaoZhuangProps1");
                            string[] valueFileds     = tempValueString.Split(new char[]
                            {
                                '|'
                            });
                            double[] extProps = new double[177];
                            foreach (string value in valueFileds)
                            {
                                string[] KvpFileds = value.Split(new char[]
                                {
                                    ','
                                });
                                if (KvpFileds.Length == 2)
                                {
                                    ExtPropIndexes index = ConfigParser.GetPropIndexByPropName(KvpFileds[0]);
                                    if (index < ExtPropIndexes.Max)
                                    {
                                        extProps[(int)index] = Global.SafeConvertToDouble(KvpFileds[1]);
                                    }
                                }
                            }
                            tempValueString = Global.GetSafeAttributeStr(xmlItem, "TaoZhuangProps2");
                            valueFileds     = tempValueString.Split(new char[]
                            {
                                '|'
                            });
                            double[] extProps2 = new double[177];
                            foreach (string value in valueFileds)
                            {
                                string[] KvpFileds = value.Split(new char[]
                                {
                                    ','
                                });
                                if (KvpFileds.Length == 2)
                                {
                                    ExtPropIndexes index = ConfigParser.GetPropIndexByPropName(KvpFileds[0]);
                                    if (index < ExtPropIndexes.Max)
                                    {
                                        extProps2[(int)index] = Global.SafeConvertToDouble(KvpFileds[1]);
                                    }
                                }
                            }
                            tempValueString = Global.GetSafeAttributeStr(xmlItem, "TaoZhuangProps3");
                            valueFileds     = tempValueString.Split(new char[]
                            {
                                '|'
                            });
                            double[] extProps3 = new double[177];
                            foreach (string value in valueFileds)
                            {
                                string[] KvpFileds = value.Split(new char[]
                                {
                                    ','
                                });
                                if (KvpFileds.Length == 2)
                                {
                                    ExtPropIndexes index = ConfigParser.GetPropIndexByPropName(KvpFileds[0]);
                                    if (index < ExtPropIndexes.Max)
                                    {
                                        extProps3[(int)index] = Global.SafeConvertToDouble(KvpFileds[1]);
                                    }
                                }
                            }
                            string[] weaponStr = Global.GetDefAttributeStr(xmlItem, "WeaponMaster", "").Split(new char[]
                            {
                                ','
                            });
                            int weaponNum  = 0;
                            int weaponType = 0;
                            if (weaponStr.Length > 1)
                            {
                                weaponNum  = Convert.ToInt32(weaponStr[0]);
                                weaponType = Convert.ToInt32(weaponStr[1]);
                            }
                            List <List <int> > passiveSkill     = new List <List <int> >();
                            string[]           passiveSkillList = Global.GetDefAttributeStr(xmlItem, "Magic", "").Split(new char[]
                            {
                                '|'
                            });
                            foreach (string one in passiveSkillList)
                            {
                                if (!string.IsNullOrEmpty(one))
                                {
                                    string[] skillItem = one.Split(new char[]
                                    {
                                        ','
                                    });
                                    if (skillItem.Length > 1)
                                    {
                                        passiveSkill.Add(Array.ConvertAll <string, int>(skillItem, (string x) => Convert.ToInt32(x)).ToList <int>());
                                    }
                                }
                            }
                            List <List <int> > passiveEffect     = new List <List <int> >();
                            string[]           passiveEffectList = Global.GetDefAttributeStr(xmlItem, "PassiveEffect", "").Split(new char[]
                            {
                                '|'
                            });
                            foreach (string one in passiveEffectList)
                            {
                                if (!string.IsNullOrEmpty(one))
                                {
                                    string[] passiveItem = one.Split(new char[]
                                    {
                                        ','
                                    });
                                    if (passiveItem.Length > 1)
                                    {
                                        passiveEffect.Add(Array.ConvertAll <string, int>(passiveItem, (string x) => Convert.ToInt32(x)).ToList <int>());
                                    }
                                }
                            }
                            Dictionary <int, TaoZhuang> dictionary = taoZhuangDict;
                            int       key       = id;
                            TaoZhuang taoZhuang = new TaoZhuang();
                            taoZhuang.ID         = id;
                            taoZhuang.Type       = Convert.ToInt32(Global.GetDefAttributeStr(xmlItem, "Type", "0"));
                            taoZhuang.AwakenList = Array.ConvertAll <string, int>(Global.GetDefAttributeStr(xmlItem, "AwakenID", "").Split(new char[]
                            {
                                ','
                            }), (string x) => Convert.ToInt32(x)).ToList <int>();
                            taoZhuang.TaoZhuangProps1Num = Global.SafeConvertToInt32(Global.GetDefAttributeStr(xmlItem, "TaoZhuangProps1Num", "0"));
                            taoZhuang.TaoZhuangProps1    = extProps;
                            taoZhuang.TaoZhuangProps2Num = Global.SafeConvertToInt32(Global.GetDefAttributeStr(xmlItem, "TaoZhuangProps2Num", "0"));
                            taoZhuang.TaoZhuangProps2    = extProps2;
                            taoZhuang.TaoZhuangProps3Num = Global.SafeConvertToInt32(Global.GetDefAttributeStr(xmlItem, "TaoZhuangProps3Num", "0"));
                            taoZhuang.TaoZhuangProps3    = extProps3;
                            taoZhuang.WeaponMasterNum    = weaponNum;
                            taoZhuang.WeaponMasterType   = weaponType;
                            taoZhuang.PassiveSkill       = passiveSkill;
                            taoZhuang.PassiveEffect      = passiveEffect;
                            dictionary[key] = taoZhuang;
                        }
                    }
                    lock (this.JueXingRunTimeData.Mutex)
                    {
                        this.JueXingRunTimeData.TaoZhuangDict = taoZhuangDict;
                        foreach (TaoZhuang item in taoZhuangDict.Values)
                        {
                            foreach (int id in item.AwakenList)
                            {
                                if (this.JueXingRunTimeData.JueXingShiDict.ContainsKey(id))
                                {
                                    this.JueXingRunTimeData.JueXingShiDict[id].SuitParent = item.ID;
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                LogManager.WriteLog(LogTypes.Fatal, string.Format("加载xml配置文件:{0}, 失败。", fileName), ex, true);
            }
        }
示例#6
0
        public void LoadAwakenActivationXml()
        {
            string fileName = "";

            try
            {
                fileName = Global.GameResPath(JueXingConsts.AwakenActivation);
                XElement xml = CheckHelper.LoadXml(fileName, true);
                if (null != xml)
                {
                    Dictionary <int, JueXingShiItem> jueXingShiDict = new Dictionary <int, JueXingShiItem>();
                    IEnumerable <XElement>           nodes          = xml.Elements();
                    foreach (XElement xmlItem in nodes)
                    {
                        if (xmlItem != null)
                        {
                            int   id       = Convert.ToInt32(Global.GetDefAttributeStr(xmlItem, "ID", "0"));
                            int[] material = Array.ConvertAll <string, int>(Global.GetDefAttributeStr(xmlItem, "Material", "").Split(new char[]
                            {
                                ','
                            }), (string x) => Convert.ToInt32(x));
                            if (material.Length < 2)
                            {
                                LogManager.WriteLog(LogTypes.Error, string.Format("加载xml配置文件:{0}, 错误。", fileName), null, true);
                            }
                            else
                            {
                                string   tempValueString = Global.GetSafeAttributeStr(xmlItem, "BaseProps");
                                string[] valueFileds     = tempValueString.Split(new char[]
                                {
                                    '|'
                                });
                                double[] extProps = new double[177];
                                foreach (string value in valueFileds)
                                {
                                    string[] KvpFileds = value.Split(new char[]
                                    {
                                        ','
                                    });
                                    if (KvpFileds.Length == 2)
                                    {
                                        ExtPropIndexes index = ConfigParser.GetPropIndexByPropName(KvpFileds[0]);
                                        if (index < ExtPropIndexes.Max)
                                        {
                                            extProps[(int)index] = Global.SafeConvertToDouble(KvpFileds[1]);
                                        }
                                    }
                                }
                                jueXingShiDict[id] = new JueXingShiItem
                                {
                                    ID           = id,
                                    Position     = Convert.ToInt32(Global.GetDefAttributeStr(xmlItem, "Position", "0")),
                                    NeedGoodsID  = material[0],
                                    NeedGoodsNum = material[1],
                                    ExtProps     = extProps
                                };
                                lock (this.JueXingRunTimeData.Mutex)
                                {
                                    this.JueXingRunTimeData.JueXingShiDict = jueXingShiDict;
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                LogManager.WriteLog(LogTypes.Fatal, string.Format("加载xml配置文件:{0}, 失败。", fileName), ex, true);
            }
        }
示例#7
0
        public bool ProcessGetYongZheZhanChangStateCmd(GameClient client, int nID, byte[] bytes, string[] cmdParams)
        {
            try
            {
                // 根据策划需求,任何时候来查询状态,领奖状态具有最高优先级
                string awardsInfo = Global.GetRoleParamByName(client, RoleParamName.YongZheZhanChangAwards);
                if (!string.IsNullOrEmpty(awardsInfo))
                {
                    int lastGroupId = 0;
                    int score       = 0;
                    int success     = 0;
                    ConfigParser.ParseStrInt3(awardsInfo, ref lastGroupId, ref success, ref score);
                    if (lastGroupId > 0)
                    {
                        YongZheZhanChangSceneInfo lastSceneItem = null;
                        if (RuntimeData.SceneDataDict.TryGetValue(lastGroupId, out lastSceneItem))
                        {
                            // 通知有奖励可以领取
                            client.sendCmd(nID, (int)YongZheZhanChangGameStates.Awards);
                            return(true);
                        }
                    }
                }

                YongZheZhanChangSceneInfo  sceneItem = null;
                YongZheZhanChangGameStates timeState = YongZheZhanChangGameStates.None;
                int result  = (int)YongZheZhanChangGameStates.None;
                int groupId = 0;
                RuntimeData.RoleId2JoinGroup.TryGetValue(client.ClientData.RoleID, out groupId);

                CheckCondition(client, ref sceneItem, ref timeState);
                if (groupId > 0)
                {
                    if (timeState >= YongZheZhanChangGameStates.SignUp && timeState <= YongZheZhanChangGameStates.Wait)
                    {
                        int state = YongZheZhanChangClient.getInstance().GetKuaFuRoleState(client.ClientData.RoleID);
                        if (state >= (int)KuaFuRoleStates.SignUp)
                        {
                            result = (int)YongZheZhanChangGameStates.Wait;
                        }
                        else
                        {
                            result = (int)KuaFuBossGameStates.NotJoin;
                        }
                    }
                    else if (timeState == YongZheZhanChangGameStates.Start)
                    {
                        if (RuntimeData.RoleIdKuaFuLoginDataDict.ContainsKey(client.ClientData.RoleID))
                        {
                            result = (int)YongZheZhanChangGameStates.Start;
                        }
                    }
                }
                else
                {
                    if (timeState == YongZheZhanChangGameStates.SignUp)
                    {
                        result = (int)YongZheZhanChangGameStates.SignUp;
                    }
                    else if (timeState == YongZheZhanChangGameStates.Wait || timeState == YongZheZhanChangGameStates.Start)
                    {
                        // 未参加本次活动
                        result = (int)YongZheZhanChangGameStates.NotJoin;
                    }
                }

                client.sendCmd(nID, result);
                return(true);
            }
            catch (Exception ex)
            {
                DataHelper.WriteFormatExceptionLog(ex, Global.GetDebugHelperInfo(client.ClientSocket), false);
            }

            return(false);
        }
示例#8
0
        public bool ProcessGetYongZheZhanChangAwardCmd(GameClient client, int nID, byte[] bytes, string[] cmdParams)
        {
            try
            {
                int err = StdErrorCode.Error_Success;

                // 如果1.7的功能没开放
                if (GameFuncControlManager.IsGameFuncDisabled(GameFuncType.System1Dot7))
                {
                    return(false);
                }

                string awardsInfo = Global.GetRoleParamByName(client, RoleParamName.YongZheZhanChangAwards);
                if (!string.IsNullOrEmpty(awardsInfo))
                {
                    int lastGroupId = 0;
                    int score       = 0;
                    int success     = 0;
                    int sideScore1  = 0;
                    int sideScore2  = 0;
                    ConfigParser.ParseStrInt3(awardsInfo, ref lastGroupId, ref success, ref score);
                    List <int> awardsParamList = Global.StringToIntList(awardsInfo, ',');
                    lastGroupId = awardsParamList[0];
                    bool clear = true;
                    if (awardsParamList.Count >= 5 && lastGroupId > 0)
                    {
                        success    = awardsParamList[1];
                        score      = awardsParamList[2];
                        sideScore1 = awardsParamList[3];
                        sideScore2 = awardsParamList[4];

                        YongZheZhanChangSceneInfo lastSceneItem = null;
                        if (RuntimeData.SceneDataDict.TryGetValue(lastGroupId, out lastSceneItem))
                        {
                            err = GiveRoleAwards(client, success, score, lastSceneItem);
                            if (err < StdErrorCode.Error_Success_No_Info)
                            {
                                clear = false;
                            }
                        }
                    }

                    if (clear)
                    {
                        Global.SaveRoleParamsStringToDB(client, RoleParamName.YongZheZhanChangAwards, RuntimeData.RoleParamsAwardsDefaultString, true);
                    }

                    client.sendCmd(nID, err);
                }

                return(true);
            }
            catch (Exception ex)
            {
                DataHelper.WriteFormatExceptionLog(ex, Global.GetDebugHelperInfo(client.ClientSocket), false);
            }

            client.sendCmd(nID, StdErrorCode.Error_Success_No_Info);

            return(false);
        }
示例#9
0
        /// <summary>
        /// 初始化配置
        /// </summary>
        public bool InitConfig()
        {
            bool     success          = true;
            XElement xml              = null;
            string   fileName         = "";
            string   fullPathFileName = "";
            IEnumerable <XElement> nodes;

            lock (RuntimeData.Mutex)
            {
                try
                {
                    //采集怪配置
                    RuntimeData.BattleCrystalMonsterDict.Clear();

                    fileName         = "Config/BattleCrystalMonster.xml";
                    fullPathFileName = Global.GameResPath(fileName); //Global.IsolateResPath(fileName);
                    xml   = XElement.Load(fullPathFileName);
                    nodes = xml.Elements();
                    foreach (var node in nodes)
                    {
                        BattleCrystalMonsterItem item = new BattleCrystalMonsterItem();
                        item.Id          = (int)Global.GetSafeAttributeLong(node, "ID");
                        item.MonsterID   = (int)Global.GetSafeAttributeLong(node, "MonsterID");
                        item.GatherTime  = (int)Global.GetSafeAttributeLong(node, "GatherTime");
                        item.BattleJiFen = (int)Global.GetSafeAttributeLong(node, "BattleJiFen");
                        item.PosX        = (int)Global.GetSafeAttributeLong(node, "X");
                        item.PosY        = (int)Global.GetSafeAttributeLong(node, "Y");
                        item.FuHuoTime   = (int)Global.GetSafeAttributeLong(node, "FuHuoTime") * 1000;
                        //RuntimeData.BattleCrystalMonsterDict[item.MonsterID] = item;
                        RuntimeData.BattleCrystalMonsterDict[item.Id] = item;
                    }

                    //出生点配置
                    RuntimeData.MapBirthPointDict.Clear();

                    fileName         = "Config/ThroughServiceRebirth.xml";
                    fullPathFileName = Global.GameResPath(fileName); //Global.IsolateResPath(fileName);
                    xml   = XElement.Load(fullPathFileName);
                    nodes = xml.Elements();
                    foreach (var node in nodes)
                    {
                        YongZheZhanChangBirthPoint item = new YongZheZhanChangBirthPoint();
                        item.ID          = (int)Global.GetSafeAttributeLong(node, "ID");
                        item.PosX        = (int)Global.GetSafeAttributeLong(node, "PosX");
                        item.PosY        = (int)Global.GetSafeAttributeLong(node, "PosY");
                        item.BirthRadius = (int)Global.GetSafeAttributeLong(node, "BirthRadius");

                        RuntimeData.MapBirthPointDict[item.ID] = item;
                    }

                    //活动配置
                    RuntimeData.SceneDataDict.Clear();
                    RuntimeData.LevelRangeSceneIdDict.Clear();

                    fileName         = "Config/ThroughServiceBattle.xml";
                    fullPathFileName = Global.GameResPath(fileName); //Global.IsolateResPath(fileName);
                    xml   = XElement.Load(fullPathFileName);
                    nodes = xml.Elements();
                    foreach (var node in nodes)
                    {
                        YongZheZhanChangSceneInfo sceneItem = new YongZheZhanChangSceneInfo();
                        int id      = (int)Global.GetSafeAttributeLong(node, "Group");
                        int mapCode = (int)Global.GetSafeAttributeLong(node, "MapCode");

                        sceneItem.Id               = id;
                        sceneItem.MapCode          = mapCode;
                        sceneItem.MinLevel         = (int)Global.GetSafeAttributeLong(node, "MinLevel");
                        sceneItem.MaxLevel         = (int)Global.GetSafeAttributeLong(node, "MaxLevel");
                        sceneItem.MinZhuanSheng    = (int)Global.GetSafeAttributeLong(node, "MinZhuanSheng");
                        sceneItem.MaxZhuanSheng    = (int)Global.GetSafeAttributeLong(node, "MaxZhuanSheng");
                        sceneItem.PrepareSecs      = (int)Global.GetSafeAttributeLong(node, "PrepareSecs");
                        sceneItem.WaitingEnterSecs = (int)Global.GetSafeAttributeLong(node, "WaitingEnterSecs");
                        sceneItem.FightingSecs     = (int)Global.GetSafeAttributeLong(node, "FightingSecs");
                        sceneItem.ClearRolesSecs   = (int)Global.GetSafeAttributeLong(node, "ClearRolesSecs");

                        ConfigParser.ParseStrInt2(Global.GetSafeAttributeStr(node, "ApplyTime"), ref sceneItem.SignUpStartSecs, ref sceneItem.SignUpEndSecs);
                        sceneItem.SignUpStartSecs += sceneItem.SignUpEndSecs;

                        if (!ConfigParser.ParserTimeRangeListWithDay(sceneItem.TimePoints, Global.GetSafeAttributeStr(node, "TimePoints")))
                        {
                            success = false;
                            LogManager.WriteLog(LogTypes.Fatal, string.Format("读取{0}时间配置(TimePoints)出错", fileName));
                        }

                        for (int i = 0; i < sceneItem.TimePoints.Count; ++i)
                        {
                            TimeSpan ts = new TimeSpan(sceneItem.TimePoints[i].Hours, sceneItem.TimePoints[i].Minutes, sceneItem.TimePoints[i].Seconds);
                            sceneItem.SecondsOfDay.Add(ts.TotalSeconds);
                        }

                        GameMap gameMap = null;
                        if (!GameManager.MapMgr.DictMaps.TryGetValue(mapCode, out gameMap))
                        {
                            success = false;
                            LogManager.WriteLog(LogTypes.Fatal, string.Format("55地图配置中缺少{0}所需的地图:{1}", fileName, mapCode));
                        }

                        RangeKey range = new RangeKey(Global.GetUnionLevel(sceneItem.MinZhuanSheng, sceneItem.MinLevel), Global.GetUnionLevel(sceneItem.MaxZhuanSheng, sceneItem.MaxLevel));
                        RuntimeData.LevelRangeSceneIdDict[range] = sceneItem;
                        RuntimeData.SceneDataDict[id]            = sceneItem;
                    }

                    //活动奖励配置
                    fileName         = "Config/ThroughServiceBattleAward.xml";
                    fullPathFileName = Global.GameResPath(fileName); //Global.IsolateResPath(fileName);
                    xml   = XElement.Load(fullPathFileName);
                    nodes = xml.Elements();
                    foreach (var node in nodes)
                    {
                        int id = (int)Global.GetSafeAttributeLong(node, "MapCode");
                        YongZheZhanChangSceneInfo sceneItem;
                        if (RuntimeData.SceneDataDict.TryGetValue(id, out sceneItem))
                        {
                            sceneItem.Exp       = (int)Global.GetSafeAttributeLong(node, "Exp");
                            sceneItem.BandJinBi = (int)Global.GetSafeAttributeLong(node, "BandJinBi");
                            ConfigParser.ParseAwardsItemList(Global.GetSafeAttributeStr(node, "WinGoods"), ref sceneItem.WinAwardsItemList);
                            ConfigParser.ParseAwardsItemList(Global.GetSafeAttributeStr(node, "LoseGoods"), ref sceneItem.LoseAwardsItemList);
                        }
                    }

                    fileName         = "Config/BattleMonster.xml";
                    fullPathFileName = Global.GameResPath(fileName);
                    xml   = XElement.Load(fullPathFileName);
                    nodes = xml.Elements();
                    foreach (var node in nodes)
                    {
                        BattleDynamicMonsterItem item = new BattleDynamicMonsterItem();
                        item.Id           = (int)Global.GetSafeAttributeLong(node, "ID");
                        item.MapCode      = (int)Global.GetSafeAttributeLong(node, "CodeID");
                        item.MonsterID    = (int)Global.GetSafeAttributeLong(node, "MonsterID");
                        item.PosX         = (int)Global.GetSafeAttributeLong(node, "X");
                        item.PosY         = (int)Global.GetSafeAttributeLong(node, "Y");
                        item.DelayBirthMs = (int)Global.GetSafeAttributeLong(node, "Time");

                        List <BattleDynamicMonsterItem> itemList = null;
                        if (!RuntimeData.SceneDynMonsterDict.TryGetValue(item.MapCode, out itemList))
                        {
                            itemList = new List <BattleDynamicMonsterItem>();
                            RuntimeData.SceneDynMonsterDict[item.MapCode] = itemList;
                        }

                        itemList.Add(item);
                    }

                    //奖励配置
                    RuntimeData.WarriorBattleBOssLastAttack = (int)GameManager.systemParamsList.GetParamValueIntByName("WarriorBattleBOssLastAttack");
                    //RuntimeData.WarriorBattlePk = (int)GameManager.systemParamsList.GetParamValueIntByName("WarriorBattlePk");
                    RuntimeData.WarriorBattleLowestJiFen = (int)GameManager.systemParamsList.GetParamValueIntByName("WarriorBattleLowestJiFen");
                    double[] doubalArray = GameManager.systemParamsList.GetParamValueDoubleArrayByName("WarriorBattleBossAttack");
                    if (doubalArray.Length == 2)
                    {
                        RuntimeData.WarriorBattleBossAttackPercent = doubalArray[0];
                        RuntimeData.WarriorBattleBossAttackScore   = (int)doubalArray[1];
                    }
                    int[] intArray = GameManager.systemParamsList.GetParamValueIntArrayByName("WarriorBattleUltraKill");
                    if (doubalArray.Length == 2)
                    {
                        RuntimeData.WarriorBattleUltraKillParam1 = intArray[0];
                        RuntimeData.WarriorBattleUltraKillParam2 = intArray[1];
                        RuntimeData.WarriorBattleUltraKillParam3 = intArray[2];
                        RuntimeData.WarriorBattleUltraKillParam4 = intArray[3];
                    }
                    intArray = GameManager.systemParamsList.GetParamValueIntArrayByName("WarriorBattleShutDown");
                    if (doubalArray.Length == 2)
                    {
                        RuntimeData.WarriorBattleShutDownParam1 = intArray[0];
                        RuntimeData.WarriorBattleShutDownParam2 = intArray[1];
                        RuntimeData.WarriorBattleShutDownParam3 = intArray[2];
                        RuntimeData.WarriorBattleShutDownParam4 = intArray[3];
                    }
                }
                catch (System.Exception ex)
                {
                    success = false;
                    LogManager.WriteLog(LogTypes.Fatal, string.Format("加载xml配置文件:{0}, 失败。", fileName), ex);
                }
            }

            return(success);
        }
示例#10
0
        public void Initialize()
        {
            SystemXmlItems xml = new SystemXmlItems();

            xml.LoadFromXMlFile("Config/BuJian.xml", "", "ID", 0);
            foreach (KeyValuePair <int, SystemXmlItem> item in xml.SystemXmlItemDict)
            {
                HolyPartInfo data = new HolyPartInfo();
                data.m_nCostBandJinBi      = item.Value.GetIntValue("CostBandJinBi", -1);
                data.m_sSuccessProbability = Convert.ToSByte(item.Value.GetDoubleValue("SuccessProbability") * 100.0);
                if (data.m_sSuccessProbability < 0)
                {
                    data.m_sSuccessProbability = -1;
                }
                string[] strfiled = item.Value.GetStringValue("NeedGoods").Split(new char[]
                {
                    ','
                });
                if (strfiled.Length > 1)
                {
                    data.m_nNeedGoodsCount = Global.SafeConvertToInt32(strfiled[1]);
                }
                strfiled = item.Value.GetStringValue("FailCost").Split(new char[]
                {
                    ','
                });
                if (strfiled.Length > 1)
                {
                    data.m_nFailCostGoodsCount = Global.SafeConvertToInt32(strfiled[1]);
                }
                string strParam = item.Value.GetStringValue("Property");
                if (strParam != "-1")
                {
                    data.m_PropertyList = GameManager.SystemMagicActionMgr.ParseActionsOutUse(strParam);
                }
                data.m_nMaxFailCount = item.Value.GetIntValue("FailMaxNum", -1);
                if (data.m_nMaxFailCount < 0)
                {
                    data.m_nMaxFailCount = 0;
                }
                data.NeedGoods      = ConfigParser.ParserIntArrayList(item.Value.GetStringValue("NeedItem"), true, '|', ',');
                data.FaildNeedGoods = ConfigParser.ParserIntArrayList(item.Value.GetStringValue("FailureConsumption"), true, '|', ',');
                this._partDataDic.Add(item.Value.GetIntValue("ID", -1), data);
                int suitID = item.Value.GetIntValue("SuitID", -1);
                HolyItemManager.MAX_HOLY_PART_LEVEL = Math.Max(HolyItemManager.MAX_HOLY_PART_LEVEL, Convert.ToSByte(suitID));
            }
            HolyItemManager.MAX_HOLY_PART_LEVEL = (sbyte)Global.GMin((int)HolyItemManager.MAX_HOLY_PART_LEVEL, (int)GameManager.systemParamsList.GetParamValueIntByName("ShengWuMax", 0));
            xml = new SystemXmlItems();
            xml.LoadFromXMlFile("Config/ShengWu.xml", "", "ID", 0);
            foreach (KeyValuePair <int, SystemXmlItem> item in xml.SystemXmlItemDict)
            {
                HolyInfo data2    = new HolyInfo();
                string   strParam = item.Value.GetStringValue("ExtraProperty");
                if (strParam != "-1")
                {
                    data2.m_ExtraPropertyList = GameManager.SystemMagicActionMgr.ParseActionsOutUse(strParam);
                }
                this._holyDataDic.Add(item.Value.GetIntValue("ID", -1), data2);
            }
            TCPCmdDispatcher.getInstance().registerProcessorEx(10206, 2, 2, HolyItemManager.getInstance(), TCPCmdFlags.IsStringArrayParams);
        }
示例#11
0
 public bool InitConfig()
 {
     lock (this.RuntimeData.Mutex)
     {
         this.RuntimeData.SystemOpen = false;
         string   fileName = Global.GameResPath("Config/TenRetutnAward.xml");
         XElement xml      = CheckHelper.LoadXml(fileName, true);
         if (null == xml)
         {
             return(true);
         }
         try
         {
             this.RuntimeData.SystemOpen = false;
             this.RuntimeData._tenAwardDic.Clear();
             IEnumerable <XElement> xmlItems = xml.Elements();
             foreach (XElement xmlItem in xmlItems)
             {
                 if (xmlItem != null)
                 {
                     TenRetutnAwardsData config = new TenRetutnAwardsData();
                     config.ID          = Convert.ToInt32(Global.GetSafeAttributeLong(xmlItem, "ID"));
                     config.MailUser    = GLang.GetLang(112, new object[0]);
                     config.MailTitle   = Global.GetSafeAttributeStr(xmlItem, "MailTitle");
                     config.MailContent = Global.GetSafeAttributeStr(xmlItem, "MailContent");
                     ConfigParser.ParseAwardsItemList(Global.GetDefAttributeStr(xmlItem, "GoodsID1", ""), ref config.GoodsID1, '|', ',');
                     ConfigParser.ParseAwardsItemList(Global.GetDefAttributeStr(xmlItem, "GoodsID2", ""), ref config.GoodsID2, '|', ',');
                     config.UserList = Global.GetSafeAttributeStr(xmlItem, "UserList");
                     string beginTime  = Global.GetDefAttributeStr(xmlItem, "BeginTime", "2019-12-31");
                     string finishTime = Global.GetDefAttributeStr(xmlItem, "FinishTime", "2011-11-11");
                     config.BeginTimeStr  = beginTime.Replace(':', '$');
                     config.FinishTimeStr = finishTime.Replace(':', '$');
                     if (DateTime.TryParse(beginTime, out config.BeginTime) && DateTime.TryParse(finishTime, out config.FinishTime) && TimeUtil.NowDateTime() < config.FinishTime)
                     {
                         config.SystemOpen = true;
                         this.RuntimeData._tenAwardDic.Add(config.ID, config);
                         fileName = Global.GameResPath("Config/" + config.UserList);
                         if (File.Exists(fileName))
                         {
                             string[] allUserIds = File.ReadAllLines(fileName);
                             foreach (string userid in allUserIds)
                             {
                                 if (!string.IsNullOrEmpty(userid))
                                 {
                                     config._tenUserIdAwardsDict[userid.ToLower()] = false;
                                 }
                             }
                         }
                         if (config._tenUserIdAwardsDict.Count == 0)
                         {
                             config.SystemOpen = false;
                         }
                     }
                     this.RuntimeData.SystemOpen |= config.SystemOpen;
                 }
             }
         }
         catch (Exception ex)
         {
             LogManager.WriteLog(LogTypes.Warning, "加载Config/TenRetutnAward.xml时文件出现异常!!!", ex, true);
         }
     }
     return(true);
 }
示例#12
0
        /// <summary>
        /// 初始化配置
        /// </summary>
        public bool InitConfig()
        {
            bool     success          = true;
            XElement xml              = null;
            string   fileName         = "";
            string   fullPathFileName = "";
            IEnumerable <XElement> nodes;

            lock (RuntimeData.Mutex)
            {
                try
                {
                    //段位配置
                    RuntimeData.TianTiDuanWeiDict.Clear();
                    RuntimeData.DuanWeiJiFenRangeDuanWeiIdDict.Clear();

                    int preJiFen     = 0;
                    int perDuanWeiId = 0;
                    int maxDuanWeiId = 0;
                    fileName         = "Config/DuanWei.xml";
                    fullPathFileName = Global.GameResPath(fileName); //Global.IsolateResPath(fileName);
                    xml   = XElement.Load(fullPathFileName);
                    nodes = xml.Elements();
                    foreach (var node in nodes)
                    {
                        TianTiDuanWei item = new TianTiDuanWei();
                        item.ID = (int)Global.GetSafeAttributeLong(node, "ID");
                        item.NeedDuanWeiJiFen = (int)Global.GetSafeAttributeLong(node, "NeedDuanWeiJiFen");
                        item.WinJiFen         = (int)Global.GetSafeAttributeLong(node, "WinJiFen");
                        item.LoseJiFen        = (int)Global.GetSafeAttributeLong(node, "LoseJiFen");
                        item.RongYaoNum       = (int)Global.GetSafeAttributeLong(node, "RongYaoNum");
                        item.WinRongYu        = (int)Global.GetSafeAttributeLong(node, "WinRongYu");
                        item.LoseRongYu       = (int)Global.GetSafeAttributeLong(node, "LoseRongYu");

                        if (perDuanWeiId > 0)
                        {
                            RuntimeData.DuanWeiJiFenRangeDuanWeiIdDict[new RangeKey(preJiFen, item.NeedDuanWeiJiFen - 1)] = perDuanWeiId;
                        }

                        preJiFen     = item.NeedDuanWeiJiFen;
                        perDuanWeiId = item.ID;
                        maxDuanWeiId = item.ID;
                        RuntimeData.TianTiDuanWeiDict[item.ID] = item;
                    }

                    if (maxDuanWeiId > 0 && preJiFen > 0)
                    {
                        RuntimeData.DuanWeiJiFenRangeDuanWeiIdDict[new RangeKey(preJiFen, int.MaxValue)] = maxDuanWeiId;
                    }

                    //出生点配置
                    RuntimeData.MapBirthPointDict.Clear();

                    fileName         = "Config/TianTiBirthPoint.xml";
                    fullPathFileName = Global.GameResPath(fileName); //Global.IsolateResPath(fileName);
                    xml   = XElement.Load(fullPathFileName);
                    nodes = xml.Elements();
                    foreach (var node in nodes)
                    {
                        TianTiBirthPoint item = new TianTiBirthPoint();
                        item.ID          = (int)Global.GetSafeAttributeLong(node, "ID");
                        item.PosX        = (int)Global.GetSafeAttributeLong(node, "PosX");
                        item.PosY        = (int)Global.GetSafeAttributeLong(node, "PosY");
                        item.BirthRadius = (int)Global.GetSafeAttributeLong(node, "BirthRadius");

                        RuntimeData.MapBirthPointDict[item.ID] = item;
                    }

                    //段位排行奖励
                    RuntimeData.DuanWeiRankAwardDict.Clear();

                    fileName         = "Config/DuanWeiRankAward.xml";
                    fullPathFileName = Global.GameResPath(fileName); //Global.IsolateResPath(fileName);
                    xml   = XElement.Load(fullPathFileName);
                    nodes = xml.Elements();
                    foreach (var node in nodes)
                    {
                        DuanWeiRankAward item = new DuanWeiRankAward();
                        item.ID       = (int)Global.GetSafeAttributeLong(node, "ID");
                        item.StarRank = (int)Global.GetSafeAttributeLong(node, "StarRank");
                        item.EndRank  = (int)Global.GetSafeAttributeLong(node, "EndRank");
                        ConfigParser.ParseAwardsItemList(Global.GetSafeAttributeStr(node, "Award"), ref item.Award);
                        if (item.EndRank < 0)
                        {
                            item.EndRank = int.MaxValue;
                        }

                        RuntimeData.DuanWeiRankAwardDict[new RangeKey(item.StarRank, item.EndRank)] = item;
                    }

                    //活动配置
                    RuntimeData.MapCodeDict.Clear();

                    fileName         = "Config/TianTi.xml";
                    fullPathFileName = Global.GameResPath(fileName); //Global.IsolateResPath(fileName);
                    xml   = XElement.Load(fullPathFileName);
                    nodes = xml.Elements();
                    foreach (var node in nodes)
                    {
                        int mapCode = (int)Global.GetSafeAttributeLong(node, "MapCode");
                        if (!RuntimeData.MapCodeDict.ContainsKey(mapCode))
                        {
                            RuntimeData.MapCodeDict[mapCode] = 1;
                            RuntimeData.MapCodeList.Add(mapCode);
                        }

                        RuntimeData.WaitingEnterSecs = (int)Global.GetSafeAttributeLong(node, "WaitingEnterSecs");
                        RuntimeData.FightingSecs     = (int)Global.GetSafeAttributeLong(node, "FightingSecs");
                        RuntimeData.ClearRolesSecs   = (int)Global.GetSafeAttributeLong(node, "ClearRolesSecs");

                        if (!ConfigParser.ParserTimeRangeList(RuntimeData.TimePoints, Global.GetSafeAttributeStr(node, "TimePoints")))
                        {
                            success = false;
                            LogManager.WriteLog(LogTypes.Fatal, "读取跨服天梯系统时间配置(TimePoints)出错");
                        }

                        GameMap gameMap = null;
                        if (!GameManager.MapMgr.DictMaps.TryGetValue(mapCode, out gameMap))
                        {
                            success = false;
                            LogManager.WriteLog(LogTypes.Fatal, string.Format("缺少跨服天梯系统地图 {0}", mapCode));
                        }
                    }

                    //奖励配置
                    RuntimeData.DuanWeiJiFenNum  = (int)GameManager.systemParamsList.GetParamValueIntByName("DuanWeiJiFenNum");
                    RuntimeData.WinDuanWeiJiFen  = (int)GameManager.systemParamsList.GetParamValueIntByName("WinDuanWeiJiFen");
                    RuntimeData.LoseDuanWeiJiFen = (int)GameManager.systemParamsList.GetParamValueIntByName("LoseDuanWeiJiFen");
                    RuntimeData.MaxTianTiJiFen   = (int)GameManager.systemParamsList.GetParamValueIntByName("MaxTianTiJiFen");
                }
                catch (System.Exception ex)
                {
                    success = false;
                    LogManager.WriteLog(LogTypes.Fatal, string.Format("加载xml配置文件:{0}, 失败。", fileName), ex);
                }
            }

            return(success);
        }
示例#13
0
        public static void LoadWeaponMaster()
        {
            string fileName = "Config\\WeaponMaster.xml";

            try
            {
                fileName = Global.GameResPath(fileName);
                XElement xml = CheckHelper.LoadXml(fileName, true);
                if (null != xml)
                {
                    IEnumerable <XElement> nodes = xml.Elements();
                    foreach (XElement xmlItem in nodes)
                    {
                        if (xmlItem != null)
                        {
                            int type = Convert.ToInt32(Global.GetDefAttributeStr(xmlItem, "Type", "0"));
                            List <WeaponMaster.WeaponMasterItem> weaponMasterList;
                            if (!WeaponMaster.WeaponMasterXml.TryGetValue(type, out weaponMasterList))
                            {
                                weaponMasterList = new List <WeaponMaster.WeaponMasterItem>();
                                WeaponMaster.WeaponMasterXml[type] = weaponMasterList;
                            }
                            string   weaponType      = Global.GetDefAttributeStr(xmlItem, "WeaponType1", "");
                            string   weaponType2     = Global.GetDefAttributeStr(xmlItem, "WeaponType2", "");
                            string   tempValueString = Global.GetSafeAttributeStr(xmlItem, "WeaponMasterProps");
                            string[] valueFileds     = tempValueString.Split(new char[]
                            {
                                '|'
                            });
                            double[] extProps = new double[177];
                            foreach (string value in valueFileds)
                            {
                                string[] KvpFileds = value.Split(new char[]
                                {
                                    ','
                                });
                                if (KvpFileds.Length == 2)
                                {
                                    ExtPropIndexes index = ConfigParser.GetPropIndexByPropName(KvpFileds[0]);
                                    if (index < ExtPropIndexes.Max)
                                    {
                                        extProps[(int)index] = Global.SafeConvertToDouble(KvpFileds[1]);
                                    }
                                }
                            }
                            List <WeaponMaster.WeaponMasterItem> list              = weaponMasterList;
                            WeaponMaster.WeaponMasterItem        weaponMasterItem  = new WeaponMaster.WeaponMasterItem();
                            WeaponMaster.WeaponMasterItem        weaponMasterItem2 = weaponMasterItem;
                            List <int> weaponType3;
                            if (!("" == weaponType))
                            {
                                weaponType3 = Array.ConvertAll <string, int>(weaponType.Split(new char[]
                                {
                                    ','
                                }), (string x) => Convert.ToInt32(x)).ToList <int>();
                            }
                            else
                            {
                                weaponType3 = new List <int>();
                            }
                            weaponMasterItem2.WeaponType1 = weaponType3;
                            WeaponMaster.WeaponMasterItem weaponMasterItem3 = weaponMasterItem;
                            List <int> weaponType4;
                            if (!("" == weaponType2))
                            {
                                weaponType4 = Array.ConvertAll <string, int>(weaponType2.Split(new char[]
                                {
                                    ','
                                }), (string x) => Convert.ToInt32(x)).ToList <int>();
                            }
                            else
                            {
                                weaponType4 = new List <int>();
                            }
                            weaponMasterItem3.WeaponType2 = weaponType4;
                            weaponMasterItem.ExtProps     = extProps;
                            list.Add(weaponMasterItem);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                LogManager.WriteLog(LogTypes.Fatal, string.Format("加载xml配置文件:{0}, 失败。", fileName), ex, true);
            }
        }
示例#14
0
        /// <summary>
        /// 加载奖励配置
        /// </summary>
        public bool InitConfig()
        {
            lock (RuntimeData.Mutex)
            {
                RuntimeData.SystemOpen = false;
                RuntimeData._tenUserIdAwardsDict.Clear();

                string   fileName = Global.GameResPath("Config/TenRetutnAward.xml");
                XElement xml      = CheckHelper.LoadXml(fileName);
                if (null == xml)
                {
                    return(true);
                }

                try
                {
                    RuntimeData._tenAwardDic.Clear();

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

                        TenRetutnAwardsData config = new TenRetutnAwardsData();
                        config.ID = Convert.ToInt32(Global.GetSafeAttributeLong(xmlItem, "ID"));
                        //config.ChongZhiZhuanShi = Convert.ToInt32(Global.GetSafeAttributeLong(xmlItem, "ChongZhiZhuanShi"));
                        config.MailUser    = Global.GetLang("系统");
                        config.MailTitle   = Global.GetSafeAttributeStr(xmlItem, "MailTitle");
                        config.MailContent = Global.GetSafeAttributeStr(xmlItem, "MailContent");
                        ConfigParser.ParseAwardsItemList(Global.GetDefAttributeStr(xmlItem, "GoodsID1", ""), ref config.GoodsID1);
                        ConfigParser.ParseAwardsItemList(Global.GetDefAttributeStr(xmlItem, "GoodsID2", ""), ref config.GoodsID2);
                        config.UserList = Global.GetSafeAttributeStr(xmlItem, "UserList");

                        RuntimeData._tenAwardDic.Add(config.ID, config);

                        fileName = Global.GameResPath("Config/" + config.UserList);
                        if (File.Exists(fileName))
                        {
                            string[] allUserIds = File.ReadAllLines(fileName);
                            foreach (var userid in allUserIds)
                            {
                                if (!string.IsNullOrEmpty(userid))
                                {
                                    RuntimeData._tenUserIdAwardsDict[userid.ToLower()] = config.ID;
                                }
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    LogManager.WriteLog(LogTypes.Warning, "加载Config/TenRetutnAward.xml时文件出现异常!!!", ex);
                }

                fileName = Global.GameResPath("Config/TenRetutnTime.xml");
                xml      = CheckHelper.LoadXml(fileName);
                if (null == xml)
                {
                    return(true);
                }

                try
                {
                    IEnumerable <XElement> xmlItems = xml.Elements();
                    foreach (var xmlItem in xmlItems)
                    {
                        RuntimeData.SystemOpen = true;
                        string beginTime         = Global.GetDefAttributeStr(xmlItem, "BeginTime", "2019-12-31");
                        string finishTime        = Global.GetDefAttributeStr(xmlItem, "FinishTime", "2011-11-11");
                        string notLoggedInBegin  = Global.GetDefAttributeStr(xmlItem, "NotLoggedInBegin", "2011-11-11");
                        string notLoggedInFinish = Global.GetDefAttributeStr(xmlItem, "NotLoggedInFinish", "2019-12-31");
                        RuntimeData.BeginTimeStr  = beginTime.Replace(':', '$');
                        RuntimeData.FinishTimeStr = finishTime.Replace(':', '$');
                        RuntimeData.SystemOpen   &= DateTime.TryParse(beginTime, out RuntimeData.BeginTime);
                        RuntimeData.SystemOpen   &= DateTime.TryParse(finishTime, out RuntimeData.FinishTime);
                        RuntimeData.SystemOpen   &= DateTime.TryParse(notLoggedInBegin, out RuntimeData.NotLoggedInBegin);
                        RuntimeData.SystemOpen   &= DateTime.TryParse(notLoggedInFinish, out RuntimeData.NotLoggedInFinish);
                    }
                }
                catch (Exception ex)
                {
                    LogManager.WriteLog(LogTypes.Warning, "加载Config/TenRetutnTime.xml时文件出现异常!!!", ex);
                }
            }

            return(true);
        }
示例#15
0
        public static EquipPropItem ParseEquipPropItem(string str, bool verifyColumn = true, char splitChar1 = '|', char splitChar2 = ',', char splitChar3 = '-')
        {
            EquipPropItem equipPropItem = new EquipPropItem();

            if (!string.IsNullOrEmpty(str))
            {
                string[] propertyConfigArray = str.Split(new char[]
                {
                    splitChar1
                });
                foreach (string propertyConfigItem in propertyConfigArray)
                {
                    string[] nameValueArray = propertyConfigItem.Split(new char[]
                    {
                        splitChar2
                    });
                    if (nameValueArray.Length == 2)
                    {
                        ExtPropIndexes propIndex = ConfigParser.GetPropIndexByPropName(nameValueArray[0]);
                        if (propIndex < ExtPropIndexes.Max)
                        {
                            double propValue;
                            if (double.TryParse(nameValueArray[1], out propValue))
                            {
                                equipPropItem.ExtProps[(int)propIndex] = propValue;
                            }
                        }
                        else
                        {
                            int    propIndex2 = -1;
                            int    propIndex3 = -1;
                            string text       = nameValueArray[0];
                            if (text != null)
                            {
                                if (!(text == "Attack"))
                                {
                                    if (!(text == "Mattack"))
                                    {
                                        if (!(text == "Defense"))
                                        {
                                            if (text == "Mdefense")
                                            {
                                                propIndex2 = 5;
                                                propIndex3 = 6;
                                            }
                                        }
                                        else
                                        {
                                            propIndex2 = 3;
                                            propIndex3 = 4;
                                        }
                                    }
                                    else
                                    {
                                        propIndex2 = 9;
                                        propIndex3 = 10;
                                    }
                                }
                                else
                                {
                                    propIndex2 = 7;
                                    propIndex3 = 8;
                                }
                            }
                            string[] valueArray = nameValueArray[1].Split(new char[]
                            {
                                splitChar3
                            });
                            double propValue;
                            if (propIndex2 >= 0 && double.TryParse(valueArray[0], out propValue))
                            {
                                equipPropItem.ExtProps[propIndex2] = propValue;
                            }
                            if (propIndex3 >= 0 && double.TryParse(valueArray[1], out propValue))
                            {
                                equipPropItem.ExtProps[propIndex3] = propValue;
                            }
                        }
                    }
                }
            }
            return(equipPropItem);
        }
示例#16
0
        public bool InitConfig()
        {
            Dictionary <int, Dictionary <int, MazingerUpGrade> > MazingerGradeHot = new Dictionary <int, Dictionary <int, MazingerUpGrade> >();
            Dictionary <int, int> MazingerGradeLevelMaxHot = new Dictionary <int, int>();
            string   fileName = Global.GameResPath(MazingerStoreConst.MoShenMiBaoJie);
            XElement xml      = XElement.Load(fileName);

            if (null == xml)
            {
                LogManager.WriteLog(LogTypes.Fatal, string.Format("加载系统xml配置文件:{0}, 失败。没有找到相关XML配置文件!", fileName), null, true);
            }
            try
            {
                IEnumerable <XElement> xmlItems = xml.Elements();
                foreach (XElement xmlItem in xmlItems)
                {
                    MazingerUpGrade       rst      = new MazingerUpGrade();
                    Dictionary <int, int> UseGoods = new Dictionary <int, int>();
                    rst.ID       = Convert.ToInt32(Global.GetSafeAttributeStr(xmlItem, "ID"));
                    rst.Stage    = Convert.ToInt32(Global.GetSafeAttributeStr(xmlItem, "MiBaoStageLevel"));
                    rst.Type     = Convert.ToInt32(Global.GetSafeAttributeStr(xmlItem, "MiBaoType"));
                    rst.LuckyOne = Convert.ToInt32(Global.GetSafeAttributeStr(xmlItem, "LuckyOne"));
                    rst.LuckyTwo = Convert.ToInt32(Global.GetSafeAttributeStr(xmlItem, "LuckyTwo"));
                    rst.Rate     = Convert.ToDouble(Global.GetSafeAttributeStr(xmlItem, "LuckyTwoRate"));
                    string[] need = Global.GetSafeAttributeStr(xmlItem, "NeedGoods").Split(new char[]
                    {
                        '|'
                    });
                    if (need.Length != 1)
                    {
                        UseGoods.Add(Convert.ToInt32(need[0]), Convert.ToInt32(need[1]));
                    }
                    rst.UseGoods = UseGoods;
                    if (MazingerGradeLevelMaxHot.ContainsKey(rst.Type))
                    {
                        if (MazingerGradeLevelMaxHot[rst.Type] < rst.Stage)
                        {
                            MazingerGradeLevelMaxHot[rst.Type] = rst.Stage;
                        }
                    }
                    else
                    {
                        MazingerGradeLevelMaxHot.Add(rst.Type, rst.Stage);
                    }
                    if (MazingerGradeHot.ContainsKey(rst.Type))
                    {
                        if (MazingerGradeHot[rst.Type].ContainsKey(rst.Stage))
                        {
                            MazingerGradeHot[rst.Type][rst.Stage] = rst;
                        }
                        else
                        {
                            MazingerGradeHot[rst.Type].Add(rst.Stage, rst);
                        }
                    }
                    else
                    {
                        Dictionary <int, MazingerUpGrade> dict = new Dictionary <int, MazingerUpGrade>();
                        dict.Add(rst.Stage, rst);
                        MazingerGradeHot.Add(rst.Type, dict);
                    }
                }
                this.MazingerGrade         = MazingerGradeHot;
                this.MazingerGradeLevelMax = MazingerGradeLevelMaxHot;
            }
            catch (Exception ex)
            {
                LogManager.WriteException(ex.ToString());
            }
            bool result;

            if (this.MazingerGrade == null || this.MazingerGradeLevelMax == null)
            {
                result = false;
            }
            else
            {
                Dictionary <int, Dictionary <int, Dictionary <int, MazingerUpStar> > > MazingerStarHot = new Dictionary <int, Dictionary <int, Dictionary <int, MazingerUpStar> > >();
                Dictionary <int, Dictionary <int, int> > MazingerStarLevelMaxHot = new Dictionary <int, Dictionary <int, int> >();
                fileName = Global.GameResPath(MazingerStoreConst.MoShenMiBaoXing);
                xml      = XElement.Load(fileName);
                if (null == xml)
                {
                    LogManager.WriteLog(LogTypes.Fatal, string.Format("加载系统xml配置文件:{0}, 失败。没有找到相关XML配置文件!", fileName), null, true);
                }
                try
                {
                    IEnumerable <XElement> xmlItems = xml.Elements();
                    foreach (XElement xmlItem in xmlItems)
                    {
                        MazingerUpStar           rst2     = new MazingerUpStar();
                        Dictionary <int, int>    UseGoods = new Dictionary <int, int>();
                        Dictionary <int, double> Attr     = new Dictionary <int, double>();
                        rst2.ID    = Convert.ToInt32(Global.GetSafeAttributeStr(xmlItem, "ID"));
                        rst2.Stage = Convert.ToInt32(Global.GetSafeAttributeStr(xmlItem, "MiBaoStageLevel"));
                        rst2.Level = Convert.ToInt32(Global.GetSafeAttributeStr(xmlItem, "MibaoStarLevel"));
                        rst2.Type  = Convert.ToInt32(Global.GetSafeAttributeStr(xmlItem, "MiBaoType"));
                        rst2.UpExp = Convert.ToInt32(Global.GetSafeAttributeStr(xmlItem, "MibaoStarExp"));
                        rst2.Exp   = Convert.ToInt32(Global.GetSafeAttributeStr(xmlItem, "GoodsExp"));
                        string[] need = Global.GetSafeAttributeStr(xmlItem, "NeedGoods").Split(new char[]
                        {
                            '|'
                        });
                        if (need.Length != 1)
                        {
                            UseGoods.Add(Convert.ToInt32(need[0]), Convert.ToInt32(need[1]));
                        }
                        rst2.UseGoods = UseGoods;
                        string[] attr = Global.GetSafeAttributeStr(xmlItem, "MiBaoAttribute").Split(new char[]
                        {
                            '|'
                        });
                        foreach (string it in attr)
                        {
                            string[] temp = it.Split(new char[]
                            {
                                ','
                            });
                            if (temp.Length == 2)
                            {
                                Attr.Add((int)ConfigParser.GetPropIndexByPropName(temp[0]), Convert.ToDouble(temp[1]));
                            }
                        }
                        rst2.Attr = Attr;
                        if (MazingerStarLevelMaxHot.ContainsKey(rst2.Type))
                        {
                            if (MazingerStarLevelMaxHot[rst2.Type].ContainsKey(rst2.Stage))
                            {
                                if (MazingerStarLevelMaxHot[rst2.Type][rst2.Stage] < rst2.Level)
                                {
                                    MazingerStarLevelMaxHot[rst2.Type][rst2.Stage] = rst2.Level;
                                }
                            }
                            else
                            {
                                MazingerStarLevelMaxHot[rst2.Type].Add(rst2.Stage, rst2.Level);
                            }
                        }
                        else
                        {
                            Dictionary <int, int> dict2 = new Dictionary <int, int>();
                            dict2.Add(rst2.Stage, rst2.Level);
                            MazingerStarLevelMaxHot.Add(rst2.Type, dict2);
                        }
                        if (MazingerStarHot.ContainsKey(rst2.Type))
                        {
                            if (MazingerStarHot[rst2.Type].ContainsKey(rst2.Stage))
                            {
                                if (!MazingerStarHot[rst2.Type][rst2.Stage].ContainsKey(rst2.Level))
                                {
                                    MazingerStarHot[rst2.Type][rst2.Stage].Add(rst2.Level, rst2);
                                }
                            }
                            else
                            {
                                Dictionary <int, MazingerUpStar> star = new Dictionary <int, MazingerUpStar>();
                                star.Add(rst2.Level, rst2);
                                MazingerStarHot[rst2.Type].Add(rst2.Stage, star);
                            }
                        }
                        else
                        {
                            Dictionary <int, Dictionary <int, MazingerUpStar> > dict3 = new Dictionary <int, Dictionary <int, MazingerUpStar> >();
                            Dictionary <int, MazingerUpStar> star = new Dictionary <int, MazingerUpStar>();
                            star.Add(rst2.Level, rst2);
                            dict3.Add(rst2.Stage, star);
                            MazingerStarHot.Add(rst2.Type, dict3);
                        }
                    }
                    this.MazingerStar         = MazingerStarHot;
                    this.MazingerStarLevelMax = MazingerStarLevelMaxHot;
                }
                catch (Exception ex)
                {
                    LogManager.WriteException(ex.ToString());
                }
                result = (this.MazingerStar != null && MazingerStarLevelMaxHot != null);
            }
            return(result);
        }
示例#17
0
        public void LoadGodXml()
        {
            string fileName = "";

            try
            {
                fileName = Global.GameResPath(ShenQiConsts.God);
                XElement xml = CheckHelper.LoadXml(fileName, true);
                if (null != xml)
                {
                    List <GodItem>         godList = new List <GodItem>();
                    IEnumerable <XElement> nodes   = xml.Elements();
                    foreach (XElement xmlItem in nodes)
                    {
                        if (xmlItem != null)
                        {
                            int      id        = Convert.ToInt32(Global.GetDefAttributeStr(xmlItem, "ID", "0"));
                            string[] condition = Global.GetDefAttributeStr(xmlItem, "OpenCondition", "").Split(new char[]
                            {
                                '|'
                            });
                            List <int> openCondition = new List <int>();
                            foreach (string item in condition)
                            {
                                openCondition.Add(Convert.ToInt32(item));
                            }
                            string[] props = Global.GetDefAttributeStr(xmlItem, "ActivationProperty", "").Split(new char[]
                            {
                                '|'
                            });
                            List <Dictionary <int, double> > activationProperty = new List <Dictionary <int, double> >();
                            foreach (string item in props)
                            {
                                Dictionary <int, double> kvItem = new Dictionary <int, double>();
                                string[] KvpFileds = item.Split(new char[]
                                {
                                    ','
                                });
                                if (KvpFileds.Length == 2)
                                {
                                    kvItem[(int)ConfigParser.GetPropIndexByPropName(KvpFileds[0])] = Global.SafeConvertToDouble(KvpFileds[1]);
                                }
                                activationProperty.Add(kvItem);
                            }
                            godList.Add(new GodItem
                            {
                                ID                 = id,
                                OpenCondition      = openCondition,
                                ActivationProperty = activationProperty
                            });
                        }
                    }
                    if (godList.Count < 1)
                    {
                        LogManager.WriteLog(LogTypes.Fatal, string.Format("ShenQi :: 神像表不存在数据。", new object[0]), null, true);
                    }
                    else
                    {
                        lock (this.ShenQiRunTimeData.Mutex)
                        {
                            this.ShenQiRunTimeData.GodXmlList = godList;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                LogManager.WriteLog(LogTypes.Fatal, string.Format("加载xml配置文件:{0}, 失败。", fileName), ex, true);
            }
        }
示例#18
0
        public bool InitConfig()
        {
            string fileName = "";

            try
            {
                fileName = Global.GameResPath(ThemeDataConst.ThemeActivityBoss);
                XElement xml = CheckHelper.LoadXml(fileName, true);
                if (null == xml)
                {
                    return(false);
                }
                this.FromDate       = "-1";
                this.ToDate         = "-1";
                this.AwardStartDate = "-1";
                this.AwardEndDate   = "-1";
                Dictionary <int, ThemeBossConfig> bossConfigDict = new Dictionary <int, ThemeBossConfig>();
                IEnumerable <XElement>            nodes          = xml.Elements();
                foreach (XElement xmlItem in nodes)
                {
                    ThemeBossConfig config   = new ThemeBossConfig();
                    string[]        maxLevel = Global.GetDefAttributeStr(xmlItem, "MaxLevel", "0").Split(new char[]
                    {
                        '|'
                    });
                    if (maxLevel.Length >= 2)
                    {
                        config.ID            = (int)Global.GetSafeAttributeLong(xmlItem, "ID");
                        config.MonstersID    = (int)Global.GetSafeAttributeLong(xmlItem, "MonstersID");
                        config.MapCode       = (int)Global.GetSafeAttributeLong(xmlItem, "MapCode");
                        config.PosX          = (int)Global.GetSafeAttributeLong(xmlItem, "X");
                        config.PosY          = (int)Global.GetSafeAttributeLong(xmlItem, "Y");
                        config.Radius        = (int)Global.GetSafeAttributeLong(xmlItem, "Radius");
                        config.Num           = (int)Global.GetSafeAttributeLong(xmlItem, "Num");
                        config.MaxUnionLevel = Global.GetUnionLevel2(Global.SafeConvertToInt32(maxLevel[0]), Global.SafeConvertToInt32(maxLevel[1]));
                        if (!ConfigParser.ParserTimeRangeList(config.TimePoints, xmlItem.Attribute("TimePoints").Value.ToString(), true, '|', '-'))
                        {
                            throw new Exception(string.Format("读取{0}时间配置(TimePoints)出错", fileName));
                        }
                        for (int i = 0; i < config.TimePoints.Count; i++)
                        {
                            TimeSpan ts = new TimeSpan(config.TimePoints[i].Hours, config.TimePoints[i].Minutes, config.TimePoints[i].Seconds);
                            config.SecondsOfDay.Add(ts.TotalSeconds);
                        }
                        bossConfigDict[config.ID] = config;
                    }
                }
                List <int> goodsList = new List <int>();
                string     goodsStr  = GameManager.systemParamsList.GetParamValueByName("ThemeActivityBOSSGoods");
                if (!string.IsNullOrEmpty(goodsStr))
                {
                    goodsList = Array.ConvertAll <string, int>(goodsStr.Split(new char[]
                    {
                        ','
                    }), (string _x) => Global.SafeConvertToInt32(_x)).ToList <int>();
                }
                lock (ThemeBoss.Mutex)
                {
                    this.ThemeBossConfigDict = bossConfigDict;
                    this.BroadGoodsIDList    = goodsList;
                }
                this.ActivityType = 155;
                base.PredealDateTime();
            }
            catch (Exception ex)
            {
                LogManager.WriteLog(LogTypes.Error, string.Format("加载xml配置文件:{0}, 失败。", fileName), ex, true);
                return(false);
            }
            return(true);
        }
示例#19
0
        /// <summary>
        /// 初始化配置
        /// </summary>
        public bool InitConfig()
        {
            bool     success          = true;
            XElement xml              = null;
            string   fileName         = "";
            string   fullPathFileName = "";
            IEnumerable <XElement> nodes;

            lock (RuntimeData.Mutex)
            {
                try
                {
                    //圣杯配置
                    RuntimeData.ShengBeiDataDict.Clear();

                    fileName         = "Config/HolyGrail.xml";
                    fullPathFileName = Global.GameResPath(fileName); //Global.IsolateResPath(fileName);
                    xml   = XElement.Load(fullPathFileName);
                    nodes = xml.Elements();
                    foreach (var node in nodes)
                    {
                        ShengBeiData item = new ShengBeiData();
                        item.ID        = (int)Global.GetSafeAttributeLong(node, "ID");
                        item.MonsterID = (int)Global.GetSafeAttributeLong(node, "MonsterID");
                        item.Time      = (int)Global.GetSafeAttributeLong(node, "Time");
                        item.GoodsID   = (int)Global.GetSafeAttributeLong(node, "GoodsID");
                        item.Score     = (int)Global.GetSafeAttributeLong(node, "Score");
                        item.PosX      = (int)Global.GetSafeAttributeLong(node, "PosX");
                        item.PosY      = (int)Global.GetSafeAttributeLong(node, "PosY");

                        EquipPropItem propItem = GameManager.EquipPropsMgr.FindEquipPropItem(item.GoodsID);
                        if (null != propItem)
                        {
                            item.BufferProps = propItem.ExtProps;
                        }
                        else
                        {
                            success = false;
                            LogManager.WriteLog(LogTypes.Fatal, "幻影寺院的圣杯Buffer的GoodsID在物品表中找不到");
                        }

                        RuntimeData.ShengBeiDataDict[item.ID] = item;
                    }

                    //出生点配置
                    RuntimeData.MapBirthPointDict.Clear();

                    fileName         = "Config/TempleMirageRebirth.xml";
                    fullPathFileName = Global.GameResPath(fileName); //Global.IsolateResPath(fileName);
                    xml   = XElement.Load(fullPathFileName);
                    nodes = xml.Elements();
                    foreach (var node in nodes)
                    {
                        HuanYingSiYuanBirthPoint item = new HuanYingSiYuanBirthPoint();
                        item.ID          = (int)Global.GetSafeAttributeLong(node, "ID");
                        item.PosX        = (int)Global.GetSafeAttributeLong(node, "PosX");
                        item.PosY        = (int)Global.GetSafeAttributeLong(node, "PosY");
                        item.BirthRadius = (int)Global.GetSafeAttributeLong(node, "BirthRadius");

                        RuntimeData.MapBirthPointDict[item.ID] = item;
                    }

                    //连杀配置
                    RuntimeData.ContinuityKillAwardDict.Clear();

                    fileName         = "Config/ContinuityKillAward.xml";
                    fullPathFileName = Global.GameResPath(fileName); //Global.IsolateResPath(fileName);
                    xml   = XElement.Load(fullPathFileName);
                    nodes = xml.Elements();
                    foreach (var node in nodes)
                    {
                        ContinuityKillAward item = new ContinuityKillAward();
                        item.ID    = (int)Global.GetSafeAttributeLong(node, "ID");
                        item.Num   = (int)Global.GetSafeAttributeLong(node, "Num");
                        item.Score = (int)Global.GetSafeAttributeLong(node, "Score");

                        RuntimeData.ContinuityKillAwardDict[item.Num] = item;
                    }

                    //活动配置
                    RuntimeData.MapCode = 0;

                    fileName         = "Config/TempleMirage.xml";
                    fullPathFileName = Global.GameResPath(fileName); //Global.IsolateResPath(fileName);
                    xml   = XElement.Load(fullPathFileName);
                    nodes = xml.Elements();
                    foreach (var node in nodes)
                    {
                        RuntimeData.MapCode       = (int)Global.GetSafeAttributeLong(node, "MapCode");
                        RuntimeData.MinZhuanSheng = (int)Global.GetSafeAttributeLong(node, "MinZhuanSheng");
                        RuntimeData.MinLevel      = (int)Global.GetSafeAttributeLong(node, "MinLevel");
                        RuntimeData.MinRequestNum = (int)Global.GetSafeAttributeLong(node, "MinRequestNum");
                        RuntimeData.MaxEnterNum   = (int)Global.GetSafeAttributeLong(node, "MaxEnterNum");

                        RuntimeData.WaitingEnterSecs = (int)Global.GetSafeAttributeLong(node, "WaitingEnterSecs");
                        RuntimeData.PrepareSecs      = (int)Global.GetSafeAttributeLong(node, "PrepareSecs");
                        RuntimeData.FightingSecs     = (int)Global.GetSafeAttributeLong(node, "FightingSecs");
                        RuntimeData.ClearRolesSecs   = (int)Global.GetSafeAttributeLong(node, "ClearRolesSecs");

                        if (!ConfigParser.ParserTimeRangeList(RuntimeData.TimePoints, Global.GetSafeAttributeStr(node, "TimePoints")))
                        {
                            success = false;
                            LogManager.WriteLog(LogTypes.Fatal, "读取幻影寺院时间配置(TimePoints)出错");
                        }

                        GameMap gameMap = null;
                        if (!GameManager.MapMgr.DictMaps.TryGetValue(RuntimeData.MapCode, out gameMap))
                        {
                            LogManager.WriteLog(LogTypes.Fatal, string.Format("缺少幻影寺院地图 {0}", RuntimeData.MapCode));
                        }

                        RuntimeData.MapGridWidth  = gameMap.MapGridWidth;
                        RuntimeData.MapGridHeight = gameMap.MapGridHeight;

                        break;
                    }

                    //奖励配置
                    RuntimeData.TempleMirageEXPAward = GameManager.systemParamsList.GetParamValueIntByName("TempleMirageEXPAward");
                    RuntimeData.TempleMirageWin      = (int)GameManager.systemParamsList.GetParamValueIntByName("TempleMirageWin");
                    RuntimeData.TempleMiragePK       = (int)GameManager.systemParamsList.GetParamValueIntByName("TempleMiragePK");
                    RuntimeData.TempleMirageMinJiFen = (int)GameManager.systemParamsList.GetParamValueIntByName("TempleMirageMinJiFen");

                    if (!ConfigParser.ParseStrInt2(GameManager.systemParamsList.GetParamValueByName("TempleMirageWinNum"), ref RuntimeData.TempleMirageWinExtraNum, ref RuntimeData.TempleMirageWinExtraRate))
                    {
                        success = false;
                        LogManager.WriteLog(LogTypes.Fatal, "读取幻影寺院多倍奖励配置(TempleMirageWin)出错");
                    }

                    if (!ConfigParser.ParseStrInt2(GameManager.systemParamsList.GetParamValueByName("TempleMirageAward"), ref RuntimeData.TempleMirageAwardChengJiu, ref RuntimeData.TempleMirageAwardShengWang))
                    {
                        success = false;
                        LogManager.WriteLog(LogTypes.Fatal, "读取幻影寺院多倍奖励配置(TempleMirageWin)出错");
                    }

                    List <List <int> > levelRanges = ConfigParser.ParserIntArrayList(GameManager.systemParamsList.GetParamValueByName("TempleMirageLevel"));
                    if (levelRanges.Count == 0)
                    {
                        success = false;
                        LogManager.WriteLog(LogTypes.Fatal, "读取幻影寺院等级分组配置(TempleMirageLevel)出错");
                    }
                    else
                    {
                        for (int i = 0; i < levelRanges.Count; i++)
                        {
                            List <int> range = levelRanges[i];
                            RuntimeData.Range2GroupIndexDict.Add(new RangeKey(Global.GetUnionLevel(range[0], range[1]), Global.GetUnionLevel(range[2], range[3])), i + 1);
                        }
                    }
                }
                catch (System.Exception ex)
                {
                    success = false;
                    LogManager.WriteLog(LogTypes.Fatal, string.Format("加载xml配置文件:{0}, 失败。", fileName), ex);
                }
            }

            return(success);
        }
示例#20
0
        /// <summary>
        /// 初始化配置
        /// </summary>
        public bool InitConfig()
        {
            XElement xml      = null;
            string   fileName = "";

            lock (RuntimeData.Mutex)
            {
                try
                {
                    RuntimeData.PetGroupPropertyList.Clear();

                    fileName = "Config/PetGroupProperty.xml";
                    string fullPathFileName = Global.GameResPath(fileName); //Global.IsolateResPath(fileName);
                    xml = XElement.Load(fullPathFileName);
                    IEnumerable <XElement> nodes = null;
                    nodes = xml.Elements();
                    foreach (var node in nodes)
                    {
                        PetGroupPropertyItem item = new PetGroupPropertyItem();
                        item.Id   = (int)Global.GetSafeAttributeLong(node, "ID");
                        item.Name = Global.GetSafeAttributeStr(node, "Name");

                        string petGoods = Global.GetSafeAttributeStr(node, "PetGoods");
                        item.PetGoodsList = ConfigParser.ParserIntArrayList(petGoods);

                        string groupProperty = Global.GetSafeAttributeStr(node, "GroupProperty");
                        item.PropItem = ConfigParser.ParseEquipPropItem(groupProperty);
                        RuntimeData.PetGroupPropertyList.Add(item);
                    }
                }
                catch (Exception ex)
                {
                    LogManager.WriteException(string.Format("加载xml配置文件:{0}, 失败。{1}", fileName, ex.ToString()));
                    return(false);
                }

                try
                {
                    RuntimeData.PetLevelAwardList.Clear();

                    fileName = "Config/PetLevelAward.xml";
                    string fullPathFileName = Global.GameResPath(fileName); //Global.IsolateResPath(fileName);
                    xml = XElement.Load(fullPathFileName);
                    IEnumerable <XElement> nodes = null;
                    nodes = xml.Elements();
                    foreach (var node in nodes)
                    {
                        PetLevelAwardItem item = new PetLevelAwardItem();
                        item.Id    = (int)Global.GetSafeAttributeLong(node, "ID");
                        item.Level = (int)Global.GetSafeAttributeLong(node, "Level");

                        string shuXing = Global.GetSafeAttributeStr(node, "ShuXing");
                        item.PropItem = ConfigParser.ParseEquipPropItem(shuXing);

                        RuntimeData.PetLevelAwardList.Add(item);
                    }

                    RuntimeData.PetLevelAwardList.Sort((x, y) => { return(x.Level - y.Level); });
                }
                catch (Exception ex)
                {
                    LogManager.WriteException(string.Format("加载xml配置文件:{0}, 失败。{1}", fileName, ex.ToString()));
                    return(false);
                }

                try
                {
                    RuntimeData.PetTianFuAwardList.Clear();

                    fileName = "Config/PetTianFuAward.xml";
                    string fullPathFileName = Global.GameResPath(fileName); //Global.IsolateResPath(fileName);
                    xml = XElement.Load(fullPathFileName);
                    IEnumerable <XElement> nodes = null;
                    nodes = xml.Elements();
                    foreach (var node in nodes)
                    {
                        PetTianFuAwardItem item = new PetTianFuAwardItem();
                        item.Id        = (int)Global.GetSafeAttributeLong(node, "ID");
                        item.TianFuNum = (int)Global.GetSafeAttributeLong(node, "TianFuNum");

                        string shuXing = Global.GetSafeAttributeStr(node, "ShuXing");
                        item.PropItem = ConfigParser.ParseEquipPropItem(shuXing);

                        RuntimeData.PetTianFuAwardList.Add(item);
                    }

                    RuntimeData.PetTianFuAwardList.Sort((x, y) => { return(x.TianFuNum - y.TianFuNum); });
                }
                catch (Exception ex)
                {
                    LogManager.WriteException(string.Format("加载xml配置文件:{0}, 失败。{1}", fileName, ex.ToString()));
                    return(false);
                }
            }

            try
            {
                RuntimeData.PetSkillAwardList.Clear();

                fileName = "Config/PetSkillGroupProperty.xml";
                string fullPathFileName = Global.GameResPath(fileName); //Global.IsolateResPath(fileName);
                xml = XElement.Load(fullPathFileName);
                IEnumerable <XElement> xmlItems = xml.Elements();
                foreach (var xmlItem in xmlItems)
                {
                    if (xmlItem == null)
                    {
                        continue;
                    }

                    PetSkillGroupInfo config = new PetSkillGroupInfo();
                    config.GroupID = Convert.ToInt32(Global.GetDefAttributeStr(xmlItem, "ID", "0"));

                    config.SkillList = new List <int>();
                    string skills = Global.GetDefAttributeStr(xmlItem, "SkillList", "");
                    if (!string.IsNullOrEmpty(skills))
                    {
                        string[] arr = skills.Split('|');
                        foreach (string s in arr)
                        {
                            config.SkillList.Add(int.Parse(s));
                        }
                    }

                    config.SkillNum = Convert.ToInt32(Global.GetDefAttributeStr(xmlItem, "SkillNum", "0"));
                    string prop = Global.GetDefAttributeStr(xmlItem, "Property", "0");
                    config.GroupProp = GetGroupProp(prop);

                    RuntimeData.PetSkillAwardList.Add(config);
                }

                RuntimeData.PetSkillAwardList.Sort((x, y) => { return(x.GroupID - y.GroupID); });
            }
            catch (Exception ex)
            {
                LogManager.WriteLog(LogTypes.Fatal, string.Format("加载[{0}]时出错!!!", fileName));
            }

            return(true);
        }
示例#21
0
        public bool InitConfig()
        {
            bool   success  = true;
            string fileName = "";

            lock (this.RuntimeData.Mutex)
            {
                try
                {
                    this.RuntimeData.MapBirthPointDict.Clear();
                    fileName = "Config/ThroughServiceBossRebirth.xml";
                    string   fullPathFileName = Global.GameResPath(fileName);
                    XElement xml = XElement.Load(fullPathFileName);
                    IEnumerable <XElement> nodes = xml.Elements();
                    foreach (XElement node in nodes)
                    {
                        KuaFuBossBirthPoint item = new KuaFuBossBirthPoint();
                        item.ID          = (int)Global.GetSafeAttributeLong(node, "ID");
                        item.PosX        = (int)Global.GetSafeAttributeLong(node, "PosX");
                        item.PosY        = (int)Global.GetSafeAttributeLong(node, "PosY");
                        item.BirthRadius = (int)Global.GetSafeAttributeLong(node, "BirthRadius");
                        this.RuntimeData.MapBirthPointDict[item.ID] = item;
                    }
                    this.RuntimeData.SceneDataDict.Clear();
                    this.RuntimeData.LevelRangeSceneIdDict.Clear();
                    this.RuntimeData.SceneDynMonsterDict.Clear();
                    fileName         = "Config/ThroughServiceBoss.xml";
                    fullPathFileName = Global.GameResPath(fileName);
                    xml   = XElement.Load(fullPathFileName);
                    nodes = xml.Elements();
                    foreach (XElement node in nodes)
                    {
                        KuaFuBossSceneInfo sceneItem = new KuaFuBossSceneInfo();
                        int id      = (int)Global.GetSafeAttributeLong(node, "MapCode");
                        int mapCode = (int)Global.GetSafeAttributeLong(node, "MapCode");
                        sceneItem.Id               = id;
                        sceneItem.MapCode          = mapCode;
                        sceneItem.MinLevel         = (int)Global.GetSafeAttributeLong(node, "MinLevel");
                        sceneItem.MaxLevel         = (int)Global.GetSafeAttributeLong(node, "MaxLevel");
                        sceneItem.MinZhuanSheng    = (int)Global.GetSafeAttributeLong(node, "MinZhuanSheng");
                        sceneItem.MaxZhuanSheng    = (int)Global.GetSafeAttributeLong(node, "MaxZhuanSheng");
                        sceneItem.PrepareSecs      = (int)Global.GetSafeAttributeLong(node, "PrepareSecs");
                        sceneItem.WaitingEnterSecs = (int)Global.GetSafeAttributeLong(node, "WaitingEnterSecs");
                        sceneItem.FightingSecs     = (int)Global.GetSafeAttributeLong(node, "FightingSecs");
                        sceneItem.ClearRolesSecs   = (int)Global.GetSafeAttributeLong(node, "ClearRolesSecs");
                        ConfigParser.ParseStrInt2(Global.GetSafeAttributeStr(node, "ApplyTime"), ref sceneItem.SignUpStartSecs, ref sceneItem.SignUpEndSecs, ',');
                        sceneItem.SignUpStartSecs += sceneItem.SignUpEndSecs;
                        if (!ConfigParser.ParserTimeRangeListWithDay(sceneItem.TimePoints, Global.GetSafeAttributeStr(node, "TimePoints"), true, '|', '-', ','))
                        {
                            success = false;
                            LogManager.WriteLog(LogTypes.Fatal, string.Format("读取{0}时间配置(TimePoints)出错", fileName), null, true);
                        }
                        for (int i = 0; i < sceneItem.TimePoints.Count; i++)
                        {
                            TimeSpan ts = new TimeSpan(sceneItem.TimePoints[i].Hours, sceneItem.TimePoints[i].Minutes, sceneItem.TimePoints[i].Seconds);
                            sceneItem.SecondsOfDay.Add(ts.TotalSeconds);
                        }
                        GameMap gameMap = null;
                        if (!GameManager.MapMgr.DictMaps.TryGetValue(mapCode, out gameMap))
                        {
                            success = false;
                            LogManager.WriteLog(LogTypes.Fatal, string.Format("地图配置中缺少{0}所需的地图:{1}", fileName, mapCode), null, true);
                        }
                        RangeKey range = new RangeKey(Global.GetUnionLevel(sceneItem.MinZhuanSheng, sceneItem.MinLevel, false), Global.GetUnionLevel(sceneItem.MaxZhuanSheng, sceneItem.MaxLevel, false), null);
                        this.RuntimeData.LevelRangeSceneIdDict[range] = sceneItem;
                        this.RuntimeData.SceneDataDict[id]            = sceneItem;
                    }
                    fileName         = "Config/ThroughServiceBossMonster.xml";
                    fullPathFileName = Global.GameResPath(fileName);
                    xml   = XElement.Load(fullPathFileName);
                    nodes = xml.Elements();
                    foreach (XElement node in nodes)
                    {
                        BattleDynamicMonsterItem item2 = new BattleDynamicMonsterItem();
                        item2.Id            = (int)Global.GetSafeAttributeLong(node, "ID");
                        item2.MapCode       = (int)Global.GetSafeAttributeLong(node, "CodeID");
                        item2.MonsterID     = (int)Global.GetSafeAttributeLong(node, "MonsterID");
                        item2.PosX          = (int)Global.GetSafeAttributeLong(node, "X");
                        item2.PosY          = (int)Global.GetSafeAttributeLong(node, "Y");
                        item2.DelayBirthMs  = (int)Global.GetSafeAttributeLong(node, "Time");
                        item2.PursuitRadius = (int)Global.GetSafeAttributeLong(node, "PursuitRadius");
                        item2.Num           = (int)Global.GetSafeAttributeLong(node, "Num");
                        item2.Radius        = (int)Global.GetSafeAttributeLong(node, "Radius");
                        List <BattleDynamicMonsterItem> itemList = null;
                        if (!this.RuntimeData.SceneDynMonsterDict.TryGetValue(item2.MapCode, out itemList))
                        {
                            itemList = new List <BattleDynamicMonsterItem>();
                            this.RuntimeData.SceneDynMonsterDict[item2.MapCode] = itemList;
                        }
                        itemList.Add(item2);
                    }
                }
                catch (Exception ex)
                {
                    success = false;
                    LogManager.WriteLog(LogTypes.Fatal, string.Format("加载xml配置文件:{0}, 失败。", fileName), ex, true);
                }
            }
            return(success);
        }
示例#22
0
        /// <summary>
        /// 解析通用的扩展属性加成配置,目前需要扩展属性
        /// </summary>
        /// <param name="str"></param>
        /// <param name="verifyColumn"></param>
        /// <param name="splitChar1"></param>
        /// <param name="splitChar2"></param>
        public static EquipPropItem ParseEquipPropItem(string str, bool verifyColumn = true, char splitChar1 = '|', char splitChar2 = ',', char splitChar3 = '-')
        {
            EquipPropItem equipPropItem = new EquipPropItem();

            if (!string.IsNullOrEmpty(str))
            {
                string[] propertyConfigArray = str.Split(splitChar1);
                foreach (var propertyConfigItem in propertyConfigArray)
                {
                    string[] nameValueArray = propertyConfigItem.Split(splitChar2);
                    if (nameValueArray.Length == 2)
                    {
                        ExtPropIndexes propIndex = ConfigParser.GetPropIndexByPropName(nameValueArray[0]);
                        if (propIndex < ExtPropIndexes.Max)
                        {
                            double propValue;
                            if (double.TryParse(nameValueArray[1], out propValue))
                            {
                                equipPropItem.ExtProps[(int)propIndex] = propValue;
                            }
                        }
                        else
                        {
                            //其他特殊配置类型
                            int propIndex0 = -1;
                            int propIndex1 = -1;
                            switch (nameValueArray[0])
                            {
                            case "Attack":
                            {
                                propIndex0 = (int)ExtPropIndexes.MinAttack;
                                propIndex1 = (int)ExtPropIndexes.MaxAttack;
                            }
                            break;

                            case "Mattack":
                            {
                                propIndex0 = (int)ExtPropIndexes.MinMAttack;
                                propIndex1 = (int)ExtPropIndexes.MaxMAttack;
                            }
                            break;

                            case "Defense":
                            {
                                propIndex0 = (int)ExtPropIndexes.MinDefense;
                                propIndex1 = (int)ExtPropIndexes.MaxDefense;
                            }
                            break;

                            case "Mdefense":
                            {
                                propIndex0 = (int)ExtPropIndexes.MinMDefense;
                                propIndex1 = (int)ExtPropIndexes.MaxMDefense;
                            }
                            break;
                            }

                            string[] valueArray = nameValueArray[1].Split(splitChar3);
                            double   propValue;
                            if (propIndex0 >= 0 && double.TryParse(valueArray[0], out propValue))
                            {
                                equipPropItem.ExtProps[propIndex0] = propValue;
                            }

                            if (propIndex1 >= 0 && double.TryParse(valueArray[1], out propValue))
                            {
                                equipPropItem.ExtProps[propIndex1] = propValue;
                            }
                        }
                    }
                }
            }

            return(equipPropItem);
        }