Add build building task

This commit is contained in:
2020-04-12 20:41:26 +03:00
parent 9d85d07ff5
commit 9fdc573746
8 changed files with 127 additions and 25 deletions

View File

@ -0,0 +1,28 @@
import { Args, Command } from '../Common';
import { BuildBuildingAction } from '../Action/BuildBuildingAction';
import { CheckBuildingRemainingTimeAction } from '../Action/CheckBuildingRemainingTimeAction';
import { CompleteTaskAction } from '../Action/CompleteTaskAction';
import { GoToPageAction } from '../Action/GoToPageAction';
import { path } from '../utils';
import { Task } from '../Storage/TaskQueue';
import { TaskController, registerTask } from './TaskController';
@registerTask
export class BuildBuildingTask extends TaskController {
async run(task: Task) {
const args: Args = { ...task.args, taskId: task.id };
this.scheduler.scheduleActions([
new Command(GoToPageAction.name, {
...args,
path: path('/dorf1.php', { newdid: args.villageId }),
}),
new Command(CheckBuildingRemainingTimeAction.name, args),
new Command(GoToPageAction.name, {
...args,
path: path('/build.php', { newdid: args.villageId, id: args.buildId, category: args.categoryId }),
}),
new Command(BuildBuildingAction.name, args),
new Command(CompleteTaskAction.name, args),
]);
}
}