コード例 #1
0
        public ChangeLifeDataInfo GetChangeLifeDataInfo(GameClient Client, int nChangeLife = 0)
        {
            if (nChangeLife == 0)
            {
                nChangeLife = Client.ClientData.ChangeLifeCount;
            }
            Dictionary <int, ChangeLifeDataInfo> dicTmp = new Dictionary <int, ChangeLifeDataInfo>();
            ChangeLifeDataInfo result;

            if (!GameManager.ChangeLifeMgr.m_ChangeLifeInfoList.TryGetValue(Client.ClientData.Occupation, out dicTmp))
            {
                result = null;
            }
            else
            {
                ChangeLifeDataInfo infoTmp = new ChangeLifeDataInfo();
                if (!dicTmp.TryGetValue(nChangeLife, out infoTmp))
                {
                    result = null;
                }
                else
                {
                    result = infoTmp;
                }
            }
            return(result);
        }
コード例 #2
0
        /// <summary>
        /// 初始化玩家的转生加成属性
        /// </summary>
        public void InitPlayerChangeLifePorperty(GameClient client)
        {
            if (client.ClientData.ChangeLifeCount > 0)
            {
                int nOccupation = client.ClientData.Occupation;

                Dictionary <int, ChangeLifeDataInfo> dicTmp = null;

                if (!m_ChangeLifeInfoList.TryGetValue(nOccupation, out dicTmp) || dicTmp == null)
                {
                    return;
                }

                ChangeLifeDataInfo dataTmp = new ChangeLifeDataInfo();

                if (!dicTmp.TryGetValue(client.ClientData.ChangeLifeCount, out dataTmp) || dataTmp == null)
                {
                    return;
                }

                ChangeLifePropertyInfo tmpProp = null;
                tmpProp = dataTmp.Propertyinfo;

                if (tmpProp == null)
                {
                    return;
                }

                ActivationChangeLifeProp(client, tmpProp);
            }
        }
