Пример #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))
             {
             }
         }
     }
 }
        /// <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))
                {
                    ;
                }
            }
        }