travian/src/Task/BalanceHeroResourcesTask.ts
Anton Vakhrushev 2d9c3f94e7 Rewrite hero resource action
try to detect hero village before balancing
2020-04-11 13:46:10 +03:00

25 lines
1005 B
TypeScript

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 { BalanceHeroResourcesAction } from '../Action/BalanceHeroResourcesAction';
import { path } from '../utils';
import { GoToHeroVillageAction } from '../Action/GoToHeroVillageAction';
@registerTask
export class BalanceHeroResourcesTask extends TaskController {
async run(task: Task) {
const args: Args = { ...task.args, taskId: task.id };
this.scheduler.scheduleActions([
new Command(GoToPageAction.name, {
...args,
path: path('/hero.php'),
}),
new Command(GoToHeroVillageAction.name, args),
new Command(BalanceHeroResourcesAction.name, args),
new Command(CompleteTaskAction.name, args),
]);
}
}