コード例 #3
0
 public void LoadRoleZhuanShengInfo()
 {
     for (int i = 0; i < 6; i++)
     {
         if (i != 4)
         {
             XElement xmlFile = null;
             try
             {
                 xmlFile = Global.GetGameResXml(string.Format("Config/Roles/ZhuanSheng_{0}.xml", i));
             }
             catch (Exception ex)
             {
                 throw new Exception(string.Format("启动时加载xml文件: {0} 失败", string.Format("Config/Roles/ZhuanSheng_{0}.xml", i)));
             }
             IEnumerable <XElement> ChgOccpXEle          = xmlFile.Elements("ZhuanShengs").Elements <XElement>();
             Dictionary <int, ChangeLifeDataInfo> tmpDic = new Dictionary <int, ChangeLifeDataInfo>();
             foreach (XElement xmlItem in ChgOccpXEle)
             {
                 ChangeLifeDataInfo tmpChgLifeInfo = new ChangeLifeDataInfo();
                 int nLifeID = 0;
                 if (null != xmlItem)
                 {
                     nLifeID = (int)Global.GetSafeAttributeLong(xmlItem, "ChangeLifeID");
                     tmpChgLifeInfo.ChangeLifeID  = (int)Global.GetSafeAttributeLong(xmlItem, "ChangeLifeID");
                     tmpChgLifeInfo.NeedLevel     = (int)Global.GetSafeAttributeLong(xmlItem, "Level");
                     tmpChgLifeInfo.NeedMoney     = (int)Global.GetSafeAttributeLong(xmlItem, "NeedJinBi");
                     tmpChgLifeInfo.NeedMoJing    = (int)Global.GetSafeAttributeLong(xmlItem, "NeedMoJing");
                     tmpChgLifeInfo.ExpProportion = Global.GetSafeAttributeLong(xmlItem, "ExpProportion");
                     string sGoodsID = Global.GetSafeAttributeStr(xmlItem, "NeedGoods");
                     if (string.IsNullOrEmpty(sGoodsID))
                     {
                         LogManager.WriteLog(LogTypes.Warning, string.Format("转生文件NeedGoods为空", new object[0]), null, true);
                     }
                     else
                     {
                         string[] fields = sGoodsID.Split(new char[]
                         {
                             '|'
                         });
                         if (fields.Length <= 0)
                         {
                             LogManager.WriteLog(LogTypes.Warning, string.Format("转生文件NeedGoods为空", new object[0]), null, true);
                         }
                         else
                         {
                             tmpChgLifeInfo.NeedGoodsDataList = Global.LoadChangeOccupationNeedGoodsInfo(sGoodsID, "转生文件");
                         }
                     }
                     string   strShuXingInfos = Global.GetSafeAttributeStr(xmlItem, "AwardShuXing");
                     string[] sArrayPropInfo  = strShuXingInfos.Split(new char[]
                     {
                         '|'
                     });
                     if (sArrayPropInfo != null)
                     {
                         tmpChgLifeInfo.Propertyinfo = new ChangeLifePropertyInfo();
                         for (int j = 0; j < sArrayPropInfo.Length; j++)
                         {
                             string[] sArryInfo = sArrayPropInfo[j].Split(new char[]
                             {
                                 ','
                             });
                             string   strPorpName       = sArryInfo[0];
                             string   strPorpValue      = sArryInfo[1];
                             string[] strArrayPorpValue = strPorpValue.Split(new char[]
                             {
                                 '-'
                             });
                             if (strPorpName == "Defense")
                             {
                                 tmpChgLifeInfo.Propertyinfo.PhyDefenseMin         = 3;
                                 tmpChgLifeInfo.Propertyinfo.AddPhyDefenseMinValue = Global.SafeConvertToInt32(strArrayPorpValue[0]);
                                 tmpChgLifeInfo.Propertyinfo.PhyDefenseMax         = 4;
                                 tmpChgLifeInfo.Propertyinfo.AddPhyDefenseMaxValue = Global.SafeConvertToInt32(strArrayPorpValue[1]);
                             }
                             else if (strPorpName == "Mdefense")
                             {
                                 tmpChgLifeInfo.Propertyinfo.MagDefenseMin         = 5;
                                 tmpChgLifeInfo.Propertyinfo.AddMagDefenseMinValue = Global.SafeConvertToInt32(strArrayPorpValue[0]);
                                 tmpChgLifeInfo.Propertyinfo.MagDefenseMax         = 6;
                                 tmpChgLifeInfo.Propertyinfo.AddMagDefenseMaxValue = Global.SafeConvertToInt32(strArrayPorpValue[1]);
                             }
                             else if (strPorpName == "Attack")
                             {
                                 tmpChgLifeInfo.Propertyinfo.PhyAttackMin         = 7;
                                 tmpChgLifeInfo.Propertyinfo.AddPhyAttackMinValue = Global.SafeConvertToInt32(strArrayPorpValue[0]);
                                 tmpChgLifeInfo.Propertyinfo.PhyAttackMax         = 8;
                                 tmpChgLifeInfo.Propertyinfo.AddPhyAttackMaxValue = Global.SafeConvertToInt32(strArrayPorpValue[1]);
                             }
                             else if (strPorpName == "Mattack")
                             {
                                 tmpChgLifeInfo.Propertyinfo.MagAttackMin         = 9;
                                 tmpChgLifeInfo.Propertyinfo.AddMagAttackMinValue = Global.SafeConvertToInt32(strArrayPorpValue[0]);
                                 tmpChgLifeInfo.Propertyinfo.MagAttackMax         = 10;
                                 tmpChgLifeInfo.Propertyinfo.AddMagAttackMaxValue = Global.SafeConvertToInt32(strArrayPorpValue[1]);
                             }
                             else if (strPorpName == "HitV")
                             {
                                 tmpChgLifeInfo.Propertyinfo.HitProp         = 18;
                                 tmpChgLifeInfo.Propertyinfo.AddHitPropValue = Global.SafeConvertToInt32(strArrayPorpValue[0]);
                             }
                             else if (strPorpName == "Dodge")
                             {
                                 tmpChgLifeInfo.Propertyinfo.DodgeProp         = 19;
                                 tmpChgLifeInfo.Propertyinfo.AddDodgePropValue = Global.SafeConvertToInt32(strArrayPorpValue[0]);
                             }
                             else if (strPorpName == "MaxLifeV")
                             {
                                 tmpChgLifeInfo.Propertyinfo.MaxLifeProp         = 13;
                                 tmpChgLifeInfo.Propertyinfo.AddMaxLifePropValue = Global.SafeConvertToInt32(strArrayPorpValue[0]);
                             }
                             else if (strPorpName == "AddAttack")
                             {
                                 tmpChgLifeInfo.Propertyinfo.PhyAttackMin         = 7;
                                 tmpChgLifeInfo.Propertyinfo.AddPhyAttackMinValue = Global.SafeConvertToInt32(strArrayPorpValue[0]);
                                 tmpChgLifeInfo.Propertyinfo.PhyAttackMax         = 8;
                                 tmpChgLifeInfo.Propertyinfo.AddPhyAttackMaxValue = Global.SafeConvertToInt32(strArrayPorpValue[1]);
                                 tmpChgLifeInfo.Propertyinfo.MagAttackMin         = 9;
                                 tmpChgLifeInfo.Propertyinfo.AddMagAttackMinValue = Global.SafeConvertToInt32(strArrayPorpValue[0]);
                                 tmpChgLifeInfo.Propertyinfo.MagAttackMax         = 10;
                                 tmpChgLifeInfo.Propertyinfo.AddMagAttackMaxValue = Global.SafeConvertToInt32(strArrayPorpValue[1]);
                             }
                         }
                     }
                     string sGoodsID2 = Global.GetSafeAttributeStr(xmlItem, "AwardGoods");
                     if (string.IsNullOrEmpty(sGoodsID2))
                     {
                         LogManager.WriteLog(LogTypes.Warning, string.Format("转生文件NeedGoods为空", new object[0]), null, true);
                     }
                     else
                     {
                         string[] fields2 = sGoodsID2.Split(new char[]
                         {
                             '|'
                         });
                         if (fields2.Length <= 0)
                         {
                             LogManager.WriteLog(LogTypes.Warning, string.Format("转生文件NeedGoods为空", new object[0]), null, true);
                         }
                         else
                         {
                             tmpChgLifeInfo.AwardGoodsDataList = Global.LoadChangeOccupationNeedGoodsInfo(sGoodsID2, "转生文件");
                         }
                     }
                 }
                 if (nLifeID > this.m_MaxChangeLifeCount)
                 {
                     this.m_MaxChangeLifeCount = nLifeID;
                 }
                 if (nLifeID > 1)
                 {
                     tmpChgLifeInfo.Propertyinfo.AddFrom(tmpDic[nLifeID - 1].Propertyinfo);
                 }
                 tmpDic.Add(nLifeID, tmpChgLifeInfo);
             }
             this.m_ChangeLifeInfoList.Add(i, tmpDic);
         }
     }
 }
