示例#1
0
        /// <summary>
        /// 取当前用户所占位置的战斗过程,位置从0开始
        /// </summary>
        /// <returns></returns>
        public TeamCombatResult GetCombatProcess(int teamId)
        {
            var combatResult = new TeamCombatResult();

            if (_combatProcessList != null && _combatProcessList.ContainsKey(teamId))
            {
                var processList = _combatProcessList[teamId];
                combatResult.IsWin = processList.IsWin;
                int[] posList = new int[2];
                int   pos     = TeamPos(teamId);
                if (ConfigPos.GetLength(0) > pos)
                {
                    for (int i = 0; i < posList.Length; i++)
                    {
                        posList[i] = ConfigPos[pos, i] - 1;
                    }
                }
                combatResult.ProcessList = processList.ProcessList.FindAll(m => m.UserId.Equals(_userId) ||
                                                                           (!m.UserId.Equals(_userId) && (m.Position == posList[0] || m.Position == posList[1])));
                //foreach (var process in combatResult.ProcessList)
                //{
                //    Trace.WriteLine(string.Format("多人副本>>{0}打{1}位置{2}结果{3}", process.ProcessContainer.DefenseList.Count,
                //    process.PlotNpcID, process.Position, process.IsWin));
                //}
                //Trace.WriteLine(string.Format("多人副本>>{0}", combatResult.IsWin));
                if (_userList != null && _userList.ContainsKey(_userId))
                {
                    _userList.Remove(_userId);
                }
            }
            return(combatResult);
        }
示例#2
0
 private static void AppendLog(int teamId, TeamCombatProcess logTeam)
 {
     if (_combatProcessList != null)
     {
         if (!_combatProcessList.ContainsKey(teamId))
         {
             _combatProcessList.Add(teamId, new TeamCombatResult());
         }
         lock (ThisLock)
         {
             TeamCombatResult tempList = _combatProcessList[teamId];
             tempList.ProcessList.Add(logTeam);
         }
         UserCombatLog log = new UserCombatLog
         {
             CombatLogID   = Guid.NewGuid().ToString(),
             CombatType    = CombatType.MultiPlot,
             UserID        = logTeam.UserId,
             PlotID        = logTeam.PlotID,
             NpcID         = logTeam.PlotNpcID,
             HostileUser   = logTeam.TeamID.ToString(),
             IsWin         = logTeam.IsWin,
             CombatProcess = JsonUtils.Serialize(logTeam.ProcessContainer),
             CreateDate    = DateTime.Now
         };
         var sender = DataSyncManager.GetDataSender();
         sender.Send(log);
     }
 }
示例#3
0
 private static void SetCombatResult(int teamId, bool isWin)
 {
     if (_combatProcessList != null)
     {
         if (!_combatProcessList.ContainsKey(teamId))
         {
             _combatProcessList.TryAdd(teamId, new TeamCombatResult());
         }
         lock (ThisLock)
         {
             TeamCombatResult tempList = _combatProcessList[teamId];
             tempList.IsWin = isWin;
         }
     }
 }
示例#4
0
        public override bool TakeAction()
        {
            var plotTeam = new PlotTeamCombat(ContextUser);

            teamCombatResult = plotTeam.GetCombatProcess(teamID);
            teamPlot         = plotTeam.GetTeam(teamID);
            plotInfo         = new ConfigCacheSet <PlotInfo>().FindKey(plotID);

            if (teamCombatResult.IsWin)
            {
                //日常任务-多人副本
                TaskHelper.TriggerDailyTask(Uid, 4007);

                if (ContextUser.UserExtend != null && ContextUser.UserExtend.DailyInfo != null)
                {
                    if (ContextUser.UserExtend.DailyInfo.RefreshDate.Date == DateTime.Now.Date)
                    {
                        ContextUser.UserExtend.DailyInfo.MoreNum = MathUtils.Addition(ContextUser.UserExtend.DailyInfo.MoreNum, 1);
                    }
                    else
                    {
                        ContextUser.UserExtend.DailyInfo.RefreshDate = DateTime.Now;
                        ContextUser.UserExtend.DailyInfo.MoreNum     = 1;
                    }
                }
                else if (ContextUser.UserExtend != null)
                {
                    DailyRefresh dailyRefresh = new DailyRefresh();
                    dailyRefresh.RefreshDate         = DateTime.Now;
                    dailyRefresh.MoreNum             = 1;
                    ContextUser.UserExtend.DailyInfo = dailyRefresh;
                }
                //ContextUser.Update();
            }

            return(true);
        }