Exemplo n.º 1
0
 public static void SendMsgToClientForWanMoTaCopyMapAward(GameClient client, CopyMap copyMap, bool anyAlive)
 {
     if (copyMap != null)
     {
         int fuBenSeqID = FuBenManager.FindFuBenSeqIDByRoleID(client.ClientData.RoleID);
         FuBenTongGuanData fubenTongGuanData = null;
         bool bFirstPassWanMoTa = false;
         if (fuBenSeqID > 0)
         {
             FuBenInfoItem fuBenInfoItem = FuBenManager.FindFuBenInfoBySeqID(fuBenSeqID);
             if (null != fuBenInfoItem)
             {
                 fuBenInfoItem.EndTicks = TimeUtil.NOW();
                 int addFuBenNum = 1;
                 if (fuBenInfoItem.nDayOfYear != TimeUtil.NowDateTime().DayOfYear)
                 {
                     addFuBenNum = 0;
                 }
                 int fuBenID = FuBenManager.FindFuBenIDByMapCode(client.ClientData.MapCode);
                 if (fuBenID > 0)
                 {
                     if (WanMotaCopySceneManager.IsWanMoTaMapCode(client.ClientData.MapCode))
                     {
                         if (!Global.FuBenPassed(client, fuBenID))
                         {
                             bFirstPassWanMoTa = true;
                         }
                     }
                     int usedSecs = (int)((fuBenInfoItem.EndTicks - fuBenInfoItem.StartTicks) / 1000L);
                     Global.UpdateFuBenDataForQuickPassTimer(client, fuBenID, usedSecs, addFuBenNum);
                     FuBenMapItem fuBenMapItem = FuBenManager.FindMapCodeByFuBenID(fuBenID, client.ClientData.MapCode);
                     fubenTongGuanData = WanMotaCopySceneManager.GiveCopyMapGiftNoScore(client, fuBenMapItem, true);
                     GameManager.DBCmdMgr.AddDBCmd(10053, string.Format("{0}:{1}:{2}:{3}", new object[]
                     {
                         client.ClientData.RoleID,
                         Global.FormatRoleName(client, client.ClientData.RoleName),
                         fuBenID,
                         usedSecs
                     }), null, client.ServerId);
                 }
             }
         }
         GameManager.ClientMgr.NotifyAllFuBenBeginInfo(copyMap, client.ClientData.RoleID, !anyAlive);
         if (fubenTongGuanData != null && bFirstPassWanMoTa)
         {
             TCPOutPacket tcpOutPacket = DataHelper.ObjectToTCPOutPacket <FuBenTongGuanData>(fubenTongGuanData, Global._TCPManager.TcpOutPacketPool, 521);
             if (!Global._TCPManager.MySocketListener.SendData(client.ClientSocket, tcpOutPacket, true))
             {
             }
         }
     }
 }
