Exemplo n.º 1
0
        public bool processCmd(Logic.GameClient client, string[] cmdParams)
        {
            int result = JingJiChangManager.getInstance().removeCD(client);

            client.sendCmd <int>((int)TCPGameServerCmds.CMD_SPR_JINGJICHANG_REMOVE_CD, result);
            return(true);
        }
        public bool processCmd(Logic.GameClient client, string[] cmdParams)
        {
            int roleId = Convert.ToInt32(cmdParams[0]);

            //被挑战者ID
            int beChallengerId = Convert.ToInt32(cmdParams[1]);

            //被挑战者排名
            int beChallengeRanking = Convert.ToInt32(cmdParams[2]);

            //挑战方式: 0:免费, 1:vip
            int enterType = Convert.ToInt32(cmdParams[3]);

            //非法参数
            int result = 0;

            if (beChallengerId < 0 || beChallengeRanking < 1 || beChallengeRanking > JingJiChangConstants.RankingListMaxNum ||
                (enterType != JingJiChangConstants.Enter_Type_Free && enterType != JingJiChangConstants.Enter_Type_Vip))
            {
                client.sendCmd <int>((int)TCPGameServerCmds.CMD_SPR_JINGJI_REQUEST_CHALLENGE, result);
                return(true);
            }

            result = JingJiChangManager.getInstance().requestChallenge(client, beChallengerId, beChallengeRanking, enterType);

            client.sendCmd <int>((int)TCPGameServerCmds.CMD_SPR_JINGJI_REQUEST_CHALLENGE, result);
            return(true);
        }
        public bool processCmd(Logic.GameClient client, string[] cmdParams)
        {
            int result = JingJiChangManager.getInstance().upGradeJunXian(client);

            client.sendCmd <int>((int)TCPGameServerCmds.CMD_SPR_JINGJICHANG_JUNXIAN_LEVELUP, result);
            return(true);
        }
        public bool processCmd(Logic.GameClient client, string[] cmdParams)
        {
            int    nID     = (int)TCPGameServerCmds.CMD_SPR_GET_WANMOTA_DETAIL;
            int    nRoleID = Global.SafeConvertToInt32(cmdParams[0]);
            string strCmd  = "";

            WanMotaInfo data = WanMotaCopySceneManager.GetWanMoTaDetail(client, false);

            if (null == data)
            {
                strCmd = string.Format("{0}:{1}:{2}:{3}:{4}:{5}:{6}", -1, nRoleID, 0, 0, 0, 0, 0);
                client.sendCmd(nID, strCmd);
                return(true);
            }
            else
            {
                strCmd = string.Format("{0}:{1}:{2}:{3}:{4}:{5}:{6}", 0, nRoleID,
                                       data.nPassLayerCount,
                                       data.nTopPassLayerCount,
                                       SweepWanMotaManager.GetSweepCount(client),
                                       data.nSweepLayer,
                                       WanMotaCopySceneManager.WanmotaIsSweeping(client));

                if (WanMoTaTopLayer < data.nTopPassLayerCount)
                {
                    WanMoTaTopLayer = data.nTopPassLayerCount;
                }

                client.sendCmd(nID, strCmd);
                return(true);
            }
        }
Exemplo n.º 5
0
        public bool processCmd(Logic.GameClient client, string[] cmdParams)
        {
            int type = Convert.ToInt32(cmdParams[1]);

            JingJiDetailData data = JingJiChangManager.getInstance().getDetailData(client, type);

            client.sendCmd <JingJiDetailData>((int)TCPGameServerCmds.CMD_SPR_JINGJI_DETAIL, data);
            return(true);
        }
        public bool processCmd(Logic.GameClient client, string[] cmdParams)
        {
            int  result;
            long nextRewardTime;

            JingJiChangManager.getInstance().rankingReward(client, out result, out nextRewardTime);

            client.sendCmd <long[]>((int)TCPGameServerCmds.CMD_SPR_JINGJI_RANKING_REWARD, new long[] { result, nextRewardTime });
            return(true);
        }
Exemplo n.º 7
0
        /// <summary>
        /// 炼制系统命令处理
        /// </summary>
        public bool processCmd(Logic.GameClient client, string[] cmdParams)
        {
            int nID = (int)CmdID;

            if (CmdID == TCPGameServerCmds.CMD_SPR_EXEC_LIANZHI)
            {
                int type  = Global.SafeConvertToInt32(cmdParams[1]); //炼制类型: 0 金币,1 绑钻,2钻石
                int count = Global.SafeConvertToInt32(cmdParams[2]); //炼制次数: 非正数表示全部剩余次数
                return(LianZhiManager.GetInstance().ExecLianZhi(client, type, count));
            }
            else if (CmdID == TCPGameServerCmds.CMD_SPR_QUERY_LIANZHICOUNT)
            {
                return(LianZhiManager.GetInstance().QueryLianZhiCount(client));
            }

            return(false);
        }
        public bool processCmd(Logic.GameClient client, string[] cmdParams)
        {
            int    nID     = (int)TCPGameServerCmds.CMD_SPR_GET_WANMOTA_DETAIL;
            int    nRoleID = Global.SafeConvertToInt32(cmdParams[0]);
            string strCmd  = "";

            WanMotaInfo data = WanMotaCopySceneManager.GetWanMoTaDetail(client, false);

            if (null == data)
            {
                strCmd = string.Format("{0}:{1}:{2}:{3}:{4}:{5}:{6}", -1, nRoleID, 0, 0, 0, 0, 0);
                client.sendCmd(nID, strCmd);
                return(true);
            }
            else
            {
                if (data.nPassLayerCount != client.ClientData.WanMoTaNextLayerOrder)
                {
                    LogManager.WriteLog(LogTypes.Error, string.Format("角色roleid={0} 万魔塔层数不一致 nPassLayerCount={1}, WanMoTaNextLayerOrder={2}", client.ClientData.RoleID, data.nPassLayerCount, client.ClientData.WanMoTaNextLayerOrder));
                    client.ClientData.WanMoTaNextLayerOrder = data.nPassLayerCount;
                    //WanMoTaDBCommandManager.LayerChangeDBCommand(client, data.nPassLayerCount);
                    GameManager.ClientMgr.SaveWanMoTaPassLayerValue(client, data.nPassLayerCount, true);
                }

                strCmd = string.Format("{0}:{1}:{2}:{3}:{4}:{5}:{6}", 0, nRoleID,
                                       data.nPassLayerCount,
                                       data.nTopPassLayerCount,
                                       SweepWanMotaManager.GetSweepCount(client),
                                       data.nSweepLayer,
                                       WanMotaCopySceneManager.WanmotaIsSweeping(client));

                // modify by chenjingui. 20150717,解决多线程操作问题
                // 其实应该在GameServer启动的时候,加载一次万魔塔最高通关,暂时先按照原有方式
                WanMoTaTopLayerManager.Instance().CheckNeedUpdate(data.nTopPassLayerCount);

                /*
                 * if (WanMoTaTopLayer < data.nTopPassLayerCount)
                 * {
                 *  WanMoTaTopLayer = data.nTopPassLayerCount;
                 * }*/

                client.sendCmd(nID, strCmd);
                return(true);
            }
        }
        public void processCmd(Logic.GameClient client, string[] cmdParams)
        {
            //战斗时不允许请求
            if (!JingJiChangManager.getInstance().checkAction(client))
            {
                return;
            }

            //死亡时不允许请求
            if (client.ClientData.CurrentLifeV <= 0 || client.ClientData.CurrentAction == (int)GActions.Death)
            {
                return;
            }

            int pageIndex = Convert.ToInt32(cmdParams[1]);

            List <PlayerJingJiRankingData> rankingDataList = Global.sendToDB <List <PlayerJingJiRankingData> >((int)TCPGameServerCmds.CMD_DB_JINGJICHANG_GET_RANKINGLIST_DATA, DataHelper.ObjectToBytes <int>(pageIndex));

            client.sendCmd <List <PlayerJingJiRankingData> >((int)TCPGameServerCmds.CMD_SPR_JINGJI_RANKINGLIST, rankingDataList);
        }