コード例 #4
0
        /// <summary>
        /// 转生信息表
        /// </summary>
        public void LoadRoleZhuanShengInfo()
        {
            for (int i = 0; i < 3; i++)
            {
                XElement xmlFile = null;
                try
                {
                    xmlFile = Global.GetGameResXml(string.Format("Config/Roles/ZhuanSheng_{0}.xml", i));
                }
                catch (Exception)
                {
                    throw new Exception(string.Format("启动时加载xml文件: {0} 失败", string.Format("Config/Roles/ZhuanSheng_{0}.xml", i)));
                }

                IEnumerable <XElement> ChgOccpXEle          = xmlFile.Elements("ZhuanShengs").Elements();
                Dictionary <int, ChangeLifeDataInfo> tmpDic = new Dictionary <int, ChangeLifeDataInfo>();

                foreach (var xmlItem in ChgOccpXEle)
                {
                    ChangeLifeDataInfo tmpChgLifeInfo = new ChangeLifeDataInfo();

                    int nLifeID = 0;

                    if (null != xmlItem)
                    {
                        nLifeID = (int)Global.GetSafeAttributeLong(xmlItem, "ChangeLifeID");

                        tmpChgLifeInfo.ChangeLifeID  = (int)Global.GetSafeAttributeLong(xmlItem, "ChangeLifeID");
                        tmpChgLifeInfo.NeedLevel     = (int)Global.GetSafeAttributeLong(xmlItem, "Level");
                        tmpChgLifeInfo.NeedMoney     = (int)Global.GetSafeAttributeLong(xmlItem, "NeedJinBi");
                        tmpChgLifeInfo.NeedMoJing    = (int)Global.GetSafeAttributeLong(xmlItem, "NeedMoJing");
                        tmpChgLifeInfo.ExpProportion = Global.GetSafeAttributeLong(xmlItem, "ExpProportion");

                        string sGoodsID = Global.GetSafeAttributeStr(xmlItem, "NeedGoods");
                        if (string.IsNullOrEmpty(sGoodsID))
                        {
                            LogManager.WriteLog(LogTypes.Warning, string.Format("转生文件NeedGoods为空"));
                        }
                        else
                        {
                            string[] fields = sGoodsID.Split('|');
                            if (fields.Length <= 0)
                            {
                                LogManager.WriteLog(LogTypes.Warning, string.Format("转生文件NeedGoods为空"));
                            }
                            else
                            {
                                tmpChgLifeInfo.NeedGoodsDataList = Global.LoadChangeOccupationNeedGoodsInfo(sGoodsID, "转生文件"); //将物品字符串列表解析成物品数据列表
                            }
                        }

                        string strShuXingInfos = null;
                        strShuXingInfos = Global.GetSafeAttributeStr(xmlItem, "AwardShuXing");

                        string[] sArrayPropInfo = null;
                        sArrayPropInfo = strShuXingInfos.Split('|');

                        string[] sArryInfo = null;

                        if (sArrayPropInfo != null)
                        {
                            tmpChgLifeInfo.Propertyinfo = new ChangeLifePropertyInfo();
                            for (int n = 0; n < sArrayPropInfo.Length; ++n)
                            {
                                sArryInfo = null;
                                sArryInfo = sArrayPropInfo[n].Split(',');

                                string strPorpName = null;
                                strPorpName = sArryInfo[0];

                                string strPorpValue = null;
                                strPorpValue = sArryInfo[1];

                                string[] strArrayPorpValue = null;
                                strArrayPorpValue = strPorpValue.Split('-');

                                if (strPorpName == "Defense")
                                {
                                    tmpChgLifeInfo.Propertyinfo.PhyDefenseMin         = (int)ExtPropIndexes.MinDefense;
                                    tmpChgLifeInfo.Propertyinfo.AddPhyDefenseMinValue = Global.SafeConvertToInt32(strArrayPorpValue[0]);

                                    tmpChgLifeInfo.Propertyinfo.PhyDefenseMax         = (int)ExtPropIndexes.MaxDefense;
                                    tmpChgLifeInfo.Propertyinfo.AddPhyDefenseMaxValue = Global.SafeConvertToInt32(strArrayPorpValue[1]);
                                }
                                else if (strPorpName == "Mdefense")
                                {
                                    tmpChgLifeInfo.Propertyinfo.MagDefenseMin         = (int)ExtPropIndexes.MinMDefense;
                                    tmpChgLifeInfo.Propertyinfo.AddMagDefenseMinValue = Global.SafeConvertToInt32(strArrayPorpValue[0]);

                                    tmpChgLifeInfo.Propertyinfo.MagDefenseMax         = (int)ExtPropIndexes.MaxMDefense;
                                    tmpChgLifeInfo.Propertyinfo.AddMagDefenseMaxValue = Global.SafeConvertToInt32(strArrayPorpValue[1]);
                                }
                                else if (strPorpName == "Attack")
                                {
                                    tmpChgLifeInfo.Propertyinfo.PhyAttackMin         = (int)ExtPropIndexes.MinAttack;
                                    tmpChgLifeInfo.Propertyinfo.AddPhyAttackMinValue = Global.SafeConvertToInt32(strArrayPorpValue[0]);

                                    tmpChgLifeInfo.Propertyinfo.PhyAttackMax         = (int)ExtPropIndexes.MaxAttack;
                                    tmpChgLifeInfo.Propertyinfo.AddPhyAttackMaxValue = Global.SafeConvertToInt32(strArrayPorpValue[1]);
                                }
                                else if (strPorpName == "Mattack")
                                {
                                    tmpChgLifeInfo.Propertyinfo.MagAttackMin         = (int)ExtPropIndexes.MinMAttack;
                                    tmpChgLifeInfo.Propertyinfo.AddMagAttackMinValue = Global.SafeConvertToInt32(strArrayPorpValue[0]);

                                    tmpChgLifeInfo.Propertyinfo.MagAttackMax         = (int)ExtPropIndexes.MaxMAttack;
                                    tmpChgLifeInfo.Propertyinfo.AddMagAttackMaxValue = Global.SafeConvertToInt32(strArrayPorpValue[1]);
                                }
                                else if (strPorpName == "HitV")
                                {
                                    tmpChgLifeInfo.Propertyinfo.HitProp         = (int)ExtPropIndexes.HitV;
                                    tmpChgLifeInfo.Propertyinfo.AddHitPropValue = Global.SafeConvertToInt32(strArrayPorpValue[0]);
                                }
                                else if (strPorpName == "Dodge")
                                {
                                    tmpChgLifeInfo.Propertyinfo.DodgeProp         = (int)ExtPropIndexes.Dodge;
                                    tmpChgLifeInfo.Propertyinfo.AddDodgePropValue = Global.SafeConvertToInt32(strArrayPorpValue[0]);
                                }
                                else if (strPorpName == "MaxLifeV")
                                {
                                    tmpChgLifeInfo.Propertyinfo.MaxLifeProp         = (int)ExtPropIndexes.MaxLifeV;
                                    tmpChgLifeInfo.Propertyinfo.AddMaxLifePropValue = Global.SafeConvertToInt32(strArrayPorpValue[0]);
                                }
                            }
                        }

                        string sGoodsID1 = Global.GetSafeAttributeStr(xmlItem, "AwardGoods");
                        if (string.IsNullOrEmpty(sGoodsID1))
                        {
                            LogManager.WriteLog(LogTypes.Warning, string.Format("转生文件NeedGoods为空"));
                        }
                        else
                        {
                            string[] fields1 = sGoodsID1.Split('|');
                            if (fields1.Length <= 0)
                            {
                                LogManager.WriteLog(LogTypes.Warning, string.Format("转生文件NeedGoods为空"));
                            }
                            else
                            {
                                tmpChgLifeInfo.AwardGoodsDataList = Global.LoadChangeOccupationNeedGoodsInfo(sGoodsID1, "转生文件"); //将物品字符串列表解析成物品数据列表
                            }
                        }
                    }

                    if (nLifeID > m_MaxChangeLifeCount)
                    {
                        m_MaxChangeLifeCount = nLifeID;
                    }
                    if (nLifeID > 1)
                    {
                        tmpChgLifeInfo.Propertyinfo.AddFrom(tmpDic[nLifeID - 1].Propertyinfo);
                    }
                    tmpDic.Add(nLifeID, tmpChgLifeInfo);
                }

                m_ChangeLifeInfoList.Add(i, tmpDic);
            }
        }