Exemplo n.º 2
0
        /// <summary>
        /// 处理用户的获取副本奖励
        /// </summary>
        /// <param name="client"></param>
        public static bool ProcessFuBenMapAwards(GameClient client, bool notifyClient = false)
        {
            if (client.ClientData.FuBenSeqID < 0)
            {
                GameManager.ClientMgr.NotifyImportantMsg(
                    Global._TCPManager.MySocketListener,
                    Global._TCPManager.TcpOutPacketPool, client, StringUtil.substitute(Global.GetLang("您当前的副本顺序ID错误")), GameInfoTypeIndexes.Error, ShowGameInfoTypes.ErrAndBox);
                return(false);
            }

            //如果已经获取过一次奖励,则不再提示奖励
            //查找角色的ID+副本顺序ID对应地图编号的奖励领取状态
            int awardState = GameManager.CopyMapMgr.FindAwardState(client.ClientData.RoleID, client.ClientData.FuBenSeqID, client.ClientData.MapCode);

            if (awardState > 0)
            {
                GameManager.ClientMgr.NotifyImportantMsg(
                    Global._TCPManager.MySocketListener,
                    Global._TCPManager.TcpOutPacketPool, client, StringUtil.substitute(Global.GetLang("当前副本地图的奖励只能领取一次")), GameInfoTypeIndexes.Error, ShowGameInfoTypes.ErrAndBox);
                return(false);
            }

            int fuBenID = FuBenManager.FindFuBenIDByMapCode(client.ClientData.MapCode);

            if (fuBenID <= 0)
            {
                GameManager.ClientMgr.NotifyImportantMsg(
                    Global._TCPManager.MySocketListener,
                    Global._TCPManager.TcpOutPacketPool, client, StringUtil.substitute(Global.GetLang("没有找到当前地图对应的副本配置")), GameInfoTypeIndexes.Error, ShowGameInfoTypes.ErrAndBox);
                return(false);
            }

            FuBenInfoItem fuBenInfoItem = FuBenManager.FindFuBenInfoBySeqID(client.ClientData.FuBenSeqID);

            if (null == fuBenInfoItem)
            {
                GameManager.ClientMgr.NotifyImportantMsg(
                    Global._TCPManager.MySocketListener,
                    Global._TCPManager.TcpOutPacketPool, client, StringUtil.substitute(Global.GetLang("没有找到对应的内存副本信息")), GameInfoTypeIndexes.Error, ShowGameInfoTypes.ErrAndBox);
                return(false);
            }

            if (fuBenID != fuBenInfoItem.FuBenID)
            {
                GameManager.ClientMgr.NotifyImportantMsg(
                    Global._TCPManager.MySocketListener,
                    Global._TCPManager.TcpOutPacketPool, client, StringUtil.substitute(Global.GetLang("副本ID错误,无法领取其他副本的奖励")), GameInfoTypeIndexes.Error, ShowGameInfoTypes.ErrAndBox);
                return(false);
            }

            FuBenMapItem fuBenMapItem = FindMapCodeByFuBenID(fuBenID, client.ClientData.MapCode);

            if (null == fuBenMapItem)
            {
                GameManager.ClientMgr.NotifyImportantMsg(
                    Global._TCPManager.MySocketListener,
                    Global._TCPManager.TcpOutPacketPool, client, StringUtil.substitute(Global.GetLang("没有找到当前副本地图的奖励")), GameInfoTypeIndexes.Error, ShowGameInfoTypes.ErrAndBox);
                return(false);
            }

            CopyMap copyMap = null;

            copyMap = GameManager.CopyMapMgr.FindCopyMap(client.ClientData.MapCode);
            if (copyMap == null)
            {
                GameManager.ClientMgr.NotifyImportantMsg(
                    Global._TCPManager.MySocketListener,
                    Global._TCPManager.TcpOutPacketPool, client, StringUtil.substitute(Global.GetLang("领取副本奖励出错")), GameInfoTypeIndexes.Error, ShowGameInfoTypes.ErrAndBox);
                return(false);
            }

            GameManager.CopyMapMgr.AddAwardState(client.ClientData.RoleID, client.ClientData.FuBenSeqID, client.ClientData.MapCode, 1);

            FuBenTongGuanData fubenTongGuanData = null;

            int  nMaxTime     = fuBenMapItem.MaxTime * 60; //分->秒
            long startTicks   = fuBenInfoItem.StartTicks;
            long endTicks     = fuBenInfoItem.EndTicks;
            int  nFinishTimer = (int)(endTicks - startTicks) / 1000; //毫秒->秒
            int  killedNum    = 0;                                   // copyMap.KilledNormalNum + copyMap.KilledBossNum;
            int  nDieCount    = fuBenInfoItem.nDieCount;

            //向客户的发放通关奖励
            fubenTongGuanData = Global.GiveCopyMapGiftForScore(client, fuBenID, nMaxTime, nFinishTimer, killedNum, nDieCount, fuBenMapItem.Experience, fuBenMapItem.Money1, fuBenMapItem);

            if (fubenTongGuanData != null)
            {
                //发送奖励到客户端
                TCPOutPacket tcpOutPacket = DataHelper.ObjectToTCPOutPacket <FuBenTongGuanData>(fubenTongGuanData, Global._TCPManager.TcpOutPacketPool,
                                                                                                (int)TCPGameServerCmds.CMD_SPR_FUBENPASSNOTIFY);

                if (!Global._TCPManager.MySocketListener.SendData(client.ClientSocket, tcpOutPacket))
                {
                    //如果发送失败
                }
            }

            /*if (null != fuBenMapItem.GoodsDataList)
             * {
             *  //判断背包是否空间足够
             *  if (!Global.CanAddGoodsDataList(client, fuBenMapItem.GoodsDataList))
             *  {
             *      GameManager.ClientMgr.NotifyImportantMsg(
             *          Global._TCPManager.MySocketListener,
             *          Global._TCPManager.TcpOutPacketPool, client, StringUtil.substitute(Global.GetLang("背包中空格不足,请清理出足够的空格后,再获取副本地图的奖励")), GameInfoTypeIndexes.Error, ShowGameInfoTypes.ErrAndBox, (int)HintErrCodeTypes.NoBagGrid);
             *      return false;
             *  }
             * }
             *
             * //添加角色的ID+副本顺序ID对应地图编号的奖励领取状态
             * GameManager.CopyMapMgr.AddAwardState(client.ClientData.RoleID, client.ClientData.FuBenSeqID, client.ClientData.MapCode, 1);
             *
             * if (Global.FilterFallGoods(client)) //是否奖励物品
             * {
             *  //奖励用户物品
             *  if (null != fuBenMapItem.GoodsDataList)
             *  {
             *      for (int i = 0; i < fuBenMapItem.GoodsDataList.Count; i++)
             *      {
             *          //想DBServer请求加入某个新的物品到背包中
             *          //添加物品
             *          Global.AddGoodsDBCommand(Global._TCPManager.TcpOutPacketPool,
             *              client, fuBenMapItem.GoodsDataList[i].GoodsID, fuBenMapItem.GoodsDataList[i].GCount, fuBenMapItem.GoodsDataList[i].Quality, "", fuBenMapItem.GoodsDataList[i].Forge_level, fuBenMapItem.GoodsDataList[i].Binding, 0, "", true, 1, "副本奖励物品", Global.ConstGoodsEndTime, fuBenMapItem.GoodsDataList[i].AddPropIndex, fuBenMapItem.GoodsDataList[i].BornIndex, fuBenMapItem.GoodsDataList[i].Lucky, fuBenMapItem.GoodsDataList[i].Strong);
             *      }
             *  }
             * }
             *
             * //奖励用户经验
             * //异步写数据库,写入经验和级别
             * int experience = fuBenMapItem.Experience;
             *
             * //处理角色经验
             * GameManager.ClientMgr.ProcessRoleExperience(client, experience, true, false);
             *
             * //通知客户端
             * if (notifyClient)
             * {
             *  string msgText = string.Format(Global.GetLang("恭喜您通关本副本后,获得了{0}点经验奖励"), experience);
             *  GameManager.ClientMgr.NotifyImportantMsg(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool,
             *      client, msgText, GameInfoTypeIndexes.Hot, ShowGameInfoTypes.ErrAndBox, 0);
             * }
             *
             * //判断如果是最后一层,则不显示
             * int toNextMapCode = FuBenManager.FindNextMapCodeByFuBenID(client.ClientData.MapCode);
             * if (-1 == toNextMapCode) //最后一层?
             * {
             *  //副本通关获取经验通知
             *  Global.BroadcastFuBenExperience(client, fuBenID, experience);
             * }
             *
             * //奖励用户金钱
             * //异步写数据库,写入金钱
             * int money = fuBenMapItem.Money1;
             * if (-1 != money)
             * {
             *  //过滤金币奖励
             *  money = Global.FilterValue(client, money);
             *
             *  //更新用户的铜钱
             *  GameManager.ClientMgr.AddMoney1(Global._TCPManager.MySocketListener, Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool, client, money, false);
             *
             *  //GameManager.SystemServerEvents.AddEvent(string.Format("角色获取金钱, roleID={0}({1}), Money={2}, newMoney={3}", client.ClientData.RoleID, client.ClientData.RoleName, client.ClientData.Money1, money), EventLevels.Record);
             * }*/

            Global.AddFuBenAwardEvent(client, fuBenID);

            return(true);
        }
