Exemplo n.º 1
0
        public static bool CanAutoGetFuBenMapAwards(GameClient client)
        {
            int  fuBenID = FuBenManager.FindFuBenIDByMapCode(client.ClientData.MapCode);
            bool result;

            if (fuBenID <= 0)
            {
                result = false;
            }
            else if (client.ClientData.FuBenSeqID <= 0)
            {
                result = false;
            }
            else
            {
                FuBenInfoItem fuBenInfoItem = FuBenManager.FindFuBenInfoBySeqID(client.ClientData.FuBenSeqID);
                if (null == fuBenInfoItem)
                {
                    result = false;
                }
                else if (fuBenID != fuBenInfoItem.FuBenID)
                {
                    result = false;
                }
                else
                {
                    FuBenMapItem fuBenMapItem = FuBenManager.FindMapCodeByFuBenID(fuBenID, client.ClientData.MapCode);
                    if (null == fuBenMapItem)
                    {
                        result = false;
                    }
                    else
                    {
                        if (fuBenMapItem.GoodsDataList == null || fuBenMapItem.GoodsDataList.Count <= 0)
                        {
                            if (fuBenMapItem.Experience <= 0)
                            {
                                if (fuBenMapItem.Money1 <= 0)
                                {
                                    return(false);
                                }
                            }
                        }
                        result = (fuBenMapItem.GoodsDataList == null || fuBenMapItem.GoodsDataList.Count <= 0);
                    }
                }
            }
            return(result);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 给奖励
        /// </summary>
        public void GiveAwards(ElementWarScene scene)
        {
            try
            {
                FuBenMapItem fuBenMapItem = FuBenManager.FindMapCodeByFuBenID(scene.CopyMapInfo.FubenMapID, scene.MapID);
                if (fuBenMapItem == null)
                {
                    return;
                }

                //FuBenInfoItem fuBenInfoItem = FuBenManager.FindFuBenInfoBySeqID(scene.FuBenSeqId);
                //if (null == fuBenInfoItem) return;

                //fuBenInfoItem.EndTicks = TimeUtil.NOW();
                //int addFuBenNum = 1;
                //if (fuBenInfoItem.nDayOfYear != TimeUtil.NowDateTime().DayOfYear)
                //    addFuBenNum = 0;

                //int usedSecs = (int)(scene.EndTime - scene.BeginTime);

                int zhanLi = 0;
                List <GameClient> objsList = scene.CopyMapInfo.GetClientsList();
                if (objsList != null && objsList.Count > 0)
                {
                    for (int n = 0; n < objsList.Count; ++n)
                    {
                        GameClient client = objsList[n];
                        if (client != null && client == GameManager.ClientMgr.FindClient(client.ClientData.RoleID)) //确认角色仍然在线
                        {
                            // 公式
                            long nExp  = fuBenMapItem.Experience;
                            int  money = fuBenMapItem.Money1;

                            int wave = scene.MonsterWaveOld;
                            if (wave > 0)
                            {
                                wave -= 1;
                            }
                            int light = fuBenMapItem.LightAward + _runtimeData.AwardLight[wave];

                            if (nExp > 0)
                            {
                                GameManager.ClientMgr.ProcessRoleExperience(client, nExp, false);
                            }

                            if (money > 0)
                            {
                                GameManager.ClientMgr.AddMoney1(Global._TCPManager.MySocketListener, Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool, client, money, string.Format(/**/ "副本{0}通关奖励", scene.CopyID), false);
                            }

                            if (light > 0)
                            {
                                GameManager.FluorescentGemMgr.AddFluorescentPoint(client, light, "元素试炼");
                            }


                            ElementWarAwardsData awardsData = new ElementWarAwardsData()
                            {
                                Wave  = scene.MonsterWaveOld,
                                Exp   = nExp,
                                Money = money,
                                Light = light
                            };

                            AddElementWarCount(client);
                            GlobalNew.UpdateKuaFuRoleDayLogData(client.ServerId, client.ClientData.RoleID, TimeUtil.NowDateTime(), client.ClientData.ZoneID, 0, 0, 1, 0, (int)_gameType);

                            client.sendCmd((int)TCPGameServerCmds.CMD_SPR_ELEMENT_WAR_AWARD, awardsData);


                            zhanLi += client.ClientData.CombatForce;

                            Global.UpdateFuBenDataForQuickPassTimer(client, scene.CopyMapInfo.FubenMapID, 0, 1);
                        }
                    }
                }

                int roleCount = 0;
                if (objsList != null && objsList.Count > 0)
                {
                    roleCount = objsList.Count;
                    zhanLi    = zhanLi / roleCount;
                }

                // ElementWarClient.getInstance().UpdateCopyPassEvent(scene.FuBenSeqId, roleCount, scene.MonsterWaveOld, zhanLi);
            }
            catch (System.Exception ex)
            {
                DataHelper.WriteExceptionLogEx(ex, "【元素试炼】清场调度异常");
            }
        }
Exemplo n.º 3
0
 public void GiveAwards(ElementWarScene scene)
 {
     try
     {
         FuBenMapItem fuBenMapItem = FuBenManager.FindMapCodeByFuBenID(scene.CopyMapInfo.FubenMapID, scene.MapID);
         if (fuBenMapItem != null)
         {
             int zhanLi = 0;
             List <GameClient> objsList = scene.CopyMapInfo.GetClientsList();
             if (objsList != null && objsList.Count > 0)
             {
                 for (int i = 0; i < objsList.Count; i++)
                 {
                     GameClient client = objsList[i];
                     if (client != null && client == GameManager.ClientMgr.FindClient(client.ClientData.RoleID))
                     {
                         long nExp  = (long)fuBenMapItem.Experience;
                         int  money = fuBenMapItem.Money1;
                         int  wave  = scene.MonsterWaveOld;
                         int  light = fuBenMapItem.LightAward + this._runtimeData.AwardLight[wave];
                         int  ysfm  = fuBenMapItem.YuanSuFenMoaward + this._runtimeData.YuanSuShiLianAward2[wave];
                         if (nExp > 0L)
                         {
                             GameManager.ClientMgr.ProcessRoleExperience(client, nExp, false, true, false, "none");
                         }
                         if (money > 0)
                         {
                             GameManager.ClientMgr.AddMoney1(Global._TCPManager.MySocketListener, Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool, client, money, string.Format("副本{0}通关奖励", scene.CopyID), false);
                         }
                         if (light > 0)
                         {
                             GameManager.FluorescentGemMgr.AddFluorescentPoint(client, light, "元素试炼", true);
                         }
                         if (ysfm > 0)
                         {
                             GameManager.ClientMgr.ModifyYuanSuFenMoValue(client, ysfm, "元素试炼", true, false);
                         }
                         ElementWarAwardsData awardsData = new ElementWarAwardsData
                         {
                             Wave  = scene.MonsterWaveOld,
                             Exp   = nExp,
                             Money = money,
                             Light = light,
                             ysfm  = ysfm
                         };
                         this.AddElementWarCount(client);
                         GlobalNew.UpdateKuaFuRoleDayLogData(client.ServerId, client.ClientData.RoleID, TimeUtil.NowDateTime(), client.ClientData.ZoneID, 0, 0, 1, 0, 4);
                         client.sendCmd <ElementWarAwardsData>(1015, awardsData, false);
                         zhanLi += client.ClientData.CombatForce;
                         Global.UpdateFuBenDataForQuickPassTimer(client, scene.CopyMapInfo.FubenMapID, 0, 1);
                     }
                 }
             }
             if (objsList != null && objsList.Count > 0)
             {
                 int roleCount = objsList.Count;
                 zhanLi /= roleCount;
             }
         }
     }
     catch (Exception ex)
     {
         DataHelper.WriteExceptionLogEx(ex, "【元素试炼】清场调度异常");
     }
 }
Exemplo n.º 4
0
        /// <summary>
        /// 给奖励
        /// </summary>
        public void GiveAwards(CopyWolfSceneInfo scene, int leftSecond)
        {
            try
            {
                FuBenMapItem fuBenMapItem = FuBenManager.FindMapCodeByFuBenID(scene.CopyMapInfo.FubenMapID, scene.MapID);
                if (fuBenMapItem == null)
                {
                    return;
                }

                int zhanLi = 0;
                List <GameClient> objsList = scene.CopyMapInfo.GetClientsList();
                if (objsList != null && objsList.Count > 0)
                {
                    for (int n = 0; n < objsList.Count; ++n)
                    {
                        GameClient client = objsList[n];
                        if (client != null && client == GameManager.ClientMgr.FindClient(client.ClientData.RoleID)) //确认角色仍然在线
                        {
                            int wave = scene.MonsterWaveOld;
                            if (wave > scene.MonsterWaveTotal)
                            {
                                wave = scene.MonsterWaveTotal;
                            }

                            int scoreMonster = scene.GetMonsterScore(client.ClientData.RoleID);
                            int life         = scene.ScoreData.FortLifeNow;
                            int scoreAll     = GetScore(scoreMonster, leftSecond, life);

                            // 公式
                            long nExp      = AwardExp(fuBenMapItem.Experience, scoreAll);
                            int  money     = AwardGoldBind(fuBenMapItem.Money1, scoreAll);
                            int  wolfMoney = AwardWolfMoney(fuBenMapItem.WolfMoney, scoreAll);

                            if (nExp > 0)
                            {
                                GameManager.ClientMgr.ProcessRoleExperience(client, nExp, false);
                            }

                            if (money > 0)
                            {
                                GameManager.ClientMgr.AddMoney1(Global._TCPManager.MySocketListener, Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool, client, money, string.Format("副本{0}通关奖励", scene.CopyID), false);
                            }

                            if (wolfMoney > 0)
                            {
                                GameManager.ClientMgr.ModifyLangHunFenMoValue(client, wolfMoney, "狼魂要塞", true);
                            }

                            CopyWolfAwardsData awardsData = new CopyWolfAwardsData()
                            {
                                Wave      = scene.MonsterWaveOld,
                                Exp       = nExp,
                                Money     = money,
                                WolfMoney = wolfMoney,
                                RoleScore = scene.GetMonsterScore(client.ClientData.RoleID)
                            };

                            //AddElementWarCount(client);
                            GlobalNew.UpdateKuaFuRoleDayLogData(client.ServerId, client.ClientData.RoleID, TimeUtil.NowDateTime(), client.ClientData.ZoneID, 0, 0, 1, 0, (int)_gameType);

                            client.sendCmd((int)TCPGameServerCmds.CMD_SPR_COPY_WOLF_AWARD, awardsData);

                            zhanLi += client.ClientData.CombatForce;
                            Global.UpdateFuBenDataForQuickPassTimer(client, scene.CopyMapInfo.FubenMapID, 0, 1);
                        }
                    }
                }

                int roleCount = 0;
                if (objsList != null && objsList.Count > 0)
                {
                    roleCount = objsList.Count;
                    zhanLi    = zhanLi / roleCount;
                }

                // ElementWarClient.getInstance().UpdateCopyPassEvent(scene.FuBenSeqId, roleCount, scene.MonsterWaveOld, zhanLi);
            }
            catch (System.Exception ex)
            {
                DataHelper.WriteExceptionLogEx(ex, "【狼魂要塞】清场调度异常");
            }
        }
Exemplo n.º 5
0
 public void GiveAwards(CopyWolfSceneInfo scene, int leftSecond)
 {
     try
     {
         FuBenMapItem fuBenMapItem = FuBenManager.FindMapCodeByFuBenID(scene.CopyMapInfo.FubenMapID, scene.MapID);
         if (fuBenMapItem != null)
         {
             int zhanLi = 0;
             List <GameClient> objsList = scene.CopyMapInfo.GetClientsList();
             if (objsList != null && objsList.Count > 0)
             {
                 for (int i = 0; i < objsList.Count; i++)
                 {
                     GameClient client = objsList[i];
                     if (client != null && client == GameManager.ClientMgr.FindClient(client.ClientData.RoleID))
                     {
                         int wave = scene.MonsterWaveOld;
                         if (wave > scene.MonsterWaveTotal)
                         {
                             wave = scene.MonsterWaveTotal;
                         }
                         int  scoreMonster = scene.GetMonsterScore(client.ClientData.RoleID);
                         int  life         = scene.ScoreData.FortLifeNow;
                         int  scoreAll     = this.GetScore(scoreMonster, leftSecond, life);
                         long nExp         = (long)this.AwardExp(fuBenMapItem.Experience, scoreAll);
                         int  money        = this.AwardGoldBind(fuBenMapItem.Money1, scoreAll);
                         int  wolfMoney    = this.AwardWolfMoney(fuBenMapItem.WolfMoney, scoreAll);
                         if (nExp > 0L)
                         {
                             GameManager.ClientMgr.ProcessRoleExperience(client, nExp, false, true, false, "none");
                         }
                         if (money > 0)
                         {
                             GameManager.ClientMgr.AddMoney1(Global._TCPManager.MySocketListener, Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool, client, money, string.Format("副本{0}通关奖励", scene.CopyID), false);
                         }
                         if (wolfMoney > 0)
                         {
                             GameManager.ClientMgr.ModifyLangHunFenMoValue(client, wolfMoney, "狼魂要塞", true, true);
                         }
                         CopyWolfAwardsData awardsData = new CopyWolfAwardsData
                         {
                             Wave      = scene.MonsterWaveOld,
                             Exp       = nExp,
                             Money     = money,
                             WolfMoney = wolfMoney,
                             RoleScore = scene.GetMonsterScore(client.ClientData.RoleID)
                         };
                         GlobalNew.UpdateKuaFuRoleDayLogData(client.ServerId, client.ClientData.RoleID, TimeUtil.NowDateTime(), client.ClientData.ZoneID, 0, 0, 1, 0, 11);
                         client.sendCmd <CopyWolfAwardsData>(1026, awardsData, false);
                         zhanLi += client.ClientData.CombatForce;
                         Global.UpdateFuBenDataForQuickPassTimer(client, scene.CopyMapInfo.FubenMapID, 0, 1);
                     }
                 }
             }
             if (objsList != null && objsList.Count > 0)
             {
                 int roleCount = objsList.Count;
                 zhanLi /= roleCount;
             }
         }
     }
     catch (Exception ex)
     {
         DataHelper.WriteExceptionLogEx(ex, "【狼魂要塞】清场调度异常");
     }
 }
Exemplo n.º 6
0
 public static bool IsLuoLanFaZhenMap(int mapcode)
 {
     return(null != FuBenManager.FindMapCodeByFuBenID(LuoLanFaZhenCopySceneManager.LuoLanFaZhenFubenID, mapcode));
 }
        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.º 8
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))
                {
                    ;
                }
            }
        }
