Exemplo n.º 1
0
        public void ActivationStarConstellationAll(GameClient client)
        {
            int nOccupation = client.ClientData.Occupation;
            Dictionary <int, Dictionary <int, StarConstellationDetailInfo> > dicTmp = null;

            if (this.m_StarConstellationDetailInfo.TryGetValue(nOccupation, out dicTmp) && dicTmp != null)
            {
                if (client.ClientData.RoleStarConstellationInfo == null)
                {
                    client.ClientData.RoleStarConstellationInfo = new Dictionary <int, int>();
                }
                foreach (KeyValuePair <int, Dictionary <int, StarConstellationDetailInfo> > kvp in dicTmp)
                {
                    TCPOutPacket         tcpOutPacket    = null;
                    string               strDbCmd        = string.Format("{0}:{1}:{2}", client.ClientData.RoleID, kvp.Key, this.m_MaxStarSlotID);
                    TCPProcessCmdResults dbRequestResult = Global.RequestToDBServer2(Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool, 10166, strDbCmd, out tcpOutPacket, client.ServerId);
                    if (TCPProcessCmdResults.RESULT_FAILED != dbRequestResult)
                    {
                        Global.PushBackTcpOutPacket(tcpOutPacket);
                    }
                    client.ClientData.RoleStarConstellationInfo[kvp.Key] = this.m_MaxStarSlotID;
                    StarConstellationDetailInfo tmpInfo = null;
                    if (kvp.Value.TryGetValue(this.m_MaxStarSlotID, out tmpInfo) && null != tmpInfo.Propertyinfo)
                    {
                        this.ActivationStarConstellationProp(client, tmpInfo.Propertyinfo, 1);
                    }
                    this.ActivationStarConstellationExtendProp(client, kvp.Key);
                    GameManager.StarConstellationMgr.InitPlayerStarConstellationPorperty(client);
                }
                GlobalEventSource.getInstance().fireEvent(SevenDayGoalEvPool.Alloc(client, ESevenDayGoalFuncType.ActiveXingZuo));
                ProcessTask.ProcessRoleTaskVal(client, TaskTypes.XingZuoStar, -1);
                GameManager.ClientMgr.NotifyUpdateEquipProps(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, client);
                client.ClientData.LifeV  = (int)RoleAlgorithm.GetMaxLifeV(client);
                client.ClientData.MagicV = (int)RoleAlgorithm.GetMaxMagicV(client);
                GameManager.ClientMgr.NotifySelfLifeChanged(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, client);
                client.sendCmd <Dictionary <int, int> >(661, client.ClientData.RoleStarConstellationInfo, false);
            }
        }
Exemplo n.º 2
0
 public void InitPlayerStarConstellationPorperty(GameClient client)
 {
     if (client.ClientData.RoleStarConstellationInfo != null && client.ClientData.RoleStarConstellationInfo.Count > 0)
     {
         int nOccupation = client.ClientData.Occupation;
         Dictionary <int, Dictionary <int, StarConstellationDetailInfo> > dicTmp = null;
         if (this.m_StarConstellationDetailInfo.TryGetValue(nOccupation, out dicTmp) && dicTmp != null)
         {
             client.ClientData.RoleStarConstellationProp.ResetStarConstellationProps();
             foreach (KeyValuePair <int, int> StarConstellationinfo in client.ClientData.RoleStarConstellationInfo)
             {
                 int nStarSiteID = StarConstellationinfo.Key;
                 int nStarSlotID = StarConstellationinfo.Value;
                 if (nStarSiteID >= 0 && nStarSiteID <= this.m_MaxStarSiteID && nStarSlotID >= 0 && nStarSlotID <= this.m_MaxStarSlotID)
                 {
                     Dictionary <int, StarConstellationDetailInfo> dicTmpInfo = null;
                     if (dicTmp.TryGetValue(nStarSiteID, out dicTmpInfo) && dicTmpInfo != null)
                     {
                         for (int i = 0; i <= nStarSlotID; i++)
                         {
                             StarConstellationDetailInfo tmpInfo = null;
                             if (dicTmpInfo.TryGetValue(i, out tmpInfo) && tmpInfo != null)
                             {
                                 PropertyInfo tmpProp = tmpInfo.Propertyinfo;
                                 if (tmpProp == null)
                                 {
                                     return;
                                 }
                                 this.ActivationStarConstellationProp(client, tmpProp, 1);
                             }
                         }
                         this.ActivationStarConstellationExtendProp(client, StarConstellationinfo.Key);
                     }
                 }
             }
         }
     }
 }