Exemplo n.º 3
0
        public static FuBenTongGuanData GiveCopyMapGiftNoScore(GameClient client, FuBenMapItem fuBenMapItem, bool bFirstPass)
        {
            FuBenTongGuanData result;

            if (null == fuBenMapItem)
            {
                result = null;
            }
            else
            {
                List <GoodsData> goodNormal = new List <GoodsData>();
                List <int>       goodsID    = new List <int>();
                WanMotaCopySceneManager.GetFubenItemReward(client, fuBenMapItem, bFirstPass, goodNormal, goodsID);
                if (bFirstPass)
                {
                    WanMotaCopySceneManager.GetFubenItemReward(client, fuBenMapItem, false, goodNormal, goodsID);
                }
                FuBenTongGuanData fuBenTongGuanData = new FuBenTongGuanData();
                fuBenTongGuanData.FuBenID      = fuBenMapItem.FuBenID;
                fuBenTongGuanData.TotalScore   = 0;
                fuBenTongGuanData.KillNum      = 0;
                fuBenTongGuanData.KillScore    = 0;
                fuBenTongGuanData.MaxKillScore = 0;
                fuBenTongGuanData.UsedSecs     = 0;
                fuBenTongGuanData.TimeScore    = 0;
                fuBenTongGuanData.MaxTimeScore = 0;
                fuBenTongGuanData.DieCount     = 0;
                fuBenTongGuanData.DieScore     = 0;
                fuBenTongGuanData.MaxDieScore  = 0;
                fuBenTongGuanData.GoodsIDList  = goodsID;
                string strTitle;
                if (bFirstPass)
                {
                    strTitle = string.Format(GLang.GetLang(570, new object[0]), client.ClientData.WanMoTaNextLayerOrder + 1);
                }
                else
                {
                    strTitle = string.Format(GLang.GetLang(571, new object[0]), client.ClientData.WanMoTaNextLayerOrder + 1);
                }
                if (bFirstPass)
                {
                    fuBenTongGuanData.AwardExp     = fuBenMapItem.nFirstExp + fuBenMapItem.Experience;
                    fuBenTongGuanData.AwardJinBi   = fuBenMapItem.nFirstGold + fuBenMapItem.Money1;
                    fuBenTongGuanData.AwardXingHun = fuBenMapItem.nFirstXingHunAward + fuBenMapItem.nXingHunAward;
                }
                else
                {
                    fuBenTongGuanData.AwardExp     = fuBenMapItem.Experience;
                    fuBenTongGuanData.AwardJinBi   = fuBenMapItem.Money1;
                    fuBenTongGuanData.AwardXingHun = fuBenMapItem.nXingHunAward;
                }
                WanMotaCopySceneManager.AddRewardToClient(client, goodNormal, fuBenTongGuanData.AwardExp, fuBenTongGuanData.AwardJinBi, fuBenTongGuanData.AwardXingHun, strTitle);
                int nWanMoTaNextLayerOrder = GameManager.ClientMgr.GetWanMoTaPassLayerValue(client) + 1;
                GameManager.ClientMgr.SaveWanMoTaPassLayerValue(client, nWanMoTaNextLayerOrder, false);
                client.ClientData.WanMoTaNextLayerOrder = nWanMoTaNextLayerOrder;
                SingletonTemplate <WanMoTaTopLayerManager> .Instance().OnClientPass(client, nWanMoTaNextLayerOrder);

                GameManager.ClientMgr.NotifySelfParamsValueChange(client, RoleCommonUseIntParamsIndexs.WanMoTaCurrLayerOrder, 0);
                WanMoTaDBCommandManager.LayerChangeDBCommand(client, nWanMoTaNextLayerOrder);
                ProcessTask.ProcessRoleTaskVal(client, TaskTypes.WanMoTa, -1);
                result = fuBenTongGuanData;
            }
            return(result);
        }
        public static void SendMsgToClientForExperienceCopyMapAward(GameClient client)
        {
            CopyMap tmpCopyMap = ExperienceCopySceneManager.m_ExperienceListCopyMaps[client.ClientData.FuBenSeqID];

            if (tmpCopyMap != null)
            {
                int fuBenSeqID = FuBenManager.FindFuBenSeqIDByRoleID(client.ClientData.RoleID);
                FuBenTongGuanData fubenTongGuanData = null;
                if (fuBenSeqID > 0)
                {
                    FuBenInfoItem fuBenInfoItem = FuBenManager.FindFuBenInfoBySeqID(fuBenSeqID);
                    if (null != fuBenInfoItem)
                    {
                        fuBenInfoItem.EndTicks = TimeUtil.NOW();
                        int addFuBenNum = 1;
                        if (fuBenInfoItem.nDayOfYear != TimeUtil.NowDateTime().DayOfYear)
                        {
                            addFuBenNum = 0;
                        }
                        int fuBenID = FuBenManager.FindFuBenIDByMapCode(client.ClientData.MapCode);
                        if (fuBenID > 0)
                        {
                            int usedSecs = (int)((fuBenInfoItem.EndTicks - fuBenInfoItem.StartTicks) / 1000L);
                            Global.UpdateFuBenDataForQuickPassTimer(client, fuBenID, usedSecs, addFuBenNum);
                            FuBenMapItem fuBenMapItem = FuBenManager.FindMapCodeByFuBenID(fuBenID, client.ClientData.MapCode);
                            if (fuBenMapItem.Experience > 0 && fuBenMapItem.Money1 > 0)
                            {
                                int  nMaxTime     = fuBenMapItem.MaxTime * 60;
                                long startTicks   = fuBenInfoItem.StartTicks;
                                long endTicks     = fuBenInfoItem.EndTicks;
                                int  nFinishTimer = (int)(endTicks - startTicks) / 1000;
                                int  killedNum    = 0;
                                int  nDieCount    = fuBenInfoItem.nDieCount;
                                fubenTongGuanData = Global.GiveCopyMapGiftForScore(client, fuBenID, client.ClientData.MapCode, nMaxTime, nFinishTimer, killedNum, nDieCount, (int)((double)fuBenMapItem.Experience * fuBenInfoItem.AwardRate), (int)((double)fuBenMapItem.Money1 * fuBenInfoItem.AwardRate), fuBenMapItem, null);
                            }
                            GameManager.DBCmdMgr.AddDBCmd(10053, string.Format("{0}:{1}:{2}:{3}", new object[]
                            {
                                client.ClientData.RoleID,
                                Global.FormatRoleName(client, client.ClientData.RoleName),
                                fuBenID,
                                usedSecs
                            }), null, client.ServerId);
                            int           nLev            = -1;
                            SystemXmlItem systemFuBenItem = null;
                            if (!GameManager.systemFuBenMgr.SystemXmlItemDict.TryGetValue(fuBenID, out systemFuBenItem))
                            {
                                nLev = systemFuBenItem.GetIntValue("FuBenLevel", -1);
                            }
                            GameManager.ClientMgr.UpdateRoleDailyData_FuBenNum(client, 1, nLev, false);
                        }
                    }
                }
                if (fubenTongGuanData != null)
                {
                    TCPOutPacket tcpOutPacket = DataHelper.ObjectToTCPOutPacket <FuBenTongGuanData>(fubenTongGuanData, Global._TCPManager.TcpOutPacketPool, 521);
                    if (!Global._TCPManager.MySocketListener.SendData(client.ClientSocket, tcpOutPacket, true))
                    {
                    }
                }
            }
        }