Exemplo n.º 10
0
        public bool processCmd(Logic.GameClient client, string[] cmdParams)
        {
            int nID     = (int)TCPGameServerCmds.CMD_SPR_JINGJI_START_FIGHT;
            int nRoleID = Global.SafeConvertToInt32(cmdParams[0]);

            string strCmd = "";

            if (-1 == JingJiChangManager.getInstance().JingJiChangStartFight(client))
            {
                strCmd = string.Format("{0}:{1}", -1, nRoleID);
                client.sendCmd(nID, strCmd);
                return(true);
            }
            else
            {
                strCmd = string.Format("{0}:{1}", 0, nRoleID);
                client.sendCmd(nID, strCmd);
                return(true);
            }
        }
Exemplo n.º 11
0
        /// <summary>
        /// 翅膀升星处理
        /// </summary>
        public bool processCmd(Logic.GameClient client, string[] cmdParams)
        {
            int nID = (int)CmdID;

            if (CmdID == TCPGameServerCmds.CMD_SPR_EXEC_WASHPROPS)
            {
                int  dbid        = Global.SafeConvertToInt32(cmdParams[1]);
                int  washIndex   = Global.SafeConvertToInt32(cmdParams[2]); //-1: 洗练数值  0及以上:洗练第几条属性
                bool bUseBinding = Global.SafeConvertToInt32(cmdParams[3]) > 0;
                int  moneyType   = Global.SafeConvertToInt32(cmdParams[4]);
                return(WashPropsManager.WashProps(client, dbid, washIndex, bUseBinding, moneyType));
            }
            else if (CmdID == TCPGameServerCmds.CMD_SPR_EXEC_WASHPROPSINHERIT)
            {
                int leftGoodsDBID  = Global.SafeConvertToInt32(cmdParams[1]); // 源装备
                int rightGoodsDBID = Global.SafeConvertToInt32(cmdParams[2]); // 目标装备
                int moneyType      = Global.SafeConvertToInt32(cmdParams[3]); //消耗钱类型
                return(WashPropsManager.WashPropsInherit(client, leftGoodsDBID, rightGoodsDBID, moneyType));
            }

            return(true);
        }
        public bool processCmd(Logic.GameClient client, string[] cmdParams)
        {
            //战斗时不允许请求
            //if (!JingJiChangManager.getInstance().checkAction(client))
            //{
            //    return true;
            //}

            //死亡时不允许请求
            if (client.ClientData.CurrentLifeV <= 0 || client.ClientData.CurrentAction == (int)GActions.Death)
            {
                return(true);
            }

            int pageIndex = Convert.ToInt32(cmdParams[1]);

            int roleId = client.ClientData.RoleID;

            List <JingJiChallengeInfoData> dataList = Global.sendToDB <List <JingJiChallengeInfoData>, byte[]>((int)TCPGameServerCmds.CMD_DB_JINGJICHANG_ZHANBAO_DATA, DataHelper.ObjectToBytes <int[]>(new int[] { roleId, pageIndex }), client.ServerId);

            client.sendCmd <List <JingJiChallengeInfoData> >((int)TCPGameServerCmds.CMD_SPR_JINGJI_CHALLENGEINFO, dataList);

            return(true);
        }
