コード例 #1
0
        public static void GetWanmotaSweepReward(GameClient client, int nFubenID)
        {
            FuBenMapItem fuBenMapItem = FuBenManager.FindMapCodeByFuBenID(nFubenID, nFubenID);

            if (null != fuBenMapItem)
            {
                List <GoodsData> goodNormal = new List <GoodsData>();
                List <int>       goodsID    = new List <int>();
                WanMotaCopySceneManager.GetFubenItemReward(client, fuBenMapItem, false, goodNormal, goodsID);
                if (null == client.ClientData.LayerRewardData)
                {
                    client.ClientData.LayerRewardData = new LayerRewardData();
                }
                if (WanMotaCopySceneManager.IsWanMoTaMapCode(nFubenID))
                {
                    List <SingleLayerRewardData> listRewardData = null;
                    SingleLayerRewardData        layerReward    = WanMotaCopySceneManager.AddSingleSweepReward(client, goodNormal, nFubenID - WanMotaCopySceneManager.nWanMoTaFirstFuBenOrder + 1, fuBenMapItem.Experience, fuBenMapItem.Money1, fuBenMapItem.nXingHunAward, out listRewardData);
                    SweepWanMotaManager.UpdataSweepInfo(client, listRewardData);
                    lock (client.ClientData.LayerRewardData)
                    {
                        client.ClientData.LayerRewardData.WanMoTaLayerRewardList.Add(layerReward);
                    }
                }
            }
        }
コード例 #2
0
 public static void GetFubenItemReward(GameClient client, FuBenMapItem fuBenMapItem, bool bFirstPass, List <GoodsData> goodNormal, List <int> GoodsIDList)
 {
     if (bFirstPass)
     {
         if (null != fuBenMapItem.FirstGoodsDataList)
         {
             for (int i = 0; i < fuBenMapItem.FirstGoodsDataList.Count; i++)
             {
                 goodNormal.Add(fuBenMapItem.FirstGoodsDataList[i]);
                 GoodsIDList.Add(fuBenMapItem.FirstGoodsDataList[i].GoodsID);
             }
         }
     }
     else
     {
         if (null != fuBenMapItem.GoodsDataList)
         {
             for (int i = 0; i < fuBenMapItem.GoodsDataList.Count; i++)
             {
                 goodNormal.Add(new GoodsData(fuBenMapItem.GoodsDataList[i]));
                 GoodsIDList.Add(fuBenMapItem.GoodsDataList[i].GoodsID);
             }
         }
         WanMotaCopySceneManager.GetBossReward(client, fuBenMapItem.FuBenID, goodNormal, GoodsIDList);
     }
 }
コード例 #3
0
ファイル: SweepWanmota.cs プロジェクト: qiuhoude/mu_server
 private void Sweeping(object source, ElapsedEventArgs e)
 {
     lock (this.sweepClient)
     {
         WanMotaCopySceneManager.GetWanmotaSweepReward(this.sweepClient, WanMotaCopySceneManager.nWanMoTaFirstFuBenOrder + this.nSweepingOrder - 1);
         this.nSweepingOrder++;
         if (this.nSweepingOrder > this.nSweepingMaxOrder)
         {
             this.StopSweeping();
             List <SingleLayerRewardData> listRewardData         = SweepWanMotaManager.SummarySweepRewardInfo(this.sweepClient);
             List <SingleLayerRewardData> WanMoTaLayerRewardList = this.sweepClient.ClientData.LayerRewardData.WanMoTaLayerRewardList;
             this.sweepClient.ClientData.LayerRewardData.WanMoTaLayerRewardList = listRewardData;
             if (-1 == WanMoTaDBCommandManager.UpdateSweepAwardDBCommand(this.sweepClient, 0))
             {
                 LogManager.WriteLog(LogTypes.Error, "扫荡奖励汇总后,写到数据库失败", null, true);
                 this.sweepClient.ClientData.LayerRewardData.WanMoTaLayerRewardList = WanMoTaLayerRewardList;
             }
             else
             {
                 this.sweepClient.ClientData.WanMoTaProp.nSweepLayer = 0;
                 SweepWanMotaManager.UpdataSweepInfo(this.sweepClient, listRewardData);
             }
         }
         else
         {
             this.sweepClient.ClientData.WanMoTaProp.nSweepLayer = this.nSweepingOrder;
             WanMoTaDBCommandManager.UpdateSweepAwardDBCommand(this.sweepClient, this.sweepClient.ClientData.WanMoTaProp.nSweepLayer);
         }
     }
 }
コード例 #4
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))
             {
             }
         }
     }
 }
