예제 #1
0
 private void LoadHuangJinBossInfo()
 {
     try
     {
         XElement xmlFile = Global.GetGameResXml(string.Format("Config/HuangJin.xml", new object[0]));
         if (null != xmlFile)
         {
             IEnumerable <XElement> WorldBossXEle = xmlFile.Elements("Boss");
             foreach (XElement xmlItem in WorldBossXEle)
             {
                 if (null != xmlItem)
                 {
                     SystemXmlItem systemXmlItem = new SystemXmlItem
                     {
                         XMLNode = xmlItem
                     };
                     TimerBossData tmpInfo = new TimerBossData();
                     tmpInfo.nRoleID = systemXmlItem.GetIntValue("ID", -1);
                     int[] arrLevel = systemXmlItem.GetIntArrayValue("Level", ',');
                     if (arrLevel == null || arrLevel.Length != 2)
                     {
                         throw new Exception(string.Format("启动时加载xml文件: {0} 失败 Level格式错误", string.Format("Config/HuangJin.xml", new object[0])));
                     }
                     tmpInfo.nReqLevel           = arrLevel[1];
                     tmpInfo.nReqChangeLiveCount = arrLevel[0];
                     this.m_HuangJinBossDict.Add(tmpInfo.nRoleID, tmpInfo);
                 }
             }
         }
     }
     catch (Exception)
     {
         throw new Exception(string.Format("启动时加载xml文件: {0} 失败", string.Format("Config/HuangJin.xml", new object[0])));
     }
 }
예제 #2
0
        /// <summary>
        /// 是否有黄金部队
        /// </summary>
        public bool HaveHuangJinBoss(GameClient client)
        {
            lock (m_LivedInMapBoss)
            {
                foreach (KeyValuePair <int, int> kvp in m_LivedInMapBoss)
                {
                    if (kvp.Value == (int)MonsterBirthTypes.CreateDayOfWeek)
                    {
                        TimerBossData bossData = null;

                        // 是否存在于世界BOSS列表中
                        if (m_HuangJinBossDict.TryGetValue(kvp.Key, out bossData))
                        {
                            if (null != bossData)
                            {
                                // 达到要求的转生数与级别
                                if ((client.ClientData.ChangeLifeCount >= bossData.nReqChangeLiveCount &&
                                     client.ClientData.Level >= bossData.nReqLevel) ||
                                    client.ClientData.ChangeLifeCount > bossData.nReqChangeLiveCount)
                                {
                                    return(true);
                                }
                            }
                        }
                    }
                }
            }

            return(false);
        }
예제 #3
0
        /// summary
        /// 装入世界BOSS信息
        /// summary
        private void LoadWorldBossInfo()
        {
            // 世界BOSS信息表
            try
            {
                XElement xmlFile = null;
                xmlFile = Global.GetGameResXml(string.Format("Config/Activity/BossInfo.xml"));
                if (null == xmlFile)
                {
                    return;
                }

                IEnumerable <XElement> WorldBossXEle = xmlFile.Elements("Boss");
                foreach (var xmlItem in WorldBossXEle)
                {
                    if (null != xmlItem)
                    {
                        SystemXmlItem systemXmlItem = new SystemXmlItem()
                        {
                            XMLNode = xmlItem,
                        };

                        TimerBossData tmpInfo = new TimerBossData();

                        tmpInfo.nRoleID = systemXmlItem.GetIntValue("ID");
                        int [] arrLevel = systemXmlItem.GetIntArrayValue("Level");
                        if (null == arrLevel || arrLevel.Length != 2)
                        {
                            // 填写错误则抛异常
                            systemXmlItem = null;
                            throw new Exception(string.Format("启动时加载xml文件: {0} 失败 Level格式错误", string.Format("Config/Activity/BossInfo.xml")));
                        }
                        else
                        {
                            tmpInfo.nReqLevel           = arrLevel[1];
                            tmpInfo.nReqChangeLiveCount = arrLevel[0];
                        }

                        systemXmlItem = null;
                        m_WorldBossDict.Add(tmpInfo.nRoleID, tmpInfo);
                    }
                }
            }
            catch (Exception)
            {
                throw new Exception(string.Format("启动时加载xml文件: {0} 失败", string.Format("Config/Activity/BossInfo.xml")));
            }
        }
예제 #4
0
 public bool HaveHuangJinBoss(GameClient client)
 {
     lock (this.m_LivedInMapBoss)
     {
         foreach (KeyValuePair <int, int> kvp in this.m_LivedInMapBoss)
         {
             if (kvp.Value == 7)
             {
                 TimerBossData bossData = null;
                 if (this.m_HuangJinBossDict.TryGetValue(kvp.Key, out bossData))
                 {
                     if (null != bossData)
                     {
                         if ((client.ClientData.ChangeLifeCount == bossData.nReqChangeLiveCount && client.ClientData.Level >= bossData.nReqLevel) || client.ClientData.ChangeLifeCount > bossData.nReqChangeLiveCount)
                         {
                             return(true);
                         }
                     }
                 }
             }
         }
     }
     return(false);
 }