Exemplo n.º 5
0
        /// <summary>
        // 经验副本奖励
        /// </summary>
        public static void SendMsgToClientForExperienceCopyMapAward(GameClient client)
        {
            CopyMap tmpCopyMap = null;

            tmpCopyMap = m_ExperienceListCopyMaps[client.ClientData.FuBenSeqID];

            if (tmpCopyMap == null)
            {
                return;
            }

            int fuBenSeqID = FuBenManager.FindFuBenSeqIDByRoleID(client.ClientData.RoleID);

            FuBenTongGuanData fubenTongGuanData = null;

            if (fuBenSeqID > 0) //如果副本不存在
            {
                FuBenInfoItem fuBenInfoItem = FuBenManager.FindFuBenInfoBySeqID(fuBenSeqID);
                if (null != fuBenInfoItem)
                {
                    fuBenInfoItem.EndTicks = DateTime.Now.Ticks / 10000;
                    int addFuBenNum = 1;
                    if (fuBenInfoItem.nDayOfYear != TimeUtil.NowDateTime().DayOfYear)
                    {
                        addFuBenNum = 0;
                    }

                    int fuBenID = FuBenManager.FindFuBenIDByMapCode(client.ClientData.MapCode);
                    if (fuBenID > 0)
                    {
                        int usedSecs = (int)((fuBenInfoItem.EndTicks - fuBenInfoItem.StartTicks) / 1000);

                        // 更新玩家通关时间信息
                        Global.UpdateFuBenDataForQuickPassTimer(client, fuBenID, usedSecs, addFuBenNum);

                        // 给玩家物品
                        FuBenMapItem fuBenMapItem = FuBenManager.FindMapCodeByFuBenID(fuBenID, client.ClientData.MapCode);

                        if (fuBenMapItem.Experience > 0 && fuBenMapItem.Money1 > 0)
                        {
                            int  nMaxTime     = fuBenMapItem.MaxTime * 60; //分->秒
                            long startTicks   = fuBenInfoItem.StartTicks;
                            long endTicks     = fuBenInfoItem.EndTicks;
                            int  nFinishTimer = (int)(endTicks - startTicks) / 1000; //毫秒->秒
                            int  killedNum    = 0;                                   // tmpCopyMap.KilledNormalNum + tmpCopyMap.KilledBossNum;
                            int  nDieCount    = fuBenInfoItem.nDieCount;

                            //向客户的发放通关奖励
                            fubenTongGuanData = Global.GiveCopyMapGiftForScore(client, fuBenID, nMaxTime, nFinishTimer, killedNum, nDieCount, fuBenMapItem.Experience, fuBenMapItem.Money1, fuBenMapItem);
                        }

                        GameManager.DBCmdMgr.AddDBCmd((int)TCPGameServerCmds.CMD_DB_ADDFUBENHISTDATA, string.Format("{0}:{1}:{2}:{3}", client.ClientData.RoleID,
                                                                                                                    Global.FormatRoleName(client, client.ClientData.RoleName), fuBenID, usedSecs), null);

                        int           nLev            = -1;
                        SystemXmlItem systemFuBenItem = null;
                        if (!GameManager.systemFuBenMgr.SystemXmlItemDict.TryGetValue(fuBenID, out systemFuBenItem))
                        {
                            nLev = systemFuBenItem.GetIntValue("FuBenLevel");
                        }

                        //更新每日的通关副本的数量
                        GameManager.ClientMgr.UpdateRoleDailyData_FuBenNum(client, 1, nLev, false);

                        //副本通关
                        //Global.BroadcastFuBenOk(client, usedSecs, fuBenID);
                    }
                }
            }

            if (fubenTongGuanData != null)
            {
                //发送奖励到客户端
                TCPOutPacket tcpOutPacket = DataHelper.ObjectToTCPOutPacket <FuBenTongGuanData>(fubenTongGuanData, Global._TCPManager.TcpOutPacketPool, (int)TCPGameServerCmds.CMD_SPR_FUBENPASSNOTIFY);

                if (!Global._TCPManager.MySocketListener.SendData(client.ClientSocket, tcpOutPacket))
                {
                    ;
                }
            }
        }
        /// <summary>
        // 万魔塔副本层奖励
        /// </summary>
        public static void SendMsgToClientForWanMoTaCopyMapAward(GameClient client, CopyMap copyMap, bool anyAlive)
        {
            CopyMap tmpCopyMap = copyMap;

            if (tmpCopyMap == null)
            {
                return;
            }

            int fuBenSeqID = FuBenManager.FindFuBenSeqIDByRoleID(client.ClientData.RoleID);

            FuBenTongGuanData fubenTongGuanData = null;

            bool bFirstPassWanMoTa = false;

            if (fuBenSeqID > 0) //如果副本不存在
            {
                FuBenInfoItem fuBenInfoItem = FuBenManager.FindFuBenInfoBySeqID(fuBenSeqID);
                if (null != fuBenInfoItem)
                {
                    fuBenInfoItem.EndTicks = DateTime.Now.Ticks / 10000;
                    int addFuBenNum = 1;
                    if (fuBenInfoItem.nDayOfYear != TimeUtil.NowDateTime().DayOfYear)
                    {
                        addFuBenNum = 0;
                    }

                    int fuBenID = FuBenManager.FindFuBenIDByMapCode(client.ClientData.MapCode);
                    if (fuBenID > 0)
                    {
                        if (WanMotaCopySceneManager.IsWanMoTaMapCode(client.ClientData.MapCode))
                        {
                            // 第一次通过万魔塔某层
                            if (!Global.FuBenPassed(client, fuBenID))
                            {
                                bFirstPassWanMoTa = true;
                            }
                        }

                        int usedSecs = (int)((fuBenInfoItem.EndTicks - fuBenInfoItem.StartTicks) / 1000);

                        // 更新玩家通关时间信息
                        Global.UpdateFuBenDataForQuickPassTimer(client, fuBenID, usedSecs, addFuBenNum);

                        // LogManager.WriteLog(LogTypes.Info, string.Format("万魔塔首次通关标记:{0}", bFirstPassWanMoTa));

                        // 给玩家物品
                        FuBenMapItem fuBenMapItem = FuBenManager.FindMapCodeByFuBenID(fuBenID, client.ClientData.MapCode);
                        fubenTongGuanData = GiveCopyMapGiftNoScore(client, fuBenMapItem, true);

                        GameManager.DBCmdMgr.AddDBCmd((int)TCPGameServerCmds.CMD_DB_ADDFUBENHISTDATA, string.Format("{0}:{1}:{2}:{3}", client.ClientData.RoleID,
                                                                                                                    Global.FormatRoleName(client, client.ClientData.RoleName), fuBenID, usedSecs), null);

                        // 万魔塔通关不计活跃 ChenXiaojun
                        //int nLev = -1;
                        //SystemXmlItem systemFuBenItem = null;
                        //if (!GameManager.systemFuBenMgr.SystemXmlItemDict.TryGetValue(fuBenID, out systemFuBenItem))
                        //{
                        //    nLev = systemFuBenItem.GetIntValue("FuBenLevel");
                        //}
                        //GameManager.ClientMgr.UpdateRoleDailyData_FuBenNum(client, 1, nLev);

                        //副本通关
                        //Global.BroadcastFuBenOk(client, usedSecs, fuBenID);
                    }
                }
            }

            GameManager.ClientMgr.NotifyAllFuBenBeginInfo(client, !anyAlive);
            if (fubenTongGuanData != null && bFirstPassWanMoTa)
            {
                //发送奖励到客户端
                TCPOutPacket tcpOutPacket = DataHelper.ObjectToTCPOutPacket <FuBenTongGuanData>(fubenTongGuanData, Global._TCPManager.TcpOutPacketPool, (int)TCPGameServerCmds.CMD_SPR_FUBENPASSNOTIFY);

                if (!Global._TCPManager.MySocketListener.SendData(client.ClientSocket, tcpOutPacket))
                {
                    ;
                }
            }
        }
        /// <summary>
        /// 给玩家副本的奖励 -- 无视评分
        /// </summary>
        /// <param name="client"></param>
        public static FuBenTongGuanData GiveCopyMapGiftNoScore(GameClient client, FuBenMapItem fuBenMapItem, bool bFirstPass)
        {
            if (null == fuBenMapItem)
            {
                return(null);
            }

            List <GoodsData> goodNormal = new List <GoodsData>();
            List <int>       goodsID    = new List <int>();

            // 获取副本的物品奖励
            GetFubenItemReward(client, fuBenMapItem, bFirstPass, goodNormal, goodsID);
            if (bFirstPass)
            {
                GetFubenItemReward(client, fuBenMapItem, false, goodNormal, goodsID);
            }

            FuBenTongGuanData fuBenTongGuanData = new FuBenTongGuanData();

            fuBenTongGuanData.FuBenID      = fuBenMapItem.FuBenID;
            fuBenTongGuanData.TotalScore   = 0;
            fuBenTongGuanData.KillNum      = 0;
            fuBenTongGuanData.KillScore    = 0;
            fuBenTongGuanData.MaxKillScore = 0;             //击杀数=最大击杀数
            fuBenTongGuanData.UsedSecs     = 0;
            fuBenTongGuanData.TimeScore    = 0;
            fuBenTongGuanData.MaxTimeScore = 0;
            fuBenTongGuanData.DieCount     = 0;
            fuBenTongGuanData.DieScore     = 0;
            fuBenTongGuanData.MaxDieScore  = 0;
            fuBenTongGuanData.GoodsIDList  = goodsID;

            string strTitle = "";

            if (bFirstPass)
            {
                strTitle = string.Format("万魔塔首次通关【{0}层】奖励", client.ClientData.WanMoTaNextLayerOrder);
            }
            else
            {
                strTitle = string.Format("万魔塔通关【{0}层】奖励", client.ClientData.WanMoTaNextLayerOrder);
            }

            // 金币、经验奖励
            if (bFirstPass)
            {
                // 首次通关
                fuBenTongGuanData.AwardExp     = fuBenMapItem.nFirstExp + fuBenMapItem.Experience;
                fuBenTongGuanData.AwardJinBi   = fuBenMapItem.nFirstGold + fuBenMapItem.Money1;
                fuBenTongGuanData.AwardXingHun = fuBenMapItem.nFirstXingHunAward;
            }
            else
            {
                fuBenTongGuanData.AwardExp     = fuBenMapItem.Experience;
                fuBenTongGuanData.AwardJinBi   = fuBenMapItem.Money1;
                fuBenTongGuanData.AwardXingHun = fuBenMapItem.nXingHunAward;
            }

            // 给奖励用专门的函数
            AddRewardToClient(client, goodNormal, fuBenTongGuanData.AwardExp, fuBenTongGuanData.AwardJinBi, fuBenTongGuanData.AwardXingHun, strTitle);

            // 保存万魔塔通关层数(角色参数)
            int nWanMoTaNextLayerOrder = GameManager.ClientMgr.GetWanMoTaPassLayerValue(client) + 1;

            GameManager.ClientMgr.SaveWanMoTaPassLayerValue(client, nWanMoTaNextLayerOrder);
            client.ClientData.WanMoTaNextLayerOrder = nWanMoTaNextLayerOrder;

            // 当用户首次通关30层开始,每通关10层万魔塔副本,显示游戏公告
            if (nWanMoTaNextLayerOrder >= 30 && nWanMoTaNextLayerOrder % 10 == 0)
            {
                // 玩家【用户名字】勇往直前,勇不可挡,通过了万魔塔第XX层!
                string broadCastMsg = StringUtil.substitute(Global.GetLang("玩家【{0}】勇往直前,勇不可挡,通过了万魔塔第{1}层!"),
                                                            Global.FormatRoleName(client, client.ClientData.RoleName), nWanMoTaNextLayerOrder);

                //播放用户行为消息
                Global.BroadcastRoleActionMsg(client, RoleActionsMsgTypes.HintMsg, broadCastMsg, true, GameInfoTypeIndexes.Hot, ShowGameInfoTypes.OnlySysHint);
            }

            // 当用户通关超过30层,成功成为万魔塔第一名的角色时,显示游戏公告
            if (nWanMoTaNextLayerOrder >= 30)
            {
                if ((nWanMoTaNextLayerOrder - 1) > GetWanMoTaDetailCmdProcessor.getInstance().WanMoTaTopLayer)
                {
                    string broadCastMsg = StringUtil.substitute(Global.GetLang("玩家【{0}】已势如破竹,雄霸万魔榜首!"),
                                                                Global.FormatRoleName(client, client.ClientData.RoleName));

                    //播放用户行为消息
                    Global.BroadcastRoleActionMsg(client, RoleActionsMsgTypes.HintMsg, broadCastMsg, true, GameInfoTypeIndexes.Hot, ShowGameInfoTypes.OnlySysHint);
                }
            }

            // 通知客户端万魔塔通关层数改变
            GameManager.ClientMgr.NotifySelfParamsValueChange(client, RoleCommonUseIntParamsIndexs.WanMoTaCurrLayerOrder, 0);

            // 保存万魔塔通关层数到万魔塔数据库表
            WanMoTaDBCommandManager.LayerChangeDBCommand(client, nWanMoTaNextLayerOrder);
            return(fuBenTongGuanData);
        }