Exemplo n.º 3
0
        /// <summary>
        /// 激活星座信息
        /// </summary>
        public int ActivationStarConstellation(GameClient client, int nStarSiteID)
        {
            if (nStarSiteID < 1 || nStarSiteID > m_MaxStarSiteID)
            {
                return(-1);
            }

            if (client.ClientData.RoleStarConstellationInfo == null)
            {
                client.ClientData.RoleStarConstellationInfo = new Dictionary <int, int>();
            }

            int nStarSlot = 0;

            client.ClientData.RoleStarConstellationInfo.TryGetValue(nStarSiteID, out nStarSlot);

            if (nStarSlot >= m_MaxStarSlotID)
            {
                return(-1);
            }

            ++nStarSlot;

            int nOccupation = client.ClientData.Occupation;

            Dictionary <int, Dictionary <int, StarConstellationDetailInfo> > dicTmp = null;

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

            Dictionary <int, StarConstellationDetailInfo> dicTmpInfo = null;

            if (!dicTmp.TryGetValue(nStarSiteID, out dicTmpInfo) || dicTmpInfo == null)
            {
                return(-2);
            }

            StarConstellationDetailInfo tmpInfo = null;

            if (!dicTmpInfo.TryGetValue(nStarSlot, out tmpInfo) || tmpInfo == null)
            {
                return(-2);
            }

            int nNeeChangeLife = 0;

            nNeeChangeLife = tmpInfo.ChangeLifeLimit;
            int nNeedLev       = tmpInfo.LevelLimit;
            int nReqUnionLevel = Global.GetUnionLevel(nNeeChangeLife, nNeedLev);

            if (Global.GetUnionLevel(client.ClientData.ChangeLifeCount, client.ClientData.Level) < nReqUnionLevel)
            {
                return(-3);
            }

            int nGoods = tmpInfo.NeedGoodsID;
            int nNum   = tmpInfo.NeedGoodsNum;

            if (nGoods > 0 && nNum > 0)
            {
                GoodsData goods = null;
                goods = Global.GetGoodsByID(client, nGoods);

                if (goods == null || goods.GCount < nNum)
                {
                    GameManager.ClientMgr.NotifyImportantMsg(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, client,
                                                             StringUtil.substitute(Global.GetLang("所需物品不足")), GameInfoTypeIndexes.Hot, ShowGameInfoTypes.ErrAndBox);

                    return(-5);
                }
            }

            int nNeedStarSoul = tmpInfo.NeedStarSoul;

            if (nNeedStarSoul > 0)
            {
                if (nNeedStarSoul > client.ClientData.StarSoul)
                {
                    GameManager.ClientMgr.NotifyImportantMsg(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, client,
                                                             StringUtil.substitute(Global.GetLang("星魂不足")), GameInfoTypeIndexes.Hot, ShowGameInfoTypes.ErrAndBox);
                    return(-9);
                }
            }

            int nNeedMoney = tmpInfo.NeedJinBi;

            if (nNeedMoney > 0)
            {
                if (!Global.SubBindTongQianAndTongQian(client, nNeedMoney, "激活星座"))
                {
                    GameManager.ClientMgr.NotifyImportantMsg(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, client,
                                                             StringUtil.substitute(Global.GetLang("金币不足")), GameInfoTypeIndexes.Hot, ShowGameInfoTypes.ErrAndBox);

                    return(-10);
                }
            }


            if (nGoods > 0 && nNum > 0)
            {
                bool usedBinding     = false;
                bool usedTimeLimited = false;

                if (!GameManager.ClientMgr.NotifyUseGoods(Global._TCPManager.MySocketListener, Global._TCPManager.tcpClientPool,
                                                          Global._TCPManager.TcpOutPacketPool, client, nGoods, nNum, false, out usedBinding, out usedTimeLimited))
                {
                    return(-6);
                }
            }

            if (nNeedStarSoul > 0)
            {
                GameManager.ClientMgr.ModifyStarSoulValue(client, -nNeedStarSoul, "激活星座", true, true);
                //client.ClientData.StarSoul -= nNeedStarSoul;

                //if (client.ClientData.StarSoul < 0)
                //    client.ClientData.StarSoul = 0;

                //Global.SaveRoleParamsInt32ValueToDB(client, RoleParamName.StarSoul, client.ClientData.StarSoul, true);

                //GameManager.ClientMgr.NotifySelfParamsValueChange(client, RoleCommonUseIntParamsIndexs.StarSoulValue, client.ClientData.StarSoul);
            }

            // 概率
            int nRate = 0;

            nRate = Global.GetRandomNumber(1, 10001);

            if (nRate > tmpInfo.SuccessRate)
            {
                GameManager.ClientMgr.NotifyImportantMsg(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, client,
                                                         StringUtil.substitute(Global.GetLang("激活星位失败")), GameInfoTypeIndexes.Hot, ShowGameInfoTypes.ErrAndBox);
                return(-100);
            }

            // 通知DB
            TCPOutPacket tcpOutPacket = null;
            string       strDbCmd     = string.Format("{0}:{1}:{2}", client.ClientData.RoleID, nStarSiteID, nStarSlot);

            TCPProcessCmdResults dbRequestResult = Global.RequestToDBServer2(Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool,
                                                                             (int)TCPGameServerCmds.CMD_DB_UPDATESTARCONSTELLATION, strDbCmd, out tcpOutPacket, client.ServerId);

            if (TCPProcessCmdResults.RESULT_FAILED == dbRequestResult)
            {
                return(-7);
            }
            Global.PushBackTcpOutPacket(tcpOutPacket);
            PropertyInfo tmpProp = null;

            tmpProp = tmpInfo.Propertyinfo;

            if (tmpProp == null)
            {
                return(-8);
            }

            client.ClientData.RoleStarConstellationInfo[nStarSiteID] = nStarSlot;

            ActivationStarConstellationProp(client, tmpProp);

            /*int nCount = 0;
             *
             * if (!client.ClientData.StarConstellationCount.TryGetValue(nStarSiteID, out nCount))
             * {
             ++nCount;
             *  client.ClientData.StarConstellationCount.Add(nStarSiteID, nCount);
             * }
             * else
             * {
             ++client.ClientData.StarConstellationCount[nStarSiteID];
             * }*/

            if (0 == nStarSlot % 12)
            {
                ActivationStarConstellationExtendProp(client, nStarSiteID);

                // 星座属性 [8/4/2014 LiaoWei]
                GameManager.StarConstellationMgr.InitPlayerStarConstellationPorperty(client);
            }

            // 七日活动
            GlobalEventSource.getInstance().fireEvent(SevenDayGoalEvPool.Alloc(client, ESevenDayGoalFuncType.ActiveXingZuo));

            GameManager.ClientMgr.NotifyUpdateEquipProps(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, client);
            client.ClientData.LifeV  = (int)RoleAlgorithm.GetMaxLifeV(client);
            client.ClientData.MagicV = (int)RoleAlgorithm.GetMaxMagicV(client);
            GameManager.ClientMgr.NotifySelfLifeChanged(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, client);

            return(1);
        }
