任务:添加任务类型
This commit is contained in:
@@ -107,6 +107,17 @@ export async function checkTaskInGuildTrain(serverId: number, roleId: string, si
|
||||
await task.saveAndPush(sid);
|
||||
}
|
||||
|
||||
export async function checkTaskInBattleStart(serverId: number, roleId: string, sid: string, warId: number) {
|
||||
let task = new CheckTask(serverId, roleId);
|
||||
task.setParam(TASK_TYPE.BATTLE_MAIN_START, { warId, count: 1 });
|
||||
task.setParam(TASK_TYPE.BATTLE_TOWER_START, { warId, count: 1 });
|
||||
task.setParam(TASK_TYPE.BATTLE_VESTIGE_START, { warId, count: 1 });
|
||||
task.setParam(TASK_TYPE.BATTLE_DAILY_START, { warId, count: 1 });
|
||||
task.setParam(TASK_TYPE.BATTLE_EXPEDITION_START, { warId, count: 1 });
|
||||
task.setParam(TASK_TYPE.BATTLE_DUNGEON_START, { warId, count: 1 });
|
||||
await task.saveAndPush(sid);
|
||||
}
|
||||
|
||||
/**
|
||||
* battle.normalBattleHandler.battleEnd 中会触发的任务,因为有点多提出来了
|
||||
*/
|
||||
@@ -131,6 +142,14 @@ export async function checkTaskInGuildTrain(serverId: number, roleId: string, si
|
||||
}
|
||||
}
|
||||
|
||||
export async function checkTaskInSkipTower(serverId: number, roleId: string, sid: string, towerLv: number) {
|
||||
let task = new CheckTask(serverId, roleId);
|
||||
task.setParam(TASK_TYPE.BATTLE_TOWER_LV, { towerLv: towerLv - 1 });
|
||||
task.setParam(TASK_TYPE.BATTLE_TOWER_START, { skipTower: true });
|
||||
task.setParam(TASK_TYPE.BATTLE_TOWER, { skipTower: true });
|
||||
await task.saveAndPush(sid);
|
||||
}
|
||||
|
||||
|
||||
export async function checkTaskInBattleSweep(serverId: number, roleId: string, sid: string, warId: number, count: number) {
|
||||
let task = new CheckTask(serverId, roleId);
|
||||
@@ -165,6 +184,23 @@ export async function checkTaskInComBattleStart(roleStatus: RoleStatus[], capId:
|
||||
}
|
||||
}
|
||||
|
||||
export async function checkTaskInComBattleEnd(roleStatus: RoleStatus[], capId: string) {
|
||||
for (let { roleId, isRobot } of roleStatus) {
|
||||
if (!isRobot) {
|
||||
let role = await RoleModel.findByRoleId(roleId);
|
||||
let task = new CheckTask(role.serverId, roleId);
|
||||
task.setRole(role);
|
||||
if (roleId == capId && roleStatus.length > 1) { // 招募队友
|
||||
task.setParam(TASK_TYPE.COM_BATTLE_CREATE_TEAM_WIN, {});
|
||||
} else if (roleId !== capId) { // 协助寻宝
|
||||
task.setParam(TASK_TYPE.COM_BATTLE_ASSIST_TEAM_WIN, {});
|
||||
}
|
||||
task.setParam(TASK_TYPE.COM_BATTLE_WIN, {});
|
||||
await task.saveAndPush();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export async function checkTaskInPvpEnd(serverId: number, roleId: string, sid: string, isSuccess: boolean, heroScores: HeroScores[], myRank: number) {
|
||||
let task = new CheckTask(serverId, roleId);
|
||||
task.setParam(TASK_TYPE.PVP_WIN, { isSuccess });
|
||||
|
||||
Reference in New Issue
Block a user