コード例 #1
0
ファイル: CopyWolfManager.cs プロジェクト: chenchungit/ky
        /// <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, "【狼魂要塞】清场调度异常");
            }
        }
コード例 #2
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, "【狼魂要塞】清场调度异常");
     }
 }