任务:修复每日任务未正确开启bug
This commit is contained in:
@@ -310,20 +310,24 @@ export async function checkTaskWithGoods(roleId: string, taskType: number, goods
|
||||
export async function checkTask(roleId: string, taskType: number, count: number, isInc: boolean, param: TaskParam, funcs?: number[]) {
|
||||
let tasks = gameData.taskType.get(taskType)||[];
|
||||
let pushMessage = new Array<TaskListReturn>();
|
||||
let groups = new Map<number, { task0: DicTask, tasks: DicTask[] }>();
|
||||
let groups = new Map<string, { task0: DicTask, tasks: DicTask[] }>();
|
||||
for(let dicTask of tasks) {
|
||||
if(!groups.has(dicTask.group)) {
|
||||
groups.set(dicTask.group, { task0: dicTask, tasks: new Array<DicTask>() });
|
||||
if(!groups.has(`${dicTask.type}_${dicTask.group}`)) {
|
||||
groups.set(`${dicTask.type}_${dicTask.group}`, { task0: dicTask, tasks: new Array<DicTask>() });
|
||||
}
|
||||
groups.get(dicTask.group).tasks.push(dicTask);
|
||||
groups.get(`${dicTask.type}_${dicTask.group}`).tasks.push(dicTask);
|
||||
}
|
||||
if(!funcs) {
|
||||
let role = await RoleModel.findByRoleId(roleId, 'funcs');
|
||||
funcs = role.funcs||[];
|
||||
}
|
||||
|
||||
for(let [ group, { task0, tasks } ] of groups) {
|
||||
let rec = await checkTaskRec(roleId, group, task0, count, isInc, param, funcs);
|
||||
for(let [ typeAndGroup, { task0, tasks } ] of groups) {
|
||||
let arr = typeAndGroup.split('_');
|
||||
let type = parseInt(arr[0]);
|
||||
let group = parseInt(arr[1]);
|
||||
|
||||
let rec = await checkTaskRec(roleId, type, group, task0, count, isInc, param, funcs);
|
||||
if(rec) {
|
||||
for(let dicTask of tasks) {
|
||||
if(checkRecResult(rec, dicTask.id, dicTask.condition)) {
|
||||
@@ -337,8 +341,8 @@ export async function checkTask(roleId: string, taskType: number, count: number,
|
||||
}
|
||||
|
||||
// 检查各项任务是否达成,达成了就保存到数据库
|
||||
export async function checkTaskRec(roleId: string, group: number, dicTask: DicTask, count: number, isInc: boolean, param: TaskParam, funcs: number[] ) {
|
||||
let { type, taskParam, taskType } = dicTask;
|
||||
export async function checkTaskRec(roleId: string, type: number, group: number, dicTask: DicTask, count: number, isInc: boolean, param: TaskParam, funcs: number[] ) {
|
||||
let { taskParam, taskType } = dicTask;
|
||||
|
||||
let sp = [TASK_TYPE.LOGIN_SUM, TASK_TYPE.LOGIN_SERIES];
|
||||
if(type == TASK_FUN_TYPE.DAILY && funcs.indexOf(FUNCS_ID.DAILY_TASK) == -1 && sp.indexOf(taskType) == -1) { // 功能未开启
|
||||
|
||||
Reference in New Issue
Block a user