Exemplo n.º 9
0
 public void GiveAwards(WanMoXiaGuScene scene)
 {
     try
     {
         FuBenMapItem fuBenMapItem = FuBenManager.FindMapCodeByFuBenID(scene.CopyMapInfo.FubenMapID, scene.MapID);
         if (fuBenMapItem != null)
         {
             int usedSecs = (int)(scene.EndTime - scene.BeginTime);
             int zhanLi   = 0;
             List <GameClient> objsList = scene.CopyMapInfo.GetClientsList().Distinct <GameClient>().ToList <GameClient>();
             if (objsList != null && objsList.Count > 0)
             {
                 for (int i = 0; i < objsList.Count; i++)
                 {
                     GameClient client = objsList[i];
                     if (client != null && client == GameManager.ClientMgr.FindClient(client.ClientData.RoleID))
                     {
                         zhanLi += client.ClientData.CombatForce;
                         long nExp  = (long)fuBenMapItem.Experience;
                         int  money = fuBenMapItem.Money1;
                         int  idx   = this.RuntimeData.AwardList.Count - 1;
                         int  mul   = this.RuntimeData.AwardList[idx][1];
                         for (int j = 0; j <= idx; j++)
                         {
                             if (usedSecs <= this.RuntimeData.AwardList[j][0])
                             {
                                 mul = this.RuntimeData.AwardList[j][1];
                                 break;
                             }
                         }
                         if (nExp > 0L)
                         {
                             GameManager.ClientMgr.ProcessRoleExperience(client, nExp, false, true, false, "万魔峡谷通关奖励");
                         }
                         if (money > 0)
                         {
                             GameManager.ClientMgr.AddMoney1(Global._TCPManager.MySocketListener, Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool, client, money, "万魔峡谷通关奖励", true);
                         }
                         List <GoodsData> goodsList = new List <GoodsData>();
                         if (null != fuBenMapItem.GoodsDataList)
                         {
                             for (int k = 0; k < fuBenMapItem.GoodsDataList.Count; k++)
                             {
                                 GoodsData goodsData = new GoodsData(fuBenMapItem.GoodsDataList[k]);
                                 goodsData.GCount *= mul;
                                 goodsList.Add(goodsData);
                             }
                         }
                         if (goodsList.Count > 0)
                         {
                             if (Global.CanAddGoodsDataList(client, goodsList))
                             {
                                 foreach (GoodsData goodsData in goodsList)
                                 {
                                     GoodsUtil.AddGoodsDBCommand(client, goodsData, true, 1, "万魔峡谷通关奖励", true);
                                 }
                             }
                             else
                             {
                                 Global.UseMailGivePlayerAward2(client, goodsList, GLang.GetLang(4000, new object[0]), GLang.GetLang(4001, new object[0]), 0, 0, 0);
                             }
                         }
                         WanMoXiaGuAwardsData awardsData = new WanMoXiaGuAwardsData
                         {
                             Success     = scene.Success,
                             UsedSecs    = usedSecs,
                             Exp         = nExp,
                             Money       = money,
                             AwardsGoods = goodsList
                         };
                         client.sendCmd <WanMoXiaGuAwardsData>(1267, awardsData, false);
                         Global.UpdateFuBenDataForQuickPassTimer(client, scene.CopyMapInfo.FubenMapID, 0, 1);
                     }
                 }
             }
             if (objsList != null && objsList.Count > 0)
             {
                 int roleCount = objsList.Count;
                 zhanLi /= roleCount;
             }
         }
     }
     catch (Exception ex)
     {
         DataHelper.WriteExceptionLogEx(ex, "【万魔峡谷】清场调度异常");
     }
 }