Exemplo n.º 13
0
        public bool processCmd(Logic.GameClient client, string[] cmdParams)
        {
            int nID         = (int)TCPGameServerCmds.CMD_SPR_WINGUPGRADE;
            int nRoleID     = Global.SafeConvertToInt32(cmdParams[0]);
            int nUpWingMode = Global.SafeConvertToInt32(cmdParams[1]); //0: 道具进阶, 1: 钻石进阶

            string strCmd = "";

            if (null == client.ClientData.MyWingData)
            {
                strCmd = string.Format("{0}:{1}:{2}:{3}", -3, nRoleID, 0, 0);
                client.sendCmd(nID, strCmd);
                return(true);
            }

            // 已到最高级
            if (client.ClientData.MyWingData.WingID >= MUWingsManager.MaxWingID)
            {
                strCmd = string.Format("{0}:{1}:{2}:{3}", -8, nRoleID, 0, 0);
                client.sendCmd(nID, strCmd);
                return(true);
            }

            // 获取进阶信息表
            SystemXmlItem upStarXmlItem = MUWingsManager.GetWingUPCacheItem(client.ClientData.MyWingData.WingID + 1);

            if (null == upStarXmlItem)
            {
                strCmd = string.Format("{0}:{1}:{2}:{3}", -3, nRoleID, 0, 0);
                client.sendCmd(nID, strCmd);
                return(true);
            }

            if (0 == nUpWingMode)
            {
                // 获取进阶需要的道具的物品信息
                string strReqItemID = upStarXmlItem.GetStringValue("NeedGoods");

                // 解析物品ID与数量
                string[] itemParams = strReqItemID.Split(',');
                if (null == itemParams || itemParams.Length != 2)
                {
                    strCmd = string.Format("{0}:{1}:{2}:{3}", -3, nRoleID, 0, 0);
                    client.sendCmd(nID, strCmd);
                    return(true);
                }

                // 获取进阶需要的道具的物品ID
                int nEnchanceNeedGoodsID = Convert.ToInt32(itemParams[0]);
                // 获取进阶需要的道具的物品数量
                int nEnchanceNeedGoodsNum = Convert.ToInt32(itemParams[1]);

                if (nEnchanceNeedGoodsID <= 0 || nEnchanceNeedGoodsNum <= 0)
                {
                    strCmd = string.Format("{0}:{1}:{2}:{3}", -3, nRoleID, 0, 0);
                    client.sendCmd(nID, strCmd);
                    return(true);
                }

                // 判断数量是否够
                if (Global.GetTotalGoodsCountByID(client, nEnchanceNeedGoodsID) < nEnchanceNeedGoodsNum)
                {
                    // 物品数量不够
                    strCmd = string.Format("{0}:{1}:{2}:{3}", -4, nRoleID, 0, 0);
                    client.sendCmd(nID, strCmd);
                    return(true);
                }

                // 自动扣除物品
                if (nEnchanceNeedGoodsNum > 0)
                {
                    bool bUsedBinding     = false;
                    bool bUsedTimeLimited = false;

                    //扣除物品
                    if (!GameManager.ClientMgr.NotifyUseGoods(Global._TCPManager.MySocketListener,
                                                              Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool, client, nEnchanceNeedGoodsID, nEnchanceNeedGoodsNum, false, out bUsedBinding, out bUsedTimeLimited))
                    {
                        strCmd = string.Format("{0}:{1}:{2}:{3}", -5, nRoleID, 0, 0);
                        client.sendCmd(nID, strCmd);
                        return(true);
                    }
                }
            }
            else
            {
                // 获取进阶需要的钻石数量
                int nReqZuanShi = upStarXmlItem.GetIntValue("NeedZuanShi");
                if (nReqZuanShi <= 0)
                {
                    strCmd = string.Format("{0}:{1}:{2}:{3}", -3, nRoleID, 0, 0);
                    client.sendCmd(nID, strCmd);
                    return(true);
                }
                // 判断用户点卷额是否不足【钻石】
                if (client.ClientData.UserMoney < nReqZuanShi)
                {
                    //用户点卷额不足【钻石】
                    strCmd = string.Format("{0}:{1}:{2}:{3}", -6, nRoleID, 0, 0);
                    client.sendCmd(nID, strCmd);
                    return(true);
                }

                //先DBServer请求扣费
                //扣除用户点卷
                if (!GameManager.ClientMgr.SubUserMoney(Global._TCPManager.MySocketListener, Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool, client, nReqZuanShi, "翅膀进阶"))
                {
                    //扣除用户点卷失败
                    strCmd = string.Format("{0}:{1}:{2}:{3}", -7, nRoleID, 0, 0);
                    client.sendCmd(nID, strCmd);
                    return(true);
                }
            }

            int nLuckOne     = upStarXmlItem.GetIntValue("LuckyOne");
            int nLuckyTwo    = upStarXmlItem.GetIntValue("LuckyTwo");
            int nLuckTwoRate = (int)(upStarXmlItem.GetDoubleValue("LuckyTwoRate") * 100.0);

            int nNextWingID          = client.ClientData.MyWingData.WingID;
            int nNextJinJieFailedNum = client.ClientData.MyWingData.JinJieFailedNum;
            int nNextStarLevel       = client.ClientData.MyWingData.ForgeLevel;
            int nNextStarExp         = client.ClientData.MyWingData.StarExp;


            // LuckyOne+提升获得幸运点 < LuckyTwo;必定不会提升成功
            if (nLuckOne + client.ClientData.MyWingData.JinJieFailedNum < nLuckyTwo)
            {
                // 幸运点加1
                nNextJinJieFailedNum++;
            }
            // LuckyOne+提升获得幸运点>= LuckyTwo,则根据配置得到LuckyTwoRate概率判定是否能够完成进阶操作
            else if (nLuckOne + client.ClientData.MyWingData.JinJieFailedNum < 110000)
            {
                //
                int nRandNum = Global.GetRandomNumber(0, 100);
                if (nRandNum < nLuckTwoRate)
                {
                    // 进阶成功
                    nNextWingID++;

                    // 幸运点清0
                    nNextJinJieFailedNum = 0;

                    // 星级清0
                    nNextStarLevel = 0;

                    // 星级经验清0
                    nNextStarExp = 0;
                }
                else
                {
                    // 幸运点加1
                    nNextJinJieFailedNum++;
                }
            }
            // LuckyOne+提升获得幸运点>=110000时,进阶必定成功
            else
            {
                // 进阶成功
                nNextWingID++;

                // 幸运点清0
                nNextJinJieFailedNum = 0;

                // 星级清0
                nNextStarLevel = 0;

                // 星级经验清0
                nNextStarExp = 0;
            }

            // 将改变保存到数据库
            int iRet = MUWingsManager.WingUpDBCommand(client, client.ClientData.MyWingData.DbID, nNextWingID, nNextJinJieFailedNum, nNextStarLevel, nNextStarExp);

            if (iRet < 0)
            {
                strCmd = string.Format("{0}:{1}:{2}:{3}", -3, nRoleID, 0, 0);
                client.sendCmd(nID, strCmd);
                return(true);
            }
            else
            {
                strCmd = string.Format("{0}:{1}:{2}:{3}", 0, nRoleID, nNextWingID, nNextJinJieFailedNum);
                client.sendCmd(nID, strCmd);

                client.ClientData.MyWingData.JinJieFailedNum = nNextJinJieFailedNum;
                if (client.ClientData.MyWingData.WingID != nNextWingID)
                {
                    // 先移除原来的属性
                    if (1 == client.ClientData.MyWingData.Using)
                    {
                        MUWingsManager.UpdateWingDataProps(client, false);
                    }

                    client.ClientData.MyWingData.WingID     = nNextWingID;
                    client.ClientData.MyWingData.ForgeLevel = 0;
                    client.ClientData.MyWingData.StarExp    = 0;


                    // 按新等级增加属性
                    if (1 == client.ClientData.MyWingData.Using)
                    {
                        MUWingsManager.UpdateWingDataProps(client, true);

                        // 通知客户端属性变化
                        GameManager.ClientMgr.NotifyUpdateEquipProps(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, client);

                        // 总生命值和魔法值变化通知(同一个地图才需要通知)
                        GameManager.ClientMgr.NotifyOthersLifeChanged(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, client);
                    }
                }
            }

            return(true);
        }