Exemplo n.º 4
0
        /// <summary>
        /// 初始化玩家的星座加成属性
        /// </summary>
        public void InitPlayerStarConstellationPorperty(GameClient client)
        {
            if (client.ClientData.RoleStarConstellationInfo != null && client.ClientData.RoleStarConstellationInfo.Count > 0)
            {
                int nOccupation = client.ClientData.Occupation;

                Dictionary <int, Dictionary <int, StarConstellationDetailInfo> > dicTmp = null;

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

                // 清空RoleStarConstellationProp 重新计算之
                client.ClientData.RoleStarConstellationProp.ResetStarConstellationProps();

                foreach (var StarConstellationinfo in client.ClientData.RoleStarConstellationInfo)
                {
                    int nStarSiteID = -1;
                    nStarSiteID = StarConstellationinfo.Key;

                    int nStarSlotID = -1;
                    nStarSlotID = StarConstellationinfo.Value;

                    if (nStarSiteID < 0 || nStarSiteID > m_MaxStarSiteID || nStarSlotID < 0 || nStarSlotID > m_MaxStarSlotID)
                    {
                        continue;
                    }

                    Dictionary <int, StarConstellationDetailInfo> dicTmpInfo = null;

                    if (!dicTmp.TryGetValue(nStarSiteID, out dicTmpInfo) || dicTmpInfo == null)
                    {
                        continue;
                    }

                    for (int n = 0; n <= nStarSlotID; ++n)
                    {
                        StarConstellationDetailInfo tmpInfo = null;

                        if (!dicTmpInfo.TryGetValue(n, out tmpInfo) || tmpInfo == null)
                        {
                            continue;
                        }

                        PropertyInfo tmpProp = null;
                        tmpProp = tmpInfo.Propertyinfo;

                        if (tmpProp == null)
                        {
                            return;
                        }

                        ActivationStarConstellationProp(client, tmpProp);
                    }

                    /*int nCount = 0;
                     *
                     * if (!client.ClientData.StarConstellationCount.TryGetValue(nStarSiteID, out nCount))
                     * {
                     ++nCount;
                     *  client.ClientData.StarConstellationCount.Add(nStarSiteID, nCount);
                     * }
                     * else
                     * {
                     ++client.ClientData.StarConstellationCount[nStarSiteID];
                     * }*/

                    ActivationStarConstellationExtendProp(client, StarConstellationinfo.Key);
                }
            }

            // 通知客户端 星魂值 [8/5/2014 LiaoWei]
            //GameManager.ClientMgr.NotifySelfParamsValueChange(client, RoleCommonUseIntParamsIndexs.StarSoulValue, client.ClientData.StarSoul);
        }