Exemplo n.º 8
0
        public static bool ProcessFuBenMapAwards(GameClient client, bool notifyClient = false)
        {
            bool result;

            if (client.ClientData.FuBenSeqID < 0)
            {
                GameManager.ClientMgr.NotifyImportantMsg(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, client, StringUtil.substitute(GLang.GetLang(113, new object[0]), new object[0]), GameInfoTypeIndexes.Error, ShowGameInfoTypes.ErrAndBox, 0);
                result = false;
            }
            else
            {
                int awardState = GameManager.CopyMapMgr.FindAwardState(client.ClientData.RoleID, client.ClientData.FuBenSeqID, client.ClientData.MapCode);
                if (awardState > 0)
                {
                    GameManager.ClientMgr.NotifyImportantMsg(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, client, StringUtil.substitute(GLang.GetLang(21, new object[0]), new object[0]), GameInfoTypeIndexes.Error, ShowGameInfoTypes.ErrAndBox, 0);
                    result = false;
                }
                else
                {
                    int fuBenID = FuBenManager.FindFuBenIDByMapCode(client.ClientData.MapCode);
                    if (fuBenID <= 0)
                    {
                        GameManager.ClientMgr.NotifyImportantMsg(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, client, StringUtil.substitute(GLang.GetLang(114, new object[0]), new object[0]), GameInfoTypeIndexes.Error, ShowGameInfoTypes.ErrAndBox, 0);
                        result = false;
                    }
                    else
                    {
                        FuBenInfoItem fuBenInfoItem = FuBenManager.FindFuBenInfoBySeqID(client.ClientData.FuBenSeqID);
                        if (null == fuBenInfoItem)
                        {
                            GameManager.ClientMgr.NotifyImportantMsg(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, client, StringUtil.substitute(GLang.GetLang(115, new object[0]), new object[0]), GameInfoTypeIndexes.Error, ShowGameInfoTypes.ErrAndBox, 0);
                            result = false;
                        }
                        else if (fuBenID != fuBenInfoItem.FuBenID)
                        {
                            GameManager.ClientMgr.NotifyImportantMsg(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, client, StringUtil.substitute(GLang.GetLang(116, new object[0]), new object[0]), GameInfoTypeIndexes.Error, ShowGameInfoTypes.ErrAndBox, 0);
                            result = false;
                        }
                        else
                        {
                            FuBenMapItem fuBenMapItem = FuBenManager.FindMapCodeByFuBenID(fuBenID, client.ClientData.MapCode);
                            if (null == fuBenMapItem)
                            {
                                GameManager.ClientMgr.NotifyImportantMsg(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, client, StringUtil.substitute(GLang.GetLang(117, new object[0]), new object[0]), GameInfoTypeIndexes.Error, ShowGameInfoTypes.ErrAndBox, 0);
                                result = false;
                            }
                            else
                            {
                                CopyMap copyMap = GameManager.CopyMapMgr.FindCopyMap(client.ClientData.MapCode);
                                if (copyMap == null)
                                {
                                    GameManager.ClientMgr.NotifyImportantMsg(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, client, StringUtil.substitute(GLang.GetLang(118, new object[0]), new object[0]), GameInfoTypeIndexes.Error, ShowGameInfoTypes.ErrAndBox, 0);
                                    result = false;
                                }
                                else
                                {
                                    GameManager.CopyMapMgr.AddAwardState(client.ClientData.RoleID, client.ClientData.FuBenSeqID, client.ClientData.MapCode, 1);
                                    int  nMaxTime     = fuBenMapItem.MaxTime * 60;
                                    long startTicks   = fuBenInfoItem.StartTicks;
                                    long endTicks     = fuBenInfoItem.EndTicks;
                                    int  nFinishTimer = (int)(endTicks - startTicks) / 1000;
                                    int  killedNum    = 0;
                                    int  nDieCount    = fuBenInfoItem.nDieCount;
                                    FuBenTongGuanData fubenTongGuanData = Global.GiveCopyMapGiftForScore(client, fuBenID, client.ClientData.MapCode, nMaxTime, nFinishTimer, killedNum, nDieCount, (int)((double)fuBenMapItem.Experience * fuBenInfoItem.AwardRate), (int)((double)fuBenMapItem.Money1 * fuBenInfoItem.AwardRate), fuBenMapItem, null);
                                    if (fubenTongGuanData != null)
                                    {
                                        TCPOutPacket tcpOutPacket = DataHelper.ObjectToTCPOutPacket <FuBenTongGuanData>(fubenTongGuanData, Global._TCPManager.TcpOutPacketPool, 521);
                                        if (!Global._TCPManager.MySocketListener.SendData(client.ClientSocket, tcpOutPacket, true))
                                        {
                                        }
                                    }
                                    Global.AddFuBenAwardEvent(client, fuBenID);
                                    result = true;
                                }
                            }
                        }
                    }
                }
            }
            return(result);
        }