pvp:添加PVP任务

This commit is contained in:
luying
2021-10-29 12:03:16 +08:00
parent 2cf5895c52
commit 0d0855d312
9 changed files with 120 additions and 9 deletions

View File

@@ -246,6 +246,22 @@ export async function getAchievement(roleId: string, userTask: UserTaskType) {
return { point, taskList, box }
}
export async function getPvpTask(roleId: string) {
let type = TASK_FUN_TYPE.PVP;
let recMap = await UserTaskRecModel.findByRoleAndType(roleId, type); // group=>userTaskRec
let taskList: TaskListReturn[] = [];
for (let [id, dic] of gameData.pvpDailyTask) {
let dbRec = recMap.get(dic.taskType)?.get(dic.group);
if (dbRec) {
taskList.push({ type, id, count: dbRec.count, received: dbRec.received.includes(id) });
} else {
taskList.push({ type, id, count: 0, received: false });
}
}
return { taskList }
}
// 刷新每日任务
export async function refDailyTask(roleId: string, sid: string) {
let userTask = await UserTaskModel.findByRole(roleId);