活动:添加新任务类型

This commit is contained in:
qiaoxin
2021-05-29 17:15:26 +08:00
parent a1064512c3
commit b075dcfcd4
6 changed files with 18 additions and 7 deletions

View File

@@ -14,7 +14,7 @@ export default class Activity_Treasure_Hunt_Shop extends ActivityShop {
dayIndex: number; // 第几天
//根据活动id查询活动数据
public static async findTreasureData(_serverId: number, activityId: number, roleId: string, roundIndex: number, dayIndex: number) {
public static async findTreasureData(activityId: number, roleId: string, roundIndex: number, dayIndex: number) {
let result: ActivityTreasureHuntShopModelType = await ActivityTreasureHuntShopModel.findOne({ roleId, activityId, roundIndex, dayIndex }).lean(true);
return result;
}

View File

@@ -117,7 +117,7 @@ export class GrowthData extends ActivityBase {
//解析玩家领取记录
public async setPlayerRecords(data: ActivityGrowthModelType[], roleId: string, userHeroes: HeroType[]) {
let { heroNum } = await RoleModel.findByRoleId(roleId);
let { heroNum, towerLv } = await RoleModel.findByRoleId(roleId);
for (let obj of this.list) {
let index = data.findIndex(record => { return obj.dayIndex == record.dayIndex && obj.cellIndex == record.cellIndex })
if (index != -1) {
@@ -130,6 +130,8 @@ export class GrowthData extends ActivityBase {
let lv = obj.taskParamArray[1];
let heroes = userHeroes.filter(hero => { return hero.lv >= lv })
obj.totalCount = heroes.length;
} else if (obj.taskType === TASK_TYPE.BATTLE_TOWER_LV) {
obj.totalCount = towerLv;
}
}
}

View File

@@ -63,7 +63,7 @@ export class TreasureHuntShopData {
return;
}
for (let item of this.list) {
let buyRecords = record.records.filter(obj => { obj.id === item.cellIndex });
let buyRecords = record.records.filter(obj => { return obj.id === item.cellIndex });
item.buyCount = buyRecords.length;
}
}

View File

@@ -696,7 +696,7 @@ export function isComplete(roleId: string, taskType: TASK_TYPE, taskParam: strin
break;
case TASK_TYPE.BATTLE_MAIN:
addCount = param[0] == paramObj.warId ? 1 : 0;
addCount = (param[1] == paramObj.warId) ? 1 : 0;
break;
case TASK_TYPE.EQUIP_JEWEL_SUM:
addCount = count;
@@ -794,6 +794,11 @@ export function isComplete(roleId: string, taskType: TASK_TYPE, taskParam: strin
addCount = count;
break;
}
case TASK_TYPE.BATTLE_TOWER_LV://{towerLv}
{
addCount = paramObj.towerLv;
break;
}
default:
addCount = 0;
break;