示例#1
0
        public int GetBirthPoint(GameClient client, out int posX, out int posY)
        {
            int side = client.ClientData.BattleWhichSide;

            if (side <= 0)
            {
                KuaFuServerLoginData clientKuaFuServerLoginData = Global.GetClientKuaFuServerLoginData(client);
                side = HuanYingSiYuanClient.getInstance().GetRoleBattleWhichSide((int)clientKuaFuServerLoginData.GameId, clientKuaFuServerLoginData.RoleId);
                if (side > 0)
                {
                    client.ClientData.BattleWhichSide = side;
                }
            }

            lock (RuntimeData.Mutex)
            {
                HuanYingSiYuanBirthPoint huanYingSiYuanBirthPoint = null;
                if (RuntimeData.MapBirthPointDict.TryGetValue(side, out huanYingSiYuanBirthPoint))
                {
                    posX = huanYingSiYuanBirthPoint.PosX;
                    posY = huanYingSiYuanBirthPoint.PosY;
                    return(side);
                }
            }

            posX = 0;
            posY = 0;
            return(-1);
        }
示例#2
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);
        }