/// <summary> ///高级评定任务初始 /// </summary> /// <param name="taksinfo"></param> /// <returns></returns> public IEnumerable <tg_task> SpecialTasksInit(view_user_role_task taksinfo) { var entitytasks = new List <tg_task>(); var userid = taksinfo.user_id; var identify = taksinfo.role_identity; var basetask = Variable.BASE_TASKVOCATION.Where(q => q.type == 2 && q.vocation == taksinfo.player_vocation && Convert.ToInt32(q.identity) <= taksinfo.role_identity).ToList(); if (!basetask.Any()) { return(null); } var clonelist = new List <BaseTaskVocation>(); basetask.ForEach(q => clonelist.Add(q.CloneEntity())); lock (clonelist) { foreach (var item in clonelist) { var model = item.CloneEntity(); var step = model.stepInit; var steptype = model.stepType; var taskid = model.id; if (model.stepType == (int)TaskStepType.FIGHTING_CONTINUOUS || model.stepType == (int)TaskStepType.SEARCH_GOODS || model.stepType == (int)TaskStepType.ESCORT || model.stepType == (int)TaskStepType.RUMOR || model.stepType == (int)TaskStepType.FIRE || model.stepType == (int)TaskStepType.BREAK || model.stepType == (int)TaskStepType.SEll_WINE || model.stepType == (int)TaskStepType.ASSASSINATION || model.stepType == (int)TaskStepType.GUARD || model.stepType == (int)TaskStepType.ARREST_RUMOR || model.stepType == (int)TaskStepType.ARREST_FIRE || model.stepType == (int)TaskStepType.ARREST_BREAK || model.stepType == (int)TaskStepType.ARREST_SEll_WINE || model.stepType == (int)TaskStepType.STAND_GUARD) { var steptypelist = entitytasks.Select(q => q.task_step_type).ToList(); var randomtask = new Upgrade().RandomTask(steptypelist, clonelist, model.stepType); if (randomtask == null) { continue; } step = randomtask.stepInit; steptype = randomtask.stepType; taskid = randomtask.id; entitytasks.Add(new TGTask().BuildSpecialTask(step, steptype, taskid, userid, identify, (int)TaskType.VOCATION_TASK)); continue; } entitytasks.Add(new TGTask().BuildSpecialTask(step, steptype, taskid, userid, identify, (int)TaskType.VOCATION_TASK)); } clonelist.Clear(); } return(entitytasks); }
/// <summary> /// 推送在线玩家数据 /// </summary> /// <param name="usernewtasks"></param> /// <param name="newtasks"></param> private void GetTaskData(view_user_role_task usernewtasks, List <tg_task> newtasks) { var basetasks = Common.getInstance(). GetNewVocationTasks(usernewtasks.role_identity, usernewtasks.user_id, usernewtasks.player_vocation).ToList(); newtasks.AddRange(basetasks); var s_tasks = Common.getInstance().SpecialTasksInit(usernewtasks); if (s_tasks != null) { newtasks.AddRange(s_tasks); } }