Exemplo n.º 14
0
        public bool processCmd(Logic.GameClient client, string[] cmdParams)
        {
            int nID         = (int)TCPGameServerCmds.CMD_SPR_WINGUPGRADE;
            int nRoleID     = Global.SafeConvertToInt32(cmdParams[0]);
            int nUpWingMode = Global.SafeConvertToInt32(cmdParams[1]); //0: 道具进阶, 1: 钻石进阶

            string strCmd = "";

            if (null == client.ClientData.MyWingData)
            {
                strCmd = string.Format("{0}:{1}:{2}:{3}", -3, nRoleID, 0, 0);
                client.sendCmd(nID, strCmd);
                return(true);
            }

            // 已到最高级
            if (client.ClientData.MyWingData.WingID >= MUWingsManager.MaxWingID)
            {
                strCmd = string.Format("{0}:{1}:{2}:{3}", -8, nRoleID, 0, 0);
                client.sendCmd(nID, strCmd);
                return(true);
            }

            // 获取进阶信息表
            SystemXmlItem upStarXmlItem = MUWingsManager.GetWingUPCacheItem(client.ClientData.MyWingData.WingID + 1);

            if (null == upStarXmlItem)
            {
                strCmd = string.Format("{0}:{1}:{2}:{3}", -3, nRoleID, 0, 0);
                client.sendCmd(nID, strCmd);
                return(true);
            }

            if (0 == nUpWingMode)
            {
                // 获取进阶需要的道具的物品信息
                string strReqItemID = upStarXmlItem.GetStringValue("NeedGoods");

                // 解析物品ID与数量
                string[] itemParams = strReqItemID.Split(',');
                if (null == itemParams || itemParams.Length != 2)
                {
                    strCmd = string.Format("{0}:{1}:{2}:{3}", -3, nRoleID, 0, 0);
                    client.sendCmd(nID, strCmd);
                    return(true);
                }

                int originGoodsID  = Convert.ToInt32(itemParams[0]);
                int originGoodsNum = Convert.ToInt32(itemParams[1]);
                if (originGoodsID <= 0 || originGoodsNum <= 0)
                {
                    strCmd = string.Format("{0}:{1}:{2}:{3}", -3, nRoleID, 0, 0);
                    client.sendCmd(nID, strCmd);
                    return(true);
                }

                GoodsReplaceResult replaceRet = GoodsReplaceManager.Instance().GetReplaceResult(client, originGoodsID);
                if (replaceRet == null || replaceRet.TotalGoodsCnt() < originGoodsNum)
                {
                    // 物品数量不够
                    strCmd = string.Format("{0}:{1}:{2}:{3}", -4, nRoleID, 0, 0);
                    client.sendCmd(nID, strCmd);
                    return(true);
                }

                List <GoodsReplaceResult.ReplaceItem> realCostList = new List <GoodsReplaceResult.ReplaceItem>();
                // 1:替换后的绑定材料
                // 2:替换后的非绑定材料
                // 3:原始绑定材料
                // 4:原始非绑定材料
                realCostList.AddRange(replaceRet.BindList);
                realCostList.AddRange(replaceRet.UnBindList);
                realCostList.Add(replaceRet.OriginBindGoods);
                realCostList.Add(replaceRet.OriginUnBindGoods);

                int hasUseCnt    = 0;
                int stillNeedCnt = originGoodsNum;
                foreach (var item in realCostList)
                {
                    if (item.GoodsCnt <= 0)
                    {
                        continue;
                    }

                    int realCostCnt = Math.Min(stillNeedCnt, item.GoodsCnt);
                    if (realCostCnt <= 0)
                    {
                        break;
                    }

                    bool bUsedBinding     = false;
                    bool bUsedTimeLimited = false;
                    bool bFailed          = false;
                    if (item.IsBind)
                    {
                        if (!GameManager.ClientMgr.NotifyUseBindGoods(Global._TCPManager.MySocketListener, Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool,
                                                                      client, item.GoodsID, realCostCnt, false, out bUsedBinding, out bUsedTimeLimited))
                        {
                            bFailed = true;
                        }
                    }
                    else
                    {
                        if (!GameManager.ClientMgr.NotifyUseNotBindGoods(Global._TCPManager.MySocketListener, Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool,
                                                                         client, item.GoodsID, realCostCnt, false, out bUsedBinding, out bUsedTimeLimited))
                        {
                            bFailed = true;
                        }
                    }

                    stillNeedCnt -= realCostCnt;

                    if (bFailed)
                    {
                        strCmd = string.Format("{0}:{1}:{2}:{3}", -5, nRoleID, 0, 0);
                        client.sendCmd(nID, strCmd);
                        return(true);
                    }
                }
            }
            else
            {
                // 获取进阶需要的钻石数量
                int nReqZuanShi = upStarXmlItem.GetIntValue("NeedZuanShi");
                if (nReqZuanShi <= 0)
                {
                    strCmd = string.Format("{0}:{1}:{2}:{3}", -3, nRoleID, 0, 0);
                    client.sendCmd(nID, strCmd);
                    return(true);
                }
                // 判断用户点卷额是否不足【钻石】
                if (client.ClientData.UserMoney < nReqZuanShi)
                {
                    //用户点卷额不足【钻石】
                    strCmd = string.Format("{0}:{1}:{2}:{3}", -6, nRoleID, 0, 0);
                    client.sendCmd(nID, strCmd);
                    return(true);
                }

                //先DBServer请求扣费
                //扣除用户点卷
                if (!GameManager.ClientMgr.SubUserMoney(Global._TCPManager.MySocketListener, Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool, client, nReqZuanShi, "翅膀进阶"))
                {
                    //扣除用户点卷失败
                    strCmd = string.Format("{0}:{1}:{2}:{3}", -7, nRoleID, 0, 0);
                    client.sendCmd(nID, strCmd);
                    return(true);
                }
            }

            int nLuckOne     = upStarXmlItem.GetIntValue("LuckyOne");
            int nLuckyTwo    = upStarXmlItem.GetIntValue("LuckyTwo");
            int nLuckTwoRate = (int)(upStarXmlItem.GetDoubleValue("LuckyTwoRate") * 100.0);

            int nNextWingID          = client.ClientData.MyWingData.WingID;
            int nNextJinJieFailedNum = client.ClientData.MyWingData.JinJieFailedNum;
            int nNextStarLevel       = client.ClientData.MyWingData.ForgeLevel;
            int nNextStarExp         = client.ClientData.MyWingData.StarExp;


            // LuckyOne+提升获得幸运点 < LuckyTwo;必定不会提升成功
            if (nLuckOne + client.ClientData.MyWingData.JinJieFailedNum < nLuckyTwo)
            {
                // 幸运点加1
                nNextJinJieFailedNum++;
            }
            // LuckyOne+提升获得幸运点>= LuckyTwo,则根据配置得到LuckyTwoRate概率判定是否能够完成进阶操作
            else if (nLuckOne + client.ClientData.MyWingData.JinJieFailedNum < 110000)
            {
                //
                int nRandNum = Global.GetRandomNumber(0, 100);
                if (nRandNum < nLuckTwoRate)
                {
                    // 进阶成功
                    nNextWingID++;

                    // 幸运点清0
                    nNextJinJieFailedNum = 0;

                    // 星级清0
                    nNextStarLevel = 0;

                    // 星级经验清0
                    nNextStarExp = 0;
                }
                else
                {
                    // 幸运点加1
                    nNextJinJieFailedNum++;
                }
            }
            // LuckyOne+提升获得幸运点>=110000时,进阶必定成功
            else
            {
                // 进阶成功
                nNextWingID++;

                // 幸运点清0
                nNextJinJieFailedNum = 0;

                // 星级清0
                nNextStarLevel = 0;

                // 星级经验清0
                nNextStarExp = 0;
            }

            // 七日活动
            // 翅膀升级和升阶次数,成功失败都算
            GlobalEventSource.getInstance().fireEvent(SevenDayGoalEvPool.Alloc(client, ESevenDayGoalFuncType.WingSuitStarTimes));

            // 将改变保存到数据库
            int iRet = MUWingsManager.WingUpDBCommand(client, client.ClientData.MyWingData.DbID, nNextWingID, nNextJinJieFailedNum, nNextStarLevel, nNextStarExp, client.ClientData.MyWingData.ZhuLingNum, client.ClientData.MyWingData.ZhuHunNum);

            if (iRet < 0)
            {
                strCmd = string.Format("{0}:{1}:{2}:{3}", -3, nRoleID, 0, 0);
                client.sendCmd(nID, strCmd);
                return(true);
            }
            else
            {
                strCmd = string.Format("{0}:{1}:{2}:{3}", 0, nRoleID, nNextWingID, nNextJinJieFailedNum);
                client.sendCmd(nID, strCmd);

                client.ClientData.MyWingData.JinJieFailedNum = nNextJinJieFailedNum;
                if (client.ClientData.MyWingData.WingID != nNextWingID)
                {
                    // 先移除原来的属性
                    if (1 == client.ClientData.MyWingData.Using)
                    {
                        MUWingsManager.UpdateWingDataProps(client, false);
                    }

                    bool oldWingLingYuOpened = GlobalNew.IsGongNengOpened(client, GongNengIDs.WingLingYu);

                    // 更新翅膀的新等级,星数
                    client.ClientData.MyWingData.WingID     = nNextWingID;
                    client.ClientData.MyWingData.ForgeLevel = 0;
                    client.ClientData.MyWingData.StarExp    = 0;

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

                    bool newWingLingYuOpened = GlobalNew.IsGongNengOpened(client, GongNengIDs.WingLingYu);
                    if (!oldWingLingYuOpened && newWingLingYuOpened)
                    {
                        //翎羽功能开启了,初始化
                        LingYuManager.InitAsOpened(client);
                    }

                    // 按新等级增加属性
                    if (1 == client.ClientData.MyWingData.Using)
                    {
                        MUWingsManager.UpdateWingDataProps(client, true);
                        //升阶时候,翅膀的基础属性的改变会影响注魂加成
                        ZhuLingZhuHunManager.UpdateZhuLingZhuHunProps(client);

                        // 通知客户端属性变化
                        GameManager.ClientMgr.NotifyUpdateEquipProps(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, client);

                        // 总生命值和魔法值变化通知(同一个地图才需要通知)
                        GameManager.ClientMgr.NotifyOthersLifeChanged(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, client);
                    }

                    //[bing] 刷新客户端活动叹号
                    if (client._IconStateMgr.CheckJieRiFanLi(client, ActivityTypes.JieriWing))
                    {
                        client._IconStateMgr.AddFlushIconState((ushort)ActivityTipTypes.JieRiActivity, client._IconStateMgr.IsAnyJieRiTipActived());
                        client._IconStateMgr.SendIconStateToClient(client);
                    }
                }
            }

            return(true);
        }
