任务:group读取方式修改

This commit is contained in:
luying
2021-11-20 10:48:34 +08:00
parent 59d48382fa
commit da8dca2f22
4 changed files with 15 additions and 16 deletions

View File

@@ -888,12 +888,11 @@ function treatTaskGroup() {
for(let [taskType, arr] of taskByGroup) {
let tasks = gameData.taskType.get(taskType);
for(let i = 0; i < arr.length; i++) {
let group = i + 1;
let { ids } = arr[i];
let { params, ids } = arr[i];
for(let id of ids) {
let task = tasks.find(cur => `${cur.type}_${cur.id}` == id);
task.group = group;
gameData.tasks.get(task.type).get(task.id).group = group;
task.group = params.join('&');
gameData.tasks.get(task.type).get(task.id).group = params.join('&');
}
}
gameData.taskType.set(taskType, tasks);

View File

@@ -12,7 +12,7 @@ interface DicTaskBase {
// 任务类型
readonly taskType: number;
// 类型下面的分组
group: number;
group: string;
// 任务参数
readonly taskParam: number[];
// 条件

View File

@@ -319,7 +319,7 @@ export async function checkTask(roleId: string, taskType: number, count: number,
for (let [typeAndGroup, { task0, tasks }] of groups) {
let arr = typeAndGroup.split('_');
let type = parseInt(arr[0]);
let group = parseInt(arr[1]);
let group = arr[1];
let rec = await checkTaskRec(roleId, type, group, task0, count, isInc, param);
if (rec) {
@@ -335,7 +335,7 @@ export async function checkTask(roleId: string, taskType: number, count: number,
}
// 检查各项任务是否达成,达成了就保存到数据库
export async function checkTaskRec(roleId: string, type: number, group: number, dicTask: DicTask, count: number, isInc: boolean, param: TaskParam) {
export async function checkTaskRec(roleId: string, type: number, group: string, dicTask: DicTask, count: number, isInc: boolean, param: TaskParam) {
let { taskParam, taskType } = dicTask;
let isMatch = true; // 条件是否满足