コード例 #5
0
        public static WanMotaInfo GetWanMoTaDetail(GameClient client, bool bIsLogin)
        {
            WanMotaInfo dataWanMoTa = null;

            if (1 == WanMotaCopySceneManager.WanmotaIsSweeping(client))
            {
                dataWanMoTa = Global.sendToDB <WanMotaInfo, byte[]>(10159, DataHelper.ObjectToBytes <int>(client.ClientData.RoleID), client.ServerId);
                client.ClientData.WanMoTaProp = dataWanMoTa;
            }
            else
            {
                dataWanMoTa = client.ClientData.WanMoTaProp;
            }
            if (null != dataWanMoTa)
            {
                if (bIsLogin)
                {
                    if (null != client.ClientData.WanMoTaProp)
                    {
                        byte[] bytes = Convert.FromBase64String(client.ClientData.WanMoTaProp.strSweepReward);
                        client.ClientData.LayerRewardData = DataHelper.BytesToObject <LayerRewardData>(bytes, 0, bytes.Length);
                    }
                }
                else if (null != client.ClientData.LayerRewardData)
                {
                    lock (client.ClientData.LayerRewardData)
                    {
                        if (client.ClientData.LayerRewardData.WanMoTaLayerRewardList.Count > 0)
                        {
                            int nBeginIndex = 0;
                            if (client.ClientData.LayerRewardData.WanMoTaLayerRewardList.Count > 10)
                            {
                                nBeginIndex = client.ClientData.LayerRewardData.WanMoTaLayerRewardList.Count - 10;
                            }
                            List <SingleLayerRewardData> listRewardData = new List <SingleLayerRewardData>();
                            for (int i = nBeginIndex; i < client.ClientData.LayerRewardData.WanMoTaLayerRewardList.Count; i++)
                            {
                                listRewardData.Add(client.ClientData.LayerRewardData.WanMoTaLayerRewardList[i]);
                            }
                            SweepWanMotaManager.UpdataSweepInfo(client, listRewardData);
                        }
                    }
                }
            }
            return(dataWanMoTa);
        }
コード例 #6
0
ファイル: SweepWanmota.cs プロジェクト: chenchungit/ky
        /// <summary>
        /// 每2秒扫荡一层万魔塔
        /// </summary>
        private void Sweeping(object source, ElapsedEventArgs e)
        {
            lock (sweepClient)
            {
                WanMotaCopySceneManager.GetWanmotaSweepReward(sweepClient, WanMotaCopySceneManager.nWanMoTaFirstFuBenOrder + nSweepingOrder - 1);
                nSweepingOrder++;

                if (nSweepingOrder > nSweepingMaxOrder)
                {
                    // 扫荡完成
                    StopSweeping();

                    // 将奖励汇总
                    List <SingleLayerRewardData> listRewardData         = SweepWanMotaManager.SummarySweepRewardInfo(sweepClient);
                    List <SingleLayerRewardData> WanMoTaLayerRewardList = sweepClient.ClientData.LayerRewardData.WanMoTaLayerRewardList;

                    // 汇总后用汇总奖励代替各层奖励
                    sweepClient.ClientData.LayerRewardData.WanMoTaLayerRewardList = listRewardData;

                    // 如果更新失败,还原
                    if (-1 == WanMoTaDBCommandManager.UpdateSweepAwardDBCommand(sweepClient, 0))
                    {
                        // 扫荡奖励汇总后,写到数据库失败
                        LogManager.WriteLog(LogTypes.Error, "扫荡奖励汇总后,写到数据库失败");

                        sweepClient.ClientData.LayerRewardData.WanMoTaLayerRewardList = WanMoTaLayerRewardList;
                    }
                    // 成功,发送到客户端
                    else
                    {
                        sweepClient.ClientData.WanMoTaProp.nSweepLayer = 0;
                        SweepWanMotaManager.UpdataSweepInfo(sweepClient, listRewardData);
                        WanMoTaLayerRewardList = null;
                    }
                }
                else
                {
                    sweepClient.ClientData.WanMoTaProp.nSweepLayer = nSweepingOrder;
                    WanMoTaDBCommandManager.UpdateSweepAwardDBCommand(sweepClient, sweepClient.ClientData.WanMoTaProp.nSweepLayer);
                }
            }
        }
コード例 #7
0
        /// <summary>
        /// 汇总扫荡奖励
        /// </summary>
        public static List <SingleLayerRewardData> SummarySweepRewardInfo(GameClient client)
        {
            List <SingleLayerRewardData> listRewardData = null;

            if (null == client.ClientData.LayerRewardData || client.ClientData.LayerRewardData.WanMoTaLayerRewardList.Count < 1)
            {
                return(listRewardData);
            }

            int nExp    = 0;
            int nMoney  = 0;
            int nXinHun = 0;
            List <GoodsData> rewardList = new List <GoodsData>();

            lock (client.ClientData.LayerRewardData)
            {
                // 将各层的奖励汇总
                for (int i = 0; i < client.ClientData.LayerRewardData.WanMoTaLayerRewardList.Count; i++)
                {
                    nExp    += client.ClientData.LayerRewardData.WanMoTaLayerRewardList[i].nExp;
                    nMoney  += client.ClientData.LayerRewardData.WanMoTaLayerRewardList[i].nMoney;
                    nXinHun += client.ClientData.LayerRewardData.WanMoTaLayerRewardList[i].nXinHun;

                    if (null != client.ClientData.LayerRewardData.WanMoTaLayerRewardList[i].sweepAwardGoodsList)
                    {
                        for (int j = 0; j < client.ClientData.LayerRewardData.WanMoTaLayerRewardList[i].sweepAwardGoodsList.Count; j++)
                        {
                            CombineGoodList(rewardList, client.ClientData.LayerRewardData.WanMoTaLayerRewardList[i].sweepAwardGoodsList[j]);
                        }
                    }
                }

                SingleLayerRewardData layerReward = WanMotaCopySceneManager.AddSingleSweepReward(client, rewardList, 0,
                                                                                                 nExp, nMoney, nXinHun, out listRewardData);
            }

            return(listRewardData);
        }
コード例 #8
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);
        }
コード例 #9
0
        /// <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))
                {
                    ;
                }
            }
        }