Exemplo n.º 15
0
        /// <summary>
        /// 翅膀升星处理
        /// </summary>
        public bool processCmd(Logic.GameClient client, string[] cmdParams)
        {
            int nID         = (int)TCPGameServerCmds.CMD_SPR_WINGUPSTAR;
            int nRoleID     = Global.SafeConvertToInt32(cmdParams[0]);
            int nUpStarMode = Global.SafeConvertToInt32(cmdParams[1]); //0: 道具升星, 1: 钻石升星

            string strCmd = "";

            if (null == client.ClientData.MyWingData)
            {
                strCmd = string.Format("{0}:{1}:{2}:{3}", -3, nRoleID, 0, 0);
                client.sendCmd(nID, strCmd);
                return(true);
            }

            // 获取升星信息表
            SystemXmlItem upStarXmlItem = WingStarCacheManager.GetWingStarCacheItem(Global.CalcOriginalOccupationID(client), client.ClientData.MyWingData.WingID, client.ClientData.MyWingData.ForgeLevel + 1);

            if (null == upStarXmlItem)
            {
                strCmd = string.Format("{0}:{1}:{2}:{3}", -3, nRoleID, 0, 0);
                client.sendCmd(nID, strCmd);
                return(true);
            }

            string strWingShengXing = GameManager.systemParamsList.GetParamValueByName("WingShengXing");

            if ("" == strWingShengXing)
            {
                strCmd = string.Format("{0}:{1}:{2}:{3}", -3, nRoleID, 0, 0);
                client.sendCmd(nID, strCmd);
                return(true);
            }

            // 解析升级暴率
            string[] wingShengXing = strWingShengXing.Split(',');
            if (3 != wingShengXing.Length)
            {
                strCmd = string.Format("{0}:{1}:{2}:{3}", -3, nRoleID, 0, 0);
                client.sendCmd(nID, strCmd);
                return(true);
            }

            // 暴率
            int nPowRate = 0;
            // 增加的星经验
            int nAddExp = 0;

            if (0 == nUpStarMode)
            {
                nPowRate = (int)(Convert.ToDouble(wingShengXing[0]) * 100.0);
                nAddExp  = Convert.ToInt32(upStarXmlItem.GetIntValue("GoodsExp"));
            }
            else
            {
                nPowRate = (int)(Convert.ToDouble(wingShengXing[1]) * 100.0);
                nAddExp  = Convert.ToInt32(upStarXmlItem.GetIntValue("ZuanShiExp"));
            }

            // 暴升,乘以经验倍数
            int nRandNum = Global.GetRandomNumber(0, 100);

            if (nRandNum < nPowRate)
            {
                nAddExp *= Convert.ToInt32(wingShengXing[2]);
            }

            int nUpStarReqExp  = upStarXmlItem.GetIntValue("StarExp");
            int nNextStarLevel = client.ClientData.MyWingData.ForgeLevel;
            int nNextStarExp   = 0;

            if (client.ClientData.MyWingData.StarExp + nAddExp >= nUpStarReqExp)
            {
                if (nNextStarLevel < MUWingsManager.MaxWingEnchanceLevel)
                {
                    // 改变星级,剩余的经验改到下级
                    nNextStarLevel += 1;
                    nNextStarExp    = client.ClientData.MyWingData.StarExp + nAddExp - nUpStarReqExp;

                    // 连续升星
                    while (true)
                    {
                        if (nNextStarLevel >= MUWingsManager.MaxWingEnchanceLevel)
                        {
                            break;
                        }

                        SystemXmlItem nextStarXmlItem = WingStarCacheManager.GetWingStarCacheItem(Global.CalcOriginalOccupationID(client), client.ClientData.MyWingData.WingID, nNextStarLevel + 1);
                        if (null == upStarXmlItem)
                        {
                            break;
                        }

                        int nNextUpStarReqExp = nextStarXmlItem.GetIntValue("StarExp");
                        if (nNextStarExp >= nNextUpStarReqExp)
                        {
                            nNextStarLevel += 1;
                            nNextStarExp    = nNextStarExp - nNextUpStarReqExp;
                        }
                        else
                        {
                            break;
                        }
                    }
                }
                else
                {
                    // 已经达到最高星
                    nNextStarExp = nUpStarReqExp;
                }
            }
            else
            {
                nNextStarExp = client.ClientData.MyWingData.StarExp + nAddExp;
            }

            if (0 == nUpStarMode)
            {
                //获取强化需要的道具的物品ID
                string strReqItemID = upStarXmlItem.GetStringValue("NeedGoods");

                // 解析物品ID与数量
                string[] itemParams = strReqItemID.Split(',');
                if (null == itemParams || itemParams.Length != 2)
                {
                    strCmd = string.Format("{0}:{1}:{2}:{3}", -3, nRoleID, 0, 0);
                    client.sendCmd(nID, strCmd);
                    return(true);
                }

                //获取强化需要的道具的物品ID
                int nEnchanceNeedGoodsID = Convert.ToInt32(itemParams[0]);
                //获取强化需要的道具的物品数量
                int nEnchanceNeedGoodsNum = Convert.ToInt32(itemParams[1]);

                if (nEnchanceNeedGoodsID <= 0 || nEnchanceNeedGoodsNum <= 0)
                {
                    strCmd = string.Format("{0}:{1}:{2}:{3}", -3, nRoleID, 0, 0);
                    client.sendCmd(nID, strCmd);
                    return(true);
                }

                // 判断数量是否够
                if (Global.GetTotalGoodsCountByID(client, nEnchanceNeedGoodsID) < nEnchanceNeedGoodsNum)
                {
                    // 物品数量不够
                    strCmd = string.Format("{0}:{1}:{2}:{3}", -4, nRoleID, 0, 0);
                    client.sendCmd(nID, strCmd);
                    return(true);
                }

                //自动扣除物品
                if (nEnchanceNeedGoodsNum > 0)
                {
                    bool bUsedBinding     = false;
                    bool bUsedTimeLimited = false;

                    //扣除物品
                    if (!GameManager.ClientMgr.NotifyUseGoods(Global._TCPManager.MySocketListener,
                                                              Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool, client, nEnchanceNeedGoodsID, nEnchanceNeedGoodsNum, false, out bUsedBinding, out bUsedTimeLimited))
                    {
                        strCmd = string.Format("{0}:{1}:{2}:{3}", -5, nRoleID, 0, 0);
                        client.sendCmd(nID, strCmd);
                        return(true);
                    }
                }
            }
            else
            {
                // 获取强化需要的钻石数量
                int nReqZuanShi = upStarXmlItem.GetIntValue("NeedZuanShi");
                if (nReqZuanShi <= 0)
                {
                    strCmd = string.Format("{0}:{1}:{2}:{3}", -3, nRoleID, 0, 0);
                    client.sendCmd(nID, strCmd);
                    return(true);
                }
                //判断用户点卷额是否不足【钻石】
                if (client.ClientData.UserMoney < nReqZuanShi)
                {
                    //用户点卷额不足【钻石】
                    strCmd = string.Format("{0}:{1}:{2}:{3}", -6, nRoleID, 0, 0);
                    client.sendCmd(nID, strCmd);
                    return(true);
                }

                //先DBServer请求扣费
                //扣除用户点卷
                if (!GameManager.ClientMgr.SubUserMoney(Global._TCPManager.MySocketListener, Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool, client, nReqZuanShi, "翅膀升星"))
                {
                    //扣除用户点卷失败
                    strCmd = string.Format("{0}:{1}:{2}:{3}", -7, nRoleID, 0, 0);
                    client.sendCmd(nID, strCmd);
                    return(true);
                }
            }

            // 将改变保存到数据库
            int iRet = MUWingsManager.WingUpStarDBCommand(client, client.ClientData.MyWingData.DbID, nNextStarLevel, nNextStarExp);

            if (iRet < 0)
            {
                strCmd = string.Format("{0}:{1}:{2}:{3}", -3, nRoleID, 0, 0);
                client.sendCmd(nID, strCmd);
                return(true);
            }
            else
            {
                strCmd = string.Format("{0}:{1}:{2}:{3}", 0, nRoleID, nNextStarLevel, nNextStarExp);
                client.sendCmd(nID, strCmd);

                client.ClientData.MyWingData.StarExp = nNextStarExp;
                if (client.ClientData.MyWingData.ForgeLevel != nNextStarLevel)
                {
                    // 先移除原来的属性
                    if (1 == client.ClientData.MyWingData.Using)
                    {
                        MUWingsManager.UpdateWingDataProps(client, false);
                    }

                    client.ClientData.MyWingData.ForgeLevel = nNextStarLevel;

                    // 按新等级增加属性
                    if (1 == client.ClientData.MyWingData.Using)
                    {
                        MUWingsManager.UpdateWingDataProps(client, true);

                        // 通知客户端属性变化
                        GameManager.ClientMgr.NotifyUpdateEquipProps(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, client);

                        // 总生命值和魔法值变化通知(同一个地图才需要通知)
                        GameManager.ClientMgr.NotifyOthersLifeChanged(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, client);
                    }
                }
            }

            return(true);
        }