Exemplo n.º 5
0
        /// <summary>
        /// 星座详细信息数据
        /// </summary>
        public void LoadStarConstellationDetailInfo()
        {
            for (int i = (int)EOccupationType.EOT_Warrior; i < (int)EOccupationType.EOT_MAX; i++) // 新增魔剑士星座配置 [XSea 2015/4/16]
            {
                XElement xmlFile = null;
                try
                {
                    xmlFile = Global.GetGameResXml(string.Format("Config/XingZuo/XingZuo_{0}.xml", i));
                }
                catch (Exception)
                {
                    throw new Exception(string.Format("启动时加载xml文件: {0} 失败", string.Format("Config/XingZuo/XingZuo_{0}.xml", i)));
                }

                IEnumerable <XElement> StarXmlItems = xmlFile.Elements("XingZuo");

                Dictionary <int, Dictionary <int, StarConstellationDetailInfo> > tmpDicInfo = new Dictionary <int, Dictionary <int, StarConstellationDetailInfo> >();
                foreach (var xmlItem in StarXmlItems)
                {
                    Dictionary <int, StarConstellationDetailInfo> tmpDic = new Dictionary <int, StarConstellationDetailInfo>();

                    int nID = (int)Global.GetSafeAttributeDouble(xmlItem, "ID");

                    IEnumerable <XElement> XingWeiItems = xmlItem.Elements("XingWei");
                    foreach (var XingWeiItem in XingWeiItems)
                    {
                        StarConstellationDetailInfo tmpInfo = new StarConstellationDetailInfo();

                        int ID = (int)Global.GetSafeAttributeDouble(XingWeiItem, "ID");
                        tmpInfo.StarConstellationID = ID;

                        string sLevelInfo = null;
                        sLevelInfo = Global.GetSafeAttributeStr(XingWeiItem, "LevelLimit");

                        string[] sArrayLevelInfo = null;
                        sArrayLevelInfo         = sLevelInfo.Split(',');
                        tmpInfo.ChangeLifeLimit = Global.SafeConvertToInt32(sArrayLevelInfo[0]);
                        tmpInfo.LevelLimit      = Global.SafeConvertToInt32(sArrayLevelInfo[1]);

                        tmpInfo.SuccessRate = (int)(Global.GetSafeAttributeDouble(XingWeiItem, "Succeed") * 10000);

                        //string sGoodsInfo = null;
                        //sGoodsInfo = Global.GetSafeAttributeStr(XingWeiItem, "NeedGoods");

                        tmpInfo.NeedGoodsID  = 0;
                        tmpInfo.NeedGoodsNum = 0;
                        //string[] sArrayGoodInfo = null;
                        //sArrayGoodInfo = sGoodsInfo.Split(',');
                        //if (sArrayGoodInfo != null && sArrayGoodInfo.Length == 2)
                        //{
                        //    tmpInfo.NeedGoodsID = Global.SafeConvertToInt32(sArrayGoodInfo[0]);
                        //    tmpInfo.NeedGoodsNum = Global.SafeConvertToInt32(sArrayGoodInfo[1]);
                        //}

                        tmpInfo.NeedJinBi = (int)Global.GetSafeAttributeDouble(XingWeiItem, "NeedJinBi");

                        tmpInfo.NeedStarSoul = (int)Global.GetSafeAttributeDouble(XingWeiItem, "XingHun");

                        string strShuXingInfos = null;
                        strShuXingInfos = Global.GetSafeAttributeStr(XingWeiItem, "ShuXing");

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

                        string[] sArryInfo = null;

                        if (sArrayPropInfo != null)
                        {
                            tmpInfo.Propertyinfo = new PropertyInfo();
                            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")
                                {
                                    tmpInfo.Propertyinfo.PropertyID1          = (int)ExtPropIndexes.MinDefense;
                                    tmpInfo.Propertyinfo.AddPropertyMinValue1 = Global.SafeConvertToInt32(strArrayPorpValue[0]);

                                    tmpInfo.Propertyinfo.PropertyID2          = (int)ExtPropIndexes.MaxDefense;
                                    tmpInfo.Propertyinfo.AddPropertyMaxValue1 = Global.SafeConvertToInt32(strArrayPorpValue[1]);
                                }
                                else if (strPorpName == "Mdefense")
                                {
                                    tmpInfo.Propertyinfo.PropertyID3          = (int)ExtPropIndexes.MinMDefense;
                                    tmpInfo.Propertyinfo.AddPropertyMinValue2 = Global.SafeConvertToInt32(strArrayPorpValue[0]);

                                    tmpInfo.Propertyinfo.PropertyID4          = (int)ExtPropIndexes.MaxMDefense;
                                    tmpInfo.Propertyinfo.AddPropertyMaxValue2 = Global.SafeConvertToInt32(strArrayPorpValue[1]);
                                }
                                else if (strPorpName == "Attack")
                                {
                                    tmpInfo.Propertyinfo.PropertyID5          = (int)ExtPropIndexes.MinAttack;
                                    tmpInfo.Propertyinfo.AddPropertyMinValue3 = Global.SafeConvertToInt32(strArrayPorpValue[0]);

                                    tmpInfo.Propertyinfo.PropertyID6          = (int)ExtPropIndexes.MaxAttack;
                                    tmpInfo.Propertyinfo.AddPropertyMaxValue3 = Global.SafeConvertToInt32(strArrayPorpValue[1]);
                                }
                                else if (strPorpName == "Mattack")
                                {
                                    tmpInfo.Propertyinfo.PropertyID7          = (int)ExtPropIndexes.MinMAttack;
                                    tmpInfo.Propertyinfo.AddPropertyMinValue4 = Global.SafeConvertToInt32(strArrayPorpValue[0]);

                                    tmpInfo.Propertyinfo.PropertyID8          = (int)ExtPropIndexes.MaxMAttack;
                                    tmpInfo.Propertyinfo.AddPropertyMaxValue4 = Global.SafeConvertToInt32(strArrayPorpValue[1]);
                                }
                                else if (strPorpName == "HitV")
                                {
                                    tmpInfo.Propertyinfo.PropertyID9          = (int)ExtPropIndexes.HitV;
                                    tmpInfo.Propertyinfo.AddPropertyMinValue5 = Global.SafeConvertToInt32(strArrayPorpValue[0]);
                                }
                                else if (strPorpName == "Dodge")
                                {
                                    tmpInfo.Propertyinfo.PropertyID10         = (int)ExtPropIndexes.Dodge;
                                    tmpInfo.Propertyinfo.AddPropertyMinValue6 = Global.SafeConvertToInt32(strArrayPorpValue[0]);
                                }
                                else if (strPorpName == "MaxLifeV")
                                {
                                    tmpInfo.Propertyinfo.PropertyID11         = (int)ExtPropIndexes.MaxLifeV;
                                    tmpInfo.Propertyinfo.AddPropertyMinValue7 = Global.SafeConvertToInt32(strArrayPorpValue[0]);
                                }
                            }
                        }

                        tmpDic.Add(ID, tmpInfo);

                        if (ID > m_MaxStarSlotID)
                        {
                            m_MaxStarSlotID = ID;
                        }
                    }

                    if (nID > m_MaxStarSiteID)
                    {
                        m_MaxStarSiteID = nID;
                    }

                    tmpDicInfo.Add(nID, tmpDic);
                }

                m_StarConstellationDetailInfo.Add(i, tmpDicInfo);
            }
        }
