Пример #1
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, "【元素试炼】清场调度异常");
            }
        }
Пример #2
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, "【元素试炼】清场调度异常");
     }
 }