Exemplo n.º 10
0
        /// <summary>
        /// 检查死亡的怪物是否为帮会副本boss并进行通关处理
        /// </summary>
        public void ProcessMonsterDead(GameClient client, Monster monster)
        {
            // 怪物所在场景不是帮会地图
            if (IsGuildCopyMap(monster.CurrentMapCode) == false)
            {
                return;
            }

            SystemXmlItem systemFuBenItem = null;

            if (!GameManager.systemFuBenMgr.SystemXmlItemDict.TryGetValue(monster.CurrentMapCode, out systemFuBenItem))
            {
                return;
            }

            if (null == systemFuBenItem)
            {
                return;
            }

            int nBossID = systemFuBenItem.GetIntValue("BossID");

            // 不是boss
            if (nBossID != monster.MonsterInfo.ExtensionID)
            {
                return;
            }

            // 玩家没有帮会?
            GuildCopyMapDB data = GameManager.GuildCopyMapDBMgr.FindGuildCopyMapDB(client.ClientData.Faction);

            if (null == data)
            {
                LogManager.WriteLog(LogTypes.Error, string.Format("GuildCopyMapManager::ProcessMonsterDead (null == data), guildid={0}", client.ClientData.Faction));
                return;
            }

            // 没有对应副本?
            CopyMap copyMap = GameManager.CopyMapMgr.FindCopyMap(monster.CurrentCopyMapID);

            if (null == copyMap)
            {
                LogManager.WriteLog(LogTypes.Error, string.Format("GuildCopyMapManager::ProcessMonsterDead (null == copyMap), CurrentCopyMapID={0}", monster.CurrentCopyMapID));
                return;
            }

            // 没有奖励配置?
            FuBenMapItem fuBenMapItem = FuBenManager.FindMapCodeByFuBenID(copyMap.FubenMapID, copyMap.MapCode);

            if (null == fuBenMapItem)
            {
                LogManager.WriteLog(LogTypes.Error, string.Format("GuildCopyMapManager::ProcessMonsterDead (null == fuBenMapItem), CopyMapID={0}, MapCode={1}", copyMap.FubenMapID, copyMap.MapCode));
                return;
            }

            List <GameClient> objsList = copyMap.GetClientsList();

            // 副本里没人?
            if (null == objsList || objsList.Count <= 0)
            {
                LogManager.WriteLog(LogTypes.Error, string.Format("GuildCopyMapManager::ProcessMonsterDead (null == objsList || objsList.Count <= 0), CurrentCopyMapID={0}", monster.CurrentCopyMapID));
                return;
            }

            // 更新副本记录的状态
            if (copyMap.FubenMapID >= data.FuBenID)
            {
                data.FuBenID = copyMap.FubenMapID;
                data.State   = (int)GuildCopyMapState.Passed;
                if (copyMap.FubenMapID == GameManager.GuildCopyMapMgr.FirstGuildCopyMapOrder)
                {
                    data.Killers = monster.WhoKillMeName;
                }
                else
                {
                    data.Killers += ",";
                    data.Killers += monster.WhoKillMeName;
                }
            }

            // 检查是否更新成功
            bool result = GameManager.GuildCopyMapDBMgr.UpdateGuildCopyMapDB(data);

            if (false == result)
            {
                string logStr = @"GuildCopyMapManager::ProcessMonsterDead (false == result), 
                        data.GuildID={0}, data.FuBenID={1}, data.State={2}, data.OpenDay={3}, data.Killers={4}";
                LogManager.WriteLog(LogTypes.Error, string.Format(logStr, data.GuildID, data.FuBenID, data.State, data.OpenDay, data.Killers));
                return;
            }

            for (int i = 0; i < objsList.Count; i++)
            {
                //不在同一个地图上不参与分配
                GameClient gc = objsList[i];
                if (null == gc)
                {
                    continue;
                }

                // 准备发奖
                // 先检查上次领奖是不是本周~~
                int      nGuildCopyMapAwardDay = Global.GetRoleParamsInt32FromDB(gc, RoleParamName.GuildCopyMapAwardDay);
                DateTime AwardTime             = Global.GetRealDate(nGuildCopyMapAwardDay);
                if (Global.BeginOfWeek(AwardTime) != Global.BeginOfWeek(DateTime.Now))
                {
                    // 不是这周领奖则重置玩家领奖记录
                    Global.SaveRoleParamsInt32ValueToDB(gc, RoleParamName.GuildCopyMapAwardFlag, 0, true);
                }

                int  nGuildCopyMapAwardFlag = Global.GetRoleParamsInt32FromDB(gc, RoleParamName.GuildCopyMapAwardFlag);
                bool flag = GetGuildCopyMapAwardDayFlag(nGuildCopyMapAwardFlag, GetGuildCopyMapIndex(monster.CopyMapID), 1);
                // 领取过了
                if (flag == true)
                {
                    continue;
                }

                nGuildCopyMapAwardFlag = SetGuildCopyMapAwardDayFlag(nGuildCopyMapAwardFlag, GetGuildCopyMapIndex(monster.CopyMapID), 1);
                Global.SaveRoleParamsInt32ValueToDB(gc, RoleParamName.GuildCopyMapAwardFlag, nGuildCopyMapAwardFlag, true);
                Global.SaveRoleParamsInt32ValueToDB(gc, RoleParamName.GuildCopyMapAwardDay, Global.GetOffsetDay(DateTime.Now), true);
                // 发奖

                Global.SaveRoleParamsInt32ValueToDB(gc, RoleParamName.GuildZhanGong, Global.GetRoleParamsInt32FromDB(gc, RoleParamName.GuildZhanGong) + fuBenMapItem.nZhanGongaward, true);
                GameManager.ClientMgr.NotifySelfParamsValueChange(gc, RoleCommonUseIntParamsIndexs.ZhanGong, fuBenMapItem.nZhanGongaward);
            }
        }
Exemplo n.º 11
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);
        }
Exemplo n.º 12
0
        public static int GetFuBenMaxTimeSecs(int fuBenId)
        {
            SystemXmlItem copyItem = null;
            FuBenMapItem  mapItem  = null;
            int           result;

            if (!GameManager.systemFuBenMgr.SystemXmlItemDict.TryGetValue(fuBenId, out copyItem) || (mapItem = FuBenManager.FindMapCodeByFuBenID(fuBenId, copyItem.GetIntValue("MapCode", -1))) == null)
            {
                result = 15;
            }
            else
            {
                result = mapItem.MaxTime * 60;
            }
            return(result);
        }