Exemplo n.º 16
0
        /// <summary>
        /// 翅膀升星处理
        /// </summary>
        public bool processCmd(Logic.GameClient client, string[] cmdParams)
        {
            //int nID = (int)TCPGameServerCmds.CMD_SPR_WINGUPSTAR;
            int nRoleID     = Global.SafeConvertToInt32(cmdParams[0]);
            int nUpStarMode = Global.SafeConvertToInt32(cmdParams[1]); //0: 道具升星, 1: 钻石升星

            //string strCmd = "";
            SCWingStarUp scData = null;

            if (null == client.ClientData.MyWingData)
            {
                //strCmd = string.Format("{0}:{1}:{2}:{3}", -3, nRoleID, 0, 0);
                //client.sendCmd(nID, strCmd);

                scData = new SCWingStarUp(-3, nRoleID, 0, 0);
                client.sendCmd((int)TCPGameServerCmds.CMD_SPR_WINGUPSTAR, scData);

                return(true);
            }

            // 获取升星信息表
            SystemXmlItem upStarXmlItem = WingStarCacheManager.GetWingStarCacheItem(Global.CalcOriginalOccupationID(client), client.ClientData.MyWingData.WingID, client.ClientData.MyWingData.ForgeLevel + 1);

            if (null == upStarXmlItem)
            {
                //strCmd = string.Format("{0}:{1}:{2}:{3}", -3, nRoleID, 0, 0);
                //client.sendCmd(nID, strCmd);

                scData = new SCWingStarUp(StdErrorCode.Error_Level_Reach_Max_Level, nRoleID, 0, 0);
                client.sendCmd((int)TCPGameServerCmds.CMD_SPR_WINGUPSTAR, scData);

                return(true);
            }

            string strWingShengXing = GameManager.systemParamsList.GetParamValueByName("WingShengXing");

            if ("" == strWingShengXing)
            {
                //strCmd = string.Format("{0}:{1}:{2}:{3}", -3, nRoleID, 0, 0);
                //client.sendCmd(nID, strCmd);

                scData = new SCWingStarUp(-3, nRoleID, 0, 0);
                client.sendCmd((int)TCPGameServerCmds.CMD_SPR_WINGUPSTAR, scData);

                return(true);
            }

            // 解析升级暴率
            string[] wingShengXing = strWingShengXing.Split(',');
            if (3 != wingShengXing.Length)
            {
                //strCmd = string.Format("{0}:{1}:{2}:{3}", -3, nRoleID, 0, 0);
                //client.sendCmd(nID, strCmd);
                scData = new SCWingStarUp(-3, nRoleID, 0, 0);
                client.sendCmd((int)TCPGameServerCmds.CMD_SPR_WINGUPSTAR, scData);

                return(true);
            }

            // 暴率
            int nPowRate = 0;
            // 增加的星经验
            int nAddExp = 0;

            if (0 == nUpStarMode)
            {
                nPowRate = (int)(Convert.ToDouble(wingShengXing[0]) * 100.0);
                nAddExp  = Convert.ToInt32(upStarXmlItem.GetIntValue("GoodsExp"));
            }
            else
            {
                nPowRate = (int)(Convert.ToDouble(wingShengXing[1]) * 100.0);
                nAddExp  = Convert.ToInt32(upStarXmlItem.GetIntValue("ZuanShiExp"));
            }

            // 暴升,乘以经验倍数
            int nRandNum = Global.GetRandomNumber(0, 100);

            if (nRandNum < nPowRate)
            {
                nAddExp *= Convert.ToInt32(wingShengXing[2]);
            }

            int nUpStarReqExp  = upStarXmlItem.GetIntValue("StarExp");
            int nNextStarLevel = client.ClientData.MyWingData.ForgeLevel;
            int nNextStarExp   = 0;

            if (client.ClientData.MyWingData.StarExp + nAddExp >= nUpStarReqExp)
            {
                if (nNextStarLevel < MUWingsManager.MaxWingEnchanceLevel)
                {
                    // 改变星级,剩余的经验改到下级
                    nNextStarLevel += 1;
                    nNextStarExp    = client.ClientData.MyWingData.StarExp + nAddExp - nUpStarReqExp;

                    // 连续升星
                    while (true)
                    {
                        if (nNextStarLevel >= MUWingsManager.MaxWingEnchanceLevel)
                        {
                            break;
                        }

                        SystemXmlItem nextStarXmlItem = WingStarCacheManager.GetWingStarCacheItem(Global.CalcOriginalOccupationID(client), client.ClientData.MyWingData.WingID, nNextStarLevel + 1);
                        if (null == upStarXmlItem)
                        {
                            break;
                        }

                        int nNextUpStarReqExp = nextStarXmlItem.GetIntValue("StarExp");
                        if (nNextStarExp >= nNextUpStarReqExp)
                        {
                            nNextStarLevel += 1;
                            nNextStarExp    = nNextStarExp - nNextUpStarReqExp;
                        }
                        else
                        {
                            break;
                        }
                    }
                }
                else
                {
                    // 已经达到最高星
                    nNextStarExp = nUpStarReqExp;
                }
            }
            else
            {
                nNextStarExp = client.ClientData.MyWingData.StarExp + nAddExp;
            }

            if (0 == nUpStarMode)
            {
                //获取强化需要的道具的物品ID
                string strReqItemID = upStarXmlItem.GetStringValue("NeedGoods");

                // 解析物品ID与数量
                string[] itemParams = strReqItemID.Split(',');
                if (null == itemParams || itemParams.Length != 2)
                {
                    //strCmd = string.Format("{0}:{1}:{2}:{3}", -3, nRoleID, 0, 0);
                    //client.sendCmd(nID, strCmd);

                    scData = new SCWingStarUp(-3, nRoleID, 0, 0);
                    client.sendCmd((int)TCPGameServerCmds.CMD_SPR_WINGUPSTAR, scData);

                    return(true);
                }

                int originGoodsID  = Convert.ToInt32(itemParams[0]);
                int originGoodsNum = Convert.ToInt32(itemParams[1]);
                if (originGoodsID <= 0 || originGoodsNum <= 0)
                {
                    //strCmd = string.Format("{0}:{1}:{2}:{3}", -3, nRoleID, 0, 0);
                    //client.sendCmd(nID, strCmd);

                    scData = new SCWingStarUp(-3, nRoleID, 0, 0);
                    client.sendCmd((int)TCPGameServerCmds.CMD_SPR_WINGUPSTAR, scData);

                    return(true);
                }

                GoodsReplaceResult replaceRet = GoodsReplaceManager.Instance().GetReplaceResult(client, originGoodsID);
                if (replaceRet == null || replaceRet.TotalGoodsCnt() < originGoodsNum)
                {
                    // 物品数量不够
                    //strCmd = string.Format("{0}:{1}:{2}:{3}", -4, nRoleID, 0, 0);
                    //client.sendCmd(nID, strCmd);

                    scData = new SCWingStarUp(-4, nRoleID, 0, 0);
                    client.sendCmd((int)TCPGameServerCmds.CMD_SPR_WINGUPSTAR, scData);

                    return(true);
                }

                List <GoodsReplaceResult.ReplaceItem> realCostList = new List <GoodsReplaceResult.ReplaceItem>();
                // 1:替换后的绑定材料
                // 2:替换后的非绑定材料
                // 3:原始绑定材料
                // 4:原始非绑定材料
                realCostList.AddRange(replaceRet.BindList);
                realCostList.AddRange(replaceRet.UnBindList);
                realCostList.Add(replaceRet.OriginBindGoods);
                realCostList.Add(replaceRet.OriginUnBindGoods);

                int hasUseCnt    = 0;
                int stillNeedCnt = originGoodsNum;
                foreach (var item in realCostList)
                {
                    if (item.GoodsCnt <= 0)
                    {
                        continue;
                    }

                    int realCostCnt = Math.Min(stillNeedCnt, item.GoodsCnt);
                    if (realCostCnt <= 0)
                    {
                        break;
                    }

                    bool bUsedBinding     = false;
                    bool bUsedTimeLimited = false;
                    bool bFailed          = false;
                    if (item.IsBind)
                    {
                        if (!GameManager.ClientMgr.NotifyUseBindGoods(Global._TCPManager.MySocketListener, Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool,
                                                                      client, item.GoodsID, realCostCnt, false, out bUsedBinding, out bUsedTimeLimited))
                        {
                            bFailed = true;
                        }
                    }
                    else
                    {
                        if (!GameManager.ClientMgr.NotifyUseNotBindGoods(Global._TCPManager.MySocketListener, Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool,
                                                                         client, item.GoodsID, realCostCnt, false, out bUsedBinding, out bUsedTimeLimited))
                        {
                            bFailed = true;
                        }
                    }

                    stillNeedCnt -= realCostCnt;

                    if (bFailed)
                    {
                        //strCmd = string.Format("{0}:{1}:{2}:{3}", -5, nRoleID, 0, 0);
                        //client.sendCmd(nID, strCmd);

                        scData = new SCWingStarUp(-5, nRoleID, 0, 0);
                        client.sendCmd((int)TCPGameServerCmds.CMD_SPR_WINGUPSTAR, scData);

                        return(true);
                    }
                }
            }
            else
            {
                // 获取强化需要的钻石数量
                int nReqZuanShi = upStarXmlItem.GetIntValue("NeedZuanShi");
                if (nReqZuanShi <= 0)
                {
                    //strCmd = string.Format("{0}:{1}:{2}:{3}", -3, nRoleID, 0, 0);
                    //client.sendCmd(nID, strCmd);

                    scData = new SCWingStarUp(-3, nRoleID, 0, 0);
                    client.sendCmd((int)TCPGameServerCmds.CMD_SPR_WINGUPSTAR, scData);

                    return(true);
                }
                //判断用户点卷额是否不足【钻石】
                if (client.ClientData.UserMoney < nReqZuanShi)
                {
                    //用户点卷额不足【钻石】
                    //strCmd = string.Format("{0}:{1}:{2}:{3}", -6, nRoleID, 0, 0);
                    //client.sendCmd(nID, strCmd);

                    scData = new SCWingStarUp(-6, nRoleID, 0, 0);
                    client.sendCmd((int)TCPGameServerCmds.CMD_SPR_WINGUPSTAR, scData);

                    return(true);
                }

                //先DBServer请求扣费
                //扣除用户点卷
                if (!GameManager.ClientMgr.SubUserMoney(Global._TCPManager.MySocketListener, Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool, client, nReqZuanShi, "翅膀升星"))
                {
                    //扣除用户点卷失败
                    //strCmd = string.Format("{0}:{1}:{2}:{3}", -7, nRoleID, 0, 0);
                    //client.sendCmd(nID, strCmd);

                    scData = new SCWingStarUp(-7, nRoleID, 0, 0);
                    client.sendCmd((int)TCPGameServerCmds.CMD_SPR_WINGUPSTAR, scData);

                    return(true);
                }
            }

            // 七日活动
            // 翅膀升级和升阶次数,成功失败都算
            GlobalEventSource.getInstance().fireEvent(SevenDayGoalEvPool.Alloc(client, ESevenDayGoalFuncType.WingSuitStarTimes));

            // 将改变保存到数据库
            int iRet = MUWingsManager.WingUpStarDBCommand(client, client.ClientData.MyWingData.DbID, nNextStarLevel, nNextStarExp);

            if (iRet < 0)
            {
                //strCmd = string.Format("{0}:{1}:{2}:{3}", -3, nRoleID, 0, 0);
                //client.sendCmd(nID, strCmd);

                scData = new SCWingStarUp(-3, nRoleID, 0, 0);
                client.sendCmd((int)TCPGameServerCmds.CMD_SPR_WINGUPSTAR, scData);

                return(true);
            }
            else
            {
                //strCmd = string.Format("{0}:{1}:{2}:{3}", 0, nRoleID, nNextStarLevel, nNextStarExp);
                //client.sendCmd(nID, strCmd);

                scData = new SCWingStarUp(0, nRoleID, nNextStarLevel, nNextStarExp);
                client.sendCmd((int)TCPGameServerCmds.CMD_SPR_WINGUPSTAR, scData);

                client.ClientData.MyWingData.StarExp = nNextStarExp;
                if (client.ClientData.MyWingData.ForgeLevel != nNextStarLevel)
                {
                    // 先移除原来的属性
                    if (1 == client.ClientData.MyWingData.Using)
                    {
                        MUWingsManager.UpdateWingDataProps(client, false);
                    }

                    bool oldWingLingYuOpened = GlobalNew.IsGongNengOpened(client, GongNengIDs.WingLingYu);

                    client.ClientData.MyWingData.ForgeLevel = nNextStarLevel;

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

                    bool newWingLingYuOpened = GlobalNew.IsGongNengOpened(client, GongNengIDs.WingLingYu);
                    if (!oldWingLingYuOpened && newWingLingYuOpened)
                    {
                        // 翎羽功能开启了,执行初始化
                        LingYuManager.InitAsOpened(client);
                    }

                    // 按新等级增加属性
                    if (1 == client.ClientData.MyWingData.Using)
                    {
                        MUWingsManager.UpdateWingDataProps(client, true);
                        //升星时候,翅膀的基础属性的改变会影响注魂加成
                        ZhuLingZhuHunManager.UpdateZhuLingZhuHunProps(client);

                        // 通知客户端属性变化
                        GameManager.ClientMgr.NotifyUpdateEquipProps(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, client);

                        // 总生命值和魔法值变化通知(同一个地图才需要通知)
                        GameManager.ClientMgr.NotifyOthersLifeChanged(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, client);
                    }

                    //[bing] 刷新客户端活动叹号
                    if (client._IconStateMgr.CheckJieRiFanLi(client, ActivityTypes.JieriWing) ||
                        client._IconStateMgr.CheckSpecialActivity(client))
                    {
                        client._IconStateMgr.AddFlushIconState((ushort)ActivityTipTypes.JieRiActivity, client._IconStateMgr.IsAnyJieRiTipActived());
                        client._IconStateMgr.SendIconStateToClient(client);
                    }
                }
            }

            return(true);
        }
