Exemple #1
0
        /// <summary>刺杀守护者</summary>
        /// <param name="watchlist">守护玩家列表</param>
        public bool KillWatch(List <Variable.UserTaskInfo> watchlist, Int64 userid)
        {
            var id = GetWatchId(watchlist);

            if (id == 0)
            {
                return(false);
            }
            var fightvo = UserChallenge(userid, id, FightType.ONE_SIDE);
            var watch   = Variable.WorkInfo.FirstOrDefault(m => m.userid == id);

            if (!Variable.OnlinePlayer.ContainsKey(id))
            {
                return(false);
            }
            var watchse = Variable.OnlinePlayer[id] as TGGSession;

            var kill = Variable.WorkInfo.FirstOrDefault(m => m.userid == userid);

            if (fightvo.isWin == false)
            {
                kill.KillState   = (int)TaskKillType.WIN;
                watch.WatchState = (int)TaskKillType.LOSE;
                WORK_FIGHT_PUSH.GetInstance().CommandStart(watchse, fightvo, (int)TaskWatchType.LOSE);
            }
            else
            {
                kill.KillState   = (int)TaskKillType.LOSE;
                kill.KillNpcid   = 0;
                watch.WatchNpcid = 0;
                WORK_FIGHT_PUSH.GetInstance().CommandStart(watchse, fightvo, (int)TaskWatchType.WIN);
            }
            return(true);
        }
Exemple #2
0
        /// <summary>任务结束</summary>
        public void WatchEnd(Int64 task_id)
        {
            var task = tg_task.FindByid(task_id);

            if (!Variable.OnlinePlayer.ContainsKey(task.user_id))
            {
                return;
            }
            var basetask = Variable.BASE_TASKVOCATION.FirstOrDefault(m => m.id == task.task_id);
            var watch    = Variable.WorkInfo.FirstOrDefault(m => m.userid == task.user_id);

            if (basetask == null || watch == null)
            {
                return;
            }
            task.task_step_data = basetask.stepCondition;
            task.task_state     = (int)TaskStateType.TYPE_REWARD;
            task.Update();

            watch.WatchNpcid = 0;
            watch.WatchState = 0;
            watch.P_State    = 0;
            (new Share.Work()).AdvancedWorkPush(task.user_id, task);
            var session = Variable.OnlinePlayer[task.user_id] as TGGSession;

            if (session == null)
            {
                return;
            }
            WORK_FIGHT_PUSH.GetInstance().CommandStart(session, null, (int)TaskWatchType.FINISH);
        }