sdk:屏蔽词库加载处修改

This commit is contained in:
luying
2021-11-19 14:48:32 +08:00
parent 015a3a311d
commit f57e7682a1
4 changed files with 13 additions and 8 deletions

View File

@@ -854,30 +854,30 @@ function parseDicParam() {
* group为如果两个任务除了condition以外的其他所有taskParam都是一样的他们的group相同
*/
function treatTaskGroup() {
console.log('****** treatTaskGroup')
let taskType2Desc = new Map<number, DicTaskType>();
for(let obj of gameData.taskTypeDesc) {
taskType2Desc.set(obj.id, obj);
}
let taskByGroup = new Map<number, { params: number[], ids: number[] }[]>(); // taskType => obj
let taskByGroup = new Map<number, { params: number[], ids: string[] }[]>(); // taskType => obj
for(let [taskType, tasks] of gameData.taskType) {
for(let obj of tasks) {
let dicTaskType = taskType2Desc.get(taskType);
let index = dicTaskType.param.split('&').indexOf(dicTaskType.condition);
console.log(index);
let params = obj.taskParam.filter((_, i) => index != i);
// console.log('params ', obj.id, obj.type, obj.taskType, obj.taskParam, obj.condition, params);
if(!taskByGroup.has(taskType)) {
taskByGroup.set(taskType, [{ params, ids: [obj.id]}]);
taskByGroup.set(taskType, [{ params, ids: [`${obj.type}${obj.id}`]}]);
} else {
let arr = taskByGroup.get(taskType)||[];
let hasGroup = arr.find(cur => {
return _.isEqual(cur.params, params);
});
if(hasGroup) {
hasGroup.ids.push(obj.id);
hasGroup.ids.push(`${obj.type}${obj.id}`);
} else {
arr.push({ params, ids: [obj.id] });
arr.push({ params, ids: [`${obj.type}${obj.id}`] });
}
taskByGroup.set(taskType, arr);
}
@@ -890,7 +890,7 @@ function treatTaskGroup() {
let group = i + 1;
let { ids } = arr[i];
for(let id of ids) {
let task = tasks.find(cur => cur.id == id);
let task = tasks.find(cur => `${cur.type}${cur.id}` == id);
if(task) task.group = group;
}
}