Exemplo n.º 17
0
 public bool processCmd(Logic.GameClient client, string[] cmdParams)
 {
     JingJiChangManager.getInstance().onLeaveFuBenForStopCD(client);
     return(true);
 }
Exemplo n.º 18
0
        public bool processCmd(Logic.GameClient client, string[] cmdParams)
        {
            int nID              = (int)TCPGameServerCmds.CMD_SPR_SWEEP_WANMOTA;
            int nRoleID          = Global.SafeConvertToInt32(cmdParams[0]);
            int nSweepBeginOrder = Global.SafeConvertToInt32(cmdParams[1]);

            string strCmd = "";

            // 扫荡需要的最小挑战通关层数
            if (client.ClientData.WanMoTaProp.nPassLayerCount < SweepWanMotaManager.nSweepReqMinLayerOrder)
            {
                strCmd = string.Format("{0}:{1}", -2, nRoleID);
                client.sendCmd(nID, strCmd);
                return(true);
            }

            // 扫荡已完成,需要领取奖励
            if (0 == client.ClientData.WanMoTaProp.nSweepLayer)
            {
                strCmd = string.Format("{0}:{1}", -4, nRoleID);
                client.sendCmd(nID, strCmd);
                return(true);
            }

            //// 检测要扫荡的层是否与服务器一致
            //if (client.ClientData.WanMoTaProp.nSweepLayer != nSweepBeginOrder)
            //{
            //    strCmd = string.Format("{0}:{1}", -3, nRoleID);
            //    client.sendCmd(nID, strCmd);
            //    return true;
            //}

            //// 检测是否还有扫荡次数
            //if (client.ClientData.WanMoTaProp.nSweepLayer != nSweepBeginOrder)
            //{
            //    strCmd = string.Format("{0}:{1}", -3, nRoleID);
            //    client.sendCmd(nID, strCmd);
            //    return true;
            //}

            // 继续扫荡
            if (client.ClientData.WanMoTaProp.nSweepLayer > 0)
            {
                SweepWanMotaManager.SweepContinue(client);
            }
            // 重新开始扫荡
            else
            {
                // 扫荡次数是否用完
                if (SweepWanMotaManager.GetSweepCount(client) >= SweepWanMotaManager.nWanMoTaMaxSweepNum)
                {
                    strCmd = string.Format("{0}:{1}", -1, nRoleID);
                    client.sendCmd(nID, strCmd);
                    return(true);
                }

                SweepWanMotaManager.SweepBegin(client);
            }

            strCmd = string.Format("{0}:{1}", 0, nRoleID);
            client.sendCmd(nID, strCmd);
            return(true);
        }