diff --git a/game-server/app/services/task/taskObj.ts b/game-server/app/services/task/taskObj.ts index 320ae75b2..dbab1a799 100644 --- a/game-server/app/services/task/taskObj.ts +++ b/game-server/app/services/task/taskObj.ts @@ -399,11 +399,10 @@ export class CheckSingleTask { case TASK_TYPE.HERO_QUALITY: // 7. 拥有x名初始x品质武将 { let { heroes } = param; - let records = await getRecord(); let num = 0; for(let { hid } of heroes) { let dicHero = gameData.hero.get(hid); - if(dicHero.quality == dicTaskParam[1]) { + if(dicHero.quality == dicTaskParam[1] ) { num ++; } } @@ -414,18 +413,25 @@ export class CheckSingleTask { { let { heroes, hero, oldStar } = param; if(param.heroes) { // 创建武将的时候 + let records = await getRecord(); let num = 0; for(let { hid, star } of heroes) { let dicHero = gameData.hero.get(hid); - if(dicHero.quality == dicTaskParam[1] && star == dicTaskParam[2]) { + if(dicHero.quality == dicTaskParam[1] && star == dicTaskParam[2] && records.indexOf(`${hid}`) == -1) { + records.push(`${hid}`); num ++; } } - result = { inc: num }; + result = { records, inc: num }; } else { // 武将升星的时候 - let dicHero = gameData.hero.get(hero.hid); - if(dicHero.quality == dicTaskParam[1] && hero.star >= dicTaskParam[2] && oldStar < dicTaskParam[2]) { - result = { inc: 1 } + let hid = hero.hid; + let dicHero = gameData.hero.get(hid); + if(dicHero.quality == dicTaskParam[1] && hero.star >= dicTaskParam[2] && oldStar < dicTaskParam[2] ) { + let records = await getRecord(); + if(records.indexOf(`${hid}`) == -1) { + records.push(`${hid}`); + result = { records, inc: 1 } + } } } break; @@ -861,7 +867,11 @@ export class CheckSingleTask { let { hero } = param; let dicHero = gameData.hero.get(hero.hid); if(dicHero.quality == dicTaskParam[1] && hero.quality == dicTaskParam[2]) { - result = { inc: 1 }; + let records = await getRecord(); + if(records.indexOf(`${hero.hid}`) == -1) { + records.push(`${hero.hid}`) + result = { records, inc: 1 }; + } } break; } @@ -870,7 +880,11 @@ export class CheckSingleTask { let { hero, oldColorStar } = param; let dicHero = gameData.hero.get(hero.hid); if(dicTaskParam[1] == dicHero.quality && oldColorStar == 0 && hero.colorStar > 0) { - result = { inc: 1 }; + let records = await getRecord(); + if(records.indexOf(`${hero.hid}`) == -1) { + records.push(`${hero.hid}`) + result = { records, inc: 1 }; + } } break; } @@ -878,7 +892,11 @@ export class CheckSingleTask { { let { hero, oldColorStar } = param; if(dicTaskParam[1] > oldColorStar && hero.colorStar >= dicTaskParam[1]) { - result = { inc: 1 }; + let records = await getRecord(); + if(records.indexOf(`${hero.hid}`) == -1) { + records.push(`${hero.hid}`) + result = { records, inc: 1 }; + } } break; } @@ -921,7 +939,11 @@ export class CheckSingleTask { { let { hero, oldColorStar } = param; if(oldColorStar == 0 && hero.colorStar > 0) { - result = { inc: 1 }; + let records = await getRecord(); + if(records.indexOf(`${hero.hid}`) == -1) { + records.push(`${hero.hid}`); + result = { records, inc: 1 }; + } } break; }