Add auto training

This commit is contained in:
2020-04-04 12:13:28 +03:00
parent 7f5cdf2cc3
commit 4bf8161b70
9 changed files with 242 additions and 53 deletions

View File

@ -0,0 +1,18 @@
import { Args, Command } from '../Common';
import { Task } from '../Storage/TaskQueue';
import { TaskController, registerTask } from './TaskController';
import { GoToPageAction } from '../Action/GoToPageAction';
import { CompleteTaskAction } from '../Action/CompleteTaskAction';
import { TrainTrooperAction } from '../Action/TrainTrooperAction';
@registerTask
export class TrainTroopTask extends TaskController {
async run(task: Task) {
const args: Args = { ...task.cmd.args, taskId: task.id };
this.scheduler.scheduleActions([
new Command(GoToPageAction.name, { ...args, path: '/build.php?id=' + args.buildId }),
new Command(TrainTrooperAction.name, args),
new Command(CompleteTaskAction.name, args),
]);
}
}