Exemplo n.º 6
0
        public int ActivationStarConstellation(GameClient client, int nStarSiteID)
        {
            int result;

            if (nStarSiteID < 1 || nStarSiteID > this.m_MaxStarSiteID)
            {
                result = -1;
            }
            else
            {
                if (client.ClientData.RoleStarConstellationInfo == null)
                {
                    client.ClientData.RoleStarConstellationInfo = new Dictionary <int, int>();
                }
                int nStarSlot = 0;
                client.ClientData.RoleStarConstellationInfo.TryGetValue(nStarSiteID, out nStarSlot);
                if (nStarSlot >= this.m_MaxStarSlotID)
                {
                    result = -1;
                }
                else if (!GlobalNew.IsGongNengOpened(client, GongNengIDs.GamePayerRolePartXingZuo, false))
                {
                    result = -1;
                }
                else
                {
                    nStarSlot++;
                    int nOccupation = client.ClientData.Occupation;
                    Dictionary <int, Dictionary <int, StarConstellationDetailInfo> > dicTmp = null;
                    if (!this.m_StarConstellationDetailInfo.TryGetValue(nOccupation, out dicTmp) || dicTmp == null)
                    {
                        result = -2;
                    }
                    else
                    {
                        Dictionary <int, StarConstellationDetailInfo> dicTmpInfo = null;
                        if (!dicTmp.TryGetValue(nStarSiteID, out dicTmpInfo) || dicTmpInfo == null)
                        {
                            result = -2;
                        }
                        else
                        {
                            StarConstellationDetailInfo tmpInfo = null;
                            if (!dicTmpInfo.TryGetValue(nStarSlot, out tmpInfo) || tmpInfo == null)
                            {
                                result = -2;
                            }
                            else
                            {
                                int nNeeChangeLife = tmpInfo.ChangeLifeLimit;
                                int nNeedLev       = tmpInfo.LevelLimit;
                                int nReqUnionLevel = Global.GetUnionLevel(nNeeChangeLife, nNeedLev, false);
                                if (Global.GetUnionLevel(client.ClientData.ChangeLifeCount, client.ClientData.Level, false) < nReqUnionLevel)
                                {
                                    result = -3;
                                }
                                else
                                {
                                    int nGoods = tmpInfo.NeedGoodsID;
                                    int nNum   = tmpInfo.NeedGoodsNum;
                                    if (nGoods > 0 && nNum > 0)
                                    {
                                        GoodsData goods = Global.GetGoodsByID(client, nGoods);
                                        if (goods == null || goods.GCount < nNum)
                                        {
                                            GameManager.ClientMgr.NotifyImportantMsg(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, client, StringUtil.substitute(GLang.GetLang(533, new object[0]), new object[0]), GameInfoTypeIndexes.Hot, ShowGameInfoTypes.ErrAndBox, 0);
                                            return(-5);
                                        }
                                    }
                                    int nNeedStarSoul = tmpInfo.NeedStarSoul;
                                    if (nNeedStarSoul > 0)
                                    {
                                        if (nNeedStarSoul > client.ClientData.StarSoul)
                                        {
                                            GameManager.ClientMgr.NotifyImportantMsg(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, client, StringUtil.substitute(GLang.GetLang(534, new object[0]), new object[0]), GameInfoTypeIndexes.Hot, ShowGameInfoTypes.ErrAndBox, 0);
                                            return(-9);
                                        }
                                    }
                                    int nNeedMoney = tmpInfo.NeedJinBi;
                                    if (nNeedMoney > 0)
                                    {
                                        if (!Global.SubBindTongQianAndTongQian(client, nNeedMoney, "激活星座"))
                                        {
                                            GameManager.ClientMgr.NotifyImportantMsg(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, client, StringUtil.substitute(GLang.GetLang(535, new object[0]), new object[0]), GameInfoTypeIndexes.Hot, ShowGameInfoTypes.ErrAndBox, 0);
                                            return(-10);
                                        }
                                    }
                                    if (nGoods > 0 && nNum > 0)
                                    {
                                        bool usedBinding     = false;
                                        bool usedTimeLimited = false;
                                        if (!GameManager.ClientMgr.NotifyUseGoods(Global._TCPManager.MySocketListener, Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool, client, nGoods, nNum, false, out usedBinding, out usedTimeLimited, false))
                                        {
                                            return(-6);
                                        }
                                    }
                                    if (nNeedStarSoul > 0)
                                    {
                                        GameManager.ClientMgr.ModifyStarSoulValue(client, -nNeedStarSoul, "激活星座", true, true);
                                    }
                                    int nRate = Global.GetRandomNumber(1, 10001);
                                    if (nRate > tmpInfo.SuccessRate)
                                    {
                                        GameManager.ClientMgr.NotifyImportantMsg(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, client, StringUtil.substitute(GLang.GetLang(536, new object[0]), new object[0]), GameInfoTypeIndexes.Hot, ShowGameInfoTypes.ErrAndBox, 0);
                                        result = -100;
                                    }
                                    else
                                    {
                                        TCPOutPacket         tcpOutPacket    = null;
                                        string               strDbCmd        = string.Format("{0}:{1}:{2}", client.ClientData.RoleID, nStarSiteID, nStarSlot);
                                        TCPProcessCmdResults dbRequestResult = Global.RequestToDBServer2(Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool, 10166, strDbCmd, out tcpOutPacket, client.ServerId);
                                        if (TCPProcessCmdResults.RESULT_FAILED == dbRequestResult)
                                        {
                                            result = -7;
                                        }
                                        else
                                        {
                                            Global.PushBackTcpOutPacket(tcpOutPacket);
                                            PropertyInfo tmpProp = tmpInfo.Propertyinfo;
                                            if (tmpProp == null)
                                            {
                                                result = -8;
                                            }
                                            else
                                            {
                                                client.ClientData.RoleStarConstellationInfo[nStarSiteID] = nStarSlot;
                                                this.ActivationStarConstellationProp(client, tmpProp, 1);
                                                if (0 == nStarSlot % 12)
                                                {
                                                    this.ActivationStarConstellationExtendProp(client, nStarSiteID);
                                                    GameManager.StarConstellationMgr.InitPlayerStarConstellationPorperty(client);
                                                }
                                                GlobalEventSource.getInstance().fireEvent(SevenDayGoalEvPool.Alloc(client, ESevenDayGoalFuncType.ActiveXingZuo));
                                                ProcessTask.ProcessRoleTaskVal(client, TaskTypes.XingZuoStar, -1);
                                                GameManager.ClientMgr.NotifyUpdateEquipProps(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, client);
                                                client.ClientData.LifeV  = (int)RoleAlgorithm.GetMaxLifeV(client);
                                                client.ClientData.MagicV = (int)RoleAlgorithm.GetMaxMagicV(client);
                                                GameManager.ClientMgr.NotifySelfLifeChanged(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, client);
                                                result = 1;
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
            return(result);
        }
Exemplo n.º 7
0
 public void LoadStarConstellationDetailInfo()
 {
     for (int i = 0; i < 6; i++)
     {
         if (i != 4)
         {
             XElement xmlFile = null;
             try
             {
                 xmlFile = Global.GetGameResXml(string.Format("Config/XingZuo/XingZuo_{0}.xml", i));
             }
             catch (Exception ex)
             {
                 throw new Exception(string.Format("启动时加载xml文件: {0} 失败", string.Format("Config/XingZuo/XingZuo_{0}.xml", i)));
             }
             IEnumerable <XElement> StarXmlItems = xmlFile.Elements("XingZuo");
             Dictionary <int, Dictionary <int, StarConstellationDetailInfo> > tmpDicInfo = new Dictionary <int, Dictionary <int, StarConstellationDetailInfo> >();
             foreach (XElement xmlItem in StarXmlItems)
             {
                 Dictionary <int, StarConstellationDetailInfo> tmpDic = new Dictionary <int, StarConstellationDetailInfo>();
                 int nID = (int)Global.GetSafeAttributeDouble(xmlItem, "ID");
                 IEnumerable <XElement> XingWeiItems = xmlItem.Elements("XingWei");
                 foreach (XElement XingWeiItem in XingWeiItems)
                 {
                     StarConstellationDetailInfo tmpInfo = new StarConstellationDetailInfo();
                     int ID = (int)Global.GetSafeAttributeDouble(XingWeiItem, "ID");
                     tmpInfo.StarConstellationID = ID;
                     string   sLevelInfo      = Global.GetSafeAttributeStr(XingWeiItem, "LevelLimit");
                     string[] sArrayLevelInfo = sLevelInfo.Split(new char[]
                     {
                         ','
                     });
                     tmpInfo.ChangeLifeLimit = Global.SafeConvertToInt32(sArrayLevelInfo[0]);
                     tmpInfo.LevelLimit      = Global.SafeConvertToInt32(sArrayLevelInfo[1]);
                     tmpInfo.SuccessRate     = (int)(Global.GetSafeAttributeDouble(XingWeiItem, "Succeed") * 10000.0);
                     tmpInfo.NeedGoodsID     = 0;
                     tmpInfo.NeedGoodsNum    = 0;
                     tmpInfo.NeedJinBi       = (int)Global.GetSafeAttributeDouble(XingWeiItem, "NeedJinBi");
                     tmpInfo.NeedStarSoul    = (int)Global.GetSafeAttributeDouble(XingWeiItem, "XingHun");
                     string   strShuXingInfos = Global.GetSafeAttributeStr(XingWeiItem, "ShuXing");
                     string[] sArrayPropInfo  = strShuXingInfos.Split(new char[]
                     {
                         '|'
                     });
                     if (sArrayPropInfo != null)
                     {
                         tmpInfo.Propertyinfo = new PropertyInfo();
                         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")
                             {
                                 tmpInfo.Propertyinfo.PropertyID1          = 3;
                                 tmpInfo.Propertyinfo.AddPropertyMinValue1 = Global.SafeConvertToInt32(strArrayPorpValue[0]);
                                 tmpInfo.Propertyinfo.PropertyID2          = 4;
                                 tmpInfo.Propertyinfo.AddPropertyMaxValue1 = Global.SafeConvertToInt32(strArrayPorpValue[1]);
                             }
                             else if (strPorpName == "Mdefense")
                             {
                                 tmpInfo.Propertyinfo.PropertyID3          = 5;
                                 tmpInfo.Propertyinfo.AddPropertyMinValue2 = Global.SafeConvertToInt32(strArrayPorpValue[0]);
                                 tmpInfo.Propertyinfo.PropertyID4          = 6;
                                 tmpInfo.Propertyinfo.AddPropertyMaxValue2 = Global.SafeConvertToInt32(strArrayPorpValue[1]);
                             }
                             else if (strPorpName == "Attack")
                             {
                                 tmpInfo.Propertyinfo.PropertyID5          = 7;
                                 tmpInfo.Propertyinfo.AddPropertyMinValue3 = Global.SafeConvertToInt32(strArrayPorpValue[0]);
                                 tmpInfo.Propertyinfo.PropertyID6          = 8;
                                 tmpInfo.Propertyinfo.AddPropertyMaxValue3 = Global.SafeConvertToInt32(strArrayPorpValue[1]);
                             }
                             else if (strPorpName == "Mattack")
                             {
                                 tmpInfo.Propertyinfo.PropertyID7          = 9;
                                 tmpInfo.Propertyinfo.AddPropertyMinValue4 = Global.SafeConvertToInt32(strArrayPorpValue[0]);
                                 tmpInfo.Propertyinfo.PropertyID8          = 10;
                                 tmpInfo.Propertyinfo.AddPropertyMaxValue4 = Global.SafeConvertToInt32(strArrayPorpValue[1]);
                             }
                             else if (strPorpName == "HitV")
                             {
                                 tmpInfo.Propertyinfo.PropertyID9          = 18;
                                 tmpInfo.Propertyinfo.AddPropertyMinValue5 = Global.SafeConvertToInt32(strArrayPorpValue[0]);
                             }
                             else if (strPorpName == "Dodge")
                             {
                                 tmpInfo.Propertyinfo.PropertyID10         = 19;
                                 tmpInfo.Propertyinfo.AddPropertyMinValue6 = Global.SafeConvertToInt32(strArrayPorpValue[0]);
                             }
                             else if (strPorpName == "MaxLifeV")
                             {
                                 tmpInfo.Propertyinfo.PropertyID11         = 13;
                                 tmpInfo.Propertyinfo.AddPropertyMinValue7 = Global.SafeConvertToInt32(strArrayPorpValue[0]);
                             }
                         }
                     }
                     tmpDic.Add(ID, tmpInfo);
                     if (ID > this.m_MaxStarSlotID)
                     {
                         this.m_MaxStarSlotID = ID;
                     }
                 }
                 if (nID > this.m_MaxStarSiteID)
                 {
                     this.m_MaxStarSiteID = nID;
                 }
                 tmpDicInfo.Add(nID, tmpDic);
             }
             this.m_StarConstellationDetailInfo.Add(i, tmpDicInfo);
         }
     }
 }